From 5b1161a1360cc3e055e936e0357ac89340eda253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Fri, 25 Jun 2021 10:04:41 +0100 Subject: [PATCH] Alterations for teste --- src/app/home/home.page.ts | 32 ++++++++++++++++++++++++++++++++ src/index.html | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index ff4dd179a..c9c6a9591 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -67,6 +67,7 @@ export class HomePage implements OnInit { ngOnInit() { if(!this.platform.is('desktop')) { + this.mobilefirstConnect(); this.notificatinsservice.onReceviNotification(); } this.count(); @@ -99,4 +100,35 @@ export class HomePage implements OnInit { } + mobilefirstConnect() { + WLAuthorizationManager.obtainAccessToken("").then( + (token) => { + console.log('MobileFirst Server connect: Success ' + token); + + var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/", + WLResourceRequest.GET + ); + + resourceRequest.setQueryParameter("name", "world"); + resourceRequest.send().then( + (response) => { + // Will display "Hello world" in an alert dialog. + console.log("Connect with JavaAdapter Success: " + response.responseText); + //this.MFPushNotification(); + }, + (error) => { + alert("Connect with JavaAdapter Failure: " + JSON.stringify(error)); + } + ); + }, (error) => { + console.log('MobileFirst Server connect: failure ' + error.responseText); + console.log(JSON.stringify(error)) + /* this.zone.run(() => { + alert("Bummer..."); + alert("Failed to connect to MobileFirst Server"); + }); */ + } + ); + } + } diff --git a/src/index.html b/src/index.html index f596b10a7..c85c54d3d 100644 --- a/src/index.html +++ b/src/index.html @@ -7,7 +7,7 @@ - +