Skip to content

Commit

Permalink
Issue #SB-17879 added: to normalise sharedPreferences with localStora…
Browse files Browse the repository at this point in the history
…ge values
  • Loading branch information
arafath committed Feb 24, 2020
1 parent 2052cf3 commit 2cc337e
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/util/shared-preferences/impl/shared-preferences-android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<undefined> {
Expand Down Expand Up @@ -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);
});
});
});
}
}
}

0 comments on commit 2cc337e

Please sign in to comment.