Merge commit '04b200586fab1692e004103da90e9f2f34079405'
# Conflicts: # TelegramUI/NotificationsAndSounds.swift # TelegramUI/StickerPreviewPeekContent.swift
BIN
Images.xcassets/Chat List/Tabs/IconCallsHW.imageset/Calls@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 917 B |
BIN
Images.xcassets/Chat List/Tabs/IconCallsHW.imageset/Calls@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
22
Images.xcassets/Chat List/Tabs/IconCallsHW.imageset/Contents.json
vendored
Normal 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"
|
||||
}
|
||||
}
|
||||
BIN
Images.xcassets/Chat List/Tabs/IconChatsHW.imageset/Chats@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 822 B |
BIN
Images.xcassets/Chat List/Tabs/IconChatsHW.imageset/Chats@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
22
Images.xcassets/Chat List/Tabs/IconChatsHW.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Chats@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Chats@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
Images.xcassets/Chat List/Tabs/IconContactsHW.imageset/Contacts@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 918 B |
BIN
Images.xcassets/Chat List/Tabs/IconContactsHW.imageset/Contacts@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
22
Images.xcassets/Chat List/Tabs/IconContactsHW.imageset/Contents.json
vendored
Normal 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"
|
||||
}
|
||||
}
|
||||
22
Images.xcassets/Chat List/Tabs/IconSettingsHW.imageset/Contents.json
vendored
Normal 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"
|
||||
}
|
||||
}
|
||||
BIN
Images.xcassets/Chat List/Tabs/IconSettingsHW.imageset/Settings@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
Images.xcassets/Chat List/Tabs/IconSettingsHW.imageset/Settings@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
@ -48,10 +48,17 @@ 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?
|
||||
if (useSpecialTabBarIcons()) {
|
||||
icon = UIImage(bundleImageName: "Chat List/Tabs/IconCallsHW")
|
||||
} else {
|
||||
icon = UIImage(bundleImageName: "Chat List/Tabs/IconCalls")
|
||||
}
|
||||
|
||||
self.tabBarItem.title = self.presentationData.strings.Calls_TabTitle
|
||||
self.tabBarItem.image = UIImage(bundleImageName: "Chat List/Tabs/IconCalls")
|
||||
self.tabBarItem.selectedImage = UIImage(bundleImageName: "Chat List/Tabs/IconCalls")
|
||||
self.tabBarItem.image = icon
|
||||
self.tabBarItem.selectedImage = icon
|
||||
}
|
||||
|
||||
self.segmentedTitleView.indexUpdated = { [weak self] index in
|
||||
|
||||
@ -4,27 +4,34 @@ import SwiftSignalKit
|
||||
import Display
|
||||
import TelegramCore
|
||||
|
||||
private let tabImageNone = UIImage(bundleImageName: "Chat List/Tabs/IconChats")?.precomposed()
|
||||
private let tabImageUp = tabImageNone.flatMap({ image in
|
||||
return generateImage(image.size, contextGenerator: { size, context in
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.draw(image.cgImage!, in: CGRect(origin: CGPoint(), size: size))
|
||||
context.setBlendMode(.copy)
|
||||
context.setFillColor(UIColor.clear.cgColor)
|
||||
context.translateBy(x: 0.0, y: 7.0)
|
||||
let _ = try? drawSvgPath(context, path: "M14.6557321,9.04533883 C14.9642504,8.81236784 15.4032142,8.87361104 15.6361852,9.18212936 C15.8691562,9.49064768 15.807913,9.9296115 15.4993947,10.1625825 L11.612306,13.0978342 C11.3601561,13.2882398 11.0117095,13.2861239 10.7618904,13.0926701 L6.97141581,10.1574184 C6.66574952,9.92071787 6.60984175,9.48104267 6.84654232,9.17537638 C7.08324289,8.86971009 7.5229181,8.81380232 7.82858438,9.05050289 L11.1958257,11.658013 L14.6557321,9.04533883 Z ")
|
||||
})
|
||||
})
|
||||
private let tabImageUnread = tabImageNone.flatMap({ image in
|
||||
return generateImage(image.size, contextGenerator: { size, context in
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.draw(image.cgImage!, in: CGRect(origin: CGPoint(), size: size))
|
||||
context.setBlendMode(.copy)
|
||||
context.setFillColor(UIColor.clear.cgColor)
|
||||
context.translateBy(x: 0.0, y: 7.0)
|
||||
let _ = try? drawSvgPath(context, path: "M14.6557321,12.0977948 L11.1958257,9.48512064 L7.82858438,12.0926307 C7.5229181,12.3293313 7.08324289,12.2734235 6.84654232,11.9677572 C6.60984175,11.662091 6.66574952,11.2224158 6.97141581,10.9857152 L10.7618904,8.05046348 C11.0117095,7.85700968 11.3601561,7.85489378 11.612306,8.04529942 L15.4993947,10.9805511 C15.807913,11.2135221 15.8691562,11.6524859 15.6361852,11.9610043 C15.4032142,12.2695226 14.9642504,12.3307658 14.6557321,12.0977948 Z ")
|
||||
})
|
||||
})
|
||||
//private let tabImageNone = UIImage(bundleImageName: "Chat List/Tabs/IconChats")?.precomposed()
|
||||
//private let tabImageUp = tabImageNone.flatMap({ image in
|
||||
// return generateImage(image.size, contextGenerator: { size, context in
|
||||
// context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
// context.draw(image.cgImage!, in: CGRect(origin: CGPoint(), size: size))
|
||||
// context.setBlendMode(.copy)
|
||||
// context.setFillColor(UIColor.clear.cgColor)
|
||||
// context.translateBy(x: 0.0, y: 7.0)
|
||||
// let _ = try? drawSvgPath(context, path: "M14.6557321,9.04533883 C14.9642504,8.81236784 15.4032142,8.87361104 15.6361852,9.18212936 C15.8691562,9.49064768 15.807913,9.9296115 15.4993947,10.1625825 L11.612306,13.0978342 C11.3601561,13.2882398 11.0117095,13.2861239 10.7618904,13.0926701 L6.97141581,10.1574184 C6.66574952,9.92071787 6.60984175,9.48104267 6.84654232,9.17537638 C7.08324289,8.86971009 7.5229181,8.81380232 7.82858438,9.05050289 L11.1958257,11.658013 L14.6557321,9.04533883 Z ")
|
||||
// })
|
||||
//})
|
||||
//private let tabImageUnread = tabImageNone.flatMap({ image in
|
||||
// return generateImage(image.size, contextGenerator: { size, context in
|
||||
// context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
// context.draw(image.cgImage!, in: CGRect(origin: CGPoint(), size: size))
|
||||
// context.setBlendMode(.copy)
|
||||
// context.setFillColor(UIColor.clear.cgColor)
|
||||
// context.translateBy(x: 0.0, y: 7.0)
|
||||
// let _ = try? drawSvgPath(context, path: "M14.6557321,12.0977948 L11.1958257,9.48512064 L7.82858438,12.0926307 C7.5229181,12.3293313 7.08324289,12.2734235 6.84654232,11.9677572 C6.60984175,11.662091 6.66574952,11.2224158 6.97141581,10.9857152 L10.7618904,8.05046348 C11.0117095,7.85700968 11.3601561,7.85489378 11.612306,8.04529942 L15.4993947,10.9805511 C15.807913,11.2135221 15.8691562,11.6524859 15.6361852,11.9610043 C15.4032142,12.2695226 14.9642504,12.3307658 14.6557321,12.0977948 Z ")
|
||||
// })
|
||||
//})
|
||||
|
||||
public func useSpecialTabBarIcons() -> Bool {
|
||||
let calendar = Calendar(identifier: .gregorian)
|
||||
let now = calendar.dateComponents([.year, .month, .day], from: Date())
|
||||
let target = calendar.dateComponents([.year, .month, .day], from: Date(timeIntervalSince1970: 1540987200))
|
||||
return now.day == target.day && now.month == target.month && now.year == target.year
|
||||
}
|
||||
|
||||
public class ChatListController: TelegramController, KeyShortcutResponder, UIViewControllerPreviewingDelegate {
|
||||
private var validLayout: ContainerViewLayout?
|
||||
@ -78,8 +85,16 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
|
||||
self.titleView.title = NetworkStatusTitle(text: self.presentationData.strings.DialogList_Title, activity: false, hasProxy: false, connectsViaProxy: false, isPasscodeSet: false, isManuallyLocked: false)
|
||||
self.navigationItem.titleView = self.titleView
|
||||
self.tabBarItem.title = self.presentationData.strings.DialogList_Title
|
||||
self.tabBarItem.image = tabImageNone
|
||||
self.tabBarItem.selectedImage = tabImageNone
|
||||
|
||||
let icon: UIImage?
|
||||
if (useSpecialTabBarIcons()) {
|
||||
icon = UIImage(bundleImageName: "Chat List/Tabs/IconChatsHW")
|
||||
} else {
|
||||
icon = UIImage(bundleImageName: "Chat List/Tabs/IconChats")
|
||||
}
|
||||
|
||||
self.tabBarItem.image = icon
|
||||
self.tabBarItem.selectedImage = icon
|
||||
|
||||
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Edit, style: .plain, target: self, action: #selector(self.editPressed))
|
||||
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationComposeIcon(self.presentationData.theme), style: .plain, target: self, action: #selector(self.composePressed))
|
||||
|
||||
@ -121,7 +121,14 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
||||
|
||||
let displaySize = CGSize(width: 212.0, height: 212.0)
|
||||
|
||||
let (videoLayout, videoApply) = makeVideoLayout(ChatMessageBubbleContentItem(account: item.account, controllerInteraction: item.controllerInteraction, message: item.message, read: item.read, presentationData: item.presentationData, associatedData: item.associatedData), params.width - params.leftInset - params.rightInset - avatarInset, displaySize, .free, true)
|
||||
var automaticDownload = true
|
||||
for media in item.message.media {
|
||||
if let file = media as? TelegramMediaFile {
|
||||
automaticDownload = shouldDownloadMediaAutomatically(settings: item.controllerInteraction.automaticMediaDownloadSettings, peerType: item.associatedData.automaticDownloadPeerType, networkType: item.associatedData.automaticDownloadNetworkType, media: file)
|
||||
}
|
||||
}
|
||||
|
||||
let (videoLayout, videoApply) = makeVideoLayout(ChatMessageBubbleContentItem(account: item.account, controllerInteraction: item.controllerInteraction, message: item.message, read: item.read, presentationData: item.presentationData, associatedData: item.associatedData), params.width - params.leftInset - params.rightInset - avatarInset, displaySize, .free, automaticDownload)
|
||||
|
||||
let videoFrame = CGRect(origin: CGPoint(x: (incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + avatarInset + layoutConstants.bubble.contentInsets.left) : (params.width - params.rightInset - videoLayout.contentSize.width - layoutConstants.bubble.edgeInset - layoutConstants.bubble.contentInsets.left)), y: 0.0), size: videoLayout.contentSize)
|
||||
|
||||
|
||||
@ -34,8 +34,16 @@ public class ContactsController: ViewController {
|
||||
|
||||
self.title = self.presentationData.strings.Contacts_Title
|
||||
self.tabBarItem.title = self.presentationData.strings.Contacts_Title
|
||||
self.tabBarItem.image = UIImage(bundleImageName: "Chat List/Tabs/IconContacts")
|
||||
self.tabBarItem.selectedImage = UIImage(bundleImageName: "Chat List/Tabs/IconContacts")
|
||||
|
||||
let icon: UIImage?
|
||||
if (useSpecialTabBarIcons()) {
|
||||
icon = UIImage(bundleImageName: "Chat List/Tabs/IconContactsHW")
|
||||
} else {
|
||||
icon = UIImage(bundleImageName: "Chat List/Tabs/IconContacts")
|
||||
}
|
||||
|
||||
self.tabBarItem.image = icon
|
||||
self.tabBarItem.selectedImage = icon
|
||||
|
||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
||||
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationAddIcon(self.presentationData.theme), style: .plain, target: self, action: #selector(self.addPressed))
|
||||
|
||||
@ -344,7 +344,7 @@ func editSettingsController(account: Account, currentName: ItemListAvatarAndName
|
||||
}
|
||||
var updateBioSignal: Signal<Void, NoError> = .complete()
|
||||
if let updateBio = updateBio {
|
||||
updateBioSignal = updateAbout(account: account, about: updateBio.isEmpty ? nil : updateBio)
|
||||
updateBioSignal = updateAbout(account: account, about: updateBio)
|
||||
|> `catch` { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
@ -385,9 +385,7 @@ func editSettingsController(account: Account, currentName: ItemListAvatarAndName
|
||||
actionsDisposable.dispose()
|
||||
}
|
||||
|
||||
let controller = ItemListController(account: account, state: signal, tabBarItem: (account.applicationContext as! TelegramApplicationContext).presentationData |> map { presentationData in
|
||||
return ItemListControllerTabBarItem(title: presentationData.strings.EditProfile_Title, image: PresentationResourcesRootController.tabSettingsIcon(presentationData.theme), selectedImage: PresentationResourcesRootController.tabSettingsSelectedIcon(presentationData.theme))
|
||||
})
|
||||
let controller = ItemListController(account: account, state: signal, tabBarItem: nil)
|
||||
pushControllerImpl = { [weak controller] value in
|
||||
(controller?.navigationController as? NavigationController)?.pushViewController(value)
|
||||
}
|
||||
|
||||
@ -200,6 +200,13 @@ public enum NotificationExceptionMode : Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
var isEmpty: Bool {
|
||||
switch self {
|
||||
case let .users(value), let .groups(value):
|
||||
return value.isEmpty
|
||||
}
|
||||
}
|
||||
|
||||
case users([PeerId : NotificationExceptionWrapper])
|
||||
case groups([PeerId : NotificationExceptionWrapper])
|
||||
|
||||
@ -439,6 +446,12 @@ public func notificationExceptionsController(account: Account, mode: Notificatio
|
||||
})
|
||||
presentControllerImpl?(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||
actionSheet?.dismissAnimated()
|
||||
}),
|
||||
ActionSheetButtonItem(title: presentationData.strings.Notifications_ExceptionsResetToDefaults, color: .destructive, action: { [weak actionSheet] in
|
||||
|
||||
updatePeerNotificationInterval(peerId, nil)
|
||||
updatePeerSound(peerId, .default)
|
||||
actionSheet?.dismissAnimated()
|
||||
})
|
||||
]), ActionSheetItemGroup(items: [
|
||||
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, action: { [weak actionSheet] in
|
||||
@ -505,6 +518,15 @@ public func notificationExceptionsController(account: Account, mode: Notificatio
|
||||
actionSheet?.dismissAnimated()
|
||||
}))
|
||||
|
||||
if settings.muteState != .default || settings.messageSound != .default {
|
||||
items.append(ActionSheetButtonItem(title: presentationData.strings.Notifications_ExceptionsResetToDefaults, color: .destructive, action: { [weak actionSheet] in
|
||||
|
||||
updatePeerNotificationInterval(peerId, nil)
|
||||
updatePeerSound(peerId, .default)
|
||||
actionSheet?.dismissAnimated()
|
||||
}))
|
||||
}
|
||||
|
||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
|
||||
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, action: { [weak actionSheet] in
|
||||
actionSheet?.dismissAnimated()
|
||||
@ -544,7 +566,7 @@ public func notificationExceptionsController(account: Account, mode: Notificatio
|
||||
|
||||
|
||||
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.Notifications_ExceptionsTitle), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: nil)
|
||||
let listState = ItemListNodeState(entries: notificationsExceptionEntries(presentationData: presentationData, peers: peers, state: state), style: .plain, searchItem: nil)
|
||||
let listState = ItemListNodeState(entries: notificationsExceptionEntries(presentationData: presentationData, peers: peers, state: state), style: .blocks, searchItem: nil)
|
||||
|
||||
return (controllerState, (listState, arguments))
|
||||
}
|
||||
@ -771,8 +793,6 @@ private final class NotificationExceptionsControllerNode: ASDisplayNode {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
self.readyValue.set(contentNode.ready)
|
||||
}
|
||||
|
||||
|
||||
@ -423,14 +423,19 @@ private func notificationsAndSoundsEntries(globalSettings: GlobalNotificationSet
|
||||
entries.append(.messageAlerts(presentationData.theme, presentationData.strings.Notifications_MessageNotificationsAlert, globalSettings.privateChats.enabled))
|
||||
entries.append(.messagePreviews(presentationData.theme, presentationData.strings.Notifications_MessageNotificationsPreview, globalSettings.privateChats.displayPreviews))
|
||||
entries.append(.messageSound(presentationData.theme, presentationData.strings.Notifications_MessageNotificationsSound, localizedPeerNotificationSoundString(strings: presentationData.strings, sound: filteredGlobalSound(globalSettings.privateChats.sound)), filteredGlobalSound(globalSettings.privateChats.sound)))
|
||||
//entries.append(.userExceptions(presentationData.theme, presentationData.strings, presentationData.strings.Notifications_MessageNotificationsExceptions, exceptions.0))
|
||||
if !exceptions.0.isEmpty {
|
||||
// entries.append(.userExceptions(presentationData.theme, presentationData.strings, presentationData.strings.Notifications_MessageNotificationsExceptions, exceptions.0))
|
||||
}
|
||||
entries.append(.messageNotice(presentationData.theme, presentationData.strings.Notifications_MessageNotificationsHelp))
|
||||
|
||||
entries.append(.groupHeader(presentationData.theme, presentationData.strings.Notifications_GroupNotifications))
|
||||
entries.append(.groupAlerts(presentationData.theme, presentationData.strings.Notifications_MessageNotificationsAlert, globalSettings.groupChats.enabled))
|
||||
entries.append(.groupPreviews(presentationData.theme, presentationData.strings.Notifications_MessageNotificationsPreview, globalSettings.groupChats.displayPreviews))
|
||||
entries.append(.groupSound(presentationData.theme, presentationData.strings.Notifications_MessageNotificationsSound, localizedPeerNotificationSoundString(strings: presentationData.strings, sound: filteredGlobalSound(globalSettings.groupChats.sound)), filteredGlobalSound(globalSettings.groupChats.sound)))
|
||||
entries.append(.groupExceptions(presentationData.theme, presentationData.strings, presentationData.strings.Notifications_MessageNotificationsExceptions, exceptions.1))
|
||||
if !exceptions.1.isEmpty {
|
||||
// entries.append(.groupExceptions(presentationData.theme, presentationData.strings, presentationData.strings.Notifications_MessageNotificationsExceptions, exceptions.1))
|
||||
}
|
||||
|
||||
entries.append(.groupNotice(presentationData.theme, presentationData.strings.Notifications_GroupNotificationsHelp))
|
||||
|
||||
entries.append(.inAppHeader(presentationData.theme, presentationData.strings.Notifications_InAppNotifications))
|
||||
@ -584,7 +589,8 @@ public func notificationsAndSoundsController(account: Account) -> ViewController
|
||||
var groups: [PeerId : NotificationExceptionWrapper] = [:]
|
||||
|
||||
for (key, value) in allSettings {
|
||||
if let value = value as? TelegramPeerNotificationSettings {
|
||||
let peer = transaction.getPeer(key)
|
||||
if let value = value as? TelegramPeerNotificationSettings, let peer = peer, !peer.displayTitle.isEmpty, peer.id != account.peerId {
|
||||
switch value.muteState {
|
||||
case .default:
|
||||
switch value.messageSound {
|
||||
|
||||
@ -837,6 +837,11 @@ public func chatMessageVideoThumbnail(account: Account, fileReference: FileMedia
|
||||
fittedSize.height = arguments.boundingSize.height
|
||||
}
|
||||
|
||||
if arguments.intrinsicInsets != UIEdgeInsets.zero {
|
||||
fittedSize.width -= arguments.intrinsicInsets.left + arguments.intrinsicInsets.right
|
||||
fittedSize.height -= arguments.intrinsicInsets.top + arguments.intrinsicInsets.bottom
|
||||
}
|
||||
|
||||
let fittedRect = CGRect(origin: CGPoint(x: drawingRect.origin.x + (drawingRect.size.width - fittedSize.width) / 2.0, y: drawingRect.origin.y + (drawingRect.size.height - fittedSize.height) / 2.0), size: fittedSize)
|
||||
|
||||
var fullSizeImage: CGImage?
|
||||
|
||||
@ -34,43 +34,7 @@ struct PresentationResourcesRootController {
|
||||
generateIndefiniteActivityIndicatorImage(color: theme.rootController.navigationBar.accentTextColor)
|
||||
})
|
||||
}
|
||||
|
||||
static func tabContactsIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.rootTabContactsIcon.rawValue, { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/Tabs/IconContacts"), color: theme.rootController.tabBar.iconColor)
|
||||
})
|
||||
}
|
||||
|
||||
static func tabContactsSelectedIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.rootTabContactsSelectedIcon.rawValue, { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/Tabs/IconContacts"), color: theme.rootController.tabBar.selectedIconColor)
|
||||
})
|
||||
}
|
||||
|
||||
static func tabChatsIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.rootTabChatsIcon.rawValue, { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/Tabs/IconChats"), color: theme.rootController.tabBar.iconColor)
|
||||
})
|
||||
}
|
||||
|
||||
static func tabChatsSelectedIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.rootTabChatsSelectedIcon.rawValue, { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/Tabs/IconChats"), color: theme.rootController.tabBar.selectedIconColor)
|
||||
})
|
||||
}
|
||||
|
||||
static func tabSettingsIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.rootTabSettingsIcon.rawValue, { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/Tabs/IconSettings"), color: theme.rootController.tabBar.iconColor)
|
||||
})
|
||||
}
|
||||
|
||||
static func tabSettingsSelectedIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.rootTabSettingsSelectedIcon.rawValue, { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/Tabs/IconSettings"), color: theme.rootController.tabBar.selectedIconColor)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
static func navigationComposeIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.navigationComposeIcon.rawValue, { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/ComposeIcon"), color: theme.rootController.navigationBar.accentTextColor)
|
||||
|
||||
@ -1537,6 +1537,7 @@ public final class PresentationStrings {
|
||||
}
|
||||
public let Conversation_ClearPrivateHistory: String
|
||||
public let Conversation_ContextMenuShare: String
|
||||
public let Notifications_ExceptionsResetToDefaults: String
|
||||
public let Notifications_ExceptionsNone: String
|
||||
private let _Time_MonthOfYear_m6: String
|
||||
private let _Time_MonthOfYear_m6_r: [(Int, NSRange)]
|
||||
@ -6588,6 +6589,7 @@ public final class PresentationStrings {
|
||||
self._LOCKED_MESSAGE_r = extractArgumentRanges(self._LOCKED_MESSAGE)
|
||||
self.Conversation_ClearPrivateHistory = getValue(dict, "Conversation.ClearPrivateHistory")
|
||||
self.Conversation_ContextMenuShare = getValue(dict, "Conversation.ContextMenuShare")
|
||||
self.Notifications_ExceptionsResetToDefaults = getValue(dict, "Notifications.ExceptionsResetToDefaults")
|
||||
self.Notifications_ExceptionsNone = getValue(dict, "Notifications.ExceptionsNone")
|
||||
self._Time_MonthOfYear_m6 = getValue(dict, "Time.MonthOfYear_m6")
|
||||
self._Time_MonthOfYear_m6_r = extractArgumentRanges(self._Time_MonthOfYear_m6)
|
||||
|
||||
@ -714,8 +714,15 @@ public func settingsController(account: Account, accountManager: AccountManager)
|
||||
actionsDisposable.dispose()
|
||||
}
|
||||
|
||||
let icon: UIImage?
|
||||
if (useSpecialTabBarIcons()) {
|
||||
icon = UIImage(bundleImageName: "Chat List/Tabs/IconSettingsHW")
|
||||
} else {
|
||||
icon = UIImage(bundleImageName: "Chat List/Tabs/IconSettings")
|
||||
}
|
||||
|
||||
let controller = ItemListController(account: account, state: signal, tabBarItem: (account.applicationContext as! TelegramApplicationContext).presentationData |> map { presentationData in
|
||||
return ItemListControllerTabBarItem(title: presentationData.strings.Settings_Title, image: PresentationResourcesRootController.tabSettingsIcon(presentationData.theme), selectedImage: PresentationResourcesRootController.tabSettingsSelectedIcon(presentationData.theme))
|
||||
return ItemListControllerTabBarItem(title: presentationData.strings.Settings_Title, image: icon, selectedImage: icon)
|
||||
})
|
||||
pushControllerImpl = { [weak controller] value in
|
||||
(controller?.navigationController as? NavigationController)?.replaceAllButRootController(value, animated: true)
|
||||
|
||||
@ -373,7 +373,7 @@ func storageUsageController(account: Account) -> ViewController {
|
||||
if otherSize.1 != 0 {
|
||||
totalSize += otherSize.1
|
||||
let index = itemIndex
|
||||
items.append(ActionSheetCheckboxItem(title: presentationData.strings.Localization_LanguageOther, label: dataSizeString(Int(otherSize.1)), value: true, action: { value in
|
||||
items.append(ActionSheetCheckboxItem(title: presentationData.strings.Localization_LanguageOther, label: dataSizeString(otherSize.1), value: true, action: { value in
|
||||
toggleCheck(nil, index)
|
||||
}))
|
||||
itemIndex += 1
|
||||
@ -524,17 +524,14 @@ func storageUsageController(account: Account) -> ViewController {
|
||||
items.append(ActionSheetButtonItem(title: presentationData.strings.Cache_Clear("\(dataSizeString(totalSize))").0, action: {
|
||||
if let statsPromise = statsPromise {
|
||||
let clearCategories = sizeIndex.keys.filter({ sizeIndex[$0]!.0 })
|
||||
//var clearSize: Int64 = 0
|
||||
|
||||
var clearMediaIds = Set<MediaId>()
|
||||
|
||||
var media = stats.media
|
||||
if var categories = media[peerId] {
|
||||
for category in clearCategories {
|
||||
if let contents = categories[category] {
|
||||
for (mediaId, size) in contents {
|
||||
for (mediaId, _) in contents {
|
||||
clearMediaIds.insert(mediaId)
|
||||
//clearSize += size
|
||||
}
|
||||
}
|
||||
categories.removeValue(forKey: category)
|
||||
|
||||
@ -3,15 +3,29 @@ import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
public struct WatchRunningTasks: Equatable {
|
||||
public let running: Bool
|
||||
public let version: Int32
|
||||
|
||||
public init(running: Bool, version: Int32) {
|
||||
self.running = running
|
||||
self.version = version
|
||||
}
|
||||
|
||||
public static func ==(lhs: WatchRunningTasks, rhs: WatchRunningTasks) -> Bool {
|
||||
return lhs.running == rhs.running && lhs.version == rhs.version
|
||||
}
|
||||
}
|
||||
|
||||
public final class WatchManagerArguments {
|
||||
public let appInstalled: Signal<Bool, NoError>
|
||||
public let navigateToMessageRequested: Signal<MessageId, NoError>
|
||||
public let runningRequests: Signal<Bool, NoError>
|
||||
public let runningTasks: Signal<WatchRunningTasks?, NoError>
|
||||
|
||||
public init(appInstalled: Signal<Bool, NoError>, navigateToMessageRequested: Signal<MessageId, NoError>, runningRequests: Signal<Bool, NoError>) {
|
||||
public init(appInstalled: Signal<Bool, NoError>, navigateToMessageRequested: Signal<MessageId, NoError>, runningTasks: Signal<WatchRunningTasks?, NoError>) {
|
||||
self.appInstalled = appInstalled
|
||||
self.navigateToMessageRequested = navigateToMessageRequested
|
||||
self.runningRequests = runningRequests
|
||||
self.runningTasks = runningTasks
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +44,7 @@ public final class WatchManager {
|
||||
return self.arguments?.navigateToMessageRequested ?? .never()
|
||||
}
|
||||
|
||||
public var runningRequests: Signal<Bool, NoError> {
|
||||
return self.arguments?.runningRequests ?? .single(false)
|
||||
public var runningTasks: Signal<WatchRunningTasks?, NoError> {
|
||||
return self.arguments?.runningTasks ?? .single(nil)
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ private enum WatchSettingsControllerEntry: ItemListNodeEntry {
|
||||
private func watchSettingsControllerEntries(presentationData: PresentationData, customPresets: [String : String]) -> [WatchSettingsControllerEntry] {
|
||||
var entries: [WatchSettingsControllerEntry] = []
|
||||
|
||||
let defaultSuggestions : [(Int32, String, String)] = [
|
||||
let defaultSuggestions: [(Int32, String, String)] = [
|
||||
(0, "OK", presentationData.strings.Watch_Suggestion_OK),
|
||||
(1, "Thanks", presentationData.strings.Watch_Suggestion_Thanks),
|
||||
(2, "WhatsUp", presentationData.strings.Watch_Suggestion_WhatsUp),
|
||||
|
||||