Add option to not close amber

This commit is contained in:
greenart7c3
2024-11-18 12:06:09 -03:00
parent 3e19e59e29
commit f2a9c72d32
14 changed files with 466 additions and 16 deletions
@@ -2,11 +2,11 @@
"formatVersion": 1, "formatVersion": 1,
"database": { "database": {
"version": 5, "version": 5,
"identityHash": "ffb55f8c910a34676fa829322921d260", "identityHash": "3d67ebb3b84f49af6a6823444e1a28e9",
"entities": [ "entities": [
{ {
"tableName": "application", "tableName": "application",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`key` TEXT NOT NULL, `name` TEXT NOT NULL, `relays` TEXT NOT NULL, `url` TEXT NOT NULL, `icon` TEXT NOT NULL, `description` TEXT NOT NULL, `pubKey` TEXT NOT NULL, `isConnected` INTEGER NOT NULL, `secret` TEXT NOT NULL, `useSecret` INTEGER NOT NULL, `signPolicy` INTEGER NOT NULL, PRIMARY KEY(`key`))", "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`key` TEXT NOT NULL, `name` TEXT NOT NULL, `relays` TEXT NOT NULL, `url` TEXT NOT NULL, `icon` TEXT NOT NULL, `description` TEXT NOT NULL, `pubKey` TEXT NOT NULL, `isConnected` INTEGER NOT NULL, `secret` TEXT NOT NULL, `useSecret` INTEGER NOT NULL, `signPolicy` INTEGER NOT NULL, `closeApplication` INTEGER NOT NULL, PRIMARY KEY(`key`))",
"fields": [ "fields": [
{ {
"fieldPath": "key", "fieldPath": "key",
@@ -73,6 +73,12 @@
"columnName": "signPolicy", "columnName": "signPolicy",
"affinity": "INTEGER", "affinity": "INTEGER",
"notNull": true "notNull": true
},
{
"fieldPath": "closeApplication",
"columnName": "closeApplication",
"affinity": "INTEGER",
"notNull": true
} }
], ],
"primaryKey": { "primaryKey": {
@@ -341,7 +347,7 @@
"views": [], "views": [],
"setupQueries": [ "setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ffb55f8c910a34676fa829322921d260')" "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '3d67ebb3b84f49af6a6823444e1a28e9')"
] ]
} }
} }
@@ -0,0 +1,353 @@
{
"formatVersion": 1,
"database": {
"version": 6,
"identityHash": "3d67ebb3b84f49af6a6823444e1a28e9",
"entities": [
{
"tableName": "application",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`key` TEXT NOT NULL, `name` TEXT NOT NULL, `relays` TEXT NOT NULL, `url` TEXT NOT NULL, `icon` TEXT NOT NULL, `description` TEXT NOT NULL, `pubKey` TEXT NOT NULL, `isConnected` INTEGER NOT NULL, `secret` TEXT NOT NULL, `useSecret` INTEGER NOT NULL, `signPolicy` INTEGER NOT NULL, `closeApplication` INTEGER NOT NULL, PRIMARY KEY(`key`))",
"fields": [
{
"fieldPath": "key",
"columnName": "key",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "relays",
"columnName": "relays",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "icon",
"columnName": "icon",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "pubKey",
"columnName": "pubKey",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isConnected",
"columnName": "isConnected",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "secret",
"columnName": "secret",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "useSecret",
"columnName": "useSecret",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "signPolicy",
"columnName": "signPolicy",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "closeApplication",
"columnName": "closeApplication",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"key"
]
},
"indices": [
{
"name": "index_key",
"unique": true,
"columnNames": [
"key"
],
"orders": [],
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_key` ON `${TABLE_NAME}` (`key`)"
},
{
"name": "index_name",
"unique": false,
"columnNames": [
"name"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_name` ON `${TABLE_NAME}` (`name`)"
}
],
"foreignKeys": []
},
{
"tableName": "applicationPermission",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER, `pkKey` TEXT NOT NULL, `type` TEXT NOT NULL, `kind` INTEGER, `acceptable` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`pkKey`) REFERENCES `application`(`key`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "pkKey",
"columnName": "pkKey",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "acceptable",
"columnName": "acceptable",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "permissions_by_pk_key",
"unique": false,
"columnNames": [
"pkKey"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `permissions_by_pk_key` ON `${TABLE_NAME}` (`pkKey`)"
},
{
"name": "permissions_unique",
"unique": true,
"columnNames": [
"pkKey",
"type",
"kind"
],
"orders": [],
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `permissions_unique` ON `${TABLE_NAME}` (`pkKey`, `type`, `kind`)"
}
],
"foreignKeys": [
{
"table": "application",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"pkKey"
],
"referencedColumns": [
"key"
]
}
]
},
{
"tableName": "notification",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `eventId` TEXT NOT NULL, `time` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "eventId",
"columnName": "eventId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "time",
"columnName": "time",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `pkKey` TEXT NOT NULL, `type` TEXT NOT NULL, `kind` INTEGER, `time` INTEGER NOT NULL, `accepted` INTEGER NOT NULL, FOREIGN KEY(`pkKey`) REFERENCES `application`(`key`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "pkKey",
"columnName": "pkKey",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "kind",
"columnName": "kind",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "time",
"columnName": "time",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "accepted",
"columnName": "accepted",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "history_by_pk_key",
"unique": false,
"columnNames": [
"pkKey"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `history_by_pk_key` ON `${TABLE_NAME}` (`pkKey`)"
},
{
"name": "history_by_id",
"unique": false,
"columnNames": [
"id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `history_by_id` ON `${TABLE_NAME}` (`id`)"
}
],
"foreignKeys": [
{
"table": "application",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"pkKey"
],
"referencedColumns": [
"key"
]
}
]
},
{
"tableName": "amber_log",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `url` TEXT NOT NULL, `type` TEXT NOT NULL, `message` TEXT NOT NULL, `time` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "message",
"columnName": "message",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "time",
"columnName": "time",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '3d67ebb3b84f49af6a6823444e1a28e9')"
]
}
}
@@ -396,6 +396,7 @@ object LocalPreferences {
"", "",
false, false,
1, 1,
closeApplication = true,
), ),
) )
database.applicationDao().insertPermissions( database.applicationDao().insertPermissions(
@@ -40,6 +40,13 @@ val MIGRATION_4_5 =
} }
} }
val MIGRATION_5_6 =
object : Migration(5, 6) {
override fun migrate(db: SupportSQLiteDatabase) {
db.execSQL("ALTER TABLE `application` ADD COLUMN `closeApplication` INTEGER NOT NULL DEFAULT 1")
}
}
@Database( @Database(
entities = [ entities = [
ApplicationEntity::class, ApplicationEntity::class,
@@ -48,7 +55,7 @@ val MIGRATION_4_5 =
HistoryEntity::class, HistoryEntity::class,
LogEntity::class, LogEntity::class,
], ],
version = 5, version = 6,
) )
@TypeConverters(Converters::class) @TypeConverters(Converters::class)
abstract class AppDatabase : RoomDatabase() { abstract class AppDatabase : RoomDatabase() {
@@ -70,6 +77,7 @@ abstract class AppDatabase : RoomDatabase() {
.addMigrations(MIGRATION_2_3) .addMigrations(MIGRATION_2_3)
.addMigrations(MIGRATION_3_4) .addMigrations(MIGRATION_3_4)
.addMigrations(MIGRATION_4_5) .addMigrations(MIGRATION_4_5)
.addMigrations(MIGRATION_5_6)
.build() .build()
instance instance
} }
@@ -37,6 +37,7 @@ data class ApplicationEntity(
val secret: String, val secret: String,
val useSecret: Boolean, val useSecret: Boolean,
var signPolicy: Int, var signPolicy: Int,
var closeApplication: Boolean,
) { ) {
companion object { companion object {
fun empty() = ApplicationEntity( fun empty() = ApplicationEntity(
@@ -51,6 +52,7 @@ data class ApplicationEntity(
secret = "", secret = "",
useSecret = false, useSecret = false,
signPolicy = 0, signPolicy = 0,
closeApplication = true,
) )
} }
@@ -25,6 +25,7 @@ data class BunkerRequest(
var currentAccount: String, var currentAccount: String,
var encryptionType: EncryptionType, var encryptionType: EncryptionType,
var nostrConnectSecret: String, var nostrConnectSecret: String,
var closeApplication: Boolean,
) { ) {
fun toJson(): String { fun toJson(): String {
return mapper.writeValueAsString(this) return mapper.writeValueAsString(this)
@@ -94,6 +95,7 @@ data class BunkerRequest(
currentAccount = jsonObject.get("currentAccount")?.asText()?.intern() ?: "", currentAccount = jsonObject.get("currentAccount")?.asText()?.intern() ?: "",
encryptionType = encryptionType, encryptionType = encryptionType,
nostrConnectSecret = jsonObject.get("nostrConnectSecret")?.asText()?.intern() ?: "", nostrConnectSecret = jsonObject.get("nostrConnectSecret")?.asText()?.intern() ?: "",
closeApplication = jsonObject.get("closeApplication")?.asBoolean() ?: false,
) )
} }
@@ -130,6 +132,7 @@ data class BunkerRequest(
gen.writeStringField("currentAccount", value.currentAccount) gen.writeStringField("currentAccount", value.currentAccount)
gen.writeStringField("encryptionType", value.encryptionType.toString()) gen.writeStringField("encryptionType", value.encryptionType.toString())
gen.writeStringField("nostrConnectSecret", value.nostrConnectSecret) gen.writeStringField("nostrConnectSecret", value.nostrConnectSecret)
gen.writeBooleanField("closeApplication", value.closeApplication)
gen.writeEndObject() gen.writeEndObject()
} }
} }
@@ -126,6 +126,7 @@ object AmberUtils {
bunkerRequest: BunkerRequest, bunkerRequest: BunkerRequest,
relays: List<RelaySetupInfo>, relays: List<RelaySetupInfo>,
context: Context, context: Context,
closeApplication: Boolean,
onRemoveIntentData: (IntentData) -> Unit, onRemoveIntentData: (IntentData) -> Unit,
onLoading: (Boolean) -> Unit, onLoading: (Boolean) -> Unit,
) { ) {
@@ -139,7 +140,9 @@ object AmberUtils {
onDone = { onDone = {
onRemoveIntentData(intentData) onRemoveIntentData(intentData)
context.getAppCompatActivity()?.intent = null context.getAppCompatActivity()?.intent = null
context.getAppCompatActivity()?.finish() if (closeApplication) {
context.getAppCompatActivity()?.finish()
}
}, },
) )
} }
@@ -897,6 +897,7 @@ object IntentUtils {
account.signer.keyPair.pubKey.toNpub(), account.signer.keyPair.pubKey.toNpub(),
EncryptionType.NIP04, EncryptionType.NIP04,
nostrConnectSecret, nostrConnectSecret,
intent.getBooleanExtra("closeApplication", true),
), ),
route, route,
null, null,
@@ -73,7 +73,7 @@ fun EditPermission(
mutableStateListOf<ApplicationPermissionsEntity>() mutableStateListOf<ApplicationPermissionsEntity>()
} }
var applicationData by remember { var applicationData by remember {
mutableStateOf(ApplicationEntity(selectedPackage, "", emptyList(), "", "", "", "", true, "", false, 1)) mutableStateOf(ApplicationEntity.empty())
} }
var wantsToRemovePermissions by remember { mutableStateOf(false) } var wantsToRemovePermissions by remember { mutableStateOf(false) }
@@ -173,6 +173,7 @@ fun sendResult(
intentData.bunkerRequest?.secret ?: "", intentData.bunkerRequest?.secret ?: "",
intentData.bunkerRequest?.secret != null, intentData.bunkerRequest?.secret != null,
account.signPolicy, account.signPolicy,
intentData.bunkerRequest?.closeApplication ?: true,
), ),
permissions = mutableListOf(), permissions = mutableListOf(),
) )
@@ -278,7 +279,9 @@ fun sendResult(
EventNotificationConsumer(context).notificationManager().cancelAll() EventNotificationConsumer(context).notificationManager().cancelAll()
onRemoveIntentData(intentData) onRemoveIntentData(intentData)
activity?.intent = null activity?.intent = null
activity?.finish() if (application.application.closeApplication || intentData.bunkerRequest.closeApplication) {
activity?.finish()
}
}, },
) )
} else if (packageName != null) { } else if (packageName != null) {
@@ -42,6 +42,7 @@ fun NewApplicationScreen(
val intent = Intent(Intent.ACTION_VIEW) val intent = Intent(Intent.ACTION_VIEW)
intent.data = Uri.parse(it) intent.data = Uri.parse(it)
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP) intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP)
intent.putExtra("closeApplication", false)
context.getAppCompatActivity()?.startActivity(intent) context.getAppCompatActivity()?.startActivity(intent)
accountStateViewModel.switchUser(account.signer.keyPair.pubKey.toNpub(), Route.IncomingRequest.route) accountStateViewModel.switchUser(account.signer.keyPair.pubKey.toNpub(), Route.IncomingRequest.route)
} }
@@ -223,6 +223,7 @@ fun NewNsecBunkerScreen(
secret.value, secret.value,
true, true,
account.signPolicy, account.signPolicy,
true,
) )
database.applicationDao().insertApplication( database.applicationDao().insertApplication(
@@ -163,6 +163,7 @@ fun MultiEventHomeScreen(
val activity = context.getAppCompatActivity() val activity = context.getAppCompatActivity()
val results = mutableListOf<Result>() val results = mutableListOf<Result>()
reconnectToRelays(intents) reconnectToRelays(intents)
var closeApp = true
for (intentData in intents) { for (intentData in intents) {
val localAccount = val localAccount =
@@ -195,10 +196,15 @@ fun MultiEventHomeScreen(
intentData.bunkerRequest?.secret ?: "", intentData.bunkerRequest?.secret ?: "",
intentData.bunkerRequest?.secret != null, intentData.bunkerRequest?.secret != null,
localAccount.signPolicy, localAccount.signPolicy,
intentData.bunkerRequest?.closeApplication ?: true,
), ),
permissions = mutableListOf(), permissions = mutableListOf(),
) )
if (!application.application.closeApplication) {
closeApp = false
}
if (intentData.type == SignerType.SIGN_EVENT) { if (intentData.type == SignerType.SIGN_EVENT) {
val localEvent = intentData.event!! val localEvent = intentData.event!!
@@ -246,6 +252,7 @@ fun MultiEventHomeScreen(
intentData.bunkerRequest, intentData.bunkerRequest,
relays = application.application.relays, relays = application.application.relays,
context = context, context = context,
closeApplication = application.application.closeApplication,
onRemoveIntentData = onRemoveIntentData, onRemoveIntentData = onRemoveIntentData,
onLoading = {}, onLoading = {},
) )
@@ -324,6 +331,7 @@ fun MultiEventHomeScreen(
intentData.bunkerRequest, intentData.bunkerRequest,
relays = application.application.relays, relays = application.application.relays,
context = context, context = context,
closeApplication = application.application.closeApplication,
onRemoveIntentData = onRemoveIntentData, onRemoveIntentData = onRemoveIntentData,
onLoading = {}, onLoading = {},
) )
@@ -387,6 +395,7 @@ fun MultiEventHomeScreen(
intentData.bunkerRequest, intentData.bunkerRequest,
relays = application.application.relays, relays = application.application.relays,
context = context, context = context,
closeApplication = application.application.closeApplication,
onRemoveIntentData = onRemoveIntentData, onRemoveIntentData = onRemoveIntentData,
onLoading = {}, onLoading = {},
) )
@@ -411,9 +420,9 @@ fun MultiEventHomeScreen(
} }
if (intents.any { it.bunkerRequest != null }) { if (intents.any { it.bunkerRequest != null }) {
EventNotificationConsumer(context).notificationManager().cancelAll() EventNotificationConsumer(context).notificationManager().cancelAll()
finishActivity(activity) finishActivity(activity, closeApp)
} else { } else {
finishActivity(activity) finishActivity(activity, closeApp)
} }
} finally { } finally {
onLoading(false) onLoading(false)
@@ -428,12 +437,56 @@ fun MultiEventHomeScreen(
containerColor = orange, containerColor = orange,
), ),
onClick = { onClick = {
var closeApp = true
for (intentData in intents) {
val localAccount =
if (intentData.currentAccount.isNotBlank()) {
LocalPreferences.loadFromEncryptedStorage(
context,
intentData.currentAccount,
)
} else {
accountParam
} ?: continue
val key = intentData.bunkerRequest?.localKey ?: packageName ?: continue
val database = NostrSigner.getInstance().getDatabase(localAccount.signer.keyPair.pubKey.toNpub())
val application =
database
.applicationDao()
.getByKey(key) ?: ApplicationWithPermissions(
application = ApplicationEntity(
key,
"",
listOf(),
"",
"",
"",
localAccount.signer.keyPair.pubKey.toHexKey(),
true,
intentData.bunkerRequest?.secret ?: "",
intentData.bunkerRequest?.secret != null,
localAccount.signPolicy,
intentData.bunkerRequest?.closeApplication ?: true,
),
permissions = mutableListOf(),
)
if (!application.application.closeApplication) {
closeApp = false
break
}
}
val activity = context.getAppCompatActivity() val activity = context.getAppCompatActivity()
if (intents.any { it.bunkerRequest != null }) { if (intents.any { it.bunkerRequest != null }) {
EventNotificationConsumer(context).notificationManager().cancelAll() EventNotificationConsumer(context).notificationManager().cancelAll()
finishActivity(activity) finishActivity(activity, closeApp)
} else { } else {
finishActivity(activity) finishActivity(activity, closeApp)
} }
}, },
text = stringResource(R.string.discard_all_requests), text = stringResource(R.string.discard_all_requests),
@@ -441,9 +494,11 @@ fun MultiEventHomeScreen(
} }
} }
private fun finishActivity(activity: AppCompatActivity?) { private fun finishActivity(activity: AppCompatActivity?, closeApp: Boolean) {
activity?.intent = null activity?.intent = null
activity?.finish() if (closeApp) {
activity?.finish()
}
} }
private fun sendResultIntent( private fun sendResultIntent(
@@ -153,6 +153,7 @@ fun SingleEventHomeScreen(
intentData.bunkerRequest, intentData.bunkerRequest,
applicationEntity?.application?.relays ?: intentData.bunkerRequest.relays, applicationEntity?.application?.relays ?: intentData.bunkerRequest.relays,
context, context,
closeApplication = intentData.bunkerRequest.closeApplication,
onLoading = onLoading, onLoading = onLoading,
onRemoveIntentData = onRemoveIntentData, onRemoveIntentData = onRemoveIntentData,
) )
@@ -237,6 +238,7 @@ fun SingleEventHomeScreen(
intentData.bunkerRequest?.secret ?: "", intentData.bunkerRequest?.secret ?: "",
intentData.bunkerRequest?.secret != null, intentData.bunkerRequest?.secret != null,
account.signPolicy, account.signPolicy,
intentData.bunkerRequest?.closeApplication ?: true,
), ),
permissions = mutableListOf(), permissions = mutableListOf(),
) )
@@ -278,13 +280,16 @@ fun SingleEventHomeScreen(
intentData.bunkerRequest, intentData.bunkerRequest,
relays, relays,
context, context,
closeApplication = application.application.closeApplication,
onLoading = onLoading, onLoading = onLoading,
onRemoveIntentData = onRemoveIntentData, onRemoveIntentData = onRemoveIntentData,
) )
} else { } else {
onRemoveIntentData(intentData) onRemoveIntentData(intentData)
context.getAppCompatActivity()?.intent = null context.getAppCompatActivity()?.intent = null
context.getAppCompatActivity()?.finish() if (application.application.closeApplication) {
context.getAppCompatActivity()?.finish()
}
} }
} }
}, },
@@ -378,6 +383,7 @@ fun SingleEventHomeScreen(
intentData.bunkerRequest?.secret ?: "", intentData.bunkerRequest?.secret ?: "",
intentData.bunkerRequest?.secret != null, intentData.bunkerRequest?.secret != null,
account.signPolicy, account.signPolicy,
intentData.bunkerRequest?.closeApplication ?: true,
), ),
permissions = mutableListOf(), permissions = mutableListOf(),
) )
@@ -418,13 +424,16 @@ fun SingleEventHomeScreen(
intentData.bunkerRequest, intentData.bunkerRequest,
relays, relays,
context, context,
closeApplication = application.application.closeApplication,
onRemoveIntentData = onRemoveIntentData, onRemoveIntentData = onRemoveIntentData,
onLoading, onLoading,
) )
} else { } else {
onRemoveIntentData(intentData) onRemoveIntentData(intentData)
context.getAppCompatActivity()?.intent = null context.getAppCompatActivity()?.intent = null
context.getAppCompatActivity()?.finish() if (application.application.closeApplication) {
context.getAppCompatActivity()?.finish()
}
} }
} }
}, },
@@ -542,6 +551,7 @@ fun SingleEventHomeScreen(
intentData.bunkerRequest?.secret ?: "", intentData.bunkerRequest?.secret ?: "",
intentData.bunkerRequest?.secret != null, intentData.bunkerRequest?.secret != null,
account.signPolicy, account.signPolicy,
intentData.bunkerRequest?.closeApplication ?: true,
), ),
permissions = mutableListOf(), permissions = mutableListOf(),
) )
@@ -583,13 +593,16 @@ fun SingleEventHomeScreen(
intentData.bunkerRequest, intentData.bunkerRequest,
relays, relays,
context, context,
closeApplication = application.application.closeApplication,
onLoading = onLoading, onLoading = onLoading,
onRemoveIntentData = onRemoveIntentData, onRemoveIntentData = onRemoveIntentData,
) )
} else { } else {
onRemoveIntentData(intentData) onRemoveIntentData(intentData)
context.getAppCompatActivity()?.intent = null context.getAppCompatActivity()?.intent = null
context.getAppCompatActivity()?.finish() if (application.application.closeApplication) {
context.getAppCompatActivity()?.finish()
}
} }
} }
}, },