Integrate FLEX (#4394)

Set up FLEX for debug builds under a 2 finger double tap anywhere on the screen.
This commit is contained in:
Stefan Ceriu
2021-06-09 09:58:22 +03:00
committed by GitHub
parent b51c6ed630
commit de33fa7cf0
4 changed files with 28 additions and 4 deletions
+1
View File
@@ -7,6 +7,7 @@ Changes to be released in next version
🙌 Improvements
* MXRoomSummary: Adapt room summary changes on MatrixSDK (#4360).
* EncryptionKeyManager: Create keys for room last message data type.
* Integrated FLEX for debug builds.
🐛 Bugfix
*
+2
View File
@@ -69,6 +69,8 @@ abstract_target 'RiotPods' do
pod 'SwiftBase32', '~> 0.9.0'
pod 'SwiftJWT', '~> 3.6.200'
pod 'FLEX', '~> 4.4.1', :configurations => ['Debug']
target 'RiotTests' do
inherit! :search_paths
end
+24 -1
View File
@@ -17,6 +17,10 @@
import Foundation
import Intents
#if DEBUG
import FLEX
#endif
/// The AppCoordinator is responsible of screen navigation and data injection at root application level. It decides if authentication or home screen should be shown and inject data needed for these flows, it changes the navigation stack on deep link, displays global warning.
/// This class should avoid to contain too many data management code not related to screen navigation logic. For example `MXSession` or push notification management should be handled in dedicated classes and report only navigation changes to the AppCoordinator.
final class AppCoordinator: NSObject, AppCoordinatorType {
@@ -49,10 +53,14 @@ final class AppCoordinator: NSObject, AppCoordinatorType {
// MARK: - Setup
init(router: RootRouterType) {
init(router: RootRouterType, window: UIWindow) {
self.rootRouter = router
self.customSchemeURLParser = CustomSchemeURLParser()
self.userSessionsService = UserSessionsService()
super.init()
setupFlexDebuggerOnWindow(window)
}
// MARK: - Public methods
@@ -119,6 +127,21 @@ final class AppCoordinator: NSObject, AppCoordinatorType {
return canOpenLink
}
private func setupFlexDebuggerOnWindow(_ window: UIWindow) {
#if DEBUG
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(showFlexDebugger))
tapGestureRecognizer.numberOfTouchesRequired = 2
tapGestureRecognizer.numberOfTapsRequired = 2
window.addGestureRecognizer(tapGestureRecognizer)
#endif
}
@objc private func showFlexDebugger() {
#if DEBUG
FLEXManager.shared.showExplorer()
#endif
}
}
// MARK: - LegacyAppDelegateDelegate
+1 -3
View File
@@ -55,8 +55,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// Setup window
let window = UIWindow(frame: UIScreen.main.bounds)
self.window = window
@@ -64,7 +62,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Create AppCoordinator
self.rootRouter = RootRouter(window: window)
let appCoordinator = AppCoordinator(router: self.rootRouter)
let appCoordinator = AppCoordinator(router: self.rootRouter, window: window)
appCoordinator.start()
self.legacyAppDelegate.delegate = appCoordinator