From 95596e82302bb945e6bf2126f19d9245e358cb79 Mon Sep 17 00:00:00 2001 From: Osei Fortune Date: Wed, 12 May 2021 15:51:35 -0400 Subject: [PATCH] fix(Device): don't cache device language & region (#9394) closes #6082 --- packages/core/platform/index.android.ts | 14 ++------------ packages/core/platform/index.ios.ts | 15 ++------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/packages/core/platform/index.android.ts b/packages/core/platform/index.android.ts index e174b7025..547ead8db 100644 --- a/packages/core/platform/index.android.ts +++ b/packages/core/platform/index.android.ts @@ -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(); } } diff --git a/packages/core/platform/index.ios.ts b/packages/core/platform/index.ios.ts index 291896615..e40edf552 100644 --- a/packages/core/platform/index.ios.ts +++ b/packages/core/platform/index.ios.ts @@ -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); } }