Implement WatchApp version for quick calculation#163
Open
hieuwu wants to merge 59 commits into
Open
Conversation
# Conflicts: # gradle.properties # gradle/libs.versions.toml # settings.gradle
# Conflicts: # gradle/libs.versions.toml
hieuwu
commented
May 11, 2026
| import javax.inject.Inject | ||
| import javax.inject.Singleton | ||
|
|
||
| @Singleton |
Collaborator
Author
There was a problem hiding this comment.
These @Singleton annotations are added in RepoModule.
This is to avoid conflict of generated code used in watchapp, the watch version uses Hilt for DI
mdrlzy
requested changes
Jun 6, 2026
mdrlzy
left a comment
Collaborator
There was a problem hiding this comment.
Looks great!
I have a couple of comments. We should add Orbit MVI and replace Hilt with Dagger to keep it consistent with the rest of the codebase.
The watch face UI could also be improved, but we can handle that in a separate PR once the design is ready.
Comment on lines
+44
to
+47
| @Composable | ||
| fun CurrencyInputField( | ||
| label: String, | ||
| currencyCode: String, |
Comment on lines
+30
to
+34
| @Composable | ||
| fun OptionItem( | ||
| modifier: Modifier = Modifier, | ||
| icon: Painter, | ||
| text: String, |
Comment on lines
+19
to
+22
| @Composable | ||
| fun OptionsMenu(modifier: Modifier = Modifier) { | ||
| ScalingLazyColumn( | ||
| modifier = modifier.fillMaxSize(), |
Comment on lines
+27
to
+31
| @Composable | ||
| fun SwapButton( | ||
| onSwapClick: () -> Unit, | ||
| modifier: Modifier = Modifier | ||
| ) { |
Comment on lines
+28
to
+32
| @Composable | ||
| fun WearNumpad( | ||
| modifier: Modifier = Modifier, | ||
| amount: String, | ||
| onNumberClick: (Int) -> Unit, |
Comment on lines
+10
to
+14
| @HiltViewModel | ||
| class MainViewModel @Inject constructor( | ||
| private val currencyRepo: CurrencyRepo, | ||
| ): ViewModel() { | ||
|
|
Comment on lines
+50
to
+75
| if (showDeleteDialog) { | ||
| WearConfirmationDialog( | ||
| title = "Delete Pair", | ||
| message = "Are you sure you want to delete this pair?", | ||
| onConfirm = { | ||
| showDeleteDialog = false | ||
| viewModel.deletePair(onDeleted = { | ||
| onDeleteSuccess("Deleted Successfully") | ||
| }) | ||
| }, | ||
| onDismiss = { | ||
| showDeleteDialog = false | ||
| onDismiss() | ||
| }, | ||
| isDestructive = true | ||
| ) | ||
| } | ||
|
|
||
| if (showPinLimitDialog) { | ||
| WearInfoDialog( | ||
| title = "Pin Limit Reached", | ||
| message = "You can only pin up to 4 pairs. Please unpin another pair first.", | ||
| onDismiss = { viewModel.dismissPinLimitDialog() }, | ||
| dismissText = "Ok got it" | ||
| ) | ||
| } |
Comment on lines
+83
to
+88
| if (state.isSaved) { | ||
| val message = if (state.editId != null) "Updated Successfully" else "Added Successfully" | ||
| LaunchedEffect(Unit) { | ||
| onNavigateToSuccess(message) | ||
| } | ||
| } |
Comment on lines
+51
to
+54
| // Check limit | ||
| val pinnedCount = quickRepo.getAll().count { it.isPinned() } | ||
| if (pinnedCount >= 4) { | ||
| _showPinLimitDialog.value = true |
Collaborator
There was a problem hiding this comment.
We should discuss this. What is the motivation behind limiting pinned pairs?
Comment on lines
+56
to
+77
| // Pin | ||
| val updated = pair.copy(pinnedDate = java.time.OffsetDateTime.now()) | ||
| quickRepo.insert(updated) | ||
| WatchRefreshManager.refreshComplications(application) | ||
| onSuccess(true) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fun dismissPinLimitDialog() { | ||
| _showPinLimitDialog.value = false | ||
| } | ||
|
|
||
| fun deletePair(onDeleted: () -> Unit) { | ||
| viewModelScope.launch { | ||
| _quickPair.value?.let { p -> | ||
| quickRepo.delete(p.id) | ||
| onDeleted() | ||
| } | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
Should we also call refreshComplications() after deleting pair?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Description
Watchapp version for quick pairs
✅ Changes
Watch app built with compose for WearOS with basic functionalities:
🎯 How to Test
See the video
📸 Screenshots / Demo (if applicable)
Currency.converter.watchapp.mp4
🔗 Related Tickets / Issues
N/A