Skip to content

Commit

Permalink
Merge pull request #1179 from novasamatech/fix/remove-filter-for-noti…
Browse files Browse the repository at this point in the history
…fications

Fix/remove filter for notifications
  • Loading branch information
svojsu authored Aug 5, 2024
2 parents de5fc4a + b6ecd21 commit b230a3b
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ final class NewReferendumHandler: CommonHandler, PushNotificationHandler {
return
}

guard chain.syncMode.enabled() else {
completion(.filteredOut)
return
}

let title = R.string.localizable.pushNotificationNewReferendumTitle(
preferredLanguages: self.locale.rLanguages
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ final class ReferendumUpdatesHandler: CommonHandler, PushNotificationHandler {
return
}

guard chain.syncMode.enabled() else {
completion(.filteredOut)
return
}

let content = self.content(from: chain)
completion(.modified(content))
case let .failure(error):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import SoraFoundation

enum PushNotificationHandleResult {
case modified(NotificationContentResult)
case filteredOut
case original(PushNotificationsHandlerErrors)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ final class StakingRewardsHandler: CommonHandler, PushNotificationHandler {
throw PushNotificationsHandlerErrors.assetNotFound(assetId: chainId)
}

guard chain.syncMode.enabled() else {
throw PushNotificationsHandlerErrors.chainDisabled
}

let priceOperation: BaseOperation<[PriceData]>
if
let priceId = asset.priceId,
Expand Down Expand Up @@ -92,8 +88,6 @@ final class StakingRewardsHandler: CommonHandler, PushNotificationHandler {
switch result {
case let .success(content):
completion(.modified(content))
case let .failure(error as PushNotificationsHandlerErrors) where error == .chainDisabled:
completion(.filteredOut)
case let .failure(error as PushNotificationsHandlerErrors):
completion(.original(error))
case let .failure(error):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ final class TransferHandler: CommonHandler, PushNotificationHandler {
throw PushNotificationsHandlerErrors.assetNotFound(assetId: chainId)
}

guard chain.syncMode.enabled() else {
throw PushNotificationsHandlerErrors.chainDisabled
}

let priceOperation: BaseOperation<[PriceData]>
if let priceId = asset.priceId,
let currency = currencyManager(operationQueue: operationQueue)?.selectedCurrency {
Expand Down Expand Up @@ -94,8 +90,6 @@ final class TransferHandler: CommonHandler, PushNotificationHandler {
switch result {
case let .success(content):
completion(.modified(content))
case let .failure(error as PushNotificationsHandlerErrors) where error == .chainDisabled:
completion(.filteredOut)
case let .failure(error as PushNotificationsHandlerErrors):
completion(.original(error))
case let .failure(error):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ final class NotificationService: UNNotificationServiceExtension {
switch handlerResult {
case let .modified(notification):
contentHandler(notification.toUserNotificationContent(with: bestAttemptContent))
case .filteredOut:
self?.logger.info("Notification skipped")
return
case let .original(error):
self?.logError(error)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ final class StakingRewardsNotificationsInteractor {
private func subscribeChains() {
chainRegistry.chainsSubscribe(
self,
runningInQueue: .main,
filterStrategy: .enabledChains
runningInQueue: .main
) { [weak self] changes in
let stakingChains = changes.filter {
switch $0 {
Expand Down

0 comments on commit b230a3b

Please sign in to comment.