feat: add watch pairing tweaks - #29
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces functionality to bypass region and CSC checks during Samsung Watch pairing. Key additions include a new WatchPairing hook class, updated preference models, and UI components for configuring connection modes and GMS supplementation. Feedback highlights a potential crash in WatchPairing.kt when modifying the package list if the returned set is immutable, and suggests consolidating duplicate constants between the UI and hook logic to a shared location for better maintainability.
| val packages = param.result as? MutableSet<*> ?: return | ||
| @Suppress("UNCHECKED_CAST") | ||
| (packages as MutableSet<String>).add("com.google.android.wearable.app.cn") | ||
| } |
There was a problem hiding this comment.
Directly casting the result to MutableSet and calling add can cause a crash if the target application returns an immutable set (e.g., via Collections.unmodifiableSet or Set.of). It is safer to create a new mutable copy of the set, modify it, and then set it as the new result.
val packages = param.result as? Set<*> ?: return
val newSet = packages.toMutableSet()
@Suppress("UNCHECKED_CAST")
(newSet as MutableSet<String>).add("com.google.android.wearable.app.cn")
param.result = newSet| import io.github.soclear.oneuix.ui.component.SelectItem | ||
| import io.github.soclear.oneuix.ui.component.SwitchItem | ||
|
|
||
| private const val WATCH_PAIRING_MODE_CN = 1 |
There was a problem hiding this comment.
|
挺好的 |
No description provided.