Skip to content

Commit c85dc64

Browse files
feat(mobile): support Duo in the shared iOS app (#12648)
1 parent a0a0e94 commit c85dc64

42 files changed

Lines changed: 808 additions & 126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/mobile/app.config.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ const config: ExpoConfig = {
264264
"keychain-access-groups": [`$(AppIdentifierPrefix)${variant.iosBundleIdentifier}`],
265265
},
266266
infoPlist: {
267+
UISupportedInterfaceOrientations: [
268+
"UIInterfaceOrientationPortrait",
269+
"UIInterfaceOrientationLandscapeLeft",
270+
"UIInterfaceOrientationLandscapeRight",
271+
],
267272
NSAppTransportSecurity: {
268273
NSAllowsArbitraryLoads: true,
269274
},
-750 KB
Binary file not shown.
750 KB
Binary file not shown.

‎apps/mobile/eas.json‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
},
1414
"channel": "development",
1515
"developmentClient": true,
16-
"distribution": "internal"
16+
"distribution": "internal",
17+
"ios": {
18+
"image": "macos-tahoe-26.6-xcode-27.1"
19+
}
1720
},
1821
"preview": {
1922
"corepack": true,
@@ -23,7 +26,10 @@
2326
},
2427
"channel": "preview",
2528
"environment": "preview",
26-
"distribution": "internal"
29+
"distribution": "internal",
30+
"ios": {
31+
"image": "macos-tahoe-26.6-xcode-27.1"
32+
}
2733
},
2834
"preview:dev": {
2935
"corepack": true,
@@ -38,6 +44,9 @@
3844
"distribution": "internal",
3945
"android": {
4046
"buildType": "apk"
47+
},
48+
"ios": {
49+
"image": "macos-tahoe-26.6-xcode-27.1"
4150
}
4251
},
4352
"v2-preview": {
@@ -56,7 +65,10 @@
5665
},
5766
"channel": "production",
5867
"environment": "production",
59-
"autoIncrement": true
68+
"autoIncrement": true,
69+
"ios": {
70+
"image": "macos-tahoe-26.6-xcode-27.1"
71+
}
6072
}
6173
},
6274
"submit": {

‎apps/mobile/modules/t3-native-controls/expo-module.config.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"platforms": ["apple", "android"],
33
"apple": {
4-
"modules": ["T3NativeControlsModule", "T3KeyboardCommandsModule"]
4+
"modules": ["T3NativeControlsModule", "T3KeyboardCommandsModule"],
5+
"appDelegateSubscribers": ["T3WorkspaceOrientationSubscriber"]
56
},
67
"android": {
78
"modules": [

‎apps/mobile/modules/t3-native-controls/ios/T3KeyboardCommandsModule.swift‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ public final class T3KeyboardCommandsModule: Module {
1717
public final class T3KeyboardCommandsView: ExpoView {
1818
let onCommand = EventDispatcher()
1919
private var enabledCommands = Set<String>()
20+
private let shortcutInputView = UIView(frame: .zero)
2021

2122
public override var canBecomeFirstResponder: Bool { true }
2223

24+
// This responder handles hardware shortcuts, so reclaiming it must not show a software keyboard.
25+
public override var inputView: UIView? { shortcutInputView }
26+
2327
public override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
2428
if action == #selector(openCommandPalette) || action == #selector(paletteNext) || action == #selector(palettePrevious) || action == #selector(paletteDismiss),
2529
let input = window?.t3FirstResponder as? UITextInput,
@@ -89,6 +93,8 @@ public final class T3KeyboardCommandsView: ExpoView {
8993

9094
public required init(appContext: AppContext? = nil) {
9195
super.init(appContext: appContext)
96+
inputAssistantItem.leadingBarButtonGroups = []
97+
inputAssistantItem.trailingBarButtonGroups = []
9298
NotificationCenter.default.addObserver(
9399
self,
94100
selector: #selector(reclaimFirstResponderIfAvailable),

‎apps/mobile/modules/t3-native-controls/ios/T3LayoutMetricsView.swift‎

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
11
import ExpoModulesCore
22
import UIKit
33

4-
/// Reports the body geometry of a native navigation column.
4+
/// Reports geometry in the observing view's coordinate space, including system
5+
/// reservations that safe-area rectangles cannot represent, such as the fold.
56
final class T3LayoutMetricsView: ExpoView {
67
let onMetricsChange = EventDispatcher()
78
private var lastMetrics: NSDictionary?
9+
private var hasHinge: Bool? = false
810

911
required init(appContext: AppContext? = nil) {
1012
super.init(appContext: appContext)
1113
isUserInteractionEnabled = false
1214
registerForTraitChanges([UITraitHorizontalSizeClass.self, UITraitVerticalSizeClass.self]) { (view: T3LayoutMetricsView, _: UITraitCollection) in
1315
view.publishMetrics()
1416
}
17+
#if compiler(>=6.4)
18+
if #available(iOS 27.1, *) {
19+
hasHinge = nil
20+
addInteraction(UIHingeInteraction { [weak self] _, update in
21+
guard let self, self.window != nil else { return }
22+
// Capability survives temporary detachment and does not follow the hinge angle.
23+
let hasHinge = self.hasHinge == true || update.hinge != nil
24+
guard self.hasHinge != hasHinge else { return }
25+
self.hasHinge = hasHinge
26+
self.publishMetrics()
27+
})
28+
registerForTraitChanges(UITraitCollection.systemTraitsAffectingVerticalBarEdge) { (view: T3LayoutMetricsView, _: UITraitCollection) in
29+
view.publishMetrics()
30+
}
31+
}
32+
#endif
1533
}
1634

1735
override func didMoveToWindow() {
@@ -31,14 +49,43 @@ final class T3LayoutMetricsView: ExpoView {
3149
}
3250

3351
private func publishMetrics() {
34-
guard window != nil, bounds.width > 0, bounds.height > 0 else { return }
52+
guard let window, bounds.width > 0, bounds.height > 0, let hasHinge else { return }
53+
if hasHinge {
54+
T3WorkspaceOrientationSubscriber.allowHingeOrientations(in: window)
55+
}
56+
var verticalBarEdge = "none"
57+
var regions: [[String: Any]] = []
58+
#if compiler(>=6.4)
59+
if #available(iOS 27.1, *) {
60+
let rtl = effectiveUserInterfaceLayoutDirection == .rightToLeft
61+
switch traitCollection.verticalBarEdge {
62+
case .leading: verticalBarEdge = rtl ? "right" : "left"
63+
case .trailing: verticalBarEdge = rtl ? "left" : "right"
64+
default: break
65+
}
66+
for kind in [UIView.ReservedRegion.Kind.division, .occlusion] {
67+
for region in reservedRegions(kind: kind) where region.isActive {
68+
let frame = region.frame.intersection(bounds)
69+
guard !frame.isNull, !frame.isEmpty else { continue }
70+
regions.append([
71+
"kind": kind == .division ? "division" : "occlusion",
72+
"x": frame.minX, "y": frame.minY,
73+
"width": frame.width, "height": frame.height,
74+
])
75+
}
76+
}
77+
}
78+
#endif
3579
let metrics: [String: Any] = [
3680
"width": bounds.width, "height": bounds.height,
81+
"hasHinge": hasHinge,
3782
"horizontalSizeClass": traitCollection.horizontalSizeClass == .regular ? "regular" : "compact",
83+
"verticalBarEdge": verticalBarEdge,
3884
"safeArea": [
3985
"top": safeAreaInsets.top, "bottom": safeAreaInsets.bottom,
4086
"left": safeAreaInsets.left, "right": safeAreaInsets.right,
4187
],
88+
"reservedRegions": regions,
4289
]
4390
let next = metrics as NSDictionary
4491
guard lastMetrics?.isEqual(next) != true else { return }

‎apps/mobile/modules/t3-native-controls/ios/T3NativeControlsModule.swift‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ public final class T3NativeControlsModule: Module {
1313
public func definition() -> ModuleDefinition {
1414
Constants {
1515
if #available(iOS 26.0, *) {
16-
return ["supportsWorkspaceColumns": NSClassFromString("RNSSplitHostComponentView") != nil]
16+
return [
17+
"supportsWorkspaceColumns": NSClassFromString("RNSSplitHostComponentView") != nil,
18+
]
1719
}
1820
return ["supportsWorkspaceColumns": false]
1921
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import ExpoModulesCore
2+
import UIKit
3+
4+
/// Keep ordinary phones portrait-only while allowing a hinge-backed scene to rotate.
5+
public final class T3WorkspaceOrientationSubscriber: ExpoAppDelegateSubscriber {
6+
private static let hingeWindows = NSHashTable<UIWindow>.weakObjects()
7+
8+
static func allowHingeOrientations(in window: UIWindow) {
9+
guard !hingeWindows.contains(window) else { return }
10+
hingeWindows.add(window)
11+
window.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations()
12+
}
13+
14+
public func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
15+
if UIDevice.current.userInterfaceIdiom == .pad {
16+
// Keep iPad orientation policy, including portrait-only showcase captures.
17+
let orientations = Bundle.main.object(forInfoDictionaryKey: "UISupportedInterfaceOrientations~ipad") as? [String] ?? []
18+
return orientations == ["UIInterfaceOrientationPortrait"] ? .portrait : .all
19+
}
20+
return window.map { Self.hingeWindows.contains($0) } == true ? .allButUpsideDown : .portrait
21+
}
22+
}

‎apps/mobile/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
"react-native-nitro-modules": "0.35.9",
128128
"react-native-reanimated": "4.7.0",
129129
"react-native-safe-area-context": "~5.9.1",
130-
"react-native-screens": "file:deps/react-native-screens-5.0.0-t3.7.tgz",
130+
"react-native-screens": "file:deps/react-native-screens-5.0.0-t3.8.tgz",
131131
"react-native-shiki-engine": "^0.3.12",
132132
"react-native-svg": "15.15.5",
133133
"react-native-webview": "14.0.1",

0 commit comments

Comments
 (0)