|
|
|
@ -33,6 +33,7 @@ import com.wallet.crypto.trustapp.model.ESTransaction; |
|
|
|
|
import com.wallet.crypto.trustapp.model.VMAccount; |
|
|
|
|
import com.wallet.crypto.trustapp.util.KS; |
|
|
|
|
import com.wallet.crypto.trustapp.util.PMMigrateHelper; |
|
|
|
|
import com.wallet.crypto.trustapp.util.RootUtil; |
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
@ -170,58 +171,74 @@ public class TransactionListActivity extends AppCompatActivity { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onResume() { |
|
|
|
|
Log.d(TAG, "onResume"); |
|
|
|
|
|
|
|
|
|
super.onResume(); |
|
|
|
|
|
|
|
|
|
init(); |
|
|
|
|
Log.d(TAG, "Number of accounts: " + mController.getNumberOfAccounts()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); |
|
|
|
|
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); |
|
|
|
|
if (keyguardManager != null |
|
|
|
|
&& !keyguardManager.isDeviceSecure() |
|
|
|
|
&& pref.getBoolean("should_show_security_alert", true)) { |
|
|
|
|
pref.edit().putBoolean("should_show_security_alert", false).apply(); |
|
|
|
|
new AlertDialog.Builder(this) |
|
|
|
|
.setTitle(R.string.lock_title) |
|
|
|
|
.setMessage(R.string.lock_body) |
|
|
|
|
.setPositiveButton(R.string.lock_settings, new DialogInterface.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); |
|
|
|
|
startActivity(intent); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.show(); |
|
|
|
|
} else { |
|
|
|
|
if (mController.getAccounts().size() == 0) { |
|
|
|
|
Intent intent = new Intent(getApplicationContext(), CreateAccountActivity.class); |
|
|
|
|
this.startActivityForResult(intent, Controller.IMPORT_ACCOUNT_REQUEST); |
|
|
|
|
finish(); |
|
|
|
|
} else { |
|
|
|
|
mController.onResume(); |
|
|
|
|
try { |
|
|
|
|
PMMigrateHelper.migrate(this); |
|
|
|
|
} catch (ServiceErrorException e) { |
|
|
|
|
if (e.code == ServiceErrorException.USER_NOT_AUTHENTICATED) { |
|
|
|
|
KS.showAuthenticationScreen(this, Controller.UNLOCK_SCREEN_REQUEST); |
|
|
|
|
} else { |
|
|
|
|
Toast.makeText(this, "Could not process passwords.", Toast.LENGTH_LONG) |
|
|
|
|
.show(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
checkGuard(); |
|
|
|
|
checkRoot(); |
|
|
|
|
|
|
|
|
|
if (mController.getAccounts().size() == 0) { |
|
|
|
|
Intent intent = new Intent(getApplicationContext(), CreateAccountActivity.class); |
|
|
|
|
this.startActivityForResult(intent, Controller.IMPORT_ACCOUNT_REQUEST); |
|
|
|
|
finish(); |
|
|
|
|
} else { |
|
|
|
|
mController.onResume(); |
|
|
|
|
try { |
|
|
|
|
PMMigrateHelper.migrate(this); |
|
|
|
|
} catch (ServiceErrorException e) { |
|
|
|
|
if (e.code == ServiceErrorException.USER_NOT_AUTHENTICATED) { |
|
|
|
|
KS.showAuthenticationScreen(this, Controller.UNLOCK_SCREEN_REQUEST); |
|
|
|
|
} else { |
|
|
|
|
Toast.makeText(this, "Could not process passwords.", Toast.LENGTH_LONG) |
|
|
|
|
.show(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
|
|
|
|
private void checkRoot() { |
|
|
|
|
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); |
|
|
|
|
if (RootUtil.isDeviceRooted() && pref.getBoolean("should_show_root_warning", true)) { |
|
|
|
|
pref.edit().putBoolean("should_show_root_warning", false).apply(); |
|
|
|
|
new AlertDialog.Builder(this) |
|
|
|
|
.setTitle(R.string.root_title) |
|
|
|
|
.setMessage(R.string.root_body) |
|
|
|
|
.setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.show(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkGuard() { |
|
|
|
|
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); |
|
|
|
|
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); |
|
|
|
|
if (keyguardManager != null |
|
|
|
|
&& !keyguardManager.isDeviceSecure() |
|
|
|
|
&& pref.getBoolean("should_show_security_warning", true)) { |
|
|
|
|
pref.edit().putBoolean("should_show_security_warning", false).apply(); |
|
|
|
|
new AlertDialog.Builder(this) |
|
|
|
|
.setTitle(R.string.lock_title) |
|
|
|
|
.setMessage(R.string.lock_body) |
|
|
|
|
.setPositiveButton(R.string.lock_settings, new DialogInterface.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); |
|
|
|
|
startActivity(intent); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.show(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
|
|
|
|
if (requestCode == Controller.IMPORT_ACCOUNT_REQUEST) { |
|
|
|
|
if (resultCode == RESULT_OK) { |
|
|
|
|
this.finish(); |
|
|
|
|