fix: relaunching of iOS app would stop advertising

This commit is contained in:
Leon Böttger committed 2025-08-18 10:36:31 +02:00
1 parent 9d71ed35b7
commit 7d6d0f3482
6 files changed
+66 -14

No files matched your search

+2
View File
@@ -14,6 +14,8 @@ let configuration = LUIConfiguration(
copyrightInformation: licenseText,
loggingUrl: getAppGroupDirectory(),
introductionViewInformation: "QuickDropWelcomeDescription",
usesAutomaticReviewPrompt: false,
+17
View File
@@ -10,6 +10,8 @@ import LUI
struct ContentView: View {
@Environment(\.scenePhase) var scenePhase
var body: some View {
AppRootView(isPlus: .constant(true), phoneView: {
DeviceListView()
@@ -23,6 +25,21 @@ struct ContentView: View {
}
}
})
.onChange(of: scenePhase) { newValue in
if newValue == .active {
#if !EXTENSION
NearbyConnectionManager.shared.becomeVisible()
#endif
NearbyConnectionManager.shared.startDeviceDiscovery()
}
if newValue == .background {
#if !EXTENSION
NearbyConnectionManager.shared.becomeInvisible()
#endif
NearbyConnectionManager.shared.stopDeviceDiscovery()
}
}
}
}