-
-
Notifications
You must be signed in to change notification settings - Fork 50
warning: Conflict with existing popular plugins such as nativescript-firebase #218
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
Comments
Any news about this ? |
@Mixelated How did you manage to fix this ? |
Hey @daweedm rather than working with nativescript-facebook I just did everything with nativescript firebase |
Any news about this ? I need both plugins |
My hacky solution was the following : Put to bottom of (function () {
function extractAppURL(urlParam) {
if (!!urlParam) {
var url_1 = urlParam.toString(),
params = new Map(), urlWithPath = url_1.indexOf('//') < url_1.length - 2,
urlWithParams = url_1.indexOf('?') !== -1, path = urlWithPath ? url_1.substring(url_1.indexOf('//') + 2,
urlWithParams ? url_1.indexOf('?') : url_1.length) : null,
parameters = url_1.substring(url_1.indexOf('?') + 1).split('&');
if (urlWithParams) {
for (var i = 0, len = parameters.length; i < len; i++) {
var paramData = parameters[i].split('=');
params.set(paramData[0], paramData[1] ? paramData[1] : null);
}
}
return {
params: params,
path: path,
toString: function () {
return url_1;
}
};
} else {
return null;
}
}
getAppDelegate().prototype.applicationOpenURLOptions = function (application, url, options) {
if (getAppDelegate().prototype.___DS_IOS_HANDLER) {
FBSDKApplicationDelegate.sharedInstance.applicationOpenURLSourceApplicationAnnotation(application, url, options.valueForKey(UIApplicationOpenURLOptionsSourceApplicationKey), options.valueForKey(UIApplicationOpenURLOptionsAnnotationKey));
var lastArgument = arguments[arguments.length - 1];
var previousResult = lastArgument !== options ? lastArgument : undefined;
if (!previousResult) {
var appURL_1 = extractAppURL(url.absoluteString);
if (appURL_1 != null) {
setTimeout(function () { return getAppDelegate().prototype.___DS_IOS_HANDLER(appURL_1); });
}
return true;
}
return previousResult;
}
};
getAppDelegate().prototype
.applicationContinueUserActivityRestorationHandler = function (application, userActivity, restorationHandler) {
if (getAppDelegate().prototype.___DS_IOS_HANDLER) {
if (userActivity.activityType === NSUserActivityTypeBrowsingWeb) {
var appURL_2 = extractAppURL(userActivity.webpageURL);
if (appURL_2 !== null) {
setTimeout(function () { return getAppDelegate().prototype.___DS_IOS_HANDLER(appURL_2); });
}
}
return true;
}
};
})(); Then, in your require('tns-core-modules/application/application').ios.delegate.prototype.___DS_IOS_HANDLER = (url) => {
console.log('GOT url from ___DS_IOS_HANDLER', url);
setTimeout(() => this.ngZone.run(() => this.handleOpenURL(url)));
}; |
I worked around this a different way. Since I know the only other plugin I'm using that registers the ios.delegate is firebase, In the index.ios file I added this check.
This works because firebase looks for the FBSDKApplicationDelegate and if it exists then it uses it. Since firebase will use the FBSDKApplicationDelegate, then there is no need for this to register it again. |
nativescript-facebook is in conflict with other apps that show push notifications such as nativescript-firebase since it overrides other delegates as seen here. It took me quite a while to debug this.
nativescript-facebook/src/index.ios.ts
Line 11 in edfcb7c
The text was updated successfully, but these errors were encountered: