Skip to content

Commit

Permalink
refactor: converted POJO classes to kotlin models.Fixes fossasia#2357
Browse files Browse the repository at this point in the history
  • Loading branch information
sriramr98 committed Mar 14, 2018
1 parent f1ffd12 commit 7c962b1
Show file tree
Hide file tree
Showing 65 changed files with 749 additions and 3,778 deletions.
6 changes: 6 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'realm-android'
apply plugin: 'kotlin-kapt'

def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"))
Expand Down Expand Up @@ -144,4 +146,8 @@ dependencies {

//Zoomable image view
compile 'com.github.chrisbanes:PhotoView:2.1.3'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@ public static String sortOrderSpeaker() {
switch (SharedPreferencesUtil.getInt(ConstantStrings.PREF_SORT_SPEAKER, 0)) {
case SORT_TYPE_FIRST:
//By NAME
return Speaker.NAME;
return Speaker.Companion.getNAME();
case SORT_TYPE_SECOND:
//By ORGANISATION
return Speaker.ORGANISATION;
return Speaker.Companion.getORGANISATION();
case SORT_TYPE_THIRD:
//By COUNTRY
return Speaker.COUNTRY;
return Speaker.Companion.getCOUNTRY();
default:
return Speaker.NAME;
return Speaker.Companion.getNAME();
}
}

public static String sortTypeSchedule() {
switch (SharedPreferencesUtil.getInt(ConstantStrings.PREF_SORT_SCHEDULE, 2)) {
case SORT_TYPE_FIRST:
//By TITLE
return Session.TITLE;
return Session.Companion.getTITLE();
case SORT_TYPE_SECOND:
//By TRACKS
return Session.TRACK;
return Session.Companion.getTRACK();
case SORT_TYPE_THIRD:
//By START_TIME
return Session.START_TIME;
return Session.Companion.getSTART_TIME();
default:
return Session.START_TIME;
return Session.Companion.getSTART_TIME();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public LiveData<Integer> changePassword(String newPassword) {
int id;
try {
id = JWTUtils.getIdentity(AuthUtil.getAuthorization());
compositeDisposable.add(APIClient.getOpenEventAPI().updateUser(User.builder().id(id).password(newPassword).build(), id)
compositeDisposable.add(APIClient.getOpenEventAPI().updateUser(User.Companion.builder().id(id).password(newPassword).build(), id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.flatMapCompletable(user -> RealmDataRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public LiveData<Integer> signUpUser(String email, String password) {
if (signUpResponse == null) {
signUpResponse = new MutableLiveData<>();
}
compositeDisposable.add(APIClient.getOpenEventAPI().signUp(User.builder().email(email).password(password).build())
compositeDisposable.add(APIClient.getOpenEventAPI().signUp(User.Companion.builder().email(email).password(password).build())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(user -> {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.fossasia.openevent.core.auth.model

data class ImageResponse ( var url: String )

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.fossasia.openevent.core.auth.model

data class Login(var email: String?, var password: String?)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.fossasia.openevent.core.auth.model

import com.fasterxml.jackson.databind.PropertyNamingStrategy
import com.fasterxml.jackson.databind.annotation.JsonNaming

@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy::class)
data class LoginResponse ( var accessToken: String? = null )

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.fossasia.openevent.core.auth.model

data class UploadImage(var data: String?)
Loading

0 comments on commit 7c962b1

Please sign in to comment.