mattermost-mobile/ios/GekidouWrapper.swift
Felipe Martin f50056f57b
MM-65085: Support Pre Shared Password on server connect (#9082)
* feat: add shared server password to server setup

* feat: allow editing the sever

* refactor: changed password -> secret, styling and tests

* e2e: draft e2e tests

* chore: lint fix

* feat: also send preauth secret header when using native share

* fix: removed unused server database migration

credentials are being stored in the keychain

* i18n: added missing english translations

* test(e2e): simplified connection tests

* test(e2e): rework

* refactor: remove setBearerToken

* chore: restore migrations the way it was

* chore: reverted file to original state

* chore: removed unneeded test and renamed password to secret

* chore: function version

* chore: updated forms i18n keys

* chore: remove if from test

* chore: unneeded variable

* fix: add missing key on object list

* refactor: swift keychain access to retrieve all credentials in one call

* revert: edit server screen

* refactor: credentials use getGenericCredential

* fix: objc code calling old method

* fix: added scroll to login screen

* chore: variable names

* fix: avoid inline styles

* fix: Improved appVersion positioning

* Update app/screens/server/form.tsx

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>

* feat: show error message on 403

* Revert "feat: show error message on 403"

This reverts commit f41630c767e10211adf1885321ceefd8a0931e32.

---------

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
2025-09-01 11:24:15 +02:00

54 lines
1.5 KiB
Swift

//
// GekidouWrapper.swift
// Mattermost
//
// Created by Elias Nahum on 06-04-22.
// Copyright © 2022 Facebook. All rights reserved.
//
import Foundation
import Gekidou
import react_native_emm
@objc class GekidouWrapper: NSObject {
@objc public static let `default` = GekidouWrapper()
override init() {
ScreenCaptureManager.startTrackingScreens()
}
@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 credentials = try? Keychain.default.getCredentials(for: url) {
return credentials?.token
}
return nil
}
}