project migated to capacitor

This commit is contained in:
Eudes Inácio
2021-11-04 06:39:39 +01:00
parent d7745a1ed3
commit 84f2c1cc36
15 changed files with 310 additions and 1893 deletions
+2 -1
View File
@@ -20,7 +20,6 @@
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="android-minSdkVersion" value="20" />
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" />
@@ -93,4 +92,6 @@
<allow-navigation href="http://localhost:8100" sessionid="9714472a" />
<allow-navigation href="http://localhost:8101" sessionid="4721f88c" />
<plugin name="cordova-plugin-dbcopy" spec="https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git" />
<engine name="browser" />
<engine name="android" />
</widget>
+3 -2
View File
@@ -1,10 +1,11 @@
{
"name": "gabinete-digital",
"integrations": {
"cordova": {}
"cordova": {},
"capacitor": {}
},
"type": "angular",
"proxies":[
"proxies": [
{
"path": "/mfp/api/imfpush/",
"proxyUrl": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api/imfpush/"
+230 -1622
View File
File diff suppressed because it is too large Load Diff
+8 -5
View File
@@ -31,6 +31,12 @@
"@angular/platform-browser": "~12.1.2",
"@angular/platform-browser-dynamic": "~12.1.2",
"@angular/router": "~12.1.2",
"@capacitor/android": "^3.3.0",
"@capacitor/app": "^1.0.5",
"@capacitor/core": "^3.3.0",
"@capacitor/haptics": "^1.1.2",
"@capacitor/keyboard": "^1.1.2",
"@capacitor/status-bar": "^1.0.5",
"@fortawesome/angular-fontawesome": "^0.9.0",
"@fortawesome/fontawesome-free": "^5.15.3",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
@@ -46,7 +52,6 @@
"@ionic-native/file": "^5.36.0",
"@ionic-native/file-path": "^5.30.0",
"@ionic-native/fingerprint-aio": "^4.20.0",
"@ionic-native/firebase-x": "^5.36.0",
"@ionic-native/http": "^5.31.1",
"@ionic-native/image-picker": "^5.36.0",
"@ionic-native/in-app-browser": "^5.28.0",
@@ -103,7 +108,7 @@
"ionic2-calendar": "^0.6.6",
"ionicons": "^5.5.3",
"jest-puppeteer": "^5.0.4",
"jetifier": "^1.6.6",
"jetifier": "^1.6.8",
"lite-server": "^2.6.1",
"moment": "^2.29.1",
"ng2-pdf-viewer": "^7.0.1",
@@ -129,6 +134,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",
@@ -145,17 +151,14 @@
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-fcm-with-dependecy-updated": "^7.2.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-fingerprint-aio": "^4.0.2",
"cordova-plugin-firebasex": "^13.0.1",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-inappbrowser": "^4.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"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-network-information": "^3.0.0",
"cordova-plugin-screen-orientation": "^3.0.2",
"cordova-plugin-splashscreen": "^5.0.2",
+4 -4
View File
@@ -65,8 +65,8 @@ import { Media } from '@ionic-native/media/ngx';
import { StreamingMedia } from '@ionic-native/streaming-media/ngx';
import { PhotoViewer } from '@ionic-native/photo-viewer/ngx';
import { FCM } from '@ionic-native/fcm/ngx';
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
/* import { FCM } from '@ionic-native/fcm/ngx';
import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
//import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
@NgModule({
@@ -115,8 +115,8 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx';
//File,
WebView,
FilePath,
FCM,
FirebaseX,
/* FCM,
FirebaseX, */
WebsocketService,
ChatService,
ScreenOrientation,
+9 -67
View File
@@ -1,11 +1,9 @@
/* 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';
import { WebNotificationsService } from '../services/webnotifications.service';
/* import { NotificationsService } from '../services/notifications.service';
import { WebNotificationsService } from '../services/webnotifications.service'; */
import { AlertController, Platform } from '@ionic/angular';
import { Router, ActivatedRoute } from '@angular/router';
import { ToDayEventStorage } from '../store/to-day-event-storage.service';
@@ -26,8 +24,6 @@ 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',
@@ -74,10 +70,10 @@ export class HomePage implements OnInit {
private zone: NgZone,
private router: Router,
public modalCtrl: AlertController,
private notificationsService: NotificationsService,
/* private notificationsService: NotificationsService, */
private platform: Platform,
private activeroute: ActivatedRoute,
private webnotification: WebNotificationsService,
/* private webnotification: WebNotificationsService, */
public p: PermissionService,
public documentCounterService: DocumentCounterService,
private despachoRule: DespachoService,
@@ -88,8 +84,7 @@ export class HomePage implements OnInit {
private offlinemanager: OfflineManagerService,
private storage: Storage,
private eventservice: EventsService,
private screenOrientation: ScreenOrientation,
private firebaseX: FirebaseX) {
private screenOrientation: ScreenOrientation,) {
this.webNotificationPopupService.askNotificationPermission()
@@ -119,28 +114,14 @@ 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()
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.webnotification.webconnection();
this.webnotification.register();
} else {
this.notificationsService.onReceviNotification();
//this.mobilefirstConnect();
//this.notificationsService.onReceviNotification();
/* this.notificationsService.onReceviNotification(); */
this.offlinemanager.synchnize()
}
});
@@ -160,53 +141,14 @@ export class HomePage implements OnInit {
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");
});
});
}
}
} */
updateList() {
this.notificationsService.registerCallback(
/* this.notificationsService.registerCallback(
'despachos',
() => {
this.despachoRule.getList({ updateStore: true })
}
)
) */
document.addEventListener('pause', function () {
// console.log('App going to background');
+33 -22
View File
@@ -1,5 +1,3 @@
///<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';
@@ -7,9 +5,8 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { LocalstoreService } from 'src/app/store/localstore.service';
import { EditProfilePage } from './edit-profile/edit-profile.page';
import { JsonStore } from '../../services/jsonStore.service';
import { StorageService } from '../../services/storage.service';
import { NotificationsService } from '../../services/notifications.service';
/* import { NotificationsService } from '../../services/notifications.service'; */
import { SessionStore } from 'src/app/store/session.service';
import { EventTrigger } from '../../services/eventTrigger.service';
import { ThemeService } from 'src/app/services/theme.service'
@@ -39,12 +36,11 @@ export class ProfilePage implements OnInit {
private animationController: AnimationController,
private router: Router,
private localstoreService: LocalstoreService,
private jsonstore: JsonStore,
private storageservice: StorageService,
private zone: NgZone,
private notificationservice: NotificationsService,
/* private notificationservice: NotificationsService, */
private platform: Platform,
private notificationsService: NotificationsService,
/* private notificationsService: NotificationsService, */
private eventtrigger: EventTrigger,
public ThemeService: ThemeService
) {
@@ -63,14 +59,14 @@ export class ProfilePage implements OnInit {
this.getNotificationData();
}
this.notificationsService.registerCallback(
/* this.notificationsService.registerCallback(
'any',
() => {
setTimeout(()=>{
this.getNotificationData();
}, 100)
}
)
) */
}
@@ -98,22 +94,37 @@ export class ProfilePage implements OnInit {
value.forEach((element,i) => {
console.log("ARaaAA", element)
let notificationObject;
if(element.payload){
var payload = JSON.parse(element.payload)
notificationObject = {
index: i,
alert: element.alert,
//alert: element.alert,
Service: element.Service,
Object: element.Object,
IdObject: element.IdObject,
FolderId: 1,
//desc: payload.desc,
//dateInit: this.getFormatedTime(payload.dateInit),
//dateEnd: this.getFormatedTime(payload.dateEnd),
//Location: payload.Location,
//TypeAgenda: payload.TypeAgenda,
//Role: payload.Role,
//Status: payload.Status
}
/* if(element.payload){
var payload = JSON.parse(element.payload)
notificationObject = {
//index: i,
//alert: element.alert,
Service: payload.Service,
Object: payload.Object,
IdObject: payload.IdObject,
FolderId: payload.FolderId,
desc: payload.desc,
dateInit: this.getFormatedTime(payload.dateInit),
dateEnd: this.getFormatedTime(payload.dateEnd),
Location: payload.Location,
TypeAgenda: payload.TypeAgenda,
Role: payload.Role,
Status: payload.Status
//FolderId: payload.FolderId,
//desc: payload.desc,
//dateInit: this.getFormatedTime(payload.dateInit),
//dateEnd: this.getFormatedTime(payload.dateEnd),
//Location: payload.Location,
//TypeAgenda: payload.TypeAgenda,
//Role: payload.Role,
//Status: payload.Status
}
} else {
notificationObject = {
@@ -131,7 +142,7 @@ export class ProfilePage implements OnInit {
Role: element.Role,
Status: element.Status
}
}
}*/
this.DataArray.push(notificationObject)
@@ -202,7 +213,7 @@ export class ProfilePage implements OnInit {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
}
this.notificationservice.tempClearArray();
//this.notificationservice.tempClearArray();
this.deleteNotification(index);
this.eventtrigger.publishSomeData({
notification: "deleted"
+1 -1
View File
@@ -26,7 +26,7 @@ import { NavigationStart, NavigationEnd, Router } from '@angular/router';
import { EventPerson } from 'src/app/models/eventperson.model';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { environment } from 'src/environments/environment';
import { NotificationsService } from 'src/app/services/notifications.service';
//import { NotificationsService } from 'src/app/services/notifications.service';
import { TimeService } from 'src/app/services/functions/time.service';
import { ThemeService } from 'src/app/services/theme.service'
@@ -19,7 +19,7 @@ import { WaitForDomService } from 'src/app/services/dom/wait-for-dom.service';
import { TotalDocumentStore } from 'src/app/store/total-document.service';
import { DeplomasStore } from 'src/app/store/deplomas.service';
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
import { NotificationsService } from 'src/app/services/notifications.service';
//import { NotificationsService } from 'src/app/services/notifications.service';
import { DespachoService } from 'src/app/Rules/despacho.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { PermissionService } from 'src/app/services/worker/permission.service';
@@ -124,7 +124,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
authService: AuthService,
public p: PermissionService,
public waitForDomService: WaitForDomService,
private notificationsService: NotificationsService,
//private notificationsService: NotificationsService,
private despachoRule: DespachoService,
private sqliteservice: SqliteService,
private platform: Platform,
+2 -2
View File
@@ -5,7 +5,7 @@ import { UserForm } from 'src/app/models/user.model';
import { ToastService } from 'src/app/services/toast.service';
import { environment } from 'src/environments/environment';
import { AlertController } from '@ionic/angular';
import { NotificationsService } from 'src/app/services/notifications.service';
//import { NotificationsService } from 'src/app/services/notifications.service';
import { SessionStore } from 'src/app/store/session.service';
@@ -25,7 +25,7 @@ export class InactivityPage implements OnInit {
enterWithPassword = false
constructor(
private notificatinsservice: NotificationsService,
//private notificatinsservice: NotificationsService,
private router: Router,
private authService: AuthService,
private toastService: ToastService,
+3 -3
View File
@@ -5,7 +5,7 @@ import { UserForm } from 'src/app/models/user.model';
import { ToastService } from 'src/app/services/toast.service';
import { environment } from 'src/environments/environment';
import { AlertController } from '@ionic/angular';
import { NotificationsService } from 'src/app/services/notifications.service';
//import { NotificationsService } from 'src/app/services/notifications.service';
import { SessionStore } from 'src/app/store/session.service';
import { ClearStoreService } from 'src/app/services/clear-store.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
@@ -31,7 +31,7 @@ export class LoginPage implements OnInit {
sessionStore = SessionStore
constructor(
private notificatinsservice: NotificationsService,
//private notificatinsservice: NotificationsService,
private router: Router,
private authService: AuthService,
private toastService: ToastService,
@@ -74,7 +74,7 @@ export class LoginPage implements OnInit {
}
getToken() {
this.notificatinsservice.getAndpostToken(this.username);
//this.notificatinsservice.getAndpostToken(this.username);
}
async Login() {
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { JsonStore } from './jsonStore.service';
describe('JsonStore', () => {
let service: JsonStore;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(JsonStore);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
-130
View File
@@ -1,130 +0,0 @@
///<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({
providedIn: 'root'
})
export class JsonStore {
/* createCollection(name, data) {
var collectionName = name;
var addOptions = {
// Mark data as dirty (true = yes, false = no), default true.
markDirty: true
};
var JSONStoreCollections = {};
JSONStoreCollections[collectionName] = {};
JSONStoreCollections[collectionName].searchFields = { UserId: 'integer' };
WL.JSONStore.init(JSONStoreCollections)
.then(function () {
WL.Logger.debug('Init done');
console.log('Init done');
return WL.JSONStore.get(collectionName).add(data, addOptions);
}).fail(function (err) {
WL.Logger.error(err);
console.log(err)
});
}
getCollection(collectionName) {
var allOptions = {
// Returns a maximum of 10 documents, default no limit.
limit: 10,
// Skip 0 documents, default no offset.
offset: 0,
// Search fields to return, default: ['_id', 'json'].
filter: ['UserId', 'json'],
// How to sort the returned values, default no sort.}]
};
var JSONStoreCollections = {};
JSONStoreCollections[collectionName] = {};
JSONStoreCollections[collectionName].searchFields = { UserId: 'integer' };
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);
console.log("JsonStore getColletion error ",err)
});
const data = WL.JSONStore.get(collectionName).findAll(allOptions).then((value) => {
console.log('Find all colletion data', value);
return JSON.parse(value);
});
return data
//return notificationData
}
getColletionById(collectionName, value) {
var query = { UserId: value };
var allOptions = {
// Returns a maximum of 10 documents, default no limit.
limit: 10,
// Skip 0 documents, default no offset.
offset: 0,
// Search fields to return, default: ['_id', 'json'].
filter: ['UserId', 'json'],
// How to sort the returned values, default no sort.}]
};
var JSONStoreCollections = {};
JSONStoreCollections[collectionName] = {};
JSONStoreCollections[collectionName].searchFields = { UserId: 'integer' };
WL.JSONStore.init(JSONStoreCollections)
.then(function () {
WL.Logger.debug('Find colletion data by id');
console.log('Find colletion data by id');
return WL.JSONStore.get(collectionName).find(query, allOptions).then((value) => {
console.log('Find colletion data by id', value);
});
}).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
_id: 1, json: {name: 'chevy', age: 23}
};
var options = {};
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) {
console.log("JsonStore remove document sucess: ", numberOfDocsRemoved)
}).fail(function (error) {
console.log("JsonStore remove document erro: ", error)
});
} */
}
+7 -10
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';
@@ -11,13 +10,12 @@ import { Token } from '../models/token.model';
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
import { NavigationExtras, Router } from '@angular/router';
import { ToastService } from '../services/toast.service';
import { JsonStore } from './jsonStore.service';
import { BackgroundService } from './background.service';
import { v4 as uuidv4 } from 'uuid';
import { EventTrigger } from '../services/eventTrigger.service';
import { SessionStore } from '../store/session.service';
import { FCM } from '@ionic-native/fcm/ngx';
//import { FCM } from '@ionic-native/fcm/ngx';
//import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
@Injectable({
@@ -27,7 +25,7 @@ export class NotificationsService {
adding: "intervenient" | "CC" = "intervenient";
folderId: string;
DataArray: Array<String> = [];
DataArray = new Array();
callbacks: {
type: string,
@@ -46,10 +44,9 @@ export class NotificationsService {
private toastService: ToastService,
private zone: NgZone,
private activeroute: ActivatedRoute,
private jsonstore: JsonStore,
private eventtrigger: EventTrigger,
private backgroundservice: BackgroundService,
private fcm: FCM) {
/* private fcm: FCM */) {
this.storageService.get("Notifications").then((value) => {
@@ -88,7 +85,7 @@ export class NotificationsService {
return this.http.get<Token[]>(`${geturl}`);
}
getAndpostToken(username) {
/* getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
} else {
@@ -135,14 +132,14 @@ export class NotificationsService {
console.log(data.Object)
console.log(data.IdObject)
/* this.DataArray.push(data)
this.DataArray.push(data)
console.log("On ReceiveNotification", this.DataArray)
this.storageService.store("Notifications", this.DataArray) */
this.storageService.store("Notifications", this.DataArray)
};
});
}
} */
/////////////////////////////////////////////////////
+4 -4
View File
@@ -6,7 +6,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { ProfilePage } from 'src/app/modals/profile/profile.page';
import { StorageService } from '../../services/storage.service';
import { SessionStore } from 'src/app/store/session.service';
import { NotificationsService } from '../../services/notifications.service';
//import { NotificationsService } from '../../services/notifications.service';
import { environment } from 'src/environments/environment';
import { EventTrigger } from '../../services/eventTrigger.service';
import { ThemeService } from '../../services/theme.service';
@@ -35,7 +35,7 @@ export class HeaderPage implements OnInit {
private animationController: AnimationController,
private storageservice: StorageService,
private platform: Platform,
private notificationsService: NotificationsService,
//private notificationsService: NotificationsService,
private eventrigger: EventTrigger,
public ThemeService: ThemeService
) {
@@ -67,7 +67,7 @@ export class HeaderPage implements OnInit {
}
UpdateNotificationCount() {
/* UpdateNotificationCount() {
this.notificationsService.registerCallback(
'any',
() => {
@@ -76,7 +76,7 @@ export class HeaderPage implements OnInit {
}, 100)
}
)
}
} */
notificationLengthData() {
this.storageservice.get("Notifications").then((value) => {