How to add Extension in uxl file

Hi, I am using Firebase login with Phone. And for notification verification I need to send device token to Firebase and receive silent notification like:

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [[FIRAuth auth] setAPNSToken:deviceToken type:FIRAuthAPNSTokenTypeProd];
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)notification
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    if ([[FIRAuth auth] canHandleNotification:notification]) {
        completionHandler(UIBackgroundFetchResultNoData);
        return;
    }
}

How can I declare these two method in uxl file like:

<Extensions Backend="CPlusPlus" Condition="iOS">

    <Require AppDelegate.SourceFile.DidFinishLaunchingWithOptions><![CDATA[
    [FIRApp configure];
]]></Require>

</Extensions>

Looking at the Firebase Email auth implementation for iOS, I see async stuff like this. Perhaps that is enough for you to implement whatever is needed?

If you explicitly need to add something to UXL files, could you please explain what that is, and why?

As per Firebase documentation:
To use phone number authentication, Firebase must be able to verify that phone number sign-in requests are coming from your app. There are two ways Firebase Authentication accomplishes this:

  1. Silent APNs notifications
  2. reCAPTCHA verification

Also later that documentation:
Firebase Authentication uses method swizzling to automatically obtain your app’s APNs token, to handle the silent push notifications that Firebase sends to your app, and to automatically intercept the custom scheme redirect from the reCAPTCHA verification page during verification.

So I need to add these two Push notification methods for sending device token and receive silent push notification so app directly verifies with that. I want to add these two methods in a uxl file like AppDelegate.SourceFile.DidFinishLaunchingWithOptions

Please check this link: Firebase iOS Phone auth.

Since that level of Foreign code is above my head, I’ve passed the information along to other people internally. Let’s hope they get back when they’re less busy.

On a side note, I was researching other things and came upon this forum post which might prove helpful, so I thought I’d share.

Hi Dhvl,

I’m assuming you’re adding something to Fuse.Firebase in this answer, but if not I can tweak my anwer.

For calls that should be handled during DidFinishLaunchingWithOptions call your native code from the constructor of the UXGlobalModule. For example see Fuse.Firebase/src/Firebase.Authentication.Google/JS.uno in the constructor there is a call to Firebase.Authentication.Google.GoogleService.Init(); which in turn is calling Firebase.Authentication.AuthService.RegisterAuthProvider(gs); this is implemented differently for the different platforms but ends up calling native code to do the initial setup.

This was pretty terse so please feel free to pester me for more details :slight_smile: