From 1ca51d3e5c09298dc3ebcef4740ef1d33d9db499 Mon Sep 17 00:00:00 2001 From: He Hang Date: Sat, 11 Nov 2023 00:11:50 +0800 Subject: [PATCH] Hide change volume on ios --- web/src/components/Footer.vue | 95 ++++++++++++----------- web/src/components/Header.vue | 2 +- web/src/components/MusicList.vue | 2 +- web/src/components/Playlist.vue | 2 +- web/src/components/SideMenu.vue | 2 +- web/src/components/player/DefaultMode.vue | 6 +- web/src/components/player/Jukebox.vue | 2 +- web/src/components/player/Lyric.vue | 15 +++- web/src/components/player/LyricMode.vue | 3 - web/src/style/base.less | 2 +- web/src/utils/http.ts | 5 +- web/src/utils/utils.ts | 10 ++- web/src/views/playlist.vue | 4 +- web/src/views/ranking.vue | 2 +- web/src/views/recommend.vue | 2 +- web/src/views/search.vue | 2 +- web/src/views/setting.vue | 2 +- 17 files changed, 82 insertions(+), 76 deletions(-) diff --git a/web/src/components/Footer.vue b/web/src/components/Footer.vue index 952ad25..dd64551 100644 --- a/web/src/components/Footer.vue +++ b/web/src/components/Footer.vue @@ -2,6 +2,7 @@ import { usePlayStore } from '../stores/play'; import { SortType } from '../utils/type'; import { LogoImage } from '../utils/logo'; +import { isIOS } from '../utils/utils'; interface Props { full?: boolean; } @@ -44,16 +45,16 @@ const play = usePlayStore();
+
 
