Hi,
I use this code myself in my app:
class NetworkModel {
static let shared = NetworkModel()
private let monitor = NWPathMonitor()
private var connected = true
init() {
monitor.pathUpdateHandler = { path in
if path.status == .satisfied {
self.connected = true
} else {
self.connected = false
}
}
let queue = DispatchQueue(label: "Monitor")
monitor.start(queue: queue)
}
/// Retrieves the current network state.
///
/// - Returns: A boolean value indicating the network state (connected or not).
func getNetworkState() -> Bool {
return connected
}
}
Downside is that the very first time it is accessed it is always false. So trigger it during launch so that the monitor can start watching and then it works perfect!
Post
Replies
Boosts
Views
Activity
Hi,
Thank you for your reply and confirming that the new catalogs work the same way.
I've checked the logs and how everything is received and I get the following incoming request:
AnyHashable("google.c.sender.id"): 413730047848, AnyHashable("google.c.a.e"): 1, AnyHashable("google.c.fid"): c0dFB2k7vUnMszvlFTjU-J, AnyHashable("aps"): {
alert = {
"loc-args" = (
"July 7 16:00"
);
"loc-key" = "training_description_changed_body";
"title-loc-args" = (
);
"title-loc-key" = "training_description_changed_title";
};
}, AnyHashable("gcm.message_id"): 1688651931999324
Using the following method to send:
const singleMessage: admin.messaging.Message = {
android: {
ttl: 3600000,
notification: {
titleLocKey: titleLocKey,
titleLocArgs: titleLocArgs,
bodyLocKey: bodyLocKey,
bodyLocArgs: bodyLocArgs,
},
},
apns: {
payload: {
aps: {
alert: {
titleLocKey: titleLocKey,
titleLocArgs: titleLocArgs,
locKey: bodyLocKey,
locArgs: bodyLocArgs,
},
},
},
},
token: token,
};
If you think that this isn't related to the new string catalogs, then I will search somewhere else.
Thank you in advance.