diff --git a/frontend/src/components/PhoneLockScreen.contract.test.ts b/frontend/src/components/PhoneLockScreen.contract.test.ts index 5bf1314..cc79004 100644 --- a/frontend/src/components/PhoneLockScreen.contract.test.ts +++ b/frontend/src/components/PhoneLockScreen.contract.test.ts @@ -6,8 +6,18 @@ const styles = readFileSync( new URL('../assets/main.css', import.meta.url), 'utf8', ) +const source = readFileSync( + new URL('./PhoneLockScreen.vue', import.meta.url), + 'utf8', +) describe('PhoneLockScreen notification theme contract', () => { + it('uses the dedicated Lock Screen wallpaper preference', () => { + expect(source).toContain('settings.lockWallpaperImageUrl') + expect(source).toContain('settings.lockWallpaper') + expect(source).not.toContain('settings.wallpaperImageUrl') + }) + it('uses explicit light and dark notification material tokens', () => { expect(styles).toMatch( /\.lock-screen\s*\{[^}]*--lock-notification-background:\s*rgb\(38 36 40 \/ 76%\)[^}]*--lock-notification-color:\s*#fff/s, diff --git a/frontend/src/components/PhoneLockScreen.vue b/frontend/src/components/PhoneLockScreen.vue index a81424f..a09ddda 100644 --- a/frontend/src/components/PhoneLockScreen.vue +++ b/frontend/src/components/PhoneLockScreen.vue @@ -74,10 +74,10 @@ const time = computed(() => .trim(), ) const dragStyle = computed>(() => { - const imageUrl = preferences.value.settings.wallpaperImageUrl + const imageUrl = preferences.value.settings.lockWallpaperImageUrl return { '--lock-drag': `${dragOffset.value}px`, - ...(preferences.value.settings.wallpaper === 'custom' && imageUrl + ...(preferences.value.settings.lockWallpaper === 'custom' && imageUrl ? { '--phone-wallpaper-image': `url(${JSON.stringify(imageUrl)})` } : {}), } @@ -289,7 +289,7 @@ onBeforeUnmount(() => {
('home') const selectedFrameColor = computed( () => PHONE_FRAME_COLORS[phone.preferences.settings.frame], ) @@ -201,6 +204,16 @@ let factoryResetAnimationFrame: number | undefined const wallpaperHistory = computed( () => phone.preferences.settings.wallpaperHistory, ) +const selectedWallpaper = computed(() => + wallpaperTarget.value === 'home' + ? phone.preferences.settings.wallpaper + : phone.preferences.settings.lockWallpaper, +) +const selectedWallpaperImageUrl = computed(() => + wallpaperTarget.value === 'home' + ? phone.preferences.settings.wallpaperImageUrl + : phone.preferences.settings.lockWallpaperImageUrl, +) const toggleRows = [ { @@ -273,10 +286,11 @@ function openSkyUiKitchenSink(): void { } function openWallpaperMedia(app: 'photos' | 'camera'): void { + const target = wallpaperTarget.value mediaPicker.begin( - 'settings:wallpaper', + `settings:wallpaper:${target}`, 'photo', - '/apps/settings?wallpaper=1', + `/apps/settings?wallpaper=1&wallpaperTarget=${target}`, 1, ) void router.push({ @@ -293,7 +307,18 @@ function wallpaperPreviewStyle( } function selectWallpaperHistory(entry: WallpaperHistoryEntry): void { - phone.setWallpaper(entry.wallpaper, entry.imageUrl) + phone.setWallpaper(entry.wallpaper, entry.imageUrl, wallpaperTarget.value) +} + +function isWallpaperSelected(entry: WallpaperHistoryEntry): boolean { + return ( + selectedWallpaper.value === entry.wallpaper && + selectedWallpaperImageUrl.value === entry.imageUrl + ) +} + +function selectBuiltInWallpaper(wallpaper: WallpaperId): void { + phone.setWallpaper(wallpaper, null, wallpaperTarget.value) } const connectivityRows = [ @@ -671,10 +696,18 @@ async function confirmSimEject(): Promise { } onMounted(() => { - if (route.query.wallpaper === '1') activeView.value = 'wallpaper' + if (route.query.wallpaper === '1') { + activeView.value = 'wallpaper' + wallpaperTarget.value = + route.query.wallpaperTarget === 'lock' ? 'lock' : 'home' + } - const selectedPhoto = mediaPicker.consume('settings:wallpaper') - if (selectedPhoto) phone.setWallpaper('custom', selectedPhoto.url) + const selectedPhoto = mediaPicker.consume( + `settings:wallpaper:${wallpaperTarget.value}`, + ) + if (selectedPhoto) { + phone.setWallpaper('custom', selectedPhoto.url, wallpaperTarget.value) + } }) onBeforeUnmount(() => { @@ -1459,6 +1492,28 @@ onBeforeUnmount(() => {