| | |
| | | onLaunch: function() { |
| | | uni.$on('locationPermissionGranted', this.handleLocationPermissionGranted) |
| | | uni.$on('loginSuccessStartLocationPolling', this.handleLoginSuccessStartLocationPolling) |
| | | this.initTTS() |
| | | this.initJPush() |
| | | this.checkAppUpdate() |
| | | uni.$on('privacyAgreed', this.handlePrivacyAgreed) |
| | | // 检查是否已经同意过隐私政策,如果是则直接初始化极光推送 |
| | | console.log('login_privacy_policy_agreed', uni.getStorageSync('login_privacy_policy_agreed')) |
| | | if (uni.getStorageSync('login_privacy_policy_agreed')) { |
| | | // 初始化极光推送 |
| | | this.initJPush() |
| | | // 初始化语音播报 |
| | | this.initTTS() |
| | | // 获取版本号 |
| | | this.checkAppUpdate() |
| | | } |
| | | }, |
| | | onShow: function() { |
| | | console.log('App Show') |
| | | // this.checkAndStartLocationPolling() |
| | | }, |
| | | onHide: function() { |
| | | console.log('App Hide') |
| | | // this.stopLocationPolling() |
| | | }, |
| | | onUnload() { |
| | | uni.$off('locationPermissionGranted', this.handleLocationPermissionGranted) |
| | | uni.$off('loginSuccessStartLocationPolling', this.handleLoginSuccessStartLocationPolling) |
| | | uni.$off('privacyAgreed', this.handlePrivacyAgreed) |
| | | if (this.tts) { |
| | | try { |
| | | if (this.ttsPlatform === 'android') { |
| | |
| | | } |
| | | this.checkAndStartLocationPolling() |
| | | }, |
| | | handlePrivacyAgreed() { |
| | | console.log('隐私政策已同意,初始化极光推送') |
| | | this.initJPush() |
| | | }, |
| | | handleLocationPermissionGranted() { |
| | | this.hasGrantedLocationPermission = true |
| | | if (!this.token || this.locationTimer) return |