Update KeychainModule.java
This commit is contained in:
parent
e335c69ce9
commit
7e3b8642bd
|
@ -118,16 +118,15 @@ public class KeychainModule extends ReactContextBaseJavaModule {
|
|||
@ReactMethod
|
||||
public void resetGenericPasswordForService(String service, Callback callback) {
|
||||
service = service == null ? "" : service;
|
||||
SharedPreferences.Editor prefsEditor = prefs.edit();
|
||||
|
||||
try {
|
||||
SharedPreferences.Editor prefsEditor = prefs.edit();
|
||||
if (prefs.contains(service + ":u")) {
|
||||
prefsEditor.remove(service + ":u");
|
||||
prefsEditor.remove(service + ":p");
|
||||
prefsEditor.apply();
|
||||
callback.invoke("", "KeychainModule password was reset");
|
||||
} catch (Exception e) {
|
||||
//this probably never happens but it is here so that the android api is the same as on iOS
|
||||
callback.invoke(e.getLocalizedMessage());
|
||||
} else {
|
||||
callback.invoke("Error when resetting password: entry not found for service: " + service);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue