mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Removed synchro services
This commit is contained in:
@@ -12,7 +12,6 @@ import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { FileService } from 'src/app/services/functions/file.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { NewEventPage } from 'src/app/shared/agenda/new-event/new-event.page';
|
||||
import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page';
|
||||
@@ -45,7 +44,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
members:any;
|
||||
scrollingOnce:boolean = true;
|
||||
|
||||
synchro = synchro;
|
||||
chatMessageStore = ChatMessageStore
|
||||
chatUserStorage = ChatUserStorage
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
|
||||
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from '../../services/socket/synchro.service';
|
||||
import { NetworkConnectionService } from 'src/app/services/network-connection.service'
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@@ -79,7 +78,6 @@ export class EventsPage implements OnInit {
|
||||
loggeduser: LoginUserRespose;
|
||||
|
||||
existingScreenOrientation: string;
|
||||
synch = synchro
|
||||
|
||||
constructor(
|
||||
private eventService: EventsService,
|
||||
|
||||
@@ -21,7 +21,6 @@ import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -19,7 +19,6 @@ import { AttachmentList } from 'src/app/models/Excludetask';
|
||||
import { PermissionService } from 'src/app/services/worker/permission.service';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
@@ -47,8 +46,6 @@ export class DespachoPage implements OnInit {
|
||||
intervenientes: any;
|
||||
cc: any = [];
|
||||
|
||||
synch = synchro;
|
||||
|
||||
constructor(private activateRoute: ActivatedRoute,
|
||||
private processes: ProcessesService,
|
||||
private iab: InAppBrowser,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
import { DespachoStore } from 'src/app/store/despacho-store.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { isThisHour } from 'date-fns';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
@@ -18,7 +17,6 @@ import { BackgroundService } from 'src/app/services/background.service';
|
||||
export class DespachosPage implements OnInit {
|
||||
|
||||
despachoStore = DespachoStore;
|
||||
synch = synchro;
|
||||
listToPresent = [];
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -14,7 +14,6 @@ import { Location } from '@angular/common';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -26,7 +26,6 @@ import { PermissionService } from 'src/app/services/worker/permission.service';
|
||||
|
||||
|
||||
import { SqliteService } from '../../services/sqlite.service';
|
||||
import { synchro } from '../../services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@@ -110,9 +109,6 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
//
|
||||
// pipe
|
||||
|
||||
synch = synchro;
|
||||
|
||||
|
||||
customTaskPipe = new CustomTaskPipe()
|
||||
|
||||
@ViewChild(ExpedientsPage) expedientesPage: ExpedientsPage;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ImageModalPage } from '../gallery/image-modal/image-modal.page';
|
||||
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
||||
import { Location } from '@angular/common';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -28,7 +28,8 @@ export class PublicationDetailPage implements OnInit {
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
private sqliteservice: SqliteService ) {
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService ) {
|
||||
|
||||
this.publicationId = this.navParams.get('publicationId');
|
||||
/* this.folderId = this.navParams.get('folderIdId'); */
|
||||
@@ -81,11 +82,7 @@ export class PublicationDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
if(synchro.connected === true) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
|
||||
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publications',
|
||||
@@ -64,14 +64,28 @@ export class PublicationsPage implements OnInit {
|
||||
private animationController: AnimationController,
|
||||
private publications: PublicationsService,
|
||||
private toastService: ToastService,
|
||||
private sqliteservice: SqliteService
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getFromDB();
|
||||
|
||||
const pathname = window.location.pathname
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||
this.getActions();
|
||||
}
|
||||
});
|
||||
this.hideRefreshButton();
|
||||
|
||||
this.backgroundservice.registerBackService('Online', () => {
|
||||
this.getActions();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
hideRefreshButton() {
|
||||
@@ -153,50 +167,40 @@ export class PublicationsPage implements OnInit {
|
||||
});
|
||||
|
||||
|
||||
}, (error) => {
|
||||
this.getFromDB();
|
||||
});
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
const pathname = window.location.pathname
|
||||
this.sqliteservice.getAllActions().then((actions: any[]) => {
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||
this.getActions();
|
||||
console.log('offline publi', actions)
|
||||
|
||||
this.publicationsEventFolderList = new Array();
|
||||
this.publicationsTravelFolderList = new Array();
|
||||
|
||||
actions.forEach(data => {
|
||||
let folder: PublicationFolder = {
|
||||
ProcessId: data.ProcessId,
|
||||
Description: data.Description,
|
||||
Detail: data.Detail,
|
||||
DateBegin: data.DateBegin,
|
||||
DateEnd: data.DateEnd,
|
||||
ActionType: data.ActionType,
|
||||
}
|
||||
|
||||
if (data.ActionType == "Evento") {
|
||||
this.publicationsEventFolderList.push(folder);
|
||||
}
|
||||
else {
|
||||
this.publicationsTravelFolderList.push(folder);
|
||||
}
|
||||
this.showLoader = false;
|
||||
});
|
||||
|
||||
this.hideRefreshButton();
|
||||
} else {
|
||||
this.sqliteservice.getAllActions().then((actions: any[]) => {
|
||||
|
||||
console.log('offline publi', actions)
|
||||
|
||||
this.publicationsEventFolderList = new Array();
|
||||
this.publicationsTravelFolderList = new Array();
|
||||
|
||||
actions.forEach(data => {
|
||||
let folder: PublicationFolder = {
|
||||
ProcessId: data.ProcessId,
|
||||
Description: data.Description,
|
||||
Detail: data.Detail,
|
||||
DateBegin: data.DateBegin,
|
||||
DateEnd: data.DateEnd,
|
||||
ActionType: data.ActionType,
|
||||
}
|
||||
|
||||
if (data.ActionType == "Evento") {
|
||||
this.publicationsEventFolderList.push(folder);
|
||||
}
|
||||
else {
|
||||
this.publicationsTravelFolderList.push(folder);
|
||||
}
|
||||
this.showLoader = false;
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async editAction(folderId?: string) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-f
|
||||
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
||||
import { PublicationDetailPage } from './publication-detail/publication-detail.page';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-publications',
|
||||
@@ -42,7 +42,8 @@ export class ViewPublicationsPage implements OnInit {
|
||||
private publications: PublicationsService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private sqliteservice: SqliteService) {
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService) {
|
||||
|
||||
this.item = new PublicationFolder();
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
@@ -63,7 +64,16 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.folderId = this.folderId['ProcessId']
|
||||
}
|
||||
|
||||
this.getFromDB();
|
||||
this.getPublicationDetail();
|
||||
setTimeout(() => {
|
||||
this.getPublications();
|
||||
}, 5000);
|
||||
|
||||
this.backgroundservice.registerBackService('Online',() => {
|
||||
this.getPublicationDetail();
|
||||
this.getPublications();
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -129,6 +139,9 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.showLoader = false;
|
||||
},
|
||||
(error) => {
|
||||
if(error.status == '0') {
|
||||
this.getFromDB();
|
||||
}
|
||||
if (error.status == '404') {
|
||||
this.error = 'Sem publicações disponíveis!';
|
||||
this.publicationList = [];
|
||||
@@ -142,47 +155,38 @@ export class ViewPublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
if (synchro.connected === true) {
|
||||
this.getPublicationDetail();
|
||||
setTimeout(() => {
|
||||
this.getPublications();
|
||||
}, 5000);
|
||||
|
||||
} else {
|
||||
this.sqliteservice.getActionById(this.folderId).then((publications) => {
|
||||
console.log('publications', publications)
|
||||
let item = {
|
||||
ActionType: publications[0].ActionType,
|
||||
DateBegin: publications[0].DateBegin,
|
||||
DateEnd: publications[0].DateEnd,
|
||||
Description: publications[0].Description,
|
||||
Detail: publications[0].Detail,
|
||||
ProcessId: publications[0].ProcessId
|
||||
}
|
||||
this.publicationDitails = item;
|
||||
|
||||
this.sqliteservice.getActionById(this.folderId).then((publications) => {
|
||||
console.log('publications', publications)
|
||||
let item = {
|
||||
ActionType: publications[0].ActionType,
|
||||
DateBegin: publications[0].DateBegin,
|
||||
DateEnd: publications[0].DateEnd,
|
||||
Description: publications[0].Description,
|
||||
Detail: publications[0].Detail,
|
||||
ProcessId: publications[0].ProcessId
|
||||
let publicationArray = [];
|
||||
JSON.parse(publications[0].publications).forEach(element => {
|
||||
let publicationlis = {
|
||||
DateIndex: element.DateIndex,
|
||||
DatePublication: element.DatePublication,
|
||||
DocumentId: element.DocumentId,
|
||||
FileBase64: element.FileBase64,
|
||||
FileExtension: element.FileExtension,
|
||||
Message: element.Message,
|
||||
OrganicEntityId: element.OrganicEntityId,
|
||||
OriginalFileName: element.OriginalFileName,
|
||||
ProcessId: element.ProcessId
|
||||
}
|
||||
this.publicationDitails = item;
|
||||
publicationArray.push(publicationlis);
|
||||
|
||||
let publicationArray = [];
|
||||
JSON.parse(publications[0].publications).forEach(element => {
|
||||
let publicationlis = {
|
||||
DateIndex: element.DateIndex,
|
||||
DatePublication: element.DatePublication,
|
||||
DocumentId: element.DocumentId,
|
||||
FileBase64: element.FileBase64,
|
||||
FileExtension: element.FileExtension,
|
||||
Message: element.Message,
|
||||
OrganicEntityId: element.OrganicEntityId,
|
||||
OriginalFileName: element.OriginalFileName,
|
||||
ProcessId: element.ProcessId
|
||||
}
|
||||
publicationArray.push(publicationlis);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
this.getpublication = publicationArray;
|
||||
})
|
||||
|
||||
}
|
||||
this.getpublication = publicationArray;
|
||||
})
|
||||
}
|
||||
|
||||
async AddPublication(publicationType: any, folderId: any) {
|
||||
|
||||
Reference in New Issue
Block a user