feat: included previous and new IP addresses in the notifications (#2637)

This commit is contained in:
Serhiy Mytrovtsiy
2025-10-11 23:37:22 +02:00
parent 868ca52221
commit c4b424b3fa
41 changed files with 218 additions and 3 deletions

View File

@@ -119,7 +119,17 @@ class Notifications: NotificationsWrapper {
if self.localIPState {
let addr = value.laddr.v4 ?? value.laddr.v6
if addr != self.localIP {
self.newNotification(id: self.localID, title: localizedString("Local IP changed"), subtitle: nil)
var subtitle = ""
if let prev = self.localIP {
subtitle = localizedString("Previous IP", prev)
}
if let new = addr {
if !subtitle.isEmpty {
subtitle += "\n"
}
subtitle += localizedString("New IP", new)
}
self.newNotification(id: self.localID, title: localizedString("Local IP changed"), subtitle: subtitle)
}
self.localIP = addr
}
@@ -127,7 +137,17 @@ class Notifications: NotificationsWrapper {
if self.publicIPState {
let addr = value.raddr.v4 ?? value.raddr.v6
if addr != self.publicIP {
self.newNotification(id: self.publicID, title: localizedString("Public IP changed"), subtitle: nil)
var subtitle = ""
if let prev = self.publicIP {
subtitle = localizedString("Previous IP", prev)
}
if let new = addr {
if !subtitle.isEmpty {
subtitle += "\n"
}
subtitle += localizedString("New IP", new)
}
self.newNotification(id: self.publicID, title: localizedString("Public IP changed"), subtitle: subtitle)
}
self.publicIP = addr
}