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": {},
-2
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
+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");
}); */
});
}
}
} */
}
+1 -2
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';
+11 -12
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,7 +49,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 all colletion data');
console.log('Find all colletion data');
@@ -67,7 +66,7 @@ export class JsonStore {
});
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,7 +100,7 @@ export class JsonStore {
}).fail(function (err) {
WL.Logger.error(err);
console.log(err)
});
}); */
}
@@ -111,20 +110,20 @@ export class JsonStore {
}; */
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)
});
}); */
}
}
@@ -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';
@@ -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,12 +38,6 @@ export class WebNotificationsService {
}
MFPPush.initialize({
appId: "com.gpr.gabinetedigital",
mfpContextRoot: "/mfp",
});
/* MFPPush.initialize({
appId: "com.gpr.gabinetedigital",
@@ -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;
-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" : ""}
}
}