mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-21 16:20:46 +08:00
✨ Feature: add privacy policy
This commit is contained in:
@@ -186,6 +186,9 @@ import {
|
||||
import db from '#/datastore'
|
||||
import mixin from '@/utils/mixin'
|
||||
import InputBoxDialog from '@/components/InputBoxDialog.vue'
|
||||
import {
|
||||
SHOW_PRIVACY_MESSAGE
|
||||
} from '~/universal/events/constants'
|
||||
const { Menu, dialog, BrowserWindow } = remote
|
||||
const customLinkRule = (rule: string, value: string, callback: (arg0?: Error) => void) => {
|
||||
if (!/\$url/.test(value)) {
|
||||
@@ -301,6 +304,12 @@ export default class extends Vue {
|
||||
click () {
|
||||
_this.qrcodeVisible = true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '隐私协议',
|
||||
click () {
|
||||
ipcRenderer.send(SHOW_PRIVACY_MESSAGE)
|
||||
}
|
||||
}
|
||||
]
|
||||
this.menu = Menu.buildFromTemplate(template)
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
IpcRendererEvent,
|
||||
remote
|
||||
} from 'electron'
|
||||
import path from 'path'
|
||||
import { SHOW_PRIVACY_MESSAGE } from '~/universal/events/constants'
|
||||
@Component({
|
||||
name: 'mini-page',
|
||||
mixins: [mixin]
|
||||
@@ -176,6 +176,12 @@ export default class extends Vue {
|
||||
remote.BrowserWindow.getFocusedWindow()!.hide()
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '隐私协议',
|
||||
click () {
|
||||
ipcRenderer.send(SHOW_PRIVACY_MESSAGE)
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '重启应用',
|
||||
click () {
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
/* eslint-disable camelcase */
|
||||
import { ipcRenderer } from 'electron'
|
||||
import {
|
||||
BAIDU_TONGJI_INIT,
|
||||
BAIDU_TONGJI_INIT_RES,
|
||||
BAIDU_TONGJI_EVENT
|
||||
TALKING_DATA_APPID, TALKING_DATA_EVENT
|
||||
} from '~/universal/events/constants'
|
||||
import { handleBaiduTongJiEvent } from './common'
|
||||
import pkg from 'root/package.json'
|
||||
import { ipcRenderer } from 'electron'
|
||||
import { handleTalkingDataEvent } from './common'
|
||||
const { version } = pkg
|
||||
|
||||
ipcRenderer.on(BAIDU_TONGJI_INIT_RES, (_, scriptContent) => {
|
||||
window._hmt = window._hmt || []
|
||||
const hm = document.createElement('script')
|
||||
hm.text = scriptContent
|
||||
const head = document.getElementsByTagName('head')[0]
|
||||
head.appendChild(hm)
|
||||
})
|
||||
|
||||
ipcRenderer.on(BAIDU_TONGJI_EVENT, (_, data: IBaiduTongJiOptions) => {
|
||||
handleBaiduTongJiEvent(data)
|
||||
})
|
||||
|
||||
export const initBaiduTongJi = () => {
|
||||
export const initTalkingData = () => {
|
||||
setTimeout(() => {
|
||||
ipcRenderer.send(BAIDU_TONGJI_INIT)
|
||||
const talkingDataScript = document.createElement('script')
|
||||
|
||||
talkingDataScript.src = `http://sdk.talkingdata.com/app/h5/v1?appid=${TALKING_DATA_APPID}&vn=${version}&vc=${version}`
|
||||
|
||||
const head = document.getElementsByTagName('head')[0]
|
||||
head.appendChild(talkingDataScript)
|
||||
}, 0)
|
||||
}
|
||||
|
||||
ipcRenderer.on(TALKING_DATA_EVENT, (_, data: ITalkingDataOptions) => {
|
||||
handleTalkingDataEvent(data)
|
||||
})
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
/* eslint-disable camelcase */
|
||||
export const handleBaiduTongJiEvent = (data: IBaiduTongJiOptions) => {
|
||||
const { category, action, opt_label = '', opt_value = Date.now() } = data
|
||||
window._hmt.push(['_trackEvent', category, action, opt_label, opt_value])
|
||||
export const handleTalkingDataEvent = (data: ITalkingDataOptions) => {
|
||||
const { EventId, Label = '', MapKv = {} } = data
|
||||
MapKv.from = window.location.href
|
||||
window.TDAPP.onEvent(EventId, Label, MapKv)
|
||||
if (isDevelopment) {
|
||||
console.log('baidu tongji', data)
|
||||
console.log('talkingData', data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user