Add CI workflow, Matrix login flow in session, placeholder for room ID
ClippyAuto CI / build (push) Has been cancelled
ClippyAuto CI / build (push) Has been cancelled
This commit is contained in:
@@ -17,11 +17,14 @@ class ClippySession : Session(), DefaultLifecycleObserver {
|
||||
private var voiceLoop: VoiceLoop? = null
|
||||
private var screen: ClippyScreen? = null
|
||||
|
||||
// TODO: Move to config / SharedPreferences / SetupActivity
|
||||
// TODO: Move to SharedPreferences via SetupActivity
|
||||
companion object {
|
||||
const val HOMESERVER = "https://mess.hobbs.farm"
|
||||
const val ROOM_ID = "" // Set after #clippy-voice room is created
|
||||
const val ROOM_ID = "" // TODO: Set once #clippy-voice room alias resolves
|
||||
const val CLIPPY_USER = "@clippy:hobbs.farm"
|
||||
// Hardcoded for v1 — move to secure storage
|
||||
const val MATRIX_USER = "clippyauto"
|
||||
const val MATRIX_PASS = "" // TODO: Create bot user for the app
|
||||
}
|
||||
|
||||
override fun onCreateScreen(intent: Intent): Screen {
|
||||
@@ -44,11 +47,19 @@ class ClippySession : Session(), DefaultLifecycleObserver {
|
||||
}
|
||||
)
|
||||
|
||||
voiceLoop?.initialize()
|
||||
voiceLoop?.startSession()
|
||||
|
||||
// Give the screen a reference so the talk button works
|
||||
screen?.attachVoiceLoop(voiceLoop!!)
|
||||
// Login then initialize voice loop
|
||||
kotlinx.coroutines.CoroutineScope(kotlinx.coroutines.Dispatchers.IO).launch {
|
||||
val loggedIn = matrixClient.login(MATRIX_USER, MATRIX_PASS)
|
||||
kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.Main) {
|
||||
if (loggedIn) {
|
||||
voiceLoop?.initialize()
|
||||
voiceLoop?.startSession()
|
||||
screen?.attachVoiceLoop(voiceLoop!!)
|
||||
} else {
|
||||
screen?.updateStatus("⚠️ Matrix login failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStop(owner: LifecycleOwner) {
|
||||
|
||||
Reference in New Issue
Block a user