ruby_everywhere 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 500e5331ac0f9b650cef020b9992c4f54bcff2ec08a37aa160da69c57468498a
|
|
4
|
+
data.tar.gz: 78114f8b44040ad51a3d2e10b033f6e6df25f46ee0a91cfbd96e519987ae52fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ecd03c6b0ee4823567da935d34696fa75925472b9e2cfb086cb8e00b80cc2e74b72d89c94b588ce807187a511fa12e2b4ce385105befd0e3fbd2f520efaadce1
|
|
7
|
+
data.tar.gz: 683c8c90f049d8a7ae8718ad4ca12d4a02c7acfe639c01b76b38bcf9d7507ff37dfd7a7bf81ac6381dc1f990245f78ae83a2a99f6c1227488e2cc0105c58b6fb
|
data/lib/everywhere/version.rb
CHANGED
|
@@ -122,7 +122,7 @@ final class WebControlHandler: NSObject, WKScriptMessageHandler {
|
|
|
122
122
|
let info = (body["to"] as? String).map { ["to": $0] }
|
|
123
123
|
NotificationCenter.default.post(name: .everywhereResetApp, object: nil, userInfo: info)
|
|
124
124
|
case "setBadge":
|
|
125
|
-
|
|
125
|
+
AppIconBadge.set((body["count"] as? NSNumber)?.intValue ?? 0)
|
|
126
126
|
case "setTabBadge":
|
|
127
127
|
guard let path = body["path"] as? String else { return }
|
|
128
128
|
NotificationCenter.default.post(
|
|
@@ -143,9 +143,13 @@ final class WebControlHandler: NSObject, WKScriptMessageHandler {
|
|
|
143
143
|
break
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
+
}
|
|
146
147
|
|
|
148
|
+
/// The app icon badge. Set by the page through `setBadge`, and cleared by the
|
|
149
|
+
/// scene on every reset — see `SceneDelegate.clearBadges()`.
|
|
150
|
+
enum AppIconBadge {
|
|
147
151
|
/// Provisional authorization is silent — no permission prompt for a badge.
|
|
148
|
-
|
|
152
|
+
static func set(_ count: Int) {
|
|
149
153
|
let center = UNUserNotificationCenter.current()
|
|
150
154
|
center.requestAuthorization(options: [.badge, .provisional]) { granted, _ in
|
|
151
155
|
guard granted else { return }
|
|
@@ -204,6 +204,7 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
204
204
|
authFlow.cancel()
|
|
205
205
|
awaitingAuthHandoff = false
|
|
206
206
|
clearWebContentCache()
|
|
207
|
+
clearBadges()
|
|
207
208
|
rebuildRoot(entries: [], routeTo: target)
|
|
208
209
|
loadedTabsFingerprint = "" // matches the empty tab set we just built
|
|
209
210
|
loadPathConfiguration(serverOnly: true)
|
|
@@ -272,6 +273,7 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
272
273
|
guard let handoff = config.authHandoffURL(token: token) else { return }
|
|
273
274
|
|
|
274
275
|
clearWebContentCache()
|
|
276
|
+
clearBadges()
|
|
275
277
|
rebuildRoot(entries: [], routeTo: handoff)
|
|
276
278
|
loadedTabsFingerprint = "" // matches the empty tab set we just built
|
|
277
279
|
awaitingAuthHandoff = true
|
|
@@ -465,6 +467,21 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
465
467
|
applyTabBadge(path: path, value: count > 0 ? String(count) : nil)
|
|
466
468
|
}
|
|
467
469
|
|
|
470
|
+
/// Drop every badge the app is carrying. Called from the reset sequence,
|
|
471
|
+
/// alongside the web content cache and for the same reason: a count belongs
|
|
472
|
+
/// to the session and the instance that rendered it, and a reset means one
|
|
473
|
+
/// of those is gone — a sign-out, a sign-in as someone else, or leaving a
|
|
474
|
+
/// picked instance for the picker. Without this the previous user's counts
|
|
475
|
+
/// stay on the app icon (nothing ever posts setBadge again once they're
|
|
476
|
+
/// signed out) and ride the stored `tabBadges` back onto the next tab bar
|
|
477
|
+
/// `rebuildRoot` builds. Whatever lands after the reset re-renders its own
|
|
478
|
+
/// `everywhere_badge` / `everywhere_tab_badge` metas if it has any.
|
|
479
|
+
private func clearBadges() {
|
|
480
|
+
tabBadges.keys.forEach { applyTabBadge(path: $0, value: nil) }
|
|
481
|
+
tabBadges.removeAll()
|
|
482
|
+
AppIconBadge.set(0)
|
|
483
|
+
}
|
|
484
|
+
|
|
468
485
|
private func applyTabBadge(path: String, value: String?) {
|
|
469
486
|
if #available(iOS 18.0, *), let tabBarController {
|
|
470
487
|
tabBarController.tabs.first { $0.identifier == path }?.badgeValue = value
|