MOBILE-3325 settings: Divide app and site settings

main
Pau Ferrer Ocaña 2020-01-28 11:53:32 +01:00
parent c4becfd0af
commit fa72fa4f02
17 changed files with 170 additions and 32 deletions

View File

@ -1760,7 +1760,6 @@
"core.login.visitchangepassword": "local_moodlemobileapp",
"core.login.webservicesnotenabled": "local_moodlemobileapp",
"core.lostconnection": "local_moodlemobileapp",
"core.mainmenu.appsettings": "local_moodlemobileapp",
"core.mainmenu.changesite": "local_moodlemobileapp",
"core.mainmenu.help": "moodle",
"core.mainmenu.logout": "moodle",
@ -1891,6 +1890,7 @@
"core.sending": "chat",
"core.serverconnection": "error",
"core.settings.about": "local_moodlemobileapp",
"core.settings.appsettings": "local_moodlemobileapp",
"core.settings.appversion": "local_moodlemobileapp",
"core.settings.cannotsyncoffline": "local_moodlemobileapp",
"core.settings.cannotsyncwithoutwifi": "local_moodlemobileapp",
@ -1950,6 +1950,7 @@
"core.settings.showdownloadoptions": "local_moodlemobileapp",
"core.settings.siteinfo": "local_moodlemobileapp",
"core.settings.sites": "moodle",
"core.settings.sitesettings": "moodle",
"core.settings.spaceusage": "local_moodlemobileapp",
"core.settings.synchronization": "local_moodlemobileapp",
"core.settings.synchronizenow": "local_moodlemobileapp",

View File

@ -1760,7 +1760,6 @@
"core.login.visitchangepassword": "Do you want to visit the site to change the password?",
"core.login.webservicesnotenabled": "Web services are not enabled in your site. Please contact your site administrator if you think they should be enabled.",
"core.lostconnection": "Your authentication token is invalid or has expired. You will have to reconnect to the site.",
"core.mainmenu.appsettings": "App settings",
"core.mainmenu.changesite": "Change site",
"core.mainmenu.help": "Help",
"core.mainmenu.logout": "Log out",
@ -1891,6 +1890,7 @@
"core.sending": "Sending",
"core.serverconnection": "Error connecting to the server",
"core.settings.about": "About",
"core.settings.appsettings": "App settings",
"core.settings.appversion": "App version",
"core.settings.cannotsyncoffline": "Cannot synchronise offline.",
"core.settings.cannotsyncwithoutwifi": "Cannot synchronise because the current settings only allow to synchronise when connected to Wi-Fi. Please connect to a Wi-Fi network.",
@ -1950,6 +1950,7 @@
"core.settings.showdownloadoptions": "Show download options",
"core.settings.siteinfo": "Site info",
"core.settings.sites": "Sites",
"core.settings.sitesettings": "Site settings",
"core.settings.spaceusage": "Space usage",
"core.settings.synchronization": "Synchronisation",
"core.settings.synchronizenow": "Synchronise now",
@ -2078,4 +2079,4 @@
"core.yes": "Yes",
"core.youreoffline": "You are offline",
"core.youreonline": "You are back online"
}
}

View File

@ -3,8 +3,8 @@
<ion-title>{{ 'core.login.login' | translate }}</ion-title>
<ion-buttons end>
<button *ngIf="isFixedUrlSet" ion-button icon-only [navPush]="'CoreSettingsListPage'" [attr.aria-label]="'core.mainmenu.appsettings' | translate">
<ion-icon name="cog"></ion-icon>
<button *ngIf="isFixedUrlSet" ion-button icon-only [navPush]="'CoreAppSettingsPage'" [attr.aria-label]="'core.settings.appsettings' | translate">
<core-icon name="fa-cogs"></core-icon>
</button>
</ion-buttons>
</ion-navbar>

View File

@ -3,8 +3,8 @@
<ion-title>{{ 'core.login.connecttomoodle' | translate }}</ion-title>
<ion-buttons end>
<button ion-button icon-only [navPush]="'CoreSettingsListPage'" [attr.aria-label]="'core.mainmenu.appsettings' | translate">
<ion-icon name="cog"></ion-icon>
<button ion-button icon-only [navPush]="'CoreAppSettingsPage'" [attr.aria-label]="'core.settings.appsettings' | translate">
<core-icon name="fa-cogs"></core-icon>
</button>
<button ion-button icon-only (click)="showHelp()" [attr.aria-label]="'core.help' | translate">
<ion-icon name="help-circle"></ion-icon>

View File

