MOBILE-3313 settings: Improve about page with device info

main
Pau Ferrer Ocaña 2020-01-23 17:30:35 +01:00
parent 498c502089
commit c6b3190c64
12 changed files with 399 additions and 216 deletions

View File

@ -1328,6 +1328,7 @@
"core.areyousure": "moodle",
"core.back": "moodle",
"core.block.blocks": "moodle",
"core.browser": "local_moodlemobileapp",
"core.cancel": "moodle",
"core.cannotconnect": "local_moodlemobileapp",
"core.cannotdownloadfiles": "local_moodlemobileapp",
@ -1465,6 +1466,7 @@
"core.deleteduser": "bulkusers",
"core.deleting": "local_moodlemobileapp",
"core.description": "moodle",
"core.desktop": "local_moodlemobileapp",
"core.dfdaymonthyear": "local_moodlemobileapp",
"core.dfdayweekmonth": "local_moodlemobileapp",
"core.dffulldate": "local_moodlemobileapp",
@ -1658,6 +1660,7 @@
"core.lastmodified": "moodle",
"core.lastsync": "local_moodlemobileapp",
"core.layoutgrid": "workshopform_rubric",
"core.linux": "local_moodlemobileapp",
"core.list": "moodle",
"core.listsep": "langconfig",
"core.loading": "moodle",
@ -1759,6 +1762,7 @@
"core.login.visitchangepassword": "local_moodlemobileapp",
"core.login.webservicesnotenabled": "local_moodlemobileapp",
"core.lostconnection": "local_moodlemobileapp",
"core.mac": "local_moodlemobileapp",
"core.mainmenu.appsettings": "local_moodlemobileapp",
"core.mainmenu.changesite": "local_moodlemobileapp",
"core.mainmenu.help": "moodle",
@ -1890,7 +1894,7 @@
"core.sending": "chat",
"core.serverconnection": "error",
"core.settings.about": "local_moodlemobileapp",
"core.settings.appready": "local_moodlemobileapp",
"core.settings.appversion": "local_moodlemobileapp",
"core.settings.cannotsyncoffline": "local_moodlemobileapp",
"core.settings.cannotsyncwithoutwifi": "local_moodlemobileapp",
"core.settings.colorscheme": "local_moodlemobileapp",
@ -1898,6 +1902,7 @@
"core.settings.colorscheme-dark": "local_moodlemobileapp",
"core.settings.colorscheme-light": "local_moodlemobileapp",
"core.settings.compilationinfo": "local_moodlemobileapp",
"core.settings.copyinfo": "local_moodlemobileapp",
"core.settings.cordovadevicemodel": "local_moodlemobileapp",
"core.settings.cordovadeviceosversion": "local_moodlemobileapp",
"core.settings.cordovadeviceplatform": "local_moodlemobileapp",
@ -1910,7 +1915,6 @@
"core.settings.deletesitefilestitle": "local_moodlemobileapp",
"core.settings.deviceinfo": "local_moodlemobileapp",
"core.settings.deviceos": "local_moodlemobileapp",
"core.settings.devicewebworkers": "local_moodlemobileapp",
"core.settings.disableall": "message",
"core.settings.disabled": "lesson",
"core.settings.displayformat": "local_moodlemobileapp",
@ -1929,7 +1933,6 @@
"core.settings.fontsizecharacter": "block_accessibility/char",
"core.settings.general": "moodle",
"core.settings.language": "moodle",
"core.settings.license": "moodle",
"core.settings.localnotifavailable": "local_moodlemobileapp",
"core.settings.locationhref": "local_moodlemobileapp",
"core.settings.locked": "admin",
@ -1938,19 +1941,20 @@
"core.settings.navigatorlanguage": "local_moodlemobileapp",
"core.settings.navigatoruseragent": "local_moodlemobileapp",
"core.settings.networkstatus": "local_moodlemobileapp",
"core.settings.opensourcelicenses": "local_moodlemobileapp",
"core.settings.privacypolicy": "local_moodlemobileapp",
"core.settings.pushid": "local_moodlemobileapp",
"core.settings.reportinbackground": "local_moodlemobileapp",
"core.settings.screen": "local_moodlemobileapp",
"core.settings.settings": "moodle",
"core.settings.showdownloadoptions": "local_moodlemobileapp",
"core.settings.siteinfo": "local_moodlemobileapp",
"core.settings.sites": "moodle",
"core.settings.spaceusage": "local_moodlemobileapp",
"core.settings.synchronization": "local_moodlemobileapp",
"core.settings.synchronizenow": "local_moodlemobileapp",
"core.settings.syncsettings": "local_moodlemobileapp",
"core.settings.total": "moodle",
"core.settings.versioncode": "local_moodlemobileapp",
"core.settings.versionname": "local_moodlemobileapp",
"core.settings.wificonnection": "local_moodlemobileapp",
"core.sharedfiles.chooseaccountstorefile": "local_moodlemobileapp",
"core.sharedfiles.chooseactionrepeatedfile": "local_moodlemobileapp",
@ -2068,7 +2072,7 @@
"core.whoops": "local_moodlemobileapp",
"core.whyisthishappening": "local_moodlemobileapp",
"core.whyisthisrequired": "moodle",
"core.windowsphone": "local_moodlemobileapp",
"core.windows": "local_moodlemobileapp",
"core.wsfunctionnotavailable": "local_moodlemobileapp",
"core.year": "moodle",
"core.years": "moodle",

