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

10th version of plugin broke getToken method on iOS #456

Closed
SaintNK opened this issue Jul 15, 2020 · 1 comment
Closed

10th version of plugin broke getToken method on iOS #456

SaintNK opened this issue Jul 15, 2020 · 1 comment
Labels
bug Something isn't working properly ios relates to iOS platform

Comments

@SaintNK
Copy link

SaintNK commented Jul 15, 2020

Hello! On 10 version of plugin for iOS - FirebasePlugin.getToken(token => console.log(token),error =>console.error(error)) always returns undefined, because logic of method was broken:
now getToken in Objective-C source not use callback from javascript FirebasePlugin.getToken call, it use sendToken method

- (void)getToken:(CDVInvokedUrlCommand *)command {
@try {
[[FIRInstanceID instanceID] instanceIDWithHandler:^(FIRInstanceIDResult * _Nullable result,
NSError * _Nullable error) {
if (result.token != nil && error == nil) {
[self sendToken:result.token];

which always checks tokenRefreshCallbackId (which sets only by onTokenRefresh method)
- (void)onTokenRefresh:(CDVInvokedUrlCommand *)command {
self.tokenRefreshCallbackId = command.callbackId;
@try {

and send token only to this callback
if (self.tokenRefreshCallbackId != nil) {
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:token];
[pluginResult setKeepCallbackAsBool:YES];
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.tokenRefreshCallbackId];
}

and this is totally wrong and breaks specification.

So if you didn't call onTokenRefresh and call FirebasePlugin.getToken(token => console.log(token),error =>console.error(error)) plugin not send token at all.

Снимок экрана 2020-07-15 в 16 14 40

Снимок экрана 2020-07-15 в 16 15 49

@dpa99c dpa99c added bug Something isn't working properly ios relates to iOS platform labels Jul 15, 2020
@dpa99c dpa99c closed this as completed in 6d4a0d6 Jul 15, 2020
@dpa99c dpa99c added ready for release Something has been implemented and is awaiting release to npm and removed ready for release Something has been implemented and is awaiting release to npm labels Jul 15, 2020
@dpa99c
Copy link
Owner

dpa99c commented Jul 15, 2020

This has been fixed in [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly ios relates to iOS platform
Projects
None yet
Development

No branches or pull requests

2 participants