Skip to content

Commit

Permalink
1.8.7 (354)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis15yo committed Oct 30, 2024
1 parent 56215a3 commit b03f5b4
Show file tree
Hide file tree
Showing 20 changed files with 76 additions and 244 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.

9 changes: 0 additions & 9 deletions Nicegram/NGData/Sources/NGSettings.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import FeatPremium
import Postbox
import Foundation
import NGAppCache

Expand Down Expand Up @@ -109,14 +108,6 @@ public struct NGSettings {

@NGStorage(key: "recordAllCalls", defaultValue: false)
public static var recordAllCalls: Bool

@NGStorage(key: "showFeedTab", defaultValue: false)
public static var showFeedTab: Bool

@NGStorage(key: "feedPeerId", defaultValue: NGSettings.zeroFeedPeerId)
public static var feedPeerId: PeerId

public static let zeroFeedPeerId: PeerId = .init(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt64Value(0))
}

public struct NGWebSettings {
Expand Down
12 changes: 0 additions & 12 deletions Nicegram/NGResources/Images.xcassets/feed.imageset/Contents.json

This file was deleted.

Binary file not shown.
46 changes: 10 additions & 36 deletions Nicegram/NGUI/Sources/NicegramSettingsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ private enum NicegramSettingsControllerEntry: ItemListNodeEntry {
case showCallsTab(String, Bool)
case showNicegramTab
case showTabNames(String, Bool)
case showFeedTab(String, Bool)

case pinnedChatsHeader
case pinnedChat(Int32, PinnedChat)
Expand Down Expand Up @@ -128,7 +127,7 @@ private enum NicegramSettingsControllerEntry: ItemListNodeEntry {

var section: ItemListSectionId {
switch self {
case .TabsHeader, .showContactsTab, .showCallsTab, .showNicegramTab, .showTabNames, .showFeedTab:
case .TabsHeader, .showContactsTab, .showCallsTab, .showNicegramTab, .showTabNames:
return NicegramSettingsControllerSection.Tabs.rawValue
case .FoldersHeader, .foldersAtBottom, .foldersAtBottomNotice:
return NicegramSettingsControllerSection.Folders.rawValue
Expand Down Expand Up @@ -174,9 +173,6 @@ private enum NicegramSettingsControllerEntry: ItemListNodeEntry {
case .showTabNames:
return 1600

case .showFeedTab:
return 1650

case .FoldersHeader:
return 1700

Expand Down Expand Up @@ -272,13 +268,6 @@ private enum NicegramSettingsControllerEntry: ItemListNodeEntry {
} else {
return false
}

case let .showFeedTab(lhsText, lhsVar0Bool):
if case let .showFeedTab(rhsText, rhsVar0Bool) = rhs, lhsText == rhsText, lhsVar0Bool == rhsVar0Bool {
return true
} else {
return false
}

case let .FoldersHeader(lhsText):
if case let .FoldersHeader(rhsText) = rhs, lhsText == rhsText {
Expand Down Expand Up @@ -468,13 +457,6 @@ private enum NicegramSettingsControllerEntry: ItemListNodeEntry {
arguments.presentController(controller, nil)
})

case let .showFeedTab(text, value):
return ItemListSwitchItem(presentationData: presentationData, title: text, value: value, enabled: true, sectionId: section, style: .blocks, updated: { value in
ngLog("[showFeedTab] invoked with \(value)", LOGTAG)
NGSettings.showFeedTab = value
arguments.updateTabs()
})

case let .FoldersHeader(text):
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: section)

Expand Down Expand Up @@ -650,10 +632,6 @@ private func nicegramSettingsControllerEntries(presentationData: PresentationDat
l("NiceFeatures.Tabs.ShowNames"),
NGSettings.showTabNames
))
entries.append(.showFeedTab(
l("Show Feed Tab"),
NGSettings.showFeedTab
))

entries.append(.FoldersHeader(l("NiceFeatures.Folders.Header")))
entries.append(.foldersAtBottom(
Expand Down Expand Up @@ -839,23 +817,19 @@ public func nicegramSettingsController(context: AccountContext, accountsContexts
controller?.view.window?.rootViewController
}
updateTabsImpl = {
updateTabs(with: context)
}
return controller
}

public func updateTabs(with context: AccountContext) {
_ = updateCallListSettingsInteractively(accountManager: context.sharedContext.accountManager) { settings in
var settings = settings
settings.showTab = !settings.showTab
return settings
}.start(completed: {
_ = updateCallListSettingsInteractively(accountManager: context.sharedContext.accountManager) { settings in
var settings = settings
settings.showTab = !settings.showTab
return settings
}.start(completed: {
ngLog("Tabs refreshed", LOGTAG)
_ = updateCallListSettingsInteractively(accountManager: context.sharedContext.accountManager) { settings in
var settings = settings
settings.showTab = !settings.showTab
return settings
}.start(completed: {
ngLog("Tabs refreshed", LOGTAG)
})
})
})
}
return controller
}
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" : "[email protected]:mobyrix/nicegram-assistant-ios.git",
"state" : {
"branch" : "develop",
"revision" : "66d6fe9535b718018566630c5407c383ad20651d"
"revision" : "b1d4897f36e71c8faef3a06278d503c42f737e98"
}
},
{
Expand Down
4 changes: 0 additions & 4 deletions Telegram/Telegram-iOS/en.lproj/NiceLocalizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,3 @@
"NicegramCallRecord.StopAlertButtonCancel" = "Cancel";
"NicegramCallRecord.SavedMessage" = "Recorded Call saved to **Saved Messages**.";

/*Feed*/
"NicegramFeed.Title" = "Feed";
"NicegramFeed.Add" = "Add to Feed";
"NicegramFeed.Remove" = "Remove from Feed";
2 changes: 2 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"project_id": "378913"
"api_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJ3UUVxdmhVM3ZMT2EyWGljbVV5VCIsImp0aSI6IjY0MDRiZTFlOGIyOTVhNzg2ZGEyYmI0MmZmYjAwN2MyYmQ3MmM4MGI0YzJhZGEzNTk4MzBmMjEzZjQ4ZGFhNDkxYTcyNjgwYjJiYzFkOTUyIiwiaWF0IjoxNzIyODYzNDcxLjcwNDc3NywibmJmIjoxNzIyODYzNDcxLjcwNDc3OSwiZXhwIjoxNzU0Mzk5NDcxLjYyOTI5Mywic3ViIjoiMTUyNDUwMTYiLCJzY29wZXMiOlsicHJvamVjdCJdLCJkb21haW4iOm51bGwsImFzc29jaWF0aW9ucyI6WyIqIl0sInNlc3Npb24iOjB9.dLOqTsIngzAsXnrh2PRnzAtZVtosy0dnIPWViL9kVYnxGCGL3LJMPZ_cji-G9aHPhgmxERmBNeMp4Pynw7Y7NbtpT0QmgL9Gn6Ljjd5TTGwwS1UX81m-l69J6wTd1sRufs8X9vIAkxp-3boW7N0BkasBm9gRr_fBlnOFX_yV6mYj-gB5bRxI2CmakUcRVVZFk7hNfRT1LZnn60ghSllSoXM4dGF647Ey_Qm8kgerVqy1cshKc1X8jBKVLTXPTPnIpTESp4pFFbmDUlcnvvLa76FbW-5qBDXjPIEl6ASCqR8pIRV8Bh3n6-oaean7WBb_ZwPkrwxVczGlRd2io8xhVpQq33P6ebSnHp8hZFGS7kYyBZqBRfgzYTBSnNUCTWd-SQJzVeGiqzO-Qodi30X4AA7_nDYNun_soY3ma5sJsdaq2muMKXP2uWV9epLHp-VSTcIWEki0ozZqHKkUVlfzoWhtBKfQbLa5G48LQB9PVgOj3CQ4qgY8FPPdPk29-R_ytnQkXFTHXpudH0Ga_hrM7xtqYNmCttAVYZMGRoFZqH8GZs5KjSG2c0F9-x0554qi0fLgczJDOW15zjwZXRyUtqTD4SGaKQPvtYQn6AxBVRsUlLVUpPH7OLo8Kn7gMu3bx6fJhIURC6kA_Ap9YEgcnMRTuY_pTXSJi3VCJqP2iSw"
"base_path": "."
"base_url": "https://api.crowdin.com"
"preserve_hierarchy": true
Expand Down
4 changes: 0 additions & 4 deletions submodules/AccountContext/Sources/AccountContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1164,10 +1164,6 @@ public protocol AccountContext: AnyObject {
func scheduleGroupCall(peerId: PeerId, parentController: ViewController)
func joinGroupCall(peerId: PeerId, invite: String?, requestJoinAsPeerId: ((@escaping (PeerId?) -> Void) -> Void)?, activeCall: EngineGroupCallDescription)
func requestCall(peerId: PeerId, isVideo: Bool, completion: @escaping () -> Void)
// MARK: Nicegram NCG-6373 Feed tab
var updateFeed: Signal<Void, NoError> { get }
func needUpdateFeed()
//
}

public struct AntiSpamBotConfiguration {
Expand Down
38 changes: 0 additions & 38 deletions submodules/ChatListUI/Sources/ChatContextMenus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
import FeatHiddenChats
import NGStrings
//
// MARK: Nicegram NCG-6373 Feed tab
import NGData
import NGUI
//
import Foundation
import UIKit
import SwiftSignalKit
Expand Down Expand Up @@ -120,41 +116,7 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, promoInfo: Ch
}

var items: [ContextMenuItem] = []
// MARK: Nicegram NCG-6373 Feed tab
if case .chatList = source {
let isFeedPeerEqualPeer = NGSettings.feedPeerId == peerId
let text = isFeedPeerEqualPeer ? l("NicegramFeed.Remove") : l("NicegramFeed.Add")
let color: ContextMenuActionItemTextColor = isFeedPeerEqualPeer ? .destructive : .primary
items.append(
.action(ContextMenuActionItem(
text: text,
textColor: color,
icon: { theme in
let color = isFeedPeerEqualPeer ? theme.contextMenu.destructiveColor : theme.contextMenu.primaryColor
return generateTintedImage(image: UIImage(bundleImageName: "feed"), color: color)
},
action: { _, f in
if isFeedPeerEqualPeer {
NGSettings.feedPeerId = NGSettings.zeroFeedPeerId
updateTabs(with: context)
} else {
let needUpdateTabs =
!NGSettings.showFeedTab ||
NGSettings.feedPeerId == NGSettings.zeroFeedPeerId

NGSettings.feedPeerId = peerId
if needUpdateTabs {
NGSettings.showFeedTab = true
updateTabs(with: context)
}
}
context.needUpdateFeed()
f(.default)
}
))
)
}
//
if case let .search(search) = source {
switch search {
case .recentPeers:
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
30 changes: 29 additions & 1 deletion submodules/TelegramCore/Sources/Utils/Log.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,35 @@ public final class Logger {
return EmptyDisposable
}
}

// MARK: Nicegram NCG-5828 call recording
public func collectLogs(
with basePath: String,
accountPathName: String?
) -> Signal<[(String, String)], NoError> {
guard let accountPathName else { return .never() }

return Signal { subscriber in
self.queue.async {
let logsPath: String = basePath + "/\(accountPathName)/calls"
var result: [(Date, String, String)] = []
if let files = try? FileManager.default.contentsOfDirectory(at: URL(fileURLWithPath: logsPath), includingPropertiesForKeys: [URLResourceKey.creationDateKey], options: []) {
for url in files {
if url.lastPathComponent.hasSuffix(".log") {
if let creationDate = (try? url.resourceValues(forKeys: Set([.creationDateKey])))?.creationDate {
result.append((creationDate, url.lastPathComponent, url.path))
}
}
}
}
result.sort(by: { $0.0 < $1.0 })
subscriber.putNext(result.map { ($0.1, $0.2) })
subscriber.putCompletion()
}

return EmptyDisposable
}
}
//
public func collectShortLog() -> Signal<[(Double, String)], NoError> {
return Signal { subscriber in
self.queue.async {
Expand Down
9 changes: 0 additions & 9 deletions submodules/TelegramUI/Sources/AccountContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,7 @@ public final class AccountContextImpl: AccountContext {
public private(set) var isPremium: Bool

public let imageCache: AnyObject?
// MARK: Nicegram NCG-6373 Feed tab
private let _updateFeed = Promise<Void>()
public var updateFeed: Signal<Void, NoError> {
_updateFeed.get()
}

public func needUpdateFeed() {
_updateFeed.set(.single(()))
}
//
public init(sharedContext: SharedAccountContextImpl, account: Account, limitsConfiguration: LimitsConfiguration, contentSettings: ContentSettings, appConfiguration: AppConfiguration, availableReplyColors: EngineAvailableColorOptions, availableProfileColors: EngineAvailableColorOptions, temp: Bool = false)
{
self.sharedContextImpl = sharedContext
Expand Down
2 changes: 1 addition & 1 deletion submodules/TelegramUI/Sources/ApplicationContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ final class AuthorizedApplicationContext {
private var showCallsTab: Bool
private var showCallsTabDisposable: Disposable?
private var enablePostboxTransactionsDiposable: Disposable?

init(sharedApplicationContext: SharedApplicationContext, mainWindow: Window1, watchManagerArguments: Signal<WatchManagerArguments?, NoError>, context: AccountContextImpl, accountManager: AccountManager<TelegramAccountManagerTypes>, showCallsTab: Bool, reinitializedNotificationSettings: @escaping () -> Void) {
self.sharedApplicationContext = sharedApplicationContext

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ import AdsInfoScreen

extension ChatControllerImpl {
func loadDisplayNodeImpl() {
self.displayNode = ChatControllerNode(context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, subject: self.subject, controllerInteraction: self.controllerInteraction!, chatPresentationInterfaceState: self.presentationInterfaceState, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings, navigationBar: self.navigationBar, statusBar: self.statusBar, backgroundNode: self.chatBackgroundNode, controller: self, isFeed: self.isFeed)
self.displayNode = ChatControllerNode(context: self.context, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, subject: self.subject, controllerInteraction: self.controllerInteraction!, chatPresentationInterfaceState: self.presentationInterfaceState, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings, navigationBar: self.navigationBar, statusBar: self.statusBar, backgroundNode: self.chatBackgroundNode, controller: self)

if let currentItem = self.tempVoicePlaylistCurrentItem {
self.chatDisplayNode.historyNode.voicePlaylistItemChanged(nil, currentItem)
Expand Down
15 changes: 4 additions & 11 deletions submodules/TelegramUI/Sources/ChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
self.chatDisplayNode.showListEmptyResults = self.showListEmptyResults
}
}
// MARK: Nicegram NCG-6373 Feed tab
let isFeed: Bool
//
// MARK: Nicegram NCG-6373 Feed tab, isFeed

public init(
context: AccountContext,
chatLocation: ChatLocation,
Expand All @@ -669,12 +666,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
chatListFilter: Int32? = nil,
chatNavigationStack: [ChatNavigationStackItem] = [],
customChatNavigationStack: [EnginePeer.Id]? = nil,
params: ChatControllerParams? = nil,
isFeed: Bool = false
params: ChatControllerParams? = nil
) {
// MARK: Nicegram NCG-6373 Feed tab
self.isFeed = isFeed
//
let _ = ChatControllerCount.modify { value in
return value + 1
}
Expand Down Expand Up @@ -5876,8 +5869,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
return interfaceState
}
})
// MARK: Nicegram NCG-6373 Feed tab, !isFeed
if case .standard(.default) = mode, let channel = renderedPeer?.chatMainPeer as? TelegramChannel, case .broadcast = channel.info, !isFeed {

if case .standard(.default) = mode, let channel = renderedPeer?.chatMainPeer as? TelegramChannel, case .broadcast = channel.info {
var isRegularChat = false
if let subject = subject {
if case .message = subject {
Expand Down
Loading

0 comments on commit b03f5b4

Please sign in to comment.