View File

@ -205,6 +205,10 @@ ion-app.app-root {
background-color: $gray-light;
}
ion-note.core-note-block {
display: block;
}
// Form items
// -------------------------

View File

@ -1328,6 +1328,7 @@
"core.areyousure": "Are you sure?",
"core.back": "Back",
"core.block.blocks": "Blocks",
"core.browser": "Browser",
"core.cancel": "Cancel",
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle {{$a}} or later.",
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
@ -1465,6 +1466,7 @@
"core.deleteduser": "Deleted user",
"core.deleting": "Deleting",
"core.description": "Description",
"core.desktop": "Desktop",
"core.dfdaymonthyear": "MM-DD-YYYY",
"core.dfdayweekmonth": "ddd, D MMM",
"core.dffulldate": "dddd, D MMMM YYYY h[:]mm A",
@ -1658,6 +1660,7 @@
"core.lastmodified": "Last modified",
"core.lastsync": "Last synchronisation",
"core.layoutgrid": "Grid",
"core.linux": "Linux",
"core.list": "List",
"core.listsep": ",",
"core.loading": "Loading",
@ -1759,6 +1762,7 @@
"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.mac": "MacOS",
"core.mainmenu.appsettings": "App settings",
"core.mainmenu.changesite": "Change site",
"core.mainmenu.help": "Help",
@ -1890,7 +1894,7 @@
"core.sending": "Sending",
"core.serverconnection": "Error connecting to the server",
"core.settings.about": "About",
"core.settings.appready": "App ready",
"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.",
"core.settings.colorscheme": "Color Scheme",
@ -1898,6 +1902,7 @@
"core.settings.colorscheme-dark": "Dark",
"core.settings.colorscheme-light": "Light",
"core.settings.compilationinfo": "Compilation info",
"core.settings.copyinfo": "Copy device info on the clipboard",
"core.settings.cordovadevicemodel": "Cordova device model",
"core.settings.cordovadeviceosversion": "Cordova device OS version",
"core.settings.cordovadeviceplatform": "Cordova device platform",
@ -1910,7 +1915,6 @@
"core.settings.deletesitefilestitle": "Delete site files",
"core.settings.deviceinfo": "Device info",
"core.settings.deviceos": "Device OS",
"core.settings.devicewebworkers": "Device web workers supported",
"core.settings.disableall": "Disable notifications",
"core.settings.disabled": "Disabled",
"core.settings.displayformat": "Display format",
@ -1929,7 +1933,6 @@
"core.settings.fontsizecharacter": "A",
"core.settings.general": "General",
"core.settings.language": "Language",
"core.settings.license": "Licence",
"core.settings.localnotifavailable": "Local notifications available",
"core.settings.locationhref": "Web view URL",
"core.settings.locked": "Locked",
@ -1938,19 +1941,20 @@
"core.settings.navigatorlanguage": "Navigator language",
"core.settings.navigatoruseragent": "Navigator userAgent",
"core.settings.networkstatus": "Internet connection status",
"core.settings.opensourcelicenses": "Open Source Licences",
"core.settings.privacypolicy": "Privacy policy",
"core.settings.pushid": "Push notifications ID",
"core.settings.reportinbackground": "Report errors automatically",
"core.settings.screen": "Screen information",
"core.settings.settings": "Settings",
"core.settings.showdownloadoptions": "Show download options",
"core.settings.siteinfo": "Site info",
"core.settings.sites": "Sites",
"core.settings.spaceusage": "Space usage",
"core.settings.synchronization": "Synchronisation",
"core.settings.synchronizenow": "Synchronise now",
"core.settings.syncsettings": "Synchronisation settings",
"core.settings.total": "Total",
"core.settings.versioncode": "Version code",
"core.settings.versionname": "Version name",
"core.settings.wificonnection": "Wi-Fi connection",
"core.sharedfiles.chooseaccountstorefile": "Choose an account to store the file in.",
"core.sharedfiles.chooseactionrepeatedfile": "A file with this name already exists. Do you want to replace the existing file or rename it to \"{{$a}}\"?",
@ -2068,7 +2072,7 @@
"core.whoops": "Oops!",
"core.whyisthishappening": "Why is this happening?",
"core.whyisthisrequired": "Why is this required?",
"core.windowsphone": "Windows Phone",
"core.windows": "Windows",
"core.wsfunctionnotavailable": "The web service function is not available.",
"core.year": "year",
"core.years": "years",

