added firebase token instead of one signal

MOHEMM-SFH-COLORS
umasoodch 6 years ago
parent 10458f2e0f
commit 5c7a30f308

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.cloudsolutions.alhabibmohemm" version="1.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.cloudsolutions.mohemm" version="1.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MOHEMM</name>
<description>an app created by cloud Solutions</description>
<author email="eservicescs@cloudsolution-sa.com" href="http://cloudsolution-sa.com">HMG</author>
@ -124,7 +124,6 @@
<plugin name="cordova-plugin-file" spec="^6.0.2" />
<plugin name="cordova-plugin-filepath" spec="^1.5.6" />
<plugin name="com-badrit-base64" spec="^0.2.0" />
<plugin name="onesignal-cordova-plugin" spec="^2.7.0" />
<plugin name="cordova-plugin-fingerprint-aio" spec="^3.0.0">
<variable name="FACEID_USAGE_DESCRIPTION" value="User Authentication" />
</plugin>

@ -1,34 +1,34 @@
{
"project_info": {
"project_number": "448880075189",
"firebase_url": "https://al-habib-mohemm.firebaseio.com",
"project_id": "al-habib-mohemm",
"storage_bucket": "al-habib-mohemm.appspot.com"
"project_number": "608631731238",
"firebase_url": "https://mohemm-cs.firebaseio.com",
"project_id": "mohemm-cs",
"storage_bucket": "mohemm-cs.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:448880075189:android:5bb4821d515a826d88b9fc",
"mobilesdk_app_id": "1:608631731238:android:3a8384007f8700ec",
"android_client_info": {
"package_name": "com.cloudsolutions.alhabibmohemm"
"package_name": "com.cloudsolutions.mohemm"
}
},
"oauth_client": [
{
"client_id": "448880075189-49hc2l78pr9hsmr9p3k7j411r40diej8.apps.googleusercontent.com",
"client_id": "608631731238-83a5qndedia496ssa6ekkd3db5jo8khr.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyC8nrli7eyuRNow8nF-QHvDMOxqUkj6fEw"
"current_key": "AIzaSyB5zpz9vC2NOxsU1dPr0TK0dVaMY5D4Mjg"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "448880075189-49hc2l78pr9hsmr9p3k7j411r40diej8.apps.googleusercontent.com",
"client_id": "608631731238-83a5qndedia496ssa6ekkd3db5jo8khr.apps.googleusercontent.com",
"client_type": 3
}
]

@ -149,9 +149,9 @@ call npm install @ionic-native/file-path
call ionic cordova plugin add com-badrit-base64
call npm install @ionic-native/base64
@echo install OneSignal plugin
call ionic cordova plugin add onesignal-cordova-plugin
call npm install @ionic-native/onesignal
@echo install Firebasex plugin
call ionic cordova plugin add cordova-plugin-firebasex
call npm install @ionic-native/firebase-x
@echo reinitializing git repository
@echo git init

@ -21,38 +21,39 @@
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@ionic-native/android-permissions": "^5.17.0",
"@ionic-native/app-availability": "^5.17.0",
"@ionic-native/app-rate": "^5.17.0",
"@ionic-native/android-permissions": "^5.18.0",
"@ionic-native/app-availability": "^5.18.0",
"@ionic-native/app-rate": "^5.18.0",
"@ionic-native/background-geolocation": "^5.4.0",
"@ionic-native/badge": "^5.17.0",
"@ionic-native/barcode-scanner": "^5.17.0",
"@ionic-native/base64": "^5.17.0",
"@ionic-native/ble": "^5.17.0",
"@ionic-native/call-number": "^5.17.0",
"@ionic-native/camera": "^5.17.0",
"@ionic-native/badge": "^5.18.0",
"@ionic-native/barcode-scanner": "^5.18.0",
"@ionic-native/base64": "^5.18.0",
"@ionic-native/ble": "^5.18.0",
"@ionic-native/call-number": "^5.18.0",
"@ionic-native/camera": "^5.18.0",
"@ionic-native/core": "^5.8.0",
"@ionic-native/date-picker": "^5.10.0",
"@ionic-native/device": "^5.17.0",
"@ionic-native/diagnostic": "^5.17.0",
"@ionic-native/file": "^5.17.0",
"@ionic-native/file-path": "^5.17.0",
"@ionic-native/fingerprint-aio": "^5.17.1",
"@ionic-native/device": "^5.18.0",
"@ionic-native/diagnostic": "^5.18.0",
"@ionic-native/file": "^5.18.0",
"@ionic-native/file-path": "^5.18.0",
"@ionic-native/fingerprint-aio": "^5.18.0",
"@ionic-native/firebase-x": "^5.19.1",
"@ionic-native/geolocation": "^5.10.0",
"@ionic-native/globalization": "^5.17.0",
"@ionic-native/globalization": "^5.18.0",
"@ionic-native/health": "^5.4.0",
"@ionic-native/in-app-browser": "^5.17.0",
"@ionic-native/keyboard": "^5.17.0",
"@ionic-native/launch-navigator": "^5.17.0",
"@ionic-native/local-notifications": "^5.17.0",
"@ionic-native/native-storage": "^5.17.0",
"@ionic-native/onesignal": "^5.17.0",
"@ionic-native/in-app-browser": "^5.18.0",
"@ionic-native/keyboard": "^5.18.0",
"@ionic-native/launch-navigator": "^5.18.0",
"@ionic-native/local-notifications": "^5.18.0",
"@ionic-native/native-storage": "^5.18.0",
"@ionic-native/onesignal": "^5.18.0",
"@ionic-native/open-native-settings": "^5.14.0",
"@ionic-native/push": "^5.17.0",
"@ionic-native/push": "^5.18.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/sqlite": "^5.17.0",
"@ionic-native/sqlite": "^5.18.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic-native/themeable-browser": "^5.17.0",
"@ionic-native/themeable-browser": "^5.18.0",
"@ionic-native/zbar": "^5.10.0",
"@ionic/angular": "^4.1.0",
"@ng-bootstrap/ng-bootstrap": "^4.2.2",
@ -62,7 +63,7 @@
"call-number": "~0.0.2",
"chart.js": "^2.9.3",
"com-badrit-base64": "^0.2.0",
"cordova-android": "8.1.0",
"cordova-android": "^8.1.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-browser": "5.0.4",
"cordova-ios": "4.5.5",
@ -71,6 +72,8 @@
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-android-permissions": "^1.0.2",
"cordova-plugin-androidx": "^1.0.2",
"cordova-plugin-androidx-adapter": "^1.1.0",
"cordova-plugin-appavailability": "^0.4.2",
"cordova-plugin-apprate": "^1.4.0",
"cordova-plugin-badge": "^0.8.8",
@ -82,6 +85,7 @@
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-filepath": "^1.5.6",
"cordova-plugin-fingerprint-aio": "^3.0.0",
"cordova-plugin-firebasex": "^7.0.1",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-inappbrowser": "^3.1.0",
@ -103,7 +107,6 @@
"ng2-file-upload": "^1.3.0",
"ng2-pdf-viewer": "^5.3.2",
"npm": "^6.13.1",
"onesignal-cordova-plugin": "^2.7.0",
"phonegap-plugin-barcodescanner": "^8.1.0",
"phonegap-plugin-multidex": "^1.0.0",
"phonegap-plugin-push": "^2.3.0",
@ -136,6 +139,7 @@
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.13.0",
"protractor": "~5.4.0",
"ts-node": "~8.0.0",
"tslint": "~5.12.0",
@ -184,9 +188,22 @@
"cordova-opentok-android-permissions": {},
"cordova-plugin-appavailability": {},
"cordova-plugin-apprate": {},
"onesignal-cordova-plugin": {},
"cordova-plugin-fingerprint-aio": {
"FACEID_USAGE_DESCRIPTION": "User Authentication"
},
"cordova-plugin-firebasex": {
"FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
"FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
"FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
"ANDROID_ICON_ACCENT": "#FF00FFFF",
"ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION": "17.0.0",
"ANDROID_FIREBASE_ANALYTICS_VERSION": "17.2.1",
"ANDROID_FIREBASE_MESSAGING_VERSION": "20.0.0",
"ANDROID_FIREBASE_CONFIG_VERSION": "19.0.3",
"ANDROID_FIREBASE_PERF_VERSION": "19.0.1",
"ANDROID_FIREBASE_AUTH_VERSION": "19.1.0",
"ANDROID_CRASHLYTICS_VERSION": "2.10.1",
"ANDROID_CRASHLYTICS_NDK_VERSION": "2.1.1"
}
},
"platforms": [

@ -5,7 +5,7 @@ import { HmgCommonModule } from './hmg-common/hmg-common.module';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { OneSignal } from '@ionic-native/onesignal/ngx';
// import { OneSignal } from '@ionic-native/onesignal/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
@ -16,6 +16,8 @@ import {Camera,CameraOptions,PictureSourceType} from'@ionic-native/Camera/ngx';
import { FilePath } from "@ionic-native/file-path/ngx";
import { File } from "@ionic-native/file/ngx";
import { Base64 } from "@ionic-native/base64/ngx";
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
@ -37,7 +39,8 @@ import { Base64 } from "@ionic-native/base64/ngx";
File,
FilePath,
Base64,
OneSignal,
// OneSignal,
FirebaseX,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]

