fix(Device): don't cache device language & region (#9394)

closes #6082
This commit is contained in:
Osei Fortune
2021-05-12 15:51:35 -04:00
committed by GitHub
parent 7e878f83a3
commit 95596e8230
2 changed files with 4 additions and 25 deletions

View File

@ -67,8 +67,6 @@ class DeviceRef {
private _sdkVersion: string;
private _deviceType: 'Phone' | 'Tablet';
private _uuid: string;
private _language: string;
private _region: string;
get manufacturer(): string {
if (!this._manufacturer) {
@ -130,19 +128,11 @@ class DeviceRef {
}
get language(): string {
if (!this._language) {
this._language = java.util.Locale.getDefault().getLanguage().replace('_', '-');
}
return this._language;
return java.util.Locale.getDefault().getLanguage().replace('_', '-');
}
get region(): string {
if (!this._region) {
this._region = java.util.Locale.getDefault().getCountry();
}
return this._region;
return java.util.Locale.getDefault().getCountry();
}
}

View File

@ -10,8 +10,6 @@ class DeviceRef {
private _osVersion: string;
private _sdkVersion: string;
private _deviceType: 'Phone' | 'Tablet';
private _language: string;
private _region: string;
get manufacturer(): string {
return 'Apple';
@ -72,20 +70,11 @@ class DeviceRef {
}
get language(): string {
if (!this._language) {
const languages = NSLocale.preferredLanguages;
this._language = languages[0];
}
return this._language;
return NSLocale.preferredLanguages[0];
}
get region(): string {
if (!this._region) {
this._region = NSLocale.currentLocale.objectForKey(NSLocaleCountryCode);
}
return this._region;
return NSLocale.currentLocale.objectForKey(NSLocaleCountryCode);
}
}