diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 40e6b29..4ad36b2 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -25,8 +25,8 @@ jobs: run: chmod +x gradlew - name: Build with Gradle run: ./gradlew build - - name: Upload artifact - uses: actions/upload-artifact@v2 + - name: Upload artifacts + uses: actions/upload-artifact@v4 with: name: android-app - path: app/build/outputs/apk/debug/app-debug.apk + path: app/build/outputs/apk/*/*/*.apk diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 489b59d..03ed029 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,28 +17,51 @@ android { defaultConfig { applicationId = "me.floow.app" minSdk = 28 - targetSdk = 34 + targetSdk = 35 versionCode = 1 versionName = "1.0" - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true } - val secretsFile = project.rootProject.file("secrets.properties") - val secretsProperties = Properties() - secretsProperties.load(secretsFile.inputStream()) +// val secretsFile = project.rootProject.file("secrets.properties") +// val secretsProperties = Properties() +// secretsProperties.load(secretsFile.inputStream()) - val googleClientId = secretsProperties.getProperty("googleClientId") ?: "" +// val googleClientId = secretsProperties.getProperty("googleClientId") ?: "" buildConfigField( type = "String", name = "GOOGLE_CLIENT_ID", - value = googleClientId + value = "BUILD_TYPE" // mock ) } + flavorDimensions += "data" + + productFlavors { + create("production") { + dimension = "data" + + buildConfigField( + name = "USE_MOCK_DATA", + value = "false", + type = "boolean" + ) + } + + create("mock") { + dimension = "data" + applicationIdSuffix = ".mock" + buildConfigField( + name = "USE_MOCK_DATA", + value = "true", + type = "boolean" + ) + } + } + buildTypes { release { isMinifyEnabled = true @@ -106,4 +129,4 @@ dependencies { androidTestImplementation(libs.ui.test.junit4) debugImplementation(libs.ui.tooling) debugImplementation(libs.ui.test.manifest) -} \ No newline at end of file +} diff --git a/app/google-services.json b/app/google-services.json index 03b6b11..fcfdc7f 100644 --- a/app/google-services.json +++ b/app/google-services.json @@ -23,7 +23,26 @@ "other_platform_oauth_client": [] } } + }, + { + "client_info": { + "mobilesdk_app_id": "1:291755427997:android:a5bdc8e67ad57b441a2c74", + "android_client_info": { + "package_name": "me.floow.app.mock" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyDtGUu5IMFTc5-PW5Ta2LkPmlCrolVUOdo" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } } ], "configuration_version": "1" -} \ No newline at end of file +} diff --git a/app/src/main/java/me/floow/app/MainActivity.kt b/app/src/main/java/me/floow/app/MainActivity.kt index c05c322..7d20b2b 100644 --- a/app/src/main/java/me/floow/app/MainActivity.kt +++ b/app/src/main/java/me/floow/app/MainActivity.kt @@ -14,6 +14,7 @@ import me.floow.chatssearch.di.usersearchModule import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch +import me.floow.app.BuildConfig.* import me.floow.app.di.apiModule import me.floow.app.di.appModule import me.floow.app.di.authModule @@ -49,15 +50,14 @@ class MainActivity : ComponentActivity() { startKoin { androidContext(this@MainActivity) - val mockDependencies = false // TODO: make build flavors with and without mocks - - if (!mockDependencies) { + @Suppress("KotlinConstantConditions") + if (USE_MOCK_DATA) { modules( appModule, apiModule, - authModule, + mockAuthModule, databaseModule, - dataModule, + mockDataModule, domainModule, mockModule, loginModule, @@ -69,9 +69,9 @@ class MainActivity : ComponentActivity() { modules( appModule, apiModule, - mockAuthModule, + authModule, databaseModule, - mockDataModule, + dataModule, domainModule, mockModule, loginModule, @@ -123,4 +123,4 @@ class MainActivity : ComponentActivity() { super.attachBaseContext(newBase?.createConfigurationContext(newConfiguration)) } -} \ No newline at end of file +} diff --git a/app/src/mock/res/values/strings.xml b/app/src/mock/res/values/strings.xml new file mode 100644 index 0000000..23c58cc --- /dev/null +++ b/app/src/mock/res/values/strings.xml @@ -0,0 +1,3 @@ + + Flow (Mock) + diff --git a/feature/profile/build.gradle.kts b/feature/profile/build.gradle.kts index 1fafe49..456f7c3 100644 --- a/feature/profile/build.gradle.kts +++ b/feature/profile/build.gradle.kts @@ -45,4 +45,4 @@ dependencies { androidTestImplementation(libs.androidx.test.ext.junit) androidTestImplementation(libs.espresso.core) -} \ No newline at end of file +} diff --git a/feature/shared/.gitignore b/feature/shared/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/feature/shared/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 11a9b24..8ea0209 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,4 +21,4 @@ kotlin.code.style=official # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true -android.defaults.buildfeatures.buildconfig=true +