From 2fadeebbfa53a2cc046c3af27bf967afc28d4baf Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sat, 21 Mar 2020 23:11:21 +0400 Subject: [PATCH 1/6] Temp --- Telegram/BUILD | 57 ++++++++++++++ .../NotificationServiceNext.swift | 8 ++ Telegram/telegram_info_plist.bzl | 77 ------------------- 3 files changed, 65 insertions(+), 77 deletions(-) create mode 100644 Telegram/NotificationServiceNext/NotificationServiceNext.swift delete mode 100644 Telegram/telegram_info_plist.bzl diff --git a/Telegram/BUILD b/Telegram/BUILD index e365cc9c3a..50b2dcff7d 100644 --- a/Telegram/BUILD +++ b/Telegram/BUILD @@ -624,6 +624,62 @@ ios_extension( ], ) +swift_library( + name = "NotificationServiceExtensionLib", + module_name = "NotificationServiceExtensionLib", + srcs = glob([ + "NotificationServiceNext/**/*.swift", + ]), + deps = [ + ], +) + +plist_fragment( + name = "NotificationServiceInfoPlist", + extension = "plist", + template = + """ + CFBundleDevelopmentRegion + en + CFBundleIdentifier + {telegram_bundle_id}.NotificationService + CFBundleName + Telegram + CFBundlePackageType + XPC! + NSExtension + + NSExtensionPointIdentifier + com.apple.usernotifications.service + NSExtensionPrincipalClass + NotificationService + + """.format( + telegram_bundle_id = telegram_bundle_id, + ) +) + +ios_extension( + name = "NotificationServiceExtension", + bundle_id = "{telegram_bundle_id}.NotificationService".format( + telegram_bundle_id = telegram_bundle_id, + ), + families = [ + "iphone", + "ipad", + ], + infoplists = [ + ":NotificationServiceInfoPlist", + ":VersionInfoPlist", + ":AppNameInfoPlist", + ], + minimum_os_version = "10.0", + provisioning_profile = "//build-input/data/provisioning-profiles:NotificationService.mobileprovision", + deps = [":NotificationServiceExtensionLib"], + frameworks = [ + ], +) + plist_fragment( name = "TelegramInfoPlist", extension = "plist", @@ -813,6 +869,7 @@ ios_application( ], extensions = [ ":ShareExtension", + ":NotificationServiceExtension", ], watch_application = ":TelegramWatchApp", deps = [ diff --git a/Telegram/NotificationServiceNext/NotificationServiceNext.swift b/Telegram/NotificationServiceNext/NotificationServiceNext.swift new file mode 100644 index 0000000000..cbf5c7df64 --- /dev/null +++ b/Telegram/NotificationServiceNext/NotificationServiceNext.swift @@ -0,0 +1,8 @@ +import Foundation +import UserNotifications + +@available(iOSApplicationExtension 10.0, *) +@objc(NotificationService) +public final class NotificationService: UNNotificationServiceExtension { + +} diff --git a/Telegram/telegram_info_plist.bzl b/Telegram/telegram_info_plist.bzl deleted file mode 100644 index 6e38968e65..0000000000 --- a/Telegram/telegram_info_plist.bzl +++ /dev/null @@ -1,77 +0,0 @@ -load("//build-system:defines.bzl", - "string_value", -) - -def _telegram_info_plist(ctx): - output = ctx.outputs.out - - plist_string = """ - - - - - CFBundleShortVersionString - {app_version} - CFBundleVersion - {build_number} - CFBundleURLTypes - - - CFBundleTypeRole - Viewer - CFBundleURLName - {bundle_id} - CFBundleURLSchemes - - telegram - - - - CFBundleTypeRole - Viewer - CFBundleURLName - {bundle_id}.ton - CFBundleURLSchemes - - ton - - - - CFBundleTypeRole - Viewer - CFBundleURLName - {app_name}.compatibility - CFBundleURLSchemes - - {url_scheme} - - - - - - """.format( - app_version = string_value(ctx, ctx.attr.app_version_define), - build_number = string_value(ctx, ctx.attr.build_number_define), - bundle_id = string_value(ctx, ctx.attr.bundle_id_define), - app_name = ctx.attr.app_name, - url_scheme = ctx.attr.url_scheme, - ) - - ctx.actions.write( - output = output, - content = plist_string, - ) - -telegram_info_plist = rule( - implementation = _telegram_info_plist, - attrs = { - "app_name": attr.string(mandatory = True), - "url_scheme": attr.string(mandatory = True), - "bundle_id_define": attr.string(mandatory = True), - "app_version_define": attr.string(mandatory = True), - "build_number_define": attr.string(mandatory = True), - }, - outputs = { - "out": "%{name}.plist" - }, -) From 45a17328071c139cc61e00a7685088706f146ba5 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Tue, 24 Mar 2020 17:03:15 +0400 Subject: [PATCH 2/6] Don't display the folders tooltip more than once if the user has folders --- submodules/ChatListUI/Sources/ChatListController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 0a7f9afef0..2a288463ba 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -1187,6 +1187,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController, let text: String if hasFilters { text = strongSelf.presentationData.strings.ChatList_TabIconFoldersTooltipNonEmptyFolders + let _ = markChatListFeaturedFiltersAsSeen(postbox: strongSelf.context.account.postbox).start() } else { text = strongSelf.presentationData.strings.ChatList_TabIconFoldersTooltipEmptyFolders } From 9b66b96d87d50f6ffef9734786b4030a4e204287 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Tue, 24 Mar 2020 17:03:56 +0400 Subject: [PATCH 3/6] Don't automatically dismiss phone calls if DnD is enabled --- submodules/TelegramCallsUI/Sources/PresentationCall.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/TelegramCallsUI/Sources/PresentationCall.swift b/submodules/TelegramCallsUI/Sources/PresentationCall.swift index 5fcfaefa4a..919d0fd189 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCall.swift @@ -418,9 +418,9 @@ public final class PresentationCallImpl: PresentationCall { if error.domain == "com.apple.CallKit.error.incomingcall" && (error.code == -3 || error.code == 3) { Logger.shared.log("PresentationCall", "reportIncomingCall device in DND mode") Queue.mainQueue().async { - if let strongSelf = self { + /*if let strongSelf = self { strongSelf.callSessionManager.drop(internalId: strongSelf.internalId, reason: .busy, debugLog: .single(nil)) - } + }*/ } } else { Logger.shared.log("PresentationCall", "reportIncomingCall error \(error)") From ca4001a29f6cff8f7658fd8c9842b14ec310446f Mon Sep 17 00:00:00 2001 From: Ali <> Date: Tue, 24 Mar 2020 17:04:05 +0400 Subject: [PATCH 4/6] Fix warnings --- .../Sources/PeerInfo/PeerInfoScreen.swift | 64 +++++-------------- 1 file changed, 17 insertions(+), 47 deletions(-) diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 02941f260f..1053f670e8 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -668,7 +668,6 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese let ItemAdmins = 3 let ItemMembers = 4 let ItemBanned = 5 - let ItemReport = 6 let ItemLocationHeader = 7 let ItemLocation = 8 @@ -747,11 +746,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese if let peer = data.peer, let members = data.members, case let .shortList(_, memberList) = members { for member in memberList { - var presence = member.presence let isAccountPeer = member.id == context.account.peerId - if isAccountPeer { - presence = TelegramUserPresence(status: .present(until: Int32.max - 1), lastActivity: 0) - } items[.peerMembers]!.append(PeerInfoScreenMemberItem(id: member.id, context: context, enclosingPeer: peer, member: member, action: isAccountPeer ? nil : { action in switch action { case .open: @@ -817,7 +812,7 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr } if let data = data { - if let user = data.peer as? TelegramUser { + if let _ = data.peer as? TelegramUser { let ItemDelete = 0 if data.isContact { items[.peerSettings]!.append(PeerInfoScreenActionItem(id: ItemDelete, text: presentationData.strings.UserInfo_DeleteContact, color: .destructive, action: { @@ -846,7 +841,7 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr if channel.flags.contains(.isCreator) || (channel.adminRights != nil && channel.hasPermission(.pinMessages)) { let discussionGroupTitle: String - if let cachedData = data.cachedData as? CachedChannelData { + if let _ = data.cachedData as? CachedChannelData { if let peer = data.linkedDiscussionPeer { if let addressName = peer.addressName, !addressName.isEmpty { discussionGroupTitle = "@\(addressName)" @@ -1214,7 +1209,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD guard let strongSelf = self else { return } - let items = (chatAvailableMessageActionsImpl(postbox: strongSelf.context.account.postbox, accountPeerId: strongSelf.context.account.peerId, messageIds: [message.id]) + let _ = (chatAvailableMessageActionsImpl(postbox: strongSelf.context.account.postbox, accountPeerId: strongSelf.context.account.peerId, messageIds: [message.id]) |> deliverOnMainQueue).start(next: { actions in var messageIds = Set() messageIds.insert(message.id) @@ -1660,7 +1655,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD strongSelf.hapticFeedback?.tap() let entriesPromise = Promise<[AvatarGalleryEntry]>(entries) - let galleryController = AvatarGalleryController(context: strongSelf.context, peer: peer, sourceHasRoundCorners: !strongSelf.headerNode.isAvatarExpanded, remoteEntries: entriesPromise, centralEntryIndex: centralEntry.flatMap { entries.index(of: $0) }, replaceRootController: { controller, ready in + let galleryController = AvatarGalleryController(context: strongSelf.context, peer: peer, sourceHasRoundCorners: !strongSelf.headerNode.isAvatarExpanded, remoteEntries: entriesPromise, centralEntryIndex: centralEntry.flatMap { entries.firstIndex(of: $0) }, replaceRootController: { controller, ready in }) strongSelf.hiddenAvatarRepresentationDisposable.set((galleryController.hiddenMedia |> deliverOnMainQueue).start(next: { entry in self?.headerNode.updateAvatarIsHidden(entry: entry) @@ -2012,7 +2007,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD } } - if let (layout, navigationHeight) = self.validLayout { + if let (_, navigationHeight) = self.validLayout { let contentOffset = self.scrollNode.view.contentOffset let paneAreaExpansionFinalPoint: CGFloat = self.paneContainerNode.frame.minY - navigationHeight if contentOffset.y < paneAreaExpansionFinalPoint - CGFloat.ulpOfOne { @@ -2124,8 +2119,6 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD if let navigationController = self.controller?.navigationController as? NavigationController { self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: self.context, chatLocation: .peer(peerId), botStart: startPayload)) } - default: - break } } @@ -2158,6 +2151,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD let muteValues: [Int32] = [ 1 * 60 * 60, 24 * 60 * 60, + 2 * 24 * 60 * 60, Int32.max ] for delay in muteValues { @@ -2522,12 +2516,6 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD guard let strongSelf = self else { return } - let soundSettings: NotificationSoundSettings? - if case .default = peerSettings.messageSound { - soundSettings = NotificationSoundSettings(value: nil) - } else { - soundSettings = NotificationSoundSettings(value: peerSettings.messageSound) - } let muteSettingsController = notificationMuteSettingsController(presentationData: strongSelf.presentationData, notificationSettings: globalSettings.effective.groupChats, soundSettings: nil, openSoundSettings: { guard let strongSelf = self else { return @@ -2562,12 +2550,6 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD guard let strongSelf = self else { return } - let soundSettings: NotificationSoundSettings? - if case .default = peerSettings.messageSound { - soundSettings = NotificationSoundSettings(value: nil) - } else { - soundSettings = NotificationSoundSettings(value: peerSettings.messageSound) - } let soundController = notificationSoundSelectionController(context: strongSelf.context, isModal: true, currentSound: peerSettings.messageSound, defaultSound: globalSettings.effective.groupChats.sound, completion: { sound in guard let strongSelf = self else { @@ -2699,8 +2681,8 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD let dismissAction: () -> Void = { [weak actionSheet] in actionSheet?.dismissAnimated() } - var reportSpam = false - var deleteChat = false + let reportSpam = false + let deleteChat = false actionSheet.setItemGroups([ ActionSheetItemGroup(items: [ ActionSheetTextItem(title: presentationData.strings.UserInfo_BlockConfirmationTitle(peer.compactDisplayTitle).0), @@ -2924,12 +2906,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD |> mapToSignal { address -> Signal in return updateChannelGeoLocation(postbox: context.account.postbox, network: context.account.network, channelId: peer.id, coordinate: (coordinate.latitude, coordinate.longitude), address: address) } - |> deliverOnMainQueue).start(error: { errror in - guard let strongSelf = self else { - return - } - strongSelf.controller?.present(textAlertController(context: context, title: nil, text: strongSelf.presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root)) - }) + |> deliverOnMainQueue).start() }, sendLiveLocation: { _, _ in }, theme: presentationData.theme, customLocationPicker: true, presentationCompleted: { }) self.controller?.push(locationController) @@ -3219,8 +3196,8 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD } let _ = strongSelf.currentAvatarMixin.swap(nil) - if let profileImage = peer.smallProfileImage { - strongSelf.state = strongSelf.state.withUpdatingAvatar(.none) + if let _ = peer.smallProfileImage { + strongSelf.state = strongSelf.state.withUpdatingAvatar(nil) if let (layout, navigationHeight) = strongSelf.validLayout { strongSelf.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false) } @@ -3355,7 +3332,6 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD if groupPeer.id.namespace == Namespaces.Peer.CloudChannel { return context.peerChannelMemberCategoriesContextsManager.addMember(account: context.account, peerId: groupPeer.id, memberId: memberId) |> map { _ -> Void in - return Void() } |> `catch` { _ -> Signal in return .complete() @@ -3402,7 +3378,6 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD return .complete() } |> mapToSignal { _ -> Signal in - return .complete() } |> then(.single(upgradedPeerId)) } @@ -3431,12 +3406,11 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD return context.account.postbox.multiplePeersView(memberIds) |> take(1) |> deliverOnMainQueue - |> mapError { _ in return .generic} + |> castError(AddChannelMemberError.self) |> mapToSignal { view -> Signal in if memberIds.count == 1 { return context.peerChannelMemberCategoriesContextsManager.addMember(account: context.account, peerId: groupPeer.id, memberId: memberIds[0]) |> map { _ -> Void in - return Void() } } else { return context.peerChannelMemberCategoriesContextsManager.addMembers(account: context.account, peerId: groupPeer.id, memberIds: memberIds) |> map { _ in @@ -3798,7 +3772,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD } } var removeRegularSections: [AnyHashable] = [] - for (sectionId, sectionNode) in self.regularSections { + for (sectionId, _) in self.regularSections { if !validRegularSections.contains(sectionId) { removeRegularSections.append(sectionId) } @@ -3844,7 +3818,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD } } var removeEditingSections: [AnyHashable] = [] - for (sectionId, sectionNode) in self.editingSections { + for (sectionId, _) in self.editingSections { if !validEditingSections.contains(sectionId) { removeEditingSections.append(sectionId) } @@ -3988,7 +3962,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD if let (layout, navigationHeight) = self.validLayout { if !additive { - self.headerNode.update(width: layout.size.width, containerHeight: layout.size.height, containerInset: layout.safeInsets.left, statusBarHeight: layout.statusBarHeight ?? 0.0, navigationHeight: navigationHeight, contentOffset: self.isMediaOnly ? 212.0 : offsetY, presentationData: self.presentationData, peer: self.data?.peer, cachedData: self.data?.cachedData, notificationSettings: self.data?.notificationSettings, statusData: self.data?.status, isContact: self.data?.isContact ?? false, state: self.state, transition: transition, additive: additive) + let _ = self.headerNode.update(width: layout.size.width, containerHeight: layout.size.height, containerInset: layout.safeInsets.left, statusBarHeight: layout.statusBarHeight ?? 0.0, navigationHeight: navigationHeight, contentOffset: self.isMediaOnly ? 212.0 : offsetY, presentationData: self.presentationData, peer: self.data?.peer, cachedData: self.data?.cachedData, notificationSettings: self.data?.notificationSettings, statusData: self.data?.status, isContact: self.data?.isContact ?? false, state: self.state, transition: transition, additive: additive) } let paneAreaExpansionDistance: CGFloat = 32.0 @@ -4190,7 +4164,6 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD return nil } var currentParent: UIView? = result - var enableScrolling = true while true { if currentParent == nil || currentParent === self.view { break @@ -4480,9 +4453,6 @@ private final class PeerInfoNavigationTransitionNode: ASDisplayNode, CustomNavig } if let currentBackButton = self.currentBackButton { - let currentBackButtonFrame = topNavigationBar.backButtonNode.view.convert(topNavigationBar.backButtonNode.view.bounds, to: topNavigationBar.view) - //transition.updateFrame(node: currentBackButton, frame: currentBackButtonFrame.offsetBy(dx: fraction * 12.0, dy: 0.0)) - transition.updateAlpha(node: currentBackButton, alpha: (1.0 - fraction)) } @@ -4491,8 +4461,8 @@ private final class PeerInfoNavigationTransitionNode: ASDisplayNode, CustomNavig let previousStatusFrame = previousTitleView.activityNode.view.convert(previousTitleView.activityNode.bounds, to: bottomNavigationBar.view) self.headerNode.navigationTransition = PeerInfoHeaderNavigationTransition(sourceNavigationBar: bottomNavigationBar, sourceTitleView: previousTitleView, sourceTitleFrame: previousTitleFrame, sourceSubtitleFrame: previousStatusFrame, fraction: fraction) - if let (layout, navigationHeight) = self.screenNode.validLayout { - self.headerNode.update(width: layout.size.width, containerHeight: layout.size.height, containerInset: layout.safeInsets.left, statusBarHeight: layout.statusBarHeight ?? 0.0, navigationHeight: topNavigationBar.bounds.height, contentOffset: 0.0, presentationData: self.presentationData, peer: self.screenNode.data?.peer, cachedData: self.screenNode.data?.cachedData, notificationSettings: self.screenNode.data?.notificationSettings, statusData: self.screenNode.data?.status, isContact: self.screenNode.data?.isContact ?? false, state: self.screenNode.state, transition: transition, additive: false) + if let (layout, _) = self.screenNode.validLayout { + let _ = self.headerNode.update(width: layout.size.width, containerHeight: layout.size.height, containerInset: layout.safeInsets.left, statusBarHeight: layout.statusBarHeight ?? 0.0, navigationHeight: topNavigationBar.bounds.height, contentOffset: 0.0, presentationData: self.presentationData, peer: self.screenNode.data?.peer, cachedData: self.screenNode.data?.cachedData, notificationSettings: self.screenNode.data?.notificationSettings, statusData: self.screenNode.data?.status, isContact: self.screenNode.data?.isContact ?? false, state: self.screenNode.state, transition: transition, additive: false) } let titleScale = (fraction * previousTitleNode.bounds.height + (1.0 - fraction) * self.headerNode.titleNodeRawContainer.bounds.height) / previousTitleNode.bounds.height From 343c325f78270c277960dd19af4625943996e14c Mon Sep 17 00:00:00 2001 From: overtake Date: Tue, 24 Mar 2020 17:12:34 +0400 Subject: [PATCH 5/6] fix typo [skip ci] --- submodules/GraphCore/Sources/Models/ColorMode.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/GraphCore/Sources/Models/ColorMode.swift b/submodules/GraphCore/Sources/Models/ColorMode.swift index 367adcb994..f30948b133 100644 --- a/submodules/GraphCore/Sources/Models/ColorMode.swift +++ b/submodules/GraphCore/Sources/Models/ColorMode.swift @@ -63,5 +63,5 @@ public class ChartTheme { public static var defaultDayTheme = ChartTheme(chartTitleColor: GColor.black, actionButtonColor: GColor(red: 53/255.0, green: 120/255.0, blue: 246/255.0, alpha: 1.0), chartBackgroundColor: GColor(red: 254/255.0, green: 254/255.0, blue: 254/255.0, alpha: 1.0), chartLabelsColor: GColor(red: 37/255.0, green: 37/255.0, blue: 41/255.0, alpha: 0.5), chartHelperLinesColor: GColor(red: 24/255.0, green: 45/255.0, blue: 59/255.0, alpha: 0.1), chartStrongLinesColor: GColor(red: 24/255.0, green: 45/255.0, blue: 59/255.0, alpha: 0.35), barChartStrongLinesColor: GColor(red: 37/255.0, green: 37/255.0, blue: 41/255.0, alpha: 0.2), chartDetailsTextColor: GColor(red: 109/255.0, green: 109/255.0, blue: 114/255.0, alpha: 1.0), chartDetailsArrowColor: GColor(red: 197/255.0, green: 199/255.0, blue: 205/255.0, alpha: 1.0), chartDetailsViewColor: GColor(red: 245/255.0, green: 245/255.0, blue: 251/255.0, alpha: 1.0), rangeViewFrameColor: GColor(red: 202/255.0, green: 212/255.0, blue: 222/255.0, alpha: 1.0), rangeViewTintColor: GColor(red: 239/255.0, green: 239/255.0, blue: 244/255.0, alpha: 0.5), rangeViewMarkerColor: GColor.white, rangeCropImage: GImage(named: "selection_frame_light")) - public static var defaultNightTheme = ChartTheme(chartTitleColor: GColor.white, actionButtonColor: GColor(red: 84/255.0, green: 164/255.0, blue: 247/255.0, alpha: 1.0), chartBackgroundColor: GColor(red: 34/255.0, green: 47/255.0, blue: 63/255.0, alpha: 1.0), chartLabelsColor: GColor(red: 186/255.0, green: 204/255.0, blue: 225/255.0, alpha: 0.6), chartHelperLinesColor: GColor(red: 133/255.0, green: 150/255.0, blue: 171/255.0, alpha: 0.20), chartStrongLinesColor: GColor(red: 186/255.0, green: 204/255.0, blue: 225/255.0, alpha: 0.45), barChartStrongLinesColor: GColor(red: 186/255.0, green: 204/255.0, blue: 225/255.0, alpha: 0.45), chartDetailsTextColor: GColor(red: 254/255.0, green: 254/255.0, blue: 254/255.0, alpha: 1.0), chartDetailsArrowColor: GColor(red: 76/255.0, green: 84/255.0, blue: 96/255.0, alpha: 1.0), chartDetailsViewColor: GColor(red: 25/255.0, green: 35/255.0, blue: 47/255.0, alpha: 1.0), rangeViewFrameColor: GColor(red: 53/255.0, green: 70/255.0, blue: 89/255.0, alpha: 1.0), rangeViewTintColor: GColor(red: 24/255.0, green: 34/255.0, blue: 45/255.0, alpha: 0.5), rangeViewMarkerColor: GColor.white, rangeCropImage: GImage(named: "selection_frame_light")) + public static var defaultNightTheme = ChartTheme(chartTitleColor: GColor.white, actionButtonColor: GColor(red: 84/255.0, green: 164/255.0, blue: 247/255.0, alpha: 1.0), chartBackgroundColor: GColor(red: 34/255.0, green: 47/255.0, blue: 63/255.0, alpha: 1.0), chartLabelsColor: GColor(red: 186/255.0, green: 204/255.0, blue: 225/255.0, alpha: 0.6), chartHelperLinesColor: GColor(red: 133/255.0, green: 150/255.0, blue: 171/255.0, alpha: 0.20), chartStrongLinesColor: GColor(red: 186/255.0, green: 204/255.0, blue: 225/255.0, alpha: 0.45), barChartStrongLinesColor: GColor(red: 186/255.0, green: 204/255.0, blue: 225/255.0, alpha: 0.45), chartDetailsTextColor: GColor(red: 254/255.0, green: 254/255.0, blue: 254/255.0, alpha: 1.0), chartDetailsArrowColor: GColor(red: 76/255.0, green: 84/255.0, blue: 96/255.0, alpha: 1.0), chartDetailsViewColor: GColor(red: 25/255.0, green: 35/255.0, blue: 47/255.0, alpha: 1.0), rangeViewFrameColor: GColor(red: 53/255.0, green: 70/255.0, blue: 89/255.0, alpha: 1.0), rangeViewTintColor: GColor(red: 24/255.0, green: 34/255.0, blue: 45/255.0, alpha: 0.5), rangeViewMarkerColor: GColor.white, rangeCropImage: GImage(named: "selection_frame_dark")) } From 74a179cd1e4fc82c86babdbb123ce0ff789bbd72 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Tue, 24 Mar 2020 17:13:44 +0400 Subject: [PATCH 6/6] Fix saved messages in folder settings --- .../ChatListFilterPresetController.swift | 2 +- .../ChatListUI/Sources/Node/ChatListNode.swift | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift b/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift index b8995512ad..47ae8612e5 100644 --- a/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift +++ b/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift @@ -389,7 +389,7 @@ private enum ChatListFilterPresetEntry: ItemListNodeEntry { } ) case let .includePeer(_, peer, isRevealed): - return ItemListPeerItem(presentationData: presentationData, dateTimeFormat: PresentationDateTimeFormat(timeFormat: .regular, dateFormat: .monthFirst, dateSeparator: ".", decimalSeparator: ".", groupingSeparator: "."), nameDisplayOrder: .firstLast, context: arguments.context, peer: peer.chatMainPeer!, height: .peerList, presence: nil, text: .none, label: .none, editing: ItemListPeerItemEditing(editable: true, editing: false, revealed: isRevealed), revealOptions: ItemListPeerItemRevealOptions(options: [ItemListPeerItemRevealOption(type: .destructive, title: presentationData.strings.Common_Delete, action: { + return ItemListPeerItem(presentationData: presentationData, dateTimeFormat: PresentationDateTimeFormat(timeFormat: .regular, dateFormat: .monthFirst, dateSeparator: ".", decimalSeparator: ".", groupingSeparator: "."), nameDisplayOrder: .firstLast, context: arguments.context, peer: peer.chatMainPeer!, height: .peerList, aliasHandling: .threatSelfAsSaved, presence: nil, text: .none, label: .none, editing: ItemListPeerItemEditing(editable: true, editing: false, revealed: isRevealed), revealOptions: ItemListPeerItemRevealOptions(options: [ItemListPeerItemRevealOption(type: .destructive, title: presentationData.strings.Common_Delete, action: { arguments.deleteIncludePeer(peer.peerId) })]), switchValue: nil, enabled: true, selectable: false, sectionId: self.section, action: nil, setPeerIdWithRevealedOptions: { lhs, rhs in arguments.setItemIdWithRevealedOptions(lhs.flatMap { .peer($0) }, rhs.flatMap { .peer($0) }) diff --git a/submodules/ChatListUI/Sources/Node/ChatListNode.swift b/submodules/ChatListUI/Sources/Node/ChatListNode.swift index 1c3811fad7..d6bc102d2f 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListNode.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListNode.swift @@ -250,7 +250,11 @@ private func mappedInsertEntries(context: AccountContext, nodeInteraction: ChatL var status: ContactsPeerItemStatus = .none if isSelecting, let itemPeer = itemPeer { - status = .custom(statusStringForPeerType(strings: presentationData.strings, peer: itemPeer, isContact: isContact)) + if let string = statusStringForPeerType(accountPeerId: context.account.peerId, strings: presentationData.strings, peer: itemPeer, isContact: isContact) { + status = .custom(string) + } else { + status = .none + } } return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ContactsPeerItem(presentationData: ItemListPresentationData(theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings), sortOrder: presentationData.nameSortOrder, displayOrder: presentationData.nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: itemPeer, chatPeer: chatPeer), status: status, enabled: enabled, selection: editing ? .selectable(selected: selected) : .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in @@ -313,7 +317,11 @@ private func mappedUpdateEntries(context: AccountContext, nodeInteraction: ChatL var status: ContactsPeerItemStatus = .none if isSelecting, let itemPeer = itemPeer { - status = .custom(statusStringForPeerType(strings: presentationData.strings, peer: itemPeer, isContact: isContact)) + if let string = statusStringForPeerType(accountPeerId: context.account.peerId, strings: presentationData.strings, peer: itemPeer, isContact: isContact) { + status = .custom(string) + } else { + status = .none + } } return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ContactsPeerItem(presentationData: ItemListPresentationData(theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings), sortOrder: presentationData.nameSortOrder, displayOrder: presentationData.nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: itemPeer, chatPeer: chatPeer), status: status, enabled: enabled, selection: editing ? .selectable(selected: selected) : .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in @@ -1789,7 +1797,10 @@ public final class ChatListNode: ListView { } } -private func statusStringForPeerType(strings: PresentationStrings, peer: Peer, isContact: Bool) -> String { +private func statusStringForPeerType(accountPeerId: PeerId, strings: PresentationStrings, peer: Peer, isContact: Bool) -> String? { + if accountPeerId == peer.id { + return nil + } if let user = peer as? TelegramUser { if user.botInfo != nil || user.flags.contains(.isSupport) { return strings.ChatList_PeerTypeBot