change storage package to beast-rom

This commit is contained in:
Peter Maquiran
2022-03-10 23:08:29 +01:00
parent f3aabae9c7
commit c2b1a54a6e
18 changed files with 256 additions and 185 deletions
@@ -18,7 +18,7 @@ import { UserSession } from 'src/app/models/user.model';
import { AuthService } from '../auth.service';
import { ChatStorageService } from './chat-storage.service'
import { ChatMethodsService } from './chat-methods.service'
import { AESEncrypt } from '../aesencrypt.service'
@Injectable({
providedIn: 'root'
@@ -54,7 +54,8 @@ export class WsChatMethodsService {
private chatService: ChatService,
private authService: AuthService,
private ChatStorageService: ChatStorageService,
private ChatMethodsService:ChatMethodsService
private ChatMethodsService:ChatMethodsService,
private AESEncrypt: AESEncrypt
) {
this.loggedUser = authService.ValidatedUserChat['data'];
@@ -146,6 +147,8 @@ export class WsChatMethodsService {
try {
const rooms = await this.storage.get('Rooms');
console.log('restore',rooms)
if(rooms) {
await rooms.result.update.forEach( async (roomData: room) => {
await this.prepareRoom(roomData);
@@ -163,9 +166,6 @@ export class WsChatMethodsService {
const rooms = await this.WsChatService.getRooms();
await this.storage.remove('Rooms');
console.log('rooms ============', rooms)
await rooms.result.update.forEach( async (roomData: room, index) => {
const roomId = this.getRoomId(roomData);
@@ -199,8 +199,8 @@ export class WsChatMethodsService {
});
console.log('save rooms', rooms)
await this.storage.set('Rooms', rooms);
console.log(rooms.result.update, 'rooms.result.update')
this.sortRoomList()
this.loadingWholeList = false
@@ -291,7 +291,7 @@ export class WsChatMethodsService {
// create room
if(!this.roomExist(roomId)) {
let room:RoomService = new RoomService(this.WsChatService, new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService , this.ChatStorageService, this.ChatMethodsService)
let room:RoomService = new RoomService(this.WsChatService, new MessageService(this.storage, this.NfService, this.WsChatService, this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService , this.ChatStorageService, this.ChatMethodsService, this.AESEncrypt)
room.setData(setData)
room.receiveMessage()
room.getAllUsers = this.getUsers