Disable reset for Gnuk token version < 1.2.5
This commit is contained in:
@@ -98,6 +98,7 @@ class ManageSecurityTokenContract {
|
||||
|
||||
void requestStoragePermission();
|
||||
|
||||
void showErrorCannotReset(boolean isGnuk);
|
||||
void showErrorCannotUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,6 +352,15 @@ public class ManageSecurityTokenFragment extends Fragment implements ManageSecur
|
||||
Notify.create(getActivity(), R.string.token_error_locked_indefinitely, Style.ERROR).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showErrorCannotReset(boolean isGnuk) {
|
||||
if (isGnuk) {
|
||||
Notify.create(getActivity(), R.string.token_error_cannot_reset_gnuk_old, Style.ERROR).show();
|
||||
} else {
|
||||
Notify.create(getActivity(), R.string.token_error_cannot_reset, Style.ERROR).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showDisplayLogActivity(OperationResult result) {
|
||||
Intent intent = new Intent(getActivity(), LogDisplayActivity.class);
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.sufficientlysecure.keychain.operations.results.GenericOperationResult
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo;
|
||||
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TokenType;
|
||||
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenContract.ManageSecurityTokenMvpPresenter;
|
||||
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenContract.ManageSecurityTokenMvpView;
|
||||
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenFragment.StatusLine;
|
||||
@@ -362,6 +363,14 @@ class ManageSecurityTokenPresenter implements ManageSecurityTokenMvpPresenter {
|
||||
|
||||
@Override
|
||||
public void onClickResetToken() {
|
||||
if (!tokenInfo.isResetSupported()) {
|
||||
TokenType tokenType = tokenInfo.getTokenType();
|
||||
boolean isGnuk = tokenType == TokenType.GNUK_OLD || tokenType == TokenType.GNUK_UNKNOWN;
|
||||
|
||||
view.showErrorCannotReset(isGnuk);
|
||||
return;
|
||||
}
|
||||
|
||||
view.showConfirmResetDialog();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user