Various fixes
This commit is contained in:
Ilya Laktyushin 2018-12-20 18:14:08 +04:00
parent 2a75b5fc61
commit a9c80c111b
27 changed files with 193 additions and 34 deletions

View File

@ -0,0 +1,9 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"provides-namespace" : true
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Calls@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Calls@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Messages@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Messages@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Contacts@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Contacts@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Settings@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Settings@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -49,7 +49,13 @@ public final class CallListController: ViewController {
if case .tab = self.mode {
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationCallIcon(self.presentationData.theme), style: .plain, target: self, action: #selector(self.callPressed))
let icon = UIImage(bundleImageName: "Chat List/Tabs/IconCalls")
let icon: UIImage?
if (useSpecialTabBarIcons()) {
icon = UIImage(bundleImageName: "Chat List/Tabs/NY/IconCalls")
} else {
icon = UIImage(bundleImageName: "Chat List/Tabs/IconCalls")
}
self.tabBarItem.title = self.presentationData.strings.Calls_TabTitle
self.tabBarItem.image = icon
self.tabBarItem.selectedImage = icon

View File

@ -4,6 +4,10 @@ import SwiftSignalKit
import Display
import TelegramCore
public func useSpecialTabBarIcons() -> Bool {
return (Date(timeIntervalSince1970: 1545642000)...Date(timeIntervalSince1970: 1546387200)).contains(Date())
}
public class ChatListController: TelegramController, KeyShortcutResponder, UIViewControllerPreviewingDelegate {
private var validLayout: ContainerViewLayout?
@ -64,7 +68,13 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
self.navigationItem.titleView = self.titleView
self.tabBarItem.title = self.presentationData.strings.DialogList_Title
let icon = UIImage(bundleImageName: "Chat List/Tabs/IconChats")
let icon: UIImage?
if (useSpecialTabBarIcons()) {
icon = UIImage(bundleImageName: "Chat List/Tabs/NY/IconChats")
} else {
icon = UIImage(bundleImageName: "Chat List/Tabs/IconChats")
}
self.tabBarItem.image = icon
self.tabBarItem.selectedImage = icon

View File

@ -83,7 +83,7 @@ public final class DeviceAccess {
public static func authorizationStatus(account: Account, subject: DeviceAccessSubject) -> Signal<AccessType, NoError> {
switch subject {
case .notifications:
let status = Signal<AccessType, NoError> { subscriber in
let status = (Signal<AccessType, NoError> { subscriber in
if #available(iOSApplicationExtension 10.0, *) {
UNUserNotificationCenter.current().getNotificationSettings(completionHandler: { settings in
switch settings.authorizationStatus {
@ -107,7 +107,14 @@ public final class DeviceAccess {
subscriber.putCompletion()
}
return EmptyDisposable
} |> afterNext { status in
switch status {
case .allowed, .unreachable:
DeviceAccess.notificationsPromise.set(.single(nil))
default:
break
}
} )
|> then(self.notifications
|> mapToSignal { authorized -> Signal<AccessType, NoError> in
if let authorized = authorized {

View File

@ -1042,6 +1042,10 @@ final class ContactListNode: ASDisplayNode {
itemHeaderNode.updateTheme(theme: presentationData.theme)
}
})
if let validLayout = strongSelf.validLayout {
strongSelf.containerLayoutUpdated(validLayout, transition: .immediate)
}
}
}
})
@ -1136,10 +1140,8 @@ final class ContactListNode: ASDisplayNode {
indexNode.update(size: indexNodeFrame.size, color: self.presentationData.theme.list.itemAccentColor, sections: indexSections, transition: transition)
}
//if let authorizationNode = self.authorizationNode {
authorizationNode.updateLayout(size: layout.size, insets: insets, transition: transition)
transition.updateFrame(node: authorizationNode, frame: self.bounds)
//}
self.authorizationNode.updateLayout(size: layout.size, insets: insets, transition: transition)
transition.updateFrame(node: self.authorizationNode, frame: self.bounds)
if !hadValidLayout {
self.dequeueTransitions()

View File

@ -35,7 +35,13 @@ public class ContactsController: ViewController {
self.title = self.presentationData.strings.Contacts_Title
self.tabBarItem.title = self.presentationData.strings.Contacts_Title
let icon = UIImage(bundleImageName: "Chat List/Tabs/IconContacts")
let icon: UIImage?
if (useSpecialTabBarIcons()) {
icon = UIImage(bundleImageName: "Chat List/Tabs/NY/IconContacts")
} else {
icon = UIImage(bundleImageName: "Chat List/Tabs/IconContacts")
}
self.tabBarItem.image = icon
self.tabBarItem.selectedImage = icon

View File

@ -2,7 +2,7 @@ import Foundation
import AsyncDisplayKit
import Display
final class GalleryNavigationCheckNode: ASDisplayNode {
final class GalleryNavigationCheckNode: ASDisplayNode, NavigationButtonCustomDisplayNode {
private var checkNode: CheckNode
init(theme: PresentationTheme) {
@ -13,6 +13,10 @@ final class GalleryNavigationCheckNode: ASDisplayNode {
self.addSubnode(self.checkNode)
}
var isHighlightable: Bool {
return false
}
var isChecked: Bool {
return self.checkNode.isChecked
}

View File

@ -3,26 +3,37 @@ import AsyncDisplayKit
import Display
import LegacyComponents
final class GalleryNavigationRecipientNode: ASDisplayNode {
final class GalleryNavigationRecipientNode: ASDisplayNode, NavigationButtonCustomDisplayNode {
private var iconNode: ASImageNode
private var textNode: ASTextNode
private var textNode: ImmediateTextNode
init(color: UIColor, title: String) {
self.iconNode = ASImageNode()
self.iconNode.alpha = 0.45
self.iconNode.image = TGComponentsImageNamed("PhotoPickerArrow")
self.textNode = ASTextNode()
self.textNode = ImmediateTextNode()
self.textNode.attributedText = NSAttributedString(string: title, font: Font.bold(13.0), textColor: UIColor(rgb: 0xffffff, alpha: 0.45))
self.textNode.maximumNumberOfLines = 1
super.init()
self.addSubnode(self.iconNode)
self.addSubnode(self.textNode)
if title.isEmpty {
self.iconNode.isHidden = true
self.textNode.isHidden = true
}
}
var isHighlightable: Bool {
return false
}
override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
return CGSize(width: 30.0, height: 30.0)
let textSize = self.textNode.updateLayout(CGSize(width: constrainedSize.width - 50.0, height: constrainedSize.height))
return CGSize(width: textSize.width + 12.0, height: 30.0)
}
override func layout() {
@ -32,6 +43,6 @@ final class GalleryNavigationRecipientNode: ASDisplayNode {
self.iconNode.frame = CGRect(origin: CGPoint(x: -2.0, y: 9.0), size: image.size)
}
self.textNode.frame = CGRect(x: self.iconNode.frame.maxX + 6.0, y: 7.0, width: 150.0, height: 20.0)
self.textNode.frame = CGRect(x: self.iconNode.frame.maxX + 6.0, y: 7.0, width: self.frame.size.width - 12.0, height: 15.0)
}
}

View File

@ -31,7 +31,7 @@ func presentLegacyWebSearchEditor(account: Account, theme: PresentationTheme, re
let legacyController = LegacyController(presentation: .custom, theme: theme, initialLayout: initialLayout)
legacyController.statusBar.statusBarStyle = theme.rootController.statusBar.style.style
let controller = TGPhotoEditorController(context: legacyController.context, item: item, intent: TGPhotoEditorControllerAvatarIntent, adjustments: nil, caption: nil, screenImage: screenImage, availableTabs: TGPhotoEditorController.defaultTabsForAvatarIntent(), selectedTab: .cropTab)!
let controller = TGPhotoEditorController(context: legacyController.context, item: item, intent: TGPhotoEditorControllerAvatarIntent, adjustments: nil, caption: nil, screenImage: screenImage ?? UIImage(), availableTabs: TGPhotoEditorController.defaultTabsForAvatarIntent(), selectedTab: .cropTab)!
legacyController.bind(controller: controller)
controller.editingContext = TGMediaEditingContext()

View File

@ -169,9 +169,6 @@ private final class LiveLocationPeerSummaryContext {
}
}
}
if let accountPeer = accountPeer, strongSelf.isActive {
//peers.append(accountPeer)
}
if peersAndMessages.isEmpty {
strongSelf.peersAndMessages = nil
} else {

View File

@ -234,7 +234,7 @@ final class OngoingCallContext {
}
func start(key: Data, isOutgoing: Bool, connections: CallSessionConnectionSet, maxLayer: Int32, allowP2P: Bool, audioSessionActive: Signal<Bool, NoError>, logName: String) {
var logPath = logName.isEmpty ? "" : callLogsPath(account: self.account) + "/" + logName + ".log"
let logPath = logName.isEmpty ? "" : callLogsPath(account: self.account) + "/" + logName + ".log"
self.audioSessionDisposable.set((audioSessionActive
|> filter { $0 }
|> take(1)).start(next: { [weak self] _ in

View File

@ -79,7 +79,7 @@ final class PermissionContentNode: ASDisplayNode {
func updateLayout(size: CGSize, insets: UIEdgeInsets, transition: ContainedViewLayoutTransition) {
let sidePadding: CGFloat
let fontSize: CGFloat
if size.width > 330.0 {
if min(size.width, size.height) > 330.0 {
fontSize = 24.0
sidePadding = 38.0
} else {
@ -91,28 +91,32 @@ final class PermissionContentNode: ASDisplayNode {
let titleSize = self.titleNode.updateLayout(CGSize(width: size.width - sidePadding * 2.0, height: .greatestFiniteMagnitude))
let textSize = self.textNode.updateLayout(CGSize(width: size.width - sidePadding * 2.0, height: .greatestFiniteMagnitude))
let buttonHeight = self.actionButton.updateLayout(width: size.width, transition: transition)
let buttonWidth = min(size.width, size.height)
let buttonHeight = self.actionButton.updateLayout(width: buttonWidth, transition: transition)
let privacyButtonSize = self.privacyPolicyButton.measure(CGSize(width: size.width - sidePadding * 2.0, height: .greatestFiniteMagnitude))
let titleSubtitleSpacing: CGFloat = 26.0
let buttonSpacing: CGFloat = 36.0
let privacySpacing: CGFloat = 45.0
let availableHeight = floor(size.height - insets.top - insets.bottom - titleSize.height - textSize.height - buttonHeight)
let titleSubtitleSpacing: CGFloat = max(15.0, floor(availableHeight * 0.055))
let buttonSpacing: CGFloat = max(19.0, floor(availableHeight * 0.075))
var contentHeight = titleSize.height + titleSubtitleSpacing + textSize.height + buttonHeight + buttonSpacing
var imageSize = CGSize()
var imageSpacing: CGFloat = 0.0
if let icon = self.iconNode.image {
imageSpacing = 60.0
if let icon = self.iconNode.image, size.width < size.height {
imageSpacing = floor(availableHeight * 0.12)
imageSize = icon.size
contentHeight += imageSize.height + imageSpacing
}
let privacySpacing: CGFloat = max(30.0 + privacyButtonSize.height, (availableHeight - titleSubtitleSpacing - buttonSpacing - imageSize.height - imageSpacing) / 2.0)
let contentOrigin = insets.top + floor((size.height - insets.top - insets.bottom - contentHeight) / 2.0)
let iconFrame = CGRect(origin: CGPoint(x: floor((size.width - imageSize.width) / 2.0), y: contentOrigin), size: imageSize)
let titleFrame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: iconFrame.maxY + imageSpacing), size: titleSize)
let textFrame = CGRect(origin: CGPoint(x: floor((size.width - textSize.width) / 2.0), y: titleFrame.maxY + titleSubtitleSpacing), size: textSize)
let buttonFrame = CGRect(origin: CGPoint(x: 0.0, y: textFrame.maxY + buttonSpacing), size: CGSize(width: size.width, height: buttonHeight))
let privacyButtonFrame = CGRect(origin: CGPoint(x: floor((size.width - privacyButtonSize.width) / 2.0), y: buttonFrame.maxY + privacySpacing), size: privacyButtonSize)
let buttonFrame = CGRect(origin: CGPoint(x: floor((size.width - buttonWidth) / 2.0), y: textFrame.maxY + buttonSpacing), size: CGSize(width: buttonWidth, height: buttonHeight))
let privacyButtonFrame = CGRect(origin: CGPoint(x: floor((size.width - privacyButtonSize.width) / 2.0), y: buttonFrame.maxY + floor((privacySpacing - privacyButtonSize.height) / 2.0)), size: privacyButtonSize)
transition.updateFrame(node: self.iconNode, frame: iconFrame)

View File

@ -777,7 +777,12 @@ public func settingsController(account: Account, accountManager: AccountManager)
actionsDisposable.dispose()
}
let icon = UIImage(bundleImageName: "Chat List/Tabs/IconSettings")
let icon: UIImage?
if (useSpecialTabBarIcons()) {
icon = UIImage(bundleImageName: "Chat List/Tabs/NY/IconSettings")
} else {
icon = UIImage(bundleImageName: "Chat List/Tabs/IconSettings")
}
let controller = ItemListController(account: account, state: signal, tabBarItem: combineLatest((account.applicationContext as! TelegramApplicationContext).presentationData, notificationsAuthorizationStatus.get(), notificationsWarningSuppressed.get()) |> map { presentationData, notificationsAuthorizationStatus, notificationsWarningSuppressed in
let notificationsWarning = shouldDisplayNotificationsPermissionWarning(status: notificationsAuthorizationStatus, suppressed: notificationsWarningSuppressed)

View File

@ -154,9 +154,17 @@ public class TelegramController: ViewController {
switch locationBroadcastPanelSource {
case let .peer(peerId):
self.locationBroadcastMode = .peer
signal = liveLocationManager.summaryManager.peersBroadcastingTo(peerId: peerId)
|> map { peersAndMessages in
let peers = peersAndMessages?.map { $0.0 }
signal = combineLatest(liveLocationManager.summaryManager.peersBroadcastingTo(peerId: peerId), liveLocationManager.summaryManager.broadcastingToMessages())
|> map { peersAndMessages, outgoingMessages in
var peers = peersAndMessages?.map { $0.0 }
for message in outgoingMessages.values {
if message.id.peerId == peerId, let author = message.author {
if peers == nil {
peers = []
}
peers?.append(author)
}
}
return (peers, nil)
}
default:

View File

@ -55,6 +55,8 @@ final class WebSearchGalleryControllerPresentationArguments {
}
class WebSearchGalleryController: ViewController {
private static let navigationTheme = NavigationBarTheme(buttonColor: .white, disabledButtonColor: UIColor(rgb: 0x525252), primaryTextColor: .white, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear)
private var galleryNode: GalleryControllerNode {
return self.displayNode as! GalleryControllerNode
}
@ -98,7 +100,7 @@ class WebSearchGalleryController: ViewController {
self.presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 }
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: GalleryController.darkNavigationTheme, strings: NavigationBarStrings(presentationStrings: self.presentationData.strings)))
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: WebSearchGalleryController.navigationTheme, strings: NavigationBarStrings(presentationStrings: self.presentationData.strings)))
self.controllerInteraction = WebSearchGalleryControllerInteraction(dismiss: { [weak self] animated in
self?.dismiss(forceAway: false)