forked from zelo72/mastodon-ios
fix: foreground notification not trigger tab bell icon update issue
This commit is contained in:
parent
d85af16e03
commit
59812807c6
|
@ -7,7 +7,7 @@
|
||||||
<key>AppShared.xcscheme_^#shared#^_</key>
|
<key>AppShared.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>29</integer>
|
<integer>28</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
<key>MastodonIntent.xcscheme_^#shared#^_</key>
|
<key>MastodonIntent.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>28</integer>
|
<integer>30</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>MastodonIntents.xcscheme_^#shared#^_</key>
|
<key>MastodonIntents.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
<key>ShareActionExtension.xcscheme_^#shared#^_</key>
|
<key>ShareActionExtension.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>30</integer>
|
<integer>29</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SuppressBuildableAutocreation</key>
|
<key>SuppressBuildableAutocreation</key>
|
||||||
|
|
|
@ -45,7 +45,7 @@ final public class SceneCoordinator {
|
||||||
return Just(nil).eraseToAnyPublisher()
|
return Just(nil).eraseToAnyPublisher()
|
||||||
}
|
}
|
||||||
|
|
||||||
let accessToken = pushNotification._accessToken // use raw accessToken value without normalize
|
let accessToken = pushNotification.accessToken // use raw accessToken value without normalize
|
||||||
if currentActiveAuthenticationBox.userAuthorization.accessToken == accessToken {
|
if currentActiveAuthenticationBox.userAuthorization.accessToken == accessToken {
|
||||||
// do nothing if notification for current account
|
// do nothing if notification for current account
|
||||||
return Just(pushNotification).eraseToAnyPublisher()
|
return Just(pushNotification).eraseToAnyPublisher()
|
||||||
|
|
|
@ -348,7 +348,7 @@ extension HomeTimelineViewController {
|
||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
let pushNotification = MastodonPushNotification(
|
let pushNotification = MastodonPushNotification(
|
||||||
_accessToken: authenticationBox.userAuthorization.accessToken,
|
accessToken: authenticationBox.userAuthorization.accessToken,
|
||||||
notificationID: notificationID,
|
notificationID: notificationID,
|
||||||
notificationType: notificationType.rawValue,
|
notificationType: notificationType.rawValue,
|
||||||
preferredLocale: nil,
|
preferredLocale: nil,
|
||||||
|
@ -372,7 +372,7 @@ extension HomeTimelineViewController {
|
||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
let pushNotification = MastodonPushNotification(
|
let pushNotification = MastodonPushNotification(
|
||||||
_accessToken: accessToken,
|
accessToken: accessToken,
|
||||||
notificationID: notificationID,
|
notificationID: notificationID,
|
||||||
notificationType: notificationType.rawValue,
|
notificationType: notificationType.rawValue,
|
||||||
preferredLocale: nil,
|
preferredLocale: nil,
|
||||||
|
|
|
@ -9,10 +9,10 @@ import Foundation
|
||||||
|
|
||||||
struct MastodonPushNotification: Codable {
|
struct MastodonPushNotification: Codable {
|
||||||
|
|
||||||
let _accessToken: String
|
let accessToken: String
|
||||||
var accessToken: String {
|
// var accessToken: String {
|
||||||
return String.normalize(base64String: _accessToken)
|
// return String.normalize(base64String: _accessToken)
|
||||||
}
|
// }
|
||||||
|
|
||||||
let notificationID: Int
|
let notificationID: Int
|
||||||
let notificationType: String
|
let notificationType: String
|
||||||
|
@ -23,7 +23,7 @@ struct MastodonPushNotification: Codable {
|
||||||
let body: String
|
let body: String
|
||||||
|
|
||||||
enum CodingKeys: String, CodingKey {
|
enum CodingKeys: String, CodingKey {
|
||||||
case _accessToken = "access_token"
|
case accessToken = "access_token"
|
||||||
case notificationID = "notification_id"
|
case notificationID = "notification_id"
|
||||||
case notificationType = "notification_type"
|
case notificationType = "notification_type"
|
||||||
case preferredLocale = "preferred_locale"
|
case preferredLocale = "preferred_locale"
|
||||||
|
@ -33,7 +33,7 @@ struct MastodonPushNotification: Codable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
_accessToken: String,
|
accessToken: String,
|
||||||
notificationID: Int,
|
notificationID: Int,
|
||||||
notificationType: String,
|
notificationType: String,
|
||||||
preferredLocale: String?,
|
preferredLocale: String?,
|
||||||
|
@ -41,7 +41,7 @@ struct MastodonPushNotification: Codable {
|
||||||
title: String,
|
title: String,
|
||||||
body: String
|
body: String
|
||||||
) {
|
) {
|
||||||
self._accessToken = _accessToken
|
self.accessToken = accessToken
|
||||||
self.notificationID = notificationID
|
self.notificationID = notificationID
|
||||||
self.notificationType = notificationType
|
self.notificationType = notificationType
|
||||||
self.preferredLocale = preferredLocale
|
self.preferredLocale = preferredLocale
|
||||||
|
|
Loading…
Reference in New Issue