소스 검색

app: fix first time startup. UI can be restarted but App remains persistant so we must also set the first_time flag to false.

darkfi 22 시간 전
부모
커밋
b29e981a6e
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      bin/app/src/app/mod.rs

+ 4 - 1
bin/app/src/app/mod.rs

@@ -212,7 +212,10 @@ impl App {
     /// Begins the draw of the tree, and then starts the UI procs.
     pub async fn start(self: Arc<Self>, event_pub: GraphicsEventPublisherPtr, epoch: EpochIndex) {
         d!("Starting app epoch={epoch}");
-        if self.is_first_time.load(Ordering::Relaxed) {
+        // On Android the foreground service keeps the process alive across
+        // UI restarts, so start() runs on every relaunch. swap() consumes
+        // the flag so the sound only plays on the very first launch.
+        if self.is_first_time.swap(false, Ordering::Relaxed) {
             sfx::play_commup();
         }
         let mut atom = PropertyAtomicGuard::none();