feat: add haptic feedback toggle setting

- Add haptic_enabled field to AppDTO with default value true
- Update SettingsSerializerService to deserialize haptic_enabled
- Add haptic_enabled setting in admin panel (GeneralView) with toggle
- Update admin settings store to include haptic_enabled default value
- Update SPA SettingsStore to load haptic_enabled from API
- Refactor useHapticFeedback composable to return safe wrapper object
- Replace all direct window.Telegram.WebApp.HapticFeedback usage with composable
- Update useHapticScroll to use useHapticFeedback composable
- Add getHapticFeedback helper function in CheckoutStore for store usage
- Add haptic_enabled default value to app.php configuration
- All haptic feedback methods now check settings internally
- Remove redundant if checks from components (handled in composable)
This commit is contained in:
2025-12-25 22:34:23 +03:00
parent ce2ea9dea1
commit afade85d00
23 changed files with 147 additions and 35 deletions

View File

@@ -20,6 +20,7 @@ export const useSettingsStore = defineStore('settings', {
privacy_policy_link: null,
image_aspect_ratio: '1:1',
image_crop_algorithm: 'cover',
haptic_enabled: true,
},
telegram: {

View File

@@ -62,6 +62,10 @@
<li><strong>Resize</strong> - изменяет размер изображения с сохранением пропорций (без обрезки)</li>
</ul>
</ItemSelect>
<ItemBool label="Тактильная обратная связь (Haptic Feedback)" v-model="settings.items.app.haptic_enabled">
Включить виброотклик при взаимодействии с элементами интерфейса. Если выключено, тактильная обратная связь не будет использоваться.
</ItemBool>
</template>
<script setup>