mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 09:32:46 +00:00
Merge commit '2e26c3cdbd298c49e19511a31173a53c2ba54d70'
This commit is contained in:
commit
626e94f72b
@ -88,10 +88,11 @@ public func PremiumBoostScreen(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let initialState = BoostState(level: Int32(status.level), currentLevelBoosts: Int32(status.currentLevelBoosts), nextLevelBoosts: status.nextLevelBoosts.flatMap(Int32.init), boosts: Int32(status.boosts))
|
||||
|
||||
let boosts = max(Int32(status.boosts), myBoostCount)
|
||||
let initialState = BoostState(level: Int32(status.level), currentLevelBoosts: Int32(status.currentLevelBoosts), nextLevelBoosts: status.nextLevelBoosts.flatMap(Int32.init), boosts: boosts)
|
||||
let updatedState = Promise<BoostState?>()
|
||||
updatedState.set(.single(BoostState(level: Int32(status.level), currentLevelBoosts: Int32(status.currentLevelBoosts), nextLevelBoosts: status.nextLevelBoosts.flatMap(Int32.init), boosts: Int32(status.boosts + 1))))
|
||||
updatedState.set(.single(BoostState(level: Int32(status.level), currentLevelBoosts: Int32(status.currentLevelBoosts), nextLevelBoosts: status.nextLevelBoosts.flatMap(Int32.init), boosts: boosts + 1)))
|
||||
|
||||
var updateImpl: (() -> Void)?
|
||||
var dismissImpl: (() -> Void)?
|
||||
|
||||
@ -885,14 +885,14 @@ private final class PremiumGiftScreenComponent: CombinedComponent {
|
||||
|
||||
let purpose: AppStoreTransactionPurpose
|
||||
var quantity: Int32 = 1
|
||||
if case .settings = self.source {
|
||||
purpose = .giftCode(peerIds: self.peerIds, boostPeer: nil, currency: currency, amount: amount)
|
||||
quantity = Int32(self.peerIds.count)
|
||||
} else if let peerId = self.peerIds.first {
|
||||
|
||||
if self.source == .profile || self.source == .attachMenu, let peerId = self.peerIds.first {
|
||||
purpose = .gift(peerId: peerId, currency: currency, amount: amount)
|
||||
} else {
|
||||
fatalError()
|
||||
purpose = .giftCode(peerIds: self.peerIds, boostPeer: nil, currency: currency, amount: amount)
|
||||
quantity = Int32(self.peerIds.count)
|
||||
}
|
||||
|
||||
let _ = (self.context.engine.payments.canPurchasePremium(purpose: purpose)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] available in
|
||||
if let strongSelf = self {
|
||||
|
||||
@ -1045,8 +1045,9 @@ final class AvatarEditorScreenComponent: Component {
|
||||
state.updated(transition: .easeInOut(duration: 0.2))
|
||||
}
|
||||
},
|
||||
openColorPicker: { [weak state] in
|
||||
if let state {
|
||||
openColorPicker: { [weak self, weak state] in
|
||||
if let self, let state {
|
||||
self.endEditing(true)
|
||||
state.editingColor = true
|
||||
state.previousColor = state.selectedBackground
|
||||
state.previousCustomColor = state.customColor
|
||||
|
||||
@ -1041,13 +1041,11 @@ final class StoryItemSetContainerSendMessage {
|
||||
immediateExternalShare: false,
|
||||
forceTheme: defaultDarkColorPresentationTheme
|
||||
)
|
||||
if !component.slice.peer.isService {
|
||||
shareController.shareStory = { [weak view] in
|
||||
guard let view else {
|
||||
return
|
||||
}
|
||||
view.openStoryEditing(repost: true)
|
||||
shareController.shareStory = { [weak view] in
|
||||
guard let view else {
|
||||
return
|
||||
}
|
||||
view.openStoryEditing(repost: true)
|
||||
}
|
||||
shareController.completed = { [weak view] peerIds in
|
||||
guard let view, let component = view.component else {
|
||||
|
||||
@ -2251,6 +2251,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
let concealed = urlData.concealed
|
||||
let message = urlData.message
|
||||
let progress = urlData.progress
|
||||
let forceExternal = urlData.external ?? false
|
||||
|
||||
var skipConcealedAlert = false
|
||||
if let author = message?.author, author.isVerified {
|
||||
@ -2264,7 +2265,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if let performOpenURL = strongSelf.performOpenURL {
|
||||
performOpenURL(message, url, progress)
|
||||
} else {
|
||||
strongSelf.openUrl(url, concealed: concealed, skipConcealedAlert: skipConcealedAlert, message: message, allowInlineWebpageResolution: urlData.allowInlineWebpageResolution, progress: progress)
|
||||
strongSelf.openUrl(url, concealed: concealed, forceExternal: forceExternal, skipConcealedAlert: skipConcealedAlert, message: message, allowInlineWebpageResolution: urlData.allowInlineWebpageResolution, progress: progress)
|
||||
}
|
||||
}
|
||||
}, shareCurrentLocation: { [weak self] in
|
||||
@ -4164,7 +4165,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
case let .join(_, joinHash):
|
||||
self.controllerInteraction?.openJoinLink(joinHash)
|
||||
case let .webPage(_, url):
|
||||
self.controllerInteraction?.openUrl(ChatControllerInteraction.OpenUrl(url: url, concealed: false, external: false))
|
||||
self.controllerInteraction?.openUrl(ChatControllerInteraction.OpenUrl(url: url, concealed: false, external: true))
|
||||
case let .botApp(peerId, botApp, startParam):
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId))
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self] peer in
|
||||
|
||||
@ -94,18 +94,29 @@ final class WebAppWebView: WKWebView {
|
||||
|
||||
init(account: Account) {
|
||||
let configuration = WKWebViewConfiguration()
|
||||
|
||||
let uuid: UUID
|
||||
|
||||
if let current = UserDefaults.standard.object(forKey: "TelegramWebStoreUUID_\(account.id.int64)") as? String {
|
||||
uuid = UUID(uuidString: current)!
|
||||
} else {
|
||||
uuid = UUID()
|
||||
UserDefaults.standard.set(uuid.uuidString, forKey: "TelegramWebStoreUUID_\(account.id.int64)")
|
||||
}
|
||||
|
||||
if #available(iOS 17.0, *) {
|
||||
configuration.websiteDataStore = WKWebsiteDataStore(forIdentifier: uuid)
|
||||
var uuid: UUID?
|
||||
if let current = UserDefaults.standard.object(forKey: "TelegramWebStoreUUID_\(account.id.int64)") as? String {
|
||||
uuid = UUID(uuidString: current)!
|
||||
} else {
|
||||
let mainAccountId: Int64
|
||||
if let current = UserDefaults.standard.object(forKey: "TelegramWebStoreMainAccountId") as? Int64 {
|
||||
mainAccountId = current
|
||||
} else {
|
||||
mainAccountId = account.id.int64
|
||||
UserDefaults.standard.set(mainAccountId, forKey: "TelegramWebStoreMainAccountId")
|
||||
}
|
||||
|
||||
if account.id.int64 != mainAccountId {
|
||||
uuid = UUID()
|
||||
UserDefaults.standard.set(uuid!.uuidString, forKey: "TelegramWebStoreUUID_\(account.id.int64)")
|
||||
}
|
||||
}
|
||||
|
||||
if let uuid {
|
||||
configuration.websiteDataStore = WKWebsiteDataStore(forIdentifier: uuid)
|
||||
}
|
||||
}
|
||||
|
||||
let contentController = WKUserContentController()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user