fix table notification permision and chat open conversation

This commit is contained in:
Lorito Tiago
2023-10-11 10:18:01 +01:00
parent cca49822b3
commit 3007cf6897
5 changed files with 395 additions and 35 deletions
+2 -2
View File
@@ -390,7 +390,7 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 42;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
INFOPLIST_FILE = App/Info.plist;
@@ -419,7 +419,7 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 42;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
INFOPLIST_FILE = App/Info.plist;
File diff suppressed because one or more lines are too long
+7 -6
View File
@@ -108,6 +108,7 @@ export class ChatPage implements OnInit {
showEventEditOrOpen: "edit" | "add" | "" | "eventoToApprove" = ""
socket: WebSocket;
receivedData: any;
routerSubscription
constructor(
private chatService: ChatService,
@@ -167,7 +168,7 @@ export class ChatPage implements OnInit {
}
});
this.router.events.forEach((event) => {
this.routerSubscription = this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd && event.url.startsWith('/home/chat')) {
this.routeCheck()
}
@@ -176,6 +177,11 @@ export class ChatPage implements OnInit {
this.routeCheck()
}
ngOnDestroy() {
// this.setStatus('offline');
this.routerSubscription?.unsubscribe();
}
reopenWebSocketConnection() {
// Implement your reconnection logic here.
const newWebSocket = new WebSocket(environment.apiWsChatUrl);
@@ -218,11 +224,6 @@ export class ChatPage implements OnInit {
return Array(n);
}
ngOnDestroy() {
this.setStatus('offline');
}
setStatus(status: string) {
let body = {
message: '',
@@ -101,10 +101,10 @@ export class ViewPublicationsPage implements OnInit {
createPublicationList(folderId = this.folderId) {
console.log('create')
if(!this.publicationFolderService.publicationList[folderId]) {
if (!this.publicationFolderService.publicationList[folderId]) {
this.publicationFolderService.publicationList[folderId] = []
}
if(!this.publicationFolderService.FolderDetails[folderId]) {
if (!this.publicationFolderService.FolderDetails[folderId]) {
this.publicationFolderService.FolderDetails[folderId] = new PublicationFolder();
}
}
@@ -116,7 +116,7 @@ export class ViewPublicationsPage implements OnInit {
this.getPublicationsIds();
try {
event?.target?.complete();
} catch(error) {}
} catch (error) { }
//}, 3000);
}
@@ -132,9 +132,9 @@ export class ViewPublicationsPage implements OnInit {
getPublicationDetail() {
const folderId = this.folderId
this.publications.GetPresidentialAction(folderId).subscribe(res =>{
this.publications.GetPresidentialAction(folderId).subscribe(res => {
this.publicationFolderService.FolderDetails[folderId] = res
this.storage.set(folderId+"name", res)
this.storage.set(folderId + "name", res)
}, (error) => {
this.showLoader = false;
// this.httpErroHandle.httpStatusHandle(error)
@@ -158,7 +158,7 @@ export class ViewPublicationsPage implements OnInit {
let loadLater = []
for (let publicationId of publicationIds) {
if(!this.publicationIsPresent(publicationId, folderId)) {
if (!this.publicationIsPresent(publicationId, folderId)) {
await this.loadPublication(publicationId, folderId)
} else {
@@ -166,14 +166,14 @@ export class ViewPublicationsPage implements OnInit {
}
}
for( let publicationId of loadLater) {
for (let publicationId of loadLater) {
await this.loadPublication(publicationId, folderId)
}
for(let localPublication of this.publicationFolderService.publicationList[folderId]) {
for (let localPublication of this.publicationFolderService.publicationList[folderId]) {
const apiPublication = publicationIds.includes(localPublication.DocumentId)
if(!apiPublication) {
if (!apiPublication) {
this.publicationFolderService.deletePost(folderId, localPublication.DocumentId)
}
}
@@ -182,20 +182,20 @@ export class ViewPublicationsPage implements OnInit {
this.storage.set(folderId, this.publicationFolderService.publicationList[folderId]);
this.getpublication = this.publicationFolderService.publicationList[folderId];
} catch(error) {
} catch (error) {
this.showLoader = false;
}
}
publicationIsPresent(publicationId, folderId) {
return this.publicationFolderService.publicationList[folderId].find( e => e.DocumentId == publicationId )
return this.publicationFolderService.publicationList[folderId].find(e => e.DocumentId == publicationId)
}
publicationFind(publicationId, folderId) {
return this.publicationFolderService.publicationList[folderId].find( e => e.DocumentId == publicationId )
return this.publicationFolderService.publicationList[folderId].find(e => e.DocumentId == publicationId)
}
publicationFindIndex(publicationId, folderId) {
return this.publicationFolderService.publicationList[folderId].findIndex( e => e.DocumentId == publicationId )
return this.publicationFolderService.publicationList[folderId].findIndex(e => e.DocumentId == publicationId)
}
async loadPublication(publicationId, folderId) {
@@ -204,7 +204,7 @@ export class ViewPublicationsPage implements OnInit {
const findIndex = this.publicationFindIndex(publicationId, folderId)
const found = this.publicationIsPresent(publicationId, folderId)
if(!found) {
if (!found) {
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
} else {
this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails
@@ -229,13 +229,13 @@ export class ViewPublicationsPage implements OnInit {
await modal.present();
}
goToPublicationDetail(DocumentId:string, ProcessId: string) {
goToPublicationDetail(DocumentId: string, ProcessId: string) {
this.router.navigate(['/home/publications/view-publications', this.folderId, DocumentId]);
}
async viewPublicationDetail(DocumentId: string) {
alert('nice');
// alert('nice');
const modal = await this.modalController.create({
component: PublicationDetailPage,
componentProps: {
+7 -1
View File
@@ -73,8 +73,14 @@ export class NotificationsService {
PushNotifications.requestPermissions().then(async (result) => {
if (result.receive === 'granted') {
// Register with Apple / Google to receive push via APNS/FCM
PushNotifications.register();
try {
PushNotifications.register().catch((error) => {
console.log("Register device", error)
})
this.getAndpostToken("")
} catch (error) {
console.log("Granted permission error", error)
}
} else {
// Show some error
}