View File

@ -8,8 +8,8 @@
<a ion-item core-user-link [userId]="siteInfo.userid" text-wrap>
<ion-avatar core-user-avatar [user]="siteInfo" item-start></ion-avatar>
<h2>{{siteInfo.fullname}}</h2>
<ion-note><core-format-text [text]="siteName" contextLevel="system" [contextInstanceId]="0" [wsNotFiltered]="true"></core-format-text></ion-note>
<ion-note>{{ siteUrl }}</ion-note>
<ion-note class="core-note-block"><core-format-text [text]="siteName" contextLevel="system" [contextInstanceId]="0" [wsNotFiltered]="true"></core-format-text></ion-note>
<ion-note class="core-note-block">{{ siteUrl }}</ion-note>
</a>
<ion-item-divider></ion-item-divider>
<ion-item text-center *ngIf="(!handlers || !handlers.length) && !handlersLoaded">

View File

@ -1,6 +1,6 @@
{
"about": "About",
"appready": "App ready",
"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.",
"colorscheme": "Color Scheme",
@ -8,6 +8,7 @@
"colorscheme-dark": "Dark",
"colorscheme-light": "Light",
"compilationinfo": "Compilation info",
"copyinfo": "Copy device info on the clipboard",
"cordovadevicemodel": "Cordova device model",
"cordovadeviceosversion": "Cordova device OS version",
"cordovadeviceplatform": "Cordova device platform",
@ -20,7 +21,6 @@
"deletesitefilestitle": "Delete site files",
"deviceinfo": "Device info",
"deviceos": "Device OS",
"devicewebworkers": "Device web workers supported",
"disableall": "Disable notifications",
"disabled": "Disabled",
"displayformat": "Display format",
@ -38,7 +38,7 @@
"fontsizecharacter": "A",
"general": "General",
"language": "Language",
"license": "Licence",
"opensourcelicenses": "Open Source Licences",
"localnotifavailable": "Local notifications available",
"locationhref": "Web view URL",
"locked": "Locked",
@ -51,15 +51,15 @@
"pushid": "Push notifications ID",
"reportinbackground": "Report errors automatically",
"entriesincache": "{{$a}} entries in cache",
"screen": "Screen information",
"settings": "Settings",
"showdownloadoptions": "Show download options",
"siteinfo": "Site info",
"sites": "Sites",
"spaceusage": "Space usage",
"synchronization": "Synchronisation",
"synchronizenow": "Synchronise now",
"syncsettings": "Synchronisation settings",
"total": "Total",
"versioncode": "Version code",
"versionname": "Version name",
"wificonnection": "Wi-Fi connection"
}

View File

