Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Slow discovery selection #14

Merged
merged 26 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
572dc14
Adding back button to all pages
amachadogarcia Sep 22, 2020
0ceca55
Styles back button on header content
CarlosFJ Sep 22, 2020
98a3603
Styles back button on header content
CarlosFJ Sep 22, 2020
99bbe34
Lifecycle on config screen
CarlosFJ Sep 23, 2020
fa4a10d
Control arrow back when focus on input
CarlosFJ Sep 24, 2020
faa1d0f
Back button controled and fixed scss error page
amachadogarcia Sep 24, 2020
e22fe58
Fix styles
CarlosFJ Sep 24, 2020
5f3c6b1
fixed style of android
amachadogarcia Sep 25, 2020
5467a9d
Fixed init flow to version less than api 29
amachadogarcia Sep 25, 2020
f7f51ec
Fixing button of errorPage
amachadogarcia Sep 28, 2020
8fb0383
Event connection on Error Page
CarlosFJ Sep 28, 2020
def13c8
Preload Discovery after initialized the app
CarlosFJ Oct 2, 2020
fb43cc1
Preload Discovery after initialized the app
CarlosFJ Oct 2, 2020
f7b7fe8
Create module to modal controller
CarlosFJ Oct 14, 2020
e900974
Merging with develop
amachadogarcia Oct 15, 2020
e5ef9fb
Merge develop into fix/init_flow
CarlosFJ Oct 19, 2020
0364e04
Implement ngOnInit to charge InstitutionSearch component
CarlosFJ Oct 19, 2020
ac8a067
Charge instutionsNames to global provider
CarlosFJ Oct 19, 2020
f570f24
Remove module modal
CarlosFJ Oct 20, 2020
b44c60e
Merge branch 'fix/init_flow'
CarlosFJ Oct 20, 2020
1d8057b
Changes on InstitutionSearch
CarlosFJ Oct 20, 2020
df74ceb
Changes struct to ion-list
CarlosFJ Oct 20, 2020
7eb10ec
Merge branch 'develop'
CarlosFJ Oct 20, 2020
1935ad2
Load discovery to init app when not network connection
CarlosFJ Oct 21, 2020
8ef00d5
Merge branch 'develop' of https://github.com/geteduroam/ionic-app int…
CarlosFJ Oct 21, 2020
ec90a7a
Merge branch 'develop' of https://github.com/geteduroam/ionic-app int…
CarlosFJ Oct 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/plugins/wifi-eap-configurator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 7 additions & 21 deletions src/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -43,6 +42,7 @@ export class GeteduroamApp {
lastTimeBackPress = 0;

timePeriodToExit = 2000;

/**
* @constructor
*
Expand Down Expand Up @@ -79,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() {
Expand Down Expand Up @@ -149,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
Expand Down Expand Up @@ -199,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();

Expand Down Expand Up @@ -232,8 +216,10 @@ export class GeteduroamApp {
if (!this.checkExtFile) {
this.connectionEvent(connectionStatus);

if (!connectionStatus.connected){
if (!connectionStatus.connected) {
this.notConnectionNetwork();
} else {
this.global.setDiscovery(await this.getEduroamServices.discovery());
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -19,15 +18,18 @@ 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';
import { ReactiveFormsModule } from '@angular/forms';

@NgModule({
declarations: [
GeteduroamApp
],
imports: [
BrowserModule,
ReactiveFormsModule,
PagesModule,
IonicModule.forRoot(GeteduroamApp)
IonicModule.forRoot(GeteduroamApp, { preload: InstitutionSearch }),
],
bootstrap: [IonicApp],
entryComponents: [
Expand All @@ -50,7 +52,7 @@ import { OauthConfProvider } from '../providers/oauth-conf/oauth-conf';
OauthConfProvider,
ErrorServiceProvider
],
exports:[]
exports:[],
})
export class AppModule {

Expand Down
42 changes: 42 additions & 0 deletions src/src/assets/icon/flecha.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions src/src/pages/configScreen/configScreen.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ <h1>{{getString('header', 'config')}}</h1>
<div class="content-form" margin-top padding-top text-center>
<ion-label class="label-conf" no-margin padding-top text-left>{{getString('label', 'institution')}}</ion-label>

<div class="row" padding-top>
<div *ngIf="this.instances" class="row" padding-top>

<ion-searchbar (click)="showModal($event)" [(ngModel)]="instanceName" cancelButtonText
<ion-searchbar (click)="showModal($event)" [(ngModel)]="instanceName" cancelButtonText debounce="500"
class="searchbar-input" no-padding placeholder="{{getString('placeholder', 'institution')}}">

</ion-searchbar>
Expand Down Expand Up @@ -44,4 +44,3 @@ <h1>{{getString('header', 'config')}}</h1>
</div>
</div>
</div>

47 changes: 33 additions & 14 deletions src/src/pages/configScreen/configScreen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, NgZone } from '@angular/core';
import {Events, ModalController, NavController} from 'ionic-angular';
import { Component, NgModule, NgZone } from '@angular/core';
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';
Expand All @@ -20,7 +20,6 @@ declare var window;
selector: 'page-config-screen',
templateUrl: 'configScreen.html',
})

export class ConfigurationScreen extends BasePage{

showAll: boolean = false;
Expand Down Expand Up @@ -80,7 +79,6 @@ export class ConfigurationScreen extends BasePage{
*/
showButton: boolean = true;


/**
* Constructor
* */
Expand All @@ -89,34 +87,45 @@ 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();
});

