Open lettertoamit opened 5 years ago
Here is my version:
const application = require("tns-core-modules/application");
const localize = require("nativescript-localize");
var SocialLogin = require("nativescript-social-login");
application.setResources({ L: localize });
application.on(application.launchEvent, function (args) {
});
if (application.ios) {
var MyDelegate = (function (_super) {
__extends(MyDelegate, _super);
function MyDelegate() {
return _super !== null && _super.apply(this, arguments) || this;
}
MyDelegate.prototype.applicationDidFinishLaunchingWithOptions = function (application, launchOptions) {
var gglDelegate = false;
try {
var errorRef = new interop.Reference();
GGLContext.sharedInstance().configureWithError(errorRef);
var signIn = GIDSignIn.sharedInstance();
gglDelegate = true;
}
catch (error) {
console.log(error);
}
var fcbDelegate = FBSDKApplicationDelegate.sharedInstance().applicationDidFinishLaunchingWithOptions(application, launchOptions); // facebook login delegate
return gglDelegate || fcbDelegate;
};
MyDelegate.prototype.applicationOpenURLSourceApplicationAnnotation = function (application, url, sourceApplication, annotation) {
var fcbDelegate = FBSDKApplicationDelegate.sharedInstance().applicationOpenURLSourceApplicationAnnotation(application, url, sourceApplication, annotation); // facebook login delegate
var gglDelegate = GIDSignIn.sharedInstance().handleURLSourceApplicationAnnotation(url, sourceApplication, annotation); // google login delegate
return fcbDelegate || gglDelegate;
};
MyDelegate.ObjCProtocols = [UIApplicationDelegate];
return MyDelegate;
}(UIResponder));
application.ios.delegate = MyDelegate;
}
if (application.android) {
application.android.on(application.AndroidApplication.activityResumedEvent, () => {
let result = SocialLogin.init();
});
}
application.run({ moduleName: "app-root/app-root" });
Here is my version:
const application = require("tns-core-modules/application"); const localize = require("nativescript-localize"); var SocialLogin = require("nativescript-social-login"); application.setResources({ L: localize }); application.on(application.launchEvent, function (args) { }); if (application.ios) { var MyDelegate = (function (_super) { __extends(MyDelegate, _super); function MyDelegate() { return _super !== null && _super.apply(this, arguments) || this; } MyDelegate.prototype.applicationDidFinishLaunchingWithOptions = function (application, launchOptions) { var gglDelegate = false; try { var errorRef = new interop.Reference(); GGLContext.sharedInstance().configureWithError(errorRef); var signIn = GIDSignIn.sharedInstance(); gglDelegate = true; } catch (error) { console.log(error); } var fcbDelegate = FBSDKApplicationDelegate.sharedInstance().applicationDidFinishLaunchingWithOptions(application, launchOptions); // facebook login delegate return gglDelegate || fcbDelegate; }; MyDelegate.prototype.applicationOpenURLSourceApplicationAnnotation = function (application, url, sourceApplication, annotation) { var fcbDelegate = FBSDKApplicationDelegate.sharedInstance().applicationOpenURLSourceApplicationAnnotation(application, url, sourceApplication, annotation); // facebook login delegate var gglDelegate = GIDSignIn.sharedInstance().handleURLSourceApplicationAnnotation(url, sourceApplication, annotation); // google login delegate return fcbDelegate || gglDelegate; }; MyDelegate.ObjCProtocols = [UIApplicationDelegate]; return MyDelegate; }(UIResponder)); application.ios.delegate = MyDelegate; } if (application.android) { application.android.on(application.AndroidApplication.activityResumedEvent, () => { let result = SocialLogin.init(); }); } application.run({ moduleName: "app-root/app-root" });
really thank you for your reply , I will try it on . But I used nativescript-oauth2 plugin for now .
I had the same issue and resolved it
add below lines before if (application.ios) {
` declare class UIResponder {}; declare class UIApplicationDelegate{}; declare class FBSDKApplicationDelegate { static sharedInstance():any; };
declare class GGLContext { static sharedInstance():any; };
declare class GIDSignIn { static sharedInstance():any; };
declare class FBSDKAppEvents{ static activateApp(); }; declare class UIApplication {}; declare class NSDictionary {};`
Can't find variable: FBSDKApplicationDelegate,
app.js
The js code given in https://github.com/mkloubert/nativescript-social-login#javascript . not working , i am working on nativescript( javascript ) without any framework like TS , angular or view.