diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java index b54156d..b905b71 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java @@ -338,9 +338,11 @@ public class MainActivity extends BaseActivity { } } + @Override - protected void onPause() { - super.onPause(); + protected void onStop() { + super.onStop(); + // OTPDatabase.unloadDatabase(); } @Override diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/scanner/QRScannerActivity.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/scanner/QRScannerActivity.java index 063f92c..5bf9a80 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/scanner/QRScannerActivity.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/scanner/QRScannerActivity.java @@ -27,6 +27,7 @@ import androidx.camera.core.SurfaceOrientedMeteringPointFactory; import androidx.camera.lifecycle.ProcessCameraProvider; import androidx.core.content.ContextCompat; +import com.cringe_studios.cringe_authenticator.BaseActivity; import com.cringe_studios.cringe_authenticator.R; import com.cringe_studios.cringe_authenticator.databinding.ActivityQrScannerBinding; import com.cringe_studios.cringe_authenticator.model.OTPData; @@ -42,7 +43,7 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutionException; -public class QRScannerActivity extends AppCompatActivity { +public class QRScannerActivity extends BaseActivity { public static final int RESULT_ERROR = -2; @@ -63,7 +64,7 @@ public class QRScannerActivity extends AppCompatActivity { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { - requestPermissions(new String[] {Manifest.permission.CAMERA}, 1234); + requestPermissions(new String[] {Manifest.permission.CAMERA}, 1234); // TODO: handle denied } binding = ActivityQrScannerBinding.inflate(getLayoutInflater()); diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/util/OTPDatabase.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/util/OTPDatabase.java index fa1d1e2..92b7bf7 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/util/OTPDatabase.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/util/OTPDatabase.java @@ -71,10 +71,6 @@ public class OTPDatabase { return; } - if(!(ctx instanceof BaseActivity)) { - throw new RuntimeException("NOT BASEACTIVITY"); - } - if(!SettingsUtil.isDatabaseEncrypted(ctx)) { try { loadDatabase(ctx, null); @@ -85,17 +81,6 @@ public class OTPDatabase { return; } - /*DialogUtil.showInputPasswordDialog(ctx, password -> { - try { - SecretKey key = Crypto.generateKey(SettingsUtil.getCryptoParameters(ctx), password); - loadDatabase(ctx, key); - if (success != null) success.run(); - }catch(CryptoException e) { - DialogUtil.showErrorDialog(ctx, "Failed to load database: Invalid password or database corrupted", failure); - } catch (OTPDatabaseException e) { - DialogUtil.showErrorDialog(ctx, "Failed to load database: " + e, failure); - } - }, failure);*/ ((BaseActivity) ctx).promptUnlock(success, failure); } diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/util/OTPParser.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/util/OTPParser.java index 7263165..f4e0376 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/util/OTPParser.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/util/OTPParser.java @@ -172,10 +172,9 @@ public class OTPParser { } try { - // 0 or null for defaults (handled by Cringe-Authenticator-Library) - OTPAlgorithm fAlgorithm = algorithm == null ? null : OTPAlgorithm.valueOf(algorithm.toUpperCase()); - int fDigits = digits == null ? 0 : Integer.parseInt(digits); - int fPeriod = period == null ? 0 : Integer.parseInt(period); + OTPAlgorithm fAlgorithm = algorithm == null ? OTPAlgorithm.SHA1 : OTPAlgorithm.valueOf(algorithm.toUpperCase()); + int fDigits = digits == null ? 6 : Integer.parseInt(digits); + int fPeriod = period == null ? 30 : Integer.parseInt(period); int fCounter = counter == null ? 0 : Integer.parseInt(counter); boolean fChecksum = false; if(checksum != null) { diff --git a/app/src/main/res/drawable/ic_hamburger.xml b/app/src/main/res/drawable/ic_hamburger.xml index 97d9a1b..e2c84af 100644 --- a/app/src/main/res/drawable/ic_hamburger.xml +++ b/app/src/main/res/drawable/ic_hamburger.xml @@ -2,7 +2,8 @@ android:width="48dp" android:height="48dp" android:viewportWidth="960" - android:viewportHeight="960"> + android:viewportHeight="960" + android:tint="?android:attr/textColor">