mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2026-05-16 04:52:39 +02:00
Made sync dialogs more robust.
This commit is contained in:
@@ -84,16 +84,20 @@ class StateSync {
|
||||
|
||||
onUnauthorized = { sess ->
|
||||
StateApp.instance.scope.launch(Dispatchers.Main) {
|
||||
UIDialogs.showConfirmationDialog(
|
||||
context,
|
||||
"Device Unauthorized: ${sess.displayName}",
|
||||
action = {
|
||||
Logger.i(TAG, "${sess.remotePublicKey} unauthorized received")
|
||||
removeAuthorizedDevice(sess.remotePublicKey)
|
||||
deviceRemoved.emit(sess.remotePublicKey)
|
||||
},
|
||||
cancelAction = {}
|
||||
)
|
||||
try {
|
||||
UIDialogs.showConfirmationDialog(
|
||||
context,
|
||||
"Device Unauthorized: ${sess.displayName}",
|
||||
action = {
|
||||
Logger.i(TAG, "${sess.remotePublicKey} unauthorized received")
|
||||
removeAuthorizedDevice(sess.remotePublicKey)
|
||||
deviceRemoved.emit(sess.remotePublicKey)
|
||||
},
|
||||
cancelAction = {}
|
||||
)
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(TAG, "Failed to show unauthorized dialog.", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,30 +122,38 @@ class StateSync {
|
||||
|
||||
if (scope != null && activity != null) {
|
||||
scope.launch(Dispatchers.Main) {
|
||||
UIDialogs.showConfirmationDialog(activity, "Allow connection from $remotePublicKey?",
|
||||
action = {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
callback(true)
|
||||
Logger.i(TAG, "Connection authorized for $remotePublicKey by confirmation")
|
||||
try {
|
||||
UIDialogs.showConfirmationDialog(
|
||||
activity, "Allow connection from $remotePublicKey?",
|
||||
action = {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
callback(true)
|
||||
Logger.i(
|
||||
TAG,
|
||||
"Connection authorized for $remotePublicKey by confirmation"
|
||||
)
|
||||
|
||||
activity.finish()
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(TAG, "Failed to send authorize", e)
|
||||
activity.finish()
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(TAG, "Failed to send authorize", e)
|
||||
}
|
||||
}
|
||||
},
|
||||
cancelAction = {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
callback(false)
|
||||
Logger.i(TAG, "$remotePublicKey unauthorized received")
|
||||
} catch (e: Throwable) {
|
||||
Logger.w(TAG, "Failed to send unauthorize", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cancelAction = {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
callback(false)
|
||||
Logger.i(TAG, "$remotePublicKey unauthorized received")
|
||||
} catch (e: Throwable) {
|
||||
Logger.w(TAG, "Failed to send unauthorize", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(TAG, "Failed to show authorized dialog.", e)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
callback(false)
|
||||
|
||||
Submodule app/src/stable/assets/sources/dailymotion updated: d115430011...ffd40f2006
Submodule app/src/stable/assets/sources/odysee updated: 6ea9fa7e4c...215cd9bd70
Submodule app/src/stable/assets/sources/patreon updated: d98c7f8aee...e5dce87c9d
Submodule app/src/stable/assets/sources/peertube updated: 56bff39123...6e7f943b0b
Submodule app/src/stable/assets/sources/rumble updated: 3bbce81794...932fdf78de
Submodule app/src/stable/assets/sources/soundcloud updated: 5456431268...f8234d6af8
Submodule app/src/stable/assets/sources/spotify updated: 1d884f50ab...47e76a96e5
Submodule app/src/stable/assets/sources/youtube updated: 6d6838e2a4...a297a0a788
Submodule app/src/unstable/assets/sources/apple-podcasts updated: 089987f007...9aa31c5e87
Submodule app/src/unstable/assets/sources/bitchute updated: b213f91c0b...b31ced36b9
Submodule app/src/unstable/assets/sources/dailymotion updated: d115430011...ffd40f2006
Submodule app/src/unstable/assets/sources/odysee updated: 6ea9fa7e4c...215cd9bd70
Submodule app/src/unstable/assets/sources/patreon updated: d98c7f8aee...e5dce87c9d
Submodule app/src/unstable/assets/sources/peertube updated: 56bff39123...6e7f943b0b
Submodule app/src/unstable/assets/sources/rumble updated: 3bbce81794...932fdf78de
Submodule app/src/unstable/assets/sources/soundcloud updated: 5456431268...f8234d6af8
Submodule app/src/unstable/assets/sources/spotify updated: 1d884f50ab...47e76a96e5
Submodule app/src/unstable/assets/sources/youtube updated: 6d6838e2a4...a297a0a788
Reference in New Issue
Block a user