mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 13:32:10 +08:00
添加退出日志
This commit is contained in:
parent
719aeaf49f
commit
2f0beb7755
@ -52,6 +52,7 @@ public class UtilsModule extends ReactContextBaseJavaModule {
|
||||
|
||||
// https://stackoverflow.com/questions/6330200/how-to-quit-android-application-programmatically
|
||||
Activity currentActivity = reactContext.getCurrentActivity();
|
||||
Log.d("Utils", "Exit app...");
|
||||
if (currentActivity == null) {
|
||||
Log.d("Utils", "killProcess");
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
|
@ -49,7 +49,8 @@ export const setLanguage = (locale: Parameters<typeof applyLanguage>[0]) => {
|
||||
|
||||
|
||||
let isDestroying = false
|
||||
export const exitApp = () => {
|
||||
export const exitApp = (reason: string) => {
|
||||
console.log('Handle Exit App, Reason: ' + reason)
|
||||
if (isDestroying) return
|
||||
isDestroying = true
|
||||
Promise.all([
|
||||
|
@ -17,7 +17,7 @@ const timeoutTools = {
|
||||
global.lx.isPlayedStop = true
|
||||
this.callHooks()
|
||||
} else {
|
||||
exitApp()
|
||||
exitApp('Timeout Exit')
|
||||
}
|
||||
},
|
||||
getTime() {
|
||||
|
@ -18,9 +18,9 @@ let isInitialized = false
|
||||
// let isPlaying = false
|
||||
|
||||
// 销毁播放器并退出
|
||||
const handleExitApp = async() => {
|
||||
const handleExitApp = async(reason: string) => {
|
||||
global.lx.isPlayedStop = false
|
||||
exitApp()
|
||||
exitApp(reason)
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ const registerPlaybackService = async() => {
|
||||
|
||||
TrackPlayer.addEventListener(TPEvent.RemoteStop, () => {
|
||||
// console.log('remote-stop')
|
||||
void handleExitApp()
|
||||
void handleExitApp('Remote Stop')
|
||||
})
|
||||
|
||||
// TrackPlayer.addEventListener(TPEvent.RemoteDuck, async({ permanent, paused, ducking }) => {
|
||||
@ -105,7 +105,7 @@ const registerPlaybackService = async() => {
|
||||
// console.log('playback-state', info)
|
||||
break
|
||||
}
|
||||
if (global.lx.isPlayedStop) return handleExitApp()
|
||||
if (global.lx.isPlayedStop) return handleExitApp('Timeout Exit')
|
||||
|
||||
// console.log('currentIsPlaying', currentIsPlaying, global.lx.playInfo.isPlaying)
|
||||
// void updateMetaData(global.lx.store_playMusicInfo.musicInfo, currentIsPlaying)
|
||||
@ -114,7 +114,7 @@ const registerPlaybackService = async() => {
|
||||
// console.log('PlaybackTrackChanged====>', info)
|
||||
global.lx.playerTrackId = await getCurrentTrackId()
|
||||
if (info.track == null) return
|
||||
if (global.lx.isPlayedStop) return handleExitApp()
|
||||
if (global.lx.isPlayedStop) return handleExitApp('Timeout Exit')
|
||||
|
||||
// console.log('global.lx.playerTrackId====>', global.lx.playerTrackId)
|
||||
if (isEmpty()) {
|
||||
|
@ -115,7 +115,7 @@ export default memo(() => {
|
||||
confirmButtonText: global.i18n.t('list_remove_tip_button'),
|
||||
}).then(isExit => {
|
||||
if (!isExit) return
|
||||
exitApp()
|
||||
exitApp('Exit Btn')
|
||||
})
|
||||
return
|
||||
case 'back_home':
|
||||
|
@ -109,7 +109,7 @@ export default memo(() => {
|
||||
confirmButtonText: global.i18n.t('list_remove_tip_button'),
|
||||
}).then(isExit => {
|
||||
if (!isExit) return
|
||||
exitApp()
|
||||
exitApp('Exit Btn')
|
||||
})
|
||||
return
|
||||
case 'back_home':
|
||||
|
Loading…
x
Reference in New Issue
Block a user