blockchainethereumblockchain-walleterc20erc721walletxdaidappdecentralizederc1155erc875iosswifttokens
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
740 B
26 lines
740 B
//
|
|
// NotificationSubscribersStorage.swift
|
|
// AlphaWalletNotifications
|
|
//
|
|
// Created by Vladyslav Shepitko on 05.05.2023.
|
|
//
|
|
|
|
import Foundation
|
|
import AlphaWalletFoundation
|
|
|
|
public protocol NotificationSubscribersStorage: AnyObject {
|
|
subscript(address: AlphaWallet.Address) -> Bool? { get set }
|
|
}
|
|
|
|
public class BaseNotificationSubscribersStorage: NotificationSubscribersStorage {
|
|
private let defaults: UserDefaults
|
|
|
|
public subscript(address: AlphaWallet.Address) -> Bool? {
|
|
get { defaults.value(forKey: "push-notifications-\(address)") as? Bool }
|
|
set { defaults.set(newValue, forKey: "push-notifications-\(address)") }
|
|
}
|
|
|
|
public init(defaults: UserDefaults) {
|
|
self.defaults = defaults
|
|
}
|
|
}
|
|
|