Skip to content

Commit

Permalink
Release 1.4.3 (178)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis15yo committed Oct 17, 2023
1 parent 82b0728 commit 0b60072
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Nicegram/NGTranslate/Sources/GTranslate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public func getGoogleLang(_ userLang: String) -> String {

// Google lang for Chineses
switch (lang) {
case "zh-hans":
case "zh-hans", "zh":
return "zh-CN"
case "zh-hant":
return "zh-TW"
Expand Down
2 changes: 1 addition & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"location" : "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git",
"state" : {
"branch" : "develop",
"revision" : "34a8009b7beb51b8d18a90446134c7e166bd8ff9"
"revision" : "34cbe2865492b059e6eb4d423731b93e09c3f39e"
}
},
{
Expand Down
46 changes: 46 additions & 0 deletions submodules/ChatListUI/Sources/ChatListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,23 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
)))

// MARK: Nicegram Assistant
if #available(iOS 15.0, *) {
self.primaryContext?.nicegramButton = AnyComponentWithIdentity(
id: "nicegram",
component: AnyComponent(NicegramButtonComponent(
pressed: {
Task {
AssistantUITgHelper.routeToAssistant(
source: .generic
)
}
}
))
)
}
//

//let backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.DialogList_Title, style: .plain, target: nil, action: nil)
//backBarButtonItem.accessibilityLabel = self.presentationData.strings.Common_Back
//self.navigationItem.backBarButtonItem = backBarButtonItem
Expand Down Expand Up @@ -2132,6 +2149,16 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController

override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

// MARK: Nicegram
if #available(iOS 15.0, *), !didAppear {
Task {
if await AssistantTgHelper.shouldShowGemAnimation() {
showGemAnimation()
}
}
}
//

