From 6fad5d54820ffe8bf30b27d0b930f609f737282f Mon Sep 17 00:00:00 2001 From: Levin Li Date: Thu, 11 Jul 2024 22:47:05 -0700 Subject: [PATCH] Huawei AppGallery tweaks --- .../space/celestia/mobilecelestia/MainActivity.kt | 12 +++++++++++- jobs/build.yml | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt b/app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt index d8154603..5a9ad919 100644 --- a/app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt +++ b/app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt @@ -190,6 +190,7 @@ class MainActivity : AppCompatActivity(R.layout.activity_main), private var bottomSheetCommitIds = arrayListOf() private var initialURLCheckPerformed = false + private var isAskingForExit = false override fun onCreate(savedInstanceState: Bundle?) { val factory = EntryPointAccessors.fromApplication(this, AppStatusInterface::class.java) @@ -478,10 +479,19 @@ class MainActivity : AppCompatActivity(R.layout.activity_main), frag.popLast() } else if (self.canPopBottomSheetFragment()) { self.popBottomSheetFragment() - } else { + } else if (frag != null || drawerLayout.isDrawerOpen(GravityCompat.END)) { self.lifecycleScope.launch { self.hideOverlay(true) } + } else if (!self.isAskingForExit) { + self.isAskingForExit = true + self.showAlert(self.getString(R.string.exit_celestia_alert_title), self.getString(R.string.exit_celestia_alert_message), handler = { + self.isAskingForExit = false + self.finishAndRemoveTask() + exitProcess(0) + }, cancelHandler = { + self.isAskingForExit = false + }) } } }) diff --git a/jobs/build.yml b/jobs/build.yml index 48323796..6f754a82 100644 --- a/jobs/build.yml +++ b/jobs/build.yml @@ -35,6 +35,7 @@ jobs: git checkout origin/$(Build.SourceBranchName) cd ../CelestiaLocalization git checkout origin/$(Build.SourceBranchName) + git cherry-pick origin/huawei displayName: 'Checkout Branch' condition: ne( variables['Build.Reason'], 'PullRequest' ) @@ -43,6 +44,7 @@ jobs: git checkout origin/$(System.PullRequest.TargetBranch) cd ../CelestiaLocalization git checkout origin/$(System.PullRequest.TargetBranch) + git cherry-pick origin/huawei displayName: 'Checkout Branch (PR)' condition: eq( variables['Build.Reason'], 'PullRequest' )