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:
@@ -0,0 +1,27 @@
|
||||
name: ClippyAuto CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: cimg/android:2024.01
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
|
||||
- name: Build Debug APK
|
||||
run: ./gradlew assembleDebug
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: ./gradlew testDebugUnitTest
|
||||
|
||||
- name: Lint
|
||||
run: ./gradlew lintDebug
|
||||
@@ -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 {
|
||||
}
|
||||
)
|
||||
|
||||
// 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()
|
||||
|
||||
// Give the screen a reference so the talk button works
|
||||
screen?.attachVoiceLoop(voiceLoop!!)
|
||||
} else {
|
||||
screen?.updateStatus("⚠️ Matrix login failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStop(owner: LifecycleOwner) {
|
||||
|
||||
Reference in New Issue
Block a user