Skip to content

Commit

Permalink
ios13 quick test
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazhvera committed Jul 15, 2024
1 parent e2c66f1 commit 3acbe94
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
--run_id ${{ github.run_id }} \
--run_attempt ${{ github.run_attempt }} \
--project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f2 -d\") \
--device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f2 -d\") \
--device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOS13PoolArn" --query "SecretString" | cut -f2 -d\") \
--app_file_path ./output/MqttClient.ipa \
--test_file_path ./workspace/test_bundle.zip \
--test_spec_file_path ./DeviceFarmScript/test_spec.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ let TEST_PORT: UInt32 = 1883
var mqttTestContext = MqttTestContext()
var client: Mqtt5Client?

@available(iOS 14.0, *)
struct ContentView: View {
@StateObject var testContext = mqttTestContext
@ObservedObject var testContext = mqttTestContext
var body: some View {
VStack {
Button("Setup Client and Start") {
Expand Down
34 changes: 33 additions & 1 deletion Test/IntegrationTests/MqttClient/MqttClient/MqttClientApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,44 @@

import SwiftUI

@available(iOS 14.0, *)

@main
struct MqttClientAppWrapper {
static func main() {
if #available(iOS 14.0, *) {
MqttClientApp.main()
}
else {
// The main actor only exists for 14.0 and above.
UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, nil, NSStringFromClass(SceneDelegate.self))
}
}
}


@available(iOS 14.0, *)
struct MqttClientApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}


class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
let contentView = ContentView()

// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
}
}
}

0 comments on commit 3acbe94

Please sign in to comment.