@ -568,31 +568,31 @@ export class ConfirmLoginComponent implements OnInit {
// title: 'Biometric Authetnciation', // (Android Only) | optional | Default: "<APP_NAME> Biometric Sign On"
title: 'Biometric Authetnciation', // (Android Only) | optional | Default: "<APP_NAME> Biometric Sign On"
// subtitle: 'Coolest Plugin ever' ,// (Android Only) | optional | Default: null
subtitle: 'Coolest Plugin ever' ,// (Android Only) | optional | Default: null
// description: this.ts.trPK("general", "auth-please"),// optional | Default: null
description: this.ts.trPK("general", "auth-please"),// optional | Default: null
// fallbackButtonTitle: this.ts.trPK("general", "use-pin"), // optional | When disableBackup is false defaults to "Use Pin".
fallbackButtonTitle: this.ts.trPK("general", "use-pin"), // optional | When disableBackup is false defaults to "Use Pin".
// // When disableBackup is true defaults to "Cancel"
// When disableBackup is true defaults to "Cancel"
// disableBackup:true, // optional | default: false
disableBackup:true, // optional | default: false
clientId: "Fingerprint Authetnciation",
// clientId: "Fingerprint Authetnciation",
clientSecret: "Ate343_9347lajF", // Only necessary for Android
// clientSecret: "Ate343_9347lajF", // Only necessary for Android
disableBackup: true, // Only for Android(optional)
// disableBackup: true, // Only for Android(optional)
localizedFallbackTitle: this.ts.trPK("general", "use-pin"), // Only for iOS
// localizedFallbackTitle: this.ts.trPK("general", "use-pin"), // Only for iOS
localizedReason: this.ts.trPK("general", "auth-please") // Only for iOS
// localizedReason: this.ts.trPK("general", "auth-please") // Only for iOS
})

