Postpone permission prompt after introduction

This commit is contained in:
Leon Böttger committed 2025-08-18 14:48:31 +02:00
1 parent 22e86bc4f5
commit cecffa1aaa
2 files changed
+26 -21

No files matched your search

+25 -20
View File
@@ -10,7 +10,7 @@ import LUI
struct ContentView: View { struct ContentView: View {
@Environment(\.scenePhase) var scenePhase @ObservedObject var luiSettings = LUISettings.sharedInstance
var body: some View { var body: some View {
AppRootView(isPlus: .constant(true), phoneView: { AppRootView(isPlus: .constant(true), phoneView: {
@@ -25,21 +25,6 @@ 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()
}
}
} }
} }
@@ -51,12 +36,13 @@ struct DeviceListView: View {
@StateObject var receiveModel = ReceiveModel() @StateObject var receiveModel = ReceiveModel()
#endif #endif
@Environment(\.scenePhase) var scenePhase
@ObservedObject var nearbyConnectionManager = NearbyConnectionManager.shared @ObservedObject var nearbyConnectionManager = NearbyConnectionManager.shared
var body: some View { var body: some View {
NavigationSubView(header: "QuickDrop ", navigationBarLayout: isShareExtension() ? .SmallOnlyAlways : .Default) { NavigationSubView(header: "QuickDrop ", navigationBarLayout: isShareExtension() ? .SmallOnlyAlways : .Default) {
VStack {
VStack(alignment: .leading, spacing: 8) { VStack(alignment: .leading, spacing: 8) {
@@ -87,10 +73,7 @@ struct DeviceListView: View {
if !nearbyConnectionManager.hasLocalNetworkAccess { if !nearbyConnectionManager.hasLocalNetworkAccess {
CardView(backgroundColor: .red, title: "NoNetworkAccess", titleSymbol: "network.slash") { CardView(backgroundColor: .red, title: "NoNetworkAccess", titleSymbol: "network.slash") {
HStack {
CardSubView(symbol: "exclamationmark.triangle.fill", text: "NoLocalNetworkAccessDescription") CardSubView(symbol: "exclamationmark.triangle.fill", text: "NoLocalNetworkAccessDescription")
}
} }
.padding(.bottom, 10) .padding(.bottom, 10)
.onTapGesture { .onTapGesture {
@@ -154,6 +137,28 @@ struct DeviceListView: View {
.padding(.vertical, 16) .padding(.vertical, 16)
} }
} }
.frame(maxWidth: 700)
}
.onChange(of: scenePhase) { newValue in
if newValue == .active {
log("App became active")
#if !EXTENSION
NearbyConnectionManager.shared.becomeVisible()
#endif
NearbyConnectionManager.shared.startDeviceDiscovery()
}
if newValue == .background {
log("App went to background")
#if !EXTENSION
NearbyConnectionManager.shared.becomeInvisible()
#endif
NearbyConnectionManager.shared.stopDeviceDiscovery()
}
}
.animation(.smooth, value: nearbyConnectionManager.hasLocalNetworkAccess) .animation(.smooth, value: nearbyConnectionManager.hasLocalNetworkAccess)
.navigationBarItems(trailing: ZStack { .navigationBarItems(trailing: ZStack {
if isShareExtension() { if isShareExtension() {
+1 -1
View File
@@ -7,4 +7,4 @@
*/ */
NSLocalNetworkUsageDescription = "Der Zugriff auf das lokale Netzwerk ist erforderlich, um Geräte zu erkennen und Dateien über Ihr Wi-Fi-Netzwerk zu übertragen."; NSLocalNetworkUsageDescription = "Der Zugriff auf das lokale Netzwerk ist erforderlich, um Geräte zu erkennen und Dateien über WLAN zu übertragen.";