mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-05 12:07:25 +00:00
feat(ui): top-right 日程按钮 — add current/next pass to system calendar on radar and passes pages
Restores the original repo's calendar function (ic_calendar → AddToCalendar via CalendarContract ACTION_INSERT) to the top-right of both pages, replacing the map buttons: - Radar page: back to upstream's addToCalendar (current pass name/aos/los). - Passes page: new PassesAction.AddToCalendar wired through PassesViewModel + container.provideAddToCalendar() (next pass name/aos/los); left button back to the pass filter (reverts the earlier radios-button swap). The map button is gone from both top bars — the map is now a bottom-nav tab. Also drops the now-dead openMapRequest/navigateToMap navigation chain in NavRoot/MainScreen that only the radar map button used.
This commit is contained in:
1 parent
14b98cc7b1
commit
d56392f3c6
5 files changed
+34
-38
No files matched your search
@@ -156,7 +156,7 @@ private fun PassesScreen(
|
||||
TopBar(
|
||||
isVerticalLayout = isVerticalLayout,
|
||||
startAction = {
|
||||
IconCard(action = { onAction(PassesAction.ToggleRadiosDialog) }, resId = R.drawable.ic_radios)
|
||||
IconCard(action = { onAction(PassesAction.TogglePassesDialog) }, resId = R.drawable.ic_filter)
|
||||
},
|
||||
topInfo = {
|
||||
TimerRow(timeString = uiState.nextTime, isTimeAos = uiState.isNextTimeAos)
|
||||
@@ -165,7 +165,19 @@ private fun PassesScreen(
|
||||
NextPassRow(pass = uiState.nextPass, isUtc = uiState.isUtc)
|
||||
},
|
||||
endAction = {
|
||||
IconCard(action = { onAction(PassesAction.TogglePassesDialog) }, resId = R.drawable.ic_filter)
|
||||
// 日程功能: 把下个过境写入系统日历 (原仓库雷达页的 addToCalendar).
|
||||
IconCard(
|
||||
action = {
|
||||
onAction(
|
||||
PassesAction.AddToCalendar(
|
||||
uiState.nextPass.name,
|
||||
uiState.nextPass.aosTime,
|
||||
uiState.nextPass.losTime
|
||||
)
|
||||
)
|
||||
},
|
||||
resId = R.drawable.ic_calendar
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -61,4 +61,6 @@ sealed interface PassesAction {
|
||||
data object ToggleRadiosDialog : PassesAction
|
||||
data class FocusCatNum(val catNum: Int) : PassesAction
|
||||
data object ClearFocus : PassesAction
|
||||
/** 日程功能: 把下个过境写入系统日历 (ic_calendar 按钮). */
|
||||
data class AddToCalendar(val name: String, val aosTime: Long, val losTime: Long) : PassesAction
|
||||
}
|
||||
+7
-2
@@ -28,6 +28,7 @@ import com.rtbishop.look4sat.core.domain.predict.OrbitalPass
|
||||
import com.rtbishop.look4sat.core.domain.repository.IMainContainer
|
||||
import com.rtbishop.look4sat.core.domain.repository.ISatelliteRepo
|
||||
import com.rtbishop.look4sat.core.domain.repository.ISettingsRepo
|
||||
import com.rtbishop.look4sat.core.domain.usecase.IAddToCalendar
|
||||
import com.rtbishop.look4sat.core.domain.utility.round
|
||||
import com.rtbishop.look4sat.core.domain.utility.toTimerString
|
||||
import com.rtbishop.look4sat.core.presentation.getDefaultPass
|
||||
@@ -46,7 +47,8 @@ import java.util.TimeZone
|
||||
|
||||
class PassesViewModel(
|
||||
private val satelliteRepo: ISatelliteRepo,
|
||||
private val settingsRepo: ISettingsRepo
|
||||
private val settingsRepo: ISettingsRepo,
|
||||
private val addToCalendar: IAddToCalendar
|
||||
) : ViewModel() {
|
||||
|
||||
private val defaultPass = getDefaultPass()
|
||||
@@ -151,6 +153,8 @@ class PassesViewModel(
|
||||
_uiState.update { it.copy(isRadiosDialogShown = !it.isRadiosDialogShown) }
|
||||
is PassesAction.FocusCatNum -> _uiState.update { it.copy(focusedCatNum = action.catNum) }
|
||||
PassesAction.ClearFocus -> _uiState.update { it.copy(focusedCatNum = null) }
|
||||
is PassesAction.AddToCalendar ->
|
||||
addToCalendar(action.name, action.aosTime, action.losTime)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,7 +349,8 @@ class PassesViewModel(
|
||||
initializer {
|
||||
PassesViewModel(
|
||||
satelliteRepo = container.satelliteRepo,
|
||||
settingsRepo = container.settingsRepo
|
||||
settingsRepo = container.settingsRepo,
|
||||
addToCalendar = container.provideAddToCalendar()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user