mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-06-10 00:27:49 +00:00
Request permission to show notifications
This is needed since API 33, because we show a "Vault unlocked" notification if the user has enabled encryption and has unlocked the vault.
This commit is contained in:
parent
642864fca1
commit
1e3ceefeec
7 changed files with 53 additions and 2 deletions
|
@ -1,11 +1,13 @@
|
|||
package com.beemdevelopment.aegis;
|
||||
|
||||
import android.Manifest;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.test.espresso.UiController;
|
||||
import androidx.test.espresso.ViewAction;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.rule.GrantPermissionRule;
|
||||
|
||||
import com.beemdevelopment.aegis.crypto.CryptoUtils;
|
||||
import com.beemdevelopment.aegis.crypto.SCryptParameters;
|
||||
|
@ -42,6 +44,9 @@ public abstract class AegisTest {
|
|||
@Rule
|
||||
public HiltAndroidRule hiltRule = new HiltAndroidRule(this);
|
||||
|
||||
@Rule
|
||||
public final GrantPermissionRule permRule = GrantPermissionRule.grant(Manifest.permission.POST_NOTIFICATIONS);
|
||||
|
||||
@Inject
|
||||
protected VaultManager _vaultManager;
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ public class IntroTest extends AegisTest {
|
|||
|
||||
@Test
|
||||
public void doIntro_None() {
|
||||
assertFalse(_prefs.isIntroDone());
|
||||
ViewInteraction next = onView(withId(R.id.btnNext));
|
||||
ViewInteraction prev = onView(withId(R.id.btnPrevious));
|
||||
|
||||
|
@ -98,10 +99,12 @@ public class IntroTest extends AegisTest {
|
|||
VaultRepository vault = _vaultManager.getVault();
|
||||
assertFalse(vault.isEncryptionEnabled());
|
||||
assertNull(vault.getCredentials());
|
||||
assertTrue(_prefs.isIntroDone());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doIntro_Password() {
|
||||
assertFalse(_prefs.isIntroDone());
|
||||
ViewInteraction next = onView(withId(R.id.btnNext));
|
||||
ViewInteraction prev = onView(withId(R.id.btnPrevious));
|
||||
|
||||
|
@ -129,10 +132,12 @@ public class IntroTest extends AegisTest {
|
|||
assertTrue(vault.isEncryptionEnabled());
|
||||
assertTrue(slots.has(PasswordSlot.class));
|
||||
assertFalse(slots.has(BiometricSlot.class));
|
||||
assertTrue(_prefs.isIntroDone());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doIntro_Import_Plain() {
|
||||
assertFalse(_prefs.isIntroDone());
|
||||
Uri uri = getResourceUri("aegis_plain.json");
|
||||
Intent resultData = new Intent();
|
||||
resultData.setData(uri);
|
||||
|
@ -147,10 +152,12 @@ public class IntroTest extends AegisTest {
|
|||
VaultRepository vault = _vaultManager.getVault();
|
||||
assertFalse(vault.isEncryptionEnabled());
|
||||
assertNull(vault.getCredentials());
|
||||
assertTrue(_prefs.isIntroDone());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doIntro_Import_Encrypted() {
|
||||
assertFalse(_prefs.isIntroDone());
|
||||
Uri uri = getResourceUri("aegis_encrypted.json");
|
||||
Intent resultData = new Intent();
|
||||
resultData.setData(uri);
|
||||
|
@ -169,6 +176,7 @@ public class IntroTest extends AegisTest {
|
|||
assertTrue(vault.isEncryptionEnabled());
|
||||
assertTrue(slots.has(PasswordSlot.class));
|
||||
assertFalse(slots.has(BiometricSlot.class));
|
||||
assertTrue(_prefs.isIntroDone());
|
||||
}
|
||||
|
||||
private Uri getResourceUri(String resourceName) {
|
||||
|
|
|
@ -75,6 +75,7 @@ public class OverallTest extends AegisTest {
|
|||
VaultRepository vault = _vaultManager.getVault();
|
||||
assertTrue(vault.isEncryptionEnabled());
|
||||
assertTrue(vault.getCredentials().getSlots().has(PasswordSlot.class));
|
||||
assertTrue(_prefs.isIntroDone());
|
||||
|
||||
List<VaultEntry> entries = Arrays.asList(
|
||||
generateEntry(TotpInfo.class, "Frank", "Google"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue