Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,12 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.0.0'

# Needs to be removed, after github fixed an issue with the Xcode 26 beta version
- name: Download iOS 26.0 Platform
run: |
xcodebuild -downloadPlatform iOS
working-directory: .

- name: Build iOS app
run: fastlane build

android:
name: Android
runs-on: macos-latest
runs-on: ubuntu-latest
environment: PlayStore
env:
GOOGLE_PLAY_KEY_FILE: ${{ secrets.GOOGLE_PLAY_KEY_FILE }}
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/deploy-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.0.0'

# Needs to be removed, after github fixed an issue with the Xcode 26 beta version
- name: Download iOS 26.0 Platform
run: |
xcodebuild -downloadPlatform iOS
working-directory: .

- name: Set FASTLANE_BUILD_NUMBER from tag
run: echo "FASTLANE_BUILD_NUMBER=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

Expand All @@ -58,7 +47,7 @@ jobs:

android:
name: Android
runs-on: macos-latest
runs-on: ubuntu-latest
environment: PlayStore
if: startsWith(github.ref, 'refs/tags/')
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import io.redlink.more.more_app_mutliplatform.database.getRoomDatabase
import io.redlink.more.more_app_mutliplatform.database.repository.MainRepository
import io.redlink.more.more_app_mutliplatform.napierDebugBuild
import io.redlink.more.more_app_mutliplatform.services.store.SharedPreferencesRepository
import io.redlink.more.more_app_mutliplatform.viewModels.ViewManager

