Skip to content

Commit 6621292

Browse files
author
Vladimir Amiorkov
authored
feat: upgrade to latest native iOS Facebook SDK frameworks (#189)
* feat: upgrade to latest native iOS Facebook SDK frameworks * chore: update "custom login" test to latest native framework changes * chore: update e2e test in Vue demo
1 parent 6376efa commit 6621292

File tree

17 files changed

+262
-612
lines changed

17 files changed

+262
-612
lines changed

demo-angular/app/app.module.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
22
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
33
import { NativeScriptRouterModule } from "nativescript-angular/router";
44
import { AppComponent } from "./app.component";
5-
import { LoginModule } from "./pages/login/login.module";
6-
import { HomeModule } from "./pages/home/home.module";
75
import { NativeScriptFacebookModule } from "nativescript-facebook/angular";
86
import * as application from 'tns-core-modules/application';
97
import { routes } from "./app.routing";
108
import { NavigationService } from "./services/navigation.service";
11-
import { init, LoginBehavior } from "nativescript-facebook";
9+
import { init } from "nativescript-facebook";
1210

1311
application.on(application.launchEvent, function (args) {
14-
init("1771472059772879", LoginBehavior.LoginBehaviorWeb);
12+
init("1771472059772879");
1513
});
1614

1715
@NgModule({

demo-vue/app/app.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Login from "./components/Login";
44

55
import {
66
init,
7-
LoginBehavior
87
} from 'nativescript-facebook';
98

109
import FacebookPlugin from "nativescript-facebook/vue";
@@ -13,7 +12,7 @@ Vue.use(FacebookPlugin);
1312
Vue.config.silent = true;
1413

1514
application.on(application.launchEvent, function (args) {
16-
init("1771472059772879", LoginBehavior.LoginBehaviorWeb);
15+
init("1771472059772879");
1716
});
1817

1918
new Vue({

demo-vue/e2e/test.e2e.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ describe("Facebook tests", async function () {
7777
await driver.wait(1000);
7878
await allFields[0].sendKeys(USERNAME);
7979
} else {
80+
const continueBtn = await driver.findElementByText("Continue");
81+
await continueBtn.click();
82+
8083
const passField = await driver.findElementByClassName(driver.locators.getElementByName("securetextfield"));
8184
await passField.click();
8285
await passField.sendKeys(PASSWORD);

demo/app/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as application from 'tns-core-modules/application';
2-
import { init, LoginBehavior } from "nativescript-facebook";
2+
import { init } from "nativescript-facebook";
33

44
application.on(application.launchEvent, function (args) {
5-
init("1771472059772879", LoginBehavior.LoginBehaviorWeb);
5+
init("1771472059772879");
66
});
77

88
application.run({ moduleName: "app-root" });

demo/e2e/test.e2e.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe("Facebook tests", async function () {
4141
console.log("Driver successfully quit");
4242
});
4343

44-
afterEach(async function (){
44+
afterEach(async function () {
4545
if (this.currentTest.state && this.currentTest.state === "failed") {
4646
let png = await driver.logScreenshot(this.currentTest.title);
4747
fs.copyFile(png, './mochawesome-report/' + this.currentTest.title + '.png', function (err) {
@@ -52,13 +52,14 @@ describe("Facebook tests", async function () {
5252
});
5353
addContext(this, './' + this.currentTest.title + '.png');
5454
}
55-
})
55+
});
5656

5757
it("should log in via custom button", async function () {
58+
let userNameLabelElement;
5859
if (isAndroid) {
59-
var userNameLabelElement = "[@text='Nativescript User']";
60+
userNameLabelElement = "[@text='Nativescript User']";
6061
} else {
61-
var userNameLabelElement = "[@name='Nativescript User']";
62+
userNameLabelElement = "[@name='Nativescript User']";
6263
}
6364

6465
const facebookButton = await driver.findElementByText("Custom", SearchOptions.contains);
@@ -81,6 +82,9 @@ describe("Facebook tests", async function () {
8182
await driver.wait(1000);
8283
await allFields[0].sendKeys(USERNAME);
8384
} else {
85+
const continueBtn = await driver.findElementByText("Continue");
86+
await continueBtn.click();
87+
8488
const passField = await driver.findElementByClassName(driver.locators.getElementByName("securetextfield"));
8589
await passField.click();
8690
await passField.sendKeys(PASSWORD);

src/index.android.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export * from "./login-manager";
22
export * from "./ui/login-button";
33
export * from "./login-event-data";
4-
export * from "./login-behavior";
54
export * from './share-manager';
65
export * from "./ui/share-button";

src/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ export * from "./login-manager";
22
export * from "./ui/login-button";
33
export * from "./login-response";
44
export * from "./login-event-data";
5-
export * from "./login-behavior";
65
export * from './share-manager';
76
export * from "./ui/share-button";

src/index.ios.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as applicationModule from "tns-core-modules/application";
22
export * from "./ui/login-button";
33
export * from "./login-manager";
44
export * from "./login-event-data";
5-
export * from "./login-behavior";
65
export * from './share-manager';
76
export * from "./ui/share-button";
87

@@ -13,11 +12,11 @@ class BaseDelegate extends UIResponder implements UIApplicationDelegate {
1312
public static ObjCProtocols = [UIApplicationDelegate];
1413

1514
applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary<any, any>): boolean {
16-
return FBSDKApplicationDelegate.sharedInstance().applicationDidFinishLaunchingWithOptions(application, launchOptions);
15+
return FBSDKApplicationDelegate.sharedInstance.applicationDidFinishLaunchingWithOptions(application, launchOptions);
1716
}
1817

1918
applicationOpenURLSourceApplicationAnnotation(application, url, sourceApplication, annotation) {
20-
return FBSDKApplicationDelegate.sharedInstance().applicationOpenURLSourceApplicationAnnotation(application, url, sourceApplication, annotation);
19+
return FBSDKApplicationDelegate.sharedInstance.applicationOpenURLSourceApplicationAnnotation(application, url, sourceApplication, annotation);
2120
}
2221

2322
applicationDidBecomeActive(application: UIApplication): void {

src/login-behavior.d.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/login-behavior.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)