mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Some changes
This commit is contained in:
+54
-39
@@ -26,6 +26,8 @@ import { Storage } from '@ionic/storage';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
|
||||
|
||||
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@@ -86,7 +88,8 @@ export class HomePage implements OnInit {
|
||||
private offlinemanager: OfflineManagerService,
|
||||
private storage: Storage,
|
||||
private eventservice: EventsService,
|
||||
private screenOrientation: ScreenOrientation) {
|
||||
private screenOrientation: ScreenOrientation,
|
||||
private firebaseX: FirebaseX) {
|
||||
|
||||
this.webNotificationPopupService.askNotificationPermission()
|
||||
|
||||
@@ -116,6 +119,18 @@ export class HomePage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.notificationsService.onReceviNotification();
|
||||
|
||||
this.firebaseX.getToken()
|
||||
.then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
|
||||
.catch(error => console.error('Error getting token', error));
|
||||
|
||||
this.firebaseX.onMessageReceived()
|
||||
.subscribe(data => console.log(`User opened a notification ${data}`));
|
||||
|
||||
this.firebaseX.onTokenRefresh()
|
||||
.subscribe((token: string) => console.log(`Got a new token ${token}`));
|
||||
|
||||
window.addEventListener('online', () => {
|
||||
console.log('Became online')
|
||||
this.backgroundservice.online()
|
||||
@@ -136,51 +151,51 @@ export class HomePage implements OnInit {
|
||||
|
||||
this.updateList()
|
||||
|
||||
var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url));
|
||||
/* var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url));
|
||||
|
||||
myWorker.onmessage = function (oEvent) {
|
||||
console.log('Worker said : ' + oEvent.data);
|
||||
}
|
||||
|
||||
myWorker.postMessage('ali');
|
||||
myWorker.postMessage('ali'); */
|
||||
}
|
||||
|
||||
/* mobilefirstConnect() {
|
||||
|
||||
console.log("Mobileconecct");
|
||||
|
||||
if (window['WLAuthorizationManager']) {
|
||||
if (window['WLAuthorizationManager'].obtainAccessToken) {
|
||||
window['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) => {
|
||||
console.log("Connect with JavaAdapter Failure: " + JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}, (error) => {
|
||||
console.log('MobileFirst Server connect: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error))
|
||||
/* this.zone.run(() => {
|
||||
console.log("Bummer...");
|
||||
console.log("Failed to connect to MobileFirst Server");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
} */
|
||||
/* mobilefirstConnect() {
|
||||
|
||||
console.log("Mobileconecct");
|
||||
|
||||
if (window['WLAuthorizationManager']) {
|
||||
if (window['WLAuthorizationManager'].obtainAccessToken) {
|
||||
window['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) => {
|
||||
console.log("Connect with JavaAdapter Failure: " + JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}, (error) => {
|
||||
console.log('MobileFirst Server connect: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error))
|
||||
/* this.zone.run(() => {
|
||||
console.log("Bummer...");
|
||||
console.log("Failed to connect to MobileFirst Server");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
postMessage("I\'m working before postMessage(\'ali\').");
|
||||
/* postMessage("I\'m working before postMessage(\'ali\').");
|
||||
|
||||
onmessage = function(oEvent) {
|
||||
postMessage('Hi ' + oEvent.data);
|
||||
};
|
||||
}; */
|
||||
Reference in New Issue
Block a user