capacitor-community / apple-sign-in

Sign in with Apple Support
MIT License
135 stars 58 forks source link

How to prevent "registerWebPlugin" for iOS? #31

Closed mesqueeb closed 3 years ago

mesqueeb commented 3 years ago

So the docs say we need to execute

registerWebPlugin(SignInWithApple);

but is this only for the web?

If the user uses the plugin on iOS capacitor app, what is the recommended way to not execute registerWebPlugin(SignInWithApple); for that case?

getDeviceInfo is async, so it's not ideal right?

mirko77 commented 3 years ago

I usually access getDeviceInfo when bootstrapping the app and save it in a global object I can access whenever I need.

cyril-colin commented 3 years ago

In order to avoid the registerWebPlugin(SignInWithApple); I just import the module (that already make this call, only on web environment due to capacitor mecanism :

import '@capacitor-community/apple-sign-in'; // This call avoid needs to call registerWebPlugin
import {
    SignInWithAppleResponse,
    SignInWithAppleOptions,
} from '@capacitor-community/apple-sign-in';
import {Plugins} from '@capacitor/core';

Hope this helps !