mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-31 15:37:01 +00:00
Merge commit 'f357e5596f2a71c56a67fd99a9f0e11c9be3c455'
This commit is contained in:
commit
9cdeb71e8d
@ -1580,7 +1580,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if peer.id == strongSelf.context.account.peerId {
|
if peer.id == strongSelf.context.account.peerId {
|
||||||
mode = .reminders
|
mode = .reminders
|
||||||
} else {
|
} else {
|
||||||
mode = .scheduledMessages
|
mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] scheduleTime in
|
let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] scheduleTime in
|
||||||
@ -1612,7 +1612,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if peer.id == strongSelf.context.account.peerId {
|
if peer.id == strongSelf.context.account.peerId {
|
||||||
mode = .reminders
|
mode = .reminders
|
||||||
} else {
|
} else {
|
||||||
mode = .scheduledMessages
|
mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = (strongSelf.context.account.postbox.transaction { transaction -> Message? in
|
let _ = (strongSelf.context.account.postbox.transaction { transaction -> Message? in
|
||||||
@ -5463,7 +5463,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if peer.id == strongSelf.context.account.peerId {
|
if peer.id == strongSelf.context.account.peerId {
|
||||||
mode = .reminders
|
mode = .reminders
|
||||||
} else {
|
} else {
|
||||||
mode = .scheduledMessages
|
mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser)
|
||||||
}
|
}
|
||||||
let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] time in
|
let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] time in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
@ -5504,7 +5504,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if peer.id == strongSelf.context.account.peerId {
|
if peer.id == strongSelf.context.account.peerId {
|
||||||
mode = .reminders
|
mode = .reminders
|
||||||
} else {
|
} else {
|
||||||
mode = .scheduledMessages
|
mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser)
|
||||||
}
|
}
|
||||||
let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] time in
|
let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] time in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
@ -5693,7 +5693,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if peer.id == strongSelf.context.account.peerId {
|
if peer.id == strongSelf.context.account.peerId {
|
||||||
mode = .reminders
|
mode = .reminders
|
||||||
} else {
|
} else {
|
||||||
mode = .scheduledMessages
|
mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser)
|
||||||
}
|
}
|
||||||
let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] time in
|
let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] time in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
@ -5980,7 +5980,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if peerId == self.context.account.peerId {
|
if peerId == self.context.account.peerId {
|
||||||
mode = .reminders
|
mode = .reminders
|
||||||
} else {
|
} else {
|
||||||
mode = .scheduledMessages
|
mode = .scheduledMessages(sendWhenOnlineAvailable: peerId.namespace == Namespaces.Peer.CloudUser)
|
||||||
}
|
}
|
||||||
let controller = ChatScheduleTimeController(context: self.context, mode: mode, minimalTime: self.presentationInterfaceState.slowmodeState?.timeout, dismissByTapOutside: false, completion: { [weak self] time in
|
let controller = ChatScheduleTimeController(context: self.context, mode: mode, minimalTime: self.presentationInterfaceState.slowmodeState?.timeout, dismissByTapOutside: false, completion: { [weak self] time in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
|
@ -9,7 +9,7 @@ import SwiftSignalKit
|
|||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
enum ChatScheduleTimeControllerMode {
|
enum ChatScheduleTimeControllerMode {
|
||||||
case scheduledMessages
|
case scheduledMessages(sendWhenOnlineAvailable: Bool)
|
||||||
case reminders
|
case reminders
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,9 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel
|
|||||||
self.contentContainerNode.addSubnode(self.titleNode)
|
self.contentContainerNode.addSubnode(self.titleNode)
|
||||||
self.contentContainerNode.addSubnode(self.cancelButton)
|
self.contentContainerNode.addSubnode(self.cancelButton)
|
||||||
self.contentContainerNode.addSubnode(self.doneButton)
|
self.contentContainerNode.addSubnode(self.doneButton)
|
||||||
//self.contentContainerNode.addSubnode(self.onlineButton)
|
if case .scheduledMessages(true) = self.mode {
|
||||||
|
self.contentContainerNode.addSubnode(self.onlineButton)
|
||||||
|
}
|
||||||
|
|
||||||
self.cancelButton.addTarget(self, action: #selector(self.cancelButtonPressed), forControlEvents: .touchUpInside)
|
self.cancelButton.addTarget(self, action: #selector(self.cancelButtonPressed), forControlEvents: .touchUpInside)
|
||||||
self.doneButton.pressed = { [weak self] in
|
self.doneButton.pressed = { [weak self] in
|
||||||
@ -311,7 +313,10 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel
|
|||||||
let cleanInsets = layout.insets(options: [.statusBar])
|
let cleanInsets = layout.insets(options: [.statusBar])
|
||||||
insets.top = max(10.0, insets.top)
|
insets.top = max(10.0, insets.top)
|
||||||
|
|
||||||
var buttonOffset: CGFloat = 0.0 //44.0
|
var buttonOffset: CGFloat = 0.0
|
||||||
|
if case .scheduledMessages(true) = self.mode {
|
||||||
|
buttonOffset += 44.0
|
||||||
|
}
|
||||||
|
|
||||||
let bottomInset: CGFloat = 10.0 + cleanInsets.bottom
|
let bottomInset: CGFloat = 10.0 + cleanInsets.bottom
|
||||||
let titleHeight: CGFloat = 54.0
|
let titleHeight: CGFloat = 54.0
|
||||||
|
@ -330,6 +330,6 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
|||||||
dismissInput()
|
dismissInput()
|
||||||
context.sharedContext.openWallet(context: context, walletContext: .send(address: address, amount: amount, comment: comment)) { c in
|
context.sharedContext.openWallet(context: context, walletContext: .send(address: address, amount: amount, comment: comment)) { c in
|
||||||
navigationController?.pushViewController(c)
|
navigationController?.pushViewController(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,10 @@ func handleTextLinkActionImpl(context: AccountContext, peerId: PeerId?, navigate
|
|||||||
controller.present(JoinLinkPreviewController(context: context, link: link, navigateToPeer: { peerId in
|
controller.present(JoinLinkPreviewController(context: context, link: link, navigateToPeer: { peerId in
|
||||||
openResolvedPeerImpl(peerId, .chat(textInputState: nil, subject: nil))
|
openResolvedPeerImpl(peerId, .chat(textInputState: nil, subject: nil))
|
||||||
}), in: .window(.root))
|
}), in: .window(.root))
|
||||||
|
case let .wallet(address, amount, comment):
|
||||||
|
context.sharedContext.openWallet(context: context, walletContext: .send(address: address, amount: amount, comment: comment)) { c in
|
||||||
|
(controller.navigationController as? NavigationController)?.pushViewController(c)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,16 @@ public func parseWalletUrl(_ url: URL) -> ParsedWalletUrl? {
|
|||||||
guard url.scheme == "ton" && url.host == "transfer" else {
|
guard url.scheme == "ton" && url.host == "transfer" else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
let updatedUrl = URL(string: url.absoluteString.replacingOccurrences(of: "+", with: "%20"), relativeTo: nil) ?? url
|
||||||
|
|
||||||
var address: String?
|
var address: String?
|
||||||
let path = url.path.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
|
let path = updatedUrl.path.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
|
||||||
if isValidWalletAddress(path) {
|
if isValidWalletAddress(path) {
|
||||||
address = path
|
address = path
|
||||||
}
|
}
|
||||||
var amount: Int64?
|
var amount: Int64?
|
||||||
var comment: String?
|
var comment: String?
|
||||||
if let query = url.query, let components = URLComponents(string: "/?" + query), let queryItems = components.queryItems {
|
if let query = updatedUrl.query, let components = URLComponents(string: "/?" + query), let queryItems = components.queryItems {
|
||||||
for queryItem in queryItems {
|
for queryItem in queryItems {
|
||||||
if let value = queryItem.value {
|
if let value = queryItem.value {
|
||||||
if queryItem.name == "amount", !value.isEmpty, let amountValue = Int64(value) {
|
if queryItem.name == "amount", !value.isEmpty, let amountValue = Int64(value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user