How can I handle iOS deeplink in iosMain using handleDeeplinks for google authentication? #940
Replies: 1 comment 2 replies
-
UPDATE: iosApp.swift import SwiftUI
import ComposeApp
@main
struct iOSApp: App {
var body: some Scene {
WindowGroup {
ContentView().onOpenURL { url in
KoinKt.provideSupabaseAuthDeeplinkHandler().handle(url: url.absoluteString)
}
}
}
} Koin.kt package com.quare.nuplist.di
import com.quare.nuplist.core.config.configModule
import com.quare.nuplist.core.navigation.di.navigationModule
import com.quare.nuplist.feature.di.loginModule
import com.quare.nuplist.feature.main.di.mainModule
import com.quare.nuplist.feature.settings.di.settingsModule
import org.koin.core.KoinApplication
import org.koin.core.component.KoinComponent
import org.koin.core.component.get
import org.koin.core.context.startKoin
import org.koin.core.module.Module
expect val platformModule: Module
fun initializeKoin(
config: (KoinApplication.() -> Unit)? = null,
) {
startKoin {
config?.invoke(this)
modules(
platformModule,
configModule,
mainModule,
loginModule,
navigationModule,
settingsModule,
)
}
}
fun provideSupabaseAuthDeeplinkHandler(): SupabaseAuthDeeplinkHandler {
val koinComponent = object : KoinComponent {
val supabaseAuthDeeplinkHandler: SupabaseAuthDeeplinkHandler get() = get()
}
return koinComponent.supabaseAuthDeeplinkHandler
} In iosMain package com.quare.nuplist.core.supabase
import com.quare.nuplist.di.SupabaseAuthDeeplinkHandler
import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.auth.handleDeeplinks
import platform.Foundation.NSURL
class IosSupabaseAuthDeeplinkHandler(
private val supabaseClient: SupabaseClient
): SupabaseAuthDeeplinkHandler {
override fun handle(url: String) {
supabaseClient.handleDeeplinks(NSURL(string = url))
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to handle my iOS deeplinks in iOSMain module to complete my authentication flow with Google in iOS using handleDeeplinks extension (there's no example in the samples). I think I should have something like
applicationHandleOpenURL
fromUIApplication.sharedApplication.delegate
inplatform.UIKit.UIApplication
to use like:But I can't find...
Here's my code:
MainViewController.kt
InitializeKoin.ios.kt
IosSupabaseProvider.kt
I added in my
Info.plist
the following:I also added the deeplink in my URL configuration in Supabase:
Beta Was this translation helpful? Give feedback.
All reactions