brandonmcansh
11/26/2023, 10:39 PM/ios/ios/iOSApp.swift:3:8: error: no such module 'GoogleSignIn'
import GoogleSignIn
when compiling from Android Studio but compiles and runs from XCode without an issue.brandonmcansh
11/26/2023, 10:39 PMlistOf(
iosArm64(),
iosSimulatorArm64(),
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "shared"
isStatic = true
}
}
cocoapods {
version = "1.0.0"
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "14.1"
podfile = project.file("../ios/Podfile") // why doesn't it load the cocoapods from the iosApp podfile?
pod("GoogleSignIn") {
version = "7.0.0"
}
}
build.gradle.kts for sharedbrandonmcansh
11/26/2023, 10:40 PMsource '<https://cdn.cocoapods.org>'
target 'ios' do
use_frameworks!
platform :ios, '14.1'
pod 'GoogleSignIn', '7.0.0'
end
Podfilebrandonmcansh
11/26/2023, 10:44 PMbrandonmcansh
11/26/2023, 11:11 PMRaed Ghazal
11/27/2023, 3:42 AMJoel Denke
11/27/2023, 3:52 AMbrandonmcansh
11/27/2023, 12:49 PMRaed Ghazal
11/27/2023, 1:44 PMapp
directory
now I migrated my app to KMP, where should my json file be stored to use the default_web_client_id
string? initially I moved it to the shared module and had to create a new app in firebase [Name]Shared
with package [package].shared
it would be used for both android and iOS, but then it didn’t work and knew that i had to implement the id of iOS differently and the android app package name wasn’t changed to .shared
so the new firebase app didn’t match the package name
so I went back to using my old json file from the android directory but now this doesn’t work as well for some reason
the google dialog launches but picking an account doesn’t do anything, the activity result is not called at all, any idea where things might have went wrong here?
I’ll post snippets to make it easier to understand in the next messageRaed Ghazal
11/27/2023, 1:48 PMApplication.kt
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(androidContext().getString(R.string.default_web_client_id))
.requestEmail()
.build()
val googleSignInClient = GoogleSignIn.getClient(androidContext(), gso)
setupGoogleSignIn(googleSignInClient) <- this function is in shared/androidMain
androidMain/ShowGoogleSignIn.kt
private var googleSignInClient: GoogleSignInClient? = null
fun setupGoogleSignIn(id: GoogleSignInClient) {
googleSignInClient = id
}
@Composable
actual fun ShowGoogleSignIn(
onSignInWithGoogleResultReceived: (Boolean, Task<String>) -> Unit
) {
val signInWithGoogleLauncher = rememberLauncherForActivityResult(
ActivityResultContracts.StartActivityForResult()
) {
val result = it.resultCode == Activity.RESULT_OK
val task = GoogleSignIn.getSignedInAccountFromIntent(it.data)
onSignInWithGoogleResultReceived(result, task)
}
googleSignInClient?.signOut()
LaunchedEffect(Unit) {
signInWithGoogleLauncher.launch(
googleSignInClient?.signInIntent
)
}
}
commonMain/SignInScreen.kt
ShowGoogleSignIn { result, task ->
viewModel.onEvent(SignInEvents.OnSignInWithGoogleResultReceived(result, task))
}
Raed Ghazal
11/27/2023, 1:50 PMandroidApp
directory
and debug SHA1 & SHA-256 are taken by running this signingReport
Joel Denke
11/27/2023, 3:59 PMRaed Ghazal
11/27/2023, 4:00 PMRaed Ghazal
11/27/2023, 4:00 PMJoel Denke
11/27/2023, 4:00 PMJoel Denke
11/27/2023, 4:01 PMRaed Ghazal
11/27/2023, 4:01 PMJoel Denke
11/27/2023, 4:02 PM<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
Raed Ghazal
11/27/2023, 4:03 PMGoogleSignIn.getClient
part? androidApp or androidMain?Joel Denke
11/27/2023, 4:03 PMJoel Denke
11/27/2023, 4:04 PMRaed Ghazal
11/27/2023, 4:04 PMJoel Denke
11/27/2023, 4:05 PMJoel Denke
11/27/2023, 4:05 PMJoel Denke
11/27/2023, 4:05 PMColton Idle
01/17/2024, 5:59 PMJoel Denke
01/17/2024, 6:45 PMJoel Denke
01/17/2024, 6:46 PMColton Idle
01/17/2024, 7:35 PMColton Idle
01/17/2024, 7:35 PMColton Idle
01/17/2024, 7:36 PMproductFlavors {
create("free") {
dimension = "stage"
applicationIdSuffix = ".free"
}
create("paid") { dimension = "stage" }
}
then in the root kotlin {} block
i have
sourceSets {
sourceSets.invokeWhenCreated("androidFree") {
}
sourceSets.invokeWhenCreated("androidPaid") {
}
I updated my dirs from /free and /paid to androidFree and androidPaid.
does that all seem correct?