This commit is contained in:
tiago.kayaya
2021-02-26 08:38:33 +01:00
parent a74a8bfa9d
commit 8a93e49f71
9 changed files with 63 additions and 16 deletions
+16
View File
@@ -2087,6 +2087,22 @@
"@types/cordova": "^0.0.34" "@types/cordova": "^0.0.34"
} }
}, },
"@ionic-native/sqlite": {
"version": "5.31.1",
"resolved": "https://registry.npmjs.org/@ionic-native/sqlite/-/sqlite-5.31.1.tgz",
"integrity": "sha512-X26n+6mvqyv94ADG67lHOmDj/Ha+ZVbHztwsWzbvBqmnmgck9y+mo8ndC47UKIXRA/8lwoGMyAtJAfE81eT3mg==",
"requires": {
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/sqlite-porter": {
"version": "5.31.1",
"resolved": "https://registry.npmjs.org/@ionic-native/sqlite-porter/-/sqlite-porter-5.31.1.tgz",
"integrity": "sha512-dBIp0f85Qn6KRymOg5dZxlfZTiyMDXRYiO1Eg44UxIsNZx7qchZg63wMRWyZmdnFWMfvYjAbkJ3NKiumqR1z3w==",
"requires": {
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/status-bar": { "@ionic-native/status-bar": {
"version": "5.31.1", "version": "5.31.1",
"resolved": "https://registry.npmjs.org/@ionic-native/status-bar/-/status-bar-5.31.1.tgz", "resolved": "https://registry.npmjs.org/@ionic-native/status-bar/-/status-bar-5.31.1.tgz",
+2
View File
@@ -34,6 +34,8 @@
"@ionic-native/in-app-browser": "^5.28.0", "@ionic-native/in-app-browser": "^5.28.0",
"@ionic-native/ionic-webview": "^5.30.0", "@ionic-native/ionic-webview": "^5.30.0",
"@ionic-native/splash-screen": "^5.31.1", "@ionic-native/splash-screen": "^5.31.1",
"@ionic-native/sqlite": "^5.31.1",
"@ionic-native/sqlite-porter": "^5.31.1",
"@ionic-native/status-bar": "^5.0.0", "@ionic-native/status-bar": "^5.0.0",
"@ionic-native/wheel-selector": "^5.31.1", "@ionic-native/wheel-selector": "^5.31.1",
"@ionic/angular": "^5.5.4", "@ionic/angular": "^5.5.4",
-2
View File
@@ -229,8 +229,6 @@ export class HomePage implements OnInit {
} }
async viewPublications(folderId) { async viewPublications(folderId) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: ViewPublicationsPage, component: ViewPublicationsPage,
/* enterAnimation, /* enterAnimation,
+14 -4
View File
@@ -9,6 +9,7 @@ import { ContactsPage } from './messages/contacts/contacts.page';
import { MessagesPage } from './messages/messages.page'; import { MessagesPage } from './messages/messages.page';
import { NewGroupPage } from './new-group/new-group.page'; import { NewGroupPage } from './new-group/new-group.page';
import { NewchatPage } from './newchat/newchat.page'; import { NewchatPage } from './newchat/newchat.page';
import { Storage } from '@ionic/storage';
@Component({ @Component({
selector: 'app-chat', selector: 'app-chat',
@@ -24,7 +25,7 @@ export class ChatPage implements OnInit {
X_User_Id:any; X_User_Id:any;
X_Auth_Token:any; X_Auth_Token:any;
loggedUser: any; private loggedUser: any;
/* Set segment variable */ /* Set segment variable */
segment:string; segment:string;
allGroups: any[]; allGroups: any[];
@@ -42,20 +43,29 @@ export class ChatPage implements OnInit {
private chatService: ChatService, private chatService: ChatService,
private modalController: ModalController, private modalController: ModalController,
private authService: AuthService, private authService: AuthService,
private storage:Storage,
) { ) {
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
this.headers = this.headers.set('X-User-Id', 'GqjNWiLrGEHRna7Zn'); /* this.headers = this.headers.set('X-User-Id', 'GqjNWiLrGEHRna7Zn');
this.headers = this.headers.set('X-Auth-Token', 'SJwIgtlqfloPK696fpc2VBvyDluipuIHKB_0Q6-9ycJ'); this.headers = this.headers.set('X-Auth-Token', 'SJwIgtlqfloPK696fpc2VBvyDluipuIHKB_0Q6-9ycJ'); */
} }
ngOnInit() { ngOnInit() {
this.segment = "Contactos"; this.segment = "Contactos";
this.authService.userData$.subscribe((res:any)=>{ this.authService.userData$.subscribe((res:any)=>{
this.loggedUser=res; this.loggedUser=res;
console.log(this.loggedUser); console.log(this.loggedUser);
}); });
this.load(); this.storage.get('userDataKey').then(val=> {
let t = JSON.parse(unescape(atob(val)));
this.loggedUser=t;
this.load();
})
} }
onSegmentChange(){ onSegmentChange(){
+3 -6
View File
@@ -52,12 +52,9 @@ export class AuthService {
result = await this.http.get<boolean>(service, options).toPromise(); result = await this.http.get<boolean>(service, options).toPromise();
response = await this.http.post<any>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise(); response = await this.http.post<any>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
/* this.http.post(environment.apiURL + "UserAuthentication/Login", '', this.opts).subscribe(res=>{
this.storageService.store(AuthConnstants.USER, res); console.log(response);
this.ValidatedUser = user;
response = user;
console.log(user);
}); */
if (result) if (result)
{ {
+1
View File
@@ -87,6 +87,7 @@ export class ChatService {
//Load messages from roomId //Load messages from roomId
getAllDirectMessages(){ getAllDirectMessages(){
console.log(this.options);
return this.http.get(environment.apiChatUrl+'im.list', this.options); return this.http.get(environment.apiChatUrl+'im.list', this.options);
} }
//Load messages from roomId //Load messages from roomId
+16
View File
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { DatabaseService } from './database.service';
describe('DatabaseService', () => {
let service: DatabaseService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(DatabaseService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+9
View File
@@ -0,0 +1,9 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class DatabaseService {
constructor() { }
}
+2 -4
View File
@@ -15,11 +15,9 @@ const { Storage } = Plugins; */
} }
// Get the value // Get the value
async get(key: string) { async get(key: string) {
const ret = await this.storage.get(key).then((val) => { const ret = await this.storage.get(key).then((val) => { return val; });
return val;
});
return JSON.parse(unescape(atob(ret))); return JSON.parse(unescape(atob(ret)));
} }
/* /*
// Get the value // Get the value
async get(storageKey: string) { async get(storageKey: string) {