mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-04 17:23:25 +00:00
ADD - add iOS-style control center
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
useNotificationsStore,
|
||||
type PhoneNotificationDevice,
|
||||
} from '@/stores/notifications'
|
||||
import { usePhoneStore } from '@/stores/phone'
|
||||
import {
|
||||
DEFAULT_PHONE_PREFERENCES,
|
||||
type PhonePreferencesV1,
|
||||
@@ -104,4 +105,26 @@ describe('notifications store', () => {
|
||||
expect(id).toBeNull()
|
||||
expect(notifications.devicePreviews).toEqual([])
|
||||
})
|
||||
|
||||
it('suppresses normal notifications during Focus but keeps critical alerts', () => {
|
||||
const phone = usePhoneStore()
|
||||
const notifications = useNotificationsStore()
|
||||
phone.preferences.settings.focusMode = true
|
||||
|
||||
const normalId = notifications.show({
|
||||
appId: 'mail',
|
||||
text: 'Quiet message',
|
||||
title: 'Mail',
|
||||
})
|
||||
const criticalId = notifications.show({
|
||||
appId: 'clock',
|
||||
critical: true,
|
||||
text: 'Timer finished',
|
||||
title: 'Clock',
|
||||
})
|
||||
|
||||
expect(normalId).toBeNull()
|
||||
expect(criticalId).not.toBeNull()
|
||||
expect(notifications.current?.text).toBe('Timer finished')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -123,6 +123,7 @@ export const useNotificationsStore = defineStore('notifications', () => {
|
||||
console.error(`[Phone notifications] Unknown app: ${input.appId}`)
|
||||
return null
|
||||
}
|
||||
if (!input.critical && preferences.settings.focusMode) return null
|
||||
if (!input.critical && !appPreferences.enabled) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -1030,6 +1030,31 @@ const defaultLocales: LocaleTree = {
|
||||
},
|
||||
},
|
||||
},
|
||||
ControlCenter: {
|
||||
airplaneMode: 'Airplane Mode',
|
||||
bluetooth: 'Bluetooth',
|
||||
brightness: 'Brightness',
|
||||
calculator: 'Calculator',
|
||||
camera: 'Camera',
|
||||
cellular: 'Cellular Data',
|
||||
close: 'Close Control Center',
|
||||
flashlight: 'Flashlight',
|
||||
focus: 'Focus',
|
||||
label: 'Control Center',
|
||||
media: 'Media',
|
||||
muteRingtone: 'Mute ringtone and notifications',
|
||||
next: 'Next track',
|
||||
notPlaying: 'Not Playing',
|
||||
open: 'Open Control Center',
|
||||
play: 'Play',
|
||||
previous: 'Previous track',
|
||||
quickActions: 'Quick actions',
|
||||
rotationLock: 'Rotation Lock',
|
||||
timer: 'Timer',
|
||||
unmuteRingtone: 'Unmute ringtone and notifications',
|
||||
volume: 'Volume',
|
||||
wifi: 'Wi-Fi',
|
||||
},
|
||||
Common: {
|
||||
add: 'Add',
|
||||
cancel: 'Cancel',
|
||||
@@ -1189,6 +1214,12 @@ export const usePhoneStore = defineStore('phone', {
|
||||
this.preferences.settings[key] = value
|
||||
this.saveDeviceNamespace('settings', this.preferences)
|
||||
},
|
||||
setAlertVolumes(value: number): void {
|
||||
const volume = Math.min(100, Math.max(0, Math.round(value)))
|
||||
this.preferences.settings.notificationVolume = volume
|
||||
this.preferences.settings.ringtoneVolume = volume
|
||||
this.saveDeviceNamespace('settings', this.preferences)
|
||||
},
|
||||
setSystemDarkMode(value: boolean): void {
|
||||
this.systemDarkMode = value
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user