An advanced Ethereum/EVM mobile wallet
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.
 
 
 
alpha-wallet-ios/NotificationSubscribersStor...

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
}
}