Skip to content

Commit

Permalink
1.9.9 (457)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis15yo committed Feb 26, 2025
1 parent befa0f5 commit 86e401f
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 42 deletions.
4 changes: 2 additions & 2 deletions MODULE.bazel.lock

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

2 changes: 1 addition & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"location" : "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git",
"state" : {
"branch" : "develop",
"revision" : "76bd43153b01ed55a46ec9ff0c2e5db1c2dcc544"
"revision" : "6211ab244afbd77d0fce224e174c67eb5a06046f"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,36 @@ private final class SpyOnFriendsContextImpl {
return .single(nil)
}

let maxId = self.commonChats.last?.peerId.id

return network.request(Api.functions.messages.getCommonChats(
userId: inputUser,
maxId: maxId?._internalGetInt64Value() ?? 0,
limit: self.limit)
)
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.messages.Chats?, NoError> in
return .single(nil)
if peerId == self.account.peerId {
switch inputUser {
case let .inputUser(_, accessHash):
return fetchChatList(
accountPeerId: peerId,
postbox: account.postbox,
network: account.network,
location: .general,
upperBound: .absoluteUpperBound(),
hash: accessHash,
limit: self.limit
)
|> map { result in
Api.messages.Chats.chats(chats: result?.peers.chats.map { $0.value } ?? [])
}
default:
return .single(nil)
}
} else {
let maxId = self.commonChats.last?.peerId.id

return network.request(Api.functions.messages.getCommonChats(
userId: inputUser,
maxId: maxId?._internalGetInt64Value() ?? 0,
limit: self.limit
))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.messages.Chats?, NoError> in
return .single(nil)
}
}
}

Expand Down Expand Up @@ -168,22 +188,16 @@ private final class SpyOnFriendsContextImpl {

private func loadMessages() {
let peerId = self.peerId
let maxDate: Int32? = if let lastUpdatedDate = lastUpdatedDate()?.timeIntervalSince1970 {
Int32(lastUpdatedDate)
} else {
nil
}

let signal = combineLatest(
commonChats.map { chat -> Signal<(Api.Chat?, [Message]), NoError> in
let location = SearchMessagesLocation.peer(
peerId: chat.peerId,
fromId: peerId,
tags: /*[.file, .music, .webPage, .gif, .photo, .video]*/nil,
tags: nil,
reactions: nil,
threadId: nil,
minDate: nil,
maxDate: maxDate
maxDate: nil
)

return self.engine.messages.searchMessages(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private func preparedTransition(
share: @escaping () -> Void
) -> SpyOnFriendsListTransaction {
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)

let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
let insertions = indicesAndItems.map {
ListViewInsertItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1023,28 +1023,26 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
let groupsInCommon: GroupsInCommonContext?
// MARK: Nicegram NCG-7303 Spy on friends
var spyOnFriends: SpyOnFriendsContext? = nil
let feature = SpyOnFriendsFeature(navigator: SpyOnFriendsNavigatorImpl())

if (isPremium() || isPremiumPlus()) &&
feature.checkIfNeedUpdate(with: userPeerId.id._internalGetInt64Value()) {
feature.updateLastUpdated(with: userPeerId.id._internalGetInt64Value())
sendSpyOnFriendsAnalytics(with: .usage)
}

spyOnFriends = SpyOnFriendsContext(
account: context.account,
engine: context.engine,
peerId: userPeerId
) {
feature.getLastUpdated(with: userPeerId.id._internalGetInt64Value())
}
//
if isMyProfile {
groupsInCommon = nil
} else if [.user, .bot].contains(kind) {
groupsInCommon = GroupsInCommonContext(account: context.account, peerId: userPeerId, hintGroupInCommon: hintGroupInCommon)
// MARK: Nicegram NCG-7303 Spy on friends
let feature = SpyOnFriendsFeature(navigator: SpyOnFriendsNavigatorImpl())

if (isPremium() || isPremiumPlus()) &&
feature.checkIfNeedUpdate(with: userPeerId.id._internalGetInt64Value()) {
feature.updateLastUpdated(with: userPeerId.id._internalGetInt64Value())
sendSpyOnFriendsAnalytics(with: .usage)
}

spyOnFriends = SpyOnFriendsContext(
account: context.account,
engine: context.engine,
peerId: userPeerId
) {
feature.getLastUpdated(with: userPeerId.id._internalGetInt64Value())
}
//
} else {
groupsInCommon = nil
}
Expand Down Expand Up @@ -1446,12 +1444,10 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
enableQRLogin: false)
}
// MARK: Nicegram NCG-7303 Spy on friends
// if user.botInfo != nil && !user.id.isVerificationCodes {
if #available(iOS 15.0, *),
let user = peer as? TelegramUser,
!(user.botInfo != nil && !user.id.isVerificationCodes), // checking is bot
user.id.id._internalGetInt64Value() != 777000, //checking for telegram login bot
peer?.id != context.account.peerId {
user.id.id._internalGetInt64Value() != 777000 { //checking for telegram login bot
if availablePanes != nil {
availablePanes?.insert(.spyOnFriends, at: 0)
} else {
Expand Down

0 comments on commit 86e401f

Please sign in to comment.