{ class="music-lyric-line"> {{ line }}
+
 
@@ -104,6 +106,7 @@ onUnmounted(() => { display: flex; flex-direction: column; justify-content: center; + padding: var(--music-page-padding-horizontal); &-pure { text-align: center; } @@ -141,6 +144,13 @@ onUnmounted(() => { &::-webkit-scrollbar-thumb { background-color: transparent; } + -webkit-mask: linear-gradient( + 0, + rgba(0, 0, 0, 0) 0%, + rgba(0, 0, 0, 1) 15%, + rgba(0, 0, 0, 1) 85%, + rgba(0, 0, 0, 0) 100% + ); } &-line { opacity: 0.6; @@ -156,15 +166,12 @@ onUnmounted(() => { } } } -@media (max-width: 720px), (max-height: 720px) { +@media (max-width: 800px) { .music-lyric { &-header { height: unset; margin-bottom: 10px; } - &-pure { - padding: 0 0 10px 0; - } } } diff --git a/web/src/components/player/LyricMode.vue b/web/src/components/player/LyricMode.vue index 6ea4548..657d00a 100644 --- a/web/src/components/player/LyricMode.vue +++ b/web/src/components/player/LyricMode.vue @@ -12,8 +12,5 @@ import Lyric from './Lyric.vue'; .music-mode-lyric { height: 100%; width: 100%; - & > .music-lyric { - padding: 30px 0; - } } diff --git a/web/src/style/base.less b/web/src/style/base.less index 8cf66ce..66d07fe 100644 --- a/web/src/style/base.less +++ b/web/src/style/base.less @@ -43,7 +43,7 @@ rgb(235, 240, 251), rgb(248, 239, 241)); - @media (max-width: 720px), + @media (max-width: 800px), (max-height: 720px) { --music-page-padding-horizontal: 10px; } diff --git a/web/src/utils/http.ts b/web/src/utils/http.ts index 50b353f..72ebddf 100644 --- a/web/src/utils/http.ts +++ b/web/src/utils/http.ts @@ -5,9 +5,8 @@ const musicRouterPrefix = localStorage.getItem('musiche-router-prefix'); const history = musicRouterPrefix ? '/' + musicRouterPrefix : ''; const httpAddress = import.meta.env.DEV ? '127.0.0.1:54621' : location.host; -const proxyAddress = - (!webView2Services.enabled && - localStorage.getItem('musiche-proxy-address')) || +const proxyAddress = 'https://music.picapico.top/proxy'; +(!webView2Services.enabled && localStorage.getItem('musiche-proxy-address')) || `//${httpAddress}/proxy`; const useLocalAudio = !webView2Services.enabled; var localAudio: AudioPlayer | null = null; diff --git a/web/src/utils/utils.ts b/web/src/utils/utils.ts index 46c5708..c8c24d4 100644 --- a/web/src/utils/utils.ts +++ b/web/src/utils/utils.ts @@ -46,8 +46,11 @@ export const isInStandaloneMode = Boolean( ('standalone' in window.navigator && window.navigator.standalone) || window.matchMedia('(display-mode: standalone)').matches ); -export const isIOS = !!navigator.userAgent.match( - /\(i[^;]+;( U;)? CPU.+Mac OS X/ +export const isIOS = !!( + navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) || + (/Mac OS X/.test(navigator.userAgent) && + navigator.maxTouchPoints && + navigator.maxTouchPoints > 2) ); export function scrollToElementId( @@ -100,8 +103,7 @@ export function getRandomInt(min: number, max: number, ignore?: number) { } export function fixNotchIPhoneHeight() { - if (!('standalone' in window.navigator && window.navigator.standalone)) - return; + if (!isInStandaloneMode || !isIOS) return; const computeStyle = getComputedStyle(document.documentElement); const sat = computeStyle.getPropertyValue('--sat') || '0'; const sal = computeStyle.getPropertyValue('--sal') || '0'; diff --git a/web/src/views/playlist.vue b/web/src/views/playlist.vue index 34d8400..b493752 100644 --- a/web/src/views/playlist.vue +++ b/web/src/views/playlist.vue @@ -356,14 +356,14 @@ onUnmounted(unWatch); padding: 0 calc(var(--music-page-padding-horizontal) - 10px); } } -@media (max-width: 720px), (max-height: 720px) { +@media (max-width: 800px) { .music-playlist { & > .el-scrollbar { padding: 0 !important; } } } -@media (max-width: 720px) and (orientation: portrait) { +@media (max-width: 800px) and (orientation: portrait) { .music-playlist { &-header { flex-direction: column; diff --git a/web/src/views/ranking.vue b/web/src/views/ranking.vue index 69033c0..6bfce1f 100644 --- a/web/src/views/ranking.vue +++ b/web/src/views/ranking.vue @@ -168,7 +168,7 @@ onUnmounted(unWatch); padding: 0 calc(var(--music-page-padding-horizontal) - 10px); } } -@media (max-width: 720px), (max-height: 720px) { +@media (max-width: 800px) { .music-ranking { &-header { flex-direction: column; diff --git a/web/src/views/recommend.vue b/web/src/views/recommend.vue index 18cdbff..12c8ee2 100644 --- a/web/src/views/recommend.vue +++ b/web/src/views/recommend.vue @@ -115,7 +115,7 @@ onUnmounted(unWatch); .music-recommend { height: 100%; padding: 0 var(--music-page-padding-horizontal); - @media (max-width: 720px), (max-height: 720px) { + @media (max-width: 800px) { padding: 0 10px; } } diff --git a/web/src/views/search.vue b/web/src/views/search.vue index ad3f874..1c92f1e 100644 --- a/web/src/views/search.vue +++ b/web/src/views/search.vue @@ -158,7 +158,7 @@ onUnmounted(unWatch); padding: 0 calc(var(--music-page-padding-horizontal) - 10px); } } -@media (max-width: 720px), (max-height: 720px) { +@media (max-width: 800px) { .music-search { &-header { flex-direction: column; diff --git a/web/src/views/setting.vue b/web/src/views/setting.vue index d783567..45d07ac 100644 --- a/web/src/views/setting.vue +++ b/web/src/views/setting.vue @@ -1132,7 +1132,7 @@ onUnmounted(unWatch); } } } -@media (max-width: 720px), (max-height: 720px) { +@media (max-width: 800px) { .music-setting { &-body { table > tr {