Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[auth][android] resolve signOut return undefined #174 #175

Merged
merged 6 commits into from
Mar 23, 2023

Conversation

kefahB
Copy link
Contributor

@kefahB kefahB commented Jan 21, 2023

Hi @NathanWalker @triniwiz

this is a PR in case you agree about #174.

@cla-bot cla-bot bot added the cla: yes label Jan 21, 2023
@kefahB
Copy link
Contributor Author

kefahB commented Feb 4, 2023

@NathanWalker
This is a little issue with logout can you verify and if ok push please.

Thanks

@mukaschultze
Copy link
Contributor

The native signOut return type on android is void, adding async in front of it won't cast it to boolean. I think the best solution would be to add a return true after calling the native method.

@kefahB
Copy link
Contributor Author

kefahB commented Feb 4, 2023

Currently it is return true but it doesn’t work

@kefahB
Copy link
Contributor Author

kefahB commented Feb 4, 2023

So we can register the plugin him self and resolve the promise!
according to the docs signOut has a completion handler.

@kefahB
Copy link
Contributor Author

kefahB commented Feb 5, 2023

@mukaschultze I updated the code since android return void in order to capture the real signOut event.

@NathanWalker @triniwiz What do you think about this way ?

async signOut(): Promise<boolean> {
    return new Promise((resolve, reject) => {
        this.native?.signOut();
        let timeout = setTimeout(() => {
            reject(false);
        }, 3000);
        this.addAuthStateChangeListener((user) => {
            clearTimeout(timeout);
            console.log("User signed out", user);
            if(user) {
                reject(false);
            }
            resolve(true);
        });
     })
}

@kefahB
Copy link
Contributor Author

kefahB commented Mar 9, 2023

@NathanWalker, @triniwiz .. any news aboutt this PR !

@triniwiz
Copy link
Member

triniwiz commented Mar 9, 2023 via email

@triniwiz triniwiz merged commit ab61707 into NativeScript:main Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants