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