diff --git a/Nicegram/NGData/Sources/NGSettings.swift b/Nicegram/NGData/Sources/NGSettings.swift index 017419e3fdd..0d27ce1904a 100644 --- a/Nicegram/NGData/Sources/NGSettings.swift +++ b/Nicegram/NGData/Sources/NGSettings.swift @@ -185,9 +185,6 @@ public func checkPremium(completion: @escaping (Bool) -> Void) { } public func isPremium() -> Bool { -#if DEBUG - return true -#else if #available(iOS 13.0, *) { return PremiumContainer.shared .getPremiumStatusUseCase() @@ -195,7 +192,6 @@ public func isPremium() -> Bool { } else { return false } -#endif } public func usetrButton() -> [(Bool, [String])] { diff --git a/Nicegram/NGLab/Sources/RegDate.swift b/Nicegram/NGLab/Sources/RegDate.swift index ba4de231f3d..7513e274747 100644 --- a/Nicegram/NGLab/Sources/RegDate.swift +++ b/Nicegram/NGLab/Sources/RegDate.swift @@ -142,44 +142,6 @@ public func makeNiceRegDateStr(_ date: String) -> String { } } -public func getDaysFromRegDate(with id: Int64) -> Signal { - if let dateString = getCachedRegDate(id) { - return .single(days(from: dateString)) - } else { - return getRegDate(id) - .skipError() - |> map { dateString in - days(from: dateString) - } - } -} - -private func days(from dateString: String, to: Date = Date()) -> Int? { - let monthDateFormatter = DateFormatter() - monthDateFormatter.dateFormat = "yyyy-MM" - - let dayDateFormatter = DateFormatter() - dayDateFormatter.dateFormat = "yyyy-MM-dd" - - var convertDateFormatter = DateFormatter() - - var date: Date? - if let monthDate = monthDateFormatter.date(from: dateString) { - date = monthDate - } else if let dayDate = dayDateFormatter.date(from: dateString) { - date = dayDate - } - - if let date { - let calendar = Calendar.current - let components = calendar.dateComponents([.day], from: date, to: to) - if let days = components.day { - return days - } - } - - return nil -} public func resetRegDateCache() -> Void { UserDefaults.standard.removePersistentDomain(forName: "CachedRegDate") diff --git a/Nicegram/NGPersonality/BUILD b/Nicegram/NGPersonality/BUILD deleted file mode 100644 index 053a3ba3b4a..00000000000 --- a/Nicegram/NGPersonality/BUILD +++ /dev/null @@ -1,19 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "NGPersonality", - module_name = "NGPersonality", - srcs = glob([ - "Sources/**/*.swift", - ]), - deps = [ - "//submodules/TelegramCore:TelegramCore", - "//submodules/TelegramApi:TelegramApi", - "//submodules/AccountContext:AccountContext", - "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", - "//Nicegram/NGPersonalityCore:NGPersonalityCore" - ], - visibility = [ - "//visibility:public", - ], -) diff --git a/Nicegram/NGPersonality/Sources/CollectGhostScore.swift b/Nicegram/NGPersonality/Sources/CollectGhostScore.swift deleted file mode 100644 index 91695d55662..00000000000 --- a/Nicegram/NGPersonality/Sources/CollectGhostScore.swift +++ /dev/null @@ -1,35 +0,0 @@ -import TelegramApi -import TelegramCore -import AccountContext -import SwiftSignalKit -import Network -import MtProtoKit -import Postbox -import FeatPersonality - -private let container = PersonalityContainer.shared -private let checkCollectStateUseCase = container.checkCollectStateUseCase() -private let checkPreferencesStateUseCase = container.checkPreferencesStateUseCase() -private let collectGhostScoreUseCase = container.collectGhostScoreUseCase() - -public func collectGhostScore( - with context: AccountContext, - completion: @escaping () -> Void = {} -) { - guard checkCollectStateUseCase(with: .ghostScore(.empty)) else { return } - guard checkPreferencesStateUseCase(with: .ghostScore(.empty)) else { return } - - - _ = context.account.postbox.transaction { transaction -> ChatListTotalUnreadState in - transaction.getTotalUnreadState(groupId: .root) - } - .start { state in - let count = state.count(for: .filtered, in: .messages, with: .contact) - - collectGhostScoreUseCase( - with: context.account.peerId.toInt64(), - count: count - ) - completion() - } -} diff --git a/Nicegram/NGPersonality/Sources/CollectInfluencerScore.swift b/Nicegram/NGPersonality/Sources/CollectInfluencerScore.swift deleted file mode 100644 index 01dfe25e1ee..00000000000 --- a/Nicegram/NGPersonality/Sources/CollectInfluencerScore.swift +++ /dev/null @@ -1,115 +0,0 @@ -import TelegramApi -import TelegramCore -import AccountContext -import SwiftSignalKit -import Network -import MtProtoKit -import Postbox -import FeatPersonality - -private let container = PersonalityContainer.shared -private let checkCollectStateUseCase = container.checkCollectStateUseCase() -private let checkPreferencesStateUseCase = container.checkPreferencesStateUseCase() -private let collectInfluencerScoreUseCase = container.collectInfluencerScoreUseCase() - -public func collectInfluencerScore( - with context: AccountContext, - completion: @escaping () -> Void = {} -) { - guard checkCollectStateUseCase(with: .influencerScore(.empty)) else { return } - guard checkPreferencesStateUseCase(with: .influencerScore(.empty)) else { return } - - - _ = influencerScore(with: context) - .start(next: { result in - collectInfluencerScoreUseCase( - with: context.account.peerId.toInt64(), - channelsCount: result.1, - participantsCount: result.0 - ) - completion() - }) -} - -private func influencerScore( - with context: AccountContext -) -> Signal<(Int32, Int32), NoError> { - dialogs(with: context) - |> mapToSignal { dialogs -> Signal<[Api.messages.ChatFull?], NoError> in - switch dialogs { - case let .dialogs(_, _, chats, _): - return fullChannels(with: context, chats: chats) - case let .dialogsSlice(_, _, _, chats, _): - return fullChannels(with: context, chats: chats) - default: return .single([]) - } - } - |> map { fullChannels -> (Int32, Int32) in - var count: Int32 = 0 - - fullChannels.forEach { chatFull in - switch chatFull { - case let .chatFull(fullChat, _, _): - switch fullChat { - case let .channelFull(_, _, _, _, participantsCount, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _): - count += (participantsCount ?? 0) - default: break - } - default: break - } - } - - return (count, Int32(fullChannels.count)) - } -} - -private func fullChannels( - with context: AccountContext, - chats: [Api.Chat] -) -> Signal<[Api.messages.ChatFull?], NoError> { - combineLatest( - chats.compactMap { chat in - switch chat { - case let .channel(flags, _, id, accessHash, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _): - if (flags & Int32(1 << 0)) != 0 { - return fullChannel(with: context, channelId: id, accessHash: accessHash ?? 0) - } else { - return nil - } - default: return nil - } - } - ) -} - -private func fullChannel( - with context: AccountContext, - channelId: Int64, - accessHash: Int64 -) -> Signal { - context.account.network.request(Api.functions.channels.getFullChannel( - channel: .inputChannel(channelId: channelId, accessHash: accessHash) - )) - |> map(Optional.init) - |> `catch` { error -> Signal in - return .single(nil) - } -} - -private func dialogs( - with context: AccountContext -) -> Signal { - context.account.network.request(Api.functions.messages.getDialogs( - flags: 0, - folderId: nil, - offsetDate: 0, - offsetId: 0, - offsetPeer: .inputPeerSelf, - limit: .max, - hash: 0 - )) - |> map(Optional.init) - |> `catch` { error -> Signal in - return .single(nil) - } -} diff --git a/Nicegram/NGPersonality/Sources/CollectMessagesActivity.swift b/Nicegram/NGPersonality/Sources/CollectMessagesActivity.swift deleted file mode 100644 index e2c41fe5e5d..00000000000 --- a/Nicegram/NGPersonality/Sources/CollectMessagesActivity.swift +++ /dev/null @@ -1,106 +0,0 @@ -import TelegramApi -import TelegramCore -import AccountContext -import SwiftSignalKit -import Network -import MtProtoKit -import Postbox -import FeatPersonality - -private let container = PersonalityContainer.shared -private let checkCollectStateUseCase = container.checkCollectStateUseCase() -private let checkPreferencesStateUseCase = container.checkPreferencesStateUseCase() -private let collectMessagesActivityUseCase = container.collectMessagesActivityUseCase() - -public func collectMessagesActivity( - with context: AccountContext, - completion: @escaping () -> Void = {} -) { - guard checkCollectStateUseCase(with: .messagesActivity(.empty)) else { return } - guard checkPreferencesStateUseCase(with: .messagesActivity(.empty)) else { return } - - _ = combineLatest( - searchGlobal(with: context), - search(with: context) - ) - .start { all, user in - var allCount: Int32 = 0 - var userCount: Int32 = 0 - - switch all { - case let .channelMessages(_, _, count, _, _, _, _, _): - allCount = count - case let .messagesSlice(_, count, _, _, _, _, _): - allCount = count - default: break - } - switch user { - case let .channelMessages(_, _, count, _, _, _, _, _): - userCount = count - case let .messagesSlice(_, count, _, _, _, _, _): - userCount = count - default: break - } - - collectMessagesActivityUseCase( - with: context.account.peerId.toInt64(), - allMessagesCount: allCount, - userMessagesCount: userCount - ) - - completion() - } -} - -// limit = 0, return only count without messages -func search( - with context: AccountContext, - peer: Api.InputPeer = .inputPeerEmpty, - from: Api.InputPeer = .inputPeerSelf, - limit: Int32 = 0 -) -> Signal { - context.account.network.request(Api.functions.messages.search( - flags: 0, - peer: peer, - q: "", - fromId: from, - savedPeerId: nil, - savedReaction: nil, - topMsgId: nil, - filter: .inputMessagesFilterEmpty, - minDate: 0, - maxDate: 0, - offsetId: 0, - addOffset: 0, - limit: limit, - maxId: 0, - minId: 0, - hash: 0 - )) - |> map(Optional.init) - |> `catch` { error -> Signal in - return .single(nil) - } -} - -private func searchGlobal( - with context: AccountContext, - limit: Int32 = 0 -) -> Signal { - context.account.network.request(Api.functions.messages.searchGlobal( - flags: 0, - folderId: nil, - q: "", - filter: .inputMessagesFilterEmpty, - minDate: 0, - maxDate: 0, - offsetRate: 0, - offsetPeer: .inputPeerEmpty, - offsetId: 0, - limit: limit - )) - |> map(Optional.init) - |> `catch` { error -> Signal in - return .single(nil) - } -} diff --git a/Nicegram/NGPersonalityCore/BUILD b/Nicegram/NGPersonalityCore/BUILD deleted file mode 100644 index 43e8a9847d5..00000000000 --- a/Nicegram/NGPersonalityCore/BUILD +++ /dev/null @@ -1,16 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "NGPersonalityCore", - module_name = "NGPersonalityCore", - srcs = glob([ - "Sources/**/*.swift", - ]), - deps = [ - "@swiftpkg_nicegram_assistant_ios//:FeatPersonality", - "@swiftpkg_nicegram_assistant_ios//:FeatPersonalityUI" - ], - visibility = [ - "//visibility:public", - ], -) diff --git a/Nicegram/NGPersonalityCore/Sources/CollectActiveHours.swift b/Nicegram/NGPersonalityCore/Sources/CollectActiveHours.swift deleted file mode 100644 index f702b7708fd..00000000000 --- a/Nicegram/NGPersonalityCore/Sources/CollectActiveHours.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation -import FeatPersonality - -private let container = PersonalityContainer.shared -private let checkPreferencesStateUseCase = container.checkPreferencesStateUseCase() -private let collectActiveHoursUseCase = container.collectActiveHoursUseCase() - -public func collectMessageActivity(with userId: Int64) { - guard checkPreferencesStateUseCase(with: .activeHours([])) else { return } - - collectActiveHoursUseCase.collectMessageActivity(with: userId) -} - -public func collectScrollActivity(with userId: Int64) { - guard checkPreferencesStateUseCase(with: .activeHours([])) else { return } - - collectActiveHoursUseCase.collectScrollActivity(with: userId) -} - -public func collectCallActivity(with userId: Int64) { - guard checkPreferencesStateUseCase(with: .activeHours([])) else { return } - - collectActiveHoursUseCase.collectCallActivity(with: userId) -} - -public func collectVideoActivity(with userId: Int64) { - guard checkPreferencesStateUseCase(with: .activeHours([])) else { return } - - collectActiveHoursUseCase.collectVideoActivity(with: userId) -} diff --git a/Nicegram/NGPersonalityCore/Sources/CollectContactsActivity.swift b/Nicegram/NGPersonalityCore/Sources/CollectContactsActivity.swift deleted file mode 100644 index 4923faa6e38..00000000000 --- a/Nicegram/NGPersonalityCore/Sources/CollectContactsActivity.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation -import FeatPersonality - -private let container = PersonalityContainer.shared -private let checkPreferencesStateUseCase = container.checkPreferencesStateUseCase() -private let collectContactsActivityUseCase = container.collectContactsActivityUseCase() - -public func collectContactsActivity( - with userId: Int64, - count: Int -) { - guard checkPreferencesStateUseCase(with: .contactsActivity(.empty)) else { return } - - collectContactsActivityUseCase(with: userId, count: count) -} diff --git a/Nicegram/NGPersonalityCore/Sources/CollectDailyActivity.swift b/Nicegram/NGPersonalityCore/Sources/CollectDailyActivity.swift deleted file mode 100644 index 20a74ec7a30..00000000000 --- a/Nicegram/NGPersonalityCore/Sources/CollectDailyActivity.swift +++ /dev/null @@ -1,15 +0,0 @@ -import UIKit -import FeatPersonality - -private let container = PersonalityContainer.shared -private let checkPreferencesStateUseCase = container.checkPreferencesStateUseCase() -private let collectDailyActivityUseCases = container.collectDailyActivityUseCases() - -public func collectDailyActivity( - with userId: Int64, - notificationName: NSNotification.Name -) { - guard checkPreferencesStateUseCase(with: .dailyActivity(.empty)) else { return } - - collectDailyActivityUseCases(with: userId, notificationName: notificationName) -} diff --git a/ng-env.txt b/ng-env.txt index 30d74d25844..c23f7a80886 100644 --- a/ng-env.txt +++ b/ng-env.txt @@ -1 +1 @@ -test \ No newline at end of file +prod \ No newline at end of file diff --git a/submodules/DebugSettingsUI/BUILD b/submodules/DebugSettingsUI/BUILD index 5b364b69df3..55e0cb03ce4 100644 --- a/submodules/DebugSettingsUI/BUILD +++ b/submodules/DebugSettingsUI/BUILD @@ -1,8 +1,7 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") NGDEPS = [ - "//Nicegram/NGData:NGData", - "//Nicegram/NGPersonality:NGPersonality" +"//Nicegram/NGData:NGData" ] swift_library( diff --git a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift index 07c5492be65..47da141849c 100644 --- a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift +++ b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift @@ -33,9 +33,6 @@ import RasterizedCompositionComponent import BadgeComponent import ComponentFlow import ComponentDisplayAdapters -// MARK: Nicegram NCG-6903 Nicegram Personality -import NGPersonalityCore -// public enum UniversalVideoGalleryItemContentInfo { case message(Message, Int?) @@ -1808,14 +1805,9 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { } else { self.updateDisplayPlaceholder() } -// MARK: Nicegram NCG-6903 Nicegram Personality, added [weak self] in - scrubberView.setStatusSignal(videoNode.status |> map { [weak self] value -> MediaPlayerStatus in + + scrubberView.setStatusSignal(videoNode.status |> map { value -> MediaPlayerStatus in if let value = value, !value.duration.isZero { -// MARK: Nicegram NCG-6903 Nicegram Personality - if let self { - collectVideoActivity(with: self.context.account.peerId.toInt64()) - } -// return value } else { return MediaPlayerStatus(generationTimestamp: 0.0, duration: max(Double(item.content.duration), 0.01), dimensions: CGSize(), timestamp: 0.0, baseRate: 1.0, seekId: 0, status: .paused, soundEnabled: true) diff --git a/submodules/SSignalKit/SwiftSignalKit/Source/Signal_SwiftCombine.swift b/submodules/SSignalKit/SwiftSignalKit/Source/Signal_SwiftCombine.swift index 09b96d1b041..19b17dc0323 100644 --- a/submodules/SSignalKit/SwiftSignalKit/Source/Signal_SwiftCombine.swift +++ b/submodules/SSignalKit/SwiftSignalKit/Source/Signal_SwiftCombine.swift @@ -43,21 +43,3 @@ public extension Signal { } } } - -public extension Signal { - func toAnyPublisher() -> AnyPublisher { - let subject = PassthroughSubject() - - let disposable = self.start(next: { value in - subject.send(value) - }, completed: { - subject.send(completion: .finished) - }) - - return subject - .handleEvents(receiveCancel: { - disposable.dispose() - }) - .eraseToAnyPublisher() - } -} diff --git a/submodules/TelegramCallsUI/Sources/CallControllerNodeV2.swift b/submodules/TelegramCallsUI/Sources/CallControllerNodeV2.swift index 7f86562d8cf..40f0b54895c 100644 --- a/submodules/TelegramCallsUI/Sources/CallControllerNodeV2.swift +++ b/submodules/TelegramCallsUI/Sources/CallControllerNodeV2.swift @@ -21,8 +21,6 @@ import LibYuvBinding // MARK: Nicegram NCG-5828 call recording import NGStrings import UndoUI -// MARK: Nicegram NCG-6903 Nicegram Personality -import NGPersonalityCore // final class CallControllerNodeV2: ViewControllerTracingNode, CallControllerNodeProtocol { private struct PanGestureState { @@ -473,9 +471,6 @@ final class CallControllerNodeV2: ViewControllerTracingNode, CallControllerNodeP signalInfo: PrivateCallScreen.State.SignalInfo(quality: Double(signalQuality ?? 0) / 4.0), emojiKey: self.resolvedEmojiKey(data: keyData) )) -// MARK: Nicegram NCG-6903 Nicegram Personality - collectCallActivity(with: account.peerId.toInt64()) -// case let .reconnecting(startTime, _, keyData): self.smoothSignalQuality = nil self.smoothSignalQualityTarget = nil @@ -496,7 +491,7 @@ final class CallControllerNodeV2: ViewControllerTracingNode, CallControllerNodeP } else { duration = 0.0 } - + let mappedReason: PrivateCallScreen.State.TerminatedState.Reason if let reason { switch reason { diff --git a/submodules/TelegramCore/BUILD b/submodules/TelegramCore/BUILD index 69bfe25b0d2..50c87afcee0 100644 --- a/submodules/TelegramCore/BUILD +++ b/submodules/TelegramCore/BUILD @@ -1,9 +1,5 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") -NGDEPS = [ - "//Nicegram/NGPersonalityCore:NGPersonalityCore" -] - swift_library( name = "TelegramCore", module_name = "TelegramCore", @@ -13,7 +9,7 @@ swift_library( copts = [ #"-warnings-as-errors", ], - deps = NGDEPS + [ + deps = [ "//submodules/TelegramApi:TelegramApi", "//submodules/MtProtoKit:MtProtoKit", "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", diff --git a/submodules/TelegramCore/Sources/PendingMessages/EnqueueMessage.swift b/submodules/TelegramCore/Sources/PendingMessages/EnqueueMessage.swift index 3bc2f0914d0..46906016845 100644 --- a/submodules/TelegramCore/Sources/PendingMessages/EnqueueMessage.swift +++ b/submodules/TelegramCore/Sources/PendingMessages/EnqueueMessage.swift @@ -3,9 +3,6 @@ import Postbox import TelegramApi import SwiftSignalKit import Emoji -// MARK: Nicegram NCG-6903 Nicegram Personality -import NGPersonalityCore -// public enum EnqueueMessageGrouping { case none @@ -442,9 +439,6 @@ public func resendMessages(account: Account, messageIds: [MessageId]) -> Signal< } func enqueueMessages(transaction: Transaction, account: Account, peerId: PeerId, messages: [(Bool, EnqueueMessage)], disableAutoremove: Bool = false, transformGroupingKeysWithPeerId: Bool = false) -> [MessageId?] { -// MARK: Nicegram NCG-6903 Nicegram Personality - collectMessageActivity(with: account.peerId.toInt64()) -// /** * If it is a support account, mark messages as read here as they are * not marked as read when chat is opened. diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Contacts/ContactManagement.swift b/submodules/TelegramCore/Sources/TelegramEngine/Contacts/ContactManagement.swift index 88bdfd78d89..6e4bae85f99 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Contacts/ContactManagement.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Contacts/ContactManagement.swift @@ -49,7 +49,7 @@ func syncContactsOnce(network: Network, postbox: Postbox, accountPeerId: PeerId) let peerIds = Set(contactPeerIds.filter({ $0.namespace == Namespaces.Peer.CloudUser })) return hashForCountAndIds(count: totalCount, ids: peerIds.map({ $0.id._internalGetInt64Value() }).sorted()) } - + let updatedPeers = initialContactPeerIdsHash |> mapToSignal { hash -> Signal<(AccumulatedPeers, Int32)?, NoError> in return updatedRemoteContactPeers(network: network, hash: hash) diff --git a/submodules/TelegramUI/BUILD b/submodules/TelegramUI/BUILD index f34b4bff5f1..052b47b8e94 100644 --- a/submodules/TelegramUI/BUILD +++ b/submodules/TelegramUI/BUILD @@ -27,7 +27,6 @@ NGDEPS = [ "@swiftpkg_nicegram_assistant_ios//:FeatTgChatButton", "@swiftpkg_nicegram_assistant_ios//:NGEntryPoint", "@swiftpkg_nicegram_assistant_ios//:_NGRemoteConfig", - "@swiftpkg_nicegram_assistant_ios//:FeatPersonalityUI", "//Nicegram/NGCollectInformation:NGCollectInformation" ] diff --git a/submodules/TelegramUI/Sources/AppDelegate.swift b/submodules/TelegramUI/Sources/AppDelegate.swift index 2936c88163d..7ecda5fbbbd 100644 --- a/submodules/TelegramUI/Sources/AppDelegate.swift +++ b/submodules/TelegramUI/Sources/AppDelegate.swift @@ -17,13 +17,9 @@ import NGStats import NGStrings import NGUtils import NicegramWallet -import NGPersonalityCore -import NGPersonality +import NGCollectInformation import Combine -import AvatarNode -import NGLab import FeatPersonality -import NGCollectInformation // import UIKit import SwiftSignalKit @@ -375,45 +371,8 @@ private class UserInterfaceStyleObserverWindow: UIWindow { private let voipDeviceToken = Promise(nil) private let regularDeviceToken = Promise(nil) -// MARK: Nicegram NCG-6903 Nicegram Personality private let personalityInput = CurrentValueSubject(.refresh(0)) - private let personalityOutput = CurrentValueSubject(())//PassthroughSubject() - - func loadUserInformation(with context: AccountContext) { - let signal = context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId)) - |> mapToSignal { peer -> Signal<(Int64, String?, UIImage?, Int?), NoError> in - if case let .user(user) = peer { - return peerAvatarCompleteImage( - account: context.account, - peer: EnginePeer(user), - forceProvidedRepresentation: false, - representation: nil, - size: CGSize(width: 168, height: 168) - ) - |> mapToSignal { image -> Signal<(Int64, String?, UIImage?, Int?), NoError> in - getDaysFromRegDate(with: user.id.toInt64()) - |> map { days -> (Int64, String?, UIImage?, Int?) in - var displayName = user.username - if let firstName = user.firstName, - let lastName = user.lastName, - !firstName.isEmpty && - !lastName.isEmpty { - displayName = "\(firstName) \(lastName)" - } - - return (user.id.toInt64() , displayName?.capitalized, image, days) - } - } - } - - return .single((0, nil, nil, nil)) - } - - _ = signal.start(next: { [weak self] result in - self?.personalityInput.send(.user(result.0, result.1, result.2, result.3)) - }) - } -// + private let personalityOutput = CurrentValueSubject(()) func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { precondition(!testIsLaunched) testIsLaunched = true @@ -537,10 +496,10 @@ private class UserInterfaceStyleObserverWindow: UIWindow { // MARK: Nicegram Unblock let _ = (self.context.get() |> take(1) - |> deliverOnMainQueue).start(next: { [weak self] context in + |> deliverOnMainQueue).start(next: { context in if let context = context { Queue().async { - self?.fetchNGUserSettings(context.context.account.peerId.id._internalGetInt64Value()) + self.fetchNGUserSettings(context.context.account.peerId.id._internalGetInt64Value()) } } }) @@ -2189,18 +2148,6 @@ private class UserInterfaceStyleObserverWindow: UIWindow { } func applicationDidEnterBackground(_ application: UIApplication) { -// MARK: Nicegram NCG-6903 Nicegram Personality - let _ = (self.context.get() - |> take(1) - |> deliverOnMainQueue).start(next: { context in - if let context = context { - collectDailyActivity( - with: context.context.account.peerId.toInt64(), - notificationName: UIApplication.didEnterBackgroundNotification - ) - } - }) -// // MARK: Nicegram DB Changes let _ = (self.sharedContextPromise.get() @@ -2212,7 +2159,6 @@ private class UserInterfaceStyleObserverWindow: UIWindow { extendNow = true } } - if !sharedApplicationContext.sharedContext.energyUsageSettings.extendBackgroundWork { extendNow = false } @@ -2290,50 +2236,17 @@ private class UserInterfaceStyleObserverWindow: UIWindow { //self.fetchPremium() } // -// MARK: Nicegram NCG-6903 Nicegram Personality - let getContext = (self.context.get() - |> take(1) - |> deliverOnMainQueue) - - let _ = combineLatest(getContext, personalityOutput.toSignal().skipError()) - .start(next: { [weak self] result in - if let context = result.0 { - self?.loadUserInformation(with: context.context) - - let id = context.context.account.peerId.toInt64() - _ = context.context.account.postbox.transaction { transaction in - let contactPeerIds = transaction.getContactPeerIds() -// let totalCount = transaction.getRemoteContactCount() - - collectContactsActivity(with: id, count: contactPeerIds.count) - }.start() - - collectDailyActivity( - with: id, - notificationName: UIApplication.didBecomeActiveNotification - ) - collectGhostScore(with: context.context) { [weak self] in - self?.personalityInput.send(.refresh(id)) - } - collectInfluencerScore(with: context.context) { [weak self] in - self?.personalityInput.send(.refresh(id)) - } - collectMessagesActivity(with: context.context) { [weak self] in - self?.personalityInput.send(.refresh(id)) - } - } - }) -// - + SharedDisplayLinkDriver.shared.updateForegroundState(self.isActiveValue) // MARK: Nicegram NCG-6554 channels info - let _ = getContext - .start(next: { authorizedApplicationContext in - if let authorizedApplicationContext { - collectChannelsInformation(with: authorizedApplicationContext.context) - } - }) + let _ = (self.context.get() + |> take(1) + |> deliverOnMainQueue).start(next: { authorizedApplicationContext in + if let authorizedApplicationContext { + collectChannelsInformation(with: authorizedApplicationContext.context) + } + }) // } diff --git a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift index e8acc192854..f2bed600a36 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift @@ -1,12 +1,12 @@ // MARK: Nicegram ATT import ChatMessageNicegramAdNode import FeatAttentionEconomy +// // MARK: Nicegram AiChat import NGAiChatUI +// // MARK: Nicegram ChatBanner import FeatChatBanner -// MARK: Nicegram NCG-6903 Nicegram Personality -import NGPersonalityCore // import Foundation import UIKit @@ -998,9 +998,6 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto atBottom = true offsetFromBottom = offsetValue } -// MARK: Nicegram NCG-6903 Nicegram Personality - collectScrollActivity(with: strongSelf.context.account.peerId.toInt64()) -// //print("offsetValue: \(offsetValue)") default: break diff --git a/submodules/TelegramUI/Sources/Nicegram/NGDeeplinkHandler.swift b/submodules/TelegramUI/Sources/Nicegram/NGDeeplinkHandler.swift index 93ffe791227..7a20ceea7e1 100644 --- a/submodules/TelegramUI/Sources/Nicegram/NGDeeplinkHandler.swift +++ b/submodules/TelegramUI/Sources/Nicegram/NGDeeplinkHandler.swift @@ -20,7 +20,6 @@ import NGSpecialOffer import NGUI import TelegramPresentationData import UIKit -import FeatPersonalityUI @MainActor class NGDeeplinkHandler { @@ -99,16 +98,6 @@ class NGDeeplinkHandler { AssistantTgHelper.routeToAssistant(source: .generic) } return true - case "personality": - if #available(iOS 15.0, *) { - PersonalityPresenter().present() - } - return true - case "personality": - if #available(iOS 15.0, *) { - PersonalityPresenter().present() - } - return true default: return false }