From 0a7aaae79b27faddb52600886e65ea4a31f677a1 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 12 Mar 2018 18:51:14 +0530 Subject: [PATCH] feat: Move lombok to another module - Add kotlin support in main app - Move JSONAPI models to another module data - Update Realm and split using RealmModule - Convert preleminary classes to data classes - Balance classes of lombok and Kotlin within modules - Fix kotlin properties and tests - Add mockito extension inline for kotlin classes --- android/app/build.gradle | 23 ++-- .../openevent/config/StrategyRegistry.java | 102 ------------------ .../openevent/config/StrategyRegistry.kt | 73 +++++++++++++ .../config/strategies/HttpStrategy.java | 62 ----------- .../config/strategies/HttpStrategy.kt | 56 ++++++++++ .../config/strategies/LanguageStrategy.java | 28 ----- .../config/strategies/LanguageStrategy.kt | 20 ++++ .../config/strategies/LeakCanaryStrategy.java | 34 ------ .../config/strategies/LeakCanaryStrategy.kt | 31 ++++++ .../config/strategies/MapModuleStrategy.java | 25 ----- .../config/strategies/MapModuleStrategy.kt | 21 ++++ .../config/strategies/RealmStrategy.java | 2 + .../core/auth/LoginActivityViewModel.java | 7 +- .../core/auth/SignUpActivityViewModel.java | 9 +- .../core/auth/model/ImageResponse.java | 12 --- .../core/auth/model/ImageResponse.kt | 3 + .../openevent/core/auth/model/Login.java | 11 -- .../openevent/core/auth/model/Login.kt | 3 + .../core/auth/model/LoginResponse.java | 16 --- .../core/auth/model/LoginResponse.kt | 7 ++ .../core/auth/model/SignUpResponse.kt | 3 + .../core/auth/model/UploadImage.java | 10 -- .../openevent/core/auth/model/UploadImage.kt | 3 + .../core/bookmark/BookmarkStatus.java | 20 ---- .../openevent/core/bookmark/BookmarkStatus.kt | 14 +++ .../FacebookFeedFragmentViewModel.java | 7 +- .../core/feed/facebook/api/CommentItem.java | 53 --------- .../core/feed/facebook/api/CommentItem.kt | 17 +++ .../core/feed/facebook/api/Commenter.java | 11 -- .../core/feed/facebook/api/Commenter.kt | 10 ++ .../core/feed/facebook/api/Comments.java | 12 --- .../core/feed/facebook/api/Comments.kt | 3 + .../feed/facebook/api/FacebookPageId.java | 11 -- .../core/feed/facebook/api/FacebookPageId.kt | 6 ++ .../core/feed/facebook/api/Feed.java | 12 --- .../openevent/core/feed/facebook/api/Feed.kt | 3 + .../core/feed/facebook/api/FeedItem.java | 21 ---- .../core/feed/facebook/api/FeedItem.kt | 16 +++ .../core/feed/facebook/api/PostsResponse.kt | 3 + .../twitter/TwitterFeedFragmentViewModel.java | 7 +- .../core/feed/twitter/api/PostsResponse.kt | 3 + .../core/feed/twitter/api/TwitterFeed.java | 12 --- .../core/feed/twitter/api/TwitterFeed.kt | 3 + .../feed/twitter/api/TwitterFeedItem.java | 21 ---- .../core/feed/twitter/api/TwitterFeedItem.kt | 16 +++ .../core/schedule/EventDateStrings.kt | 3 + .../schedule/ScheduleFragmentViewModel.java | 10 +- .../core/search/SearchActivityViewModel.java | 16 ++- .../data/repository/RealmDataRepository.java | 63 ++++++++--- .../org.mockito.plugins.MockMaker | 1 + android/build.gradle | 8 +- android/data/.gitignore | 1 + android/data/build.gradle | 32 ++++++ android/{app => data}/lombok.config | 0 android/data/proguard-rules.pro | 21 ++++ android/data/src/main/AndroidManifest.xml | 2 + .../org/fossasia/openevent/config/Config.java | 0 .../openevent/config/ConfigStrategy.java | 0 .../config/ConfigStrategyHolder.java | 0 .../openevent/core/auth/model/User.java | 0 .../fossasia/openevent/data/DiscountCode.java | 0 .../org/fossasia/openevent/data/Event.java | 0 .../java/org/fossasia/openevent/data/FAQ.java | 5 - .../openevent/data/Microlocation.java | 0 .../fossasia/openevent/data/Notification.java | 0 .../org/fossasia/openevent/data/Session.java | 0 .../fossasia/openevent/data/SessionType.java | 0 .../org/fossasia/openevent/data/Speaker.java | 0 .../org/fossasia/openevent/data/Sponsor.java | 0 .../org/fossasia/openevent/data/Track.java | 0 .../openevent/data/extras/Copyright.java | 0 .../openevent/data/extras/EventDates.java | 0 .../openevent/data/extras/SocialLink.java | 0 .../openevent/data/extras/SpeakersCall.java | 0 .../openevent/data/module/DataModule.java | 7 ++ android/settings.gradle | 2 +- 76 files changed, 472 insertions(+), 541 deletions(-) delete mode 100644 android/app/src/main/java/org/fossasia/openevent/config/StrategyRegistry.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/config/StrategyRegistry.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/config/strategies/HttpStrategy.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/config/strategies/HttpStrategy.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/config/strategies/LanguageStrategy.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/config/strategies/LanguageStrategy.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/config/strategies/LeakCanaryStrategy.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/config/strategies/LeakCanaryStrategy.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/config/strategies/MapModuleStrategy.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/config/strategies/MapModuleStrategy.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/auth/model/ImageResponse.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/auth/model/ImageResponse.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/auth/model/Login.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/auth/model/Login.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/auth/model/LoginResponse.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/auth/model/LoginResponse.kt create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/auth/model/SignUpResponse.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/auth/model/UploadImage.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/auth/model/UploadImage.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/bookmark/BookmarkStatus.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/bookmark/BookmarkStatus.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/CommentItem.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/CommentItem.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Commenter.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Commenter.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Comments.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Comments.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FacebookPageId.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FacebookPageId.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Feed.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Feed.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FeedItem.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FeedItem.kt create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/PostsResponse.kt create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/PostsResponse.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeed.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeed.kt delete mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeedItem.java create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeedItem.kt create mode 100644 android/app/src/main/java/org/fossasia/openevent/core/schedule/EventDateStrings.kt create mode 100644 android/app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker create mode 100644 android/data/.gitignore create mode 100644 android/data/build.gradle rename android/{app => data}/lombok.config (100%) create mode 100644 android/data/proguard-rules.pro create mode 100644 android/data/src/main/AndroidManifest.xml rename android/{app => data}/src/main/java/org/fossasia/openevent/config/Config.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/config/ConfigStrategy.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/config/ConfigStrategyHolder.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/core/auth/model/User.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/DiscountCode.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/Event.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/FAQ.java (86%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/Microlocation.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/Notification.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/Session.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/SessionType.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/Speaker.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/Sponsor.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/Track.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/extras/Copyright.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/extras/EventDates.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/extras/SocialLink.java (100%) rename android/{app => data}/src/main/java/org/fossasia/openevent/data/extras/SpeakersCall.java (100%) create mode 100644 android/data/src/main/java/org/fossasia/openevent/data/module/DataModule.java diff --git a/android/app/build.gradle b/android/app/build.gradle index e1ef5a1a7..14460f701 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,4 +1,7 @@ apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-android-extensions' apply plugin: 'realm-android' def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim() @@ -8,8 +11,8 @@ def isTravis = "true" == System.getenv("TRAVIS") def preDexEnabled = "true" == System.getProperty("pre-dex", "true") android { - compileSdkVersion 27 - buildToolsVersion "27.0.3" + compileSdkVersion rootProject.sdkVersion + buildToolsVersion rootProject.buildTools dexOptions { // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false. @@ -22,8 +25,8 @@ android { defaultConfig { applicationId "org.fossasia.openevent" - minSdkVersion 16 - targetSdkVersion 27 + targetSdkVersion rootProject.sdkVersion + minSdkVersion rootProject.minSdkVersion versionCode 101 versionName "1.0.1" @@ -67,6 +70,10 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } + androidExtensions { + experimental = true + } + sourceSets.test.resources.srcDirs += ["src/main/assets"] } @@ -88,6 +95,10 @@ dependencies { implementation "com.android.support:customtabs:${SUPPORT_LIB_VERSION}" implementation "com.android.support:palette-v7:${SUPPORT_LIB_VERSION}" implementation 'com.android.support:multidex:1.0.2' + + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation project(':data') + implementation 'com.github.jasminb:jsonapi-converter:0.7' implementation 'com.squareup.retrofit2:retrofit:2.3.0' implementation 'com.squareup.retrofit2:converter-jackson:2.3.0' @@ -107,9 +118,7 @@ dependencies { implementation 'com.github.yalantis:ucrop:2.2.1' implementation 'io.reactivex.rxjava2:rxjava:2.1.3' implementation "android.arch.lifecycle:reactivestreams:1.0.0" - compileOnly "org.projectlombok:lombok:1.16.18" - annotationProcessor "org.projectlombok:lombok:1.16.18" - annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0' + kapt 'com.jakewharton:butterknife-compiler:8.6.0' // Googleplay Variant googleplayImplementation 'com.google.android.gms:play-services-maps:11.8.0' diff --git a/android/app/src/main/java/org/fossasia/openevent/config/StrategyRegistry.java b/android/app/src/main/java/org/fossasia/openevent/config/StrategyRegistry.java deleted file mode 100644 index 1690e3482..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/config/StrategyRegistry.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.fossasia.openevent.config; - -import org.fossasia.openevent.config.strategies.AppConfigStrategy; -import org.fossasia.openevent.config.strategies.EventBusStrategy; -import org.fossasia.openevent.config.strategies.HttpStrategy; -import org.fossasia.openevent.config.strategies.LanguageStrategy; -import org.fossasia.openevent.config.strategies.LeakCanaryStrategy; -import org.fossasia.openevent.config.strategies.MapModuleStrategy; -import org.fossasia.openevent.config.strategies.RealmStrategy; -import org.fossasia.openevent.config.strategies.TimberStrategy; -import org.fossasia.openevent.config.strategies.TimeConfigStrategy; - -import lombok.Setter; - -/** - * Project level configuration strategies holder singleton - * - * Holds all strategies and provides an interface to get singleton strategies or - * override the default strategy holder. Also sets the order and strategies in default - * holder which is then utilised by {@link AppConfigurer} to configure the application - */ -@Setter -public class StrategyRegistry { - - private static StrategyRegistry strategyRegistry; - private final ConfigStrategyHolder defaultHolder; - - private ConfigStrategyHolder strategyHolder; - - private HttpStrategy httpStrategy; - private LanguageStrategy languageStrategy; - private LeakCanaryStrategy leakCanaryStrategy; - private EventBusStrategy eventBusStrategy; - private MapModuleStrategy mapModuleStrategy; - private AppConfigStrategy appConfigStrategy; - - private StrategyRegistry() { - // Prevent anyone from creating a new instance - defaultHolder = new ConfigStrategyHolder(); - } - - public static StrategyRegistry getInstance() { - if (strategyRegistry == null) - strategyRegistry = new StrategyRegistry(); - - return strategyRegistry; - } - - public HttpStrategy getHttpStrategy() { - if (httpStrategy == null) - httpStrategy = new HttpStrategy(); - - return httpStrategy; - } - - public LeakCanaryStrategy getLeakCanaryStrategy() { - if (leakCanaryStrategy == null) - leakCanaryStrategy = new LeakCanaryStrategy(); - return leakCanaryStrategy; - } - - public LanguageStrategy getLanguageStrategy() { - if (languageStrategy == null) - languageStrategy = new LanguageStrategy(); - - return languageStrategy; - } - - public EventBusStrategy getEventBusStrategy() { - if (eventBusStrategy == null) - eventBusStrategy = new EventBusStrategy(); - return eventBusStrategy; - } - - public MapModuleStrategy getMapModuleStrategy() { - if (mapModuleStrategy == null) - mapModuleStrategy = new MapModuleStrategy(); - return mapModuleStrategy; - } - - public AppConfigStrategy getAppConfigStrategy() { - if (appConfigStrategy == null) - appConfigStrategy = new AppConfigStrategy(); - return appConfigStrategy; - } - - public ConfigStrategyHolder getDefaultHolder() { - if (strategyHolder != null) - return strategyHolder; - defaultHolder.register(getLeakCanaryStrategy()); - defaultHolder.register(getHttpStrategy()); - defaultHolder.register(getEventBusStrategy()); - defaultHolder.register(getMapModuleStrategy()); - defaultHolder.register(getAppConfigStrategy()); - defaultHolder.register(getLanguageStrategy()); - defaultHolder.register(new TimberStrategy()); - defaultHolder.register(new TimeConfigStrategy()); - defaultHolder.register(new RealmStrategy()); - return defaultHolder; - } - -} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/StrategyRegistry.kt b/android/app/src/main/java/org/fossasia/openevent/config/StrategyRegistry.kt new file mode 100644 index 000000000..68ba0da01 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/config/StrategyRegistry.kt @@ -0,0 +1,73 @@ +package org.fossasia.openevent.config + +import org.fossasia.openevent.config.strategies.* + +/** + * Project level configuration strategies holder singleton + * + * Holds all strategies and provides an interface to get singleton strategies or + * override the default strategy holder. Also sets the order and strategies in default + * holder which is then utilised by [AppConfigurer] to configure the application + */ +class StrategyRegistry private constructor() { + private val defaultHolder: ConfigStrategyHolder = ConfigStrategyHolder() + + var strategyHolder: ConfigStrategyHolder? = null + + private fun lazyInit(field: T?, initializer: () -> T): T { + return field ?: initializer() + } + + var httpStrategy: HttpStrategy? = null + get() { + field = lazyInit(field) { HttpStrategy() } + return field + } + var languageStrategy: LanguageStrategy? = null + get() { + field = lazyInit(field) { LanguageStrategy() } + return field + } + var leakCanaryStrategy: LeakCanaryStrategy? = null + get() { + field = lazyInit(field) { LeakCanaryStrategy() } + return field + } + var eventBusStrategy: EventBusStrategy? = null + get() { + field = lazyInit(field) { EventBusStrategy() } + return field + } + var mapModuleStrategy: MapModuleStrategy? = null + get() { + field = lazyInit(field) { MapModuleStrategy() } + return field + } + var appConfigStrategy: AppConfigStrategy? = null + get() { + field = lazyInit(field) { AppConfigStrategy() } + return field + } + + + fun getDefaultHolder(): ConfigStrategyHolder { + if (strategyHolder != null) + return strategyHolder as ConfigStrategyHolder + defaultHolder.register(leakCanaryStrategy) + defaultHolder.register(httpStrategy) + defaultHolder.register(eventBusStrategy) + defaultHolder.register(mapModuleStrategy) + defaultHolder.register(appConfigStrategy) + defaultHolder.register(languageStrategy) + defaultHolder.register(TimberStrategy()) + defaultHolder.register(TimeConfigStrategy()) + defaultHolder.register(RealmStrategy()) + return defaultHolder + } + + companion object { + @JvmStatic + val instance by lazy { StrategyRegistry() } + } + +} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/strategies/HttpStrategy.java b/android/app/src/main/java/org/fossasia/openevent/config/strategies/HttpStrategy.java deleted file mode 100644 index c881fe64d..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/config/strategies/HttpStrategy.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.fossasia.openevent.config.strategies; - -import android.content.Context; - -import com.facebook.stetho.Stetho; -import com.facebook.stetho.okhttp3.StethoInterceptor; -import com.jakewharton.picasso.OkHttp3Downloader; -import com.squareup.picasso.Picasso; -import com.uphyca.stetho_realm.RealmInspectorModulesProvider; - -import org.fossasia.openevent.BuildConfig; -import org.fossasia.openevent.config.ConfigStrategy; - -import java.io.File; - -import lombok.Getter; -import okhttp3.Cache; -import okhttp3.OkHttpClient; - -/** - * Configures Http Cache and stetho plugin and sets picasso to use the configured client - * - * Also provides an interface for application to use Picasso with cache - * To be used via {@link org.fossasia.openevent.config.StrategyRegistry} - */ -@Getter -public class HttpStrategy implements ConfigStrategy { - - private Picasso picassoWithCache; - - @Override - public boolean configure(Context context) { - //Initialize Cache - File httpCacheDirectory = new File(context.getCacheDir(), "picasso-cache"); - Cache cache = new Cache(httpCacheDirectory, 15 * 1024 * 1024); - - OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder().cache(cache); - - if (BuildConfig.DEBUG) { - // Create an InitializerBuilder - Stetho.initialize( - Stetho.newInitializerBuilder(context) - .enableDumpapp(Stetho.defaultDumperPluginsProvider(context)) - .enableWebKitInspector(RealmInspectorModulesProvider.builder(context).build()) - .build()); - - //Initialize Stetho Interceptor into OkHttp client - OkHttpClient httpClient = new OkHttpClient.Builder().addNetworkInterceptor(new StethoInterceptor()).build(); - okHttpClientBuilder = okHttpClientBuilder.addNetworkInterceptor(new StethoInterceptor()); - - //Initialize Picasso - Picasso picasso = new Picasso.Builder(context).downloader(new OkHttp3Downloader(httpClient)).build(); - Picasso.setSingletonInstance(picasso); - } - - //Initialize Picasso with cache - picassoWithCache = new Picasso.Builder(context).downloader(new OkHttp3Downloader(okHttpClientBuilder.build())).build(); - - return false; - } - -} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/strategies/HttpStrategy.kt b/android/app/src/main/java/org/fossasia/openevent/config/strategies/HttpStrategy.kt new file mode 100644 index 000000000..2baf05780 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/config/strategies/HttpStrategy.kt @@ -0,0 +1,56 @@ +package org.fossasia.openevent.config.strategies + +import android.content.Context +import com.facebook.stetho.Stetho +import com.facebook.stetho.okhttp3.StethoInterceptor +import com.jakewharton.picasso.OkHttp3Downloader +import com.squareup.picasso.Picasso +import com.uphyca.stetho_realm.RealmInspectorModulesProvider +import okhttp3.Cache +import okhttp3.OkHttpClient +import org.fossasia.openevent.BuildConfig +import org.fossasia.openevent.config.ConfigStrategy +import java.io.File + +/** + * Configures Http Cache and stetho plugin and sets picasso to use the configured client + * + * Also provides an interface for application to use Picasso with cache + * To be used via [org.fossasia.openevent.config.StrategyRegistry] + */ +class HttpStrategy : ConfigStrategy { + + lateinit var picassoWithCache: Picasso + private set + + override fun configure(context: Context): Boolean { + //Initialize Cache + val httpCacheDirectory = File(context.cacheDir, "picasso-cache") + val cache = Cache(httpCacheDirectory, (15 * 1024 * 1024).toLong()) + + val okHttpClientBuilder: OkHttpClient.Builder = OkHttpClient.Builder().cache(cache) + + if (BuildConfig.DEBUG) { + // Create an InitializerBuilder + Stetho.initialize( + Stetho.newInitializerBuilder(context) + .enableDumpapp(Stetho.defaultDumperPluginsProvider(context)) + .enableWebKitInspector(RealmInspectorModulesProvider.builder(context).build()) + .build()) + + //Initialize Stetho Interceptor into OkHttp client + val httpClient = OkHttpClient.Builder().addNetworkInterceptor(StethoInterceptor()).build() + okHttpClientBuilder.addNetworkInterceptor(StethoInterceptor()) + + //Initialize Picasso + val picasso = Picasso.Builder(context).downloader(OkHttp3Downloader(httpClient)).build() + Picasso.setSingletonInstance(picasso) + } + + //Initialize Picasso with cache + picassoWithCache = Picasso.Builder(context).downloader(OkHttp3Downloader(okHttpClientBuilder.build())).build() + + return false + } + +} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/strategies/LanguageStrategy.java b/android/app/src/main/java/org/fossasia/openevent/config/strategies/LanguageStrategy.java deleted file mode 100644 index a9a364127..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/config/strategies/LanguageStrategy.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.fossasia.openevent.config.strategies; - -import android.content.Context; - -import org.fossasia.openevent.config.ConfigStrategy; - -import java.util.Locale; - -import lombok.Getter; -import lombok.Setter; - -/** - * Sets and provides default system language - * To be used via {@link org.fossasia.openevent.config.StrategyRegistry} - */ -@Setter -@Getter -public class LanguageStrategy implements ConfigStrategy { - - private String defaultSystemLanguage; - - @Override - public boolean configure(Context context) { - defaultSystemLanguage = Locale.getDefault().getDisplayLanguage(); - return false; - } - -} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/strategies/LanguageStrategy.kt b/android/app/src/main/java/org/fossasia/openevent/config/strategies/LanguageStrategy.kt new file mode 100644 index 000000000..1e52a6bc9 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/config/strategies/LanguageStrategy.kt @@ -0,0 +1,20 @@ +package org.fossasia.openevent.config.strategies + +import android.content.Context +import org.fossasia.openevent.config.ConfigStrategy +import java.util.* + +/** + * Sets and provides default system language + * To be used via [org.fossasia.openevent.config.StrategyRegistry] + */ +class LanguageStrategy : ConfigStrategy { + + var defaultSystemLanguage: String? = null + + override fun configure(context: Context): Boolean { + defaultSystemLanguage = Locale.getDefault().displayLanguage + return false + } + +} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/strategies/LeakCanaryStrategy.java b/android/app/src/main/java/org/fossasia/openevent/config/strategies/LeakCanaryStrategy.java deleted file mode 100644 index 06f8e65a2..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/config/strategies/LeakCanaryStrategy.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.fossasia.openevent.config.strategies; - -import android.content.Context; - -import com.squareup.leakcanary.LeakCanary; -import com.squareup.leakcanary.RefWatcher; - -import org.fossasia.openevent.OpenEventApp; -import org.fossasia.openevent.config.ConfigStrategy; - -import lombok.Getter; - -/** - * Configures and provides Leak Canary Reference Watcher - * To be used via {@link org.fossasia.openevent.config.StrategyRegistry} - */ -@Getter -public class LeakCanaryStrategy implements ConfigStrategy { - - private RefWatcher refWatcher; - - @Override - public boolean configure(Context context) { - if (LeakCanary.isInAnalyzerProcess(context)) { - // This process is dedicated to LeakCanary for heap analysis. - // You should not init your app in this process. - return true; - } - refWatcher = LeakCanary.install((OpenEventApp) context); - - return false; - } - -} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/strategies/LeakCanaryStrategy.kt b/android/app/src/main/java/org/fossasia/openevent/config/strategies/LeakCanaryStrategy.kt new file mode 100644 index 000000000..f2c8eb8b3 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/config/strategies/LeakCanaryStrategy.kt @@ -0,0 +1,31 @@ +package org.fossasia.openevent.config.strategies + +import android.content.Context + +import com.squareup.leakcanary.LeakCanary +import com.squareup.leakcanary.RefWatcher + +import org.fossasia.openevent.OpenEventApp +import org.fossasia.openevent.config.ConfigStrategy + +/** + * Configures and provides Leak Canary Reference Watcher + * To be used via [org.fossasia.openevent.config.StrategyRegistry] + */ +class LeakCanaryStrategy : ConfigStrategy { + + var refWatcher: RefWatcher? = null + private set + + override fun configure(context: Context): Boolean { + if (LeakCanary.isInAnalyzerProcess(context)) { + // This process is dedicated to LeakCanary for heap analysis. + // You should not init your app in this process. + return true + } + refWatcher = LeakCanary.install(context as OpenEventApp) + + return false + } + +} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/strategies/MapModuleStrategy.java b/android/app/src/main/java/org/fossasia/openevent/config/strategies/MapModuleStrategy.java deleted file mode 100644 index 2a4f05e39..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/config/strategies/MapModuleStrategy.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.fossasia.openevent.config.strategies; - -import android.content.Context; - -import org.fossasia.openevent.config.ConfigStrategy; -import org.fossasia.openevent.core.location.modules.MapModuleFactory; - -import lombok.Getter; - -/** - * Configures and provides Map Module Factory to switch map implementations between flavours - * To be used via {@link org.fossasia.openevent.config.StrategyRegistry} - */ -@Getter -public class MapModuleStrategy implements ConfigStrategy { - - private MapModuleFactory mapModuleFactory; - - @Override - public boolean configure(Context context) { - mapModuleFactory = new MapModuleFactory(); - return false; - } - -} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/strategies/MapModuleStrategy.kt b/android/app/src/main/java/org/fossasia/openevent/config/strategies/MapModuleStrategy.kt new file mode 100644 index 000000000..4de03bd06 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/config/strategies/MapModuleStrategy.kt @@ -0,0 +1,21 @@ +package org.fossasia.openevent.config.strategies + +import android.content.Context +import org.fossasia.openevent.config.ConfigStrategy +import org.fossasia.openevent.core.location.modules.MapModuleFactory + +/** + * Configures and provides Map Module Factory to switch map implementations between flavours + * To be used via [org.fossasia.openevent.config.StrategyRegistry] + */ +class MapModuleStrategy : ConfigStrategy { + + var mapModuleFactory: MapModuleFactory? = null + private set + + override fun configure(context: Context): Boolean { + mapModuleFactory = MapModuleFactory() + return false + } + +} diff --git a/android/app/src/main/java/org/fossasia/openevent/config/strategies/RealmStrategy.java b/android/app/src/main/java/org/fossasia/openevent/config/strategies/RealmStrategy.java index 837f37dfc..23383f43a 100644 --- a/android/app/src/main/java/org/fossasia/openevent/config/strategies/RealmStrategy.java +++ b/android/app/src/main/java/org/fossasia/openevent/config/strategies/RealmStrategy.java @@ -3,6 +3,7 @@ import android.content.Context; import org.fossasia.openevent.config.ConfigStrategy; +import org.fossasia.openevent.data.module.DataModule; import org.fossasia.openevent.data.repository.RealmDatabaseMigration; import io.realm.Realm; @@ -17,6 +18,7 @@ public boolean configure(Context context) { Realm.init(context); io.realm.RealmConfiguration config = new io.realm.RealmConfiguration.Builder() .schemaVersion(RealmDatabaseMigration.DB_VERSION) // Must be bumped when the schema changes + .modules(new DataModule()) //TODO: Re-add migration once DB is locked/finalized .deleteRealmIfMigrationNeeded() .build(); diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/LoginActivityViewModel.java b/android/app/src/main/java/org/fossasia/openevent/core/auth/LoginActivityViewModel.java index 7a7689ab1..ba805ca50 100644 --- a/android/app/src/main/java/org/fossasia/openevent/core/auth/LoginActivityViewModel.java +++ b/android/app/src/main/java/org/fossasia/openevent/core/auth/LoginActivityViewModel.java @@ -6,11 +6,11 @@ import org.fossasia.openevent.common.api.APIClient; import org.fossasia.openevent.core.auth.model.Login; +import org.fossasia.openevent.core.auth.model.LoginResponse; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.schedulers.Schedulers; -import lombok.Data; import timber.log.Timber; import static org.fossasia.openevent.core.auth.AuthUtil.INVALID; @@ -44,9 +44,4 @@ protected void onCleared() { super.onCleared(); } - @Data - public static class LoginResponse { - private final int response; - private final String accessToken; - } } diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/SignUpActivityViewModel.java b/android/app/src/main/java/org/fossasia/openevent/core/auth/SignUpActivityViewModel.java index f7822d199..7e761eedf 100644 --- a/android/app/src/main/java/org/fossasia/openevent/core/auth/SignUpActivityViewModel.java +++ b/android/app/src/main/java/org/fossasia/openevent/core/auth/SignUpActivityViewModel.java @@ -5,14 +5,14 @@ import android.arch.lifecycle.ViewModel; import org.fossasia.openevent.common.api.APIClient; +import org.fossasia.openevent.common.utils.Utils; import org.fossasia.openevent.core.auth.model.Login; +import org.fossasia.openevent.core.auth.model.SignUpResponse; import org.fossasia.openevent.core.auth.model.User; -import org.fossasia.openevent.common.utils.Utils; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.schedulers.Schedulers; -import lombok.Data; import timber.log.Timber; public class SignUpActivityViewModel extends ViewModel { @@ -75,9 +75,4 @@ protected void onCleared() { super.onCleared(); } - @Data - public static class SignUpResponse { - private final int response; - private final String token; - } } diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/ImageResponse.java b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/ImageResponse.java deleted file mode 100644 index 1eb1b4a37..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/ImageResponse.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.fossasia.openevent.core.auth.model; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ImageResponse { - private String url; -} diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/ImageResponse.kt b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/ImageResponse.kt new file mode 100644 index 000000000..213174a52 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/ImageResponse.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.auth.model + +data class ImageResponse (var url: String? = null) diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/Login.java b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/Login.java deleted file mode 100644 index f2081bf47..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/Login.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.fossasia.openevent.core.auth.model; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class Login { - private String email; - private String password; -} \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/Login.kt b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/Login.kt new file mode 100644 index 000000000..256765606 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/Login.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.auth.model + +data class Login(var email: String? = null, var password: String? = null) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/LoginResponse.java b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/LoginResponse.java deleted file mode 100644 index 75d7b9fdf..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/LoginResponse.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.fossasia.openevent.core.auth.model; - -import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import com.fasterxml.jackson.databind.annotation.JsonNaming; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) -public class LoginResponse { - private String accessToken; -} \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/LoginResponse.kt b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/LoginResponse.kt new file mode 100644 index 000000000..1d225c78b --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/LoginResponse.kt @@ -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 response: Int? = null, var accessToken: String? = null) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/SignUpResponse.kt b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/SignUpResponse.kt new file mode 100644 index 000000000..4cdc587e0 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/SignUpResponse.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.auth.model + +data class SignUpResponse(var response: Int? = null, var token: String? = null) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/UploadImage.java b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/UploadImage.java deleted file mode 100644 index aad3294b6..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/UploadImage.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.fossasia.openevent.core.auth.model; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class UploadImage { - private String data; -} diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/UploadImage.kt b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/UploadImage.kt new file mode 100644 index 000000000..0d03bfb2f --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/auth/model/UploadImage.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.auth.model + +data class UploadImage(var data: String? = null) diff --git a/android/app/src/main/java/org/fossasia/openevent/core/bookmark/BookmarkStatus.java b/android/app/src/main/java/org/fossasia/openevent/core/bookmark/BookmarkStatus.java deleted file mode 100644 index d7baa7bbf..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/bookmark/BookmarkStatus.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.fossasia.openevent.core.bookmark; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class BookmarkStatus { - - private int storedColor; - private int sessionId; - private Status actionCode; - - public enum Status { - CODE_UNDO_ADDED, - CODE_BLANK, - CODE_UNDO_REMOVED, - CODE_ERROR - } -} diff --git a/android/app/src/main/java/org/fossasia/openevent/core/bookmark/BookmarkStatus.kt b/android/app/src/main/java/org/fossasia/openevent/core/bookmark/BookmarkStatus.kt new file mode 100644 index 000000000..f6f4fdad8 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/bookmark/BookmarkStatus.kt @@ -0,0 +1,14 @@ +package org.fossasia.openevent.core.bookmark + +data class BookmarkStatus( + var storedColor: Int? = null, + var sessionId: Int? = null, + var actionCode: Status? = null) { + + enum class Status { + CODE_UNDO_ADDED, + CODE_BLANK, + CODE_UNDO_REMOVED, + CODE_ERROR + } +} diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/FacebookFeedFragmentViewModel.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/FacebookFeedFragmentViewModel.java index 8cd9d3351..3470010d5 100644 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/FacebookFeedFragmentViewModel.java +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/FacebookFeedFragmentViewModel.java @@ -10,13 +10,13 @@ import org.fossasia.openevent.core.feed.facebook.api.FacebookApi; import org.fossasia.openevent.core.feed.facebook.api.FacebookPageId; import org.fossasia.openevent.core.feed.facebook.api.Feed; +import org.fossasia.openevent.core.feed.facebook.api.PostsResponse; import org.reactivestreams.Publisher; import io.reactivex.BackpressureStrategy; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.schedulers.Schedulers; -import lombok.Data; import static org.fossasia.openevent.core.auth.AuthUtil.INVALID; import static org.fossasia.openevent.core.auth.AuthUtil.VALID; @@ -62,9 +62,4 @@ protected void onCleared() { super.onCleared(); } - @Data - public static class PostsResponse { - private final int response; - private final Feed feed; - } } diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/CommentItem.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/CommentItem.java deleted file mode 100644 index de954ff55..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/CommentItem.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.fossasia.openevent.core.feed.facebook.api; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import com.fasterxml.jackson.databind.annotation.JsonNaming; - -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@JsonIgnoreProperties(ignoreUnknown = true) -@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) -public class CommentItem implements Parcelable { - - private String createdTime; - private Commenter from; - private String message; - private String id; - - protected CommentItem(Parcel in) { - createdTime = in.readString(); - message = in.readString(); - id = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override - public CommentItem createFromParcel(Parcel in) { - return new CommentItem(in); - } - - @Override - public CommentItem[] newArray(int size) { - return new CommentItem[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeString(createdTime); - dest.writeString(message); - dest.writeString(id); - } -} \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/CommentItem.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/CommentItem.kt new file mode 100644 index 000000000..d0b0baacd --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/CommentItem.kt @@ -0,0 +1,17 @@ +package org.fossasia.openevent.core.feed.facebook.api + +import android.os.Parcelable +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.databind.PropertyNamingStrategy +import com.fasterxml.jackson.databind.annotation.JsonNaming +import kotlinx.android.parcel.Parcelize + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy::class) +@Parcelize +data class CommentItem( + val createdTime: String? = null, + val from: Commenter? = null, + val message: String? = null, + val id: String? = null +): Parcelable \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Commenter.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Commenter.java deleted file mode 100644 index 533254061..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Commenter.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.fossasia.openevent.core.feed.facebook.api; - -import lombok.Data; - -@Data -public class Commenter { - - private String name; - private String id; - -} \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Commenter.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Commenter.kt new file mode 100644 index 000000000..b2a6011a7 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Commenter.kt @@ -0,0 +1,10 @@ +package org.fossasia.openevent.core.feed.facebook.api + +import android.os.Parcelable +import kotlinx.android.parcel.Parcelize + +@Parcelize +data class Commenter ( + var name: String? = null, + var id: String? = null +): Parcelable \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Comments.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Comments.java deleted file mode 100644 index 8aabd3987..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Comments.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.fossasia.openevent.core.feed.facebook.api; - -import java.util.List; - -import lombok.Data; - -@Data -public class Comments { - - private List data; - -} \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Comments.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Comments.kt new file mode 100644 index 000000000..15174f128 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Comments.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.feed.facebook.api + +data class Comments (var data: List? = null) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FacebookPageId.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FacebookPageId.java deleted file mode 100644 index 40d46f672..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FacebookPageId.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.fossasia.openevent.core.feed.facebook.api; - -import lombok.Data; - -@Data -public class FacebookPageId { - - private String name; - private String id; - -} \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FacebookPageId.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FacebookPageId.kt new file mode 100644 index 000000000..8a84a0e68 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FacebookPageId.kt @@ -0,0 +1,6 @@ +package org.fossasia.openevent.core.feed.facebook.api + +data class FacebookPageId ( + var name: String? = null, + var id: String? = null +) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Feed.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Feed.java deleted file mode 100644 index caf5c021d..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Feed.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.fossasia.openevent.core.feed.facebook.api; - -import java.util.ArrayList; - -import lombok.Data; - -@Data -public class Feed { - - private ArrayList data; - -} \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Feed.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Feed.kt new file mode 100644 index 000000000..2df62362e --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/Feed.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.feed.facebook.api + +data class Feed (var data: List? = null) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FeedItem.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FeedItem.java deleted file mode 100644 index 04a49cec1..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FeedItem.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.fossasia.openevent.core.feed.facebook.api; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import com.fasterxml.jackson.databind.annotation.JsonNaming; - -import lombok.Data; - -@Data -@JsonIgnoreProperties(ignoreUnknown = true) -@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) -public class FeedItem { - - private String id; - private String message; - private String createdTime; - private Comments comments; - private String fullPicture; - private String link; - -} \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FeedItem.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FeedItem.kt new file mode 100644 index 000000000..26650d5c4 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/FeedItem.kt @@ -0,0 +1,16 @@ +package org.fossasia.openevent.core.feed.facebook.api + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.databind.PropertyNamingStrategy +import com.fasterxml.jackson.databind.annotation.JsonNaming + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy::class) +data class FeedItem ( + var id: String? = null, + var message: String? = null, + var createdTime: String? = null, + var comments: Comments? = null, + var fullPicture: String? = null, + var link: String? = null +) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/PostsResponse.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/PostsResponse.kt new file mode 100644 index 000000000..fd9328f61 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/api/PostsResponse.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.feed.facebook.api + +data class PostsResponse(val response: Int? = null, val feed: Feed? = null) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/TwitterFeedFragmentViewModel.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/TwitterFeedFragmentViewModel.java index ac92b9575..b2e8a6729 100644 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/TwitterFeedFragmentViewModel.java +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/TwitterFeedFragmentViewModel.java @@ -4,13 +4,13 @@ import android.arch.lifecycle.MutableLiveData; import android.arch.lifecycle.ViewModel; +import org.fossasia.openevent.core.feed.twitter.api.PostsResponse; import org.fossasia.openevent.core.feed.twitter.api.TwitterApi; import org.fossasia.openevent.core.feed.twitter.api.TwitterFeed; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.schedulers.Schedulers; -import lombok.Data; import static org.fossasia.openevent.core.auth.AuthUtil.INVALID; import static org.fossasia.openevent.core.auth.AuthUtil.VALID; @@ -39,9 +39,4 @@ protected void onCleared() { super.onCleared(); } - @Data - public static class PostsResponse { - private final int response; - private final TwitterFeed twitterFeed; - } } diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/PostsResponse.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/PostsResponse.kt new file mode 100644 index 000000000..59e2623e1 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/PostsResponse.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.feed.twitter.api + +data class PostsResponse(val response: Int? = null, val twitterFeed: TwitterFeed? = null) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeed.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeed.java deleted file mode 100644 index ea7da18d5..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeed.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.fossasia.openevent.core.feed.twitter.api; - -import java.util.ArrayList; - -import lombok.Data; - -@Data -public class TwitterFeed { - - private ArrayList statuses; - -} diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeed.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeed.kt new file mode 100644 index 000000000..15676b6ac --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeed.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.feed.twitter.api + +data class TwitterFeed (var statuses: List? = null) diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeedItem.java b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeedItem.java deleted file mode 100644 index 0ea309ee5..000000000 --- a/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeedItem.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.fossasia.openevent.core.feed.twitter.api; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import com.fasterxml.jackson.databind.annotation.JsonNaming; - -import java.util.ArrayList; - -import lombok.Data; - -@Data -@JsonIgnoreProperties(ignoreUnknown = true) -@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) -public class TwitterFeedItem { - private String link; - private ArrayList hashTags; - private ArrayList links; - private ArrayList images; - private String text; - private String createdAt; -} diff --git a/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeedItem.kt b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeedItem.kt new file mode 100644 index 000000000..0dc533eaf --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/feed/twitter/api/TwitterFeedItem.kt @@ -0,0 +1,16 @@ +package org.fossasia.openevent.core.feed.twitter.api + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.databind.PropertyNamingStrategy +import com.fasterxml.jackson.databind.annotation.JsonNaming + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy::class) +data class TwitterFeedItem( + var link: String? = null, + var hashTags: List? = null, + var links: List? = null, + var images: List? = null, + var text: String? = null, + var createdAt: String? = null +) diff --git a/android/app/src/main/java/org/fossasia/openevent/core/schedule/EventDateStrings.kt b/android/app/src/main/java/org/fossasia/openevent/core/schedule/EventDateStrings.kt new file mode 100644 index 000000000..2412f4680 --- /dev/null +++ b/android/app/src/main/java/org/fossasia/openevent/core/schedule/EventDateStrings.kt @@ -0,0 +1,3 @@ +package org.fossasia.openevent.core.schedule + +data class EventDateStrings(val formattedDate: String? = null, val date: String? = null) \ No newline at end of file diff --git a/android/app/src/main/java/org/fossasia/openevent/core/schedule/ScheduleFragmentViewModel.java b/android/app/src/main/java/org/fossasia/openevent/core/schedule/ScheduleFragmentViewModel.java index feadd9c1e..b7e5846e2 100644 --- a/android/app/src/main/java/org/fossasia/openevent/core/schedule/ScheduleFragmentViewModel.java +++ b/android/app/src/main/java/org/fossasia/openevent/core/schedule/ScheduleFragmentViewModel.java @@ -4,17 +4,16 @@ import android.arch.lifecycle.Transformations; import android.arch.lifecycle.ViewModel; +import org.fossasia.openevent.common.arch.FilterableRealmLiveData; +import org.fossasia.openevent.common.date.DateConverter; import org.fossasia.openevent.data.Track; import org.fossasia.openevent.data.extras.EventDates; -import org.fossasia.openevent.common.arch.FilterableRealmLiveData; import org.fossasia.openevent.data.repository.RealmDataRepository; -import org.fossasia.openevent.common.date.DateConverter; import org.threeten.bp.format.DateTimeParseException; import java.util.ArrayList; import java.util.List; -import lombok.Data; import timber.log.Timber; public class ScheduleFragmentViewModel extends ViewModel { @@ -55,9 +54,4 @@ public LiveData> getTracks() { return trackFilterableRealmLiveData; } - @Data - public static class EventDateStrings { - private final String formattedDate; - private final String date; - } } diff --git a/android/app/src/main/java/org/fossasia/openevent/core/search/SearchActivityViewModel.java b/android/app/src/main/java/org/fossasia/openevent/core/search/SearchActivityViewModel.java index a6345bc8b..98190eb47 100644 --- a/android/app/src/main/java/org/fossasia/openevent/core/search/SearchActivityViewModel.java +++ b/android/app/src/main/java/org/fossasia/openevent/core/search/SearchActivityViewModel.java @@ -51,7 +51,9 @@ public String getSearchText() { public void addResultsFromTracks(String queryString) { RealmResults filteredTracks = realm.where(Track.class) - .like("name", queryString, Case.INSENSITIVE).findAllSortedAsync("name"); + .like("name", queryString, Case.INSENSITIVE) + .sort("name") + .findAllAsync(); filteredTracks.addChangeListener(tracks -> { if (tracks.size() > 0) { @@ -66,7 +68,9 @@ public void addResultsFromSpeakers(String queryString) { RealmResults filteredSpeakers = realm.where(Speaker.class) .like("name", queryString, Case.INSENSITIVE).or() .like("country", queryString, Case.INSENSITIVE).or() - .like("organisation", queryString, Case.INSENSITIVE).findAllSortedAsync("name"); + .like("organisation", queryString, Case.INSENSITIVE) + .sort("name") + .findAllAsync(); filteredSpeakers.addChangeListener(speakers -> { if (speakers.size() > 0) { @@ -79,7 +83,9 @@ public void addResultsFromSpeakers(String queryString) { public void addResultsFromLocations(String queryString) { RealmResults filteredMicrolocations = realm.where(Microlocation.class) - .like("name", queryString, Case.INSENSITIVE).findAllSortedAsync("name"); + .like("name", queryString, Case.INSENSITIVE) + .sort("name") + .findAllAsync(); filteredMicrolocations.addChangeListener(microlocations -> { if (microlocations.size() > 0) { @@ -92,7 +98,9 @@ public void addResultsFromLocations(String queryString) { public void addResultFromSessions(String queryString) { RealmResults filteredSessions = realm.where(Session.class) - .like("title", queryString, Case.INSENSITIVE).findAllSortedAsync("title"); + .like("title", queryString, Case.INSENSITIVE) + .sort("title") + .findAllAsync(); filteredSessions.addChangeListener(sessions -> { if (sessions.size() > 0) { diff --git a/android/app/src/main/java/org/fossasia/openevent/data/repository/RealmDataRepository.java b/android/app/src/main/java/org/fossasia/openevent/data/repository/RealmDataRepository.java index 587e4133a..2de6bba88 100644 --- a/android/app/src/main/java/org/fossasia/openevent/data/repository/RealmDataRepository.java +++ b/android/app/src/main/java/org/fossasia/openevent/data/repository/RealmDataRepository.java @@ -231,15 +231,20 @@ public RealmResults getTracksFiltered(String query) { return realm.where(Track.class) .like("name", wildcardQuery, Case.INSENSITIVE) - .findAllSorted("name"); + .sort("name") + .findAll(); } public RealmResults getTracks() { - return realm.where(Track.class).findAllSortedAsync("name"); + return realm.where(Track.class) + .sort("name") + .findAllAsync(); } public RealmResults getTracksSync() { - return realm.where(Track.class).findAllSorted("name"); + return realm.where(Track.class) + .sort("name") + .findAll(); } public Track getTrack(int trackId) { @@ -378,11 +383,15 @@ public RealmResults getSessionsFiltered(int trackId, String query) { return realm.where(Session.class) .equalTo("track.id", trackId) .like("title", wildcardQuery, Case.INSENSITIVE) - .findAllSorted("startsAt"); + .sort("startsAt") + .findAll(); } public RealmResults getSessionsByLocation(String location) { - return realm.where(Session.class).equalTo("microlocation.name", location).findAllSortedAsync(Session.START_TIME); + return realm.where(Session.class) + .equalTo("microlocation.name", location) + .sort(Session.START_TIME) + .findAllAsync(); } public RealmResults getSessionsByDate(String date) { @@ -395,7 +404,8 @@ public RealmResults getSessionsByDateFiltered(String date, String query return realm.where(Session.class) .equalTo("startDate", date) .like("title", wildcardQuery, Case.INSENSITIVE) - .findAllSorted(sortCriteria); + .sort(sortCriteria) + .findAllAsync(); } public RealmResults getBookMarkedSessions() { @@ -465,11 +475,15 @@ public RealmResults getSpeakersForName(String speakerName){ } public RealmResults getSpeakers(String sortCriteria) { - return realm.where(Speaker.class).findAllSortedAsync(sortCriteria); + return realm.where(Speaker.class) + .sort(sortCriteria) + .findAllAsync(); } public RealmResults getSpeakersSync(String sortCriteria) { - return realm.where(Speaker.class).findAllSorted(sortCriteria); + return realm.where(Speaker.class) + .sort(sortCriteria) + .findAllAsync(); } public RealmResults getSpeakersFiltered(String query, String sortCriteria) { @@ -477,7 +491,8 @@ public RealmResults getSpeakersFiltered(String query, String sortCriter return realm.where(Speaker.class) .like("name", wildcardQuery, Case.INSENSITIVE) - .findAllSorted(sortCriteria); + .sort(sortCriteria) + .findAllAsync(); } public RealmResults getFeaturedSpeakers() { @@ -502,7 +517,9 @@ public Completable saveSponsors(final List sponsors) { } public RealmResults getSponsors() { - return realm.where(Sponsor.class).findAllSortedAsync("level", Sort.DESCENDING, "name", Sort.ASCENDING); + return realm.where(Sponsor.class) + .sort("level", Sort.DESCENDING, "name", Sort.ASCENDING) + .findAllAsync(); } //DiscountCode section @@ -521,7 +538,9 @@ public Completable saveDiscountCodes(final List discountCodes) { } public RealmResults getDiscountCodes() { - return realm.where(DiscountCode.class).findAllSortedAsync("code"); + return realm.where(DiscountCode.class) + .sort("code") + .findAllAsync(); } // Location Section @@ -540,11 +559,15 @@ public Completable saveLocations(final List locations) { } public RealmResults getLocations() { - return realm.where(Microlocation.class).findAllSortedAsync("name"); + return realm.where(Microlocation.class) + .sort("name") + .findAllAsync(); } public RealmResults getLocationsSync() { - return realm.where(Microlocation.class).findAllSorted("name"); + return realm.where(Microlocation.class) + .sort("name") + .findAll(); } //Session Types Section @@ -563,11 +586,15 @@ public Completable saveSessionTypes(final List sessionTypes) { } public RealmResults getSessionTypes() { - return realm.where(SessionType.class).findAllSortedAsync("name"); + return realm.where(SessionType.class) + .sort("name") + .findAllAsync(); } public RealmResults getSessionTypesSync() { - return realm.where(SessionType.class).findAllSorted("name"); + return realm.where(SessionType.class) + .sort("name") + .findAll(); } // Dates Section @@ -596,7 +623,7 @@ public RealmResults getEventDates() { public RealmResults getEventDatesSync(){ return realm.where(EventDates.class).findAll(); } - + // Notifications section public Completable saveNotifications(final List notifications) { @@ -614,7 +641,9 @@ private void saveNotificationsInRealm(List notifications) { } public RealmResults getNotifications() { - return realm.where(Notification.class).findAllSortedAsync("receivedAt"); + return realm.where(Notification.class) + .sort("receivedAt") + .findAllAsync(); } // FAQ Section diff --git a/android/app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/android/app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000..ca6ee9cea --- /dev/null +++ b/android/app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index da09b8d9b..77bd5379b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,13 +1,19 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. +project.ext.sdkVersion = 27 +project.ext.minSdkVersion = 16 +project.ext.buildTools = '27.0.3' + buildscript { + ext.kotlin_version = '1.2.30' repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' - classpath 'io.realm:realm-gradle-plugin:3.7.2' + classpath 'io.realm:realm-gradle-plugin:5.0.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/android/data/.gitignore b/android/data/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/android/data/.gitignore @@ -0,0 +1 @@ +/build diff --git a/android/data/build.gradle b/android/data/build.gradle new file mode 100644 index 000000000..2d8b1ae44 --- /dev/null +++ b/android/data/build.gradle @@ -0,0 +1,32 @@ +apply plugin: 'com.android.library' +apply plugin: 'realm-android' + +android { + compileSdkVersion rootProject.sdkVersion + buildToolsVersion rootProject.buildTools + + defaultConfig { + targetSdkVersion rootProject.sdkVersion + minSdkVersion rootProject.minSdkVersion + versionCode 1 + versionName "1.0" + } + + compileOptions{ + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + buildTypes { + release { + minifyEnabled false + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.github.jasminb:jsonapi-converter:0.7' + compileOnly 'org.projectlombok:lombok:1.16.20' + annotationProcessor 'org.projectlombok:lombok:1.16.20' +} diff --git a/android/app/lombok.config b/android/data/lombok.config similarity index 100% rename from android/app/lombok.config rename to android/data/lombok.config diff --git a/android/data/proguard-rules.pro b/android/data/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/android/data/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/android/data/src/main/AndroidManifest.xml b/android/data/src/main/AndroidManifest.xml new file mode 100644 index 000000000..8e62b80cb --- /dev/null +++ b/android/data/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + diff --git a/android/app/src/main/java/org/fossasia/openevent/config/Config.java b/android/data/src/main/java/org/fossasia/openevent/config/Config.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/config/Config.java rename to android/data/src/main/java/org/fossasia/openevent/config/Config.java diff --git a/android/app/src/main/java/org/fossasia/openevent/config/ConfigStrategy.java b/android/data/src/main/java/org/fossasia/openevent/config/ConfigStrategy.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/config/ConfigStrategy.java rename to android/data/src/main/java/org/fossasia/openevent/config/ConfigStrategy.java diff --git a/android/app/src/main/java/org/fossasia/openevent/config/ConfigStrategyHolder.java b/android/data/src/main/java/org/fossasia/openevent/config/ConfigStrategyHolder.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/config/ConfigStrategyHolder.java rename to android/data/src/main/java/org/fossasia/openevent/config/ConfigStrategyHolder.java diff --git a/android/app/src/main/java/org/fossasia/openevent/core/auth/model/User.java b/android/data/src/main/java/org/fossasia/openevent/core/auth/model/User.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/core/auth/model/User.java rename to android/data/src/main/java/org/fossasia/openevent/core/auth/model/User.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/DiscountCode.java b/android/data/src/main/java/org/fossasia/openevent/data/DiscountCode.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/DiscountCode.java rename to android/data/src/main/java/org/fossasia/openevent/data/DiscountCode.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/Event.java b/android/data/src/main/java/org/fossasia/openevent/data/Event.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/Event.java rename to android/data/src/main/java/org/fossasia/openevent/data/Event.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/FAQ.java b/android/data/src/main/java/org/fossasia/openevent/data/FAQ.java similarity index 86% rename from android/app/src/main/java/org/fossasia/openevent/data/FAQ.java rename to android/data/src/main/java/org/fossasia/openevent/data/FAQ.java index 5b63e8953..7189869ca 100644 --- a/android/app/src/main/java/org/fossasia/openevent/data/FAQ.java +++ b/android/data/src/main/java/org/fossasia/openevent/data/FAQ.java @@ -11,9 +11,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; -/** - * Created by mayank on 4/2/18. - */ @Data @Type("faq") @EqualsAndHashCode(callSuper = false) @@ -27,6 +24,4 @@ public class FAQ extends RealmObject { private String question; private String answer; -// @Relationship("faq-type") -// private RealmList faqTypes; } diff --git a/android/app/src/main/java/org/fossasia/openevent/data/Microlocation.java b/android/data/src/main/java/org/fossasia/openevent/data/Microlocation.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/Microlocation.java rename to android/data/src/main/java/org/fossasia/openevent/data/Microlocation.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/Notification.java b/android/data/src/main/java/org/fossasia/openevent/data/Notification.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/Notification.java rename to android/data/src/main/java/org/fossasia/openevent/data/Notification.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/Session.java b/android/data/src/main/java/org/fossasia/openevent/data/Session.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/Session.java rename to android/data/src/main/java/org/fossasia/openevent/data/Session.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/SessionType.java b/android/data/src/main/java/org/fossasia/openevent/data/SessionType.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/SessionType.java rename to android/data/src/main/java/org/fossasia/openevent/data/SessionType.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/Speaker.java b/android/data/src/main/java/org/fossasia/openevent/data/Speaker.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/Speaker.java rename to android/data/src/main/java/org/fossasia/openevent/data/Speaker.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/Sponsor.java b/android/data/src/main/java/org/fossasia/openevent/data/Sponsor.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/Sponsor.java rename to android/data/src/main/java/org/fossasia/openevent/data/Sponsor.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/Track.java b/android/data/src/main/java/org/fossasia/openevent/data/Track.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/Track.java rename to android/data/src/main/java/org/fossasia/openevent/data/Track.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/extras/Copyright.java b/android/data/src/main/java/org/fossasia/openevent/data/extras/Copyright.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/extras/Copyright.java rename to android/data/src/main/java/org/fossasia/openevent/data/extras/Copyright.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/extras/EventDates.java b/android/data/src/main/java/org/fossasia/openevent/data/extras/EventDates.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/extras/EventDates.java rename to android/data/src/main/java/org/fossasia/openevent/data/extras/EventDates.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/extras/SocialLink.java b/android/data/src/main/java/org/fossasia/openevent/data/extras/SocialLink.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/extras/SocialLink.java rename to android/data/src/main/java/org/fossasia/openevent/data/extras/SocialLink.java diff --git a/android/app/src/main/java/org/fossasia/openevent/data/extras/SpeakersCall.java b/android/data/src/main/java/org/fossasia/openevent/data/extras/SpeakersCall.java similarity index 100% rename from android/app/src/main/java/org/fossasia/openevent/data/extras/SpeakersCall.java rename to android/data/src/main/java/org/fossasia/openevent/data/extras/SpeakersCall.java diff --git a/android/data/src/main/java/org/fossasia/openevent/data/module/DataModule.java b/android/data/src/main/java/org/fossasia/openevent/data/module/DataModule.java new file mode 100644 index 000000000..5dbdd3bb8 --- /dev/null +++ b/android/data/src/main/java/org/fossasia/openevent/data/module/DataModule.java @@ -0,0 +1,7 @@ +package org.fossasia.openevent.data.module; + +import io.realm.annotations.RealmModule; + +@RealmModule(library = true, allClasses = true) +public class DataModule { +} \ No newline at end of file diff --git a/android/settings.gradle b/android/settings.gradle index e7b4def49..16ce0eff6 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1 +1 @@ -include ':app' +include ':app', ':data'