iPhone client for network-computer: see and drive a remote Linux/Mac desktop over WebRTC, phone as trackpad and keyboard, desktop on a TV via AirPlay.

0 downloads

network-computer-ios/Sources/App/AppDelegate.swift
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/network-computer-ios.git
HTTPS
https://gitstable.com/git/askrobots/network-computer-ios.git
SSH
ssh://git@gitstable.com:2222/askrobots/network-computer-ios.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Dan Quellhorst First cut of the iPhone client cc1f67f 2 months ago History
AppDelegate.swift · 1.8 KB · 43 lines
1import UIKit
2import WebRTC
3
4@main
5final class AppDelegate: UIResponder, UIApplicationDelegate {
6 func application(_ application: UIApplication,
7 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
8 RTCInitializeSSL()
9 // Route remote desktop audio to the speaker (or AirPlay/Bluetooth), not the earpiece.
10 let cfg = RTCAudioSessionConfiguration.webRTC()
11 cfg.category = AVAudioSession.Category.playAndRecord.rawValue
12 cfg.categoryOptions = [.defaultToSpeaker, .allowAirPlay, .allowBluetoothA2DP]
13 cfg.mode = AVAudioSession.Mode.default.rawValue
14 RTCAudioSessionConfiguration.setWebRTC(cfg)
15 return true
16 }
17
18 // The main window and the external display (wired or AirPlay) get separate scene delegates.
19 func application(_ application: UIApplication,
20 configurationForConnecting session: UISceneSession,
21 options: UIScene.ConnectionOptions) -> UISceneConfiguration {
22 if session.role == .windowExternalDisplayNonInteractive {
23 let c = UISceneConfiguration(name: "External", sessionRole: session.role)
24 c.delegateClass = ExternalSceneDelegate.self
25 return c
26 }
27 let c = UISceneConfiguration(name: "Main", sessionRole: session.role)
28 c.delegateClass = SceneDelegate.self
29 return c
30 }
31}
32
33final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
34 var window: UIWindow?
35
36 func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options: UIScene.ConnectionOptions) {
37 guard let ws = scene as? UIWindowScene else { return }
38 let w = UIWindow(windowScene: ws)
39 w.rootViewController = RootViewController()
40 window = w
41 w.makeKeyAndVisible()
42 }
43}