This commit is contained in:
Koen 2023-12-05 15:21:35 +01:00
commit e45c8617df

View file

@ -62,20 +62,19 @@ class StatePolycentric {
val activeProcessHandleString = _activeProcessHandle.value; val activeProcessHandleString = _activeProcessHandle.value;
if (activeProcessHandleString.isNotEmpty()) { if (activeProcessHandleString.isNotEmpty()) {
val system = val system = PublicKey.fromProto(Protocol.PublicKey.parseFrom(activeProcessHandleString.base64ToByteArray()));
PublicKey.fromProto(Protocol.PublicKey.parseFrom(activeProcessHandleString.base64ToByteArray()));
setProcessHandle(Store.instance.getProcessSecret(system)?.toProcessHandle()); setProcessHandle(Store.instance.getProcessSecret(system)?.toProcessHandle());
} }
} catch (e: Throwable) { } catch (e: Throwable) {
_transientEnabled = false _transientEnabled = false
UIDialogs.toast(context, "Polycentric failed to initialize.") UIDialogs.toast(context, "Polycentric failed to initialize due to an error.")
Log.i(TAG, "Failed to initialize Polycentric.", e) Log.i(TAG, "Failed to initialize Polycentric.", e)
} }
} }
fun ensureEnabled() { fun ensureEnabled() {
if (!enabled) { if (!enabled) {
throw Exception("Cannot set process handle when Polycentric is disdabled") throw Exception("Polycentric is disabled")
} }
} }