Skip to content

Commit

Permalink
1.8.7 (357)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis15yo committed Oct 30, 2024
1 parent d4df8a9 commit fd2a56b
Show file tree
Hide file tree
Showing 25 changed files with 164 additions and 892 deletions.
6 changes: 3 additions & 3 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions Nicegram/NGUtils/Sources/Peer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,3 @@ public func extractPeerId(peer: Peer) -> Int64 {

return Int64(idText) ?? peer.id.id._internalGetInt64Value()
}

public func getMembersCount(cachedPeerData: CachedPeerData?) -> Int? {
guard let cachedPeerData else {
return nil
}

switch cachedPeerData {
case let channel as CachedChannelData:
return channel.participantsSummary.memberCount.flatMap(Int.init)
case let group as CachedGroupData:
return group.participants?.participants.count
default:
return nil
}
}
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@
"kind" : "remoteSourceControl",
"location" : "[email protected]:mobyrix/nicegram-assistant-ios.git",
"state" : {
"branch" : "feat/attention-economy",
"revision" : "4e25d9a908597c1849f853026af0c60ca1fa35cd"
"branch" : "develop",
"revision" : "b1d4897f36e71c8faef3a06278d503c42f737e98"
}
},
{
"identity" : "nicegram-wallet-ios",
"kind" : "remoteSourceControl",
"location" : "[email protected]:mobyrix/nicegram-wallet-ios.git",
"state" : {
"branch" : "feat/attention-economy",
"revision" : "6b32239cc639c4cd27874b44b4d5426732a84da2"
"branch" : "develop",
"revision" : "ee32c2836b5ba333342d4c73b98561f8f0fb1ae2"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PackageDescription
let package = Package(
name: "nicegram-package",
dependencies: [
.package(url: "[email protected]:mobyrix/nicegram-assistant-ios.git", branch: "feat/attention-economy"),
.package(url: "[email protected]:mobyrix/nicegram-wallet-ios.git", branch: "feat/attention-economy")
.package(url: "[email protected]:mobyrix/nicegram-assistant-ios.git", branch: "develop"),
.package(url: "[email protected]:mobyrix/nicegram-wallet-ios.git", branch: "develop")
]
)
2 changes: 1 addition & 1 deletion ng-env.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
test
prod
14 changes: 0 additions & 14 deletions submodules/ChatListUI/Sources/ChatListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2244,10 +2244,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

// MARK: Nicegram PinnedChats
updateChatListNode(isOnScreen: true)
//

// MARK: Nicegram
if #available(iOS 15.0, *), !didAppear {
Task {
Expand Down Expand Up @@ -2678,10 +2674,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
override public func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)

// MARK: Nicegram PinnedChats
updateChatListNode(isOnScreen: false)
//

if self.dismissSearchOnDisappear {
self.dismissSearchOnDisappear = false
self.deactivateSearch(animated: false)
Expand All @@ -2701,12 +2693,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
}

// MARK: Nicegram PinnedChats
private func updateChatListNode(isOnScreen: Bool) {
chatListDisplayNode.effectiveContainerNode.currentItemNode.isOnScreen.value = isOnScreen
}
//

func updateHeaderContent() -> (primaryContent: ChatListHeaderComponent.Content?, secondaryContent: ChatListHeaderComponent.Content?) {
var primaryContent: ChatListHeaderComponent.Content?
if let primaryContext = self.primaryContext {
Expand Down
73 changes: 6 additions & 67 deletions submodules/ChatListUI/Sources/Node/ChatListItem.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// MARK: Nicegram ATT
import class Combine.AnyCancellable
import FeatAttentionEconomy
//
// MARK: Nicegram HideReactions, HideStories
import FeatPinnedChats
import NGData
Expand Down Expand Up @@ -404,12 +400,6 @@ public class ChatListItem: ListViewItem, ChatListSearchItemNeighbour {
// MARK: Nicegram PinnedChats
let nicegramItem: PinnedChatToDisplay?
//

// MARK: Nicegram ATT
let attBannerFeature = AttBannerFeature()
var attAd: AttAd? { nicegramItem?.chat.attAd }
//

let presentationData: ChatListPresentationData
let context: AccountContext
let chatListLocation: ChatListControllerLocation
Expand Down Expand Up @@ -518,12 +508,8 @@ public class ChatListItem: ListViewItem, ChatListSearchItemNeighbour {
if let nicegramItem {
if #available(iOS 13.0, *) {
Task { @MainActor in
if let attAd {
attBannerFeature.onClick(ad: attAd)
} else {
let openPinnedChatUseCase = PinnedChatsContainer.shared.openPinnedChatUseCase()
openPinnedChatUseCase(nicegramItem.chat)
}
let openPinnedChatUseCase = PinnedChatsContainer.shared.openPinnedChatUseCase()
openPinnedChatUseCase(nicegramItem.chat)

interaction.clearHighlightAnimated(true)
}
Expand Down Expand Up @@ -1224,11 +1210,6 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {

var item: ChatListItem?

// MARK: Nicegram ATT
private var attClaimAnimationView: AttClaimAnimationView?
private var attClaimAnimationCancellable: AnyCancellable?
//

private let backgroundNode: ASDisplayNode
private let highlightedBackgroundNode: ASDisplayNode

Expand Down Expand Up @@ -1483,16 +1464,6 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
)
}
self.authorNode.visibilityStatus = self.visibilityStatus

// MARK: Nicegram ATT
if self.visibilityStatus, let item {
if let attAd = item.attAd {
item.attBannerFeature.onView(ad: attAd)
} else if let nicegramItem = item.nicegramItem {
PinnedChatsUI.trackChatView(nicegramItem.chat)
}
}
//
}
}
}
Expand Down Expand Up @@ -1854,13 +1825,6 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
}
//

// MARK: Nicegram ATT
attClaimAnimationCancellable = item.attBannerFeature.claimAnimationPublisher
.sink { [weak self] result in
self?.attClaimAnimationView?.animate(value: result.claimAmount)
}
//

self.contextContainer.isGestureEnabled = enablePreview && !item.editing
}

Expand Down Expand Up @@ -4515,27 +4479,6 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
strongSelf.mutedIconNode.isHidden = true
}

