Skip to content

Commit 8336495

Browse files
committed
Various fixes
1 parent 1ef71d2 commit 8336495

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

submodules/Camera/Sources/Camera.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ private final class CameraContext {
257257

258258
mainDeviceContext.output.markPositionChange(position: targetPosition)
259259
} else {
260+
self.session.session.stopRunning()
260261
self.configure {
261262
let isRoundVideo = self.initialConfiguration.isRoundVideo
262263
self.mainDeviceContext?.invalidate(switchAudio: !isRoundVideo)
@@ -284,6 +285,7 @@ private final class CameraContext {
284285
self.modeChange = .none
285286
}
286287
}
288+
self.session.session.startRunning()
287289
}
288290
}
289291

@@ -320,6 +322,7 @@ private final class CameraContext {
320322
self.modeChange = .dualCamera
321323
}
322324

325+
self.session.session.stopRunning()
323326
if enabled {
324327
self.configure {
325328
self.mainDeviceContext?.invalidate()
@@ -432,6 +435,7 @@ private final class CameraContext {
432435
self?.detectedCodesPipe.putNext(codes)
433436
}
434437
}
438+
self.session.session.startRunning()
435439

436440
if change {
437441
if #available(iOS 13.0, *), let previewView = self.simplePreviewView {

submodules/WebUI/Sources/WebAppController.swift

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,6 +2246,9 @@ public final class WebAppController: ViewController, AttachmentContainable {
22462246
self?.startDownload(url: url, fileName: fileName, fileSize: fileSize, isMedia: isMedia)
22472247
})
22482248
], parseMarkdown: true)
2249+
alertController.dismissed = { [weak self] byOutsideTap in
2250+
self?.webView?.sendEvent(name: "file_download_requested", data: "{status: \"cancelled\"}")
2251+
}
22492252
controller.present(alertController, in: .window(.root))
22502253
})
22512254
}
@@ -2447,6 +2450,9 @@ public final class WebAppController: ViewController, AttachmentContainable {
24472450
}
24482451
}
24492452
)
2453+
alertController.dismissed = { [weak self] byOutsideTap in
2454+
self?.webView?.sendEvent(name: "emoji_status_access_requested", data: "{status: \"cancelled\"}")
2455+
}
24502456
controller.present(alertController, in: .window(.root))
24512457
})
24522458
}
@@ -2477,7 +2483,22 @@ public final class WebAppController: ViewController, AttachmentContainable {
24772483
guard let self else {
24782484
return
24792485
}
2480-
if result {
2486+
if result, let controller {
2487+
let context = self.context
2488+
if !context.isPremium {
2489+
var replaceImpl: ((ViewController) -> Void)?
2490+
let demoController = context.sharedContext.makePremiumDemoController(context: context, subject: .emojiStatus, forceDark: false, action: {
2491+
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .animatedEmoji, forceDark: false, dismissed: nil)
2492+
replaceImpl?(controller)
2493+
}, dismissed: nil)
2494+
replaceImpl = { [weak demoController] c in
2495+
demoController?.replace(with: c)
2496+
}
2497+
controller.parentController()?.push(demoController)
2498+
self.webView?.sendEvent(name: "emoji_status_failed", data: "{error: \"USER_DECLINED\"}")
2499+
return
2500+
}
2501+
24812502
let _ = (self.context.engine.accountData.setEmojiStatus(file: file, expirationDate: expirationDate)
24822503
|> deliverOnMainQueue).start(completed: { [weak self] in
24832504
self?.webView?.sendEvent(name: "emoji_status_set", data: nil)
@@ -2494,7 +2515,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
24942515
return true
24952516
}
24962517
)
2497-
controller?.present(resultController, in: .window(.root))
2518+
controller.present(resultController, in: .window(.root))
24982519
} else {
24992520
self.webView?.sendEvent(name: "emoji_status_failed", data: "{error: \"USER_DECLINED\"}")
25002521
}

submodules/WebUI/Sources/WebAppMessagePreviewScreen.swift

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,24 @@ private final class SheetContent: CombinedComponent {
154154
break
155155
}
156156
case let .externalReference(reference):
157-
let _ = reference
157+
switch reference.message {
158+
case let .auto(textValue, entitiesValue, _):
159+
text = textValue
160+
entities = entitiesValue
161+
case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, _):
162+
text = textValue
163+
entities = entitiesValue
164+
let _ = disableUrlPreview
165+
let _ = previewParameters
166+
case let .contact(contact, _):
167+
media = [contact]
168+
case let .mapLocation(map, _):
169+
media = [map]
170+
case let .invoice(invoice, _):
171+
media = [invoice]
172+
default:
173+
break
174+
}
158175
}
159176

160177
let messageItem = PeerNameColorChatPreviewItem.MessageItem(

0 commit comments

Comments
 (0)