if self.powerSavingMonitoringDisposable == nil {
self.powerSavingMonitoringDisposable = (self.context.sharedContext.automaticMediaDownloadSettings
Expand Down Expand Up @@ -4456,6 +4483,16 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
}

@available(iOS 13.0, *)
private func showGemAnimation() {
findAssistantButton()?.showGemAnimation()
}

@available(iOS 13.0, *)
private func findAssistantButton() -> AssistantButton? {
view.viewWithTag(AssistantButton.tag) as? AssistantButton
}

@available(iOS 13.0, *)
private func nicegramInit() {
RepoTgHelper.setTelegramId(context.account.peerId.id._internalGetInt64Value())
Expand Down Expand Up @@ -5959,6 +5996,10 @@ private final class ChatListLocationContext {
private(set) var chatTitleComponent: ChatTitleComponent?
private(set) var chatListTitle: NetworkStatusTitle?

// MARK: Nicegram Assistant
var nicegramButton: AnyComponentWithIdentity<NavigationButtonComponentEnvironment>?
//

var leftButton: AnyComponentWithIdentity<NavigationButtonComponentEnvironment>?
var rightButton: AnyComponentWithIdentity<NavigationButtonComponentEnvironment>?
var proxyButton: AnyComponentWithIdentity<NavigationButtonComponentEnvironment>?
Expand All @@ -5975,6 +6016,11 @@ private final class ChatListLocationContext {
if let proxyButton = self.proxyButton {
result.append(proxyButton)
}
// MARK: Nicegram Assistant
if let nicegramButton = self.nicegramButton {
result.append(nicegramButton)
}
//
return result
}

Expand Down
29 changes: 29 additions & 0 deletions submodules/ChatListUI/Sources/NicegramButtonComponent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import ChatListHeaderComponent
import ComponentFlow
import NGAssistantUI
import UIKit

@available(iOS 13.0, *)
class NicegramButtonComponent: Component {
typealias EnvironmentType = NavigationButtonComponentEnvironment

let pressed: () -> Void

init(pressed: @escaping () -> Void) {
self.pressed = pressed
}

static func == (lhs: NicegramButtonComponent, rhs: NicegramButtonComponent) -> Bool {
return true
}

func makeView() -> AssistantButton {
return AssistantButton()
}

func update(view: AssistantButton, availableSize: CGSize, state: EmptyComponentState, environment: Environment<NavigationButtonComponentEnvironment>, transition: Transition) -> CGSize {
view.pressed = pressed

return view.systemLayoutSizeFitting(availableSize)
}
}
4 changes: 3 additions & 1 deletion submodules/MediaPickerUI/Sources/MediaPickerScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
private var requestedCameraAccess = false

// MARK: Nicegram InLab
private let inLabNode = ASDisplayNode { InLabButton() }
private let inLabNode = ASDisplayNode {
InLabButton(location: .galleryAttachment)
}
//

private let containerNode: ASDisplayNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ private enum StickerPackNextAction {
private final class StickerPackContainer: ASDisplayNode {

// MARK: Nicegram StickerMaker
private let stickerMakerNode = ASDisplayNode { StickerMakerButton() }
private let stickerMakerNode = ASDisplayNode {
StickerMakerButton(location: .stickerPack)
}
//

let index: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,9 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate {
private var textField: EmojiSearchTextField?

// MARK: Nicegram StickerMaker
private let stickerMakerButton = StickerMakerButton()
private let stickerMakerButton = StickerMakerButton(
location: .stickerSearch
)
//

private var tapRecognizer: UITapGestureRecognizer?
Expand Down Expand Up @@ -6632,7 +6634,23 @@ public final class EmojiPagerContentComponent: Component {
}
let availableCustomContentSize = availableSize
let customContentViewSize = customContentView.update(theme: keyboardChildEnvironment.theme, strings: keyboardChildEnvironment.strings, useOpaqueTheme: useOpaqueTheme, availableSize: availableCustomContentSize, transition: customContentViewTransition)
customContentViewTransition.setFrame(view: customContentView, frame: CGRect(origin: CGPoint(x: 0.0, y: pagerEnvironment.containerInsets.top + (component.displaySearchWithPlaceholder != nil ? 54.0 : 0.0)), size: customContentViewSize))

// MARK: Nicegram StickerMaker
var searchHeight: CGFloat
if component.displaySearchWithPlaceholder != nil {
searchHeight = 54

if StickerMaker.showConfig.stickerSearch {
let additionalHeight = StickerMakerButton.height + StickerMakerButton.searchStickersConfig.topPadding
searchHeight += additionalHeight
}
} else {
searchHeight = 0
}
//

// MARK: Nicegram StickerMaker, use searchHeight for 'y' calculation
customContentViewTransition.setFrame(view: customContentView, frame: CGRect(origin: CGPoint(x: 0.0, y: pagerEnvironment.containerInsets.top + searchHeight), size: customContentViewSize))

customContentHeight = customContentViewSize.height
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,9 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
actions.append(.action(ContextMenuActionItem(text: StickerMaker.buttonTitle, icon: { theme in
return generateTintedImage(image: StickerMaker.contextMenuIcon, color: theme.actionSheet.primaryTextColor)
}, action: { _, f in
StickerMaker.openFromContextMenu()
StickerMaker.open(
from: .contextMenu
)
f(.dismissWithoutContent)
})))
}
Expand Down
17 changes: 16 additions & 1 deletion submodules/TelegramUI/Sources/TelegramRootController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ public final class TelegramRootController: NavigationController, TelegramRootCon
// MARK: Nicegram Assistant
if #available(iOS 15.0, *) {
let assistantController = NativeControllerWrapper(
controller: AssistantUITgHelper.assistantController(),
controller: AssistantUITgHelper.assistantController(
close: nil
),
accountContext: self.context,
adjustSafeArea: true
)
Expand All @@ -286,9 +288,22 @@ public final class TelegramRootController: NavigationController, TelegramRootCon
let assistantIndex = rootTabController.controllers.firstIndex {
$0 === assistantController
}

if let assistantIndex {
popToRoot(animated: true)
rootTabController.selectedIndex = assistantIndex
} else {
guard let presentingController = UIApplication.topViewController else {
return
}

let controller = AssistantUITgHelper.assistantController(
close: { [weak presentingController] in
presentingController?.dismiss(animated: true)
}
)
controller.modalPresentationStyle = .overFullScreen
presentingController.present(controller, animated: true)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion swift_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def swift_dependencies():
# branch: develop
swift_package(
name = "swiftpkg_nicegram_assistant_ios",
commit = "34a8009b7beb51b8d18a90446134c7e166bd8ff9",
commit = "34cbe2865492b059e6eb4d423731b93e09c3f39e",
dependencies_index = "@//:swift_deps_index.json",
remote = "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git",
)
Expand Down
2 changes: 1 addition & 1 deletion swift_deps_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@
"name": "swiftpkg_nicegram_assistant_ios",
"identity": "nicegram-assistant-ios",
"remote": {
"commit": "34a8009b7beb51b8d18a90446134c7e166bd8ff9",
"commit": "34cbe2865492b059e6eb4d423731b93e09c3f39e",
"remote": "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git",
"branch": "develop"
}
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"app": "1.4.2",
"app": "1.4.3",
"bazel": "6.3.2",
"xcode": "15.0"
}

0 comments on commit 0b60072

Please sign in to comment.