Skip to content

Commit

Permalink
1.9.8 (449)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis15yo committed Feb 20, 2025
1 parent 2dfd37e commit d112f26
Show file tree
Hide file tree
Showing 23 changed files with 1,372 additions and 263 deletions.
12 changes: 6 additions & 6 deletions MODULE.bazel.lock

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

21 changes: 3 additions & 18 deletions Nicegram/NGUI/Sources/NicegramSettingsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import AccountContext
import Display
import FeatAiShortcuts
import FeatImagesHubUI
import FeatNicegramHub
import FeatPinnedChats
Expand Down Expand Up @@ -80,7 +79,6 @@ private enum NicegramSettingsControllerSection: Int32 {

private enum EasyToggleType {
case showNicegramButtonInChat
case showAiShortcutsInChat
case sendWithEnter
case showProfileId
case showRegDate
Expand Down Expand Up @@ -543,11 +541,6 @@ private enum NicegramSettingsControllerEntry: ItemListNodeEntry {
switch (toggleType) {
case .showNicegramButtonInChat:
NGSettings.showNicegramButtonInChat = value
case .showAiShortcutsInChat:
Task {
let updateSettingsUseCase = AiShortcutsModule.shared.updateSettingsUseCase()
await updateSettingsUseCase.set(showInChat: value)
}
case .sendWithEnter:
NGSettings.sendWithEnter = value
case .showProfileId:
Expand Down Expand Up @@ -679,7 +672,7 @@ private enum NicegramSettingsControllerEntry: ItemListNodeEntry {

// MARK: Entries list

private func nicegramSettingsControllerEntries(presentationData: PresentationData, experimentalSettings: ExperimentalUISettings, showCalls: Bool, pinnedChats: [NicegramSettingsControllerEntry.PinnedChat], sharingSettings: SharingSettings?, aiShortcutsSettings: FeatAiShortcuts.Settings, context: AccountContext) -> [NicegramSettingsControllerEntry] {
private func nicegramSettingsControllerEntries(presentationData: PresentationData, experimentalSettings: ExperimentalUISettings, showCalls: Bool, pinnedChats: [NicegramSettingsControllerEntry.PinnedChat], sharingSettings: SharingSettings?, context: AccountContext) -> [NicegramSettingsControllerEntry] {
let nicegramSettings = getNicegramSettings()

var entries: [NicegramSettingsControllerEntry] = []
Expand Down Expand Up @@ -758,9 +751,6 @@ private func nicegramSettingsControllerEntries(presentationData: PresentationDat
entries.append(.easyToggle(toggleIndex, .showNicegramButtonInChat, l("ShowNicegramButtonInChat"), NGSettings.showNicegramButtonInChat))
toggleIndex += 1

entries.append(.easyToggle(toggleIndex, .showAiShortcutsInChat, l("ShowAIShortcutsInChat"), aiShortcutsSettings.showInChat))
toggleIndex += 1

entries.append(.easyToggle(toggleIndex, .sendWithEnter, l("SendWithKb"), NGSettings.sendWithEnter))
toggleIndex += 1

Expand Down Expand Up @@ -950,13 +940,8 @@ public func nicegramSettingsController(context: AccountContext, accountsContexts
} else {
sharingSettingsSignal = .single(nil)
}

let aiShortcutsSettingsSignal = AiShortcutsModule.shared.getSettingsUseCase()
.publisher()
.toSignal()
.skipError()

let signal = combineLatest(context.sharedContext.presentationData, sharedDataSignal, showCallsTab, pinnedChatsSignal, sharingSettingsSignal, aiShortcutsSettingsSignal) |> map { presentationData, sharedData, showCalls, pinnedChats, sharingSettings, aiShortcutsSettings -> (ItemListControllerState, (ItemListNodeState, Any)) in
let signal = combineLatest(context.sharedContext.presentationData, sharedDataSignal, showCallsTab, pinnedChatsSignal, sharingSettingsSignal) |> map { presentationData, sharedData, showCalls, pinnedChats, sharingSettings -> (ItemListControllerState, (ItemListNodeState, Any)) in

let experimentalSettings: ExperimentalUISettings = sharedData.entries[ApplicationSpecificSharedDataKeys.experimentalUISettings]?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings

Expand All @@ -967,7 +952,7 @@ public func nicegramSettingsController(context: AccountContext, accountsContexts
})
}

let entries = nicegramSettingsControllerEntries(presentationData: presentationData, experimentalSettings: experimentalSettings, showCalls: showCalls, pinnedChats: pinnedChats, sharingSettings: sharingSettings, aiShortcutsSettings: aiShortcutsSettings, context: context)
let entries = nicegramSettingsControllerEntries(presentationData: presentationData, experimentalSettings: experimentalSettings, showCalls: showCalls, pinnedChats: pinnedChats, sharingSettings: sharingSettings, context: context)
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(l("AppName")), leftNavigationButton: leftNavigationButton, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back))
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: entries, style: .blocks)

Expand Down
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" : "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git",
"state" : {
"branch" : "feat/ai-shortcuts",
"revision" : "b6811d8dcbeca9525fdf8e7368fb020682fe173e"
"branch" : "feat/NCG-7303_spy_on_friends",
"revision" : "2a7c71de73ca9dc7b14bc30d7dbdfd1b93fea928"
}
},
{
"identity" : "nicegram-wallet-ios",
"kind" : "remoteSourceControl",
"location" : "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git",
"state" : {
"branch" : "develop",
"revision" : "35ee7a33d5f60d40f6d3857c107bd4d8b0769cd3"
"branch" : "feat/NCG-7303_spy_on_friends",
"revision" : "0d12be95114430db63569f04a08ec962733ed2d7"
}
},
{
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: "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git", branch: "feat/ai-shortcuts"),
.package(url: "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git", branch: "develop")
.package(url: "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git", branch: "feat/NCG-7303_spy_on_friends"),
.package(url: "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git", branch: "feat/NCG-7303_spy_on_friends")
]
)
4 changes: 3 additions & 1 deletion Telegram/Telegram-iOS/en.lproj/NiceLocalizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
"Gmod.Disable" = "Disable Preview Mode?";

"ShowNicegramButtonInChat" = "Show Nicegram button in chat";
"ShowAIShortcutsInChat" = "Show AI Shortcuts in Chat";
"SendWithKb" = "Send with «Enter» button";
"NiceFeatures.ShowGmodIcon" = "Show Preview Mode icon";
"Gmod.OpenChatQ" = "Open chat?";
Expand Down Expand Up @@ -241,3 +240,6 @@
/*Stars Purchase*/
"StarsPurchase.GetOnFragment" = "Get on Fragment";
"StarsPurchase.GetOnTelegram" = "Get on Telegram";

/*Spy On Friends*/
"SpyOnFriends.Title" = "Activities";
2 changes: 1 addition & 1 deletion ng-env.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
test
prod
Original file line number Diff line number Diff line change
Expand Up @@ -504,35 +504,6 @@ final class ChatSendMessageContextScreenComponent: Component {

var items: [ContextMenuItem] = []

// MARK: Nicegram AiChat
if textString.length > 0 {
let commands = TgChatAiHelper.getCommandsForInputText()
for command in commands {
items.append(.action(ContextMenuActionItem(
id: AnyHashable(command.id),
text: command.title,
icon: { _ in nil },
action: { [weak self] _, _ in
guard let self, let component = self.component else {
return
}
self.animateOutToEmpty = true

let request = TgChatAiRequst(
peerId: component.peerId?.id._internalGetInt64Value(),
command: command,
text: component.textInputView.text
)
TgChatAiHelper.send(request: request)

self.environment?.controller()?.dismiss()
}
)))
}
items.append(.separator)
}
//

let canAdjustMediaCaptionPosition: Bool
switch component.params {
case let .sendMessage(sendMessage):
Expand Down Expand Up @@ -701,6 +672,40 @@ final class ChatSendMessageContextScreenComponent: Component {
)))
}

// MARK: Nicegram AiChat
if let improveWritingCommand = TgChatAiHelper.improveWritingCommand() {
if case .separator = items.last {} else {
items.append(.separator)
}

items.append(.action(ContextMenuActionItem(
id: AnyHashable("improveWriting"),
text: improveWritingCommand.title,
icon: { theme in
generateTintedImage(
image: UIImage(systemName: "wand.and.stars"),
color: theme.contextMenu.primaryColor
)
},
action: { [weak self] _, _ in
guard let self, let component = self.component else {
return
}
self.animateOutToEmpty = true

let request = TgChatAiRequst(
peerId: component.peerId?.id._internalGetInt64Value(),
command: improveWritingCommand,
text: component.textInputView.text
)
TgChatAiHelper.send(request: request)

self.environment?.controller()?.dismiss()
}
)))
}
//

// MARK: Nicegram TranslateEnteredMessage
if component.nicegramData.canTranslate {
if case .separator = items.last {} else {
Expand Down
13 changes: 2 additions & 11 deletions submodules/Display/Source/Navigation/NavigationContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ public final class NavigationContainer: ASDisplayNode, ASGestureRecognizerDelega
}

public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
// MARK: Nicegram
if otherGestureRecognizer.isNicegramExclusiveGesture() {
// MARK: Nicegram AiChat
if otherGestureRecognizer.name == "AiChatCommandsPanGestureRecognizer" {
return false
}
//
Expand All @@ -214,15 +214,6 @@ public final class NavigationContainer: ASDisplayNode, ASGestureRecognizerDelega
return false
}

// MARK: Nicegram
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRequireFailureOf otherGestureRecognizer: UIGestureRecognizer) -> Bool {
if otherGestureRecognizer.isNicegramExclusiveGesture() {
return true
}
return false
}
//

@objc private func panGesture(_ recognizer: UIPanGestureRecognizer) {
switch recognizer.state {
case .began:
Expand Down
46 changes: 0 additions & 46 deletions submodules/Display/Source/Nicegram/NicegramUtils.swift

This file was deleted.

5 changes: 0 additions & 5 deletions submodules/Display/Source/WindowContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,6 @@ public final class WindowKeyboardGestureRecognizerDelegate: NSObject, UIGestureR
}

public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
// MARK: Nicegram
if otherGestureRecognizer.isNicegramExclusiveGesture() {
return false
}
//
return true
}

Expand Down
Loading

0 comments on commit d112f26

Please sign in to comment.