mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-30 15:10:56 +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 {
|
||||
mode = .reminders
|
||||
} 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
|
||||
@ -1612,7 +1612,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if peer.id == strongSelf.context.account.peerId {
|
||||
mode = .reminders
|
||||
} else {
|
||||
mode = .scheduledMessages
|
||||
mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser)
|
||||
}
|
||||
|
||||
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 {
|
||||
mode = .reminders
|
||||
} 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
|
||||
if let strongSelf = self {
|
||||
@ -5504,7 +5504,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if peer.id == strongSelf.context.account.peerId {
|
||||
mode = .reminders
|
||||
} 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
|
||||
if let strongSelf = self {
|
||||
@ -5693,7 +5693,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if peer.id == strongSelf.context.account.peerId {
|
||||
mode = .reminders
|
||||
} 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
|
||||
if let strongSelf = self {
|
||||
@ -5980,7 +5980,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if peerId == self.context.account.peerId {
|
||||
mode = .reminders
|
||||
} 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
|
||||
if let strongSelf = self {
|
||||
|
@ -9,7 +9,7 @@ import SwiftSignalKit
|
||||
import AccountContext
|
||||
|
||||
enum ChatScheduleTimeControllerMode {
|
||||
case scheduledMessages
|
||||
case scheduledMessages(sendWhenOnlineAvailable: Bool)
|
||||
case reminders
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,9 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel
|
||||
self.contentContainerNode.addSubnode(self.titleNode)
|
||||
self.contentContainerNode.addSubnode(self.cancelButton)
|
||||
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.doneButton.pressed = { [weak self] in
|
||||
@ -311,7 +313,10 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel
|
||||
let cleanInsets = layout.insets(options: [.statusBar])
|
||||
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 titleHeight: CGFloat = 54.0
|
||||
|
@ -330,6 +330,6 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
dismissInput()
|
||||
context.sharedContext.openWallet(context: context, walletContext: .send(address: address, amount: amount, comment: comment)) { c in
|
||||
navigationController?.pushViewController(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,10 @@ func handleTextLinkActionImpl(context: AccountContext, peerId: PeerId?, navigate
|
||||
controller.present(JoinLinkPreviewController(context: context, link: link, navigateToPeer: { peerId in
|
||||
openResolvedPeerImpl(peerId, .chat(textInputState: nil, subject: nil))
|
||||
}), 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:
|
||||
break
|
||||
}
|
||||
|
@ -18,14 +18,16 @@ public func parseWalletUrl(_ url: URL) -> ParsedWalletUrl? {
|
||||
guard url.scheme == "ton" && url.host == "transfer" else {
|
||||
return nil
|
||||
}
|
||||
let updatedUrl = URL(string: url.absoluteString.replacingOccurrences(of: "+", with: "%20"), relativeTo: nil) ?? url
|
||||
|
||||
var address: String?
|
||||
let path = url.path.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
|
||||
let path = updatedUrl.path.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
|
||||
if isValidWalletAddress(path) {
|
||||
address = path
|
||||
}
|
||||
var amount: Int64?
|
||||
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 {
|
||||
if let value = queryItem.value {
|
||||
if queryItem.name == "amount", !value.isEmpty, let amountValue = Int64(value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user