Skip to content

Commit

Permalink
Merge commit '42de4756aafdb38ce720af8fb691d9a553d5921c'
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac committed Aug 12, 2024
2 parents babdec7 + 42de475 commit efb0d78
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 41 deletions.
31 changes: 0 additions & 31 deletions submodules/BrowserUI/Sources/BrowserDocumentContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -376,37 +376,6 @@ final class BrowserDocumentContent: UIView, BrowserContent, WKNavigationDelegate
decisionHandler(.prompt)
}


// @available(iOS 13.0, *)
// func webView(_ webView: WKWebView, contextMenuConfigurationForElement elementInfo: WKContextMenuElementInfo, completionHandler: @escaping (UIContextMenuConfiguration?) -> Void) {
// guard let url = elementInfo.linkURL else {
// completionHandler(nil)
// return
// }
// let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
// let configuration = UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { [weak self] _ in
// return UIMenu(title: "", children: [
// UIAction(title: presentationData.strings.Browser_ContextMenu_Open, image: generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Browser"), color: presentationData.theme.contextMenu.primaryColor), handler: { [weak self] _ in
// self?.open(url: url.absoluteString, new: false)
// }),
// UIAction(title: presentationData.strings.Browser_ContextMenu_OpenInNewTab, image: generateTintedImage(image: UIImage(bundleImageName: "Instant View/NewTab"), color: presentationData.theme.contextMenu.primaryColor), handler: { [weak self] _ in
// self?.open(url: url.absoluteString, new: true)
// }),
// UIAction(title: presentationData.strings.Browser_ContextMenu_AddToReadingList, image: generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReadingList"), color: presentationData.theme.contextMenu.primaryColor), handler: { _ in
// let _ = try? SSReadingList.default()?.addItem(with: url, title: nil, previewText: nil)
// }),
// UIAction(title: presentationData.strings.Browser_ContextMenu_CopyLink, image: generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: presentationData.theme.contextMenu.primaryColor), handler: { [weak self] _ in
// UIPasteboard.general.string = url.absoluteString
// self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
// }),
// UIAction(title: presentationData.strings.Browser_ContextMenu_Share, image: generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: presentationData.theme.contextMenu.primaryColor), handler: { [weak self] _ in
// self?.share(url: url.absoluteString)
// })
// ])
// }
// completionHandler(configuration)
// }

private func open(url: String, new: Bool) {
let subject: BrowserScreen.Subject = .webPage(url: url)
if new, let navigationController = self.getNavigationController() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1093,9 +1093,6 @@ func _internal_sendStarsPaymentForm(account: Account, formId: Int64, source: Bot

return account.network.request(Api.functions.payments.sendStarsForm(flags: flags, formId: formId, invoice: invoice))
|> map { result -> SendBotPaymentResult in



switch result {
case let .paymentResult(updates):
account.stateManager.addUpdates(updates)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,23 @@ private final class StarsTransactionSheetContent: CombinedComponent {
}
isCancelled = true
} else {
statusText = strings.Stars_Transaction_Subscription_Active(stringForMediumDate(timestamp: subscription.untilDate, strings: strings, dateTimeFormat: dateTimeFormat, withTime: false)).string
buttonText = strings.Stars_Transaction_Subscription_Cancel
buttonIsDestructive = true
if subscription.flags.contains(.isCancelled) {
statusText = strings.Stars_Transaction_Subscription_Cancelled
statusIsDestructive = true
if date > Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970) {
buttonText = strings.Stars_Transaction_Subscription_Renew
} else {
if let _ = subscription.inviteHash, !isKicked {
buttonText = strings.Stars_Transaction_Subscription_JoinAgainChannel
} else {
buttonText = strings.Common_OK
}
}
} else {
statusText = strings.Stars_Transaction_Subscription_Active(stringForMediumDate(timestamp: subscription.untilDate, strings: strings, dateTimeFormat: dateTimeFormat, withTime: false)).string
buttonText = strings.Stars_Transaction_Subscription_Cancel
buttonIsDestructive = true
}
}
case let .transaction(transaction, parentPeer):
if let _ = transaction.subscriptionPeriod {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,13 +969,15 @@ public final class StarsTransactionsScreen: ViewControllerComponentContainer {
return
}
if subscription.untilDate > Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970) {
if let channel = subscription.peer._asPeer() as? TelegramChannel, channel.participationStatus == .left {
var updated = false
if let channel = subscription.peer._asPeer() as? TelegramChannel, channel.participationStatus == .left && !subscription.flags.contains(.isCancelled) {
let _ = self.context.engine.payments.fulfillStarsSubscription(peerId: context.account.peerId, subscriptionId: subscription.id).startStandalone()
updated = true
}
if !updated {
if subscription.flags.contains(.isCancelled) {
self.subscriptionsContext.updateSubscription(id: subscription.id, cancel: false)
}
} else {
if !subscription.flags.contains(.isCancelled) {
} else {
self.subscriptionsContext.updateSubscription(id: subscription.id, cancel: true)
}
}
Expand Down Expand Up @@ -1104,4 +1106,8 @@ public final class StarsTransactionsScreen: ViewControllerComponentContainer {
deinit {
self.navigateDisposable.dispose()
}

public func update() {
self.subscriptionsContext.loadMore()
}
}

0 comments on commit efb0d78

Please sign in to comment.