iOS: Localize local network access, add alert if no local network access

This commit is contained in:
Leon Böttger committed 2025-08-18 14:38:41 +02:00
1 parent 6087a274ad
commit 22e86bc4f5
23 files changed
+501 -29

No files matched your search

+42 -23
View File
@@ -27,16 +27,16 @@ struct ContentView: View {
})
.onChange(of: scenePhase) { newValue in
if newValue == .active {
#if !EXTENSION
#if !EXTENSION
NearbyConnectionManager.shared.becomeVisible()
#endif
#endif
NearbyConnectionManager.shared.startDeviceDiscovery()
}
if newValue == .background {
#if !EXTENSION
#if !EXTENSION
NearbyConnectionManager.shared.becomeInvisible()
#endif
#endif
NearbyConnectionManager.shared.stopDeviceDiscovery()
}
}
@@ -47,9 +47,9 @@ struct DeviceListView: View {
@StateObject var sendModel = SendModel()
#if !EXTENSION
#if !EXTENSION
@StateObject var receiveModel = ReceiveModel()
#endif
#endif
@ObservedObject var nearbyConnectionManager = NearbyConnectionManager.shared
@@ -57,6 +57,7 @@ struct DeviceListView: View {
NavigationSubView(header: "QuickDrop ", navigationBarLayout: isShareExtension() ? .SmallOnlyAlways : .Default) {
VStack(alignment: .leading, spacing: 8) {
let attachments = nearbyConnectionManager.attachments
@@ -84,6 +85,18 @@ struct DeviceListView: View {
.padding(.top, 8)
.frame(maxWidth: .infinity, alignment: .leading)
if !nearbyConnectionManager.hasLocalNetworkAccess {
CardView(backgroundColor: .red, title: "NoNetworkAccess", titleSymbol: "network.slash") {
HStack {
CardSubView(symbol: "exclamationmark.triangle.fill", text: "NoLocalNetworkAccessDescription")
}
}
.padding(.bottom, 10)
.onTapGesture {
openAppSettings()
}
}
if sendModel.foundDevices.isEmpty {
@@ -93,11 +106,13 @@ struct DeviceListView: View {
Image(systemName: "square.and.arrow.down")
.font(.system(size: 30))
.foregroundColor(.gray)
.padding(.leading, -10)
Text("DownloadQuickDropOnPlayStore")
}
.padding(.vertical)
}
} else {
CustomSection(header: "AvailableDevices") {
@@ -126,16 +141,20 @@ struct DeviceListView: View {
}
}
HStack(spacing: 8) {
Text("SearchingForDevices")
.font(.system(size: 14))
.foregroundColor(Color.primary.opacity(0.6))
ProgressView()
.frame(width: 12, height: 12)
if nearbyConnectionManager.hasLocalNetworkAccess {
HStack(spacing: 8) {
Text("SearchingForDevices")
.font(.system(size: 14))
.foregroundColor(Color.primary.opacity(0.6))
ProgressView()
.frame(width: 12, height: 12)
}
.padding(.vertical, 16)
}
.padding(.vertical, 16)
}
.animation(.smooth, value: nearbyConnectionManager.hasLocalNetworkAccess)
.navigationBarItems(trailing: ZStack {
if isShareExtension() {
XButton(action: { NearbyConnectionManager.shared.attachments?.closeView?() })
@@ -228,11 +247,11 @@ struct DeviceButtonLabel: View {
func isShareExtension() -> Bool {
#if EXTENSION
#if EXTENSION
return true
#else
#else
return false
#endif
#endif
}
@@ -244,13 +263,13 @@ func isShareExtension() -> Bool {
// RemoteDeviceInfo(name: "iPhone 14", type: .phone, id: "iphone-14-id"),
// RemoteDeviceInfo(name: "Samsung Galaxy S21", type: .phone, id: "samsung-galaxy-s21-id")
// ]
//
//
// return DeviceListView(sendModel: model, receiveModel: ReceiveModel())
// }
//}
//
//#Preview {
// NavigationView {
// DeviceListView.preview
// }
//}
#Preview {
NavigationView {
DeviceListView()
}
}
+7
View File
@@ -2,6 +2,13 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UIFileSharingEnabled</key>
<true/>
</dict>
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "الوصول إلى الشبكة المحلية مطلوب لاكتشاف الأجهزة ونقل الملفات عبر شبكة Wi-Fi الخاصة بك.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "Der Zugriff auf das lokale Netzwerk ist erforderlich, um Geräte zu erkennen und Dateien über Ihr Wi-Fi-Netzwerk zu übertragen.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "Se necesita acceso a la red local para detectar dispositivos y transferir archivos a través de su red Wi-Fi.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "L’accès au réseau local est nécessaire pour détecter les appareils et transférer des fichiers via votre réseau Wi-Fi.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "Helyi hálózati hozzáférés szükséges az eszközök felismeréséhez és a fájlok átviteléhez a Wi-Fi hálózatán keresztül.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "È necessario l’accesso alla rete locale per rilevare i dispositivi e trasferire file tramite la tua rete Wi-Fi.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "ローカルネットワークへのアクセスは、デバイスを検出し、Wi-Fi ネットワーク経由でファイルを転送するために必要です。";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "장치를 감지하고 Wi-Fi 네트워크를 통해 파일을 전송하려면 로컬 네트워크 접근이 필요합니다.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "Lokale netwerktoegang is nodig om apparaten te detecteren en bestanden over uw Wi-Fi-netwerk te verzenden.";
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "O acesso à rede local é necessário para detectar dispositivos e transferir arquivos pela sua rede Wi-Fi.";
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "O acesso à rede local é necessário para detetar dispositivos e transferir ficheiros através da sua rede Wi-Fi.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "Accesul la rețeaua locală este necesar pentru a detecta dispozitivele și a transfera fișiere prin rețeaua Wi-Fi.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "Доступ к локальной сети необходим для обнаружения устройств и передачи файлов через вашу сеть Wi-Fi.";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "การเข้าถึงเครือข่ายภายในเครื่องจำเป็นสำหรับการตรวจหาดีไวซ์และการถ่ายโอนไฟล์ผ่านเครือข่าย Wi-Fi ของคุณ";
+10
View File
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "Доступ до локальної мережі потрібен для виявлення пристроїв та передавання файлів через вашу мережу Wi-Fi.";
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
AirGuard
Created by Leon Böttger on 23.08.22.
*/
NSLocalNetworkUsageDescription = "需要本地网络访问以检测设备并通过您的 Wi-Fi 网络传输文件。";