Commit 57b09bb6 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Don't ask for the pin when navigating inside the app

Fixes #270
parent 60280042
......@@ -60,20 +60,27 @@ class MainActivity : NavigationDrawerActivity() {
private var cardNetworkCallback:ConnectivityManager.NetworkCallback? = null
private val networkManager by lazy { getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager }
private var pinLastPassed:Long? = null
private var navigatedInternal = false
override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(LanguageContextWrapper.attachFromSettings(this, newBase))
}
override fun startActivity(intent: Intent?, options: Bundle?) {
navigatedInternal = intent?.component?.packageName?.equals(packageName) ?: false
super.startActivity(intent, options)
}
override fun onResume() {
super.onResume()
if(getPreferences().enablePin) {
if(!navigatedInternal && getPreferences().enablePin) {
pinLastPassed = intent?.getLongExtra("pin_validated_at", 0)
if(pinLastPassed == null || System.currentTimeMillis() >= pinLastPassed!! + PIN_TIMEOUT) {
startActivity(PinActivity.openAppIntent(this, intent?.extras))
finish()
}
}
navigatedInternal = false
}
override fun onCreate(savedInstanceState: Bundle?) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment