This commit is contained in:
kornerr committed 2026-11-19 23:21:51 +03:00
1 parent 7ce81d2650
commit 9b07ff5892
4 files changed
+8 -4

No files matched your search

+4 -1
View File
@@ -15,7 +15,10 @@ fun hcmAnimateDisappearance(ids: Array<Int>) {
}, HCM_DELAY.toLong())
}
fun hcmVibrate() {
fun hcmVibrate(matchedItemIds: Array<Int>) {
if (matchedItemIds.isEmpty()) {
return
}
Handler(Looper.getMainLooper()).post {
HCMVM.shared!!.hapticView?.let { view ->
ViewCompat.performHapticFeedback(view, HapticFeedbackConstantsCompat.CONFIRM)
+2 -1
View File
@@ -15,8 +15,9 @@ func hcmAnimateDisappearance(_ ids: [Int]) {
}
}
func hcmVibrate() {
func hcmVibrate(_ matchedItemIds: [Int]) {
#if os(iOS)
guard !matchedItemIds.isEmpty else { return }
DispatchQueue.main.async {
UINotificationFeedbackGenerator().notificationOccurred(.success)
}
+1 -1
View File
@@ -38,7 +38,7 @@ HCMComponent:
- itemPositions: renderSet(F.itemPositions, c.itemPositions)
- items: renderSet(F.items, c.items)
- matchedItemIds: renderSet(F.matchedItemIds, c.matchedItemIds)
- matchedItemIds: if !c.matchedItemIds.isEmpty { hcmVibrate() }
- matchedItemIds: hcmVibrate(c.matchedItemIds)
- matchedItemIds: hcmAnimateDisappearance(c.matchedItemIds)
- selectionPair: renderSet(F.selectionPair, c.selectionPair)
- stats: HCMVM.shared!.stats = c.stats
@@ -1098,7 +1098,7 @@ func hcmRegisterEffects(_ ctrl: DialectController) {
F.itemPositions, { (c: HCMContext) in renderSet(F.itemPositions, c.itemPositions) },
F.items, { (c: HCMContext) in renderSet(F.items, c.items) },
F.matchedItemIds, { (c: HCMContext) in renderSet(F.matchedItemIds, c.matchedItemIds) },
F.matchedItemIds, { (c: HCMContext) in if !c.matchedItemIds.isEmpty { hcmVibrate() } },
F.matchedItemIds, { (c: HCMContext) in hcmVibrate(c.matchedItemIds) },
F.matchedItemIds, { (c: HCMContext) in hcmAnimateDisappearance(c.matchedItemIds) },
F.selectionPair, { (c: HCMContext) in renderSet(F.selectionPair, c.selectionPair) },
F.stats, { (c: HCMContext) in HCMVM.shared!.stats = c.stats },