From cafa6797598e8664cadcd1a8ce69c488f48b4997 Mon Sep 17 00:00:00 2001 From: Christophe Tremblay Date: Mon, 6 Nov 2023 16:53:29 -0500 Subject: [PATCH] setup appcenter --- androidApp/build.gradle.kts | 2 ++ gradle/libs.versions.toml | 3 +++ ios/Podfile | 1 + ios/Podfile.lock | 8 +++++++- ios/iosApp/AppInitializer.swift | 9 +++++++++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index e5b5b6c..cd2f2e4 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -95,4 +95,6 @@ dependencies { implementation(libs.koin.androidx.compose.navigation) implementation(libs.trikot.viewmodels.databinding) implementation(libs.trikot.vmd.compose) + "ciImplementation"(libs.appcenter) + "storeImplementation"(libs.appcenter.play) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9e69d8d..c23922e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,6 +9,7 @@ play-services-measurement-api = "21.5.0" androidxActivityCompose = "1.8.0" androidxAppcompat = "1.6.1" androidxComposeBom = "2023.10.01" +appcenter = "5.0.0" apollo = "3.7.4" crashlytics-plugin = "2.9.9" killswitch = "1.0.4" @@ -43,6 +44,8 @@ androidx-compose-material = { group = "androidx.compose.material", name = "mater android-firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase" } android-firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-ktx" } android-firebase-analytics = { module = "com.google.firebase:firebase-analytics-ktx" } +appcenter = { module = "com.microsoft.appcenter:appcenter-distribute", version.ref = "appcenter"} +appcenter-play = { module = "com.microsoft.appcenter:appcenter-distribute-play", version.ref = "appcenter"} apollo-runtime = { group = "com.apollographql.apollo3", name = "apollo-runtime" } killswitch = { module = "com.mirego.killswitch-mobile:killswitch", version.ref = "killswitch" } koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } diff --git a/ios/Podfile b/ios/Podfile index 75daacd..973c42f 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -8,6 +8,7 @@ target 'iosApp' do use_frameworks! platform :ios, $deploymentTarget # Thirdo-party + pod 'AppCenter/Distribute' pod 'FirebaseCore' pod 'FirebaseAnalytics' diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 4e8e454..3b1440a 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,4 +1,7 @@ PODS: + - AppCenter/Core (5.0.4) + - AppCenter/Distribute (5.0.4): + - AppCenter/Core - FirebaseAnalytics (10.16.0): - FirebaseAnalytics/AdIdSupport (= 10.16.0) - FirebaseCore (~> 10.0) @@ -88,6 +91,7 @@ PODS: - Trikot/viewmodels.declarative.flow DEPENDENCIES: + - AppCenter/Distribute - FirebaseAnalytics - FirebaseCore - Shared (from `../shared`) @@ -97,6 +101,7 @@ DEPENDENCIES: SPEC REPOS: trunk: + - AppCenter - FirebaseAnalytics - FirebaseCore - FirebaseCoreInternal @@ -122,6 +127,7 @@ CHECKOUT OPTIONS: :tag: 5.2.0 SPEC CHECKSUMS: + AppCenter: 85c92db0759d2792a65eb61d6842d2e86611a49a FirebaseAnalytics: 7b41efc4eba5ff841cc94d5994b5f339361258f4 FirebaseCore: 65a801af84cca84361ef9eac3fd868656968a53b FirebaseCoreInternal: 26233f705cc4531236818a07ac84d20c333e505a @@ -136,6 +142,6 @@ SPEC CHECKSUMS: SwiftUIIntrospect: 53b6a16734c822804ff82c35d9073d8d8edfb085 Trikot: ca201c8ae67ff21f35a60a0bda6c600fbe51b282 -PODFILE CHECKSUM: 8c6a75418b236f7d0081b7844d58c4e6b129cedb +PODFILE CHECKSUM: 85b292e2fef97a1359500ae62489551542a67efb COCOAPODS: 1.13.0 diff --git a/ios/iosApp/AppInitializer.swift b/ios/iosApp/AppInitializer.swift index b0f80cc..6a4c940 100644 --- a/ios/iosApp/AppInitializer.swift +++ b/ios/iosApp/AppInitializer.swift @@ -1,3 +1,5 @@ +import AppCenter +import AppCenterDistribute import FirebaseCore import Foundation import Kingfisher @@ -7,6 +9,7 @@ import Trikot enum AppInitializer { static func initializeComponents(environment _: AppEnvironment) { initializeFirebase() + initializeAppCenter() initializeCommon() initializeKingfisher() inititalizeKillSwitch() @@ -30,6 +33,12 @@ enum AppInitializer { SharedAnalyticsConfiguration().analyticsManager = firebaseAnalyticsService } + + private static func initializeAppCenter() { + guard let appCenterSecret = Bundle.main.object(forInfoDictionaryKey: "APP_CENTER_APP_SECRET") as? String, !appCenterSecret.isEmpty else { return } + Distribute.updateTrack = .private + AppCenter.start(withAppSecret: appCenterSecret, services: [Distribute.self]) + } private static func initializeCommon() { TrikotKword.shared.setCurrentLanguage(Foundation.Locale.isPreferredLanguagesFrench ? "fr" : "en")