From 572dc14f2a1246c98e4dd1b08b5bd39335be474c Mon Sep 17 00:00:00 2001 From: amachadogarcia Date: Tue, 22 Sep 2020 14:32:20 +0200 Subject: [PATCH 01/20] Adding back button to all pages --- src/src/assets/icon/flecha.svg | 42 +++++++++++++++++++ src/src/pages/configScreen/configScreen.html | 5 +++ src/src/pages/configScreen/configScreen.ts | 4 +- src/src/pages/profile/profile.html | 5 +++ src/src/pages/profile/profile.ts | 8 ++-- src/src/pages/welcome/reconfigure.ts | 2 +- .../wifiConfirmation/wifiConfirmation.html | 5 +++ .../wifiConfirmation/wifiConfirmation.ts | 4 +- src/src/providers/oauth-conf/oauth-conf.ts | 4 +- 9 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 src/src/assets/icon/flecha.svg diff --git a/src/src/assets/icon/flecha.svg b/src/src/assets/icon/flecha.svg new file mode 100644 index 00000000..140c05f4 --- /dev/null +++ b/src/src/assets/icon/flecha.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/src/pages/configScreen/configScreen.html b/src/src/pages/configScreen/configScreen.html index 092eb68d..e81069f0 100644 --- a/src/src/pages/configScreen/configScreen.html +++ b/src/src/pages/configScreen/configScreen.html @@ -1,3 +1,8 @@ +
+ +
setting diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index 1eb56dd9..f9600081 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import {Events, ModalController, NavController} from 'ionic-angular'; +import {Events, ModalController, NavController, ViewController} from 'ionic-angular'; import {GeteduroamServices} from "../../providers/geteduroam-services/geteduroam-services"; import { ProfilePage } from '../profile/profile'; import { OauthFlow } from '../oauthFlow/oauthFlow'; @@ -82,7 +82,7 @@ export class ConfigurationScreen extends BasePage{ * */ constructor(private navCtrl: NavController, private getEduroamServices: GeteduroamServices, protected loading: LoadingProvider, protected modalCtrl: ModalController, protected dictionary: DictionaryServiceProvider, - protected event: Events, protected global: GlobalProvider) { + protected event: Events, protected global: GlobalProvider, private viewCtrl: ViewController) { super(loading, dictionary, event, global); } diff --git a/src/src/pages/profile/profile.html b/src/src/pages/profile/profile.html index e5f257bc..33c4d1b0 100644 --- a/src/src/pages/profile/profile.html +++ b/src/src/pages/profile/profile.html @@ -1,3 +1,8 @@ +
+ +
authorized diff --git a/src/src/pages/profile/profile.ts b/src/src/pages/profile/profile.ts index 65cee019..fbe64a35 100644 --- a/src/src/pages/profile/profile.ts +++ b/src/src/pages/profile/profile.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { Events, NavController, NavParams } from 'ionic-angular'; +import {Events, NavController, NavParams, ViewController} from 'ionic-angular'; import { WifiConfirmation } from '../wifiConfirmation/wifiConfirmation'; import { GeteduroamServices } from '../../providers/geteduroam-services/geteduroam-services'; import { AuthenticationMethod } from '../../shared/entities/authenticationMethod'; @@ -90,7 +90,7 @@ export class ProfilePage extends BasePage{ constructor(private navCtrl: NavController, private navParams: NavParams, protected loading: LoadingProvider, private getEduroamServices: GeteduroamServices, private errorHandler: ErrorHandlerProvider, private validator: ValidatorProvider, protected global: GlobalProvider, protected dictionary: DictionaryServiceProvider, - protected event: Events) { + protected event: Events, private viewCtrl: ViewController) { super(loading, dictionary, event, global); } @@ -139,9 +139,9 @@ export class ProfilePage extends BasePage{ if (this.activeNavigation) { this.showAll = false; - !!this.providerInfo.providerLogo ? await this.navCtrl.setRoot(WifiConfirmation, { + !!this.providerInfo.providerLogo ? await this.navCtrl.push(WifiConfirmation, { logo: this.providerInfo.providerLogo}, { animation: 'transition' }) : - await this.navCtrl.setRoot(WifiConfirmation, {}, {animation: 'transition'}); + await this.navCtrl.push(WifiConfirmation, {}, {animation: 'transition'}); } else { await this.alertConnectionDisabled(); } diff --git a/src/src/pages/welcome/reconfigure.ts b/src/src/pages/welcome/reconfigure.ts index 8065917e..c48e8dbf 100644 --- a/src/src/pages/welcome/reconfigure.ts +++ b/src/src/pages/welcome/reconfigure.ts @@ -35,7 +35,7 @@ export class ReconfigurePage extends BasePage{ */ async navigateTo() { if (this.activeNavigation) { - await this.navCtrl.setRoot(ConfigurationScreen, null, { animation: 'transition' }); + await this.navCtrl.push(ConfigurationScreen, null, { animation: 'transition' }); } else{ await this.alertConnectionDisabled(); } diff --git a/src/src/pages/wifiConfirmation/wifiConfirmation.html b/src/src/pages/wifiConfirmation/wifiConfirmation.html index 00f39d4c..00689782 100644 --- a/src/src/pages/wifiConfirmation/wifiConfirmation.html +++ b/src/src/pages/wifiConfirmation/wifiConfirmation.html @@ -1,3 +1,8 @@ +
+ +
setting diff --git a/src/src/pages/wifiConfirmation/wifiConfirmation.ts b/src/src/pages/wifiConfirmation/wifiConfirmation.ts index 1697cf03..0f029fb8 100644 --- a/src/src/pages/wifiConfirmation/wifiConfirmation.ts +++ b/src/src/pages/wifiConfirmation/wifiConfirmation.ts @@ -1,5 +1,5 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; -import {Events, NavParams, Platform} from 'ionic-angular'; +import {Events, NavParams, Platform, ViewController} from 'ionic-angular'; import { LoadingProvider } from '../../providers/loading/loading'; import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; import {BasePage} from "../basePage"; @@ -38,7 +38,7 @@ export class WifiConfirmation extends BasePage implements OnInit { constructor(private navParams: NavParams, private platform: Platform, protected loading: LoadingProvider, private sanitizer: DomSanitizer, protected dictionary:DictionaryServiceProvider, protected global: GlobalProvider, - protected event: Events) { + protected event: Events, private viewCtrl: ViewController) { super(loading, dictionary, event, global); } diff --git a/src/src/providers/oauth-conf/oauth-conf.ts b/src/src/providers/oauth-conf/oauth-conf.ts index cc69ddb7..51fad0ae 100644 --- a/src/src/providers/oauth-conf/oauth-conf.ts +++ b/src/src/providers/oauth-conf/oauth-conf.ts @@ -105,9 +105,9 @@ export class OauthConfProvider { async navigateTo() { //this.showAll = false; - !!this.providerInfo.providerLogo ? await this.navCtrl.setRoot(WifiConfirmation, { + !!this.providerInfo.providerLogo ? await this.navCtrl.push(WifiConfirmation, { logo: this.providerInfo.providerLogo}, { animation: 'transition' }) : - await this.navCtrl.setRoot(WifiConfirmation, {}, {animation: 'transition'}); + await this.navCtrl.push(WifiConfirmation, {}, {animation: 'transition'}); } } From 0ceca55dbea4086bd77092f11362b06ce3b48898 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Tue, 22 Sep 2020 20:35:12 +0200 Subject: [PATCH 02/20] Styles back button on header content --- src/src/pages/configScreen/configScreen.html | 6 +++-- src/src/pages/profile/profile.html | 4 ++-- .../wifiConfirmation/wifiConfirmation.html | 4 ++-- src/src/theme/base-content.scss | 24 +++++++++++++++++-- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/src/pages/configScreen/configScreen.html b/src/src/pages/configScreen/configScreen.html index e81069f0..97c3129c 100644 --- a/src/src/pages/configScreen/configScreen.html +++ b/src/src/pages/configScreen/configScreen.html @@ -1,8 +1,10 @@ -
-
diff --git a/src/src/pages/wifiConfirmation/wifiConfirmation.html b/src/src/pages/wifiConfirmation/wifiConfirmation.html index 00689782..f3974bee 100644 --- a/src/src/pages/wifiConfirmation/wifiConfirmation.html +++ b/src/src/pages/wifiConfirmation/wifiConfirmation.html @@ -1,5 +1,5 @@ -
-
diff --git a/src/src/theme/base-content.scss b/src/src/theme/base-content.scss index 12d9f794..ee2640af 100644 --- a/src/src/theme/base-content.scss +++ b/src/src/theme/base-content.scss @@ -33,14 +33,34 @@ ion-content { margin-top: 0; border-top: none; + .arrow-back { + text-align: left; + background-color: transparent !important; + height: 10%; + + .arrow-btn { + background-color: transparent; + padding: 20px; + height: 100%; + + span { + padding: 5px 0 0 15px; + + img{ + height: 50px; + } + } + } + } + .container-content { background: #FFFFFF; - height: 95%; + height: calc(100% - 26%); } .header-content { - height: 22%; + // height: 22%; img { width: 57px; From 98a36036a6fb0253795b907f30154dd68f7424c1 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Tue, 22 Sep 2020 20:53:24 +0200 Subject: [PATCH 03/20] Styles back button on header content --- src/src/theme/base-content.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/src/theme/base-content.scss b/src/src/theme/base-content.scss index ee2640af..985afe0a 100644 --- a/src/src/theme/base-content.scss +++ b/src/src/theme/base-content.scss @@ -40,8 +40,10 @@ ion-content { .arrow-btn { background-color: transparent; - padding: 20px; + padding: 5px; height: 100%; + box-shadow: none; + margin: 10px 0 0 0; span { padding: 5px 0 0 15px; From 99bbe3445ed07a52e921594e51f5402613c25515 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Wed, 23 Sep 2020 10:09:54 +0200 Subject: [PATCH 04/20] Lifecycle on config screen --- src/src/pages/configScreen/configScreen.html | 2 +- src/src/pages/configScreen/configScreen.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/src/pages/configScreen/configScreen.html b/src/src/pages/configScreen/configScreen.html index 97c3129c..1181a85c 100644 --- a/src/src/pages/configScreen/configScreen.html +++ b/src/src/pages/configScreen/configScreen.html @@ -7,7 +7,7 @@ -->
- setting + setting

{{getString('header', 'config')}}

diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index f9600081..f6ae7bbf 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -211,8 +211,11 @@ export class ConfigurationScreen extends BasePage{ const firstResponse = await this.getEduroamServices.discovery(); this.instances = await this.waitingSpinner(firstResponse); this.removeSpinner(); - this.showAll = true; + } + ionViewDidEnter() { + this.showAll = true; + } } From fa4a10d87b452da0d29a8c7a69d7e9a09c9c8346 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Thu, 24 Sep 2020 10:05:05 +0200 Subject: [PATCH 05/20] Control arrow back when focus on input --- src/src/pages/profile/profile.html | 11 +++++++---- src/src/pages/profile/profile.ts | 12 ++++++++++++ src/src/theme/base-content.scss | 6 +++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/src/pages/profile/profile.html b/src/src/pages/profile/profile.html index 5332b095..1224061f 100644 --- a/src/src/pages/profile/profile.html +++ b/src/src/pages/profile/profile.html @@ -1,5 +1,5 @@ -
-
@@ -29,7 +29,8 @@

{{getString('header', 'profile')}}

{{getString('label', 'password')}} -

{{getString('error', 'password')}}

@@ -38,7 +39,9 @@

{{getString('header', 'profile')}}

- {{getString('label', 'accept')}}{{getString('label', 'terms')}} + {{getString('label', 'accept')}} + {{getString('label', 'terms')}} +
diff --git a/src/src/pages/profile/profile.ts b/src/src/pages/profile/profile.ts index fbe64a35..a2c09f61 100644 --- a/src/src/pages/profile/profile.ts +++ b/src/src/pages/profile/profile.ts @@ -12,7 +12,9 @@ import { ProvideModel } from '../../shared/models/provide-model'; import { GlobalProvider } from '../../providers/global/global'; import { BasePage } from "../basePage"; import { DictionaryServiceProvider } from "../../providers/dictionary-service/dictionary-service-provider.service"; +import { Plugins } from '@capacitor/core'; +const { Keyboard } = Plugins; @Component({ selector: 'page-profile', templateUrl: 'profile.html' @@ -87,12 +89,22 @@ export class ProfilePage extends BasePage{ */ enableButton: boolean = false; + hiddenIcon: boolean = true; + constructor(private navCtrl: NavController, private navParams: NavParams, protected loading: LoadingProvider, private getEduroamServices: GeteduroamServices, private errorHandler: ErrorHandlerProvider, private validator: ValidatorProvider, protected global: GlobalProvider, protected dictionary: DictionaryServiceProvider, protected event: Events, private viewCtrl: ViewController) { super(loading, dictionary, event, global); + Keyboard.addListener('keyboardWillShow', () => { + this.hiddenIcon = false; + }); + + Keyboard.addListener('keyboardWillHide', () => { + this.hiddenIcon = true; + }); + } /** diff --git a/src/src/theme/base-content.scss b/src/src/theme/base-content.scss index 985afe0a..9f700a25 100644 --- a/src/src/theme/base-content.scss +++ b/src/src/theme/base-content.scss @@ -33,10 +33,14 @@ ion-content { margin-top: 0; border-top: none; + .arrow-back-hidden { + display: none; + } + .arrow-back { + display: block; text-align: left; background-color: transparent !important; - height: 10%; .arrow-btn { background-color: transparent; From faa1d0f6160ad0a0ce38f0186bb81e21f16d625f Mon Sep 17 00:00:00 2001 From: amachadogarcia Date: Thu, 24 Sep 2020 11:49:37 +0200 Subject: [PATCH 06/20] Back button controled and fixed scss error page --- src/src/pages/configScreen/configScreen.html | 4 ++-- src/src/pages/configScreen/configScreen.scss | 4 ++++ src/src/pages/configScreen/configScreen.ts | 2 +- src/src/pages/errors/errors.scss | 6 ++++++ src/src/pages/profile/profile.html | 2 +- src/src/pages/wifiConfirmation/wifiConfirmation.html | 2 +- src/src/pages/wifiConfirmation/wifiConfirmation.ts | 9 +++++++++ src/src/theme/base-content.scss | 4 +--- 8 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/src/pages/configScreen/configScreen.html b/src/src/pages/configScreen/configScreen.html index 1181a85c..14f8bd29 100644 --- a/src/src/pages/configScreen/configScreen.html +++ b/src/src/pages/configScreen/configScreen.html @@ -14,14 +14,14 @@

{{getString('header', 'config')}}

{{getString('label', 'institution')}} -
+
- {{getString('label', 'profile')}} + {{getString('label', 'profile')}}
diff --git a/src/src/pages/configScreen/configScreen.scss b/src/src/pages/configScreen/configScreen.scss index 9ee4ab6c..9b99dc95 100644 --- a/src/src/pages/configScreen/configScreen.scss +++ b/src/src/pages/configScreen/configScreen.scss @@ -1,5 +1,9 @@ page-config-screen { + .content-button { + padding-top: 30px; + } + //--------------------------- // Searchbar custom style //--------------------------- diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index f6ae7bbf..635e1ba6 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -10,6 +10,7 @@ import {BasePage} from "../basePage"; import {DictionaryServiceProvider} from "../../providers/dictionary-service/dictionary-service-provider.service"; import {GlobalProvider} from "../../providers/global/global"; import {ProfileModel} from "../../shared/models/profile-model"; +import {c} from "@angular/core/src/render3"; const { Keyboard } = Plugins; @Component({ @@ -211,7 +212,6 @@ export class ConfigurationScreen extends BasePage{ const firstResponse = await this.getEduroamServices.discovery(); this.instances = await this.waitingSpinner(firstResponse); this.removeSpinner(); - } ionViewDidEnter() { diff --git a/src/src/pages/errors/errors.scss b/src/src/pages/errors/errors.scss index a1b65582..2630b325 100644 --- a/src/src/pages/errors/errors.scss +++ b/src/src/pages/errors/errors.scss @@ -38,3 +38,9 @@ and (orientation: portrait) { } } } + +@media only screen and (max-device-width: 1940px) { + .base-content { + height: 87% !important; + } +} diff --git a/src/src/pages/profile/profile.html b/src/src/pages/profile/profile.html index 1224061f..57188421 100644 --- a/src/src/pages/profile/profile.html +++ b/src/src/pages/profile/profile.html @@ -4,7 +4,7 @@
-
+
authorized

{{getString('header', 'profile')}}

diff --git a/src/src/pages/wifiConfirmation/wifiConfirmation.html b/src/src/pages/wifiConfirmation/wifiConfirmation.html index f3974bee..d6290520 100644 --- a/src/src/pages/wifiConfirmation/wifiConfirmation.html +++ b/src/src/pages/wifiConfirmation/wifiConfirmation.html @@ -1,5 +1,5 @@
-
diff --git a/src/src/pages/wifiConfirmation/wifiConfirmation.ts b/src/src/pages/wifiConfirmation/wifiConfirmation.ts index 0f029fb8..f55ad234 100644 --- a/src/src/pages/wifiConfirmation/wifiConfirmation.ts +++ b/src/src/pages/wifiConfirmation/wifiConfirmation.ts @@ -84,4 +84,13 @@ export class WifiConfirmation extends BasePage implements OnInit { } } + + async backToConfig() { + await this.statusConnection(); + if (!!this.activeNavigation) { + await this.viewCtrl.dismiss() + } else { + await this.alertConnectionDisabled(); + } + } } diff --git a/src/src/theme/base-content.scss b/src/src/theme/base-content.scss index 9f700a25..3379a714 100644 --- a/src/src/theme/base-content.scss +++ b/src/src/theme/base-content.scss @@ -83,11 +83,9 @@ ion-content { } .content-info { - height: calc(50% - 20px); + padding-top: 0 !important; .info-text { - height: 100%; - padding-top: 10%; .copy { font-family: Helvetica, sans-serif; From e22fe588b9158e7f33abb81493ec4b1a8290b8c5 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Thu, 24 Sep 2020 12:54:15 +0200 Subject: [PATCH 07/20] Fix styles --- src/src/pages/errors/errors.scss | 6 +++++- src/src/theme/base-content.scss | 23 ++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/src/pages/errors/errors.scss b/src/src/pages/errors/errors.scss index 2630b325..daab96e0 100644 --- a/src/src/pages/errors/errors.scss +++ b/src/src/pages/errors/errors.scss @@ -38,9 +38,13 @@ and (orientation: portrait) { } } } - +/* +////--------------------------------------------- +//// Specific style to error page on Android Moto G +////--------------------------------------------- @media only screen and (max-device-width: 1940px) { .base-content { height: 87% !important; } } +*/ diff --git a/src/src/theme/base-content.scss b/src/src/theme/base-content.scss index 3379a714..37fa7292 100644 --- a/src/src/theme/base-content.scss +++ b/src/src/theme/base-content.scss @@ -66,8 +66,6 @@ ion-content { .header-content { - // height: 22%; - img { width: 57px; height: 65px; @@ -83,9 +81,11 @@ ion-content { } .content-info { - padding-top: 0 !important; + height: calc(50% - 20px); .info-text { + height: 100%; + padding-top: 10%; .copy { font-family: Helvetica, sans-serif; @@ -209,3 +209,20 @@ ion-app, ion-alert div:last-child { } +////--------------------------------------------- +//// Specific style to error page on Android Moto G +////--------------------------------------------- +@media only screen and (max-device-width: 1940px) { + .base-content { + + .content-info { + height: inherit; + padding-top: 0 !important; + + .info-text { + height: inherit; + padding-top: unset; + } + } + } +} From 5f3c6b10d2f9a449ddbec964222b23b38a16f1dc Mon Sep 17 00:00:00 2001 From: amachadogarcia Date: Fri, 25 Sep 2020 11:21:03 +0200 Subject: [PATCH 08/20] fixed style of android --- src/src/pages/errors/errors.scss | 7 +++---- src/src/pages/welcome/reconfigure.scss | 6 ++++++ .../wifiConfirmation/wifiConfirmation.scss | 6 ++++++ src/src/providers/global/global.ts | 2 +- src/src/theme/base-content.scss | 19 ------------------- 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/src/pages/errors/errors.scss b/src/src/pages/errors/errors.scss index daab96e0..2dc77ebd 100644 --- a/src/src/pages/errors/errors.scss +++ b/src/src/pages/errors/errors.scss @@ -38,13 +38,12 @@ and (orientation: portrait) { } } } -/* + ////--------------------------------------------- //// Specific style to error page on Android Moto G ////--------------------------------------------- @media only screen and (max-device-width: 1940px) { - .base-content { - height: 87% !important; + .content-error { + height: auto !important; } } -*/ diff --git a/src/src/pages/welcome/reconfigure.scss b/src/src/pages/welcome/reconfigure.scss index dfc11bd3..5a466ddd 100644 --- a/src/src/pages/welcome/reconfigure.scss +++ b/src/src/pages/welcome/reconfigure.scss @@ -1,3 +1,9 @@ page-welcome { } + +@media only screen and (max-device-width: 1940px) { + .content-info { + height: auto !important; + } +} \ No newline at end of file diff --git a/src/src/pages/wifiConfirmation/wifiConfirmation.scss b/src/src/pages/wifiConfirmation/wifiConfirmation.scss index 8da10900..473170ca 100644 --- a/src/src/pages/wifiConfirmation/wifiConfirmation.scss +++ b/src/src/pages/wifiConfirmation/wifiConfirmation.scss @@ -5,3 +5,9 @@ page-wifi-confirm{ height: 100% !important } } + +@media only screen and (max-device-width: 1940px) { + .copy, .info-text, .content-info { + padding-top: 0 !important; + } +} \ No newline at end of file diff --git a/src/src/providers/global/global.ts b/src/src/providers/global/global.ts index a88ac44d..b5600986 100644 --- a/src/src/providers/global/global.ts +++ b/src/src/providers/global/global.ts @@ -41,7 +41,7 @@ export class GlobalProvider { * SSID network */ getSsid() { - return this.ssid; + return !!this.ssid ? this.ssid : 'eduroam'; } setSsid(value: string) { diff --git a/src/src/theme/base-content.scss b/src/src/theme/base-content.scss index 37fa7292..5a6da73d 100644 --- a/src/src/theme/base-content.scss +++ b/src/src/theme/base-content.scss @@ -207,22 +207,3 @@ ion-app, ion-alert div:last-child { .nav-decor { display: none !important; } - - -////--------------------------------------------- -//// Specific style to error page on Android Moto G -////--------------------------------------------- -@media only screen and (max-device-width: 1940px) { - .base-content { - - .content-info { - height: inherit; - padding-top: 0 !important; - - .info-text { - height: inherit; - padding-top: unset; - } - } - } -} From 5467a9db181aa6cf481e6e159744bff75ecd1469 Mon Sep 17 00:00:00 2001 From: amachadogarcia Date: Fri, 25 Sep 2020 17:30:16 +0200 Subject: [PATCH 09/20] Fixed init flow to version less than api 29 --- src/src/app/app.component.ts | 117 ++++++++++++++----------------- src/src/pages/errors/errors.html | 2 +- src/src/pages/errors/errors.ts | 5 +- 3 files changed, 57 insertions(+), 67 deletions(-) diff --git a/src/src/app/app.component.ts b/src/src/app/app.component.ts index ced539da..42e5da0f 100644 --- a/src/src/app/app.component.ts +++ b/src/src/app/app.component.ts @@ -1,4 +1,4 @@ -import {Config, Events, Platform} from 'ionic-angular'; +import {Config, Events, ModalController, Platform} from 'ionic-angular'; import {Component} from '@angular/core'; import { ReconfigurePage } from '../pages/welcome/reconfigure'; import { ProfilePage } from '../pages/profile/profile'; @@ -14,11 +14,10 @@ import {DictionaryServiceProvider} from "../providers/dictionary-service/diction import {NetworkStatus} from "@capacitor/core/dist/esm/core-plugin-definitions"; import {ConfigFilePage} from "../pages/configFile/configFile"; import {GeteduroamServices} from "../providers/geteduroam-services/geteduroam-services"; - -const { Toast, Network, App } = Plugins; +import {ErrorsPage} from "../pages/errors/errors"; +const { Toast, Network, App, Device } = Plugins; declare var Capacitor; const { WifiEapConfigurator } = Capacitor.Plugins; - @Component({ templateUrl: 'app.html' }) @@ -29,23 +28,19 @@ const { WifiEapConfigurator } = Capacitor.Plugins; * **/ export class GeteduroamApp { - rootPage; - rootParams = {}; - profile: ProfileModel; - + versionAndroid: boolean = false; protected checkExtFile: boolean = false; /** * @constructor * */ - constructor(private platform: Platform, private config: Config, + constructor(private platform: Platform, private config: Config, private modalCtrl: ModalController, private screenOrientation: ScreenOrientation, public errorHandler: ErrorHandlerProvider, private networkInterface: NetworkInterface, private global: GlobalProvider, private dictionary: DictionaryServiceProvider, public event: Events, private getEduroamServices: GeteduroamServices) { - this.platform.ready().then(async () => { // Transition provider, to navigate between pages this.config.setTransition('transition', Transition); @@ -68,26 +63,22 @@ export class GeteduroamApp { * This method check if network is associated and flow to initialize app */ async associatedNetwork() { - - if (this.platform.is('android')) { - this.enableWifi(); - } if (!this.checkExtFile) { const isAssociated = await this.isAssociatedNetwork(); - - if (!!isAssociated.success) { - // this.rootPage = !!isAssociated.success ? ConfigurationScreen : ReconfigurePage; - this.rootPage = ConfigurationScreen; - } else{ - if (!isAssociated.message.includes('alreadyAssociated')) { - this.rootPage = ConfigurationScreen; - } else { + if (!isAssociated.success) { + if (!!isAssociated.overridable) { this.rootPage = ReconfigurePage; this.getAssociation(isAssociated); this.global.setOverrideProfile(true); - - !isAssociated.success && !isAssociated.overridable ? this.removeAssociatedManually() : ''; + } else { + this.versionAndroid = true; + this.removeAssociatedManually(); } + //this.rootPage = !!isAssociated.overridable ? ConfigurationScreen : ReconfigurePage; + } else{ + this.rootPage = ConfigurationScreen; + // this.getAssociation(isAssociated); + // this.global.setOverrideProfile(true); } } } @@ -104,24 +95,29 @@ export class GeteduroamApp { */ async removeAssociatedManually() { let connect = await this.statusConnection(); - - if (connect.connected) { - + if (!!this.versionAndroid) { + let errorModal = this.modalCtrl.create(ErrorsPage, { + error: this.dictionary.getTranslation('error', 'available1') + + this.global.getSsid() + this.dictionary.getTranslation('error', 'available2') + + this.global.getSsid() + '.', isFinal: false, link: '', method: 'removeConnection' + }); + errorModal.onDidDismiss(() => { + this.rootPage = ConfigurationScreen; + }); + await errorModal.present(); + } else if (connect.connected) { await this.errorHandler.handleError( - this.dictionary.getTranslation('error', 'available1') + this.global.getSsid() + - this.dictionary.getTranslation('error', 'available2') + - this.global.getSsid() + '.', false, '', 'removeConnection', true); - + this.dictionary.getTranslation('error', 'available1') + this.global.getSsid() + + this.dictionary.getTranslation('error', 'available2') + + this.global.getSsid() + '.', false, '', 'removeConnection', true); } else { - - await this.errorHandler.handleError( - this.dictionary.getTranslation('error', 'available1') + - this.global.getSsid() + this.dictionary.getTranslation('error', 'available2') + - this.global.getSsid() + '.\n' + this.dictionary.getTranslation('error', 'turn-on') + - this.global.getSsid() + '.', false, '', 'enableAccess', false); + await this.errorHandler.handleError( + this.dictionary.getTranslation('error', 'available1') + + this.global.getSsid() + this.dictionary.getTranslation('error', 'available2') + + this.global.getSsid() + '.\n' + this.dictionary.getTranslation('error', 'turn-on') + + this.global.getSsid() + '.', false, '', 'enableAccess', false); } } - /** * This method add listeners needed to app */ @@ -131,20 +127,16 @@ export class GeteduroamApp { let connectionStatus: NetworkStatus = await this.statusConnection(); if (!this.checkExtFile) { this.connectionEvent(connectionStatus); - !connectionStatus.connected ? - this.alertConnection(this.dictionary.getTranslation('error', 'turn-on') + - this.global.getSsid() + '.') : - this.alertConnection(this.dictionary.getTranslation('text', 'network-available')); + this.alertConnection(this.dictionary.getTranslation('error', 'turn-on') + + this.global.getSsid() + '.') : + this.alertConnection(this.dictionary.getTranslation('text', 'network-available')); } }); - App.addListener('backButton', () => { this.platform.backButton.observers.pop(); - }); } - /** * This method open ProfilePage when the app is initialize from an eap-config file * @param uri @@ -163,7 +155,6 @@ export class GeteduroamApp { this.rootPage = !!this.profile.oauth ? ConfigFilePage : ProfilePage; } } - getAssociation(isAssociated) { if (!!this.platform.is('android')) { this.rootParams = !isAssociated.success && !!isAssociated.overridable ? {'reconfigure': true} : {'reconfigure': false}; @@ -176,22 +167,16 @@ export class GeteduroamApp { */ async notConnectionNetwork() { if (!this.checkExtFile) { - this.rootPage = ReconfigurePage; - const isAssociated = await this.isAssociatedNetwork(); this.getAssociation(isAssociated); - - if (!isAssociated.success && !isAssociated.overridable) { this.removeAssociatedManually(); - } else { await this.errorHandler.handleError(this.dictionary.getTranslation('error', 'turn-on') + - this.global.getSsid() + '.', false, '', 'enableAccess', true); + this.global.getSsid() + '.', false, '', 'enableAccess', true); } } } - /** * This method call to the plugin and return if network if just associated * @@ -199,7 +184,6 @@ export class GeteduroamApp { async isAssociatedNetwork() { return await WifiEapConfigurator.isNetworkAssociated({'ssid': 'eduroam'}); } - /** * This method check connection to initialized app * and show Toast message @@ -208,13 +192,21 @@ export class GeteduroamApp { let connectionStatus = await this.statusConnection(); if (!this.checkExtFile) { this.connectionEvent(connectionStatus); - - if (!connectionStatus.connected){ - this.notConnectionNetwork(); + if (!connectionStatus.connected) { + if (this.platform.is('android')) { + await this.enableWifi(); + const connected = await this.statusConnection(); + const info = await Device.getInfo(); + if (!connected.connected && parseInt(info.osVersion) < 10) { + await this.errorHandler.handleError(this.dictionary.getTranslation('error', 'turn-on') + + this.global.getSsid() + '.', false, '', 'enableAccess', true); + } + } else { + this.notConnectionNetwork(); + } } } } - /** * This method enable wifi on Android devices. * @@ -222,23 +214,20 @@ export class GeteduroamApp { async enableWifi() { await WifiEapConfigurator.enableWifi(); } - /** * This method throw an event to disabled button when network is disconnected. * @param connectionStatus */ protected connectionEvent(connectionStatus: NetworkStatus){ connectionStatus.connected ? this.event.publish('connection', 'connected') : - this.event.publish('connection', 'disconnected'); + this.event.publish('connection', 'disconnected'); } - /** * This method check status of connection */ private async statusConnection(): Promise { return await Network.getStatus() } - /** * This method show a toast message * @param text @@ -249,7 +238,6 @@ export class GeteduroamApp { duration: 'long' }) } - /** * This method sets the global dictionary * Default: 'en' @@ -257,5 +245,4 @@ export class GeteduroamApp { private setDictionary(){ this.dictionary.loadDictionary('en'); } -} - +} \ No newline at end of file diff --git a/src/src/pages/errors/errors.html b/src/src/pages/errors/errors.html index e85859d3..afc559b4 100644 --- a/src/src/pages/errors/errors.html +++ b/src/src/pages/errors/errors.html @@ -30,7 +30,7 @@

{{getString('header', 'error')}}

diff --git a/src/src/pages/errors/errors.ts b/src/src/pages/errors/errors.ts index dfb0080b..20a1bb1e 100644 --- a/src/src/pages/errors/errors.ts +++ b/src/src/pages/errors/errors.ts @@ -75,7 +75,10 @@ export class ErrorsPage extends BasePage{ * This method close error page on modal screen. */ async closeModal() { - if (await this.errorService.checkAgain(this.checkMethod, this.isFinal)) { + if (this.checkMethod === 'enableAccess' && !this.isFinal || + this.checkMethod === 'removeConnection' && !this.isFinal) { + await this.viewCtrl.dismiss(); + } else if (await this.errorService.checkAgain(this.checkMethod, this.isFinal)) { await this.viewCtrl.dismiss(); } else { this.showToast(this.text); From f7f51ec4aac417b28f1d450e2892907f318f3a5b Mon Sep 17 00:00:00 2001 From: amachadogarcia Date: Mon, 28 Sep 2020 08:27:22 +0200 Subject: [PATCH 10/20] Fixing button of errorPage --- .../emergya/wifieapconfigurator/WifiEapConfigurator.java | 3 ++- src/src/pages/errors/errors.html | 3 +-- src/src/pages/errors/errors.ts | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/wifi-eap-configurator/android/src/main/java/com/emergya/wifieapconfigurator/WifiEapConfigurator.java b/src/plugins/wifi-eap-configurator/android/src/main/java/com/emergya/wifieapconfigurator/WifiEapConfigurator.java index 4666adf7..6f2986c9 100644 --- a/src/plugins/wifi-eap-configurator/android/src/main/java/com/emergya/wifieapconfigurator/WifiEapConfigurator.java +++ b/src/plugins/wifi-eap-configurator/android/src/main/java/com/emergya/wifieapconfigurator/WifiEapConfigurator.java @@ -700,7 +700,8 @@ private boolean getNetworkAssociated(PluginCall call, String ssid) { return res; } - boolean checkEnabledWifi(PluginCall call) { + @PluginMethod + public boolean checkEnabledWifi(PluginCall call) { boolean res = true; WifiManager wifi = (WifiManager) getContext().getApplicationContext().getSystemService(Context.WIFI_SERVICE); diff --git a/src/src/pages/errors/errors.html b/src/src/pages/errors/errors.html index afc559b4..85ade477 100644 --- a/src/src/pages/errors/errors.html +++ b/src/src/pages/errors/errors.html @@ -30,10 +30,9 @@

{{getString('header', 'error')}}

-
diff --git a/src/src/pages/errors/errors.ts b/src/src/pages/errors/errors.ts index 20a1bb1e..812e91be 100644 --- a/src/src/pages/errors/errors.ts +++ b/src/src/pages/errors/errors.ts @@ -7,7 +7,9 @@ import {LoadingProvider} from "../../providers/loading/loading"; import {DictionaryServiceProvider} from "../../providers/dictionary-service/dictionary-service-provider.service"; import {GlobalProvider} from "../../providers/global/global"; import {ErrorServiceProvider} from "../../providers/error-service/error-service"; -const {Browser} = Plugins; +const {Browser, Network} = Plugins; +declare var Capacitor; +const { WifiEapConfigurator } = Capacitor.Plugins; @Component({ @@ -119,4 +121,8 @@ export class ErrorsPage extends BasePage{ isLinkEmail(): boolean { return this.validator.validateEmail(this.link); } + + async checkWifi(): Promise { + return await WifiEapConfigurator.checkEnabledWifi(); + } } From 8fb038360cd4673cfc6785aadb2a3527d527e78b Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Mon, 28 Sep 2020 14:31:26 +0200 Subject: [PATCH 11/20] Event connection on Error Page --- src/src/app/app.component.ts | 15 ++++++++++----- src/src/pages/errors/errors.html | 2 +- src/src/pages/errors/errors.ts | 25 ++++++++++++++++++------- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/src/app/app.component.ts b/src/src/app/app.component.ts index 42e5da0f..ffc92099 100644 --- a/src/src/app/app.component.ts +++ b/src/src/app/app.component.ts @@ -1,5 +1,5 @@ import {Config, Events, ModalController, Platform} from 'ionic-angular'; -import {Component} from '@angular/core'; +import { Component } from '@angular/core'; import { ReconfigurePage } from '../pages/welcome/reconfigure'; import { ProfilePage } from '../pages/profile/profile'; import { ConfigurationScreen } from '../pages/configScreen/configScreen'; @@ -18,6 +18,8 @@ import {ErrorsPage} from "../pages/errors/errors"; const { Toast, Network, App, Device } = Plugins; declare var Capacitor; const { WifiEapConfigurator } = Capacitor.Plugins; + + @Component({ templateUrl: 'app.html' }) @@ -65,7 +67,8 @@ export class GeteduroamApp { async associatedNetwork() { if (!this.checkExtFile) { const isAssociated = await this.isAssociatedNetwork(); - if (!isAssociated.success) { + if (!!this.platform.is('android') && !isAssociated.success || + !!this.platform.is('ios') && !!isAssociated.success) { if (!!isAssociated.overridable) { this.rootPage = ReconfigurePage; this.getAssociation(isAssociated); @@ -125,6 +128,7 @@ export class GeteduroamApp { // Listening to changes in network states, it show toast message when status changed Network.addListener('networkStatusChange', async () => { let connectionStatus: NetworkStatus = await this.statusConnection(); + if (!this.checkExtFile) { this.connectionEvent(connectionStatus); !connectionStatus.connected ? @@ -133,6 +137,7 @@ export class GeteduroamApp { this.alertConnection(this.dictionary.getTranslation('text', 'network-available')); } }); + App.addListener('backButton', () => { this.platform.backButton.observers.pop(); }); @@ -218,10 +223,10 @@ export class GeteduroamApp { * This method throw an event to disabled button when network is disconnected. * @param connectionStatus */ - protected connectionEvent(connectionStatus: NetworkStatus){ + protected connectionEvent(connectionStatus: NetworkStatus) { connectionStatus.connected ? this.event.publish('connection', 'connected') : this.event.publish('connection', 'disconnected'); - } + }; /** * This method check status of connection */ @@ -245,4 +250,4 @@ export class GeteduroamApp { private setDictionary(){ this.dictionary.loadDictionary('en'); } -} \ No newline at end of file +} diff --git a/src/src/pages/errors/errors.html b/src/src/pages/errors/errors.html index 85ade477..8c8333fb 100644 --- a/src/src/pages/errors/errors.html +++ b/src/src/pages/errors/errors.html @@ -30,7 +30,7 @@

{{getString('header', 'error')}}

diff --git a/src/src/pages/errors/errors.ts b/src/src/pages/errors/errors.ts index 812e91be..426b90de 100644 --- a/src/src/pages/errors/errors.ts +++ b/src/src/pages/errors/errors.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, NgZone } from '@angular/core'; import {Events, NavParams, Platform, ViewController} from "ionic-angular"; import {Plugins} from "@capacitor/core"; import {ValidatorProvider} from "../../providers/validator/validator"; @@ -7,9 +7,7 @@ import {LoadingProvider} from "../../providers/loading/loading"; import {DictionaryServiceProvider} from "../../providers/dictionary-service/dictionary-service-provider.service"; import {GlobalProvider} from "../../providers/global/global"; import {ErrorServiceProvider} from "../../providers/error-service/error-service"; -const {Browser, Network} = Plugins; -declare var Capacitor; -const { WifiEapConfigurator } = Capacitor.Plugins; +const {Browser, Network } = Plugins; @Component({ @@ -34,6 +32,8 @@ export class ErrorsPage extends BasePage{ */ checkMethod : string; + enabledButton: boolean; + /** * It checks if the error page have permission * to continue navigate or finish app @@ -41,11 +41,13 @@ export class ErrorsPage extends BasePage{ public isFinal: boolean = false; - constructor(private platform: Platform, private navParams: NavParams, private viewCtrl: ViewController, + constructor(private platform: Platform, private navParams: NavParams, private viewCtrl: ViewController, private ngZone: NgZone, private validator: ValidatorProvider, protected loading: LoadingProvider, protected dictionary: DictionaryServiceProvider, protected event: Events, protected global: GlobalProvider, private errorService: ErrorServiceProvider) { super(loading, dictionary, event, global); + this.checkConnection(); + if (!!this.navParams.get('isFinal')) { this.link = this.navParams.get('link'); @@ -58,6 +60,13 @@ export class ErrorsPage extends BasePage{ this.isFinal = false; this.checkMethod = this.navParams.get('method'); } + + this.event.subscribe('connection', (data) => { + this.ngZone.run(() => { + this.enabledButton = data == 'connected'; + }); + + }); } /** @@ -122,7 +131,9 @@ export class ErrorsPage extends BasePage{ return this.validator.validateEmail(this.link); } - async checkWifi(): Promise { - return await WifiEapConfigurator.checkEnabledWifi(); + async checkConnection(){ + let connect = await Network.getStatus(); + this.enabledButton = connect.connected; + } } From def13c8116090cc3601f312913601fd64166d16e Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Fri, 2 Oct 2020 08:34:57 +0200 Subject: [PATCH 12/20] Preload Discovery after initialized the app --- src/src/app/app.component.ts | 85 +++++----------------- src/src/pages/configScreen/configScreen.ts | 2 +- src/src/providers/global/global.ts | 11 +++ 3 files changed, 32 insertions(+), 66 deletions(-) diff --git a/src/src/app/app.component.ts b/src/src/app/app.component.ts index ffc92099..b02d4604 100644 --- a/src/src/app/app.component.ts +++ b/src/src/app/app.component.ts @@ -1,6 +1,5 @@ import {Config, Events, ModalController, Platform} from 'ionic-angular'; import { Component } from '@angular/core'; -import { ReconfigurePage } from '../pages/welcome/reconfigure'; import { ProfilePage } from '../pages/profile/profile'; import { ConfigurationScreen } from '../pages/configScreen/configScreen'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; @@ -66,23 +65,9 @@ export class GeteduroamApp { */ async associatedNetwork() { if (!this.checkExtFile) { - const isAssociated = await this.isAssociatedNetwork(); - if (!!this.platform.is('android') && !isAssociated.success || - !!this.platform.is('ios') && !!isAssociated.success) { - if (!!isAssociated.overridable) { - this.rootPage = ReconfigurePage; - this.getAssociation(isAssociated); - this.global.setOverrideProfile(true); - } else { - this.versionAndroid = true; - this.removeAssociatedManually(); - } - //this.rootPage = !!isAssociated.overridable ? ConfigurationScreen : ReconfigurePage; - } else{ - this.rootPage = ConfigurationScreen; - // this.getAssociation(isAssociated); - // this.global.setOverrideProfile(true); - } + this.rootPage = ConfigurationScreen; + const list = this.getEduroamServices.discovery(); + this.global.setDiscovery(list); } } async checkExternalOpen() { @@ -101,8 +86,8 @@ export class GeteduroamApp { if (!!this.versionAndroid) { let errorModal = this.modalCtrl.create(ErrorsPage, { error: this.dictionary.getTranslation('error', 'available1') + - this.global.getSsid() + this.dictionary.getTranslation('error', 'available2') + - this.global.getSsid() + '.', isFinal: false, link: '', method: 'removeConnection' + this.global.getSsid() + this.dictionary.getTranslation('error', 'available2') + + this.global.getSsid() + '.', isFinal: false, link: '', method: 'removeConnection' }); errorModal.onDidDismiss(() => { this.rootPage = ConfigurationScreen; @@ -110,15 +95,15 @@ export class GeteduroamApp { await errorModal.present(); } else if (connect.connected) { await this.errorHandler.handleError( - this.dictionary.getTranslation('error', 'available1') + this.global.getSsid() + - this.dictionary.getTranslation('error', 'available2') + - this.global.getSsid() + '.', false, '', 'removeConnection', true); + this.dictionary.getTranslation('error', 'available1') + this.global.getSsid() + + this.dictionary.getTranslation('error', 'available2') + + this.global.getSsid() + '.', false, '', 'removeConnection', true); } else { - await this.errorHandler.handleError( - this.dictionary.getTranslation('error', 'available1') + - this.global.getSsid() + this.dictionary.getTranslation('error', 'available2') + - this.global.getSsid() + '.\n' + this.dictionary.getTranslation('error', 'turn-on') + - this.global.getSsid() + '.', false, '', 'enableAccess', false); + await this.errorHandler.handleError( + this.dictionary.getTranslation('error', 'available1') + + this.global.getSsid() + this.dictionary.getTranslation('error', 'available2') + + this.global.getSsid() + '.\n' + this.dictionary.getTranslation('error', 'turn-on') + + this.global.getSsid() + '.', false, '', 'enableAccess', false); } } /** @@ -132,9 +117,9 @@ export class GeteduroamApp { if (!this.checkExtFile) { this.connectionEvent(connectionStatus); !connectionStatus.connected ? - this.alertConnection(this.dictionary.getTranslation('error', 'turn-on') + - this.global.getSsid() + '.') : - this.alertConnection(this.dictionary.getTranslation('text', 'network-available')); + this.alertConnection(this.dictionary.getTranslation('error', 'turn-on') + + this.global.getSsid() + '.') : + this.alertConnection(this.dictionary.getTranslation('text', 'network-available')); } }); @@ -167,28 +152,7 @@ export class GeteduroamApp { this.rootParams = isAssociated.message.includes('noNetworksFound') ? {'reconfigure': false} : {'reconfigure': true} ; } } - /** - * This method shown an error message when network is disconnect - */ - async notConnectionNetwork() { - if (!this.checkExtFile) { - const isAssociated = await this.isAssociatedNetwork(); - this.getAssociation(isAssociated); - if (!isAssociated.success && !isAssociated.overridable) { - this.removeAssociatedManually(); - } else { - await this.errorHandler.handleError(this.dictionary.getTranslation('error', 'turn-on') + - this.global.getSsid() + '.', false, '', 'enableAccess', true); - } - } - } - /** - * This method call to the plugin and return if network if just associated - * - */ - async isAssociatedNetwork() { - return await WifiEapConfigurator.isNetworkAssociated({'ssid': 'eduroam'}); - } + /** * This method check connection to initialized app * and show Toast message @@ -198,17 +162,8 @@ export class GeteduroamApp { if (!this.checkExtFile) { this.connectionEvent(connectionStatus); if (!connectionStatus.connected) { - if (this.platform.is('android')) { - await this.enableWifi(); - const connected = await this.statusConnection(); - const info = await Device.getInfo(); - if (!connected.connected && parseInt(info.osVersion) < 10) { - await this.errorHandler.handleError(this.dictionary.getTranslation('error', 'turn-on') + - this.global.getSsid() + '.', false, '', 'enableAccess', true); - } - } else { - this.notConnectionNetwork(); - } + await this.errorHandler.handleError(this.dictionary.getTranslation('error', 'turn-on') + + this.global.getSsid() + '.', false, '', 'enableAccess', true); } } } @@ -225,7 +180,7 @@ export class GeteduroamApp { */ protected connectionEvent(connectionStatus: NetworkStatus) { connectionStatus.connected ? this.event.publish('connection', 'connected') : - this.event.publish('connection', 'disconnected'); + this.event.publish('connection', 'disconnected'); }; /** * This method check status of connection diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index 635e1ba6..0ada95aa 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -209,7 +209,7 @@ export class ConfigurationScreen extends BasePage{ * Load the discovery data and show the spinner */ async ionViewWillEnter() { - const firstResponse = await this.getEduroamServices.discovery(); + const firstResponse = await this.global.getDiscovery(); this.instances = await this.waitingSpinner(firstResponse); this.removeSpinner(); } diff --git a/src/src/providers/global/global.ts b/src/src/providers/global/global.ts index b5600986..56a61fe8 100644 --- a/src/src/providers/global/global.ts +++ b/src/src/providers/global/global.ts @@ -31,10 +31,13 @@ export class GlobalProvider { private clientId : string = 'f817fbcc-e8f4-459e-af75-0822d86ff47a'; + private overrideProfile: boolean = false; private externalOpen: boolean = false; + discovery: any; + constructor(public platform: Platform) {} /** @@ -128,4 +131,12 @@ export class GlobalProvider { getExternalOpen() { return this.externalOpen; } + + getDiscovery() { + return this.discovery; + } + + setDiscovery(list: any) { + this.discovery = list; + } } From fb43cc1349a059fbcb042169ee9c6494cbab9916 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Fri, 2 Oct 2020 08:35:16 +0200 Subject: [PATCH 13/20] Preload Discovery after initialized the app --- src/plugins/wifi-eap-configurator/ios/Plugin/Plugin.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/wifi-eap-configurator/ios/Plugin/Plugin.swift b/src/plugins/wifi-eap-configurator/ios/Plugin/Plugin.swift index b1a06876..2a963527 100644 --- a/src/plugins/wifi-eap-configurator/ios/Plugin/Plugin.swift +++ b/src/plugins/wifi-eap-configurator/ios/Plugin/Plugin.swift @@ -236,14 +236,14 @@ public class WifiEapConfigurator: CAPPlugin { NEHotspotConfigurationManager.shared.apply(config) { (error) in if let error = error { - if error.code == NEHotspotConfigurationError.alreadyAssociated /* 13 */ { + if error.code == NEHotspotConfigurationError.alreadyAssociated.rawValue /* 13 */ { call.success([ "message": "plugin.wifieapconfigurator.error.network.alreadyAssociated", "success": false, ]) } - if error.code == NEHotspotConfigurationError.userDenied /* 7 */ { + if error.code == NEHotspotConfigurationError.userDenied.rawValue /* 7 */ { call.success([ "message": "plugin.wifieapconfigurator.error.network.userCancelled", "success": false, From f7b7fe8db88215fb35b368b5874bfb620800302b Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Wed, 14 Oct 2020 10:48:13 +0200 Subject: [PATCH 14/20] Create module to modal controller --- src/src/pages/configScreen/configScreen.ts | 13 ++++++++----- src/src/pages/errors/errors.ts | 2 +- .../pages/institutionSearch/institutionSearch.ts | 7 ++++++- src/src/providers/util/modal.module | 12 ++++++++++++ 4 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 src/src/providers/util/modal.module diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index 85fc97cd..5a9c4bb9 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -1,4 +1,4 @@ -import { Component, NgZone } from '@angular/core'; +import { Component, NgModule, NgZone } from '@angular/core'; import {Events, ModalController, NavController} from 'ionic-angular'; import {GeteduroamServices} from "../../providers/geteduroam-services/geteduroam-services"; import { ProfilePage } from '../profile/profile'; @@ -12,6 +12,7 @@ import {GlobalProvider} from "../../providers/global/global"; import {ProfileModel} from "../../shared/models/profile-model"; import {ErrorHandlerProvider} from "../../providers/error-handler/error-handler"; import {ConfigFilePage} from "../configFile/configFile"; +import { CommonModule } from '@angular/common'; const { Keyboard, App } = Plugins; declare var window; @@ -20,7 +21,6 @@ declare var window; selector: 'page-config-screen', templateUrl: 'configScreen.html', }) - export class ConfigurationScreen extends BasePage{ showAll: boolean = false; @@ -95,13 +95,13 @@ export class ConfigurationScreen extends BasePage{ * Method executes when the search bar is tapped. * */ async showModal(e: any) { + Keyboard.hide(); e.preventDefault(); - await Keyboard.hide(); if (!!this.instances) { let searchModal = this.modalCtrl.create(InstitutionSearch, { instances: this.instances, - instanceName: this.instanceName} - ); + instanceName: this.instanceName + }); searchModal.onDidDismiss((data) => { @@ -226,6 +226,9 @@ export class ConfigurationScreen extends BasePage{ this.resetValues(); } + ionViewWillEnter() { + this.loading.create(); + } /** * Lifecycle when entering a page, before it becomes the active one * Load the discovery data and show the spinner diff --git a/src/src/pages/errors/errors.ts b/src/src/pages/errors/errors.ts index 993563c4..971456ea 100644 --- a/src/src/pages/errors/errors.ts +++ b/src/src/pages/errors/errors.ts @@ -75,7 +75,7 @@ export class ErrorsPage extends BasePage{ * This method close error page on modal screen. */ async closeModal() { - if (await this.errorService.checkAgain(this.checkMethod, this.isFinal)) { + if (await this.errorService.checkAgain(this.checkMethod, this.isFinal) || this.checkMethod === 'enableAccess') { await this.viewCtrl.dismiss(); } else { this.showToast(this.text); diff --git a/src/src/pages/institutionSearch/institutionSearch.ts b/src/src/pages/institutionSearch/institutionSearch.ts index b37e709e..5c0ecfb6 100644 --- a/src/src/pages/institutionSearch/institutionSearch.ts +++ b/src/src/pages/institutionSearch/institutionSearch.ts @@ -7,6 +7,7 @@ import {DictionaryServiceProvider} from "../../providers/dictionary-service/dict import {GlobalProvider} from "../../providers/global/global"; const { Keyboard } = Plugins; + @Component({ selector: 'page-institution-search', templateUrl: 'institutionSearch.html', @@ -131,13 +132,17 @@ export class InstitutionSearch extends BasePage{ this.selectedProfileId = ''; } + + ionViewWillEnter() { + this.ios = !!this.platform.is('ios'); + } /** * Lifecycle when entering a page, after it becomes the active page. * this sets focus on search bar */ ionViewDidEnter() { - this.platform.is('ios') ? this.ios = true : this.ios = false ; this.instances = this.navParams.get('instances'); + this.filteredInstances = this.instances; this.instanceName = this.navParams.get('instanceName'); this.filterInstances(this.instanceName); diff --git a/src/src/providers/util/modal.module b/src/src/providers/util/modal.module new file mode 100644 index 00000000..b045867f --- /dev/null +++ b/src/src/providers/util/modal.module @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import { InstitutionSearch } from '../../pages/institutionSearch/institutionSearch'; +import { CommonModule } from '@angular/common'; + +@NgModule({ + entryComponents: [InstitutionSearch], + declarations: [InstitutionSearch], + imports: [CommonModule] +}) + +// TODO: CREATE MODULE TO OPEN MODAL THROWS THEM +export class ModalModule {} From 0364e04e53b2a14ce014448ecda94320d6ef7799 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Mon, 19 Oct 2020 17:07:01 +0200 Subject: [PATCH 15/20] Implement ngOnInit to charge InstitutionSearch component --- src/src/app/app.component.ts | 1 - src/src/pages/configScreen/configScreen.ts | 3 +-- src/src/pages/institutionSearch/institutionSearch.ts | 7 +++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/src/app/app.component.ts b/src/src/app/app.component.ts index 59813d44..e67cd2d7 100644 --- a/src/src/app/app.component.ts +++ b/src/src/app/app.component.ts @@ -233,7 +233,6 @@ export class GeteduroamApp { if (!this.checkExtFile) { this.connectionEvent(connectionStatus); this.global.setDiscovery(await this.getEduroamServices.discovery()); - if (!connectionStatus.connected){ this.notConnectionNetwork(); } diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index 5a9c4bb9..be3e69a9 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -95,11 +95,10 @@ export class ConfigurationScreen extends BasePage{ * Method executes when the search bar is tapped. * */ async showModal(e: any) { - Keyboard.hide(); + await Keyboard.hide(); e.preventDefault(); if (!!this.instances) { let searchModal = this.modalCtrl.create(InstitutionSearch, { - instances: this.instances, instanceName: this.instanceName }); diff --git a/src/src/pages/institutionSearch/institutionSearch.ts b/src/src/pages/institutionSearch/institutionSearch.ts index c3d7702e..7025285c 100644 --- a/src/src/pages/institutionSearch/institutionSearch.ts +++ b/src/src/pages/institutionSearch/institutionSearch.ts @@ -131,7 +131,7 @@ export class InstitutionSearch extends BasePage{ this.selectedProfileId = ''; } - ionViewWillEnter() { + ngOnInit() { this.instances = Object.values(this.global.getDiscovery()); this.filteredInstances = Object.values(this.instances); } @@ -139,10 +139,13 @@ export class InstitutionSearch extends BasePage{ * Lifecycle when entering a page, after it becomes the active page. * this sets focus on search bar */ - ionViewDidEnter() { + ionViewWillEnter() { this.ios = !!this.platform.is('ios'); this.instanceName = this.navParams.get('instanceName'); + + } + ionViewDidEnter() { setTimeout(() => { this.searchBar.setFocus() }, 10); From ac8a06789ebc1945fe07b235618c51b2b19b4f89 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Mon, 19 Oct 2020 18:40:12 +0200 Subject: [PATCH 16/20] Charge instutionsNames to global provider --- src/src/app/app.module.ts | 3 ++- src/src/pages/configScreen/configScreen.ts | 7 ++++++- src/src/pages/institutionSearch/institutionSearch.html | 2 +- src/src/pages/institutionSearch/institutionSearch.ts | 4 ++-- src/src/providers/global/global.ts | 10 ++++++++++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/src/app/app.module.ts b/src/src/app/app.module.ts index eabaee1d..44dc1ebd 100644 --- a/src/src/app/app.module.ts +++ b/src/src/app/app.module.ts @@ -19,6 +19,7 @@ import { GlobalProvider } from '../providers/global/global'; import { CryptoUtil } from '../providers/util/crypto-util'; import { ErrorServiceProvider } from "../providers/error-service/error-service"; import { OauthConfProvider } from '../providers/oauth-conf/oauth-conf'; +import { InstitutionSearch } from '../pages/institutionSearch/institutionSearch'; @NgModule({ declarations: [ @@ -27,7 +28,7 @@ import { OauthConfProvider } from '../providers/oauth-conf/oauth-conf'; imports: [ BrowserModule, PagesModule, - IonicModule.forRoot(GeteduroamApp) + IonicModule.forRoot(GeteduroamApp, {preload: InstitutionSearch}) ], bootstrap: [IonicApp], entryComponents: [ diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index be3e69a9..40b3568e 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -103,7 +103,12 @@ export class ConfigurationScreen extends BasePage{ }); searchModal.onDidDismiss((data) => { - + this.instances.forEach((res: any) => { + if (res.name === data) { + data = res; + } + }); + // TODO: MACHT NAME if (data !== undefined) { this.instance = data; this.instanceName = data.name; diff --git a/src/src/pages/institutionSearch/institutionSearch.html b/src/src/pages/institutionSearch/institutionSearch.html index 6234c130..4e47ea11 100644 --- a/src/src/pages/institutionSearch/institutionSearch.html +++ b/src/src/pages/institutionSearch/institutionSearch.html @@ -12,6 +12,6 @@ - {{institution.name}} + {{institution}} diff --git a/src/src/pages/institutionSearch/institutionSearch.ts b/src/src/pages/institutionSearch/institutionSearch.ts index 7025285c..731d0e08 100644 --- a/src/src/pages/institutionSearch/institutionSearch.ts +++ b/src/src/pages/institutionSearch/institutionSearch.ts @@ -93,7 +93,7 @@ export class InstitutionSearch extends BasePage{ if (stringAux && stringAux.trim() != '') { this.filteredInstances = this.instances.filter((item:any) => { - return (item.name.toLowerCase().indexOf(stringAux.toLowerCase()) > -1); + return (item.toLowerCase().indexOf(stringAux.toLowerCase()) > -1); }) } else { this.clearInstance(); @@ -132,7 +132,7 @@ export class InstitutionSearch extends BasePage{ } ngOnInit() { - this.instances = Object.values(this.global.getDiscovery()); + this.instances = Object.values(this.global.getInstitutionNames()); this.filteredInstances = Object.values(this.instances); } /** diff --git a/src/src/providers/global/global.ts b/src/src/providers/global/global.ts index d5648527..fb8660b4 100644 --- a/src/src/providers/global/global.ts +++ b/src/src/providers/global/global.ts @@ -36,6 +36,7 @@ export class GlobalProvider { private externalOpen: boolean = false; discovery: any; + institutionNames: string[] = []; constructor(public platform: Platform) {} @@ -133,9 +134,18 @@ export class GlobalProvider { setDiscovery(list: any) { this.discovery = list; + list.forEach((res) => { + if(res.name) { + this.institutionNames.push(res.name); + } + }) } getDiscovery() { return this.discovery; } + + getInstitutionNames() { + return this.institutionNames; + } } From f570f24597a3bebed7184679924fc8fcb8f74968 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Tue, 20 Oct 2020 09:58:39 +0200 Subject: [PATCH 17/20] Remove module modal Control Keyboard --- src/src/pages/configScreen/configScreen.ts | 23 +++++++++++-------- .../institutionSearch/institutionSearch.ts | 1 + src/src/providers/global/global.ts | 2 +- src/src/providers/util/modal.module | 12 ---------- 4 files changed, 15 insertions(+), 23 deletions(-) delete mode 100644 src/src/providers/util/modal.module diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index 40b3568e..b14f53e9 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -12,7 +12,6 @@ import {GlobalProvider} from "../../providers/global/global"; import {ProfileModel} from "../../shared/models/profile-model"; import {ErrorHandlerProvider} from "../../providers/error-handler/error-handler"; import {ConfigFilePage} from "../configFile/configFile"; -import { CommonModule } from '@angular/common'; const { Keyboard, App } = Plugins; declare var window; @@ -89,13 +88,16 @@ export class ConfigurationScreen extends BasePage{ protected dictionary: DictionaryServiceProvider, protected global: GlobalProvider, private errorHandler: ErrorHandlerProvider) { super(loading, dictionary, event, global); + Keyboard.addListener('keyboardWillShow', async () => { + await Keyboard.hide(); + }); } + /** * Method executes when the search bar is tapped. * */ async showModal(e: any) { - await Keyboard.hide(); e.preventDefault(); if (!!this.instances) { let searchModal = this.modalCtrl.create(InstitutionSearch, { @@ -103,15 +105,14 @@ export class ConfigurationScreen extends BasePage{ }); searchModal.onDidDismiss((data) => { - this.instances.forEach((res: any) => { - if (res.name === data) { - data = res; - } + + data = this.instances.filter((res: any) => { + if (res.name === data) return res }); - // TODO: MACHT NAME + if (data !== undefined) { - this.instance = data; - this.instanceName = data.name; + this.instance = data[0]; + this.instanceName = data[0].name; this.initializeProfiles(this.instance); @@ -238,7 +239,9 @@ export class ConfigurationScreen extends BasePage{ * Load the discovery data and show the spinner */ async ionViewDidEnter() { - await this.getDiscovery(); + if (!this.global.getDiscovery()) { + await this.getDiscovery(); + } this.removeSpinner(); this.showAll = true; } diff --git a/src/src/pages/institutionSearch/institutionSearch.ts b/src/src/pages/institutionSearch/institutionSearch.ts index 731d0e08..647d0779 100644 --- a/src/src/pages/institutionSearch/institutionSearch.ts +++ b/src/src/pages/institutionSearch/institutionSearch.ts @@ -58,6 +58,7 @@ export class InstitutionSearch extends BasePage{ protected dictionary: DictionaryServiceProvider, protected event: Events, protected global: GlobalProvider) { super(loading, dictionary, event, global); + Keyboard.removeAllListeners(); } /** diff --git a/src/src/providers/global/global.ts b/src/src/providers/global/global.ts index fb8660b4..152b0591 100644 --- a/src/src/providers/global/global.ts +++ b/src/src/providers/global/global.ts @@ -134,7 +134,7 @@ export class GlobalProvider { setDiscovery(list: any) { this.discovery = list; - list.forEach((res) => { + list.map((res) => { if(res.name) { this.institutionNames.push(res.name); } diff --git a/src/src/providers/util/modal.module b/src/src/providers/util/modal.module deleted file mode 100644 index b045867f..00000000 --- a/src/src/providers/util/modal.module +++ /dev/null @@ -1,12 +0,0 @@ -import { NgModule } from '@angular/core'; -import { InstitutionSearch } from '../../pages/institutionSearch/institutionSearch'; -import { CommonModule } from '@angular/common'; - -@NgModule({ - entryComponents: [InstitutionSearch], - declarations: [InstitutionSearch], - imports: [CommonModule] -}) - -// TODO: CREATE MODULE TO OPEN MODAL THROWS THEM -export class ModalModule {} From 1d8057bb8443d0f391a05b329e4a76038bf5b1ae Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Tue, 20 Oct 2020 15:49:49 +0200 Subject: [PATCH 18/20] Changes on InstitutionSearch Include ReactiveFormsModule --- src/src/app/app.module.ts | 7 ++-- src/src/pages/configScreen/configScreen.html | 3 +- src/src/pages/configScreen/configScreen.ts | 10 +++--- .../institutionSearch/institutionSearch.html | 4 +-- .../institutionSearch/institutionSearch.ts | 36 +++++++++++-------- src/src/providers/global/global.ts | 2 +- 6 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/src/app/app.module.ts b/src/src/app/app.module.ts index 44dc1ebd..b7ee4bd8 100644 --- a/src/src/app/app.module.ts +++ b/src/src/app/app.module.ts @@ -3,7 +3,6 @@ import { BrowserModule } from '@angular/platform-browser'; import { IonicApp, IonicModule } from 'ionic-angular'; import { GeteduroamApp } from './app.component'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; - import { StatusBar } from '@ionic-native/status-bar/ngx'; import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { AndroidPermissions } from '@ionic-native/android-permissions/ngx'; @@ -20,6 +19,7 @@ import { CryptoUtil } from '../providers/util/crypto-util'; import { ErrorServiceProvider } from "../providers/error-service/error-service"; import { OauthConfProvider } from '../providers/oauth-conf/oauth-conf'; import { InstitutionSearch } from '../pages/institutionSearch/institutionSearch'; +import { ReactiveFormsModule } from '@angular/forms'; @NgModule({ declarations: [ @@ -27,8 +27,9 @@ import { InstitutionSearch } from '../pages/institutionSearch/institutionSearch' ], imports: [ BrowserModule, + ReactiveFormsModule, PagesModule, - IonicModule.forRoot(GeteduroamApp, {preload: InstitutionSearch}) + IonicModule.forRoot(GeteduroamApp, { preload: InstitutionSearch }), ], bootstrap: [IonicApp], entryComponents: [ @@ -51,7 +52,7 @@ import { InstitutionSearch } from '../pages/institutionSearch/institutionSearch' OauthConfProvider, ErrorServiceProvider ], - exports:[] + exports:[], }) export class AppModule { diff --git a/src/src/pages/configScreen/configScreen.html b/src/src/pages/configScreen/configScreen.html index cbfb2841..1ed3b74c 100644 --- a/src/src/pages/configScreen/configScreen.html +++ b/src/src/pages/configScreen/configScreen.html @@ -16,7 +16,7 @@

{{getString('header', 'config')}}

- @@ -44,4 +44,3 @@

{{getString('header', 'config')}}

- diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index b14f53e9..b8f63fbc 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -1,5 +1,5 @@ import { Component, NgModule, NgZone } from '@angular/core'; -import {Events, ModalController, NavController} from 'ionic-angular'; +import { Events, Modal, ModalController, NavController, NavParams, ViewController } from 'ionic-angular'; import {GeteduroamServices} from "../../providers/geteduroam-services/geteduroam-services"; import { ProfilePage } from '../profile/profile'; import { OauthFlow } from '../oauthFlow/oauthFlow'; @@ -79,7 +79,6 @@ export class ConfigurationScreen extends BasePage{ */ showButton: boolean = true; - /** * Constructor * */ @@ -115,7 +114,6 @@ export class ConfigurationScreen extends BasePage{ this.instanceName = data[0].name; this.initializeProfiles(this.instance); - } }); @@ -230,7 +228,9 @@ export class ConfigurationScreen extends BasePage{ } this.resetValues(); } - + ngOnInit() { + this.instances = this.global.discovery; + } ionViewWillEnter() { this.loading.create(); } @@ -239,7 +239,7 @@ export class ConfigurationScreen extends BasePage{ * Load the discovery data and show the spinner */ async ionViewDidEnter() { - if (!this.global.getDiscovery()) { + if (!this.instances) { await this.getDiscovery(); } this.removeSpinner(); diff --git a/src/src/pages/institutionSearch/institutionSearch.html b/src/src/pages/institutionSearch/institutionSearch.html index 4e47ea11..5ebc3ec7 100644 --- a/src/src/pages/institutionSearch/institutionSearch.html +++ b/src/src/pages/institutionSearch/institutionSearch.html @@ -11,7 +11,7 @@ - - {{institution}} + +
{{ institution }}
diff --git a/src/src/pages/institutionSearch/institutionSearch.ts b/src/src/pages/institutionSearch/institutionSearch.ts index 647d0779..7619cde7 100644 --- a/src/src/pages/institutionSearch/institutionSearch.ts +++ b/src/src/pages/institutionSearch/institutionSearch.ts @@ -5,6 +5,9 @@ import {BasePage} from "../basePage"; import {LoadingProvider} from "../../providers/loading/loading"; import {DictionaryServiceProvider} from "../../providers/dictionary-service/dictionary-service-provider.service"; import {GlobalProvider} from "../../providers/global/global"; +import { FormControl } from '@angular/forms'; +import { debounceTime } from 'rxjs/operators'; + const { Keyboard } = Plugins; @Component({ @@ -48,6 +51,8 @@ export class InstitutionSearch extends BasePage{ */ ios: boolean = false; + searchControl: FormControl; + /** * Component SearchBar */ @@ -58,7 +63,14 @@ export class InstitutionSearch extends BasePage{ protected dictionary: DictionaryServiceProvider, protected event: Events, protected global: GlobalProvider) { super(loading, dictionary, event, global); + this.searchControl = new FormControl(); Keyboard.removeAllListeners(); + setTimeout(() => { + this.searchBar.setFocus() + }, 10); + if (!this.ios) { + Keyboard.show(); + } } /** @@ -81,9 +93,10 @@ export class InstitutionSearch extends BasePage{ * @param {any} ev event triggered. */ getItems(ev: any) { - const val = ev.target.value; + this.searchControl.valueChanges.pipe(debounceTime(500)).subscribe((res: any) => { + this.filterInstances(res); + }); - this.filterInstances(val); } /** @@ -92,8 +105,7 @@ export class InstitutionSearch extends BasePage{ */ filterInstances(stringAux: string){ if (stringAux && stringAux.trim() != '') { - - this.filteredInstances = this.instances.filter((item:any) => { + this.instances = this.instances.filter((item:any) => { return (item.toLowerCase().indexOf(stringAux.toLowerCase()) > -1); }) } else { @@ -107,7 +119,7 @@ export class InstitutionSearch extends BasePage{ * This method updates the properties [showInstanceItems]{@link #showInstanceItems} and [filteredInstances]{@link #filteredInstances} */ getAllItems(){ - this.filteredInstances = this.instances; + this.instances = Object.values(this.global.getInstitutionNames()); } @@ -134,7 +146,6 @@ export class InstitutionSearch extends BasePage{ ngOnInit() { this.instances = Object.values(this.global.getInstitutionNames()); - this.filteredInstances = Object.values(this.instances); } /** * Lifecycle when entering a page, after it becomes the active page. @@ -144,15 +155,6 @@ export class InstitutionSearch extends BasePage{ this.ios = !!this.platform.is('ios'); this.instanceName = this.navParams.get('instanceName'); - - } - ionViewDidEnter() { - setTimeout(() => { - this.searchBar.setFocus() - }, 10); - if (!this.ios) { - Keyboard.show(); - } } /** @@ -163,4 +165,8 @@ export class InstitutionSearch extends BasePage{ Keyboard.hide(); } + instanceByName(index, instance) { + return instance.name; + } + } diff --git a/src/src/providers/global/global.ts b/src/src/providers/global/global.ts index 44ef578a..26f70fdf 100644 --- a/src/src/providers/global/global.ts +++ b/src/src/providers/global/global.ts @@ -135,7 +135,7 @@ export class GlobalProvider { setDiscovery(list: any) { this.discovery = list; list.map((res) => { - if(res.name) { + if (res.name) { this.institutionNames.push(res.name); } }) From df74ceb3e6f58bbadf31308a3e6837e1d4bfad25 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Tue, 20 Oct 2020 17:36:30 +0200 Subject: [PATCH 19/20] Changes struct to ion-list Include new classes to InstitutionSearch --- .../institutionSearch/institutionSearch.html | 11 ++++-- .../institutionSearch/institutionSearch.scss | 12 +++---- .../institutionSearch/institutionSearch.ts | 34 +++++++------------ 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/src/pages/institutionSearch/institutionSearch.html b/src/src/pages/institutionSearch/institutionSearch.html index 5ebc3ec7..f97a7331 100644 --- a/src/src/pages/institutionSearch/institutionSearch.html +++ b/src/src/pages/institutionSearch/institutionSearch.html @@ -11,7 +11,14 @@ - -
{{ institution }}
+ +
+
+
+
{{ institution }}
+
+
+
+
diff --git a/src/src/pages/institutionSearch/institutionSearch.scss b/src/src/pages/institutionSearch/institutionSearch.scss index d09bd4ee..07995fb5 100644 --- a/src/src/pages/institutionSearch/institutionSearch.scss +++ b/src/src/pages/institutionSearch/institutionSearch.scss @@ -2,11 +2,11 @@ page-institution-search { //--------------------------- // ion-item custom style //--------------------------- - ion-item { - background-color: unset; - div.item-inner { - padding: 0 !important; - border-bottom: 0 !important; - } + .list-institution { + background-color: white; + } + .label-institution { + font-size: 20px; + padding-left: 16px } } diff --git a/src/src/pages/institutionSearch/institutionSearch.ts b/src/src/pages/institutionSearch/institutionSearch.ts index 7619cde7..19135ae8 100644 --- a/src/src/pages/institutionSearch/institutionSearch.ts +++ b/src/src/pages/institutionSearch/institutionSearch.ts @@ -5,9 +5,6 @@ import {BasePage} from "../basePage"; import {LoadingProvider} from "../../providers/loading/loading"; import {DictionaryServiceProvider} from "../../providers/dictionary-service/dictionary-service-provider.service"; import {GlobalProvider} from "../../providers/global/global"; -import { FormControl } from '@angular/forms'; -import { debounceTime } from 'rxjs/operators'; - const { Keyboard } = Plugins; @Component({ @@ -51,8 +48,6 @@ export class InstitutionSearch extends BasePage{ */ ios: boolean = false; - searchControl: FormControl; - /** * Component SearchBar */ @@ -63,14 +58,7 @@ export class InstitutionSearch extends BasePage{ protected dictionary: DictionaryServiceProvider, protected event: Events, protected global: GlobalProvider) { super(loading, dictionary, event, global); - this.searchControl = new FormControl(); Keyboard.removeAllListeners(); - setTimeout(() => { - this.searchBar.setFocus() - }, 10); - if (!this.ios) { - Keyboard.show(); - } } /** @@ -93,10 +81,9 @@ export class InstitutionSearch extends BasePage{ * @param {any} ev event triggered. */ getItems(ev: any) { - this.searchControl.valueChanges.pipe(debounceTime(500)).subscribe((res: any) => { - this.filterInstances(res); - }); + const val = ev.target.value; + this.filterInstances(val); } /** @@ -105,7 +92,7 @@ export class InstitutionSearch extends BasePage{ */ filterInstances(stringAux: string){ if (stringAux && stringAux.trim() != '') { - this.instances = this.instances.filter((item:any) => { + this.filteredInstances = this.instances.filter((item:any) => { return (item.toLowerCase().indexOf(stringAux.toLowerCase()) > -1); }) } else { @@ -119,7 +106,7 @@ export class InstitutionSearch extends BasePage{ * This method updates the properties [showInstanceItems]{@link #showInstanceItems} and [filteredInstances]{@link #filteredInstances} */ getAllItems(){ - this.instances = Object.values(this.global.getInstitutionNames()); + this.filteredInstances = this.instances; } @@ -146,6 +133,7 @@ export class InstitutionSearch extends BasePage{ ngOnInit() { this.instances = Object.values(this.global.getInstitutionNames()); + this.filteredInstances = Object.values(this.instances); } /** * Lifecycle when entering a page, after it becomes the active page. @@ -156,6 +144,14 @@ export class InstitutionSearch extends BasePage{ this.instanceName = this.navParams.get('instanceName'); } + ionViewDidEnter() { + setTimeout(() => { + this.searchBar.setFocus() + }, 10); + if (!this.ios) { + Keyboard.show(); + } + } /** * Lifecycle when you leave a page, @@ -165,8 +161,4 @@ export class InstitutionSearch extends BasePage{ Keyboard.hide(); } - instanceByName(index, instance) { - return instance.name; - } - } From 1935ad2d7fa530e11a292f55928e2513864a4755 Mon Sep 17 00:00:00 2001 From: CarlosFJ Date: Wed, 21 Oct 2020 10:19:31 +0200 Subject: [PATCH 20/20] Load discovery to init app when not network connection --- src/src/app/app.component.ts | 29 ++++++---------------- src/src/pages/configScreen/configScreen.ts | 21 +++++++++++----- src/src/providers/global/global.ts | 12 +++++---- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/src/app/app.component.ts b/src/src/app/app.component.ts index e67cd2d7..40ed90a8 100644 --- a/src/src/app/app.component.ts +++ b/src/src/app/app.component.ts @@ -1,6 +1,5 @@ import {Config, Events, Nav, Platform} from 'ionic-angular'; import {Component, ViewChild} from '@angular/core'; -import { ReconfigurePage } from '../pages/welcome/reconfigure'; import { ProfilePage } from '../pages/profile/profile'; import { ConfigurationScreen } from '../pages/configScreen/configScreen'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; @@ -80,22 +79,7 @@ export class GeteduroamApp { this.enableWifi(); } if (!this.checkExtFile) { - const isAssociated = await this.isAssociatedNetwork(); - - if (!!isAssociated.success) { - // this.rootPage = !!isAssociated.success ? ConfigurationScreen : ReconfigurePage; - this.rootPage = ConfigurationScreen; - } else{ - if (!isAssociated.message.includes('alreadyAssociated')) { - this.rootPage = ConfigurationScreen; - } else { - this.rootPage = ReconfigurePage; - this.getAssociation(isAssociated); - this.global.setOverrideProfile(true); - - !isAssociated.success && !isAssociated.overridable ? this.removeAssociatedManually() : ''; - } - } + this.rootPage = ConfigurationScreen; } } async checkExternalOpen() { @@ -150,7 +134,7 @@ export class GeteduroamApp { this.platform.registerBackButtonAction(() => { // get current active page let view = this.navCtrl.getActive(); - if (view.component.name == "ConfigurationScreen" || view.component.name == "ReconfigurePage") { + if (view.component.name == "ConfigurationScreen") { //Double check to exit app if (new Date().getTime() - this.lastTimeBackPress < this.timePeriodToExit) { this.platform.exitApp(); //Exit from app @@ -200,12 +184,11 @@ export class GeteduroamApp { */ async notConnectionNetwork() { if (!this.checkExtFile) { - this.rootPage = ReconfigurePage; + this.rootPage = ConfigurationScreen; const isAssociated = await this.isAssociatedNetwork(); this.getAssociation(isAssociated); - if (!isAssociated.success && !isAssociated.overridable) { this.removeAssociatedManually(); @@ -232,9 +215,11 @@ export class GeteduroamApp { let connectionStatus = await this.statusConnection(); if (!this.checkExtFile) { this.connectionEvent(connectionStatus); - this.global.setDiscovery(await this.getEduroamServices.discovery()); - if (!connectionStatus.connected){ + + if (!connectionStatus.connected) { this.notConnectionNetwork(); + } else { + this.global.setDiscovery(await this.getEduroamServices.discovery()); } } } diff --git a/src/src/pages/configScreen/configScreen.ts b/src/src/pages/configScreen/configScreen.ts index b8f63fbc..a1e87277 100644 --- a/src/src/pages/configScreen/configScreen.ts +++ b/src/src/pages/configScreen/configScreen.ts @@ -90,6 +90,12 @@ export class ConfigurationScreen extends BasePage{ Keyboard.addListener('keyboardWillShow', async () => { await Keyboard.hide(); }); + + this.event.subscribe('connection', async (res: any) => { + if (!!res.connected && !this.global.discovery) { + this.chargeDiscovery() + } + }); } @@ -119,7 +125,7 @@ export class ConfigurationScreen extends BasePage{ return await searchModal.present(); } else { - await this.getDiscovery(); + await this.chargeDiscovery(); this.showModal(e); } } @@ -228,9 +234,11 @@ export class ConfigurationScreen extends BasePage{ } this.resetValues(); } - ngOnInit() { + + async ngOnInit() { this.instances = this.global.discovery; } + ionViewWillEnter() { this.loading.create(); } @@ -239,9 +247,6 @@ export class ConfigurationScreen extends BasePage{ * Load the discovery data and show the spinner */ async ionViewDidEnter() { - if (!this.instances) { - await this.getDiscovery(); - } this.removeSpinner(); this.showAll = true; } @@ -261,7 +266,6 @@ export class ConfigurationScreen extends BasePage{ this.instanceName = ''; }); - } async checkEap(profile: ProfileModel) { @@ -286,6 +290,11 @@ export class ConfigurationScreen extends BasePage{ } } + async chargeDiscovery() { + await this.getDiscovery(); + this.global.setDiscovery(this.instances) + } + /** * */ diff --git a/src/src/providers/global/global.ts b/src/src/providers/global/global.ts index 26f70fdf..5dcb28ff 100644 --- a/src/src/providers/global/global.ts +++ b/src/src/providers/global/global.ts @@ -134,11 +134,13 @@ export class GlobalProvider { setDiscovery(list: any) { this.discovery = list; - list.map((res) => { - if (res.name) { - this.institutionNames.push(res.name); - } - }) + if (!!list) { + list.map((res) => { + if (res.name) { + this.institutionNames.push(res.name); + } + }) + } } getDiscovery() {