The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 03:00 UTC
fix(mobile): gallery images shrink back into their thumbnail on close (#21481)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
oliver committed
Oct 18, 2026 at 22:24 UTC
0e3c79567b665df327341488c01725072ccb2afa
3 files changed
+25
-12
apps/mobile/modules/t3-native-controls/ios/T3NativeControlsModule.swift
+9
-6
@@ -52,11 +52,14 @@ public final class T3NativeControlsModule: Module {
52
identifier: identifier, promise: promise)
53
}.runOnQueue(.main)
54
55
- AsyncFunction("presentFiles") { (urls: [URL], titles: [String], selectedIndex: Int, identifier: String, promise: Promise) in
56
- guard !urls.isEmpty, urls.count == titles.count, urls.indices.contains(selectedIndex) else {
55
+ AsyncFunction("presentFiles") { (urls: [URL], titles: [String], selectedIndex: Int, sourceIdentifiers: [String], identifier: String, promise: Promise) in
56
+ guard !urls.isEmpty, urls.count == titles.count, urls.count == sourceIdentifiers.count,
57
+ urls.indices.contains(selectedIndex)
58
+ else {
59
throw URLError(.badURL)
60
}
59
- let file = try self.makeFilePresentation(sourceIdentifier: "", identifier: identifier, promise: promise)
61
+ let file = try self.makeFilePresentation(sourceIdentifiers: sourceIdentifiers, identifier: identifier,
62
+ promise: promise)
63
guard let presenter = self.appContext?.utilities?.currentViewController() else {
64
file.dismiss()
65
return
@@ -241,13 +244,13 @@ public final class T3NativeControlsModule: Module {
244
if videoPresentation?.identifier == identifier { videoPresentation?.dismiss() }
245
}
246
244
- private func makeFilePresentation(sourceIdentifier: String, identifier: String,
247
+ private func makeFilePresentation(sourceIdentifiers: [String], identifier: String,
248
promise: Promise) throws -> T3NativeFilePresentation {
249
guard filePresentation == nil, videoPresentation == nil,
250
appContext?.utilities?.currentViewController() != nil
251
else { throw URLError(.cannotLoadFromNetwork) }
252
let file = T3NativeFilePresentation(identifier: identifier, sources: presentationSources,
250
- sourceIdentifier: sourceIdentifier) { [weak self] error in
253
+ sourceIdentifiers: sourceIdentifiers) { [weak self] error in
254
self?.filePresentation = nil
255
if let error { promise.reject(error) } else { promise.resolve(nil) }
256
}
@@ -257,7 +260,7 @@ public final class T3NativeControlsModule: Module {
260
261
private func presentFile(url: URL, title: String, sourceIdentifier: String,
262
identifier: String, promise: Promise) throws {
260
- let file = try makeFilePresentation(sourceIdentifier: sourceIdentifier, identifier: identifier, promise: promise)
263
+ let file = try makeFilePresentation(sourceIdentifiers: [sourceIdentifier], identifier: identifier, promise: promise)
264
guard let presenter = appContext?.utilities?.currentViewController() else { file.dismiss(); return }
265
file.present(url: url, title: title, from: presenter)
266
}
apps/mobile/modules/t3-native-controls/ios/T3NativeFilePresentation.swift
+14
-6
@@ -24,16 +24,17 @@ final class T3NativeFilePresentation: NSObject, QLPreviewControllerDataSource,
24
private var controller: UIViewController?
25
private let completion: (Error?) -> Void
26
private weak var sources: T3PresentationSources?
27
- private let sourceIdentifier: String
27
+ private let sourceIdentifiers: [String]
28
private var items: [FilePreviewItem] = []
29
private var loading: Task<Void, Never>?
30
private var dismissRequested = false
31
private var finished = false
32
33
- init(identifier: String, sources: T3PresentationSources, sourceIdentifier: String, completion: @escaping (Error?) -> Void) {
33
+ init(identifier: String, sources: T3PresentationSources, sourceIdentifiers: [String],
34
+ completion: @escaping (Error?) -> Void) {
35
self.identifier = identifier
36
self.sources = sources
36
- self.sourceIdentifier = sourceIdentifier
37
+ self.sourceIdentifiers = sourceIdentifiers
38
self.completion = completion
39
super.init()
40
}
@@ -107,14 +108,21 @@ final class T3NativeFilePresentation: NSObject, QLPreviewControllerDataSource,
108
items[index]
109
}
110
111
+ private func sourceView(for item: QLPreviewItem) -> UIView? {
112
+ guard !UIAccessibility.isReduceMotionEnabled,
113
+ let index = items.firstIndex(where: { $0 === item }),
114
+ sourceIdentifiers.indices.contains(index)
115
+ else { return nil }
116
+ return sources?.view(for: sourceIdentifiers[index])
117
+ }
118
+
119
func previewController(_ controller: QLPreviewController, transitionViewFor item: QLPreviewItem) -> UIView? {
111
- guard !UIAccessibility.isReduceMotionEnabled else { return nil }
112
- return sources?.view(for: sourceIdentifier)
120
+ sourceView(for: item)
121
}
122
123
func previewController(_ controller: QLPreviewController, frameFor item: QLPreviewItem,
124
inSourceView view: AutoreleasingUnsafeMutablePointer<UIView?>) -> CGRect {
117
- guard !UIAccessibility.isReduceMotionEnabled, let source = sources?.view(for: sourceIdentifier) else { return .zero }
125
+ guard let source = sourceView(for: item) else { return .zero }
126
view.pointee = source
127
return source.bounds
128
}
apps/mobile/src/components/FilePreview.ios.tsx
+2
@@ -15,6 +15,7 @@ const NativeControls = requireNativeModule<{
15
uris: readonly string[],
16
names: readonly string[],
17
selectedIndex: number,
18
+ sourceIdentifiers: readonly string[],
19
identifier: string,
20
): Promise<void>;
21
dismissFile(identifier: string): Promise<void>;
@@ -44,6 +45,7 @@ function NativeFilePreview(props: {
45
0,
46
gallery.findIndex((item) => item.uri === uri),
47
),
48
+ gallery.map((item) => item.sourceIdentifier ?? ""),
49
identifier,
50
)
51
: NativeControls.presentFile(uri, name ?? "Preview", sourceIdentifier ?? "", identifier);