@ -7,120 +7,16 @@
<ion-item text-wrap>
<h2>{{ appName }} {{ versionName }}</h2>
</ion-item>
<ion-item-group>
<ion-item-divider text-wrap>
{{ 'core.settings.license' | translate }}
</ion-item-divider>
<ion-item text-wrap>
<h2>Apache 2.0</h2>
<p><a href="http://www.apache.org/licenses/LICENSE-2.0" core-link auto-login="no">http://www.apache.org/licenses/LICENSE-2.0</a></p>
</ion-item>
</ion-item-group>
<ion-item-group *ngIf="privacyPolicy">
<ion-item-divider text-wrap>
{{ 'core.settings.privacypolicy' | translate }}
</ion-item-divider>
<ion-item text-wrap>
<p><a [href]="privacyPolicy" core-link auto-login="no">{{ privacyPolicy }}</a></p>
</ion-item>
</ion-item-group>
<ion-item-group *ngIf="siteUrl">
<ion-item-divider text-wrap>
{{ 'core.login.siteurl' | translate }}<ng-container *ngIf="isPrefixedUrl"> *</ng-container>
</ion-item-divider>
<ion-item text-wrap>
<p><a [href]="siteUrl" core-link auto-login="yes">{{ siteUrl }}</a></p>
</ion-item>
</ion-item-group>
<ion-item-group>
<ion-item-divider text-wrap>
{{ 'core.settings.deviceinfo' | translate }}
</ion-item-divider>
<ion-item text-wrap *ngIf="versionName">
<h2>{{ 'core.settings.versionname' | translate}}</h2>
<p>{{ versionName }}</p>
</ion-item>
<ion-item text-wrap *ngIf="versionCode">
<h2>{{ 'core.settings.versioncode' | translate}}</h2>
<p>{{ versionCode }}</p>
</ion-item>
<ion-item text-wrap *ngIf="compilationTime || lastCommit">
<h2>{{ 'core.settings.compilationinfo' | translate }}</h2>
<p *ngIf="compilationTime">{{ compilationTime | coreFormatDate: "LLL Z": false }}</p>
<p *ngIf="lastCommit">{{ lastCommit }}</p>
</ion-item>
<ion-item text-wrap *ngIf="fileSystemRoot">
<h2>{{ 'core.settings.filesystemroot' | translate}}</h2>
<p><a *ngIf="fsClickable" [href]="fileSystemRoot" core-link auto-login="no">{{ fileSystemRoot }}</a></p>
<p *ngIf="!fsClickable">{{ fileSystemRoot }}</p>
</ion-item>
<ion-item text-wrap *ngIf="navigator && navigator.userAgent">
<h2>{{ 'core.settings.navigatoruseragent' | translate}}</h2>
<p>{{ navigator.userAgent }}</p>
</ion-item>
<ion-item text-wrap *ngIf="navigator && navigator.language">
<h2>{{ 'core.settings.navigatorlanguage' | translate}}</h2>
<p>{{ navigator.language }}</p>
</ion-item>
<ion-item text-wrap *ngIf="locationHref">
<h2>{{ 'core.settings.locationhref' | translate}}</h2>
<p>{{ locationHref }}</p>
</ion-item>
<ion-item text-wrap *ngIf="appReady">
<h2>{{ 'core.settings.appready' | translate}}</h2>
<p>{{ appReady | translate }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceType">
<h2>{{ 'core.settings.displayformat' | translate}}</h2>
<p>{{ deviceType | translate }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceOs">
<h2>{{ 'core.settings.deviceos' | translate}}</h2>
<p>{{ deviceOs | translate }}</p>
</ion-item>
<ion-item text-wrap *ngIf="currentLanguage">
<h2>{{ 'core.settings.currentlanguage' | translate}}</h2>
<p>{{ currentLanguage }}</p>
</ion-item>
<ion-item text-wrap *ngIf="networkStatus">
<h2>{{ 'core.settings.networkstatus' | translate}}</h2>
<p>{{ networkStatus | translate }}</p>
</ion-item>
<ion-item text-wrap *ngIf="wifiConnection">
<h2>{{ 'core.settings.wificonnection' | translate}}</h2>
<p>{{ wifiConnection | translate }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceWebWorkers">
<h2>{{ 'core.settings.devicewebworkers' | translate}}</h2>
<p>{{ deviceWebWorkers | translate }}</p>
</ion-item>
<ion-item text-wrap *ngIf="device && device.cordova">
<h2>{{ 'core.settings.cordovaversion' | translate}}</h2>
<p>{{ device.cordova }}</p>
</ion-item>
<ion-item text-wrap *ngIf="device && device.platform">
<h2>{{ 'core.settings.cordovadeviceplatform' | translate}}</h2>
<p>{{ device.platform }}</p>
</ion-item>
<ion-item text-wrap *ngIf="device && device.version">
<h2>{{ 'core.settings.cordovadeviceosversion' | translate}}</h2>
<p>{{ device.version }}</p>
</ion-item>
<ion-item text-wrap *ngIf="device && device.model">
<h2>{{ 'core.settings.cordovadevicemodel' | translate}}</h2>
<p>{{ device.model }}</p>
</ion-item>
<ion-item text-wrap *ngIf="device && device.uuid">
<h2>{{ 'core.settings.cordovadeviceuuid' | translate}}</h2>
<p>{{ device.uuid }}</p>
</ion-item>
<ion-item text-wrap *ngIf="pushId">
<h2>{{ 'core.settings.pushid' | translate}}</h2>
<p>{{ pushId }}</p>
</ion-item>
<ion-item text-wrap *ngIf="localNotifAvailable">
<h2>{{ 'core.settings.localnotifavailable' | translate}}</h2>
<p>{{ localNotifAvailable | translate }}</p>
</ion-item>
</ion-item-group>
<ion-item text-wrap detail-push>
<core-icon name="fa-copyright" item-start></core-icon>
{{ 'core.settings.opensourcelicenses' | translate }}
</ion-item>
<a ion-item text-wrap *ngIf="privacyPolicy" [href]="privacyPolicy" core-link auto-login="no">
<core-icon name="fa-user-secret" item-start></core-icon>
{{ 'core.settings.privacypolicy' | translate }}
</a>
<a ion-item (click)="openPage('CoreSettingsDeviceInfoPage')" [title]="'core.settings.deviceinfo' | translate">
<ion-icon name="phone-portrait" item-start></ion-icon>
<p>{{ 'core.settings.deviceinfo' | translate }}</p>
</a>
</ion-content>

View File

@ -12,17 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { Component, } from '@angular/core';
import { IonicPage, Platform } from 'ionic-angular';
import { Device } from '@ionic-native/device';
import { Component, Optional } from '@angular/core';
import { IonicPage, NavController } from 'ionic-angular';
import { CoreAppProvider } from '@providers/app';
import { CoreFileProvider } from '@providers/file';
import { CoreInitDelegate } from '@providers/init';
import { CoreLangProvider } from '@providers/lang';
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
import { CoreSitesProvider } from '@providers/sites';
import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreConfigConstants } from '../../../../configconstants';
import { CorePushNotificationsProvider } from '@core/pushnotifications/providers/pushnotifications';
/**
* Page that displays the about settings.
@ -36,89 +31,30 @@ export class CoreSettingsAboutPage {
appName: string;
versionName: string;
versionCode: number;
compilationTime: number;
lastCommit: string;
privacyPolicy: string;
navigator: Navigator;
locationHref: string;
appReady: string;
deviceType: string;
deviceOs: string;
currentLanguage: string;
networkStatus: string;
wifiConnection: string;
deviceWebWorkers: string;
device: Device;
fileSystemRoot: string;
fsClickable: boolean;
storageType: string;
localNotifAvailable: string;
pushId: string;
siteUrl: string;
isPrefixedUrl: boolean;
constructor(platform: Platform, device: Device, appProvider: CoreAppProvider, fileProvider: CoreFileProvider,
initDelegate: CoreInitDelegate, langProvider: CoreLangProvider, sitesProvider: CoreSitesProvider,
localNotificationsProvider: CoreLocalNotificationsProvider, pushNotificationsProvider: CorePushNotificationsProvider) {
constructor(appProvider: CoreAppProvider,
sitesProvider: CoreSitesProvider,
@Optional() private svComponent: CoreSplitViewComponent,
protected navCtrl: NavController) {
const currentSite = sitesProvider.getCurrentSite();
this.appName = appProvider.isDesktop() ? CoreConfigConstants.desktopappname : CoreConfigConstants.appname;
this.versionName = CoreConfigConstants.versionname;
this.versionCode = CoreConfigConstants.versioncode;
this.compilationTime = CoreConfigConstants.compilationtime;
this.lastCommit = CoreConfigConstants.lastcommit;
// Calculate the privacy policy to use.
this.privacyPolicy = (currentSite && (currentSite.getStoredConfig('tool_mobile_apppolicy') ||
currentSite.getStoredConfig('sitepolicy'))) || CoreConfigConstants.privacypolicy;
}
this.navigator = window.navigator;
if (window.location && window.location.href) {
const url = window.location.href;
this.locationHref = url.substr(0, url.indexOf('#'));
}
this.appReady = initDelegate.isReady() ? 'core.yes' : 'core.no';
this.deviceType = platform.is('tablet') ? 'core.tablet' : 'core.phone';
if (platform.is('android')) {
this.deviceOs = 'core.android';
} else if (platform.is('ios')) {
this.deviceOs = 'core.ios';
} else if (platform.is('windows')) {
this.deviceOs = 'core.windowsphone';
} else {
const matches = navigator.userAgent.match(/\(([^\)]*)\)/);
if (matches && matches.length > 1) {
this.deviceOs = matches[1];
} else {
this.deviceOs = 'core.unknown';
}
}
langProvider.getCurrentLanguage().then((lang) => {
this.currentLanguage = lang;
});
this.networkStatus = appProvider.isOnline() ? 'core.online' : 'core.offline';
this.wifiConnection = appProvider.isWifi() ? 'core.yes' : 'core.no';
this.deviceWebWorkers = !!window['Worker'] && !!window['URL'] ? 'core.yes' : 'core.no';
this.device = device;
if (fileProvider.isAvailable()) {
fileProvider.getBasePath().then((basepath) => {
this.fileSystemRoot = basepath;
this.fsClickable = fileProvider.usesHTMLAPI();
});
}
this.localNotifAvailable = localNotificationsProvider.isAvailable() ? 'core.yes' : 'core.no';
this.pushId = pushNotificationsProvider.getPushId();
this.siteUrl = (currentSite && currentSite.getURL()) ||
(typeof CoreConfigConstants.siteurl == 'string' && CoreConfigConstants.siteurl);
this.isPrefixedUrl = !!CoreConfigConstants.siteurl;
/**
* Opens a page.
*
* @param page The component deeplink name you want to push onto the navigation stack.
*/
openPage(page: string): void {
const navCtrl = this.svComponent ? this.svComponent.getMasterNav() : this.navCtrl;
navCtrl.push(page);
}
}

View File

@ -0,0 +1,97 @@
<ion-header>
<ion-navbar core-back-button>
<ion-title>{{ 'core.settings.deviceinfo' | translate }}</ion-title>
<ion-buttons end>
<button ion-button icon-only (click)="copyInfo()" [attr.aria-label]="'core.settings.copyinfo' | translate">
<ion-icon name="copy"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content>
<ion-item text-wrap>
<h2>{{ 'core.settings.appversion' | translate}}</h2>
<p>{{ deviceInfo.versionName }} ({{ deviceInfo.versionCode }})</p>
</ion-item>
<ion-item text-wrap>
<h2>{{ 'core.settings.compilationinfo' | translate }}</h2>
<p *ngIf="deviceInfo.compilationTime">{{ deviceInfo.compilationTime | coreFormatDate: "LLL Z": false }}</p>
<p *ngIf="deviceInfo.lastCommit">{{ deviceInfo.lastCommit }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.siteUrl">
<h2>{{ 'core.settings.siteinfo' | translate }}<ng-container *ngIf="deviceInfo.isPrefixedUrl"> *</ng-container></h2>
<p><a [href]="deviceInfo.siteUrl" core-link auto-login="yes">{{ deviceInfo.siteUrl }}</a></p>
<p *ngIf="deviceInfo.siteVersion">{{ deviceInfo.siteVersion }}</p>
<p *ngIf="deviceInfo.siteId">{{ deviceInfo.siteId }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.fileSystemRoot">
<h2>{{ 'core.settings.filesystemroot' | translate}}</h2>
<p><a *ngIf="fsClickable" [href]="deviceInfo.fileSystemRoot" core-link auto-login="no">{{ deviceInfo.fileSystemRoot }}</a></p>
<p *ngIf="!fsClickable">{{ deviceInfo.fileSystemRoot }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.userAgent">
<h2>{{ 'core.settings.navigatoruseragent' | translate}}</h2>
<p>{{ deviceInfo.userAgent }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.browserLanguage">
<h2>{{ 'core.settings.navigatorlanguage' | translate}}</h2>
<p>{{ deviceInfo.browserLanguage }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.currentLanguage">
<h2>{{ 'core.settings.currentlanguage' | translate}}</h2>
<p>{{ currentLangName }} ({{ deviceInfo.currentLanguage }})</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.locationHref">
<h2>{{ 'core.settings.locationhref' | translate}}</h2>
<p>{{ deviceInfo.locationHref }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.deviceType">
<h2>{{ 'core.settings.displayformat' | translate}}</h2>
<p>{{ 'core.' + deviceInfo.deviceType | translate }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.deviceOs">
<h2>{{ 'core.settings.deviceos' | translate}}</h2>
<p *ngIf="deviceOSTranslatable">{{ 'core.' + deviceInfo.deviceOs | translate }}</p>
<p *ngIf="!deviceOSTranslatable">{{ deviceInfo.deviceOs }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.screen">
<h2>{{ 'core.settings.screen' | translate}}</h2>
<p>{{ deviceInfo.screen | translate }}</p>
</ion-item>
<ion-item text-wrap>
<h2>{{ 'core.settings.networkstatus' | translate}}</h2>
<p>{{ 'core.' + deviceInfo.networkStatus | translate }}</p>
</ion-item>
<ion-item text-wrap>
<h2>{{ 'core.settings.wificonnection' | translate}}</h2>
<p>{{ 'core.' + deviceInfo.wifiConnection | translate }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.cordovaVersion">
<h2>{{ 'core.settings.cordovaversion' | translate}}</h2>
<p>{{ deviceInfo.cordovaVersion }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.platform">
<h2>{{ 'core.settings.cordovadeviceplatform' | translate}}</h2>
<p>{{ deviceInfo.platform }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.osVersion">
<h2>{{ 'core.settings.cordovadeviceosversion' | translate}}</h2>
<p>{{ deviceInfo.osVersion }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.model">
<h2>{{ 'core.settings.cordovadevicemodel' | translate}}</h2>
<p>{{ deviceInfo.model }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.uuid">
<h2>{{ 'core.settings.cordovadeviceuuid' | translate}}</h2>
<p>{{ deviceInfo.uuid }}</p>
</ion-item>
<ion-item text-wrap *ngIf="deviceInfo.pushId">
<h2>{{ 'core.settings.pushid' | translate}}</h2>
<p>{{ deviceInfo.pushId }}</p>
</ion-item>
<ion-item text-wrap>
<h2>{{ 'core.settings.localnotifavailable' | translate}}</h2>
<p>{{ 'core.' + deviceInfo.localNotifAvailable | translate }}</p>
</ion-item>
</ion-content>

View File

@ -0,0 +1,35 @@
// (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 { CoreSettingsDeviceInfoPage } from './deviceinfo';
import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CorePipesModule } from '@pipes/pipes.module';
@NgModule({
declarations: [
CoreSettingsDeviceInfoPage
],
imports: [
CoreComponentsModule,
CoreDirectivesModule,
CorePipesModule,
IonicPageModule.forChild(CoreSettingsDeviceInfoPage),
TranslateModule.forChild()
],
})
export class CoreSettingsDeviceInfoPageModule {}

View File

@ -0,0 +1,5 @@
page-core-settings-deviceinfo {
.item {
user-select: text;
}
}

View File

@ -0,0 +1,198 @@
// (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 } from '@angular/core';
import { IonicPage, Platform } from 'ionic-angular';
import { Device } from '@ionic-native/device';
import { CoreAppProvider } from '@providers/app';
import { CoreFileProvider } from '@providers/file';
import { CoreInitDelegate } from '@providers/init';
import { CoreLangProvider } from '@providers/lang';
import { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
import { CoreSitesProvider } from '@providers/sites';
import { CoreConfigConstants } from '../../../../configconstants';
import { CorePushNotificationsProvider } from '@core/pushnotifications/providers/pushnotifications';
/**
* Device Info to be shown and copied to clipboard.
*/
interface CoreSettingsDeviceInfo {
versionName: string;
versionCode: number;
compilationTime: number;
lastCommit: string;
siteUrl?: string;
isPrefixedUrl?: boolean;
siteId?: string;
siteVersion?: number;
fileSystemRoot?: string;
userAgent?: string;
deviceOs?: string;
browserLanguage?: string;
currentLanguage?: string;
locationHref?: string;
deviceType?: string;
screen?: string;
networkStatus: string;
wifiConnection: string;
cordovaVersion?: string;
platform?: string;
osVersion?: string;
model?: string;
uuid?: string;
pushId: string;
localNotifAvailable: string;
}
/**
* Page that displays the device information.
*/
@IonicPage({segment: 'core-settings-deviceinfo'})
@Component({
selector: 'page-core-settings-deviceinfo',
templateUrl: 'deviceinfo.html',
})
export class CoreSettingsDeviceInfoPage {
deviceInfo: CoreSettingsDeviceInfo;
currentLangName: string;
fsClickable: boolean;
deviceOSTranslatable: boolean;
constructor(platform: Platform,
device: Device,
appProvider: CoreAppProvider,
fileProvider: CoreFileProvider,
initDelegate: CoreInitDelegate,
langProvider: CoreLangProvider,
sitesProvider: CoreSitesProvider,
localNotificationsProvider: CoreLocalNotificationsProvider,
pushNotificationsProvider: CorePushNotificationsProvider,
protected utils: CoreUtilsProvider) {
this.deviceInfo = {
versionName: CoreConfigConstants.versionname,
versionCode: CoreConfigConstants.versioncode,
compilationTime: CoreConfigConstants.compilationtime,
lastCommit: CoreConfigConstants.lastcommit,
networkStatus: appProvider.isOnline() ? 'online' : 'offline',
wifiConnection: appProvider.isWifi() ? 'yes' : 'no',
localNotifAvailable: localNotificationsProvider.isAvailable() ? 'yes' : 'no',
pushId: pushNotificationsProvider.getPushId(),
};
if (window.location && window.location.href) {
const url = window.location.href;
this.deviceInfo.locationHref = url.substr(0, url.indexOf('#'));
}
const navigator = window.navigator;
if (navigator) {
if (navigator.userAgent) {
this.deviceInfo.userAgent = navigator.userAgent;
}
if (navigator.language) {
this.deviceInfo.browserLanguage = navigator.language;
}
}
if (device) {
if (device.cordova) {
this.deviceInfo.cordovaVersion = device.cordova;
}
if (device.platform) {
this.deviceInfo.platform = device.platform;
}
if (device.version) {
this.deviceInfo.osVersion = device.version;
}
if (device.model) {
this.deviceInfo.model = device.model;
}
if (device.uuid) {
this.deviceInfo.uuid = device.uuid;
}
}
this.deviceOSTranslatable = true;
if (appProvider.isMobile()) {
this.deviceInfo.deviceType = platform.is('tablet') ? 'tablet' : 'phone';
if (appProvider.isAndroid()) {
this.deviceInfo.deviceOs = 'android';
} else if (appProvider.isIOS()) {
this.deviceInfo.deviceOs = 'ios';
} else {
const matches = navigator.userAgent.match(/\(([^\)]*)\)/);
if (matches && matches.length > 1) {
this.deviceOSTranslatable = false;
this.deviceInfo.deviceOs = matches[1];
} else {
this.deviceInfo.deviceOs = 'unknown';
}
}
} else {
this.deviceInfo.deviceType = appProvider.isDesktop() ? 'desktop' : 'browser';
if (appProvider.isLinux()) {
this.deviceInfo.deviceOs = 'linux';
} else if (appProvider.isMac()) {
this.deviceInfo.deviceOs = 'mac';
} else if (appProvider.isWindows()) {
this.deviceInfo.deviceOs = 'windows';
} else {
const matches = navigator.userAgent.match(/\(([^\)]*)\)/);
if (matches && matches.length > 1) {
this.deviceOSTranslatable = false;
this.deviceInfo.deviceOs = matches[1];
} else {
this.deviceInfo.deviceOs = 'unknown';
}
}
}
langProvider.getCurrentLanguage().then((lang) => {
this.deviceInfo.currentLanguage = lang;
this.currentLangName = CoreConfigConstants.languages[lang];
});
if (fileProvider.isAvailable()) {
fileProvider.getBasePath().then((basepath) => {
this.deviceInfo.fileSystemRoot = basepath;
this.fsClickable = fileProvider.usesHTMLAPI();
});
}
if (window.screen) {
this.deviceInfo.screen = window.innerWidth + 'x' + window.innerHeight +
' (' + window.screen.width + 'x' + window.screen.height + ')';
}
const currentSite = sitesProvider.getCurrentSite();
this.deviceInfo.siteUrl = (currentSite && currentSite.getURL()) ||
(typeof CoreConfigConstants.siteurl == 'string' && CoreConfigConstants.siteurl);
this.deviceInfo.isPrefixedUrl = !!CoreConfigConstants.siteurl;
this.deviceInfo.siteId = currentSite && currentSite.getId();
this.deviceInfo.siteVersion = currentSite && currentSite.getInfo().release;
}
/**
* Copies device info into the clipboard.
*/
copyInfo(): void {
this.utils.copyToClipboard(JSON.stringify(this.deviceInfo));
}
}

View File

@ -11,6 +11,7 @@
"answered": "Answered",
"areyousure": "Are you sure?",
"back": "Back",
"browser": "Browser",
"cancel": "Cancel",
"cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle {{$a}} or later.",
"cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
@ -63,6 +64,7 @@
"deleteduser": "Deleted user",
"deleting": "Deleting",
"description": "Description",
"desktop": "Desktop",
"dfdaymonthyear": "MM-DD-YYYY",
"dfdayweekmonth": "ddd, D MMM",
"dffulldate": "dddd, D MMMM YYYY h[:]mm A",
@ -126,12 +128,14 @@
"lastmodified": "Last modified",
"lastsync": "Last synchronisation",
"layoutgrid": "Grid",
"linux": "Linux",
"list": "List",
"listsep": ",",
"loading": "Loading",
"loadmore": "Load more",
"location": "Location",
"lostconnection": "Your authentication token is invalid or has expired. You will have to reconnect to the site.",
"mac": "MacOS",
"maxsizeandattachments": "Maximum file size: {{$a.size}}, maximum number of files: {{$a.attachments}}",
"min": "min",
"mins": "mins",
@ -295,7 +299,7 @@
"whoops": "Oops!",
"whyisthishappening": "Why is this happening?",
"whyisthisrequired": "Why is this required?",
"windowsphone": "Windows Phone",
"windows": "Windows",
"wsfunctionnotavailable": "The web service function is not available.",
"year": "year",
"years": "years",