@ -16,7 +16,9 @@ import { SessionModel } from './models/session.model';
import { AuthenticatedUser } from '../authentication/models/authenticated-user';
// import { NotificationsCenterService } from 'src/app/eservices/notifications-center/service/notifications-center.service';
// import { NotificationsComponent } from 'src/app/eservices/notifications-center/notifications/notifications.component';
import {OneSignal} from '@ionic-native/onesignal/ngx'
// import {OneSignal} from '@ionic-native/onesignal/ngx';
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
@Injectable({
providedIn: 'root'
})
@ -37,13 +39,14 @@ export class PushService {
public ngZone: NgZone,
// public notifyService: NotificationsCenterService,
public events: Events,
private oneSignal: OneSignal,
// private oneSignal: OneSignal,
public firebasex: FirebaseX,
) { }
public startReceiving() {
this.processStartReceiving();
// this.processStartReceiving();
this.processStartReceivingWithFirebase();
}
private processStartReceiving1() {
// if (this.cs.isCordova()) {
@ -160,11 +163,15 @@ export class PushService {
}
private registerInBackend(data: any) {
console.log("registerInBackend");
console.log('firebasex Token ID: ' + data);
if (data) {
this.cs.sharedService.setSharedData(data, AuthenticationService.DEVICE_TOKEN);
localStorage.setItem('deviceToken', data);
}
if (this.authService.isAuthenticated()) {
this.registerAuthenticatedUser(data.registrationId);
this.registerAuthenticatedUser(data);
} else {
this.registerNotAuthenticatedUser(data.registrationId);
this.registerNotAuthenticatedUser(data);
}
}
@ -210,45 +217,55 @@ export class PushService {
}
private processStartReceiving() {
console.log('processStartReceiving');
console.log("processStartReceiving openConference");
this.oneSignal.startInit('8d9b8313-0365-4934-a2a9-fdee5aeac66e', PushService.SENDER_ID);
this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);
this.oneSignal.handleNotificationReceived().subscribe(data => this.onPushReceived(data.payload));
this.oneSignal.handleNotificationOpened().subscribe(data => this.onPushOpened(data.notification.payload));
console.log("this.oneSignal: "+ this.oneSignal.getIds());
this.oneSignal.endInit();
this.oneSignal.getIds().then(result => {
console.log("result.userId: " +result.userId);
private processStartReceivingWithFirebase() {
this.firebasex.getToken().then(token => {
console.log(token);
this.registerInBackend(token);
});
this.firebasex.onTokenRefresh().subscribe(token => {
console.log(token);
this.registerInBackend(token);
});
}
// private processStartReceiving() {
// console.log('processStartReceiving');
// console.log("processStartReceiving openConference");
// this.oneSignal.startInit('8d9b8313-0365-4934-a2a9-fdee5aeac66e', PushService.SENDER_ID);
// this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);
// this.oneSignal.handleNotificationReceived().subscribe(data => this.onPushReceived(data.payload));
// this.oneSignal.handleNotificationOpened().subscribe(data => this.onPushOpened(data.notification.payload));
// console.log("this.oneSignal: "+ this.oneSignal.getIds());
// this.oneSignal.endInit();
// this.oneSignal.getIds().then(result => {
// console.log("result.userId: " +result.userId);
//there is no part for notLoggedInUserURL () as patient app
if(result.userId){
this.cs.sharedService.setSharedData(result.userId, AuthenticationService.DEVICE_TOKEN);
localStorage.setItem("deviceToken", result.userId);
// //there is no part for notLoggedInUserURL () as patient app
// if(result.userId){
// this.cs.sharedService.setSharedData(result.userId, AuthenticationService.DEVICE_TOKEN);
// localStorage.setItem("deviceToken", result.userId);
}
// }
this.registerInBackend(result.userId);
}, err => {
console.log("getIds() error: "+err);
// this.registerInBackend(result.userId);
// }, err => {
// console.log("getIds() error: "+err);
});
// });
// if (this.cs.isCordova()) {
// console.log('Notification Channel Called');
// // if (this.cs.isCordova()) {
// // console.log('Notification Channel Called');
// if (this.platform.is('android')) {
// this.stopNotifications(() => {
// // if (this.platform.is('android')) {
// // this.stopNotifications(() => {
// // });
// // } else {
// // //initialize code
// // }
// // }
// }
// });
// } else {
// //initialize code
// }
// }
}
public onPushReceived(payload: any) {
console.log(JSON.parse(JSON.stringify(payload)));
console.log('Push-Received whole payload: ' + payload);

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { ConnectorService } from '../../hmg-common/services/connector/connector.service';
import { AuthenticationService } from '../../hmg-common/services/authentication/authentication.service';
import { Observable } from 'node_modules/@angular/cli/node_modules/rxjs';
import { Observable } from 'rxjs';
@Injectable({

Loading…
Cancel
Save