@ -17,6 +17,7 @@ import { IonicPageModule } from 'ionic-angular';
import { CoreLoginSitePage } from './site';
import { TranslateModule } from '@ngx-translate/core';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreComponentsModule } from '@components/components.module';
@NgModule({
declarations: [
@ -24,6 +25,7 @@ import { CoreDirectivesModule } from '@directives/directives.module';
],
imports: [
CoreDirectivesModule,
CoreComponentsModule,
IonicPageModule.forChild(CoreLoginSitePage),
TranslateModule.forChild()
]

View File

@ -3,8 +3,8 @@
<ion-title>{{ 'core.settings.sites' | translate }}</ion-title>
<ion-buttons end>
<button ion-button icon-only [navPush]="'CoreSettingsListPage'" [attr.aria-label]="'core.mainmenu.appsettings' | translate">
<ion-icon name="cog"></ion-icon>
<button ion-button icon-only [navPush]="'CoreAppSettingsPage'" [attr.aria-label]="'core.settings.appsettings' | translate">
<core-icon name="fa-cogs"></core-icon>
</button>
<button *ngIf="sites && sites.length > 0" ion-button icon-only (click)="toggleDelete()" [attr.aria-label]="'core.delete' | translate">
<ion-icon name="create" ios="md-create"></ion-icon>

View File

@ -17,6 +17,7 @@ import { IonicPageModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreLoginSitesPage } from './sites';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreComponentsModule } from '@components/components.module';
@NgModule({
declarations: [
@ -24,6 +25,7 @@ import { CoreDirectivesModule } from '@directives/directives.module';
],
imports: [
CoreDirectivesModule,
CoreComponentsModule,
IonicPageModule.forChild(CoreLoginSitesPage),
TranslateModule.forChild()
],

View File

@ -1,5 +1,4 @@
{
"appsettings": "App settings",
"changesite": "Change site",
"help": "Help",
"logout": "Log out",

View File

@ -39,9 +39,13 @@
<ion-icon name="help-buoy" item-start aria-hidden="true"></ion-icon>
<p>{{ 'core.mainmenu.help' | translate }}</p>
</a>
<a ion-item (click)="openSettings()" title="{{ 'core.mainmenu.appsettings' | translate }}">
<ion-icon name="cog" item-start aria-hidden="true"></ion-icon>
<p>{{ 'core.mainmenu.appsettings' | translate }}</p>
<a ion-item (click)="openSiteSettings()" title="{{ 'core.settings.sitesettings' | translate }}">
<core-icon name="fa-cog" item-start></core-icon>
<p>{{ 'core.settings.sitesettings' | translate }}</p>
</a>
<a ion-item (click)="openAppSettings()" title="{{ 'core.settings.appsettings' | translate }}">
<core-icon name="fa-cogs" item-start></core-icon>
<p>{{ 'core.settings.appsettings' | translate }}</p>
</a>
<a ion-item (click)="logout()" title="{{ logoutLabel | translate }}">
<ion-icon name="log-out" item-start aria-hidden="true"></ion-icon>

View File

@ -142,10 +142,17 @@ export class CoreMainMenuMorePage implements OnDestroy {
}
/**
* Open settings page.
* Open app settings page.
*/
openSettings(): void {
this.navCtrl.push('CoreSettingsListPage');
openAppSettings(): void {
this.navCtrl.push('CoreAppSettingsPage');
}
/**
* Open site settings page.
*/
openSiteSettings(): void {
this.navCtrl.push('CoreSiteSettingsPage');
}
/**

View File

@ -1,5 +1,6 @@
{
"about": "About",
"appsettings": "App settings",
"appversion": "App version",
"cannotsyncoffline": "Cannot synchronise offline.",
"cannotsyncwithoutwifi": "Cannot synchronise because the current settings only allow to synchronise when connected to Wi-Fi. Please connect to a Wi-Fi network.",
@ -56,6 +57,7 @@
"entriesincache": "{{$a}} entries in cache",
"screen": "Screen information",
"settings": "Settings",
"sitesettings": "Site settings",
"showdownloadoptions": "Show download options",
"siteinfo": "Site info",
"sites": "Sites",

View File

@ -1,6 +1,6 @@
<ion-header>
<ion-navbar core-back-button>
<ion-title>{{ 'core.settings.settings' | translate}}</ion-title>
<ion-title>{{ 'core.settings.appsettings' | translate}}</ion-title>
<ion-buttons end>
</ion-buttons>
</ion-navbar>
@ -24,12 +24,6 @@
<ion-icon name="folder" item-start></ion-icon>
<p>{{ 'core.sharedfiles.sharedfiles' | translate }}</p>
</a>
<a ion-item *ngFor="let handler of handlers" [ngClass]="['core-settings-handler', handler.class]" (click)="openHandler(handler.page, handler.params)" [title]="handler.title | translate" detail-push [class.core-split-item-selected]="handler.page == selectedPage">
<core-icon [name]="handler.icon" item-start *ngIf="handler.icon"></core-icon>
<p>{{ handler.title | translate}}</p>
</a>
<a ion-item (click)="openHandler('CoreSettingsAboutPage')" [title]="'core.settings.about' | translate" [class.core-split-item-selected]="'CoreSettingsAboutPage' == selectedPage" detail-push>
<ion-icon name="contacts" item-start></ion-icon>
<p>{{ 'core.settings.about' | translate }}</p>

View File

@ -15,19 +15,19 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreSettingsListPage } from './list';
import { CoreAppSettingsPage } from './app';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
@NgModule({
declarations: [
CoreSettingsListPage
CoreAppSettingsPage
],
imports: [
CoreComponentsModule,
CoreDirectivesModule,
IonicPageModule.forChild(CoreSettingsListPage),
IonicPageModule.forChild(CoreAppSettingsPage),
TranslateModule.forChild()
],
})
export class CoreSettingsListPageModule {}
export class CoreAppSettingsPageModule {}

View File

@ -0,0 +1,63 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { Component, ViewChild } from '@angular/core';
import { IonicPage, NavParams, Platform } from 'ionic-angular';
import { CoreSplitViewComponent } from '@components/split-view/split-view';
/**
* Page that displays the list of app settings pages.
*/
@IonicPage({segment: 'core-settings-app'})
@Component({
selector: 'page-core-settings-app',
templateUrl: 'app.html',
})
export class CoreAppSettingsPage {
@ViewChild(CoreSplitViewComponent) splitviewCtrl: CoreSplitViewComponent;
isIOS: boolean;
selectedPage: string;
constructor(platorm: Platform,
navParams: NavParams) {
this.isIOS = platorm.is('ios');
this.selectedPage = navParams.get('page') || false;
}
/**
* View loaded.
*/
ionViewDidLoad(): void {
if (this.selectedPage) {
this.openHandler(this.selectedPage);
} else if (this.splitviewCtrl.isOn()) {
this.openHandler('CoreSettingsGeneralPage');
}
}
/**
* Open a handler.
*
* @param page Page to open.
* @param params Params of the page to open.
*/
openHandler(page: string, params?: any): void {
this.selectedPage = page;
this.splitviewCtrl.push(page, params);
}
}

View File

@ -0,0 +1,30 @@
<ion-header>
<ion-navbar core-back-button>
<ion-title>{{ 'core.settings.sitesettings' | translate}}</ion-title>
<ion-buttons end>
</ion-buttons>
</ion-navbar>
</ion-header>
<core-split-view>
<ion-content>
<ion-list>
<a ion-item (click)="openHandler('CoreSettingsSpaceUsagePage')" [title]="'core.settings.spaceusage' | translate" [class.core-split-item-selected]="'CoreSettingsSpaceUsagePage' == selectedPage" detail-push>
<ion-icon name="stats" item-start></ion-icon>
<p>{{ 'core.settings.spaceusage' | translate }}</p>
</a>
<a ion-item (click)="openHandler('CoreSettingsSynchronizationPage')" [title]="'core.settings.synchronization' | translate" [class.core-split-item-selected]="'CoreSettingsSynchronizationPage' == selectedPage" detail-push>
<ion-icon name="sync" item-start></ion-icon>
<p>{{ 'core.settings.synchronization' | translate }}</p>
</a>
<a ion-item *ngIf="isIOS" (click)="openHandler('CoreSharedFilesListPage', {manage: true})" [title]="'core.sharedfiles.sharedfiles' | translate" [class.core-split-item-selected]="'CoreSharedFilesListPage' == selectedPage" detail-push>
<ion-icon name="folder" item-start></ion-icon>
<p>{{ 'core.sharedfiles.sharedfiles' | translate }}</p>
</a>
<a ion-item *ngFor="let handler of handlers" [ngClass]="['core-settings-handler', handler.class]" (click)="openHandler(handler.page, handler.params)" [title]="handler.title | translate" detail-push [class.core-split-item-selected]="handler.page == selectedPage">
<core-icon [name]="handler.icon" item-start *ngIf="handler.icon"></core-icon>
<p>{{ handler.title | translate}}</p>
</a>
</ion-list>
</ion-content>
</core-split-view>

View File

@ -0,0 +1,33 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreSiteSettingsPage } from './site';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
@NgModule({
declarations: [
CoreSiteSettingsPage
],
imports: [
CoreComponentsModule,
CoreDirectivesModule,
IonicPageModule.forChild(CoreSiteSettingsPage),
TranslateModule.forChild()
],
})
export class CoreSiteSettingsPageModule {}

View File

@ -18,14 +18,14 @@ import { CoreSettingsDelegate, CoreSettingsHandlerData } from '../../providers/d
import { CoreSplitViewComponent } from '@components/split-view/split-view';
/**
* Page that displays the list of settings pages.
* Page that displays the list of site settings pages.
*/
@IonicPage({segment: 'core-settings-list'})
@IonicPage({segment: 'core-settings-site'})
@Component({
selector: 'page-core-settings-list',
templateUrl: 'list.html',
selector: 'page-core-settings-site',
templateUrl: 'site.html',
})
export class CoreSettingsListPage {
export class CoreSiteSettingsPage {
@ViewChild(CoreSplitViewComponent) splitviewCtrl: CoreSplitViewComponent;
handlers: CoreSettingsHandlerData[];