-
Notifications
You must be signed in to change notification settings - Fork 5
feat: rebuild sample app as an 8-screen haptic verification harness #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
74e6560
feat(compose): add HapticCapabilities read API for device capability …
l2hyunwoo b94cc2f
chore(sample): bundle Instrument Sans and IBM Plex Mono fonts (OFL)
l2hyunwoo 03d4e07
feat(sample): add Jindong design system, theme and shared harness com…
l2hyunwoo 93d7c7c
feat(sample): rebuild sample app as 8-screen haptic verification harness
l2hyunwoo 1e0b58d
fix(sample): apply system bar safe-area insets in JindongScaffold
l2hyunwoo ca4a45a
refactor(sample): replace emoji glyphs with self-defined vector icons
l2hyunwoo 2e0f736
fix(core): default hasAmplitudeControl and gate it on iOS support
l2hyunwoo 0cad8ed
fix(sample): key Single Haptic playback on the play trigger only
l2hyunwoo a5938f5
fix(sample): align preview timelines with replayed patterns and gate …
l2hyunwoo f22540b
fix(sample): make 48dp touch targets tappable and add button roles
l2hyunwoo 69d1ab4
fix(sample): return to Home on Android system back via PlatformBackHa…
l2hyunwoo 6e858de
fix(sample): round formatFixed zero-decimals and derive Reactive Actu…
l2hyunwoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
18 changes: 18 additions & 0 deletions
18
...ng-compose/src/androidMain/kotlin/io/github/compose/jindong/HapticCapabilities.android.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* | ||
| * Copyright (C) 2026 compose-jindong | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.github.compose.jindong | ||
|
|
||
| internal actual fun hapticPlatform(): HapticPlatform = HapticPlatform.Android |
75 changes: 75 additions & 0 deletions
75
jindong-compose/src/commonMain/kotlin/io/github/compose/jindong/HapticCapabilities.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /* | ||
| * Copyright (C) 2026 compose-jindong | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.github.compose.jindong | ||
|
|
||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.remember | ||
| import io.github.compose.jindong.executor.LocalHapticExecutor | ||
|
|
||
| /** | ||
| * Platform a haptic capability reading was taken on. | ||
| */ | ||
| enum class HapticPlatform { | ||
| Android, | ||
| Ios, | ||
| } | ||
|
|
||
| /** | ||
| * Snapshot of the current device's haptic capabilities, read from the active [HapticExecutor]. | ||
| * | ||
| * @property isSupported whether haptic feedback is available at all on this device. | ||
| * @property hasAmplitudeControl whether the actuator renders intermediate amplitudes. On Android | ||
| * this is `false` for ERM motors (every non-zero amplitude rounds up to 100%) and `true` for LRA | ||
| * motors. On iOS Core Haptics is always continuous, so this is always `true`; pair it with | ||
| * [platform] when the displayed label needs to distinguish "Yes/No" (Android) from | ||
| * "Continuous" (iOS). | ||
| * @property platform the platform this reading came from. | ||
| */ | ||
| data class HapticCapabilities( | ||
| val isSupported: Boolean, | ||
| val hasAmplitudeControl: Boolean, | ||
| val platform: HapticPlatform, | ||
| ) | ||
|
|
||
| /** | ||
| * Reads the current device's [HapticCapabilities] from the haptic executor provided by | ||
| * [JindongProvider]. Must be called inside a `JindongProvider { }` scope. | ||
| * | ||
| * Example: | ||
| * ``` | ||
| * JindongProvider { | ||
| * val capabilities = rememberHapticCapabilities() | ||
| * // capabilities.isSupported, capabilities.hasAmplitudeControl, capabilities.platform | ||
| * } | ||
| * ``` | ||
| */ | ||
| @Composable | ||
| fun rememberHapticCapabilities(): HapticCapabilities { | ||
| val executor = LocalHapticExecutor.current | ||
| val platform = hapticPlatform() | ||
| return remember(executor, platform) { | ||
| HapticCapabilities( | ||
| isSupported = executor.isSupported, | ||
| hasAmplitudeControl = executor.hasAmplitudeControl, | ||
| platform = platform, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns the [HapticPlatform] the app is currently running on. | ||
| */ | ||
| internal expect fun hapticPlatform(): HapticPlatform |
37 changes: 37 additions & 0 deletions
37
jindong-compose/src/commonTest/kotlin/io/github/compose/jindong/HapticCapabilitiesTest.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * Copyright (C) 2026 compose-jindong | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.github.compose.jindong | ||
|
|
||
| import io.kotest.assertions.assertSoftly | ||
| import io.kotest.core.spec.style.FunSpec | ||
| import io.kotest.matchers.shouldBe | ||
|
|
||
| class HapticCapabilitiesTest : | ||
| FunSpec({ | ||
| test("HapticCapabilities holds the supplied values") { | ||
| val capabilities = HapticCapabilities( | ||
| isSupported = true, | ||
| hasAmplitudeControl = false, | ||
| platform = HapticPlatform.Android, | ||
| ) | ||
|
|
||
| assertSoftly(capabilities) { | ||
| isSupported shouldBe true | ||
| hasAmplitudeControl shouldBe false | ||
| platform shouldBe HapticPlatform.Android | ||
| } | ||
| } | ||
| }) |
18 changes: 18 additions & 0 deletions
18
jindong-compose/src/iosMain/kotlin/io/github/compose/jindong/HapticCapabilities.ios.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* | ||
| * Copyright (C) 2026 compose-jindong | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.github.compose.jindong | ||
|
|
||
| internal actual fun hapticPlatform(): HapticPlatform = HapticPlatform.Ios |
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
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
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
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
31 changes: 31 additions & 0 deletions
31
...commonTest/kotlin/io/github/compose/jindong/core/executor/HapticExecutorCapabilityTest.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Copyright (C) 2026 compose-jindong | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.github.compose.jindong.core.executor | ||
|
|
||
| import io.github.compose.jindong.core.fake.FakeHapticExecutor | ||
| import io.kotest.core.spec.style.FunSpec | ||
| import io.kotest.matchers.shouldBe | ||
|
|
||
| class HapticExecutorCapabilityTest : | ||
| FunSpec({ | ||
| test("hasAmplitudeControl defaults to true") { | ||
| FakeHapticExecutor().hasAmplitudeControl shouldBe true | ||
| } | ||
|
|
||
| test("hasAmplitudeControl can be overridden via constructor") { | ||
| FakeHapticExecutor(hasAmplitudeControl = false).hasAmplitudeControl shouldBe false | ||
| } | ||
| }) |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.