mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-09-18 15:32:35 +00:00
Fixed device vanishing while still being there in the case the device is blacklisted from starting a relay.
This commit is contained in:
parent
e20945692e
commit
5be92052bb
2 changed files with 9 additions and 3 deletions
|
@ -54,7 +54,6 @@ class SyncHomeActivity : AppCompatActivity() {
|
|||
val view = _viewMap[publicKey]
|
||||
if (!session.isAuthorized) {
|
||||
if (view != null) {
|
||||
_layoutDevices.removeView(view)
|
||||
_viewMap.remove(publicKey)
|
||||
}
|
||||
return@launch
|
||||
|
@ -108,11 +107,12 @@ class SyncHomeActivity : AppCompatActivity() {
|
|||
|
||||
private fun updateDeviceView(syncDeviceView: SyncDeviceView, publicKey: String, session: SyncSession?): SyncDeviceView {
|
||||
val connected = session?.connected ?: false
|
||||
val authorized = session?.isAuthorized ?: false
|
||||
|
||||
syncDeviceView.setLinkType(session?.linkType ?: LinkType.None)
|
||||
.setName(session?.displayName ?: StateSync.instance.getCachedName(publicKey) ?: publicKey)
|
||||
//TODO: also display public key?
|
||||
.setStatus(if (connected) "Connected" else "Disconnected")
|
||||
.setStatus(if (connected && authorized) "Connected" else "Disconnected or unauthorized")
|
||||
return syncDeviceView
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.futo.platformplayer.stores
|
||||
|
||||
import com.futo.platformplayer.logging.Logger
|
||||
import com.futo.platformplayer.states.StateApp
|
||||
import com.futo.platformplayer.stores.v2.JsonStoreSerializer
|
||||
import com.futo.platformplayer.stores.v2.ManagedStore
|
||||
import com.futo.platformplayer.stores.v2.StoreSerializer
|
||||
|
@ -124,7 +125,12 @@ class FragmentedStorage {
|
|||
}
|
||||
inline fun <reified T> load(fileName: String): T where T : FragmentedStorageFile {
|
||||
if (_filesDir == null) {
|
||||
throw Exception("Files dir should be initialized before loading a file.")
|
||||
if(StateApp.instance.contextOrNull == null)
|
||||
StateApp.instance.initializeFiles();
|
||||
|
||||
if (_filesDir == null) {
|
||||
throw Exception("Files dir should be initialized before loading a file.")
|
||||
}
|
||||
}
|
||||
|
||||
val storageFile = File(_filesDir, "${fileName}.json");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue