diff --git a/config.xml b/config.xml
index f6984c7aa..fdf1dd10c 100644
--- a/config.xml
+++ b/config.xml
@@ -5,6 +5,8 @@
Equilibrium Team
+
+
@@ -100,7 +102,6 @@
-
diff --git a/package-lock.json b/package-lock.json
index c587ce5b6..100bbf6d3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1815,6 +1815,14 @@
"@types/cordova": "^0.0.34"
}
},
+ "@ionic-native/http": {
+ "version": "5.31.1",
+ "resolved": "https://registry.npmjs.org/@ionic-native/http/-/http-5.31.1.tgz",
+ "integrity": "sha512-J9pLHycF6ndpqIYsyZEVjEnz33jbTWnE5vbq+Lpytd6KO/jE/Lyuy8z0wTzVkKYI1bKpgC+Q0XuBt2UgyEuPdA==",
+ "requires": {
+ "@types/cordova": "^0.0.34"
+ }
+ },
"@ionic-native/in-app-browser": {
"version": "5.31.1",
"resolved": "https://registry.npmjs.org/@ionic-native/in-app-browser/-/in-app-browser-5.31.1.tgz",
@@ -5365,11 +5373,6 @@
"integrity": "sha512-Jb3V72btxf3XHpkPQsGdyc8N6tVBYn1vsxSFj43fIz9vonJDUThYPCJJHqk6PX6N4dJw6I4FjxkpfCR4LDYMlw==",
"dev": true
},
- "cordova-plugin-file": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-6.0.2.tgz",
- "integrity": "sha512-m7cughw327CjONN/qjzsTpSesLaeybksQh420/gRuSXJX5Zt9NfgsSbqqKDon6jnQ9Mm7h7imgyO2uJ34XMBtA=="
- },
"cordova-plugin-filepath": {
"version": "1.5.8",
"resolved": "https://registry.npmjs.org/cordova-plugin-filepath/-/cordova-plugin-filepath-1.5.8.tgz",
@@ -5469,19 +5472,6 @@
"which": "^1.3.0"
}
},
- "cordova-sqlite-storage": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/cordova-sqlite-storage/-/cordova-sqlite-storage-5.1.0.tgz",
- "integrity": "sha512-UmHe9yQiYblDBToh3z91WHuD6ZgmCm3VX+1QFseYQs4WVQ3+ndj22qyGby/NV0uyCgok91gB1obLjLM+9vYJEw==",
- "requires": {
- "cordova-sqlite-storage-dependencies": "3.0.0"
- }
- },
- "cordova-sqlite-storage-dependencies": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/cordova-sqlite-storage-dependencies/-/cordova-sqlite-storage-dependencies-3.0.0.tgz",
- "integrity": "sha512-A7gV5lQZc0oPrJ/a+lsZmMZr7vYou4MXyQFOY+b/dwuCMsagLT0EsL7oY54tqzpvjtzLfh0aZGGm9i8DMAIFSA=="
- },
"core-js": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.9.0.tgz",
diff --git a/package.json b/package.json
index 4a5f45298..1e65283e9 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,7 @@
"@ionic-native/core": "^5.0.7",
"@ionic-native/file": "^5.30.0",
"@ionic-native/file-path": "^5.30.0",
+ "@ionic-native/http": "^5.31.1",
"@ionic-native/in-app-browser": "^5.28.0",
"@ionic-native/ionic-webview": "^5.30.0",
"@ionic-native/status-bar": "^5.0.0",
@@ -41,10 +42,8 @@
"angular-calendar": "^0.28.22",
"angular-tag-cloud-module": "^5.2.2",
"cordova-plugin-camera": "^5.0.1",
- "cordova-plugin-file": "^6.0.2",
"cordova-plugin-filepath": "^1.5.8",
"cordova-res": "^0.15.1",
- "cordova-sqlite-storage": "^5.1.0",
"date-fns": "^2.16.1",
"ionic-selectable": "^4.5.0",
"ionic2-alpha-scroll": "^2.0.1",
@@ -80,7 +79,7 @@
"cordova-plugin-ionic-webview": "^4.2.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
- "cordova-plugin-whitelist": "^1.3.3",
+ "cordova-plugin-whitelist": "^1.3.4",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
@@ -96,7 +95,6 @@
"description": "An Ionic project",
"cordova": {
"plugins": {
- "cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
@@ -106,8 +104,9 @@
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-camera": {},
- "cordova-sqlite-storage": {},
- "cordova-plugin-compat": {}
+ "cordova-plugin-compat": {},
+ "cordova-plugin-whitelist": {},
+ "cordova-sqlite-storage": {}
},
"platforms": [
"browser",
@@ -120,4 +119,4 @@
"url": "git+https://Kayaya@bitbucket.org/equilibriumito/gabinete-digital.git"
},
"license": "ISC"
-}
\ No newline at end of file
+}
diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts
index ac9a7dfc2..e8d57231e 100644
--- a/src/app/pages/login/login.page.ts
+++ b/src/app/pages/login/login.page.ts
@@ -11,6 +11,7 @@ import { PhotoService } from 'src/app/services/photo.service';
import { NotificationsService } from 'src/app/services/notifications.service';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Token } from '../../models/token.model';
+import { AlertService } from 'src/app/services/alert.service';
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed } from '@capacitor/core';
@@ -38,7 +39,8 @@ export class LoginPage implements OnInit {
private storageService: StorageService,
private toastService: ToastService,
private photoService: PhotoService,
- public alertController: AlertController) { }
+ public alertController: AlertController,
+ private alertService: AlertService,) { }
ngOnInit() {
@@ -124,6 +126,7 @@ export class LoginPage implements OnInit {
BasicAuthKey: ""
}
if (await this.authService.login(this.userattempt)) {
+ this.alertService.presentAlert('5');
this.loginRocketChat();
//this.storeUserIdANdToken();
diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts
index 6ff36b53d..8f4003ba9 100644
--- a/src/app/services/auth.service.ts
+++ b/src/app/services/auth.service.ts
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
-import { StorageService } from './storage.service';
+/* import { StorageService } from './storage.service'; */
import { Router } from '@angular/router';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { User } from '../models/user.model';
@@ -7,6 +7,9 @@ import { environment } from 'src/environments/environment';
import { HttpService } from './http.service';
import { BehaviorSubject, Observable } from 'rxjs';
import { AuthConnstants } from '../config/auth-constants';
+import { AlertService } from './alert.service';
+import { map } from 'rxjs/operators';
+import { Storage } from '@ionic/storage';
@Injectable({
providedIn: 'root'
@@ -16,18 +19,23 @@ export class AuthService {
userId$ = new BehaviorSubject('');
headers: HttpHeaders;
opts:any;
+ rs:any;
constructor(
private http: HttpClient,
private httpService: HttpService,
- private storageService:StorageService,
- private router:Router
+/* private storageService:StorageService, */
+ private router:Router,
+ private alertCrontroller: AlertService,
+ private storage: Storage,
) {
this.headers = new HttpHeaders();
}
public ValidatedUser:User;
+ public ValidatedUser2:any;
async login(user: User): Promise {
+ this.alertCrontroller.presentAlert('1');
user.BasicAuthKey = 'Basic ' + btoa(user.username + '@' + user.domainName + ':' + user.password); //conversão em base64 das credenciais inseridas
const options = { headers: {'Authorization': user.BasicAuthKey }};
@@ -40,23 +48,76 @@ export class AuthService {
let result: boolean | PromiseLike;
let response: any;
- result = await this.http.get(service, options).toPromise();
+ this.alertCrontroller.presentAlert('2');
+ this.http.get('http://jsonplaceholder.typicode.com/todos/1');
+ this.alertCrontroller.presentAlert('2.1');
+ this.http.get('https://jsonplaceholder.typicode.com/todos/1');
+ this.alertCrontroller.presentAlert('2.2');
+ var that = this;
+
+ await this.http.get(service, options).subscribe(res=>{
+ this.alertCrontroller.presentAlert('3.1');
+ result = res;
+ this.storage.set('login', res);
+
+
+ return result;
+ if (result)
+ {
+ this.alertCrontroller.presentAlert('4');
+ this.ValidatedUser = user;
+ //this.storageService.store(AuthConnstants.USER, response);
+ }
+
+ });
+ this.storage.get('name').then((val) => {
+ console.log('Your age is', val);
+ });
+
+
+ this.alertCrontroller.presentAlert('3');
response = await this.http.post(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
+ console.log(response);
+
/* this.http.post(environment.apiURL + "UserAuthentication/Login", '', this.opts).subscribe(res=>{
this.storageService.store(AuthConnstants.USER, res);
this.ValidatedUser = user;
response = user;
console.log(user);
}); */
-
- if (result)
- {
- this.ValidatedUser = user;
- //this.storageService.store(AuthConnstants.USER, response);
- }
- return result;
+
+ /* this.rs = this.storage.get('name').toPromise()
+ .then((val) => {
+ return val;
+ }); */
+
+ let t = this.get('name');
+
+ console.log(this.ValidatedUser2);
+
+
+
+
+ console.log(this.rs.map(responce=>responce.json()).toPromise());
+
+ return false;
}
+ async get(key: string): Promise {
+ try {
+ const result = await this.storage.get(key);
+ console.log('storageGET: ' + key + ': ' + result);
+ if (result != null) {
+ this.ValidatedUser2 = result;
+ return result;
+ }
+ return null;
+ } catch (reason) {
+ console.log(reason);
+ return null;
+ }
+ }
+
logout(){
this.ValidatedUser = null;
}
diff --git a/src/index.html b/src/index.html
index 8942fb494..566f90ff1 100644
--- a/src/index.html
+++ b/src/index.html
@@ -11,15 +11,18 @@
-
-
-
+
+
+
+
+
+