Improve Android haptic, offer toggle for haptics in the app (#3482)

* improve android haptics, offer toggle for haptics

* update haptics.ts

* default to false

* simplify to `playHaptic`

* just leave them as `feedInfo`

* use a hook for `playHaptic`

* missed one of them
This commit is contained in:
Hailey 2024-04-11 15:20:26 -07:00 committed by GitHub
parent 9007810cdb
commit 740cd029d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 235 additions and 204 deletions

View file

@ -2,7 +2,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage'
import {logger} from '#/logger'
import {defaults, Schema, schema} from '#/state/persisted/schema'
import {write, read} from '#/state/persisted/store'
import {read, write} from '#/state/persisted/store'
/**
* The shape of the serialized data from our legacy Mobx store.
@ -113,6 +113,7 @@ export function transform(legacy: Partial<LegacySchema>): Schema {
externalEmbeds: defaults.externalEmbeds,
lastSelectedHomeFeed: defaults.lastSelectedHomeFeed,
pdsAddressHistory: defaults.pdsAddressHistory,
disableHaptics: defaults.disableHaptics,
}
}

View file

@ -1,4 +1,5 @@
import {z} from 'zod'
import {deviceLocales} from '#/platform/detection'
const externalEmbedOptions = ['show', 'hide'] as const
@ -58,6 +59,7 @@ export const schema = z.object({
useInAppBrowser: z.boolean().optional(),
lastSelectedHomeFeed: z.string().optional(),
pdsAddressHistory: z.array(z.string()).optional(),
disableHaptics: z.boolean().optional(),
})
export type Schema = z.infer<typeof schema>
@ -93,4 +95,5 @@ export const defaults: Schema = {
useInAppBrowser: undefined,
lastSelectedHomeFeed: undefined,
pdsAddressHistory: [],
disableHaptics: false,
}