Skip to content

Commit

Permalink
Huawei AppGallery (#186)
Browse files Browse the repository at this point in the history
* Huawei AppGallery

* Huawei AppGallery

* Huawei AppGallery

* Huawei AppGallery

* Huawei AppGallery

* Huawei AppGallery

* Huawei AppGallery

* Huawei AppGallery

* Huawei AppGallery

* Huawei AppGallery
  • Loading branch information
michaelbel authored Dec 12, 2023
1 parent 124cb23 commit 209ef7f
Show file tree
Hide file tree
Showing 98 changed files with 996 additions and 474 deletions.
46 changes: 40 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.google.firebase.appdistribution.gradle.AppDistributionExtension
import java.io.FileInputStream
import org.apache.commons.io.output.ByteArrayOutputStream
import org.jetbrains.kotlin.konan.properties.Properties
Expand All @@ -7,9 +8,6 @@ plugins {
alias(libs.plugins.application)
alias(libs.plugins.kotlin)
alias(libs.plugins.androidx.navigation.safeargs)
alias(libs.plugins.google.services)
alias(libs.plugins.firebase.appdistribution)
alias(libs.plugins.firebase.crashlytics)
alias(libs.plugins.palantir.git)
id("movies-android-hilt")
}
Expand Down Expand Up @@ -47,6 +45,7 @@ afterEvaluate {

android {
namespace = "org.michaelbel.movies.app"
flavorDimensions += "version"

defaultConfig {
applicationId = "org.michaelbel.moviemade"
Expand Down Expand Up @@ -98,14 +97,14 @@ android {
"okhttp3.pro",
"coroutines.pro"
)
firebaseAppDistribution {
/*firebaseAppDistribution {
appId = "1:770317857182:android:876190afbc53df31"
artifactType = "APK"
testers = "[email protected]"
groups = "qa"
//releaseNotesFile="$rootProject.rootDir/releaseNotes.txt"
//serviceCredentialsFile = "$rootDir/config/firebase-app-distribution.json"
}
}*/
}
debug {
isDebuggable = true
Expand All @@ -130,6 +129,17 @@ android {
compose = true
}

productFlavors {
create("gms") {
dimension = "version"
applicationId = "org.michaelbel.moviemade"
}
create("hms") {
dimension = "version"
applicationId = "org.michaelbel.movies"
}
}

dynamicFeatures += setOf(":instant")

composeOptions {
Expand All @@ -150,12 +160,17 @@ android {
}
}

val gmsImplementation: Configuration by configurations
val hmsImplementation: Configuration by configurations
dependencies {
gmsImplementation(project(":core:platform-services:gms"))
hmsImplementation(project(":core:platform-services:hms"))

implementation(project(":core:analytics"))
implementation(project(":core:common"))
implementation(project(":core:interactor"))
implementation(project(":core:navigation"))
implementation(project(":core:notifications"))
implementation(project(":core:platform-services:interactor"))
implementation(project(":core:ui"))
implementation(project(":core:work"))
implementation(project(":feature:auth"))
Expand All @@ -173,4 +188,23 @@ dependencies {
androidTestImplementation(libs.androidx.benchmark.junit)

lintChecks(libs.lint.checks)
}

val hasGmsDebug: Boolean = gradle.startParameter.taskNames.any { it.contains("GmsDebug", ignoreCase = true) }
val hasGmsRelease: Boolean = gradle.startParameter.taskNames.any { it.contains("GmsRelease", ignoreCase = true) }
val hasGmsBenchmark: Boolean = gradle.startParameter.taskNames.any { it.contains("GmsBenchmark", ignoreCase = true) }

if (hasGmsDebug || hasGmsRelease || hasGmsBenchmark) {
apply(plugin = libs.plugins.google.services.get().pluginId)
apply(plugin = libs.plugins.firebase.crashlytics.get().pluginId)
apply(plugin = libs.plugins.firebase.appdistribution.get().pluginId)
}

if (hasGmsRelease) {
configure<AppDistributionExtension> {
appId = "1:770317857182:android:876190afbc53df31"
artifactType = "APK"
testers = "[email protected]"
groups = "qa"
}
}
File renamed without changes.
94 changes: 94 additions & 0 deletions app/src/gmsDebug/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"project_info": {
"project_number": "770317857182",
"firebase_url": "https://fir-moviemade.firebaseio.com",
"project_id": "firebase-moviemade",
"storage_bucket": "firebase-moviemade.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:770317857182:android:876190afbc53df31",
"android_client_info": {
"package_name": "org.michaelbel.moviemade"
}
},
"oauth_client": [
{
"client_id": "770317857182-ra2roi7lhsd8vl4mbk8kdbdvdgfnmpfg.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "org.michaelbel.moviemade",
"certificate_hash": "13b59c3892a3fb6ffd9627bd660de5f51f7327c0"
}
},
{
"client_id": "770317857182-4jq65b5vb04ocgdo2pveiua7b64lp2mn.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "org.michaelbel.moviemade",
"certificate_hash": "b861ce301449dcac09e522caa68deef9467cc702"
}
},
{
"client_id": "770317857182-v9pds8nn803n26p5ta3r4i949vkciqv9.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyC1Th1aOV2nV88wuyzm2GtxItVfTvAIh8U"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "770317857182-v9pds8nn803n26p5ta3r4i949vkciqv9.apps.googleusercontent.com",
"client_type": 3
}
]
}
},
"admob_app_id": "ca-app-pub-3651393080934289~1447245983"
},
{
"client_info": {
"mobilesdk_app_id": "1:770317857182:android:df63120ae349fa2f",
"android_client_info": {
"package_name": "org.michaelbel.moviemade.beta"
}
},
"oauth_client": [
{
"client_id": "770317857182-09e8on7fl9s2phnnulblfg5e0h06gre2.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "org.michaelbel.moviemade.beta",
"certificate_hash": "b861ce301449dcac09e522caa68deef9467cc702"
}
},
{
"client_id": "770317857182-v9pds8nn803n26p5ta3r4i949vkciqv9.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyC1Th1aOV2nV88wuyzm2GtxItVfTvAIh8U"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "770317857182-v9pds8nn803n26p5ta3r4i949vkciqv9.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
94 changes: 94 additions & 0 deletions app/src/gmsRelease/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"project_info": {
"project_number": "770317857182",
"firebase_url": "https://fir-moviemade.firebaseio.com",
"project_id": "firebase-moviemade",
"storage_bucket": "firebase-moviemade.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:770317857182:android:876190afbc53df31",
"android_client_info": {
"package_name": "org.michaelbel.moviemade"
}
},
"oauth_client": [
{
"client_id": "770317857182-ra2roi7lhsd8vl4mbk8kdbdvdgfnmpfg.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "org.michaelbel.moviemade",
"certificate_hash": "13b59c3892a3fb6ffd9627bd660de5f51f7327c0"
}
},
{
"client_id": "770317857182-4jq65b5vb04ocgdo2pveiua7b64lp2mn.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "org.michaelbel.moviemade",
"certificate_hash": "b861ce301449dcac09e522caa68deef9467cc702"
}
},
{
"client_id": "770317857182-v9pds8nn803n26p5ta3r4i949vkciqv9.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyC1Th1aOV2nV88wuyzm2GtxItVfTvAIh8U"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "770317857182-v9pds8nn803n26p5ta3r4i949vkciqv9.apps.googleusercontent.com",
"client_type": 3
}
]
}
},
"admob_app_id": "ca-app-pub-3651393080934289~1447245983"
},
{
"client_info": {
"mobilesdk_app_id": "1:770317857182:android:df63120ae349fa2f",
"android_client_info": {
"package_name": "org.michaelbel.moviemade.beta"
}
},
"oauth_client": [
{
"client_id": "770317857182-09e8on7fl9s2phnnulblfg5e0h06gre2.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "org.michaelbel.moviemade.beta",
"certificate_hash": "b861ce301449dcac09e522caa68deef9467cc702"
}
},
{
"client_id": "770317857182-v9pds8nn803n26p5ta3r4i949vkciqv9.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyC1Th1aOV2nV88wuyzm2GtxItVfTvAIh8U"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "770317857182-v9pds8nn803n26p5ta3r4i949vkciqv9.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
4 changes: 0 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@
android:name="org.michaelbel.movies.common.crashlytics.FirebaseCrashlyticsInitializer"
android:value="androidx.startup"/>-->

<meta-data
android:name="org.michaelbel.movies.common.timber.TimberInitializer"
android:value="androidx.startup" />

<meta-data
android:name="org.michaelbel.movies.network.flaker.FlakerInitializer"
android:value="androidx.startup" />
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/kotlin/org/michaelbel/movies/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@ import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject
import org.michaelbel.movies.common.config.ktx.installFirebaseApp
import org.michaelbel.movies.common.BuildConfig
import org.michaelbel.movies.common.crashlytics.CrashlyticsTree
import org.michaelbel.movies.platform.main.app.AppService
import org.michaelbel.movies.platform.main.crashlytics.CrashlyticsService
import org.michaelbel.movies.ui.appicon.installLauncherIcon
import timber.log.Timber

@HiltAndroidApp
internal class App: Application(), Configuration.Provider {

@Inject lateinit var workerFactory: HiltWorkerFactory
@Inject lateinit var appService: AppService
@Inject lateinit var crashlyticsService: CrashlyticsService

override val workManagerConfiguration: Configuration
get() = Configuration.Builder().setWorkerFactory(workerFactory).build()

override fun onCreate() {
super.onCreate()
installLauncherIcon()
installFirebaseApp()
appService.installApp()
Timber.plant(if (BuildConfig.DEBUG) Timber.DebugTree() else CrashlyticsTree(crashlyticsService))
}
}
20 changes: 11 additions & 9 deletions app/src/main/kotlin/org/michaelbel/movies/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@ import androidx.navigation.NavDestination
import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.WorkManager
import androidx.work.workDataOf
import com.google.firebase.messaging.FirebaseMessaging
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import org.michaelbel.movies.analytics.MoviesAnalytics
import org.michaelbel.movies.common.inappupdate.di.InAppUpdate
import org.michaelbel.movies.common.ktx.printlnDebug
import org.michaelbel.movies.common.theme.AppTheme
import org.michaelbel.movies.common.viewmodel.BaseViewModel
import org.michaelbel.movies.interactor.Interactor
import org.michaelbel.movies.platform.main.messaging.MessagingService
import org.michaelbel.movies.platform.main.messaging.TokenListener
import org.michaelbel.movies.platform.main.update.UpdateService
import org.michaelbel.movies.work.AccountUpdateWorker
import org.michaelbel.movies.work.MoviesDatabaseWorker

@HiltViewModel
internal class MainViewModel @Inject constructor(
private val interactor: Interactor,
private val inAppUpdate: InAppUpdate,
private val updateService: UpdateService,
private val analytics: MoviesAnalytics,
private val firebaseMessaging: FirebaseMessaging,
private val messagingService: MessagingService,
private val workManager: WorkManager
): BaseViewModel() {

Expand Down Expand Up @@ -57,18 +58,19 @@ internal class MainViewModel @Inject constructor(
}

fun startUpdateFlow(activity: Activity) {
inAppUpdate.startUpdateFlow(activity)
updateService.startUpdate(activity)
}

private fun fetchRemoteConfig() = launch {
interactor.fetchRemoteConfig()
}

private fun fetchFirebaseMessagingToken() {
firebaseMessaging.token.addOnCompleteListener { task ->
val token: String = task.result
printlnDebug("firebase messaging token: $token")
}
messagingService.setTokenListener(object: TokenListener {
override fun onNewToken(token: String) {
printlnDebug("firebase messaging token: $token")
}
})
}

private fun prepopulateDatabase() {
Expand Down
Binary file removed config/images/direct-apk.png
Binary file not shown.
Loading

0 comments on commit 209ef7f

Please sign in to comment.