this.event.subscribe('connection', async (res: any) => {
if (!!res.connected && !this.global.discovery) {
this.chargeDiscovery()
}
});
}


/**
* Method executes when the search bar is tapped.
* */
async showModal(e: any) {
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) => {

data = this.instances.filter((res: any) => {
if (res.name === data) return res
});

if (data !== undefined) {
this.instance = data;
this.instanceName = data.name;
this.instance = data[0];
this.instanceName = data[0].name;

this.initializeProfiles(this.instance);

}
});

return await searchModal.present();
} else {
await this.getDiscovery();
await this.chargeDiscovery();
this.showModal(e);
}
}
Expand Down Expand Up @@ -226,12 +235,18 @@ export class ConfigurationScreen extends BasePage{
this.resetValues();
}

async ngOnInit() {
this.instances = this.global.discovery;
}

ionViewWillEnter() {
this.loading.create();
}
/**
* Lifecycle when entering a page, before it becomes the active one
* Load the discovery data and show the spinner
*/
async ionViewDidEnter() {
await this.getDiscovery();
this.removeSpinner();
this.showAll = true;
}
Expand All @@ -251,7 +266,6 @@ export class ConfigurationScreen extends BasePage{
this.instanceName = '';

});

}

async checkEap(profile: ProfileModel) {
Expand All @@ -276,6 +290,11 @@ export class ConfigurationScreen extends BasePage{
}
}

async chargeDiscovery() {
await this.getDiscovery();
this.global.setDiscovery(this.instances)
}

/**
*
*/
Expand Down
11 changes: 9 additions & 2 deletions src/src/pages/institutionSearch/institutionSearch.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
</ion-toolbar>
</ion-header>
<ion-content fullscreen>
<ion-list *ngFor="let institution of filteredInstances" no-margin>
<ion-item (click)="selectInstitution(institution)">{{institution.name}}</ion-item>
<ion-list no-margin class="list list-ios list-institution">
<div *ngFor="let institution of filteredInstances;" class="item item-block">
<div class="item-inner" (click)="selectInstitution(institution)">
<div class="input-wrapper">
<div class="label label-ios label-institution">{{ institution }} </div>
</div>
</div>
<div class="button-effect"></div>
</div>
</ion-list>
</ion-content>
12 changes: 6 additions & 6 deletions src/src/pages/institutionSearch/institutionSearch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
14 changes: 9 additions & 5 deletions src/src/pages/institutionSearch/institutionSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down Expand Up @@ -91,9 +92,8 @@ export class InstitutionSearch extends BasePage{
*/
filterInstances(stringAux: string){
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();
Expand Down Expand Up @@ -131,16 +131,20 @@ export class InstitutionSearch extends BasePage{
this.selectedProfileId = '';
}

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.
* this sets focus on search bar
*/
ionViewDidEnter() {
ionViewWillEnter() {
this.ios = !!this.platform.is('ios');
this.instances = this.navParams.get('instances');
this.instanceName = this.navParams.get('instanceName');
this.filterInstances(this.instanceName);

}
ionViewDidEnter() {
setTimeout(() => {
this.searchBar.setFocus()
}, 10);
Expand Down
10 changes: 2 additions & 8 deletions src/src/pages/wifiConfirmation/wifiConfirmation.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<div *ngIf="!global.isAndroid() && viewCtrl.enableBack() && showAll" class="arrow-back">
<button ion-button class="arrow-btn" (click)="backToConfig()" id="btn-back">
<span class="button-inner"><span class="caret">⌃</span>
Back
</span>
</button>
</div>
<div *ngIf="showAll" class="container-content" id="dismissable-back">
<div *ngIf="showAll" class="container-content">
<div class="header-content" margin padding-top>
<img #imgLogo [ngClass]="!!logo ? 'imgLogo' : ''" [src]="converted_image" alt="setting" margin />
<h1>{{getString('header', 'confirmation')}}</h1>
Expand All @@ -27,3 +20,4 @@ <h1>{{getString('header', 'confirmation')}}</h1>
</div>
</div>
</div>

Loading