// MARK: Nicegram ATT
if item.attAd != nil {
let attClaimAnimationView: AttClaimAnimationView
if let current = strongSelf.attClaimAnimationView {
attClaimAnimationView = current
} else {
attClaimAnimationView = AttClaimAnimationView()
attClaimAnimationView.set(coinOpacity: 0)
strongSelf.attClaimAnimationView = attClaimAnimationView
strongSelf.mainContentContainerNode.view.addSubview(attClaimAnimationView)
}

let iconSize = CGSize(width: 20, height: 20)
transition.updateFrame(view: attClaimAnimationView, frame: CGRect(origin: CGPoint(x: nextTitleIconOrigin, y: floorToScreenPixels(titleFrame.maxY - lastLineRect.height * 0.5 - iconSize.height / 2.0) - UIScreenPixel), size: iconSize))
nextTitleIconOrigin += attClaimAnimationView.bounds.width + 4.0
} else if let attClaimAnimationView = strongSelf.attClaimAnimationView {
strongSelf.attClaimAnimationView = nil
attClaimAnimationView.removeFromSuperview()
}
//

let separatorInset: CGFloat
if case let .groupReference(groupReferenceData) = item.content, groupReferenceData.hiddenByDefault {
separatorInset = 0.0
Expand Down Expand Up @@ -4723,14 +4666,10 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
case RevealOptionKey.unpin.rawValue:
self.setRevealOptionsOpened(false, animated: true)

if let ad = item.attAd {
item.attBannerFeature.onRemoveAdClick(ad: ad)
} else {
Task { @MainActor in
PinnedChatsUI.unpin(
nicegramItem.chat
)
}
Task { @MainActor in
PinnedChatsUI.unpin(
nicegramItem.chat
)
}
default:
break
Expand Down
37 changes: 14 additions & 23 deletions submodules/ChatListUI/Sources/Node/ChatListNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1276,11 +1276,6 @@ public final class ChatListNode: ListView {
private var dequeuedInitialTransitionOnLayout = false
private var enqueuedTransition: (ChatListNodeListViewTransition, () -> Void)?

// MARK: Nicegram PinnedChats
public let isOnScreen = CurrentValueSubject<Bool, Never>(false)
private var cancellables = Set<AnyCancellable>()
//

public private(set) var currentState: ChatListNodeState
private let statePromise: ValuePromise<ChatListNodeState>
public var state: Signal<ChatListNodeState, NoError> {
Expand Down Expand Up @@ -2259,24 +2254,16 @@ public final class ChatListNode: ListView {
}

// MARK: Nicegram PinnedChats
let nicegramItems = CurrentValueSubject<[PinnedChatToDisplay], Never>([])
let nicegramItemsSignal = nicegramItems
.eraseToAnyPublisher()
.toSignal()
.skipError()

PinnedChatsContainer.shared.getPinnedChatsToDisplayUseCase()
.publisher()
.map { $0.reversed() }
.combineLatestThreadSafe(
isOnScreen.eraseToAnyPublisher()
)
.sink { items, isOnScreen in
if isOnScreen {
nicegramItems.value = items
}
}
.store(in: &cancellables)
let nicegramItemsSignal: Signal<[PinnedChatToDisplay], NoError>
if #available(iOS 13.0, *) {
nicegramItemsSignal = PinnedChatsContainer.shared.getPinnedChatsToDisplayUseCase()
.publisher()
.map { $0.reversed() }
.toSignal()
.skipError()
} else {
nicegramItemsSignal = .single([])
}
//

// MARK: Nicegram HiddenChats
Expand Down Expand Up @@ -2367,6 +2354,10 @@ public final class ChatListNode: ListView {
if case .forum(_) = location {
nicegramItems = []
}

if #available(iOS 13.0, *) {
PinnedChatsUI.trackChatsView(nicegramItems.map(\.chat))
}
//

let innerIsMainTab = location == .chatList(groupId: .root) && chatListFilter == nil
Expand Down
24 changes: 20 additions & 4 deletions submodules/DebugSettingsUI/Sources/DebugController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,24 @@ private enum DebugControllerEntry: ItemListNodeEntry {
})
case .sendNGLogs:
return ItemListDisclosureItem(presentationData: presentationData, title: "Send Nicegram Logs", label: "", sectionId: self.section, style: .blocks, action: {
let _ = (Logger(rootPath: arguments.sharedContext.basePath, basePath: arguments.sharedContext.basePath + "/ngLogs").collectLogs()
|> deliverOnMainQueue).start(next: { logs in
let ngLogs = Logger(
rootPath: arguments.sharedContext.basePath,
basePath: arguments.sharedContext.basePath + "/ngLogs"
).collectLogs()

let accountPathName: String? = if let context = arguments.context {
accountRecordIdPathName(context.account.id)
} else {
nil
}
let callRecorderLogs = Logger.shared.collectLogs(
with: arguments.sharedContext.basePath,
accountPathName: accountPathName
)

let _ = (combineLatest(ngLogs, callRecorderLogs) |> deliverOnMainQueue)
.start(next: { logs in
let allLogs = logs.0 + logs.1
guard let context = arguments.context else {
return
}
Expand All @@ -750,8 +766,8 @@ private enum DebugControllerEntry: ItemListNodeEntry {

if let strongController = controller {
strongController.dismiss()
let messages = logs.map { (name, path) -> EnqueueMessage in

let messages = allLogs.map { (name, path) -> EnqueueMessage in
let id = Int64.random(in: Int64.min ... Int64.max)
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: LocalFileReferenceMediaResource(localFilePath: path, randomId: id), previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: nil, attributes: [.FileName(fileName: name)], alternativeRepresentations: [])
return .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,6 @@ public func combineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13
}, initialValues: [:], queue: queue)
}

public func combineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, E>(queue: Queue? = nil, _ s1: Signal<T1, E>, _ s2: Signal<T2, E>, _ s3: Signal<T3, E>, _ s4: Signal<T4, E>, _ s5: Signal<T5, E>, _ s6: Signal<T6, E>, _ s7: Signal<T7, E>, _ s8: Signal<T8, E>, _ s9: Signal<T9, E>, _ s10: Signal<T10, E>, _ s11: Signal<T11, E>, _ s12: Signal<T12, E>, _ s13: Signal<T13, E>, _ s14: Signal<T14, E>, _ s15: Signal<T15, E>, _ s16: Signal<T16, E>, _ s17: Signal<T17, E>, _ s18: Signal<T18, E>, _ s19: Signal<T19, E>, _ s20: Signal<T20, E>, _ s21: Signal<T21, E>, _ s22: Signal<T22, E>, _ s23: Signal<T23, E>, _ s24: Signal<T24, E>, _ s25: Signal<T25, E>, _ s26: Signal<T26, E>, _ s27: Signal<T27, E>) -> Signal<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27), E> {
return combineLatestAny([signalOfAny(s1), signalOfAny(s2), signalOfAny(s3), signalOfAny(s4), signalOfAny(s5), signalOfAny(s6), signalOfAny(s7), signalOfAny(s8), signalOfAny(s9), signalOfAny(s10), signalOfAny(s11), signalOfAny(s12), signalOfAny(s13), signalOfAny(s14), signalOfAny(s15), signalOfAny(s16), signalOfAny(s17), signalOfAny(s18), signalOfAny(s19), signalOfAny(s20), signalOfAny(s21), signalOfAny(s22), signalOfAny(s23), signalOfAny(s24), signalOfAny(s25), signalOfAny(s26), signalOfAny(s27)], combine: { values in
return (values[0] as! T1, values[1] as! T2, values[2] as! T3, values[3] as! T4, values[4] as! T5, values[5] as! T6, values[6] as! T7, values[7] as! T8, values[8] as! T9, values[9] as! T10, values[10] as! T11, values[11] as! T12, values[12] as! T13, values[13] as! T14, values[14] as! T15, values[15] as! T16, values[16] as! T17, values[17] as! T18, values[18] as! T19, values[19] as! T20, values[20] as! T21, values[21] as! T22, values[22] as! T23, values[23] as! T24, values[24] as! T25, values[25] as! T26, values[26] as! T27)
}, initialValues: [:], queue: queue)
}

public func combineLatest<T, E>(queue: Queue? = nil, _ signals: [Signal<T, E>]) -> Signal<[T], E> {
if signals.count == 0 {
return single([T](), E.self)
Expand Down
Loading

0 comments on commit fd2a56b

Please sign in to comment.