trying migration from cordova to capacitor

This commit is contained in:
tiago.kayaya
2021-11-04 10:41:43 +01:00
parent 0cb4097c88
commit 98cb655735
12 changed files with 268 additions and 2199 deletions
+2 -1
View File
@@ -17,5 +17,6 @@
},
"android": {
"allowMixedContent": true
}
},
"bundledWebRuntime": false
}
+1 -44
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.gpr.gabinetedigital" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:mfp="http://www.ibm.com/mobilefirst/cordova-plugin-mfp">
<widget id="com.gpr.gabinetedigital" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Gabinete digital</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
@@ -46,49 +46,6 @@
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
</platform>
<mfp:android>
<mfp:sdkChecksum>1109370933</mfp:sdkChecksum>
<mfp:appChecksum>3619450036</mfp:appChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:android>
<mfp:ios>
<mfp:sdkChecksum>1979143311</mfp:sdkChecksum>
<mfp:appChecksum>1328564293</mfp:appChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:ios>
<mfp:windows>
<mfp:windows8>
<mfp:sdkChecksum>0</mfp:sdkChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:windows8>
<mfp:windowsphone8>
<mfp:sdkChecksum>0</mfp:sdkChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:windowsphone8>
<mfp:windows10>
<mfp:sdkChecksum>0</mfp:sdkChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:windows10>
<mfp:appChecksum>0</mfp:appChecksum>
</mfp:windows>
<mfp:platformVersion>8.0.0.00-20210308-063916</mfp:platformVersion>
<mfp:clientCustomInit enabled="false" />
<mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" />
<mfp:serverUri url="" />
<mfp:directUpdateAuthenticityPublicKey />
<mfp:languagePreferences>en</mfp:languagePreferences>
<mfp:APIproxyURL>/adapters/MobileAPIProxy</mfp:APIproxyURL>
<mfp:SDKProtocolVersion>2</mfp:SDKProtocolVersion>
<allow-navigation href="http://localhost:8100" sessionid="9714472a" />
<allow-navigation href="http://localhost:8101" sessionid="4721f88c" />
</widget>
+3 -11
View File
@@ -1,17 +1,9 @@
{
"name": "gabinete-digital",
"integrations": {
"cordova": {}
"cordova": {},
"capacitor": {}
},
"type": "angular",
"proxies":[
{
"path": "/mfp/api/imfpush/",
"proxyUrl": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api/imfpush/"
},
{
"path": "/mfp/api",
"proxyUrl": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api"
}
]
"proxies": []
}
+214 -2005
View File
File diff suppressed because it is too large Load Diff
+3 -8
View File
@@ -31,6 +31,8 @@
"@angular/platform-browser": "~12.1.2",
"@angular/platform-browser-dynamic": "~12.1.2",
"@angular/router": "~12.1.2",
"@capacitor/android": "3.3.0",
"@capacitor/core": "^3.3.0",
"@fortawesome/angular-fontawesome": "^0.9.0",
"@fortawesome/fontawesome-free": "^5.15.3",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
@@ -92,8 +94,6 @@
"global": "^4.4.0",
"hammerjs": "^2.0.8",
"http-server": "^0.12.3",
"ibm-mfp-web-push": "^8.0.2020052213",
"ibm-mfp-web-sdk": "^8.0.2021021706",
"ionic-angular": "^3.9.10",
"ionic-selectable": "^4.7.1",
"ionic2-alpha-scroll": "^2.0.1",
@@ -126,6 +126,7 @@
"@angular/compiler": "^12.1.2",
"@angular/compiler-cli": "^12.1.2",
"@angular/language-service": "^12.1.2",
"@capacitor/cli": "^3.3.0",
"@ionic/angular-toolkit": "^4.0.0",
"@ionic/lab": "3.1.7",
"@types/jasmine": "~3.6.0",
@@ -151,9 +152,6 @@
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-media": "^5.0.3",
"cordova-plugin-media-capture": "^3.0.3",
"cordova-plugin-mfp": "^8.0.2021031007",
"cordova-plugin-mfp-jsonstore": "^8.0.2021062408",
"cordova-plugin-mfp-push": "^8.0.2021062405",
"cordova-plugin-network-information": "^3.0.0",
"cordova-plugin-screen-orientation": "^3.0.2",
"cordova-plugin-splashscreen": "^5.0.2",
@@ -187,12 +185,9 @@
"cordova-plugin-inappbrowser": {},
"cordova-sqlite-storage": {},
"cordova-plugin-compat": {},
"cordova-plugin-mfp": {},
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-fingerprint-aio": {},
"cordova-plugin-mfp-push": {},
"cordova-plugin-mfp-jsonstore": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-screen-orientation": {},
"cordova-plugin-network-information": {},
+1 -3
View File
@@ -18,8 +18,6 @@ npm install -g cordova
npm install -g cordova-res
## Mobile first dependencies
cordova plugin add cordova-plugin-mfp-jsonstore
cordova plugin add cordova-plugin-mfp
ionic cordova plugin add cordova-plugin-network-information
## memory leak
@@ -76,4 +74,4 @@ npm run dev:share
For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Please make sure to update tests as appropriate.
+4 -9
View File
@@ -1,7 +1,6 @@
/* eslint-disable */
/* tslint:disable */
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
import { Component, OnInit, NgZone } from '@angular/core';
import { Event } from '../models/event.model';
import { NotificationsService } from '../services/notifications.service';
@@ -121,7 +120,6 @@ export class HomePage implements OnInit {
this.backgroundservice.online()
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.webnotification.webconnection();
this.webnotification.register();
} else {
this.mobilefirstConnect();
this.notificationsService.onReceviNotification();
@@ -148,7 +146,7 @@ export class HomePage implements OnInit {
console.log("Mobileconecct");
if (window['WLAuthorizationManager']) {
/* if (window['WLAuthorizationManager']) {
if (window['WLAuthorizationManager'].obtainAccessToken) {
window['WLAuthorizationManager'].obtainAccessToken("").then((token) => {
@@ -172,13 +170,10 @@ export class HomePage implements OnInit {
}, (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");
}); */
});
}
}
} */
}
+5 -6
View File
@@ -1,5 +1,4 @@
///<reference path="../../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
///<reference path="../../../../plugins/cordova-plugin-mfp-jsonstore/typings/jsonstore.d.ts" />
import { Component, OnInit, NgZone } from '@angular/core';
import { Router, NavigationExtras } from '@angular/router';
import { AnimationController, ModalController,Platform } from '@ionic/angular';
@@ -132,7 +131,7 @@ export class ProfilePage implements OnInit {
Status: element.Status
}
}
this.DataArray.push(notificationObject)
});
@@ -168,7 +167,7 @@ export class ProfilePage implements OnInit {
else if (Service === "agenda" && Object === "event-list") {
//this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda']));
this.zone.run(() =>this.router.navigate(['/home/agenda/event-list/approve-event',IdObject, 'agenda']));
} else if (Service === "gabinete-digital" && Object === "despachos") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true }));
@@ -195,7 +194,7 @@ export class ProfilePage implements OnInit {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "diplomas-assinar") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar',IdObject,'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "expedientes-pr") {
@@ -215,7 +214,7 @@ export class ProfilePage implements OnInit {
deleteNotification(index){
console.log("Delete notification first stata", this.notificationdata)
this.notificationdata = this.notificationdata.filter(item=>item.index !=index );
this.storageservice.store("Notifications",JSON.stringify(this.notificationdata)).then(() =>{
this.storageservice.get("Notifications").then((value) =>{
console.log("notfication state", value, )
+15 -16
View File
@@ -1,5 +1,4 @@
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
///<reference path="../../../plugins/cordova-plugin-mfp-jsonstore/typings/jsonstore.d.ts" />
import { Injectable } from "@angular/core";
@Injectable({
@@ -8,7 +7,7 @@ import { Injectable } from "@angular/core";
export class JsonStore {
createCollection(name, data) {
/* createCollection(name, data) {
var collectionName = name;
var addOptions = {
@@ -32,7 +31,7 @@ export class JsonStore {
console.log(err)
});
}
} */
getCollection(collectionName) {
@@ -50,11 +49,11 @@ export class JsonStore {
JSONStoreCollections[collectionName] = {};
JSONStoreCollections[collectionName].searchFields = { UserId: 'integer' };
WL.JSONStore.init(JSONStoreCollections)
/* WL.JSONStore.init(JSONStoreCollections)
.then(function () {
WL.Logger.debug('Find all colletion data');
console.log('Find all colletion data');
}).fail(function (err) {
WL.Logger.error(err);
@@ -66,8 +65,8 @@ export class JsonStore {
return JSON.parse(value);
});
return data
return data */
//return notificationData
}
@@ -90,7 +89,7 @@ export class JsonStore {
JSONStoreCollections[collectionName] = {};
JSONStoreCollections[collectionName].searchFields = { UserId: 'integer' };
WL.JSONStore.init(JSONStoreCollections)
/* WL.JSONStore.init(JSONStoreCollections)
.then(function () {
WL.Logger.debug('Find colletion data by id');
console.log('Find colletion data by id');
@@ -101,30 +100,30 @@ export class JsonStore {
}).fail(function (err) {
WL.Logger.error(err);
console.log(err)
});
}); */
}
replaceDocument(collectionName: string, document: any) {
/* var document = { Example of how identify the document to replace
/* var document = { Example of how identify the document to replace
_id: 1, json: {name: 'chevy', age: 23}
}; */
var options = {};
WL.JSONStore.get(collectionName).replace(document, options).then(function (numberOfDocsReplaced) {
/* WL.JSONStore.get(collectionName).replace(document, options).then(function (numberOfDocsReplaced) {
console.log("JsonStore replace document sucess: ", numberOfDocsReplaced)
}).fail(function (error) {
console.log("JsonStore replace document error: ", error)
});
}); */
}
removeDocument(collectionName: any,query: any,) {
/* var query = { _id: 1 }; Exemple of query*/
var options = { exact: true };
WL.JSONStore.get(collectionName).remove(query, options).then(function (numberOfDocsRemoved) {
/* WL.JSONStore.get(collectionName).remove(query, options).then(function (numberOfDocsRemoved) {
console.log("JsonStore remove document sucess: ", numberOfDocsRemoved)
}).fail(function (error) {
console.log("JsonStore remove document erro: ", error)
});
}); */
}
}
}
+10 -11
View File
@@ -1,6 +1,5 @@
/* eslint-disable */
/* tslint:disable */
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
import { Injectable, NgZone } from '@angular/core';
import { ActivatedRoute } from '@angular/router'
import { HttpClient } from '@angular/common/http';
@@ -45,10 +44,10 @@ export class NotificationsService {
private activeroute: ActivatedRoute,
private jsonstore: JsonStore,
private eventtrigger: EventTrigger,
private backgroundservice: BackgroundService) {
private backgroundservice: BackgroundService) {
this.storageService.get("Notifications").then((value) => {
}).catch(()=>{
this.storageService.store("Notifications",[])
@@ -96,7 +95,7 @@ export class NotificationsService {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
window['MFPPush'].initialize(
function (successResponse) {
console.log("Push notification Successfully Service intialized: " + successResponse);
@@ -105,7 +104,7 @@ export class NotificationsService {
console.log("Push notification failure Service intialized: " + failureResponse);
}
);
window['MFPPush'].registerDevice(null, async (successResponse) => {
console.log("Successfully registered: " + JSON.stringify(successResponse));
console.log('token: ', successResponse.deviceId)
@@ -127,7 +126,7 @@ export class NotificationsService {
console.log('TOKEN USER MIDLE', data);
})
});
});
},
function (failureResponse) {
@@ -157,7 +156,7 @@ export class NotificationsService {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
window['MFPPush'].initialize(
function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse);
@@ -172,7 +171,7 @@ export class NotificationsService {
this.DataArray.push(message)
console.log("On ReceiveNotification", this.DataArray)
this.storageService.store("Notifications",this.DataArray)
console.log(message);
this.eventtrigger.publishSomeData({
notification: "recive"
@@ -180,11 +179,11 @@ export class NotificationsService {
var data = JSON.parse(message.payload);
//synchro.$send(data)
console.log('data.Service', data.Service); // module
console.log('data.IdObject', data.IdObject); // Object id
console.log('data.Object', data.Object); // details
if(message.actionName){
this.notificatinsRoutes(data);
} else {
@@ -192,7 +191,7 @@ export class NotificationsService {
//this.notificatinsRoutes(data);
console.log(data)
}
this.callbacks.forEach( e=> {
if(e.type == data.Object || e.type == "any") {
e.funx()
+10 -71
View File
@@ -7,7 +7,6 @@ import { Token } from '../models/token.model';
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
import { NavigationExtras, Router } from '@angular/router';
import { ToastService } from './toast.service';
import MFPPush from 'ibm-mfp-web-push';
@Injectable({
providedIn: 'root'
@@ -39,18 +38,12 @@ export class WebNotificationsService {
}
MFPPush.initialize({
appId: "com.gpr.gabinetedigital",
mfpContextRoot: "/mfp",
});
/* MFPPush.initialize({
appId: "com.gpr.gabinetedigital",
mfpContextRoot: "/mfp",
}); */
/* MFPPush.registerDevice()
.then((res) => {
console.log("WEB Successfully Registered Device...");
@@ -72,60 +65,6 @@ export class WebNotificationsService {
}); */
}
register(){
MFPPush.registerDevice()
.then((res) => {
console.log("WEB Successfully Registered Device...", res);
})
.catch((err) => {
console.log("WEB Registration Failed" + err);
});
}
async onReceviNotificationWeb() {
if (window['WLAuthorizationManager']) {
if (window['WLAuthorizationManager'].obtainAccessToken) {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
MFPPush.initialize(
function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse);
MFPPush.registerNotificationsCallback(notificationReceived);
},
function (failureResponse) {
console.log("Push notification failure intialized: " + failureResponse);
}
);
var notificationReceived = (message) => {
console.log(message);
var data = JSON.parse(message.payload);
console.log(data.Service);
console.log(data.IdObject);
console.log(data.Object);
if (message.actionName) {
//this.notificatinsRoutes(data);
console.log("Web notification")
} else {
console.log("Web notification")
//this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
}
}
}, (error) => {
console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error));
}
);
}
}
}
/* getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
@@ -138,11 +77,11 @@ export class WebNotificationsService {
} else {
const geturl = environment.apiURL + 'notifications/token'; */
/*
/*
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
MFPPush.initialize(
function (successResponse) {
console.log("Push notification Successfully Service intialized: " + successResponse);
@@ -151,7 +90,7 @@ export class WebNotificationsService {
console.log("Push notification failure Service intialized: " + failureResponse);
}
);
MFPPush.registerDevice(null, (successResponse) => {
console.log("Successfully registered: " + JSON.stringify(successResponse));
console.log('token: ', successResponse.deviceId)
@@ -171,7 +110,7 @@ export class WebNotificationsService {
console.log('TOKEN USER MIDLE', data);
})
});
});
},
function (failureResponse) {
@@ -184,14 +123,14 @@ export class WebNotificationsService {
}
);
}
} */
/*
/*
async onReceviNotification() {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
MFPPush.initialize(
function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse);
@@ -207,13 +146,13 @@ export class WebNotificationsService {
console.log(data.Service);
console.log(data.IdObject);
console.log(data.Object);
if(message.actionName){
this.notificatinsRoutes(data);
} else {
this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
}
}
}, (error) => {
console.log('Push notification recived: failure ' + error.responseText);
-14
View File
@@ -1,14 +0,0 @@
{
"/mfp/api/imfpush/": {
"target": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api/imfpush/",
"changeOrigin": true,
"secure": false,
"pathRewrite": {"/mfp/api/imfpush/" : ""}
},
"/mfp/api": {
"target": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api",
"changeOrigin": true,
"secure": false,
"pathRewrite": {"/mfp/api" : ""}
}
}