Indicate if no network connection

This commit is contained in:
Leon Böttger committed 2025-05-18 11:44:25 +02:00
1 parent 815ea3396f
commit e710bcab47
23 files changed
+77 -11

No files matched your search

+10 -10
View File
@@ -166,7 +166,7 @@
69DA9A0E29E0BF5100A442DA /* QuickDrop.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QuickDrop.app; sourceTree = BUILT_PRODUCTS_DIR; };
69DA9A1129E0BF5100A442DA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
69DA9A1329E0BF5200A442DA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
69DA9A1829E0BF5200A442DA /* NearDrop.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NearDrop.entitlements; sourceTree = "<group>"; };
69DA9A1829E0BF5200A442DA /* QuickDrop.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = QuickDrop.entitlements; sourceTree = "<group>"; };
69DA9A1E29E0C0B300A442DA /* NearbyConnectionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NearbyConnectionManager.swift; sourceTree = "<group>"; };
69DA9A2029E0CC4E00A442DA /* Data+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+Extensions.swift"; sourceTree = "<group>"; };
69DA9A2229E17F0400A442DA /* InboundNearbyConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboundNearbyConnection.swift; sourceTree = "<group>"; };
@@ -330,7 +330,7 @@
69DA9A1329E0BF5200A442DA /* Assets.xcassets */,
69D2C33629E78DF400EC7E30 /* Localizable.stringsdict */,
69D2C32B29E77F2200EC7E30 /* Localizable.strings */,
69DA9A1829E0BF5200A442DA /* NearDrop.entitlements */,
69DA9A1829E0BF5200A442DA /* QuickDrop.entitlements */,
69D2C32E29E7898C00EC7E30 /* MainMenu.xib */,
);
path = QuickDrop;
@@ -825,8 +825,8 @@
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SHARED_BUILD = 36;
SHARED_VERSION = 1.8;
SHARED_BUILD = 37;
SHARED_VERSION = 1.9;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
@@ -884,8 +884,8 @@
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SHARED_BUILD = 36;
SHARED_VERSION = 1.8;
SHARED_BUILD = 37;
SHARED_VERSION = 1.9;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
@@ -897,7 +897,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = NearDrop/NearDrop.entitlements;
CODE_SIGN_ENTITLEMENTS = QuickDrop/QuickDrop.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
@@ -907,7 +907,7 @@
DEVELOPMENT_TEAM = 92SDAWLN76;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = NearDrop/Info.plist;
INFOPLIST_FILE = QuickDrop/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = QuickDrop;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
INFOPLIST_KEY_LSUIElement = YES;
@@ -936,7 +936,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = NearDrop/NearDrop.entitlements;
CODE_SIGN_ENTITLEMENTS = QuickDrop/QuickDrop.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
@@ -946,7 +946,7 @@
DEVELOPMENT_TEAM = 92SDAWLN76;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = NearDrop/Info.plist;
INFOPLIST_FILE = QuickDrop/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = QuickDrop;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
INFOPLIST_KEY_LSUIElement = YES;
+25 -1
View File
@@ -28,11 +28,20 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
private var iapManager: IAPManager?
var showsFirewallAlert = false
var visibleItem: NSMenuItem? = nil
let hasConnectionMonitor = NWPathMonitor()
func applicationDidFinishLaunching(_: Notification) {
let menu = NSMenu()
menu.addItem(withTitle: NSLocalizedString("VisibleToEveryone", value: "Visible to everyone", comment: ""), action: nil, keyEquivalent: "")
let visibleItem = NSMenuItem(
title: "VisibleToEveryone".localized(),
action: nil,
keyEquivalent: ""
)
self.visibleItem = visibleItem
menu.addItem(visibleItem)
menu.addItem(withTitle: String(format: NSLocalizedString("DeviceName", value: "Device name: %@", comment: ""), arguments: [Host.current().localizedName ?? "Mac"]), action: nil, keyEquivalent: "")
menu.addItem(NSMenuItem.separator())
@@ -108,6 +117,21 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
let queue = DispatchQueue(label: "NetworkMonitor")
monitor.start(queue: queue)
hasConnectionMonitor.pathUpdateHandler = { path in
DispatchQueue.main.async {
if path.status == .satisfied {
self.statusItem?.button?.image = NSImage(named: "MenuBarIcon")
self.visibleItem?.title = "VisibleToEveryone".localized()
} else {
self.statusItem?.button?.image = NSImage(named: "MenuBarIconSlash")
self.visibleItem?.title = "NoNetworkConnection".localized()
}
}
}
let queue2 = DispatchQueue(label: "NetworkConnectionMonitor")
hasConnectionMonitor.start(queue: queue2)
}
func performDeviceToDeviceCheck() {
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "menubar1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "menubar2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Visible to everyone";
"NoNetworkConnection" = "No Network Connection";
"WelcomeToQuickDrop" = "Welcome to QuickDrop";
File renamed without changes.
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "مرئي للجميع";
"NoNetworkConnection" = "لا يوجد اتصال بالشبكة";
"RecommendedApps" = "التطبيقات الموصى بها";
"GetSupport" = "الدعم";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Für alle sichtbar";
"NoNetworkConnection" = "Keine Netzwerkverbindung";
"RecommendedApps" = "Empfohlene Apps";
"GetSupport" = "Support";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Visible para todos";
"NoNetworkConnection" = "Sin conexión de red";
"RecommendedApps" = "Apps recomendadas";
"GetSupport" = "Soporte";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Visible par tout le monde";
"NoNetworkConnection" = "Pas de connexion réseau";
"RecommendedApps" = "Applications recommandées";
"GetSupport" = "Support";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Mindenki számára felfedezhető";
"NoNetworkConnection" = "Nincs hálózati kapcsolat";
"RecommendedApps" = "Ajánlott alkalmazások";
"GetSupport" = "Támogatás";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Visibile a tutti";
"NoNetworkConnection" = "Nessuna connessione di rete";
"RecommendedApps" = "App consigliate";
"GetSupport" = "Supporto";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "すべてのユーザーに公開";
"NoNetworkConnection" = "ネットワークに接続されていません";
"RecommendedApps" = "おすすめアプリ";
"GetSupport" = "サポート";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "모든 사용자에게 공개";
"NoNetworkConnection" = "네트워크에 연결되어 있지 않습니다";
"RecommendedApps" = "추천 앱";
"GetSupport" = "지원";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Zichtbaar voor iedereen";
"NoNetworkConnection" = "Geen netwerkverbinding";
"RecommendedApps" = "Aanbevolen apps";
"GetSupport" = "Ondersteuning";
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Visível para todos";
"NoNetworkConnection" = "Sem conexão com a rede";
"RecommendedApps" = "Apps recomendados";
"GetSupport" = "Suporte";
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Visível para todos";
"NoNetworkConnection" = "Sem ligação de rede";
"RecommendedApps" = "Aplicativos recomendados";
"GetSupport" = "Suporte";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Vizibil pentru toată lumea";
"NoNetworkConnection" = "Nicio conexiune la rețea";
"RecommendedApps" = "Aplicații recomandate";
"GetSupport" = "Suport";
+1
View File
@@ -38,6 +38,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Видимость: все";
"NoNetworkConnection" = "Нет сетевого подключения";
/* No comment provided by engineer. */
"NotificationsDenied.Message" = "QuickDrop необходима возможность показывать уведомления о входящих файлах. Пожалуйста, разрешите уведомления в Системных настройках.";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "เปิดเผยต่อทุกคน";
"NoNetworkConnection" = "ไม่มีการเชื่อมต่อเครือข่าย";
"RecommendedApps" = "แอปแนะนำ";
"GetSupport" = "การสนับสนุน";
+1
View File
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "Видимість: для всіх";
"NoNetworkConnection" = "Немає мережевого підключення";
"RecommendedApps" = "Рекомендовані додатки";
"GetSupport" = "Підтримка";
@@ -47,6 +47,7 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "对所有人可见";
"NoNetworkConnection" = "无网络连接";
"RecommendedApps" = "推荐应用";
"GetSupport" = "支持";