diff --git a/app/src/main/java/com/beemdevelopment/aegis/ui/IntroActivity.java b/app/src/main/java/com/beemdevelopment/aegis/ui/IntroActivity.java index 6ee4b243..72b65bb2 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ui/IntroActivity.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ui/IntroActivity.java @@ -8,8 +8,8 @@ import androidx.fragment.app.Fragment; import com.beemdevelopment.aegis.AegisApplication; import com.beemdevelopment.aegis.Preferences; import com.beemdevelopment.aegis.R; -import com.beemdevelopment.aegis.ui.slides.CustomAuthenticatedSlide; -import com.beemdevelopment.aegis.ui.slides.CustomAuthenticationSlide; +import com.beemdevelopment.aegis.ui.slides.SecuritySetupSlide; +import com.beemdevelopment.aegis.ui.slides.SecurityPickerSlide; import com.beemdevelopment.aegis.vault.Vault; import com.beemdevelopment.aegis.vault.VaultFile; import com.beemdevelopment.aegis.vault.VaultFileCredentials; @@ -23,8 +23,8 @@ import com.github.appintro.model.SliderPage; import org.json.JSONObject; public class IntroActivity extends AppIntro2 { - private CustomAuthenticatedSlide _authenticatedSlide; - private CustomAuthenticationSlide _authenticationSlide; + private SecuritySetupSlide securitySetupSlide; + private SecurityPickerSlide _securityPickerSlide; private Fragment _endSlide; private AegisApplication _app; @@ -56,12 +56,12 @@ public class IntroActivity extends AppIntro2 { homeSliderPage.setBackgroundColor(getResources().getColor(R.color.colorSecondary)); addSlide(AppIntroFragment.newInstance(homeSliderPage)); - _authenticationSlide = new CustomAuthenticationSlide(); - _authenticationSlide.setBgColor(getResources().getColor(R.color.colorSecondary)); - addSlide(_authenticationSlide); - _authenticatedSlide = new CustomAuthenticatedSlide(); - _authenticatedSlide.setBgColor(getResources().getColor(R.color.colorSecondary)); - addSlide(_authenticatedSlide); + _securityPickerSlide = new SecurityPickerSlide(); + _securityPickerSlide.setBgColor(getResources().getColor(R.color.colorSecondary)); + addSlide(_securityPickerSlide); + securitySetupSlide = new SecuritySetupSlide(); + securitySetupSlide.setBgColor(getResources().getColor(R.color.colorSecondary)); + addSlide(securitySetupSlide); SliderPage endSliderPage = new SliderPage(); endSliderPage.setTitle(getString(R.string.setup_completed)); @@ -74,10 +74,10 @@ public class IntroActivity extends AppIntro2 { @Override public void onSlideChanged(Fragment oldFragment, Fragment newFragment) { - if (oldFragment == _authenticationSlide && newFragment != _endSlide) { + if (oldFragment == _securityPickerSlide && newFragment != _endSlide) { // skip to the last slide if no encryption will be used - int cryptType = getIntent().getIntExtra("cryptType", CustomAuthenticationSlide.CRYPT_TYPE_INVALID); - if (cryptType == CustomAuthenticationSlide.CRYPT_TYPE_NONE) { + int cryptType = getIntent().getIntExtra("cryptType", SecurityPickerSlide.CRYPT_TYPE_INVALID); + if (cryptType == SecurityPickerSlide.CRYPT_TYPE_NONE) { // TODO: no magic indices goToNextSlide(false); } @@ -90,14 +90,14 @@ public class IntroActivity extends AppIntro2 { public void onDonePressed(Fragment currentFragment) { super.onDonePressed(currentFragment); - int cryptType = _authenticatedSlide.getCryptType(); - VaultFileCredentials creds = _authenticatedSlide.getCredentials(); + int cryptType = securitySetupSlide.getCryptType(); + VaultFileCredentials creds = securitySetupSlide.getCredentials(); Vault vault = new Vault(); VaultFile vaultFile = new VaultFile(); try { JSONObject obj = vault.toJson(); - if (cryptType == CustomAuthenticationSlide.CRYPT_TYPE_NONE) { + if (cryptType == SecurityPickerSlide.CRYPT_TYPE_NONE) { vaultFile.setContent(obj); } else { vaultFile.setContent(obj, creds); @@ -110,7 +110,7 @@ public class IntroActivity extends AppIntro2 { return; } - if (cryptType == CustomAuthenticationSlide.CRYPT_TYPE_NONE) { + if (cryptType == SecurityPickerSlide.CRYPT_TYPE_NONE) { _app.initVaultManager(vault, null); } else { _app.initVaultManager(vault, creds); diff --git a/app/src/main/java/com/beemdevelopment/aegis/ui/slides/CustomAuthenticationSlide.java b/app/src/main/java/com/beemdevelopment/aegis/ui/slides/SecurityPickerSlide.java similarity index 92% rename from app/src/main/java/com/beemdevelopment/aegis/ui/slides/CustomAuthenticationSlide.java rename to app/src/main/java/com/beemdevelopment/aegis/ui/slides/SecurityPickerSlide.java index 216a696a..436dd62c 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ui/slides/CustomAuthenticationSlide.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ui/slides/SecurityPickerSlide.java @@ -16,7 +16,7 @@ import com.beemdevelopment.aegis.helpers.BiometricsHelper; import com.github.appintro.SlidePolicy; import com.google.android.material.snackbar.Snackbar; -public class CustomAuthenticationSlide extends Fragment implements SlidePolicy, RadioGroup.OnCheckedChangeListener { +public class SecurityPickerSlide extends Fragment implements SlidePolicy, RadioGroup.OnCheckedChangeListener { public static final int CRYPT_TYPE_INVALID = 0; public static final int CRYPT_TYPE_NONE = 1; public static final int CRYPT_TYPE_PASS = 2; @@ -27,7 +27,7 @@ public class CustomAuthenticationSlide extends Fragment implements SlidePolicy, @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - final View view = inflater.inflate(R.layout.fragment_authentication_slide, container, false); + final View view = inflater.inflate(R.layout.fragment_security_picker_slide, container, false); _buttonGroup = view.findViewById(R.id.rg_authenticationMethod); _buttonGroup.setOnCheckedChangeListener(this); onCheckedChanged(_buttonGroup, _buttonGroup.getCheckedRadioButtonId()); diff --git a/app/src/main/java/com/beemdevelopment/aegis/ui/slides/CustomAuthenticatedSlide.java b/app/src/main/java/com/beemdevelopment/aegis/ui/slides/SecuritySetupSlide.java similarity index 90% rename from app/src/main/java/com/beemdevelopment/aegis/ui/slides/CustomAuthenticatedSlide.java rename to app/src/main/java/com/beemdevelopment/aegis/ui/slides/SecuritySetupSlide.java index 7f9b2e8b..e9984f73 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ui/slides/CustomAuthenticatedSlide.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ui/slides/SecuritySetupSlide.java @@ -32,7 +32,7 @@ import com.google.android.material.snackbar.Snackbar; import javax.crypto.Cipher; import javax.crypto.SecretKey; -public class CustomAuthenticatedSlide extends Fragment implements SlidePolicy, SlideSelectionListener { +public class SecuritySetupSlide extends Fragment implements SlidePolicy, SlideSelectionListener { private int _bgColor; private EditText _textPassword; private EditText _textPasswordConfirm; @@ -43,7 +43,7 @@ public class CustomAuthenticatedSlide extends Fragment implements SlidePolicy, S @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - final View view = inflater.inflate(R.layout.fragment_authenticated_slide, container, false); + final View view = inflater.inflate(R.layout.fragment_security_setup_slide, container, false); _textPassword = view.findViewById(R.id.text_password); _textPasswordConfirm = view.findViewById(R.id.text_password_confirm); _checkPasswordVisibility = view.findViewById(R.id.check_toggle_visibility); @@ -94,8 +94,8 @@ public class CustomAuthenticatedSlide extends Fragment implements SlidePolicy, S @Override public void onSlideSelected() { Intent intent = getActivity().getIntent(); - _cryptType = intent.getIntExtra("cryptType", CustomAuthenticationSlide.CRYPT_TYPE_INVALID); - if (_cryptType != CustomAuthenticationSlide.CRYPT_TYPE_NONE) { + _cryptType = intent.getIntExtra("cryptType", SecurityPickerSlide.CRYPT_TYPE_INVALID); + if (_cryptType != SecurityPickerSlide.CRYPT_TYPE_NONE) { _creds = new VaultFileCredentials(); } } @@ -108,14 +108,14 @@ public class CustomAuthenticatedSlide extends Fragment implements SlidePolicy, S @Override public boolean isPolicyRespected() { switch (_cryptType) { - case CustomAuthenticationSlide.CRYPT_TYPE_NONE: + case SecurityPickerSlide.CRYPT_TYPE_NONE: return true; - case CustomAuthenticationSlide.CRYPT_TYPE_BIOMETRIC: + case SecurityPickerSlide.CRYPT_TYPE_BIOMETRIC: if (!_creds.getSlots().has(BiometricSlot.class)) { return false; } // intentional fallthrough - case CustomAuthenticationSlide.CRYPT_TYPE_PASS: + case SecurityPickerSlide.CRYPT_TYPE_PASS: if (EditTextHelper.areEditTextsEqual(_textPassword, _textPasswordConfirm)) { return _creds.getSlots().has(PasswordSlot.class); } @@ -137,7 +137,7 @@ public class CustomAuthenticatedSlide extends Fragment implements SlidePolicy, S Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_LONG); snackbar.show(); } - } else if (_cryptType != CustomAuthenticationSlide.CRYPT_TYPE_BIOMETRIC) { + } else if (_cryptType != SecurityPickerSlide.CRYPT_TYPE_BIOMETRIC) { deriveKey(); } else if (!_creds.getSlots().has(BiometricSlot.class)) { showBiometricPrompt(); diff --git a/app/src/main/res/layout/fragment_authentication_slide.xml b/app/src/main/res/layout/fragment_security_picker_slide.xml similarity index 100% rename from app/src/main/res/layout/fragment_authentication_slide.xml rename to app/src/main/res/layout/fragment_security_picker_slide.xml diff --git a/app/src/main/res/layout/fragment_authenticated_slide.xml b/app/src/main/res/layout/fragment_security_setup_slide.xml similarity index 100% rename from app/src/main/res/layout/fragment_authenticated_slide.xml rename to app/src/main/res/layout/fragment_security_setup_slide.xml