Repository: alphawallet/alpha-wallet-android
Issue: Unnecessary prompt to backup wallet after keystore import

- Import from keystore
- enter keystore password
- authorise OS
- (wallet imported and taken to wallet tab)
- shows prompt to backup wallet
- Expect: no prompt to backup imported wallet?
- click on Settings, `Back up this Wallet` already shown as 100% secure

Changed files:
app/src/main/java/com/alphawallet/app/ui/HomeActivity.java, app/src/main/java/com/alphawallet/app/viewmodel/WalletViewModel.java, app/src/main/java/com/alphawallet/app/ui/WalletFragment.java

diff --git a/app/src/main/java/com/alphawallet/app/ui/HomeActivity.java b/app/src/main/java/com/alphawallet/app/ui/HomeActivity.java
index d439f3df0..b12560a7e 100644
--- a/app/src/main/java/com/alphawallet/app/ui/HomeActivity.java
+++ b/app/src/main/java/com/alphawallet/app/ui/HomeActivity.java
@@ -222,7 +222,6 @@ public class HomeActivity extends BaseNavigationActivity implements View.OnClick
         }
 
         viewModel.cleanDatabases(this);
-        showBackupWalletDialog();
     }
 
     private void onBackup(String address)
@@ -233,23 +232,32 @@ public class HomeActivity extends BaseNavigationActivity implements View.OnClick
         }
     }
 
-    public void showBackupWalletDialog() {
-        if (!viewModel.isFindWalletAddressDialogShown()) {
-            int lighterBackground = Color.argb(102, 0, 0, 0); //40% opacity
-            backupWalletDialog = TutoShowcase.from(this);
-            backupWalletDialog.setContentView(R.layout.showcase_backup_wallet)
-                    .setBackgroundColor(lighterBackground)
-                    .onClickContentView(R.id.btn_close, view -> {
-                        backupWalletDialog.dismiss();
-                    })
-                    .on(R.id.settings_tab)
-                    .addCircle()
-                    .onClick(v -> {
-                        backupWalletDialog.dismiss();
-                        showPage(SETTINGS);
-                    })
-                    .show();
-            viewModel.setFindWalletAddressDialogShown(true);
+    public void showBackupWalletDialog(boolean walletImported) {
+        if (!viewModel.isFindWalletAddressDialogShown())
+        {
+            //check if wallet was imported - in which case no need to display
+            if (walletImported)
+            {
+                viewModel.setFindWalletAddressDialogShown(true);
+            }
+            else
+            {
+                int lighterBackground = Color.argb(102, 0, 0, 0); //40% opacity
+                backupWalletDialog = TutoShowcase.from(this);
+                backupWalletDialog.setContentView(R.layout.showcase_backup_wallet)
+                        .setBackgroundColor(lighterBackground)
+                        .onClickContentView(R.id.btn_close, view -> {
+                            backupWalletDialog.dismiss();
+                        })
+                        .on(R.id.settings_tab)
+                        .addCircle()
+                        .onClick(v -> {
+                            backupWalletDialog.dismiss();
+                            showPage(SETTINGS);
+                        })
+                        .show();
+                viewModel.setFindWalletAddressDialogShown(true);
+            }
         }
     }
 
diff --git a/app/src/main/java/com/alphawallet/app/ui/WalletFragment.java b/app/src/main/java/com/alphawallet/app/ui/WalletFragment.java
index 520d3b03e..e24851af1 100644
--- a/app/src/main/java/com/alphawallet/app/ui/WalletFragment.java
+++ b/app/src/main/java/com/alphawallet/app/ui/WalletFragment.java
@@ -101,6 +101,7 @@ public class WalletFragment extends Fragment implements OnTokenClickListener, Vi
         viewModel.tokenUpdate().observe(this, this::onToken);
         viewModel.tokensReady().observe(this, this::tokensReady);
         viewModel.backupEvent().observe(this, this::backupEvent);
+        viewModel.defaultWallet().observe(this, this::onDefaultWallet);
 
         adapter = new TokensAdapter(this, viewModel.getAssetDefinitionService(), viewModel.getTokensService());
         adapter.setHasStableIds(true);
@@ -122,6 +123,12 @@ public class WalletFragment extends Fragment implements OnTokenClickListener, Vi
         return view;
     }
 
+    private void onDefaultWallet(Wallet wallet)
+    {
+        //Do we display new user backup popup?
+        ((HomeActivity)getActivity()).showBackupWalletDialog(wallet.lastBackupTime > 0);
+    }
+
     private void refreshList()
     {
         adapter.clear();
diff --git a/app/src/main/java/com/alphawallet/app/viewmodel/WalletViewModel.java b/app/src/main/java/com/alphawallet/app/viewmodel/WalletViewModel.java
index 4369328a2..249b4f9af 100644
--- a/app/src/main/java/com/alphawallet/app/viewmodel/WalletViewModel.java
+++ b/app/src/main/java/com/alphawallet/app/viewmodel/WalletViewModel.java
@@ -60,6 +60,7 @@ public class WalletViewModel extends BaseViewModel
     private final MutableLiveData<BigDecimal> total = new MutableLiveData<>();
     private final MutableLiveData<Token> tokenUpdate = new MutableLiveData<>();
     private final MutableLiveData<Boolean> tokensReady = new MutableLiveData<>();
+    private final MutableLiveData<Wallet> defaultWallet = new MutableLiveData<>();
     private final MutableLiveData<GenericWalletInteract.BackupLevel> backupEvent = new MutableLiveData<>();
 
     private final FetchTokensInteract fetchTokensInteract;
@@ -130,6 +131,7 @@ public class WalletViewModel extends BaseViewModel
     }
     public LiveData<Token> tokenUpdate() { return tokenUpdate; }
     public LiveData<Boolean> tokensReady() { return tokensReady; }
+    public LiveData<Wallet> defaultWallet() { return defaultWallet; }
     public LiveData<GenericWalletInteract.BackupLevel> backupEvent() { return backupEvent; }
 
     public String getWalletAddr() { return currentWallet != null ? currentWallet.address : null; }
@@ -465,6 +467,7 @@ public class WalletViewModel extends BaseViewModel
     private void onDefaultWallet(@NotNull Wallet wallet) {
         tokensService.setCurrentAddress(wallet.address);
         currentWallet = wallet;
+        defaultWallet.postValue(wallet);
         fetchTokens();
     }