feat: migrate analytics

This commit is contained in:
Haoyu Xu
2024-12-20 00:16:43 +08:00
parent 41bab8d693
commit 8b1e3d465d
12 changed files with 50 additions and 147 deletions

View File

@@ -5,8 +5,11 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>aklive2d directory</title> <title>aklive2d directory</title>
<script async defer data-website-id="05ee2d3d-66e0-429b-89ba-db112743a8c2" <script
src="https://insights.halyul.dev/insights.js" data-do-not-track="true" data-auto-track="false"></script> id="counterscale-script"
src="https://insight.halyul.dev/on-demand.js"
defer
></script>
<style> <style>
.loader { .loader {
position: fixed; position: fixed;

View File

@@ -20,7 +20,7 @@ import { useHeader } from '@/state/header';
import VoiceElement from '@/component/voice'; import VoiceElement from '@/component/voice';
import spine from '!/libs/spine-player' import spine from '!/libs/spine-player'
import '!/libs/spine-player.css' import '!/libs/spine-player.css'
import useUmami from '@/state/insights'; import useInsight from '@/state/insight';
const voiceOnAtom = atomWithStorage('voiceOn', false) const voiceOnAtom = atomWithStorage('voiceOn', false)
const config = JSON.parse(import.meta.env.VITE_ERROR_FILES) const config = JSON.parse(import.meta.env.VITE_ERROR_FILES)
@@ -31,7 +31,7 @@ let lastVoiceState = 'ended'
export default function Error() { export default function Error() {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const _trackEvt = useUmami('/error', "Error") const _trackEvt = useInsight()
const error = useRouteError(); const error = useRouteError();
const navigate = useNavigate(); const navigate = useNavigate();
const { const {

View File

@@ -22,7 +22,7 @@ import { useAtom } from 'jotai'
import { atomWithStorage } from 'jotai/utils'; import { atomWithStorage } from 'jotai/utils';
import CharIcon from '@/component/char_icon'; import CharIcon from '@/component/char_icon';
import Border from '@/component/border'; import Border from '@/component/border';
import useUmami from '@/state/insights'; import useInsight from '@/state/insight';
import Switch from '@/component/switch'; import Switch from '@/component/switch';
import SearchBox from '@/component/search_box'; import SearchBox from '@/component/search_box';
@@ -31,7 +31,7 @@ let lastVoiceState = 'ended'
export default function Home() { export default function Home() {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const _trackEvt = useUmami('/', "Dynamic Compile") const _trackEvt = useInsight()
const { const {
setTitle, setTitle,
setTabs, setTabs,

View File

@@ -18,7 +18,7 @@ import {
import { useHeader } from '@/state/header'; import { useHeader } from '@/state/header';
import { useAppbar } from '@/state/appbar'; import { useAppbar } from '@/state/appbar';
import VoiceElement from '@/component/voice'; import VoiceElement from '@/component/voice';
import useUmami from '@/state/insights' import useInsight from '@/state/insight'
import spine from '!/libs/spine-player' import spine from '!/libs/spine-player'
import '!/libs/spine-player.css' import '!/libs/spine-player.css'
import Border from '@/component/border'; import Border from '@/component/border';
@@ -74,7 +74,7 @@ export default function Operator() {
const [config, setConfig] = useState(null) const [config, setConfig] = useState(null)
const [spineData, setSpineData] = useState(null) const [spineData, setSpineData] = useState(null)
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const _trackEvt = useUmami(`/${key}`, `${key}`) const _trackEvt = useInsight(key)
const spineRef = useRef(null) const spineRef = useRef(null)
const [spineAnimationName, setSpineAnimationName] = useState(defaultSpineAnimationName) const [spineAnimationName, setSpineAnimationName] = useState(defaultSpineAnimationName)
const { i18n } = useI18n() const { i18n } = useI18n()

View File

@@ -0,0 +1,17 @@
import React from 'react';
export default (key = null, websiteId = "directory", skipPageView = false) => {
React.useEffect(() => {
if (!skipPageView && import.meta.env.MODE !== 'development') {
try {
window.counterscale = {
q: [["set", "siteId", `aklive2d-${websiteId}`], ["trackPageview"]],
};
window.counterscaleOnDemandTrack()
} catch (err) {
console.warn && console.warn(err.message)
}
}
}, [websiteId, skipPageView, key])
}

View File

@@ -1,51 +0,0 @@
import React from 'react';
export const registerUmamiScript = (url, websiteId, dataDomain) => {
if (url && websiteId && dataDomain) {
const head = document.getElementsByTagName('head')[0]
const script = document.createElement('script')
script.type = 'text/javascript';
script.src = url;
script.async = 'async'
script.defer = 'defer'
script.setAttribute('data-auto-track', 'false')
script.setAttribute('data-domains', dataDomain)
script.setAttribute('data-website-id', websiteId)
head.appendChild(script);
}
}
export default (url, title, referrer, websiteId, skipPageView) => {
skipPageView = skipPageView || false
React.useEffect(() => {
if (!skipPageView && window.umami && import.meta.env.MODE !== 'development') {
try {
const umami = window.umami
const dict = {}
if (title) {
dict.title = title
}
if (referrer) {
dict.referrer = referrer
}
if (websiteId) {
dict.websiteId = websiteId
}
umami.track(props => ({ ...props, url: url, ...dict }))
} catch (err) {
console.warn && console.warn(err.message)
}
}
}, [url, title, referrer, websiteId, skipPageView])
const trackEvent = (eventValue) => {
try {
const umami = window.umami
umami.track(eventValue)
} catch (err) {
console.warn && console.warn(err.message)
}
}
return trackEvent
}

View File

@@ -36,7 +36,6 @@
"wrangler": "^3.96.0" "wrangler": "^3.96.0"
}, },
"dependencies": { "dependencies": {
"@parcellab/react-use-umami": "^2.0.1",
"dotenv": "^16.4.7", "dotenv": "^16.4.7",
"jotai": "^2.10.4", "jotai": "^2.10.4",
"jsdom": "^22.1.0", "jsdom": "^22.1.0",

12
pnpm-lock.yaml generated
View File

@@ -8,9 +8,6 @@ importers:
.: .:
dependencies: dependencies:
'@parcellab/react-use-umami':
specifier: ^2.0.1
version: 2.0.1(react@18.3.1)
dotenv: dotenv:
specifier: ^16.4.7 specifier: ^16.4.7
version: 16.4.7 version: 16.4.7
@@ -593,11 +590,6 @@ packages:
resolution: {integrity: sha512-i0GV1yJnm2n3Yq1qw6QrUrd/LI9bE8WEBOTtOkpCXHHdyN3TAGgqAK/DAT05z4fq2x04cARXt2pDmjWjL92iTQ==} resolution: {integrity: sha512-i0GV1yJnm2n3Yq1qw6QrUrd/LI9bE8WEBOTtOkpCXHHdyN3TAGgqAK/DAT05z4fq2x04cARXt2pDmjWjL92iTQ==}
engines: {node: '>= 10.0.0'} engines: {node: '>= 10.0.0'}
'@parcellab/react-use-umami@2.0.1':
resolution: {integrity: sha512-C/EdfRm7OyFVmMhrrSITZ79VXLreNZEJnAdpmJ9NaTcy+Wijjf0+wHF8JA5ex+J5/Owv7gVBIj6i/+Kv04nlKA==}
peerDependencies:
react: '>=16.8.0'
'@remix-run/router@1.21.0': '@remix-run/router@1.21.0':
resolution: {integrity: sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==} resolution: {integrity: sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==}
engines: {node: '>=14.0.0'} engines: {node: '>=14.0.0'}
@@ -2873,10 +2865,6 @@ snapshots:
'@parcel/watcher-win32-x64': 2.5.0 '@parcel/watcher-win32-x64': 2.5.0
optional: true optional: true
'@parcellab/react-use-umami@2.0.1(react@18.3.1)':
dependencies:
react: 18.3.1
'@remix-run/router@1.21.0': {} '@remix-run/router@1.21.0': {}
'@rollup/rollup-android-arm-eabi@4.28.1': '@rollup/rollup-android-arm-eabi@4.28.1':

View File

@@ -6,8 +6,11 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="renderer" content="webkit"> <meta name="renderer" content="webkit">
<title>aklive2d</title> <title>aklive2d</title>
<script async defer data-website-id="05ee2d3d-66e0-429b-89ba-db112743a8c2" <script
src="https://insights.halyul.dev/insights.js" data-do-not-track="true" data-auto-track="false"></script> id="counterscale-script"
src="https://insight.halyul.dev/on-demand.js"
defer
></script>
</head> </head>
<body style="background-image: url('./assets/background/operator_bg.png');"> <body style="background-image: url('./assets/background/operator_bg.png');">
<div id="app"></div> <div id="app"></div>

View File

@@ -39,9 +39,8 @@ export default class Settings {
#scale = this.#defaultScale #scale = this.#defaultScale
#logoX = this.#defaultLogoX #logoX = this.#defaultLogoX
#logoY = this.#defaultLogoY #logoY = this.#defaultLogoY
#isInsightsInited = false #isInsightInited = false
#doNotTrack = false #doNotTrack = false
#lastFunctionInsights = null
#useStartAnimation = true #useStartAnimation = true
constructor(el, logoEl) { constructor(el, logoEl) {
@@ -71,37 +70,29 @@ export default class Settings {
success() { success() {
this.loadViewport() this.loadViewport()
this.insights(false, false) this.insight(false, false)
this.#updateOptions("animation_selection", this.spinePlayer.skeleton.data.animations.map(e => e.name)) this.#updateOptions("animation_selection", this.spinePlayer.skeleton.data.animations.map(e => e.name))
if ((new URLSearchParams(window.location.search)).has("settings") || import.meta.env.MODE === 'development') { if ((new URLSearchParams(window.location.search)).has("settings") || import.meta.env.MODE === 'development') {
this.open() this.open()
} }
} }
insights(isWallpaperEngine, doNotTrack) { insight(isWallpaperEngine, doNotTrack) {
console.log(1)
this.isWallpaperEngine = isWallpaperEngine this.isWallpaperEngine = isWallpaperEngine
if (this.#isInsightsInited || import.meta.env.MODE === 'development') return if (this.#isInsightInited || import.meta.env.MODE === 'development') return
this.#isInsightsInited = true console.log(2)
this.#isInsightInited = true
this.#doNotTrack = doNotTrack this.#doNotTrack = doNotTrack
if (this.#doNotTrack) return if (this.#doNotTrack) return
console.log(3)
try { try {
window.umami?.track(props => ({ window.counterscale = {
...props, q: [["set", "siteId", `aklive2d-${import.meta.env.VITE_LINK}`], ["trackPageview"]],
url: `/${import.meta.env.VITE_LINK}${isWallpaperEngine ? "?steam" : ""}` };
})); console.log(4)
} catch(e) { window.counterscaleOnDemandTrack();
console.warn && console.warn(e.message) console.log(5)
}
}
functionInsights(functionName, toSkip = false) {
if (!this.#isInsightsInited || this.#doNotTrack || import.meta.env.MODE === 'development' || functionName === this.#lastFunctionInsights || toSkip) return
try {
window.umami?.track(props => ({
...props,
name: `${functionName}`,
url: `/${import.meta.env.VITE_LINK}${this.isWallpaperEngine ? "?steam" : ""}`
}));
} catch(e) { } catch(e) {
console.warn && console.warn(e.message) console.warn && console.warn(e.message)
} }
@@ -110,12 +101,10 @@ export default class Settings {
setFPS(value) { setFPS(value) {
this.#fps = value this.#fps = value
this.spinePlayer.setFps(value) this.spinePlayer.setFps(value)
this.functionInsights("setFPS", this.isWallpaperEngine)
} }
setLogoDisplay(flag) { setLogoDisplay(flag) {
this.#logoEl.hidden = flag; this.#logoEl.hidden = flag;
this.functionInsights("setLogoDisplay", this.isWallpaperEngine)
} }
#resize(_this, value) { #resize(_this, value) {
@@ -136,7 +125,6 @@ export default class Settings {
this.#logoEl.src = src this.#logoEl.src = src
this.#resize() this.#resize()
this.#setLogoInvertFilter(invert_filter) this.#setLogoInvertFilter(invert_filter)
this.functionInsights("setLogo", this.isWallpaperEngine)
} }
#readFile(e, callback = () => { }) { #readFile(e, callback = () => { }) {
@@ -163,18 +151,15 @@ export default class Settings {
setLogoRatio(value) { setLogoRatio(value) {
this.#ratio = value this.#ratio = value
this.#resize(this, value) this.#resize(this, value)
this.functionInsights("setLogoRatio", this.isWallpaperEngine)
} }
setLogoOpacity(value) { setLogoOpacity(value) {
this.#logoEl.style.opacity = value / 100 this.#logoEl.style.opacity = value / 100
this.#opacity = value this.#opacity = value
this.functionInsights("setLogoOpacity", this.isWallpaperEngine)
} }
setBackgoundImage(v, skipInsights = false) { setBackgoundImage(v) {
document.body.style.backgroundImage = v document.body.style.backgroundImage = v
if (!skipInsights) this.functionInsights("setBackgoundImage", this.isWallpaperEngine);
} }
get currentBackground() { get currentBackground() {
@@ -187,9 +172,8 @@ export default class Settings {
setDefaultBackground(e) { setDefaultBackground(e) {
this.#defaultBackgroundImage = `url("${import.meta.env.BASE_URL}assets/${import.meta.env.VITE_BACKGROUND_FOLDER}/${e}")` this.#defaultBackgroundImage = `url("${import.meta.env.BASE_URL}assets/${import.meta.env.VITE_BACKGROUND_FOLDER}/${e}")`
if (document.getElementById("custom_background_clear").disabled && !document.body.style.backgroundImage.startsWith("url(\"file:")) { if (document.getElementById("custom_background_clear").disabled && !document.body.style.backgroundImage.startsWith("url(\"file:")) {
this.setBackgoundImage(this.#defaultBackgroundImage, true) this.setBackgoundImage(this.#defaultBackgroundImage)
} }
this.functionInsights("setDefaultBackground", this.isWallpaperEngine)
} }
setBackground(e) { setBackground(e) {
@@ -247,7 +231,6 @@ export default class Settings {
break; break;
} }
this.loadViewport() this.loadViewport()
this.functionInsights("positionPadding", this.isWallpaperEngine)
} }
positionReset() { positionReset() {
@@ -297,7 +280,6 @@ export default class Settings {
break; break;
} }
this.elementPosition(this.#logoEl, this.#logoX, this.#logoY) this.elementPosition(this.#logoEl, this.#logoX, this.#logoY)
this.functionInsights("logoPadding", this.isWallpaperEngine)
} }
logoReset() { logoReset() {

View File

@@ -67,7 +67,6 @@ export default class Voice {
set useSubtitle(show) { set useSubtitle(show) {
this.#useSubtitle = show this.#useSubtitle = show
this.#el.hidden = !show this.#el.hidden = !show
window.settings.functionInsights("useSubtitle", window.settings.isWallpaperEngine)
} }
get useSubtitle() { get useSubtitle() {
@@ -78,7 +77,6 @@ export default class Voice {
* @param {boolean} show * @param {boolean} show
*/ */
set useVoice(show) { set useVoice(show) {
window.settings.functionInsights("useVoice", window.settings.isWallpaperEngine)
this.#useVoice = show this.#useVoice = show
this.#playEntryVoice() this.#playEntryVoice()
if (!show && this.#isPlaying) { if (!show && this.#isPlaying) {
@@ -96,7 +94,6 @@ export default class Voice {
set useVoiceActor(show) { set useVoiceActor(show) {
this.#useVoiceActor = show this.#useVoiceActor = show
document.getElementById('voice_actor_box').hidden = !show document.getElementById('voice_actor_box').hidden = !show
window.settings.functionInsights("useVoiceActor", window.settings.isWallpaperEngine)
} }
get useVoiceActor() { get useVoiceActor() {
@@ -112,7 +109,6 @@ export default class Voice {
} else { } else {
this.#subtitleLang = this.#defaultRegion this.#subtitleLang = this.#defaultRegion
} }
window.settings.functionInsights("subtitleLanguage", window.settings.isWallpaperEngine)
} }
get subtitleLanguage() { get subtitleLanguage() {
@@ -149,7 +145,6 @@ export default class Voice {
#updateSubtitlePosition() { #updateSubtitlePosition() {
window.settings.elementPosition(this.#el, this.#subtitleX, this.#subtitleY) window.settings.elementPosition(this.#el, this.#subtitleX, this.#subtitleY)
window.settings.functionInsights("subtitlePosition", window.settings.isWallpaperEngine)
} }
/** /**
@@ -161,7 +156,6 @@ export default class Voice {
} else { } else {
this.#voiceLang = this.#defaultVoiceLang this.#voiceLang = this.#defaultVoiceLang
} }
window.settings.functionInsights("language", window.settings.isWallpaperEngine)
const availableSubtitleLang = this.#getSubtitleLanguages() const availableSubtitleLang = this.#getSubtitleLanguages()
if (!availableSubtitleLang.includes(this.#subtitleLang)) { if (!availableSubtitleLang.includes(this.#subtitleLang)) {
this.#subtitleLang = availableSubtitleLang[0] this.#subtitleLang = availableSubtitleLang[0]
@@ -185,7 +179,6 @@ export default class Voice {
this.#idleDuration = duration * 60 * 1000 this.#idleDuration = duration * 60 * 1000
this.#initIdleVoiceTimer() this.#initIdleVoiceTimer()
} }
window.settings.functionInsights("idleDuration", window.settings.isWallpaperEngine)
} }
get idleDuration() { get idleDuration() {
@@ -201,7 +194,6 @@ export default class Voice {
this.#nextDuration = duration * 60 * 1000 this.#nextDuration = duration * 60 * 1000
this.#initNextVoiceTimer() this.#initNextVoiceTimer()
} }
window.settings.functionInsights("nextDuration", window.settings.isWallpaperEngine)
} }
get nextDuration() { get nextDuration() {

View File

@@ -2,111 +2,89 @@ window.wallpaperPropertyListener = {
applyGeneralProperties: function (properties) { applyGeneralProperties: function (properties) {
if (properties.fps) { if (properties.fps) {
window.settings.setFPS(properties.fps) window.settings.setFPS(properties.fps)
window.settings.functionInsights("setFPS", Object.keys(properties) !== 1)
} }
}, },
applyUserProperties: function (properties) { applyUserProperties: function (properties) {
if (properties.privacydonottrack) { if (properties.privacydonottrack) {
window.settings.insights(true, !properties.privacydonottrack.value) window.settings.insight(true, !properties.privacydonottrack.value)
} }
if (properties.logo) { if (properties.logo) {
window.settings.setLogoDisplay(!properties.logo.value) window.settings.setLogoDisplay(!properties.logo.value)
window.settings.functionInsights("setLogoDisplay", Object.keys(properties) !== 1)
} }
if (properties.logoratio) { if (properties.logoratio) {
if (properties.logoratio.value) { if (properties.logoratio.value) {
window.settings.setLogoRatio(properties.logoratio.value) window.settings.setLogoRatio(properties.logoratio.value)
window.settings.functionInsights("setLogoRatio", Object.keys(properties) !== 1)
} }
} }
if (properties.logoopacity) { if (properties.logoopacity) {
if (properties.logoopacity.value) { if (properties.logoopacity.value) {
window.settings.setLogoOpacity(properties.logoopacity.value) window.settings.setLogoOpacity(properties.logoopacity.value)
window.settings.functionInsights("setLogoOpacity", Object.keys(properties) !== 1)
} }
} }
if (properties.logoimage) { if (properties.logoimage) {
if (properties.logoimage.value) { if (properties.logoimage.value) {
window.settings.setLogo('file:///' + properties.logoimage.value) window.settings.setLogo('file:///' + properties.logoimage.value)
window.settings.functionInsights("setLogo", Object.keys(properties) !== 1)
} else { } else {
window.settings.resetLogoImage() window.settings.resetLogoImage()
} }
} }
if (properties.logox) { if (properties.logox) {
window.settings.logoPadding("x", properties.logox.value) window.settings.logoPadding("x", properties.logox.value)
window.settings.functionInsights("logoPaddingX", Object.keys(properties) !== 1)
} }
if (properties.logoy) { if (properties.logoy) {
window.settings.logoPadding("y", properties.logoy.value) window.settings.logoPadding("y", properties.logoy.value)
window.settings.functionInsights("logoPaddingY", Object.keys(properties) !== 1)
} }
if (properties.defaultbackground) { if (properties.defaultbackground) {
if (properties.defaultbackground.value) { if (properties.defaultbackground.value) {
window.settings.setDefaultBackground(properties.defaultbackground.value) window.settings.setDefaultBackground(properties.defaultbackground.value)
window.settings.functionInsights("setDefaultBackground", Object.keys(properties) !== 1)
} }
} }
if (properties.background) { if (properties.background) {
if (properties.background.value) { if (properties.background.value) {
window.settings.setBackgoundImage(`url('file:///${properties.background.value}')`) window.settings.setBackgoundImage(`url('file:///${properties.background.value}')`)
window.settings.functionInsights("setBackgoundImage", Object.keys(properties) !== 1)
} else { } else {
window.settings.resetBackground() window.settings.resetBackground()
} }
} }
if (properties.voicetitle) { if (properties.voicetitle) {
window.voice.useVoice = properties.voicetitle.value window.voice.useVoice = properties.voicetitle.value
window.settings.functionInsights("useVoice", Object.keys(properties) !== 1)
} }
if (properties.voicelanguage) { if (properties.voicelanguage) {
window.voice.language = properties.voicelanguage.value window.voice.language = properties.voicelanguage.value
window.settings.functionInsights("language", Object.keys(properties) !== 1)
} }
if (properties.voiceidle) { if (properties.voiceidle) {
window.voice.idleDuration = parseInt(properties.voiceidle.value) window.voice.idleDuration = parseInt(properties.voiceidle.value)
window.settings.functionInsights("idleDuration", Object.keys(properties) !== 1)
} }
if (properties.voicenext) { if (properties.voicenext) {
window.voice.nextDuration = parseInt(properties.voicenext.value) window.voice.nextDuration = parseInt(properties.voicenext.value)
window.settings.functionInsights("nextDuration", Object.keys(properties) !== 1)
} }
if (properties.voicesubtitle) { if (properties.voicesubtitle) {
window.voice.useSubtitle = properties.voicesubtitle.value window.voice.useSubtitle = properties.voicesubtitle.value
window.settings.functionInsights("useSubtitle", Object.keys(properties) !== 1)
} }
if (properties.voicesubtitlelanguage) { if (properties.voicesubtitlelanguage) {
window.voice.subtitleLanguage = properties.voicesubtitlelanguage.value window.voice.subtitleLanguage = properties.voicesubtitlelanguage.value
window.settings.functionInsights("subtitleLanguage", Object.keys(properties) !== 1)
} }
if (properties.voicesubtitlex) { if (properties.voicesubtitlex) {
window.voice.subtitleX = properties.voicesubtitlex.value window.voice.subtitleX = properties.voicesubtitlex.value
window.settings.functionInsights("subtitleX", Object.keys(properties) !== 1)
} }
if (properties.voicesubtitley) { if (properties.voicesubtitley) {
window.voice.subtitleY = properties.voicesubtitley.value window.voice.subtitleY = properties.voicesubtitley.value
window.settings.functionInsights("subtitleY", Object.keys(properties) !== 1)
} }
if (properties.voiceactor) { if (properties.voiceactor) {
window.voice.useVoiceActor = properties.voiceactor.value window.voice.useVoiceActor = properties.voiceactor.value
window.settings.functionInsights("useVoiceActor", Object.keys(properties) !== 1)
} }
if (properties.music_selection) { if (properties.music_selection) {
window.music.changeMusic(properties.music_selection.value) window.music.changeMusic(properties.music_selection.value)
window.settings.functionInsights("music_selection", Object.keys(properties) !== 1)
} }
if (properties.music_title) { if (properties.music_title) {
window.music.useMusic = properties.music_title.value window.music.useMusic = properties.music_title.value
window.settings.functionInsights("useMusic", Object.keys(properties) !== 1)
} }
if (properties.music_volume) { if (properties.music_volume) {
window.music.volume = properties.music_volume.value window.music.volume = properties.music_volume.value
window.settings.functionInsights("music_volume", Object.keys(properties) !== 1)
} }
if (properties.custom_music) { if (properties.custom_music) {
if (properties.custom_music.value) { if (properties.custom_music.value) {
window.settings.setMusicFromWE(`file:///${properties.custom_music.value}`) window.settings.setMusicFromWE(`file:///${properties.custom_music.value}`)
window.settings.functionInsights("setMusic", Object.keys(properties) !== 1)
} else { } else {
window.settings.resetMusic() window.settings.resetMusic()
} }
@@ -114,18 +92,15 @@ window.wallpaperPropertyListener = {
if (properties.custom_video) { if (properties.custom_video) {
if (properties.custom_video.value) { if (properties.custom_video.value) {
window.settings.setVideoFromWE(`file:///${properties.custom_video.value}`) window.settings.setVideoFromWE(`file:///${properties.custom_video.value}`)
window.settings.functionInsights("setVideo", Object.keys(properties) !== 1)
} else { } else {
window.settings.resetVideo() window.settings.resetVideo()
} }
} }
if (properties.video_volume) { if (properties.video_volume) {
window.settings.setVideoVolume(properties.video_volume.value) window.settings.setVideoVolume(properties.video_volume.value)
window.settings.functionInsights("video_volume", Object.keys(properties) !== 1)
} }
if (properties.scale) { if (properties.scale) {
window.settings.setScale(properties.scale.value) window.settings.setScale(properties.scale.value)
window.settings.functionInsights("setScale", Object.keys(properties) !== 1)
} }
if (properties.position) { if (properties.position) {
if (!properties.position.value) { if (!properties.position.value) {
@@ -141,23 +116,18 @@ window.wallpaperPropertyListener = {
} }
if (properties.paddingleft) { if (properties.paddingleft) {
window.settings.positionPadding("left", properties.paddingleft.value) window.settings.positionPadding("left", properties.paddingleft.value)
window.settings.functionInsights("positionPaddingLeft", Object.keys(properties) !== 1)
} }
if (properties.paddingright) { if (properties.paddingright) {
window.settings.positionPadding("right", properties.paddingright.value) window.settings.positionPadding("right", properties.paddingright.value)
window.settings.functionInsights("positionPaddingRight", Object.keys(properties) !== 1)
} }
if (properties.paddingtop) { if (properties.paddingtop) {
window.settings.positionPadding("top", properties.paddingtop.value) window.settings.positionPadding("top", properties.paddingtop.value)
window.settings.functionInsights("positionPaddingTop", Object.keys(properties) !== 1)
} }
if (properties.paddingbottom) { if (properties.paddingbottom) {
window.settings.positionPadding("bottom", properties.paddingbottom.value) window.settings.positionPadding("bottom", properties.paddingbottom.value)
window.settings.functionInsights("positionPaddingBottom", Object.keys(properties) !== 1)
} }
if (properties.useStartAnimation) { if (properties.useStartAnimation) {
window.settings.useStartAnimation = properties.useStartAnimation.value window.settings.useStartAnimation = properties.useStartAnimation.value
window.settings.functionInsights("useStartAnimation", Object.keys(properties) !== 1)
} }
}, },
}; };