Improve backup error handling and frequency

This patch improves our backup functionality in a number of ways:
- Only backup the vault when important changes are made, not when the order of
  entries is changed, for instance.
- Don't bubble up backup errors when saving the vault.
- Instead, show an error bar in the main view if the most recent backup attempt
  failed.

<img src="https://alexbakker.me/u/kbhhj2hcgx.png" width="300" />

Clicking on the error bar will take the user to the backup settings.
This commit is contained in:
Alexander Bakker 2020-06-13 12:45:02 +02:00
parent ae5502b650
commit 08ab8237e7
11 changed files with 116 additions and 28 deletions

View file

@ -8,12 +8,43 @@
android:fitsSystemWindows="true"
tools:context="com.beemdevelopment.aegis.ui.MainActivity">
<fragment
android:name="com.beemdevelopment.aegis.ui.views.EntryListView"
android:id="@+id/key_profiles"
android:layout_height="match_parent"
<LinearLayout
android:layout_width="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"/>
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/btn_backup_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone"
android:clickable="true"
android:focusable="true"
android:paddingHorizontal="10dp"
android:paddingVertical="10dp"
android:background="@color/colorAccent"
android:foreground="?android:selectableItemBackground"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/icon_primary_inverted"
android:src="@drawable/ic_alert_black_24dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/backup_error_bar_message"
android:textColor="@color/primary_text_inverted"
android:layout_marginStart="5dp" />
</LinearLayout>
<fragment
android:name="com.beemdevelopment.aegis.ui.views.EntryListView"
android:id="@+id/key_profiles"
android:layout_height="fill_parent"
android:layout_width="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"/>
</LinearLayout>
<!-- note: the fab should always be the last element to be sure it's displayed on top -->
<com.getbase.floatingactionbutton.FloatingActionsMenu