Use XcodeGen files for app variants and setup Enterprise submodule. (#2976)

- Create an app.yml with the base app variant.
- Override app.yml contents on Nightly/PR builds.
- Add AppHooks mechanism.
- Add Enterprise submodule.
- Conditionally import Enterprise/fastlane/Fastfile if available.
This commit is contained in:
Doug
2024-06-27 18:18:17 +01:00
committed by GitHub
parent b7345aafca
commit 3cc4145a4c
15 changed files with 116 additions and 26 deletions
@@ -29,6 +29,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
private let appMediator: AppMediator
private let appSettings: AppSettings
private let appDelegate: AppDelegate
private let appHooks: AppHooks
private let elementCallService: ElementCallServiceProtocol
/// Common background task to continue long-running tasks in the background.
@@ -65,10 +66,13 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
@Consumable private var storedAppRoute: AppRoute?
init(appDelegate: AppDelegate) {
let appHooks = AppHooks()
appHooks.configure()
windowManager = WindowManager(appDelegate: appDelegate)
appMediator = AppMediator(windowManager: windowManager)
let appSettings = AppSettings()
let appSettings = appHooks.runAppSettingsHook(AppSettings())
MXLog.configure(logLevel: appSettings.logLevel)
@@ -83,6 +87,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
self.appDelegate = appDelegate
self.appSettings = appSettings
self.appHooks = appHooks
appRouteURLParser = AppRouteURLParser(appSettings: appSettings)
elementCallService = ElementCallService()
@@ -74,6 +74,14 @@ final class AppSettings {
store = userDefaults
}
// MARK: - Hooks
func override(defaultHomeserverAddress: String? = nil) {
if let defaultHomeserverAddress {
self.defaultHomeserverAddress = defaultHomeserverAddress
}
}
// MARK: - Application
/// Whether or not the app is a development build that isn't in production.
@@ -94,7 +102,7 @@ final class AppSettings {
/// The default homeserver address used. This is intentionally a string without a scheme
/// so that it can be passed to Rust as a ServerName for well-known discovery.
let defaultHomeserverAddress = "matrix.org"
private(set) var defaultHomeserverAddress = "matrix.org"
/// An override of the homeserver's Sliding Sync proxy URL. This allows development against servers
/// that don't yet have an officially trusted proxy configured in their well-known.
+45
View File
@@ -0,0 +1,45 @@
//
// Copyright 2024 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
// MARK: Registration
class AppHooks: AppHooksProtocol {
private(set) var appSettingsHook: AppSettingsHookProtocol?
func registerAppSettingsHook(_ hook: AppSettingsHookProtocol) {
appSettingsHook = hook
}
func runAppSettingsHook(_ appSettings: AppSettings) -> AppSettings {
guard let appSettingsHook else { return appSettings }
return appSettingsHook.run(appSettings: appSettings)
}
}
protocol AppHooksProtocol {
func configure()
}
extension AppHooksProtocol {
func configure() { }
}
// MARK: Protocols
protocol AppSettingsHookProtocol {
func run(appSettings: AppSettings) -> AppSettings
}
+1 -1
View File
@@ -31,7 +31,7 @@ class MockPostHogFactory: PostHogFactory {
self.mock = mock
}
func createPostHog(config: PostHogConfig) -> ElementX.PHGPostHogProtocol {
func createPostHog(config: PostHogConfig) -> PHGPostHogProtocol {
mock
}
}
+1
View File
@@ -118,6 +118,7 @@ targets:
PRODUCT_BUNDLE_IDENTIFIER: $(BASE_BUNDLE_IDENTIFIER)
MARKETING_VERSION: $(MARKETING_VERSION)
CURRENT_PROJECT_VERSION: $(CURRENT_PROJECT_VERSION)
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
DEVELOPMENT_TEAM: $(DEVELOPMENT_TEAM)
CODE_SIGN_ENTITLEMENTS: ElementX/SupportingFiles/ElementX.entitlements
SWIFT_OBJC_BRIDGING_HEADER: ElementX/SupportingFiles/ElementX-Bridging-Header.h