mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
fed488a806
commit
dfc5077946
@ -85,6 +85,7 @@ public enum ContactMultiselectionControllerMode {
|
||||
public enum ContactListFilter {
|
||||
case excludeWithoutPhoneNumbers
|
||||
case excludeSelf
|
||||
case excludeBots
|
||||
case exclude([EnginePeer.Id])
|
||||
case disable([EnginePeer.Id])
|
||||
}
|
||||
|
@ -152,16 +152,16 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
||||
|
||||
let configuration = WKWebViewConfiguration()
|
||||
|
||||
let bundle = Bundle.main
|
||||
let bundleVersion = bundle.infoDictionary?["CFBundleShortVersionString"] ?? ""
|
||||
|
||||
// let bundle = Bundle.main
|
||||
// let bundleVersion = bundle.infoDictionary?["CFBundleShortVersionString"] ?? ""
|
||||
//
|
||||
var proxyServerHost = "magic.org"
|
||||
if let data = context.currentAppConfiguration.with({ $0 }).data, let hostValue = data["ton_proxy_address"] as? String {
|
||||
proxyServerHost = hostValue
|
||||
}
|
||||
configuration.setURLSchemeHandler(TonSchemeHandler(proxyServerHost: proxyServerHost), forURLScheme: "tonsite")
|
||||
configuration.allowsInlineMediaPlayback = true
|
||||
configuration.applicationNameForUserAgent = "Telegram-iOS/\(bundleVersion)"
|
||||
// configuration.applicationNameForUserAgent = "Telegram-iOS/\(bundleVersion)"
|
||||
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
|
||||
configuration.mediaTypesRequiringUserActionForPlayback = []
|
||||
} else {
|
||||
|
@ -1499,6 +1499,8 @@ public final class ContactListNode: ASDisplayNode {
|
||||
disabledPeerIds = disabledPeerIds.union(peerIds)
|
||||
case .excludeWithoutPhoneNumbers:
|
||||
requirePhoneNumbers = true
|
||||
case .excludeBots:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -1786,6 +1788,8 @@ public final class ContactListNode: ASDisplayNode {
|
||||
disabledPeerIds = disabledPeerIds.union(peerIds)
|
||||
case .excludeWithoutPhoneNumbers:
|
||||
requirePhoneNumbers = true
|
||||
case .excludeBots:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,6 +394,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
var existingPeerIds = Set<EnginePeer.Id>()
|
||||
var disabledPeerIds = Set<EnginePeer.Id>()
|
||||
var requirePhoneNumbers = false
|
||||
var excludeBots = false
|
||||
for filter in filters {
|
||||
switch filter {
|
||||
case .excludeSelf:
|
||||
@ -404,6 +405,8 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
disabledPeerIds = disabledPeerIds.union(peerIds)
|
||||
case .excludeWithoutPhoneNumbers:
|
||||
requirePhoneNumbers = true
|
||||
case .excludeBots:
|
||||
excludeBots = true
|
||||
}
|
||||
}
|
||||
var existingNormalizedPhoneNumbers = Set<DeviceContactNormalizedPhoneNumber>()
|
||||
@ -413,10 +416,17 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
continue
|
||||
}
|
||||
|
||||
if case let .user(user) = peer, requirePhoneNumbers {
|
||||
let phone = user.phone ?? ""
|
||||
if phone.isEmpty {
|
||||
continue
|
||||
if case let .user(user) = peer {
|
||||
if requirePhoneNumbers {
|
||||
let phone = user.phone ?? ""
|
||||
if phone.isEmpty {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if excludeBots {
|
||||
if user.botInfo != nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,11 +452,18 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
continue
|
||||
}
|
||||
|
||||
if let user = peer.peer as? TelegramUser, requirePhoneNumbers {
|
||||
let phone = user.phone ?? ""
|
||||
if phone.isEmpty {
|
||||
continue
|
||||
if let user = peer.peer as? TelegramUser {
|
||||
if requirePhoneNumbers {
|
||||
let phone = user.phone ?? ""
|
||||
if phone.isEmpty {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if excludeBots {
|
||||
if user.botInfo != nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !existingPeerIds.contains(peer.peer.id) {
|
||||
|
@ -282,7 +282,7 @@ final class NavigationModalContainer: ASDisplayNode, ASScrollViewDelegate, ASGes
|
||||
let transition: ContainedViewLayoutTransition
|
||||
let dismissProgress: CGFloat
|
||||
if (velocity.y < -0.5 || progress >= 0.5) && self.checkInteractiveDismissWithControllers() {
|
||||
if let controller = self.container.controllers.last as? MinimizableController, self.isDraggingHeader || "".isEmpty {
|
||||
if let controller = self.container.controllers.last as? MinimizableController {
|
||||
dismissProgress = 0.0
|
||||
targetOffset = 0.0
|
||||
transition = .immediate
|
||||
|
@ -3089,6 +3089,7 @@ public final class DrawingToolsInteraction {
|
||||
var isAdditional = false
|
||||
var isMessage = false
|
||||
var isLink = false
|
||||
var isWeather = false
|
||||
if let entity = entityView.entity as? DrawingStickerEntity {
|
||||
if case let .dualVideoReference(isAdditionalValue) = entity.content {
|
||||
isVideo = true
|
||||
@ -3098,6 +3099,8 @@ public final class DrawingToolsInteraction {
|
||||
}
|
||||
} else if entityView.entity is DrawingLinkEntity {
|
||||
isLink = true
|
||||
} else if entityView.entity is DrawingWeatherEntity {
|
||||
isWeather = true
|
||||
}
|
||||
|
||||
guard (!isVideo || isAdditional) && (!isMessage || !isTopmost) else {
|
||||
@ -3143,7 +3146,7 @@ public final class DrawingToolsInteraction {
|
||||
}
|
||||
}))
|
||||
}
|
||||
if !isVideo && !isMessage && !isLink {
|
||||
if !isVideo && !isMessage && !isLink && !isWeather {
|
||||
if let stickerEntity = entityView.entity as? DrawingStickerEntity, case let .file(_, type) = stickerEntity.content, case .reaction = type {
|
||||
|
||||
} else {
|
||||
|
@ -1821,6 +1821,8 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
self.moreButtonNode.iconNode.enqueueState(.more, animated: false)
|
||||
|
||||
self.selectedButtonNode = SelectedButtonNode(theme: self.presentationData.theme)
|
||||
self.selectedButtonNode.alpha = 0.0
|
||||
self.selectedButtonNode.transform = CATransform3DMakeScale(0.01, 0.01, 1.0)
|
||||
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: presentationData))
|
||||
|
||||
@ -2239,6 +2241,9 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
fileprivate var selectionCount: Int32 = 0
|
||||
fileprivate func updateSelectionState(count: Int32) {
|
||||
self.selectionCount = count
|
||||
guard let layout = self.validLayout else {
|
||||
return
|
||||
}
|
||||
|
||||
let transition = ContainedViewLayoutTransition.animated(duration: 0.25, curve: .easeInOut)
|
||||
var moreIsVisible = false
|
||||
@ -2262,15 +2267,22 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
self.titleView.updateTitle(title: title, isEnabled: isEnabled, animated: true)
|
||||
self.cancelButtonNode.setState(isEnabled ? .cancel : .back, animated: true)
|
||||
|
||||
let selectedSize = self.selectedButtonNode.update(count: count)
|
||||
|
||||
var safeInset: CGFloat = 0.0
|
||||
if layout.safeInsets.right > 0.0 {
|
||||
safeInset += layout.safeInsets.right + 16.0
|
||||
}
|
||||
let navigationHeight = navigationLayout(layout: layout).navigationFrame.height
|
||||
self.selectedButtonNode.frame = CGRect(origin: CGPoint(x: self.view.bounds.width - 54.0 - selectedSize.width - safeInset, y: floorToScreenPixels((navigationHeight - selectedSize.height) / 2.0) + UIScreenPixel), size: selectedSize)
|
||||
|
||||
let isSelectionButtonVisible = count > 0 && self.controllerNode.currentDisplayMode == .all
|
||||
transition.updateAlpha(node: self.selectedButtonNode, alpha: isSelectionButtonVisible ? 1.0 : 0.0)
|
||||
transition.updateTransformScale(node: self.selectedButtonNode, scale: isSelectionButtonVisible ? 1.0 : 0.01)
|
||||
|
||||
let selectedSize = self.selectedButtonNode.update(count: count)
|
||||
if self.selectedButtonNode.supernode == nil {
|
||||
self.navigationBar?.addSubnode(self.selectedButtonNode)
|
||||
}
|
||||
self.selectedButtonNode.frame = CGRect(origin: CGPoint(x: self.view.bounds.width - 54.0 - selectedSize.width, y: 18.0 + UIScreenPixel), size: selectedSize)
|
||||
|
||||
self.titleView.segmentsHidden = true
|
||||
moreIsVisible = count > 0
|
||||
@ -2656,9 +2668,16 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
|
||||
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||
super.containerLayoutUpdated(layout, transition: transition)
|
||||
|
||||
|
||||
self.validLayout = layout
|
||||
self.controllerNode.containerLayoutUpdated(layout, navigationBarHeight: navigationLayout(layout: layout).navigationFrame.maxY, transition: transition)
|
||||
|
||||
var safeInset: CGFloat = 0.0
|
||||
if layout.safeInsets.right > 0.0 {
|
||||
safeInset += layout.safeInsets.right + 16.0
|
||||
}
|
||||
let navigationHeight = navigationLayout(layout: layout).navigationFrame.height
|
||||
self.selectedButtonNode.frame = CGRect(origin: CGPoint(x: self.view.bounds.width - 54.0 - self.selectedButtonNode.frame.width - safeInset, y: floorToScreenPixels((navigationHeight - self.selectedButtonNode.frame.height) / 2.0) + UIScreenPixel), size: self.selectedButtonNode.frame.size)
|
||||
}
|
||||
|
||||
public var mediaPickerContext: AttachmentMediaPickerContext? {
|
||||
|
@ -2720,7 +2720,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
if url.hasPrefix("https://apps.apple.com/account/subscriptions") {
|
||||
controller.context.sharedContext.applicationBindings.openSubscriptions()
|
||||
} else if url.hasPrefix("https://") || url.hasPrefix("tg://") {
|
||||
controller.context.sharedContext.openExternalUrl(context: controller.context, urlContext: .generic, url: url, forceExternal: !url.hasPrefix("tg://") && !url.contains("?start="), presentationData: controller.context.sharedContext.currentPresentationData.with({$0}), navigationController: nil, dismissInput: {})
|
||||
controller.context.sharedContext.openExternalUrl(context: controller.context, urlContext: .generic, url: url, forceExternal: !url.hasPrefix("tg://") && !url.contains("?start="), presentationData: controller.context.sharedContext.currentPresentationData.with({$0}), navigationController: navigationController, dismissInput: {})
|
||||
} else {
|
||||
let context = controller.context
|
||||
let signal: Signal<ResolvedUrl, NoError>?
|
||||
|
@ -2878,6 +2878,12 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
if isFromCamera && mediaDimensions.width > mediaDimensions.height {
|
||||
mediaEntity.scale = storyDimensions.height / fittedSize.height
|
||||
}
|
||||
|
||||
if case .botPreview = controller.mode {
|
||||
if fittedSize.width / fittedSize.height < storyDimensions.width / storyDimensions.height {
|
||||
mediaEntity.scale = storyDimensions.height / fittedSize.height
|
||||
}
|
||||
}
|
||||
|
||||
let initialValues: MediaEditorValues?
|
||||
if case let .draft(draft, _) = subject {
|
||||
|
@ -7129,7 +7129,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
self.didAppear = true
|
||||
|
||||
self.chatDisplayNode.historyNode.experimentalSnapScrollToItem = false
|
||||
self.chatDisplayNode.historyNode.canReadHistory.set(combineLatest(context.sharedContext.applicationBindings.applicationInForeground, self.canReadHistory.get()) |> map { a, b in
|
||||
self.chatDisplayNode.historyNode.canReadHistory.set(combineLatest(self.context.sharedContext.applicationBindings.applicationInForeground, self.canReadHistory.get()) |> map { a, b in
|
||||
return a && b
|
||||
})
|
||||
|
||||
|
@ -65,6 +65,9 @@ final class ContactSelectionControllerNode: ASDisplayNode {
|
||||
if requirePhoneNumbers {
|
||||
filters.append(.excludeWithoutPhoneNumbers)
|
||||
}
|
||||
if case .starsGifting = mode {
|
||||
filters.append(.excludeBots)
|
||||
}
|
||||
self.filters = filters
|
||||
|
||||
let displayTopPeers: ContactListPresentation.TopPeers
|
||||
@ -304,7 +307,7 @@ final class ContactSelectionControllerNode: ASDisplayNode {
|
||||
} else {
|
||||
categories.insert(.global)
|
||||
}
|
||||
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, contentNode: ContactsSearchContainerNode(context: self.context, updatedPresentationData: (self.presentationData, self.presentationDataPromise.get()), onlyWriteable: false, categories: categories, addContact: nil, openPeer: { [weak self] peer in
|
||||
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, contentNode: ContactsSearchContainerNode(context: self.context, updatedPresentationData: (self.presentationData, self.presentationDataPromise.get()), onlyWriteable: false, categories: categories, filters: self.filters, addContact: nil, openPeer: { [weak self] peer in
|
||||
if let strongSelf = self {
|
||||
var updated = false
|
||||
strongSelf.contactListNode.updateSelectionState { state -> ContactListNodeGroupSelectionState? in
|
||||
|
Loading…
x
Reference in New Issue
Block a user