fix: foreground notification not trigger tab bell icon update issue

This commit is contained in:
CMK 2022-02-11 15:33:18 +08:00
parent d85af16e03
commit 59812807c6
4 changed files with 13 additions and 13 deletions

View File

@ -7,7 +7,7 @@
<key>AppShared.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>29</integer>
<integer>28</integer>
</dict>
<key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict>
@ -97,7 +97,7 @@
<key>MastodonIntent.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>28</integer>
<integer>30</integer>
</dict>
<key>MastodonIntents.xcscheme_^#shared#^_</key>
<dict>
@ -117,7 +117,7 @@
<key>ShareActionExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>30</integer>
<integer>29</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>

View File

@ -45,7 +45,7 @@ final public class SceneCoordinator {
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 {
// do nothing if notification for current account
return Just(pushNotification).eraseToAnyPublisher()

View File

@ -348,7 +348,7 @@ extension HomeTimelineViewController {
else { return }
let pushNotification = MastodonPushNotification(
_accessToken: authenticationBox.userAuthorization.accessToken,
accessToken: authenticationBox.userAuthorization.accessToken,
notificationID: notificationID,
notificationType: notificationType.rawValue,
preferredLocale: nil,
@ -372,7 +372,7 @@ extension HomeTimelineViewController {
else { return }
let pushNotification = MastodonPushNotification(
_accessToken: accessToken,
accessToken: accessToken,
notificationID: notificationID,
notificationType: notificationType.rawValue,
preferredLocale: nil,

View File

@ -9,10 +9,10 @@ import Foundation
struct MastodonPushNotification: Codable {
let _accessToken: String
var accessToken: String {
return String.normalize(base64String: _accessToken)
}
let accessToken: String
// var accessToken: String {
// return String.normalize(base64String: _accessToken)
// }
let notificationID: Int
let notificationType: String
@ -23,7 +23,7 @@ struct MastodonPushNotification: Codable {
let body: String
enum CodingKeys: String, CodingKey {
case _accessToken = "access_token"
case accessToken = "access_token"
case notificationID = "notification_id"
case notificationType = "notification_type"
case preferredLocale = "preferred_locale"
@ -33,7 +33,7 @@ struct MastodonPushNotification: Codable {
}
public init(
_accessToken: String,
accessToken: String,
notificationID: Int,
notificationType: String,
preferredLocale: String?,
@ -41,7 +41,7 @@ struct MastodonPushNotification: Codable {
title: String,
body: String
) {
self._accessToken = _accessToken
self.accessToken = accessToken
self.notificationID = notificationID
self.notificationType = notificationType
self.preferredLocale = preferredLocale