Enabled CarPlay

Tuned Tinted Night blue color
This commit is contained in:
Ilya Laktyushin 2019-08-09 22:08:01 +03:00
parent 7cf95a743c
commit f852e7f881
22 changed files with 112 additions and 92 deletions

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.10</string>
<string>5.10.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.10</string>
<string>5.10.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.10</string>
<string>5.10.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>
@ -31,15 +31,15 @@
SUBQUERY (
$extensionItem.attachments,
$attachment,
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO &quot;public.file-url&quot; ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO &quot;public.movie&quot; ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO &quot;public.image&quot; ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO &quot;public.url&quot; ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO &quot;public.text&quot; ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO &quot;public.audio&quot; ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO &quot;public.data&quot; ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO &quot;public.vcard&quot; ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO &quot;com.apple.pkpass&quot;
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.audio" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.data" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.vcard" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.apple.pkpass"
).@count == $extensionItem.attachments.@count
).@count &gt; 0</string>
</dict>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.10</string>
<string>5.10.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -185,7 +185,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.10</string>
<string>5.10.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View File

@ -33,5 +33,7 @@
<string>merchant.privatbank.test.telergramios</string>
<string>merchant.privatbank.prod.telergram</string>
</array>
<key>com.apple.developer.carplay-messaging</key><true/>
<key>com.apple.developer.carplay-calling</key><true/>
</dict>
</plist>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.10</string>
<string>5.10.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>UISupportedInterfaceOrientations</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.10</string>
<string>5.10.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.10</string>
<string>5.10.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -275,7 +275,14 @@ open class NavigationController: UINavigationController, ContainableController,
return (CGRect(origin: CGPoint(), size: detailFrame.size), ContainerViewLayout(size: CGSize(width: detailWidth, height: layout.size.height), metrics: LayoutMetrics(widthClass: .regular, heightClass: .regular), intrinsicInsets: layout.intrinsicInsets, safeInsets: layout.safeInsets, statusBarHeight: layout.statusBarHeight, inputHeight: layout.inputHeight, standardInputHeight: layout.standardInputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver))
}
case .single:
return (CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: layout.size.height)), ContainerViewLayout(size: CGSize(width: layout.size.width, height: layout.size.height), metrics: LayoutMetrics(widthClass: .compact, heightClass: layout.size.height > 900.0 ? .regular : .compact), intrinsicInsets: layout.intrinsicInsets, safeInsets: layout.safeInsets, statusBarHeight: layout.statusBarHeight, inputHeight: layout.inputHeight, standardInputHeight: layout.standardInputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver))
var heightClass: ContainerViewLayoutSizeClass
if (layout.size.width < 375.0 && layout.size.height > 700.0) || layout.size.height > 900.0 {
heightClass = .regular
} else {
heightClass = .compact
}
return (CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: layout.size.height)), ContainerViewLayout(size: CGSize(width: layout.size.width, height: layout.size.height), metrics: LayoutMetrics(widthClass: .compact, heightClass: heightClass), intrinsicInsets: layout.intrinsicInsets, safeInsets: layout.safeInsets, statusBarHeight: layout.statusBarHeight, inputHeight: layout.inputHeight, standardInputHeight: layout.standardInputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver))
}
}
@ -296,58 +303,54 @@ open class NavigationController: UINavigationController, ContainableController,
self.controllerView.addSubview(self.controllerView.separatorView)
}
let navigationBackgroundFrame = CGRect(origin: CGPoint(x: masterData.0.maxX, y: 0.0), size: CGSize(width: lastControllerFrameAndLayout.0.width, height: (layout.statusBarHeight ?? 0.0) + 44.0))
if let backgroundDetailsMode = self.backgroundDetailsMode {
switch backgroundDetailsMode {
case let .image(image):
if let detailsBackground = self.controllerView.detailsBackground {
self.controllerView.detailsBackground = nil
transition.updateAlpha(node: detailsBackground, alpha: 0.0, completion: { [weak detailsBackground] _ in
detailsBackground?.removeFromSupernode()
})
}
let emptyDetailView: UIImageView
if let emptyView = self.controllerView.emptyDetailView {
emptyDetailView = emptyView
} else {
emptyDetailView = UIImageView()
emptyDetailView.alpha = 0.0
self.controllerView.emptyDetailView = emptyDetailView
}
emptyDetailView.image = image
if emptyDetailView.superview == nil {
self.controllerView.insertSubview(emptyDetailView, at: 0)
}
transition.updateAlpha(layer: emptyDetailView.layer, alpha: 1.0)
emptyDetailView.frame = CGRect(origin: CGPoint(x: masterData.0.maxX + floor((lastControllerFrameAndLayout.0.size.width - image.size.width) / 2.0), y: floor((lastControllerFrameAndLayout.0.size.height - image.size.height) / 2.0)), size: image.size)
case let .image(image):
if let detailsBackground = self.controllerView.detailsBackground {
self.controllerView.detailsBackground = nil
transition.updateAlpha(node: detailsBackground, alpha: 0.0, completion: { [weak detailsBackground] _ in
detailsBackground?.removeFromSupernode()
})
}
let emptyDetailView: UIImageView
if let emptyView = self.controllerView.emptyDetailView {
emptyDetailView = emptyView
} else {
emptyDetailView = UIImageView()
emptyDetailView.alpha = 0.0
self.controllerView.emptyDetailView = emptyDetailView
}
emptyDetailView.image = image
if emptyDetailView.superview == nil {
self.controllerView.insertSubview(emptyDetailView, at: 0)
}
transition.updateAlpha(layer: emptyDetailView.layer, alpha: 1.0)
emptyDetailView.frame = CGRect(origin: CGPoint(x: masterData.0.maxX + floor((lastControllerFrameAndLayout.0.size.width - image.size.width) / 2.0), y: floor((lastControllerFrameAndLayout.0.size.height - image.size.height) / 2.0)), size: image.size)
case let .wallpaper(image):
if let emptyDetailView = self.controllerView.emptyDetailView {
self.controllerView.emptyDetailView = nil
transition.updateAlpha(layer: emptyDetailView.layer, alpha: 0.0, completion: { [weak emptyDetailView] _ in
emptyDetailView?.removeFromSuperview()
})
}
let detailsBackground: WallpaperbackgroundNode
if let background = self.controllerView.detailsBackground {
detailsBackground = background
} else {
detailsBackground = WallpaperbackgroundNode()
detailsBackground.alpha = 0.0
self.controllerView.detailsBackground = detailsBackground
}
detailsBackground.image = image
if detailsBackground.supernode == nil {
self.controllerView.insertSubview(detailsBackground.view, at: 0)
}
transition.updateAlpha(node: detailsBackground, alpha: 1.0)
detailsBackground.frame = CGRect(origin: CGPoint(x: masterData.0.maxX, y: 0.0), size: lastControllerFrameAndLayout.0.size)
case let .wallpaper(image):
if let emptyDetailView = self.controllerView.emptyDetailView {
self.controllerView.emptyDetailView = nil
transition.updateAlpha(layer: emptyDetailView.layer, alpha: 0.0, completion: { [weak emptyDetailView] _ in
emptyDetailView?.removeFromSuperview()
})
}
let detailsBackground: WallpaperbackgroundNode
if let background = self.controllerView.detailsBackground {
detailsBackground = background
} else {
detailsBackground = WallpaperbackgroundNode()
detailsBackground.alpha = 0.0
self.controllerView.detailsBackground = detailsBackground
}
detailsBackground.image = image
if detailsBackground.supernode == nil {
self.controllerView.insertSubview(detailsBackground.view, at: 0)
}
transition.updateAlpha(node: detailsBackground, alpha: 1.0)
detailsBackground.frame = CGRect(origin: CGPoint(x: masterData.0.maxX, y: 0.0), size: lastControllerFrameAndLayout.0.size)
}
} else {
if let emptyDetailView = self.controllerView.emptyDetailView {
self.controllerView.emptyDetailView = nil

View File

@ -1,5 +1,6 @@
import Foundation
import UIKit
import TelegramUIPreferences
private func makeDarkPresentationTheme(accentColor: UIColor, preview: Bool) -> PresentationTheme {
let destructiveColor: UIColor = UIColor(rgb: 0xff6767)
@ -322,9 +323,13 @@ private func makeDarkPresentationTheme(accentColor: UIColor, preview: Bool) -> P
)
}
public let defaultDarkAccentColor = UIColor(rgb: 0x2ea6ff)
public let defaultDarkAccentPresentationTheme = makeDarkAccentPresentationTheme(accentColor: UIColor(rgb: 0x2ea6ff), preview: false)
public func makeDarkAccentPresentationTheme(accentColor: UIColor?, preview: Bool) -> PresentationTheme {
let accentColor = accentColor ?? defaultDayAccentColor
var accentColor = accentColor ?? defaultDarkAccentColor
if accentColor == PresentationThemeBaseColor.blue.color {
accentColor = defaultDarkAccentColor
}
return makeDarkPresentationTheme(accentColor: accentColor, preview: preview)
}

View File

@ -1843,7 +1843,7 @@ final class SharedApplicationContext {
notificationCenter.getNotificationSettings(completionHandler: { settings in
switch (settings.authorizationStatus, authorize) {
case (.authorized, _), (.notDetermined, true):
notificationCenter.requestAuthorization(options: [.badge, .sound, .alert], completionHandler: { result, _ in
notificationCenter.requestAuthorization(options: [.badge, .sound, .alert, .carPlay], completionHandler: { result, _ in
completion(result)
if result {
Queue.mainQueue().async {
@ -1865,7 +1865,7 @@ final class SharedApplicationContext {
}
var carPlayOptions = options
//carPlayOptions.insert(.allowInCarPlay)
carPlayOptions.insert(.allowInCarPlay)
unknownMessageCategory = UNNotificationCategory(identifier: "unknown", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenContentString, options: options)
replyMessageCategory = UNNotificationCategory(identifier: "withReply", actions: [reply], intentIdentifiers: [INSearchForMessagesIntentIdentifier], hiddenPreviewsBodyPlaceholder: hiddenContentString, options: carPlayOptions)
@ -1876,7 +1876,7 @@ final class SharedApplicationContext {
muteMessageCategory = UNNotificationCategory(identifier: "withMute", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenContentString, options: options)
muteMediaMessageCategory = UNNotificationCategory(identifier: "withMuteMedia", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenContentString, options: options)
} else {
let carPlayOptions: UNNotificationCategoryOptions = [] //[.allowInCarPlay]
let carPlayOptions: UNNotificationCategoryOptions = [.allowInCarPlay]
unknownMessageCategory = UNNotificationCategory(identifier: "unknown", actions: [], intentIdentifiers: [], options: [])
replyMessageCategory = UNNotificationCategory(identifier: "withReply", actions: [reply], intentIdentifiers: [INSearchForMessagesIntentIdentifier], options: carPlayOptions)

View File

@ -875,7 +875,7 @@ public func channelInfoController(context: AccountContext, peerId: PeerId) -> Vi
}, reportChannel: {
presentControllerImpl?(peerReportOptionsController(context: context, subject: .peer(peerId), present: { c, a in
presentControllerImpl?(c, a)
}), nil)
}, completion: { _ in }), nil)
}, leaveChannel: {
let _ = (context.account.postbox.transaction { transaction -> Peer? in
return transaction.getPeer(peerId)

View File

@ -2653,14 +2653,14 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget,
if let strongSelf = self, let messageIds = strongSelf.presentationInterfaceState.interfaceState.selectionState?.selectedIds, !messageIds.isEmpty {
strongSelf.present(peerReportOptionsController(context: strongSelf.context, subject: .messages(Array(messageIds).sorted()), present: { c, a in
self?.present(c, in: .window(.root), with: a)
}), in: .window(.root))
}, completion: { _ in }), in: .window(.root))
}
}, reportMessages: { [weak self] messages in
if let strongSelf = self, !messages.isEmpty {
strongSelf.chatDisplayNode.dismissInput()
strongSelf.present(peerReportOptionsController(context: strongSelf.context, subject: .messages(messages.map({ $0.id }).sorted()), present: { c, a in
self?.present(c, in: .window(.root), with: a)
}), in: .window(.root))
}, completion: { _ in }), in: .window(.root))
}
}, deleteMessages: { [weak self] messages in
if let strongSelf = self, !messages.isEmpty {
@ -3341,7 +3341,7 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget,
}
if canManagePin {
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Conversation_UnpinMessageAlert, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_No, action: {}), TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Yes, action: {
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Conversation_UnpinMessageAlert, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Conversation_Unpin, action: {
if let strongSelf = self {
let disposable: MetaDisposable
if let current = strongSelf.unpinMessageDisposable {
@ -6119,6 +6119,12 @@ public final class ChatController: TelegramController, GalleryHiddenMediaTarget,
if let peer = peer as? TelegramChannel, let username = peer.username, !username.isEmpty {
self.present(peerReportOptionsController(context: self.context, subject: .peer(peer.id), present: { [weak self] c, a in
self?.present(c, in: .window(.root))
}, completion: { [weak self] success in
guard let strongSelf = self, success else {
return
}
let _ = removePeerChat(account: strongSelf.context.account, peerId: chatPeer.id, reportChatSpam: false).start()
(strongSelf.navigationController as? NavigationController)?.filterController(strongSelf, animated: true)
}), in: .window(.root))
} else if let _ = peer as? TelegramUser {
let presentationData = self.presentationData

View File

@ -790,7 +790,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|> deliverOnMainQueue
}
if self.item?.message.text == "❤️" {
if self.item?.message.text.hasPrefix("\u{2764}") ?? false {
let _ = startTime.start(next: { [weak self] time in
guard let strongSelf = self else {
return

View File

@ -201,7 +201,7 @@ func galleryItemForEntry(context: AccountContext, presentationData: Presentation
content = SystemVideoContent(url: embedUrl, imageReference: .webPage(webPage: WebpageReference(webpage), media: image), dimensions: webpageContent.embedSize ?? CGSize(width: 640.0, height: 640.0), duration: Int32(webpageContent.duration ?? 0))
}
}
if content == nil, let webEmbedContent = WebEmbedVideoContent(webPage: webpage, webpageContent: webpageContent) {
if content == nil, let webEmbedContent = WebEmbedVideoContent(webPage: webpage, webpageContent: webpageContent, forcedTimestamp: timecode.flatMap(Int.init)) {
content = webEmbedContent
}
}
@ -928,16 +928,13 @@ class GalleryController: ViewController {
if let (media, _) = mediaForMessage(message: message) {
if let presentationArguments = self.presentationArguments as? GalleryControllerPresentationArguments, let transitionArguments = presentationArguments.transitionArguments(message.id, media) {
nodeAnimatesItself = true
centralItemNode.activateAsInitial()
if presentationArguments.animated {
centralItemNode.animateIn(from: transitionArguments.transitionNode, addToTransitionSurface: transitionArguments.addToTransitionSurface)
}
self._hiddenMedia.set(.single((message.id, media)))
} else if self.isPresentedInPreviewingContext() {
centralItemNode.activateAsInitial()
}
centralItemNode.activateAsInitial()
}
}

View File

@ -169,6 +169,8 @@ func openResolvedUrl(_ resolvedUrl: ResolvedUrl, context: AccountContext, urlCon
|> deliverOnMainQueue).start(completed: {
navigationController?.pushViewController(ChatController(context: context, chatLocation: .peer(peerId), messageId: nil))
})
} else {
navigationController?.pushViewController(ChatController(context: context, chatLocation: .peer(peerId), messageId: nil))
}
}

View File

@ -290,7 +290,7 @@ public class PeerMediaCollectionController: TelegramController {
if let strongSelf = self, let messageIds = strongSelf.interfaceState.selectionState?.selectedIds, !messageIds.isEmpty {
strongSelf.present(peerReportOptionsController(context: strongSelf.context, subject: .messages(Array(messageIds).sorted()), present: { c, a in
self?.present(c, in: .window(.root), with: a)
}), in: .window(.root))
}, completion: { _ in }), in: .window(.root))
}
}, reportMessages: { _ in
}, deleteMessages: { _ in

View File

@ -20,7 +20,7 @@ private enum PeerReportOption {
case other
}
func peerReportOptionsController(context: AccountContext, subject: PeerReportSubject, present: @escaping (ViewController, Any?) -> Void) -> ViewController {
func peerReportOptionsController(context: AccountContext, subject: PeerReportSubject, present: @escaping (ViewController, Any?) -> Void, completion: @escaping (Bool) -> Void) -> ViewController {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let controller = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme))
@ -73,15 +73,17 @@ func peerReportOptionsController(context: AccountContext, subject: PeerReportSub
let _ = (reportPeer(account: context.account, peerId: peerId, reason: reportReason)
|> deliverOnMainQueue).start(completed: {
present(textAlertController(context: context, title: nil, text: presentationData.strings.ReportPeer_AlertSuccess, actions: [TextAlertAction(type: TextAlertActionType.defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
completion(true)
})
case let .messages(messageIds):
let _ = (reportPeerMessages(account: context.account, messageIds: messageIds, reason: reportReason)
|> deliverOnMainQueue).start(completed: {
present(textAlertController(context: context, title: nil, text: presentationData.strings.ReportPeer_AlertSuccess, actions: [TextAlertAction.init(type: TextAlertActionType.defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
completion(true)
})
}
} else {
controller?.present(peerReportController(context: context, subject: subject), in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
controller?.present(peerReportController(context: context, subject: subject, completion: completion), in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
}
controller?.dismissAnimated()
@ -93,6 +95,7 @@ func peerReportOptionsController(context: AccountContext, subject: PeerReportSub
ActionSheetItemGroup(items: [
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { [weak controller] in
controller?.dismissAnimated()
completion(false)
})
])
])
@ -185,7 +188,7 @@ private func peerReportControllerEntries(presentationData: PresentationData, sta
return entries
}
private func peerReportController(context: AccountContext, subject: PeerReportSubject) -> ViewController {
private func peerReportController(context: AccountContext, subject: PeerReportSubject, completion: @escaping (Bool) -> Void) -> ViewController {
var dismissImpl: (() -> Void)?
var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)?
@ -226,6 +229,7 @@ private func peerReportController(context: AccountContext, subject: PeerReportSu
let completed: () -> Void = {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.ReportPeer_AlertSuccess, actions: [TextAlertAction.init(type: TextAlertActionType.defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
completion(true)
dismissImpl?()
}
switch subject {
@ -246,6 +250,7 @@ private func peerReportController(context: AccountContext, subject: PeerReportSu
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.ReportPeer_ReasonOther_Title), leftNavigationButton: ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: {
dismissImpl?()
completion(false)
}), rightNavigationButton: rightButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back))
let listState = ItemListNodeState(entries: peerReportControllerEntries(presentationData: presentationData, state: state), style: .blocks, focusItemTag: PeerReportControllerEntryTag.text)

View File

@ -1157,7 +1157,7 @@ public func userInfoController(context: AccountContext, peerId: PeerId, mode: Us
}, report: {
presentControllerImpl?(peerReportOptionsController(context: context, subject: .peer(peerId), present: { c, a in
presentControllerImpl?(c, a)
}), nil)
}, completion: { _ in }), nil)
})
let deviceContacts: Signal<[(DeviceContactStableId, DeviceContactBasicData)], NoError> = peerView.get()

View File

@ -33,11 +33,9 @@ enum WebEmbedType {
}
}
func webEmbedType(content: TelegramMediaWebpageLoadedContent) -> WebEmbedType {
func webEmbedType(content: TelegramMediaWebpageLoadedContent, forcedTimestamp: Int? = nil) -> WebEmbedType {
if let (videoId, timestamp) = extractYoutubeVideoIdAndTimestamp(url: content.url) {
return .youtube(videoId: videoId, timestamp: timestamp)
// } else if let (videoId, timestamp) = extractVimeoVideoIdAndTimestamp(url: content.url) {
// return .vimeo(videoId: videoId, timestamp: timestamp)
return .youtube(videoId: videoId, timestamp: forcedTimestamp ?? timestamp)
} else {
return .iframe(url: content.embedUrl ?? content.url)
}

View File

@ -15,8 +15,9 @@ final class WebEmbedVideoContent: UniversalVideoContent {
let webpageContent: TelegramMediaWebpageLoadedContent
let dimensions: CGSize
let duration: Int32
let forcedTimestamp: Int?
init?(webPage: TelegramMediaWebpage, webpageContent: TelegramMediaWebpageLoadedContent) {
init?(webPage: TelegramMediaWebpage, webpageContent: TelegramMediaWebpageLoadedContent, forcedTimestamp: Int? = nil) {
guard let embedUrl = webpageContent.embedUrl else {
return nil
}
@ -25,10 +26,11 @@ final class WebEmbedVideoContent: UniversalVideoContent {
self.webpageContent = webpageContent
self.dimensions = webpageContent.embedSize ?? CGSize(width: 128.0, height: 128.0)
self.duration = Int32(webpageContent.duration ?? (0 as Int))
self.forcedTimestamp = forcedTimestamp
}
func makeContentNode(postbox: Postbox, audioSession: ManagedAudioSession) -> UniversalVideoContentNode & ASDisplayNode {
return WebEmbedVideoContentNode(postbox: postbox, audioSessionManager: audioSession, webPage: self.webPage, webpageContent: self.webpageContent)
return WebEmbedVideoContentNode(postbox: postbox, audioSessionManager: audioSession, webPage: self.webPage, webpageContent: self.webpageContent, forcedTimestamp: self.forcedTimestamp)
}
}
@ -61,7 +63,7 @@ private final class WebEmbedVideoContentNode: ASDisplayNode, UniversalVideoConte
private var readyDisposable = MetaDisposable()
init(postbox: Postbox, audioSessionManager: ManagedAudioSession, webPage: TelegramMediaWebpage, webpageContent: TelegramMediaWebpageLoadedContent) {
init(postbox: Postbox, audioSessionManager: ManagedAudioSession, webPage: TelegramMediaWebpage, webpageContent: TelegramMediaWebpageLoadedContent, forcedTimestamp: Int? = nil) {
self.webpageContent = webpageContent
if let embedSize = webpageContent.embedSize {
@ -72,7 +74,7 @@ private final class WebEmbedVideoContentNode: ASDisplayNode, UniversalVideoConte
self.imageNode = TransformImageNode()
let embedType = webEmbedType(content: webpageContent)
let embedType = webEmbedType(content: webpageContent, forcedTimestamp: forcedTimestamp)
let embedImpl = webEmbedImplementation(for: embedType)
self.playerNode = WebEmbedPlayerNode(impl: embedImpl, intrinsicDimensions: self.intrinsicDimensions)