Code Monkey home page Code Monkey logo

Comments (3)

jan-tennert avatar jan-tennert commented on June 12, 2024

You can just publish the library to maven local and then use it as a normal library. In order to do that,

  • Comment out this line:
    signAllPublications()
  • Change the version to something different like 2.1.0-local-1 (change this as you want):
    supabase-version = 2.1.0
  • Run gradlew publishToMavenLocal, wait for it to finish
  • Use the locally published library exactly like you'd add the "real" library, just with your defined version. Also make sure to add the mavenLocal() repository for your dependencies (within your app)

If you just have a small change which doesn't require a full app to test, you can create a "test" module within the cloned supabase-kt project and just make a small jvm module or something like that and run it. You can add the modules (e.g. realtime) via implementation(project(":realtime-kt")).

Remember to reverse such changes when making a PR, the "test" module is in the gitignore file and always added in the settings.gradle.kts file, so you can always have that there.

from supabase-kt.

Vaibhav-214 avatar Vaibhav-214 commented on June 12, 2024

thanks @jan-tennert , I was able to run it locally and have found out where the issue is happening, still not sure if it is something on my end but here is what I found

and Should I create a new issue with these details?

I have added the code and the logs output below

I put some logs in the method "rememberSignInWithApple" and here are my obervations

1.The method runs as soon as the app opens, without user doing anything, although the code inside launched effect doesnt runs and directly the last log is printed

  1. Then when I click on the sign in button all the statments that are marked "executed" run in an instant without me doing anything

3.Nothing is executed after I click on "signIn"(after putting password in the box) in the apple native signin ui

4."nonce" and the "user" properties are showing null

5.All properties inside the config.loginConfig["apple"] object are null, even though object is not null

6.IMPORTANT -looks like authorizationController() method is never executed, I had put some logs in that method too but nothing was printed and also the print statement "I am here 10" was not printed

@Composable
actual fun ComposeAuth.rememberSignInWithApple(
    onResult: (NativeSignInResult) -> Unit,
    fallback: suspend () -> Unit
): NativeSignInState {

    val state = remember { NativeSignInState() }
    val scope = rememberCoroutineScope()

    LaunchedEffect(key1 = state.started) {
        println("I am inside launched effect")//executed
        if (state.started) {
            println("I am inside first if block , which means state is set to started")//executed

            println("${config.loginConfig["apple"]}")
            if (config.loginConfig["apple"] == null) {
                println("I am inside 2nd if block , which shouldn't happen")// NOT EXECUTED
                fallback.invoke()
                state.reset()
                return@LaunchedEffect
            }

            val appleIDProvider = ASAuthorizationAppleIDProvider()
            val request = appleIDProvider.createRequest().apply {
                requestedScopes = listOf(ASAuthorizationScopeFullName, ASAuthorizationScopeEmail)
                nonce = (config.loginConfig["apple"] as? AppleLoginConfig)?.nonce
                println("loginConfig - ${config.loginConfig["apple"]}  server client id - ${config.loginConfig["apple"]?.serverClientId}")//executed
                println("requested scopes - $requestedScopes , nounce - $nonce  ")//executed
            }
            println("request - $request - user - ${request.user}")//executed


            val controller = ASAuthorizationController(listOf(request)).apply {
                println("i m inside controller ${this.delegate}")//executed
                delegate = authorizationController(scope) {
                    println(" I m here 10")// **** NOT EXECUTED ****
                    onResult.invoke(it)
                    state.reset()
                }

                println("I am here in the controller") // EXECUTED

                presentationContextProvider = presentationAnchor()


            }
            println("controller - $controller - delegate ${controller.delegate}") // EXECUTED
            println(" i am on my way further 3") // EXECUTED
            controller.performRequests()

            println("I am after the perfrom Reuest function")

        }
    }
    println("I am outside launched effect and state is $state.") //Executed first

    return state
}

##output

I am outside launched effect and state is io.github.jan.supabase.compose.auth.composable.NativeSignInState@8a32be0. I am inside launched effect starting apple auth I am outside launched effect and state is io.github.jan.supabase.compose.auth.composable.NativeSignInState@8a32be0. I am inside launched effect I am inside first if block , which means state is set to started AppleLoginConfig(serverClientId=, nonce=null, extraData=null) loginConfig - AppleLoginConfig(serverClientId=, nonce=null, extraData=null) server client id - requested scopes - [full_name, email] , nounce - null request - <ASAuthorizationAppleIDRequest: 0x60000213c820> - user - null i m inside controller null I am here in the controller controller - <ASAuthorizationController: 0x60000390a2f0> - delegate <ComposeApp_kobjc5: 0x600000260740> i am on my way further 3 I am after the perfrom Reuest function

from supabase-kt.

jan-tennert avatar jan-tennert commented on June 12, 2024

Yes, I created a new issue for you: #447

from supabase-kt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.