mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
@ -67,8 +67,6 @@ class DeviceRef {
|
|||||||
private _sdkVersion: string;
|
private _sdkVersion: string;
|
||||||
private _deviceType: 'Phone' | 'Tablet';
|
private _deviceType: 'Phone' | 'Tablet';
|
||||||
private _uuid: string;
|
private _uuid: string;
|
||||||
private _language: string;
|
|
||||||
private _region: string;
|
|
||||||
|
|
||||||
get manufacturer(): string {
|
get manufacturer(): string {
|
||||||
if (!this._manufacturer) {
|
if (!this._manufacturer) {
|
||||||
@ -130,19 +128,11 @@ class DeviceRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get language(): string {
|
get language(): string {
|
||||||
if (!this._language) {
|
return java.util.Locale.getDefault().getLanguage().replace('_', '-');
|
||||||
this._language = java.util.Locale.getDefault().getLanguage().replace('_', '-');
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._language;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get region(): string {
|
get region(): string {
|
||||||
if (!this._region) {
|
return java.util.Locale.getDefault().getCountry();
|
||||||
this._region = java.util.Locale.getDefault().getCountry();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._region;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@ class DeviceRef {
|
|||||||
private _osVersion: string;
|
private _osVersion: string;
|
||||||
private _sdkVersion: string;
|
private _sdkVersion: string;
|
||||||
private _deviceType: 'Phone' | 'Tablet';
|
private _deviceType: 'Phone' | 'Tablet';
|
||||||
private _language: string;
|
|
||||||
private _region: string;
|
|
||||||
|
|
||||||
get manufacturer(): string {
|
get manufacturer(): string {
|
||||||
return 'Apple';
|
return 'Apple';
|
||||||
@ -72,20 +70,11 @@ class DeviceRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get language(): string {
|
get language(): string {
|
||||||
if (!this._language) {
|
return NSLocale.preferredLanguages[0];
|
||||||
const languages = NSLocale.preferredLanguages;
|
|
||||||
this._language = languages[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._language;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get region(): string {
|
get region(): string {
|
||||||
if (!this._region) {
|
return NSLocale.currentLocale.objectForKey(NSLocaleCountryCode);
|
||||||
this._region = NSLocale.currentLocale.objectForKey(NSLocaleCountryCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._region;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user