-
- {{ 'core.settings.deviceinfo' | translate }}
-
-
- {{ 'core.settings.versionname' | translate}}
- {{ versionName }}
-
-
- {{ 'core.settings.versioncode' | translate}}
- {{ versionCode }}
-
-
- {{ 'core.settings.compilationinfo' | translate }}
- {{ compilationTime | coreFormatDate: "LLL Z": false }}
- {{ lastCommit }}
-
-
- {{ 'core.settings.filesystemroot' | translate}}
- {{ fileSystemRoot }}
- {{ fileSystemRoot }}
-
-
- {{ 'core.settings.navigatoruseragent' | translate}}
- {{ navigator.userAgent }}
-
-
- {{ 'core.settings.navigatorlanguage' | translate}}
- {{ navigator.language }}
-
-
- {{ 'core.settings.locationhref' | translate}}
- {{ locationHref }}
-
-
- {{ 'core.settings.appready' | translate}}
- {{ appReady | translate }}
-
-
- {{ 'core.settings.displayformat' | translate}}
- {{ deviceType | translate }}
-
-
- {{ 'core.settings.deviceos' | translate}}
- {{ deviceOs | translate }}
-
-
- {{ 'core.settings.currentlanguage' | translate}}
- {{ currentLanguage }}
-
-
- {{ 'core.settings.networkstatus' | translate}}
- {{ networkStatus | translate }}
-
-
- {{ 'core.settings.wificonnection' | translate}}
- {{ wifiConnection | translate }}
-
-
- {{ 'core.settings.devicewebworkers' | translate}}
- {{ deviceWebWorkers | translate }}
-
-
- {{ 'core.settings.cordovaversion' | translate}}
- {{ device.cordova }}
-
-
- {{ 'core.settings.cordovadeviceplatform' | translate}}
- {{ device.platform }}
-
-
- {{ 'core.settings.cordovadeviceosversion' | translate}}
- {{ device.version }}
-
-
- {{ 'core.settings.cordovadevicemodel' | translate}}
- {{ device.model }}
-
-
- {{ 'core.settings.cordovadeviceuuid' | translate}}
- {{ device.uuid }}
-
-
- {{ 'core.settings.pushid' | translate}}
- {{ pushId }}
-
-
- {{ 'core.settings.localnotifavailable' | translate}}
- {{ localNotifAvailable | translate }}
-
-
+
+
+ {{ 'core.settings.appversion' | translate}}
+ {{ deviceInfo.versionName }} ({{ deviceInfo.versionCode }})
+
+
+ {{ 'core.settings.compilationinfo' | translate }}
+ {{ deviceInfo.compilationTime | coreFormatDate: "LLL Z": false }}
+ {{ deviceInfo.lastCommit }}
+
+
+ {{ 'core.settings.siteinfo' | translate }} *
+ {{ deviceInfo.siteUrl }}
+ {{ deviceInfo.siteVersion }}
+ {{ deviceInfo.siteId }}
+
+
+ {{ 'core.settings.filesystemroot' | translate}}
+ {{ deviceInfo.fileSystemRoot }}
+ {{ deviceInfo.fileSystemRoot }}
+
+
+ {{ 'core.settings.navigatoruseragent' | translate}}
+ {{ deviceInfo.userAgent }}
+
+
+ {{ 'core.settings.navigatorlanguage' | translate}}
+ {{ deviceInfo.browserLanguage }}
+
+
+ {{ 'core.settings.currentlanguage' | translate}}
+ {{ currentLangName }} ({{ deviceInfo.currentLanguage }})
+
+
+ {{ 'core.settings.locationhref' | translate}}
+ {{ deviceInfo.locationHref }}
+
+
+ {{ 'core.settings.displayformat' | translate}}
+ {{ 'core.' + deviceInfo.deviceType | translate }}
+
+
+ {{ 'core.settings.deviceos' | translate}}
+ {{ 'core.' + deviceInfo.deviceOs | translate }}
+ {{ deviceInfo.deviceOs }}
+
+
+ {{ 'core.settings.screen' | translate}}
+ {{ deviceInfo.screen | translate }}
+
+
+ {{ 'core.settings.networkstatus' | translate}}
+ {{ 'core.' + deviceInfo.networkStatus | translate }}
+
+
+ {{ 'core.settings.wificonnection' | translate}}
+ {{ 'core.' + deviceInfo.wifiConnection | translate }}
+
+
+ {{ 'core.settings.cordovaversion' | translate}}
+ {{ deviceInfo.cordovaVersion }}
+
+
+ {{ 'core.settings.cordovadeviceplatform' | translate}}
+ {{ deviceInfo.platform }}
+
+
+ {{ 'core.settings.cordovadeviceosversion' | translate}}
+ {{ deviceInfo.osVersion }}
+
+
+ {{ 'core.settings.cordovadevicemodel' | translate}}
+ {{ deviceInfo.model }}
+
+
+ {{ 'core.settings.cordovadeviceuuid' | translate}}
+ {{ deviceInfo.uuid }}
+
+
+ {{ 'core.settings.pushid' | translate}}
+ {{ deviceInfo.pushId }}
+
+
+ {{ 'core.settings.localnotifavailable' | translate}}
+ {{ 'core.' + deviceInfo.localNotifAvailable | translate }}
+
+
diff --git a/src/core/settings/pages/deviceinfo/deviceinfo.module.ts b/src/core/settings/pages/deviceinfo/deviceinfo.module.ts
new file mode 100644
index 000000000..7c192b47a
--- /dev/null
+++ b/src/core/settings/pages/deviceinfo/deviceinfo.module.ts
@@ -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 {}
diff --git a/src/core/settings/pages/deviceinfo/deviceinfo.scss b/src/core/settings/pages/deviceinfo/deviceinfo.scss
new file mode 100644
index 000000000..79511592c
--- /dev/null
+++ b/src/core/settings/pages/deviceinfo/deviceinfo.scss
@@ -0,0 +1,5 @@
+page-core-settings-deviceinfo {
+ .item {
+ user-select: text;
+ }
+}
\ No newline at end of file
diff --git a/src/core/settings/pages/deviceinfo/deviceinfo.ts b/src/core/settings/pages/deviceinfo/deviceinfo.ts
new file mode 100644
index 000000000..72dd9426b
--- /dev/null
+++ b/src/core/settings/pages/deviceinfo/deviceinfo.ts
@@ -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));
+ }
+
+}
diff --git a/src/lang/en.json b/src/lang/en.json
index 34a7890d1..5ca62b1b9 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -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",