Commit 05d961e9 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Use the pin activity for deep actions, not the main activity

parent 73a6eb77
Pipeline #5831 passed with stage
in 3 minutes and 21 seconds
......@@ -56,6 +56,20 @@ class PinActivity: BaseActivity() {
return context.getPreferences().enablePin && (intent == null || !intent.getBooleanExtra("pin_validated", false))
}
fun openAppIntent(context: Context, extras:Bundle? = null):Intent {
return if(shouldValidatePin(context, null)) {
val intent = Intent(context, PinActivity::class.java)
if(intent.extras != null) intent.putExtra("extras", extras)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.putExtra("pin_type", PinType.APP)
intent
} else {
Intent(context, MainActivity::class.java).apply {
if(extras != null) putExtras(extras)
}
}
}
fun askForPin(context: Context, pinType: PinType, extras:Bundle? = null) {
val intent = Intent(context, PinActivity::class.java)
if(intent.extras != null) intent.putExtra("extras", extras)
......
......@@ -3,7 +3,8 @@ package com.frostnerd.smokescreen.util
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import com.frostnerd.smokescreen.activity.MainActivity
import android.os.Bundle
import com.frostnerd.smokescreen.activity.PinActivity
/*
* Copyright (C) 2019 Daniel Wolf (Ch4t4r)
......@@ -29,7 +30,7 @@ enum class DeepActionState {
fun intentTo(context:Context): Intent {
return Intent(context, MainActivity::class.java).putExtra("deep_action", this)
return PinActivity.openAppIntent(context, Bundle().apply { putSerializable("deep_action", this@DeepActionState) })
}
fun pendingIntentTo(context: Context):PendingIntent {
......
Supports Markdown
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