添加退出日志

This commit is contained in:
lyswhut 2023-06-15 13:44:13 +08:00
parent 719aeaf49f
commit 2f0beb7755
6 changed files with 11 additions and 9 deletions

View File

@ -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());

View File

@ -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([

View File

@ -17,7 +17,7 @@ const timeoutTools = {
global.lx.isPlayedStop = true
this.callHooks()
} else {
exitApp()
exitApp('Timeout Exit')
}
},
getTime() {

View File

@ -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()) {

View File

@ -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':

View File

@ -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':