/**
* Main Application class of the project.
Expand All @@ -47,21 +48,21 @@ class MoreApplication : Application(), DefaultLifecycleObserver {
}

override fun onTerminate() {
shared?.bluetoothController?.close()
super.onTerminate()
shared?.mainBluetoothConnector?.close()
}

override fun onResume(owner: LifecycleOwner) {
super.onResume(owner)
Napier.i { "App is in the foreground..." }
shared?.appInForeground(true)
ViewManager.appIsInForeground(true)
shared?.notificationManager?.updateNotificationBadgeCount()
}

override fun onPause(owner: LifecycleOwner) {
super.onPause(owner)
Napier.i { "App is in the background..." }
shared?.appInForeground(false)
ViewManager.appIsInForeground(false)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ import io.redlink.more.more_app_mutliplatform.AlertController
import io.redlink.more.more_app_mutliplatform.models.AlertDialogModel
import io.redlink.more.more_app_mutliplatform.registration.RegistrationService
import io.redlink.more.more_app_mutliplatform.services.notification.NotificationManager
import io.redlink.more.more_app_mutliplatform.viewModels.ViewManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
Expand Down Expand Up @@ -85,7 +83,6 @@ class ContentViewModel : ViewModel() {
val notificationId = activity.intent.getStringExtra(NotificationManager.MSG_ID)

viewModelScope.launch(Dispatchers.IO) {
ViewManager.checkingForNewStudyData.first { !it }
val modifiedDeepLink = rawDeepLink?.let { link ->
val sharedInstance = MoreApplication.shared
?: throw IllegalStateException("MoreApplication.shared is not initialized")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import io.redlink.more.app.android.services.sensorsListener.GPSStateListener
import io.redlink.more.more_app_mutliplatform.AlertController
import io.redlink.more.more_app_mutliplatform.database.entities.BluetoothDeviceEntity
import io.redlink.more.more_app_mutliplatform.models.AlertDialogModel
import io.redlink.more.more_app_mutliplatform.services.bluetooth.BluetoothDeviceManager
import io.redlink.more.more_app_mutliplatform.scopes.Scope
import io.redlink.more.more_app_mutliplatform.services.bluetooth.BluetoothStateManagement
import io.redlink.more.more_app_mutliplatform.viewModels.ViewManager
import io.redlink.more.more_app_mutliplatform.viewModels.startupConnection.CoreBluetoothViewModel
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -59,7 +60,7 @@ class BluetoothViewModel : ViewModel() {
}
}
viewModelScope.launch(Dispatchers.IO) {
BluetoothDeviceManager.discoveredDevices.collect {
BluetoothStateManagement.discoveredDevices.collect {
withContext(Dispatchers.Main) {
discoveredDevices.clear()
discoveredDevices.addAll(it)
Expand All @@ -68,7 +69,7 @@ class BluetoothViewModel : ViewModel() {
}

viewModelScope.launch(Dispatchers.IO) {
BluetoothDeviceManager.connectedDevices.collect {
BluetoothStateManagement.connectedDevices.collect {
withContext(Dispatchers.Main) {
connectedDevices.clear()
connectedDevices.addAll(it)
Expand All @@ -77,7 +78,7 @@ class BluetoothViewModel : ViewModel() {
}

viewModelScope.launch(Dispatchers.IO) {
coreBluetoothViewModel.coreBluetooth.isScanning.collect {
BluetoothStateManagement.scanning.collect {
withContext(Dispatchers.Main) {
isScanning.value = it
}
Expand All @@ -101,7 +102,7 @@ class BluetoothViewModel : ViewModel() {
}

viewModelScope.launch(Dispatchers.IO) {
BluetoothDeviceManager.devicesCurrentlyConnecting.collect {
BluetoothStateManagement.devicesCurrentlyConnecting.collect {
withContext(Dispatchers.Main) {
connectingDevices.clear()
connectingDevices.addAll(it.mapNotNull { it.address })
Expand All @@ -121,7 +122,9 @@ class BluetoothViewModel : ViewModel() {
}

fun connectToDevice(device: BluetoothDeviceEntity) {
coreBluetoothViewModel.connectToDevice(device)
Scope.launch {
coreBluetoothViewModel.connectToDevice(device)
}
}

fun disconnectFromDevice(device: BluetoothDeviceEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import io.redlink.more.app.android.MoreApplication
import io.redlink.more.app.android.observations.HR.PolarHeartRateObservation
import io.redlink.more.more_app_mutliplatform.models.ScheduleListType
import io.redlink.more.more_app_mutliplatform.services.bluetooth.polar.PolarStates
import io.redlink.more.more_app_mutliplatform.viewModels.dashboard.CoreDashboardFilterViewModel
import io.redlink.more.more_app_mutliplatform.viewModels.schedules.CoreScheduleViewModel
import kotlinx.coroutines.Dispatchers
Expand All @@ -33,15 +33,14 @@ class ScheduleViewModel(
MoreApplication.shared!!.repositories,
MoreApplication.shared!!.dataRecorder,
scheduleListType = scheduleListType,
coreFilterModel = coreDashboardFilterViewModel,
observationFactory = MoreApplication.shared!!.observationFactory
coreFilterModel = coreDashboardFilterViewModel
)

val polarHrReady: MutableState<Boolean> = mutableStateOf(false)

init {
viewModelScope.launch(Dispatchers.IO) {
PolarHeartRateObservation.hrReady.collect {
PolarStates.hrFeatureReady.collect {
withContext(Dispatchers.Main) {
polarHrReady.value = it
}
Expand All @@ -56,10 +55,4 @@ class ScheduleViewModel(
fun pauseObservation(scheduleId: String) {
coreViewModel.pause(scheduleId)
}

fun stopObservation(scheduleId: String) {
coreViewModel.stop(scheduleId)
}

fun numberOfObservationErrors(): Int = coreViewModel.numberOfObservationErrors()
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class MainViewModel(context: Context) : ViewModel() {
}

viewModelScope.launch {
ViewManager.showBluetoothView.collect {
ViewManager.bleViewActive.collect {
if (it && !lastBleViewState) {
openBLESetupActivity(context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import androidx.compose.runtime.mutableStateListOf
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import io.github.aakira.napier.Napier
import io.redlink.more.app.android.MoreApplication
import io.redlink.more.more_app_mutliplatform.observations.Observation
import io.redlink.more.more_app_mutliplatform.observations.ObservationStates
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
Expand All @@ -16,7 +16,7 @@ class ObservationErrorViewModel : ViewModel() {

init {
viewModelScope.launch(Dispatchers.IO) {
MoreApplication.shared!!.observationFactory.observationErrors.collect {
ObservationStates.observationErrors.collect {
Napier.d { it.toString() }
val (actions, errors) = it.values.flatten().toSet()
.partition { it == Observation.ERROR_DEVICE_NOT_CONNECTED }
Expand All @@ -30,5 +30,4 @@ class ObservationErrorViewModel : ViewModel() {
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import io.redlink.more.app.android.MoreApplication
import io.redlink.more.app.android.observations.HR.PolarHeartRateObservation
import io.redlink.more.more_app_mutliplatform.observations.DataRecorder
import io.redlink.more.more_app_mutliplatform.observations.ObservationFactory
import io.redlink.more.more_app_mutliplatform.services.bluetooth.polar.PolarStates
import io.redlink.more.more_app_mutliplatform.viewModels.tasks.CoreTaskDetailsViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand All @@ -31,15 +31,14 @@ class TaskDetailsViewModel(
CoreTaskDetailsViewModel(
MoreApplication.shared!!.repositories,
dataRecorder,
observationFactory,
scheduleId
)

val polarHrReady = mutableStateOf(false)

init {
viewModelScope.launch(Dispatchers.IO) {
PolarHeartRateObservation.hrReady.collect {
PolarStates.hrFeatureReady.collect {
withContext(Dispatchers.Main) {
polarHrReady.value = it
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ package io.redlink.more.app.android.observations.HR

import com.polar.sdk.api.PolarBleApi
import com.polar.sdk.api.model.PolarDeviceInfo
import io.redlink.more.more_app_mutliplatform.services.bluetooth.BluetoothState

interface PolarConnectorListener {
fun onPolarFeatureReady(feature: PolarBleApi.PolarBleSdkFeature)
fun onDeviceConnected(polarDeviceInfo: PolarDeviceInfo)
fun onDeviceDisconnected(polarDeviceInfo: PolarDeviceInfo)

fun onDeviceConnecting(polarDeviceInfo: PolarDeviceInfo)

fun onPowerChange(bluetoothState: BluetoothState)
}
Loading