mattermost-mobile/ios/GekidouWrapper.swift
Daniel Espino García c5e6e34fea
Fix MM 56723 (#7883)
* Fix MM 56723 (iOS)

* Add android

* Android fixes and version checking

* Add version check to ios

* Address feedback

* Add all versions to android

* Check all versions on iOS

* Fix unhandled version case

* Add comments

* Add final version numbers
2024-04-24 17:12:56 +02:00

49 lines
1.4 KiB
Swift

//
// GekidouWrapper.swift
// Mattermost
//
// Created by Elias Nahum on 06-04-22.
// Copyright © 2022 Facebook. All rights reserved.
//
import Foundation
import Gekidou
@objc class GekidouWrapper: NSObject {
@objc public static let `default` = GekidouWrapper()
@objc func postNotificationReceipt(_ userInfo: [AnyHashable:Any]) {
PushNotification.default.postNotificationReceipt(userInfo)
}
@objc func fetchDataForPushNotification(_ notification: [AnyHashable:Any], withContentHandler contentHander: @escaping ((_ data: Data?) -> Void)) {
PushNotification.default.fetchDataForPushNotification(notification, withContentHandler: { data in
let jsonData = try? JSONEncoder().encode(data)
contentHander(jsonData)
})
}
@objc func verifySignature(_ notification: [AnyHashable:Any]) -> Bool {
return PushNotification.default.verifySignature(notification)
}
@objc func attachSession(_ id: String, completionHandler: @escaping () -> Void) {
let shareExtension = ShareExtension()
shareExtension.attachSession(
id: id,
completionHandler: completionHandler
)
}
@objc func setPreference(_ value: Any?, forKey name: String) {
Preferences.default.set(value, forKey: name)
}
@objc func getToken(for url: String) -> String? {
if let token = try? Keychain.default.getToken(for: url) {
return token
}
return nil
}
}