diff --git a/.github/workflows/master_dev_ci.yml b/.github/workflows/master_dev_ci.yml index 8c12edf29..930b4a789 100644 --- a/.github/workflows/master_dev_ci.yml +++ b/.github/workflows/master_dev_ci.yml @@ -175,34 +175,6 @@ jobs: - name: Build APKs run: ./gradlew :androidApp:assembleDebug - - name: Check badging - id: badging_verify - continue-on-error: true - run: ./gradlew :androidApp:checkReleaseBadging - - - name: Prevent updating release badging if this is a fork - id: checkfork_badging - if: steps.badging_verify.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository - run: | - echo "::error::Release Badging failed, please update badging with: ./gradlew updateReleaseBadging" && exit 1 - - - # Runs if previous job failed - - name: Generate new release badging if verification failed and it's a PR - id: generate_badging - if: steps.checkfork_badging.outcome == 'failure' && github.event_name == 'pull_request' - run: | - ./gradlew updateReleaseBadging - - - - name: Push new release badging if available - uses: stefanzweifel/git-auto-commit-action@v5 - if: steps.generate_badging.outcome == 'success' - with: - file_pattern: 'androidApp/release-badging.txt' - disable_globbing: true - commit_message: "🤖 Updates release badging" - - name: Upload APKs uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/release_to_internal_or_beta.yml b/.github/workflows/release_to_internal_or_beta.yml index f36c3eb87..1117bafa7 100644 --- a/.github/workflows/release_to_internal_or_beta.yml +++ b/.github/workflows/release_to_internal_or_beta.yml @@ -1,15 +1,19 @@ -name: On Push +name: Internal Or Beta Release on: workflow_dispatch: inputs: - beta: - description: 'true if this is a beta release' + release_type: required: false - default: 'false' + default: 'internal' + description: Please select the release type + type: choice + options: + - internal + - beta push: branches: - - master + - development env: SUPPLY_UPLOAD_MAX_RETRIES: 5 @@ -72,7 +76,7 @@ jobs: path: ./**/*.apk - name: Create Version File - if: github.event.inputs.beta == 'true' + if: github.event.inputs.release_type == 'beta' shell: bash env: VERSION_CODE: ${{ steps.rel_number.outputs.version-code }} @@ -80,7 +84,7 @@ jobs: echo $VERSION_CODE > ./androidApp/build/outputs/version_code.txt - name: Create Github Pre-Release - if: github.event.inputs.beta == 'true' + if: github.event.inputs.release_type == 'beta' uses: softprops/action-gh-release@v2.0.8 with: tag_name: ${{ steps.rel_number.outputs.version }} @@ -117,6 +121,12 @@ jobs: ruby-version: '3.2' bundler-cache: true + - name: Install Fastlane + run: | + gem install bundler:2.2.27 + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 @@ -148,8 +158,8 @@ jobs: ./gradlew :androidApp:bundleRelease - name: Deploy to Play Store Internal - run: bundle exec fastlane android internal + run: bundle exec fastlane android deploy_internal - name: Promote Internal to Beta - if: github.event.inputs.beta == 'true' - run: bundle exec fastlane android beta + if: github.event.inputs.release_type == 'beta' + run: bundle exec fastlane android promote_to_beta diff --git a/.github/workflows/release_to_production.yml b/.github/workflows/release_to_production.yml index 3592488fd..51a0cbafe 100644 --- a/.github/workflows/release_to_production.yml +++ b/.github/workflows/release_to_production.yml @@ -1,9 +1,7 @@ -name: Production Deploy +name: Promote Beta to Production Play Store on: workflow_dispatch: - release: - types: [ released ] env: SUPPLY_UPLOAD_MAX_RETRIES: 5 @@ -20,6 +18,12 @@ jobs: ruby-version: '3.2' bundler-cache: true + - name: Install Fastlane + run: | + gem install bundler:2.2.27 + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - uses: ./.github/actions/inflate-secrets name: Inflate Secrets with: diff --git a/.github/workflows/weekly_release.yaml b/.github/workflows/weekly_release.yaml index 2e5281576..d314a1313 100644 --- a/.github/workflows/weekly_release.yaml +++ b/.github/workflows/weekly_release.yaml @@ -31,9 +31,9 @@ jobs: github.rest.actions.createWorkflowDispatch({ owner: context.repo.owner, repo: context.repo.repo, - workflow_id: 'onPush.yml', - ref: 'master', + workflow_id: 'release_to_internal_or_beta.yml', + ref: 'development', inputs: { - "beta": "true", + "release_type": "beta", }, }) diff --git a/Gemfile b/Gemfile index adc90d98c..2ccf2ecb1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ source "https://rubygems.org" -gem "fastlane" \ No newline at end of file +gem "fastlane" +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/Gss.lock b/Gemfile.lock similarity index 93% rename from Gss.lock rename to Gemfile.lock index da23f9ba0..c326c635d 100644 --- a/Gss.lock +++ b/Gemfile.lock @@ -10,20 +10,20 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.971.0) - aws-sdk-core (3.203.0) + aws-partitions (1.979.0) + aws-sdk-core (3.209.1) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.89.0) - aws-sdk-core (~> 3, >= 3.203.0) + aws-sdk-kms (1.94.0) + aws-sdk-core (~> 3, >= 3.207.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.160.0) - aws-sdk-core (~> 3, >= 3.203.0) + aws-sdk-s3 (1.166.0) + aws-sdk-core (~> 3, >= 3.207.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.9.1) + aws-sigv4 (1.10.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) base64 (0.2.0) @@ -39,7 +39,7 @@ GEM dotenv (2.8.1) emoji_regex (3.2.3) excon (0.111.0) - faraday (1.10.3) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -65,7 +65,7 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) fastimage (2.3.1) fastlane (2.222.0) @@ -109,6 +109,7 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + fastlane-plugin-increment_version_code (0.4.3) gh_inspector (1.1.3) google-apis-androidpublisher_v3 (0.54.0) google-apis-core (>= 0.11.0, < 2.a) @@ -152,7 +153,7 @@ GEM httpclient (2.8.3) jmespath (1.6.2) json (2.7.2) - jwt (2.8.2) + jwt (2.9.1) base64 mini_magick (4.13.2) mini_mime (1.1.5) @@ -193,7 +194,7 @@ GEM tty-spinner (0.9.3) tty-cursor (~> 0.7) uber (0.1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) word_wrap (1.0.0) xcodeproj (1.25.0) CFPropertyList (>= 2.3.3, < 4.0) @@ -214,6 +215,7 @@ PLATFORMS DEPENDENCIES fastlane + fastlane-plugin-increment_version_code BUNDLED WITH 2.5.18 diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 880be9f8e..a92f3972a 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -1,3 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md + */ +import org.mifos.mobile.dynamicVersion + /* * Copyright 2024 Mifos Initiative * @@ -20,7 +31,7 @@ android { namespace = "org.mifos.mobile" defaultConfig { - versionName = project.version.toString() + versionName = project.dynamicVersion versionCode = System.getenv("VERSION_CODE")?.toIntOrNull() ?: 1 applicationId = "org.mifos.mobile" vectorDrawables.useSupportLibrary = true @@ -133,4 +144,4 @@ dependencies { androidTestImplementation(libs.hilt.android.testing) debugApi(libs.androidx.compose.ui.tooling) -} \ No newline at end of file +} diff --git a/androidApp/dependencies/releaseRuntimeClasspath.tree.txt b/androidApp/dependencies/releaseRuntimeClasspath.tree.txt index 4ff9ad2bb..6a0c7328e 100644 --- a/androidApp/dependencies/releaseRuntimeClasspath.tree.txt +++ b/androidApp/dependencies/releaseRuntimeClasspath.tree.txt @@ -1096,7 +1096,7 @@ | | | +--- com.google.dagger:hilt-android:2.52 (*) | | | +--- com.squareup.retrofit2:converter-gson:2.11.0 (*) | | | +--- com.github.Raizlabs.DBFlow:dbflow:4.2.4 -| | | | +--- com.github.Raizlabs.DBFlow:dbflow-core:4.2.4 +| | | | \--- com.github.Raizlabs.DBFlow:dbflow-core:4.2.4 | | | | \--- com.android.support:support-annotations:26.0.1 -> androidx.annotation:annotation:1.8.1 (*) | | | +--- com.github.Raizlabs.DBFlow:dbflow-core:4.2.4 | | | +--- io.reactivex.rxjava2:rxandroid:2.1.1 diff --git a/androidApp/dependencies/releaseRuntimeClasspath.txt b/androidApp/dependencies/releaseRuntimeClasspath.txt index c1d6603bb..02741937d 100644 --- a/androidApp/dependencies/releaseRuntimeClasspath.txt +++ b/androidApp/dependencies/releaseRuntimeClasspath.txt @@ -160,8 +160,8 @@ co.touchlab:stately-concurrent-collections-jvm:2.0.6 co.touchlab:stately-concurrent-collections:2.0.6 co.touchlab:stately-strict-jvm:2.0.6 co.touchlab:stately-strict:2.0.6 -com.github.Raizlabs.DBFlow:dbflow-core:4.2.4 com.github.Raizlabs.DBFlow:dbflow:4.2.4 +com.github.Raizlabs.DBFlow:dbflow-core:4.2.4 com.google.accompanist:accompanist-pager:0.34.0 com.google.accompanist:accompanist-permissions:0.34.0 com.google.android.datatransport:transport-api:3.2.0 diff --git a/androidApp/proguard-rules.pro b/androidApp/proguard-rules.pro index 83bf0ff34..9dbebd9c7 100644 --- a/androidApp/proguard-rules.pro +++ b/androidApp/proguard-rules.pro @@ -15,5 +15,3 @@ #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} - --keep class * extends com.raizlabs.android.dbflow.config.DatabaseHolder { *; } \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/org/mifos/mobile/ProjectExtensions.kt b/build-logic/convention/src/main/kotlin/org/mifos/mobile/ProjectExtensions.kt index b66f8b9dd..9f142ede3 100644 --- a/build-logic/convention/src/main/kotlin/org/mifos/mobile/ProjectExtensions.kt +++ b/build-logic/convention/src/main/kotlin/org/mifos/mobile/ProjectExtensions.kt @@ -11,6 +11,9 @@ import org.gradle.kotlin.dsl.getByType val Project.libs get(): VersionCatalog = extensions.getByType().named("libs") +val Project.dynamicVersion: String + get() = this.version.toString().split('+')[0] + inline fun Project.detektGradle(crossinline configure: DetektExtension.() -> Unit) = extensions.configure { configure() diff --git a/build.gradle.kts b/build.gradle.kts index f8d5de6e1..2fd542c79 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -33,10 +33,15 @@ plugins { alias(libs.plugins.jetbrainsCompose) apply false } -tasks.register("versionFile") { - group = "publishing" - doLast { - println(project.version.toString()) - project.file("version.txt").writeText(project.version.toString()) +object DynamicVersion { + fun setDynamicVersion(file: File, version: String) { + val cleanedVersion = version.split('+')[0] + file.writeText(cleanedVersion) } +} + +tasks.register("versionFile") { + val file = File(projectDir, "version.txt") + + DynamicVersion.setDynamicVersion(file, project.version.toString()) } \ No newline at end of file diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts index 219756e3b..329ba96ca 100644 --- a/core/data/build.gradle.kts +++ b/core/data/build.gradle.kts @@ -23,6 +23,10 @@ android { isReturnDefaultValues = true } } + + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } } dependencies { diff --git a/core/data/proguard-rules.pro b/core/data/proguard-rules.pro deleted file mode 100644 index 481bb4348..000000000 --- a/core/data/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# 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 \ No newline at end of file diff --git a/core/data/src/main/java/org/mifos/mobile/core/data/repositoryImpl/UserAuthRepositoryImp.kt b/core/data/src/main/java/org/mifos/mobile/core/data/repositoryImpl/UserAuthRepositoryImp.kt index 953629184..eb03ad7bd 100644 --- a/core/data/src/main/java/org/mifos/mobile/core/data/repositoryImpl/UserAuthRepositoryImp.kt +++ b/core/data/src/main/java/org/mifos/mobile/core/data/repositoryImpl/UserAuthRepositoryImp.kt @@ -51,10 +51,11 @@ class UserAuthRepositoryImp @Inject constructor( } override suspend fun login(username: String, password: String): Flow { - val loginPayload = LoginPayload().apply { - this.username = username - this.password = password - } + val loginPayload = LoginPayload( + username = username, + password = password, + ) + return flow { emit(dataManager.login(loginPayload)) } diff --git a/core/data/src/test/kotlin/org/mifos/mobile/core/data/repositories/UserAuthRepositoryImpTest.kt b/core/data/src/test/kotlin/org/mifos/mobile/core/data/repositories/UserAuthRepositoryImpTest.kt index 266e9b51e..f2ba1bb03 100644 --- a/core/data/src/test/kotlin/org/mifos/mobile/core/data/repositories/UserAuthRepositoryImpTest.kt +++ b/core/data/src/test/kotlin/org/mifos/mobile/core/data/repositories/UserAuthRepositoryImpTest.kt @@ -123,10 +123,10 @@ class UserAuthRepositoryImpTest { @Test fun testLogin_SuccessResponseReceivedFromDataManager_ReturnsUserSuccessfully() = runTest { - val mockLoginPayload = LoginPayload().apply { - this.username = "username" - this.password = "password" - } + val mockLoginPayload = LoginPayload( + username = "username", + password = "password", + ) Mockito.`when`( dataManager.login(mockLoginPayload), @@ -143,10 +143,11 @@ class UserAuthRepositoryImpTest { @Test(expected = Exception::class) fun testLogin_ErrorResponseReceivedFromDataManager_ReturnsError() = runTest { - val mockLoginPayload = LoginPayload().apply { - this.username = "username" - this.password = "password" - } + val mockLoginPayload = LoginPayload( + username = "username", + password = "password", + ) + Mockito.`when`( dataManager.login(mockLoginPayload), ).thenThrow(Exception("Error occurred")) diff --git a/core/datastore/src/debug/java/org/mifos/mobile/core/datastore/BaseURL.kt b/core/datastore/src/debug/java/org/mifos/mobile/core/datastore/BaseURL.kt index 8d976b516..009804957 100644 --- a/core/datastore/src/debug/java/org/mifos/mobile/core/datastore/BaseURL.kt +++ b/core/datastore/src/debug/java/org/mifos/mobile/core/datastore/BaseURL.kt @@ -9,10 +9,6 @@ */ package org.mifos.mobile.core.datastore -/** - * @author Vishwajeet - * @since 09/06/16 - */ class BaseURL { val url: String? = null get() = field diff --git a/core/datastore/src/debug/java/org/mifos/mobile/core/datastore/SelfServiceInterceptor.kt b/core/datastore/src/debug/java/org/mifos/mobile/core/datastore/SelfServiceInterceptor.kt index 65a4e0c22..33601d7f4 100644 --- a/core/datastore/src/debug/java/org/mifos/mobile/core/datastore/SelfServiceInterceptor.kt +++ b/core/datastore/src/debug/java/org/mifos/mobile/core/datastore/SelfServiceInterceptor.kt @@ -18,8 +18,7 @@ import java.io.IOException * @author Vishwajeet * @since 21/06/16 */ -class SelfServiceInterceptor(private val preferencesHelper: PreferencesHelper) : - Interceptor { +class SelfServiceInterceptor(private val preferencesHelper: PreferencesHelper) : Interceptor { @Throws(IOException::class) override fun intercept(chain: Interceptor.Chain): Response { val chainRequest = chain.request() diff --git a/core/datastore/src/release/java/org/mifos/mobile/core/datastore/BaseURL.kt b/core/datastore/src/release/java/org/mifos/mobile/core/datastore/BaseURL.kt index b32216091..009804957 100644 --- a/core/datastore/src/release/java/org/mifos/mobile/core/datastore/BaseURL.kt +++ b/core/datastore/src/release/java/org/mifos/mobile/core/datastore/BaseURL.kt @@ -9,10 +9,6 @@ */ package org.mifos.mobile.core.datastore -/** - * @author Vishwajeet - * @since 09/06/16 - */ class BaseURL { val url: String? = null get() = field @@ -25,7 +21,7 @@ class BaseURL { } companion object { - const val API_ENDPOINT = "demo.mifos.community" + const val API_ENDPOINT = "gsoc.mifos.community" const val API_PATH = "/fineract-provider/api/v1/" const val PROTOCOL_HTTPS = "https://" } diff --git a/core/datastore/src/release/java/org/mifos/mobile/core/datastore/SelfServiceInterceptor.kt b/core/datastore/src/release/java/org/mifos/mobile/core/datastore/SelfServiceInterceptor.kt index 3a3cadc4f..615690eb8 100644 --- a/core/datastore/src/release/java/org/mifos/mobile/core/datastore/SelfServiceInterceptor.kt +++ b/core/datastore/src/release/java/org/mifos/mobile/core/datastore/SelfServiceInterceptor.kt @@ -15,20 +15,18 @@ import okhttp3.Request.Builder import okhttp3.Response import java.io.IOException -/** - * @author Vishwajeet - * @since 21/06/16 - */ -class SelfServiceInterceptor(private val preferencesHelper: PreferencesHelper) : - Interceptor { +class SelfServiceInterceptor(private val preferencesHelper: PreferencesHelper) : Interceptor { @Throws(IOException::class) override fun intercept(chain: Interceptor.Chain): Response { val chainRequest: Request = chain.request() val builder: Builder = chainRequest.newBuilder() + builder.header("Content-Type", "application/json") + builder.header("Accept", "application/json") preferencesHelper.tenant?.let { builder.header(HEADER_TENANT, it) } + preferencesHelper.token?.let { if (it.isNotEmpty()) { builder.header(HEADER_AUTH, it) @@ -42,6 +40,6 @@ class SelfServiceInterceptor(private val preferencesHelper: PreferencesHelper) : companion object { const val HEADER_TENANT = "Fineract-Platform-TenantId" const val HEADER_AUTH = "Authorization" - const val DEFAULT_TENANT = "mobile" + const val DEFAULT_TENANT = "gsoc" } } diff --git a/core/model/build.gradle.kts b/core/model/build.gradle.kts index 0ec00d707..1d6c0c2a2 100644 --- a/core/model/build.gradle.kts +++ b/core/model/build.gradle.kts @@ -16,6 +16,9 @@ plugins { android { namespace = "org.mifos.mobile.core.model" + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } } dependencies { diff --git a/core/model/consumer-rules.pro b/core/model/consumer-rules.pro index e69de29bb..8e39d9dad 100644 --- a/core/model/consumer-rules.pro +++ b/core/model/consumer-rules.pro @@ -0,0 +1,2 @@ +# Keep your model classes +-keep class org.mifos.mobile.core.model.** { *; } diff --git a/core/model/proguard-rules.pro b/core/model/proguard-rules.pro deleted file mode 100644 index 481bb4348..000000000 --- a/core/model/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# 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 \ No newline at end of file diff --git a/core/model/src/main/java/org/mifos/mobile/core/model/entity/User.kt b/core/model/src/main/java/org/mifos/mobile/core/model/entity/User.kt index 6ff7a6b94..9fecadaad 100644 --- a/core/model/src/main/java/org/mifos/mobile/core/model/entity/User.kt +++ b/core/model/src/main/java/org/mifos/mobile/core/model/entity/User.kt @@ -9,16 +9,37 @@ */ package org.mifos.mobile.core.model.entity +import android.os.Parcelable +import com.google.gson.annotations.SerializedName +import kotlinx.parcelize.Parcelize + /** * @author Vishwajeet * @since 12/06/16 */ - +@Parcelize data class User( + val userId: Long = 0, + @SerializedName("authenticated") + val isAuthenticated: Boolean = false, + val username: String? = null, + val officeId: Long = 0, + val officeName: String? = null, + val roles: ArrayList = ArrayList(), + val base64EncodedAuthenticationKey: String? = null, + val permissions: ArrayList = ArrayList(), + val shouldRenewPassword: Boolean = false, + val isTwoFactorAuthenticationRequired: Boolean = false, +) : Parcelable - var userId: Long = 0, - var isAuthenticated: Boolean = false, - var username: String? = null, - var base64EncodedAuthenticationKey: String? = null, - var permissions: List = ArrayList(), -) +@Parcelize +data class Role( + @SerializedName("id") + val id: Long = 0, + @SerializedName("name") + val name: String? = null, + @SerializedName("description") + val description: String? = null, + @SerializedName("disabled") + val disabled: Boolean = false, +) : Parcelable diff --git a/core/model/src/main/java/org/mifos/mobile/core/model/entity/payload/LoginPayload.kt b/core/model/src/main/java/org/mifos/mobile/core/model/entity/payload/LoginPayload.kt index 64e49ab18..02be52242 100644 --- a/core/model/src/main/java/org/mifos/mobile/core/model/entity/payload/LoginPayload.kt +++ b/core/model/src/main/java/org/mifos/mobile/core/model/entity/payload/LoginPayload.kt @@ -9,13 +9,7 @@ */ package org.mifos.mobile.core.model.entity.payload -/** - * Created by Ashwin on 23rd June 2020 - */ - data class LoginPayload( - - var username: String? = null, - - var password: String? = null, + val username: String, + val password: String, ) diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index 068b32ea9..3bf69828a 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -15,6 +15,9 @@ plugins { android { namespace = "org.mifos.mobile.core.network" + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } } dependencies { diff --git a/core/network/consumer-rules.pro b/core/network/consumer-rules.pro index e69de29bb..9ceea74cc 100644 --- a/core/network/consumer-rules.pro +++ b/core/network/consumer-rules.pro @@ -0,0 +1,95 @@ +# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and +# EnclosingMethod is required to use InnerClasses. +-keepattributes Signature, InnerClasses, EnclosingMethod + +# Retrofit does reflection on method and parameter annotations. +-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations + +# Keep annotation default values (e.g., retrofit2.http.Field.encoded). +-keepattributes AnnotationDefault + +# Retain service method parameters when optimizing. +-if interface * +-keepclasseswithmembers,allowobfuscation interface <1> { + @retrofit2.http.* ; +} + +# Ignore annotation used for build tooling. +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement + +# Ignore JSR 305 annotations for embedding nullability information. +-dontwarn javax.annotation.** + +# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. +-dontwarn kotlin.Unit + +# Top-level functions that can only be used by Kotlin. +-dontwarn retrofit2.KotlinExtensions +-dontwarn retrofit2.KotlinExtensions$* + +# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy +# and replaces all potential values with null. Explicitly keeping the interfaces prevents this. +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface <1> + +# Keep inherited services. +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface * extends <1> + +# With R8 full mode generic signatures are stripped for classes that are not +# kept. Suspend functions are wrapped in continuations where the type argument +# is used. +-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation + +# R8 full mode strips generic signatures from return types if not kept. +-if interface * { @retrofit2.http.* public *** *(...); } +-keep,allowoptimization,allowshrinking,allowobfuscation class <3> + +# With R8 full mode generic signatures are stripped for classes that are not kept. +-keep,allowobfuscation,allowshrinking interface retrofit2.Call +-keep,allowobfuscation,allowshrinking class retrofit2.Response + +# Keep all Retrofit service interfaces and their implementations +-keep class * extends retrofit2.Converter +-keep class * extends retrofit2.CallAdapter +-keep class * extends retrofit2.Callback +-keepclasseswithmembers class * { + @retrofit2.http.* ; +} + +# Keep generic signature of RxJava2 (R8 full mode strips signatures from non-kept items). +-keep,allowobfuscation,allowshrinking class io.reactivex.Flowable +-keep,allowobfuscation,allowshrinking class io.reactivex.Maybe +-keep,allowobfuscation,allowshrinking class io.reactivex.Observable +-keep,allowobfuscation,allowshrinking class io.reactivex.Single + +# JSR 305 annotations are for embedding nullability information. +-dontwarn javax.annotation.* + +# A resource is loaded with a relative path so the package of this class must be preserved. +-keeppackagenames okhttp3.internal.publicsuffix.* +-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz + +# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java. +-dontwarn org.codehaus.mojo.animal_sniffer.* + +# OkHttp platform used only on JVM and when Conscrypt and other security providers are available. +-dontwarn okhttp3.internal.platform.** +-dontwarn org.conscrypt.** +-dontwarn org.bouncycastle.** +-dontwarn org.openjsse.** + +-keepattributes Signature +-keepattributes *Annotation* +-dontwarn sun.misc.** +-keep class com.google.gson.examples.android.model.** { ; } +-keep class * extends com.google.gson.TypeAdapter +-keep class * implements com.google.gson.TypeAdapterFactory +-keep class * implements com.google.gson.JsonSerializer +-keep class * implements com.google.gson.JsonDeserializer +-keepclassmembers,allowobfuscation class * { + @com.google.gson.annotations.SerializedName ; +} + +-keep class org.mifos.mobile.core.network.** { *; } +-keep interface org.mifos.mobile.core.network.services.** { *; } diff --git a/core/network/proguard-rules.pro b/core/network/proguard-rules.pro deleted file mode 100644 index 481bb4348..000000000 --- a/core/network/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# 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 \ No newline at end of file diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/DataManager.kt b/core/network/src/main/java/org/mifos/mobile/core/network/DataManager.kt index d49650a80..97beabc3b 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/DataManager.kt +++ b/core/network/src/main/java/org/mifos/mobile/core/network/DataManager.kt @@ -57,7 +57,7 @@ class DataManager @Inject constructor( ) { var clientId: Long? = preferencesHelper.clientId - suspend fun login(loginPayload: LoginPayload?): User { + suspend fun login(loginPayload: LoginPayload): User { return baseApiManager.authenticationApi.authenticate(loginPayload) } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/AuthenticationService.kt b/core/network/src/main/java/org/mifos/mobile/core/network/services/AuthenticationService.kt index d6cf6c972..3528a9dd1 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/AuthenticationService.kt +++ b/core/network/src/main/java/org/mifos/mobile/core/network/services/AuthenticationService.kt @@ -15,13 +15,8 @@ import org.mifos.mobile.core.model.entity.payload.LoginPayload import retrofit2.http.Body import retrofit2.http.POST -/** - * @author Vishwajeet - * @since 09/06/16 - */ - interface AuthenticationService { @POST(ApiEndPoints.AUTHENTICATION) - suspend fun authenticate(@Body loginPayload: LoginPayload?): User + suspend fun authenticate(@Body loginPayload: LoginPayload): User } diff --git a/fastlane/FastFile b/fastlane/FastFile index 6abc606bc..0734cbc16 100644 --- a/fastlane/FastFile +++ b/fastlane/FastFile @@ -34,37 +34,4 @@ platform :android do ) end - desc "Deploy internal tracks to Google Play" - lane :internal do - upload_to_play_store( - track: 'internal', - aab: 'androidApp/build/outputs/bundle/release/androidApp-release.aab', - skip_upload_metadata: true, - skip_upload_images: true, - skip_upload_screenshots: true, - ) - end - - desc "Promote internal tracks to beta on Google Play" - lane :beta do - upload_to_play_store( - track: 'internal', - track_promote_to: 'beta', - skip_upload_changelogs: true, - skip_upload_metadata: true, - skip_upload_images: true, - skip_upload_screenshots: true, - ) - end - - desc "Promote beta tracks to production on Google Play" - lane :production do - supply( - track: 'beta', - track_promote_to: 'production', - skip_upload_changelogs: true, - sync_image_upload: true, - ) - end - end diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile new file mode 100644 index 000000000..273a6b6f4 --- /dev/null +++ b/fastlane/Pluginfile @@ -0,0 +1,3 @@ +# Autogenerated by fastlane +# +# Ensure this file is checked in to source control! diff --git a/fastlane/README.md b/fastlane/README.md index 2b0b7945e..f6333c179 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -39,30 +39,6 @@ Promote internal tracks to beta on Google Play Promote beta tracks to production on Google Play -### android internal - -```sh -[bundle exec] fastlane android internal -``` - -Deploy internal tracks to Google Play - -### android beta - -```sh -[bundle exec] fastlane android beta -``` - -Promote internal tracks to beta on Google Play - -### android production - -```sh -[bundle exec] fastlane android production -``` - -Promote beta tracks to production on Google Play - ---- This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.