From 2cc337eea25eb627aee22e43429c1113162bf279 Mon Sep 17 00:00:00 2001 From: arafath Date: Mon, 24 Feb 2020 14:39:49 +0530 Subject: [PATCH] Issue #SB-17879 added: to normalise sharedPreferences with localStorage values --- .../impl/shared-preferences-android.ts | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/util/shared-preferences/impl/shared-preferences-android.ts b/src/util/shared-preferences/impl/shared-preferences-android.ts index de8d1f93e..72a330dbb 100644 --- a/src/util/shared-preferences/impl/shared-preferences-android.ts +++ b/src/util/shared-preferences/impl/shared-preferences-android.ts @@ -19,16 +19,16 @@ export class SharedPreferencesAndroid implements SharedPreferences { return this.putString(key, value).pipe( mapTo(value) ); - } - - return new Observable((observer) => { - this.sharedPreferences.getString(key, '', (v) => { - observer.next(v); - observer.complete(); - }, (e) => { - observer.error(e); + } else { + return new Observable((observer) => { + this.sharedPreferences.getString(key, '', (v) => { + observer.next(v); + observer.complete(); + }, (e) => { + observer.error(e); + }); }); - }); + } } public putString(key: string, value: string): Observable { @@ -62,15 +62,15 @@ export class SharedPreferencesAndroid implements SharedPreferences { return this.putBoolean(key, value === 'true').pipe( mapTo(value === 'true') ); - } - - return new Observable((observer) => { - this.sharedPreferences.getBoolean(key, false, (v) => { - observer.next(v); - observer.complete(); - }, (e) => { - observer.error(e); + } else { + return new Observable((observer) => { + this.sharedPreferences.getBoolean(key, false, (v) => { + observer.next(v); + observer.complete(); + }, (e) => { + observer.error(e); + }); }); - }); + } } }