Skip to content

Commit

Permalink
Properly call libraries configuration from iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Tweener committed May 22, 2024
1 parent 6432bd2 commit 4575685
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 13 deletions.
4 changes: 4 additions & 0 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
9A3687712B7BC5C60089C026 /* FirebaseRemoteConfigSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 9A3687702B7BC5C60089C026 /* FirebaseRemoteConfigSwift */; };
9A3687732B7BC5C60089C026 /* FirebaseStorage in Frameworks */ = {isa = PBXBuildFile; productRef = 9A3687722B7BC5C60089C026 /* FirebaseStorage */; };
9A3687752B7BC5C60089C026 /* FirebaseStorageCombine-Community in Frameworks */ = {isa = PBXBuildFile; productRef = 9A3687742B7BC5C60089C026 /* FirebaseStorageCombine-Community */; };
9AFFDCB02BFDE60D00CFBF17 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9AFFDCAF2BFDE60D00CFBF17 /* GoogleService-Info.plist */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -47,6 +48,7 @@
7555FF7B242A565900829871 /* Kmplate.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Kmplate.app; sourceTree = BUILT_PRODUCTS_DIR; };
7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9AFFDCAF2BFDE60D00CFBF17 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -124,6 +126,7 @@
7555FF7D242A565900829871 /* iosApp */ = {
isa = PBXGroup;
children = (
9AFFDCAF2BFDE60D00CFBF17 /* GoogleService-Info.plist */,
058557BA273AAA24004C7B11 /* Assets.xcassets */,
7555FF82242A565900829871 /* ContentView.swift */,
7555FF8C242A565B00829871 /* Info.plist */,
Expand Down Expand Up @@ -234,6 +237,7 @@
files = (
058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */,
058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */,
9AFFDCB02BFDE60D00CFBF17 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
{
"originHash" : "c63c63846d9c539229e96de38d6af51417e28c0ee9a0bc48bd0f0f19d923c329",
"pins" : [
{
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "bfc0b6f81adc06ce5121eb23f628473638d67c5c",
"version" : "1.2022062300.0"
"revision" : "748c7837511d0e6a507737353af268484e1745e2",
"version" : "1.2024011601.1"
}
},
{
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "3e464dad87dad2d29bb29a97836789bf0f8f67d2",
"version" : "10.18.1"
"revision" : "076b241a625e25eac22f8849be256dfb960fcdfe",
"version" : "10.19.1"
}
},
{
"identity" : "firebase-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk",
"state" : {
"revision" : "f91c8167141d0279726c6f6d9d4a47c026785cbc",
"version" : "10.21.0"
"revision" : "9d17b500cd98d9a7009751ad62f802e152e97021",
"version" : "10.26.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "cb8617fab75d181270a1d8f763f26b15c73e2e1e",
"version" : "10.21.0"
"revision" : "16244d177c4e989f87b25e9db1012b382cfedc55",
"version" : "10.25.0"
}
},
{
Expand All @@ -59,8 +60,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "a673bc2937fbe886dd1f99c401b01b6d977a9c98",
"version" : "1.49.1"
"revision" : "e9fad491d0673bdda7063a0341fb6b47a30c5359",
"version" : "1.62.2"
}
},
{
Expand Down Expand Up @@ -118,5 +119,5 @@
}
}
],
"version" : 2
"version" : 3
}
1 change: 1 addition & 0 deletions iosApp/iosApp/iOSApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class iOSApp: App {

required init() {
KoinIosDIKt.doInitKoin()
LibrariesConfigurationHelper().doInitConfigurations()
}

var body: some Scene {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.tweener.changehere._internal.libs.firebase

/**
* @author Vivien Mahe
* @since 22/05/2024
*/

actual fun initializeFirebase() {
// Nothing to do for now
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.tweener.changehere._internal.di
import com.tweener.changehere.BuildKonfig
import com.tweener.changehere._internal.libs.LibrariesConfiguration
import com.tweener.changehere._internal.libs.coil.CoilConfiguration
import com.tweener.changehere._internal.libs.firebase.FirebaseConfiguration
import com.tweener.changehere._internal.libs.napier.CrashlyticsAntilog
import com.tweener.changehere._internal.libs.napier.NapierConfiguration
import com.tweener.changehere._internal.os.thread.CoroutinesThreadDispatcher
Expand All @@ -24,15 +25,16 @@ val sharedModule = module {
// Coil
single { CoilConfiguration() }

// Firebase Crashlytics
// Firebase
single { FirebaseConfiguration() }
single { CrashlyticsService() }

// Napier
single { CrashlyticsAntilog(crashlyticsService = get()) }
single { NapierConfiguration(isDebug = BuildKonfig.DEBUG, crashlyticsAntilog = get(), crashlyticsService = get()) }

// Libraries
single { LibrariesConfiguration(napierConfiguration = get()) }
single { LibrariesConfiguration(napierConfiguration = get(), firebaseConfiguration = get()) }

includes(dataModule(isDebug = BuildKonfig.DEBUG))
includes(domainModule)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tweener.changehere._internal.libs

import com.tweener.changehere._internal.libs.firebase.FirebaseConfiguration
import com.tweener.changehere._internal.libs.napier.NapierConfiguration

/**
Expand All @@ -8,9 +9,11 @@ import com.tweener.changehere._internal.libs.napier.NapierConfiguration
*/
class LibrariesConfiguration(
private val napierConfiguration: NapierConfiguration,
private val firebaseConfiguration: FirebaseConfiguration,
) {

fun init() {
napierConfiguration.init()
firebaseConfiguration.init()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.tweener.changehere._internal.libs.firebase

/**
* @author Vivien Mahe
* @since 22/05/2024
*/
class FirebaseConfiguration {

fun init() {
initializeFirebase()
}
}

expect fun initializeFirebase()
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.tweener.changehere._internal.di

import com.tweener.changehere._internal.libs.LibrariesConfiguration
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject

/**
* @author Vivien Mahe
* @since 22/05/2024
*/

class LibrariesConfigurationHelper : KoinComponent {

private val librariesConfiguration: LibrariesConfiguration by inject()

fun initConfigurations() {
librariesConfiguration.init()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.tweener.changehere._internal.libs.firebase

import dev.gitlive.firebase.Firebase
import dev.gitlive.firebase.initialize

/**
* @author Vivien Mahe
* @since 22/05/2024
*/

actual fun initializeFirebase() {
Firebase.initialize()
}

0 comments on commit 4575685

Please sign in to comment.