[invites][links] Fix some iOS specific issues
This commit is contained in:
parent
8e2d03cc5a
commit
72a1d1d439
@ -2,6 +2,7 @@
|
||||
|
||||
#if __has_include(<FirebaseInvites/FirebaseInvites.h>)
|
||||
#import "RNFirebaseEvents.h"
|
||||
#import "RNFirebaseLinks.h"
|
||||
#import "RNFirebaseUtil.h"
|
||||
#import <FirebaseInvites/FirebaseInvites.h>
|
||||
|
||||
@ -155,11 +156,13 @@ RCT_EXPORT_METHOD(sendInvitation:(NSDictionary *) invitation
|
||||
return [FIRInvites handleUniversalLink:url completion:^(FIRReceivedInvite * _Nullable receivedInvite, NSError * _Nullable error) {
|
||||
if (error) {
|
||||
NSLog(@"Failed to handle invitation: %@", [error localizedDescription]);
|
||||
} else if (receivedInvite) {
|
||||
[RNFirebaseUtil sendJSEvent:self name:LINKS_LINK_RECEIVED body:@{
|
||||
} else if (receivedInvite && receivedInvite.inviteId) {
|
||||
[RNFirebaseUtil sendJSEvent:self name:INVITES_INVITATION_RECEIVED body:@{
|
||||
@"deepLink": receivedInvite.deepLink,
|
||||
@"invitationId": receivedInvite.inviteId,
|
||||
}];
|
||||
} else {
|
||||
[[RNFirebaseLinks instance] sendLink:receivedInvite.deepLink];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options;
|
||||
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler;
|
||||
- (void)sendLink:(NSString *)link;
|
||||
|
||||
@end
|
||||
|
||||
@ -22,3 +23,4 @@
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -39,7 +39,7 @@ RCT_EXPORT_MODULE();
|
||||
FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];
|
||||
if (dynamicLink && dynamicLink.url) {
|
||||
NSURL* url = dynamicLink.url;
|
||||
[RNFirebaseUtil sendJSEvent:self name:LINKS_LINK_RECEIVED body:url];
|
||||
[RNFirebaseUtil sendJSEvent:self name:LINKS_LINK_RECEIVED body:url.absoluteString];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
@ -56,7 +56,7 @@ continueUserActivity:(NSUserActivity *)userActivity
|
||||
NSLog(@"Failed to handle universal link: %@", [error localizedDescription]);
|
||||
} else {
|
||||
NSURL* url = dynamicLink ? dynamicLink.url : userActivity.webpageURL;
|
||||
[RNFirebaseUtil sendJSEvent:self name:LINKS_LINK_RECEIVED body:url];
|
||||
[RNFirebaseUtil sendJSEvent:self name:LINKS_LINK_RECEIVED body:url.absoluteString];
|
||||
}
|
||||
}];
|
||||
}
|
||||
@ -66,6 +66,10 @@ continueUserActivity:(NSUserActivity *)userActivity
|
||||
// ** Finish AppDelegate methods
|
||||
// *******************************************************
|
||||
|
||||
- (void)sendLink:(NSString *)link {
|
||||
[RNFirebaseUtil sendJSEvent:self name:LINKS_LINK_RECEIVED body:link];
|
||||
}
|
||||
|
||||
// ** Start React Module methods **
|
||||
RCT_EXPORT_METHOD(createDynamicLink: (NSDictionary *) metadata resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
||||
@try {
|
||||
|
@ -10,11 +10,7 @@ import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type App from '../core/app';
|
||||
|
||||
const EVENT_TYPE = {
|
||||
Link: 'links_link_received',
|
||||
};
|
||||
|
||||
const NATIVE_EVENTS = [EVENT_TYPE.Link];
|
||||
const NATIVE_EVENTS = ['links_link_received'];
|
||||
|
||||
export const MODULE_NAME = 'RNFirebaseLinks';
|
||||
export const NAMESPACE = 'links';
|
||||
@ -94,10 +90,6 @@ export default class Links extends ModuleBase {
|
||||
);
|
||||
}
|
||||
|
||||
get EVENT_TYPE(): Object {
|
||||
return EVENT_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create long Dynamic Link from parameters
|
||||
* @param parameters
|
||||
@ -153,6 +145,4 @@ export default class Links extends ModuleBase {
|
||||
}
|
||||
}
|
||||
|
||||
export const statics = {
|
||||
EVENT_TYPE,
|
||||
};
|
||||
export const statics = {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user