Skip to content

Commit 6ff961d

Browse files
author
Isaac
committed
Various improvements
1 parent 9b0bcee commit 6ff961d

File tree

10 files changed

+276
-75
lines changed

10 files changed

+276
-75
lines changed

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,11 @@ public enum SendInviteLinkScreenSubject {
995995
case groupCall(link: String)
996996
}
997997

998+
public enum StarsWithdrawalScreenSubject {
999+
case withdraw
1000+
case enterAmount(current: StarsAmount)
1001+
}
1002+
9981003
public protocol SharedAccountContext: AnyObject {
9991004
var sharedContainerPath: String { get }
10001005
var basePath: String { get }
@@ -1179,7 +1184,7 @@ public protocol SharedAccountContext: AnyObject {
11791184
func makeStarsStatisticsScreen(context: AccountContext, peerId: EnginePeer.Id, revenueContext: StarsRevenueStatsContext) -> ViewController
11801185
func makeStarsAmountScreen(context: AccountContext, initialValue: Int64?, completion: @escaping (Int64) -> Void) -> ViewController
11811186
func makeStarsWithdrawalScreen(context: AccountContext, stats: StarsRevenueStats, completion: @escaping (Int64) -> Void) -> ViewController
1182-
func makeStarsWithdrawalScreen(context: AccountContext, completion: @escaping (Int64) -> Void) -> ViewController
1187+
func makeStarsWithdrawalScreen(context: AccountContext, subject: StarsWithdrawalScreenSubject, completion: @escaping (Int64) -> Void) -> ViewController
11831188
func makeStarGiftResellScreen(context: AccountContext, update: Bool, completion: @escaping (Int64) -> Void) -> ViewController
11841189
func makeStarsGiftScreen(context: AccountContext, message: EngineMessage) -> ViewController
11851190
func makeStarsGiveawayBoostScreen(context: AccountContext, peerId: EnginePeer.Id, boost: ChannelBoostersContext.State.Boost) -> ViewController

submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ private final class ChannelPermissionsControllerArguments {
3838
let updateSlowmode: (Int32) -> Void
3939
let updateUnrestrictBoosters: (Int32) -> Void
4040
let updateStarsAmount: (StarsAmount?, Bool) -> Void
41+
let openSetCustomStarsAmount: () -> Void
4142
let toggleIsOptionExpanded: (TelegramChatBannedRightsFlags) -> Void
4243

43-
init(context: AccountContext, updatePermission: @escaping (TelegramChatBannedRightsFlags, Bool) -> Void, setPeerIdWithRevealedOptions: @escaping (EnginePeer.Id?, EnginePeer.Id?) -> Void, addPeer: @escaping () -> Void, removePeer: @escaping (EnginePeer.Id) -> Void, openPeer: @escaping (ChannelParticipant) -> Void, openPeerInfo: @escaping (EnginePeer) -> Void, openKicked: @escaping () -> Void, presentRestrictedPermissionAlert: @escaping (TelegramChatBannedRightsFlags) -> Void, presentConversionToBroadcastGroup: @escaping () -> Void, openChannelExample: @escaping () -> Void, updateSlowmode: @escaping (Int32) -> Void, updateUnrestrictBoosters: @escaping (Int32) -> Void, updateStarsAmount: @escaping (StarsAmount?, Bool) -> Void, toggleIsOptionExpanded: @escaping (TelegramChatBannedRightsFlags) -> Void) {
44+
init(context: AccountContext, updatePermission: @escaping (TelegramChatBannedRightsFlags, Bool) -> Void, setPeerIdWithRevealedOptions: @escaping (EnginePeer.Id?, EnginePeer.Id?) -> Void, addPeer: @escaping () -> Void, removePeer: @escaping (EnginePeer.Id) -> Void, openPeer: @escaping (ChannelParticipant) -> Void, openPeerInfo: @escaping (EnginePeer) -> Void, openKicked: @escaping () -> Void, presentRestrictedPermissionAlert: @escaping (TelegramChatBannedRightsFlags) -> Void, presentConversionToBroadcastGroup: @escaping () -> Void, openChannelExample: @escaping () -> Void, updateSlowmode: @escaping (Int32) -> Void, updateUnrestrictBoosters: @escaping (Int32) -> Void, updateStarsAmount: @escaping (StarsAmount?, Bool) -> Void, openSetCustomStarsAmount: @escaping () -> Void, toggleIsOptionExpanded: @escaping (TelegramChatBannedRightsFlags) -> Void) {
4445
self.context = context
4546
self.updatePermission = updatePermission
4647
self.addPeer = addPeer
@@ -55,6 +56,7 @@ private final class ChannelPermissionsControllerArguments {
5556
self.updateSlowmode = updateSlowmode
5657
self.updateUnrestrictBoosters = updateUnrestrictBoosters
5758
self.updateStarsAmount = updateStarsAmount
59+
self.openSetCustomStarsAmount = openSetCustomStarsAmount
5860
self.toggleIsOptionExpanded = toggleIsOptionExpanded
5961
}
6062
}
@@ -427,7 +429,7 @@ private enum ChannelPermissionsEntry: ItemListNodeEntry {
427429
case let .messagePrice(_, value, maxValue, price):
428430
return MessagePriceItem(theme: presentationData.theme, strings: presentationData.strings, isEnabled: true, minValue: 1, maxValue: maxValue, value: value, price: price, sectionId: self.section, updated: { value, apply in
429431
arguments.updateStarsAmount(StarsAmount(value: value, nanos: 0), apply)
430-
})
432+
}, openSetCustom: nil)
431433
case let .messagePriceInfo(_, value):
432434
return ItemListTextItem(presentationData: presentationData, text: .plain(value), sectionId: self.section)
433435
case let .unrestrictBoostersSwitch(_, title, value):
@@ -1267,6 +1269,7 @@ public func channelPermissionsController(context: AccountContext, updatedPresent
12671269
|> deliverOnMainQueue).start())
12681270
})
12691271
}
1272+
}, openSetCustomStarsAmount: {
12701273
}, toggleIsOptionExpanded: { flags in
12711274
updateState { state in
12721275
var state = state

submodules/SettingsUI/Sources/Privacy and Security/IncomingMessagePrivacyScreen.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,24 @@ private final class IncomingMessagePrivacyScreenArguments {
2020
let infoLinkAction: () -> Void
2121
let openExceptions: () -> Void
2222
let openPremiumInfo: () -> Void
23+
let openSetCustomStarsAmount: () -> Void
2324

2425
init(
2526
context: AccountContext,
2627
updateValue: @escaping (GlobalPrivacySettings.NonContactChatsPrivacy) -> Void,
2728
disabledValuePressed: @escaping () -> Void,
2829
infoLinkAction: @escaping () -> Void,
2930
openExceptions: @escaping () -> Void,
30-
openPremiumInfo: @escaping () -> Void
31+
openPremiumInfo: @escaping () -> Void,
32+
openSetCustomStarsAmount: @escaping () -> Void
3133
) {
3234
self.context = context
3335
self.updateValue = updateValue
3436
self.disabledValuePressed = disabledValuePressed
3537
self.infoLinkAction = infoLinkAction
3638
self.openExceptions = openExceptions
3739
self.openPremiumInfo = openPremiumInfo
40+
self.openSetCustomStarsAmount = openSetCustomStarsAmount
3841
}
3942
}
4043

@@ -151,6 +154,8 @@ private enum GlobalAutoremoveEntry: ItemListNodeEntry {
151154
case let .price(value, maxValue, price, isEnabled):
152155
return MessagePriceItem(theme: presentationData.theme, strings: presentationData.strings, isEnabled: isEnabled, minValue: 1, maxValue: maxValue, value: value, price: price, sectionId: self.section, updated: { value, _ in
153156
arguments.updateValue(.paidMessages(StarsAmount(value: value, nanos: 0)))
157+
}, openSetCustom: {
158+
arguments.openSetCustomStarsAmount()
154159
}, openPremiumInfo: {
155160
arguments.openPremiumInfo()
156161
})
@@ -365,6 +370,20 @@ public func incomingMessagePrivacyScreen(context: AccountContext, value: GlobalP
365370
controller?.replace(with: c)
366371
}
367372
pushControllerImpl?(controller)
373+
},
374+
openSetCustomStarsAmount: {
375+
var currentAmount: StarsAmount = StarsAmount(value: 1, nanos: 0)
376+
if case let .paidMessages(value) = stateValue.with({ $0 }).updatedValue {
377+
currentAmount = value
378+
}
379+
let starsScreen = context.sharedContext.makeStarsWithdrawalScreen(context: context, subject: .enterAmount(current: currentAmount), completion: { amount in
380+
updateState { state in
381+
var state = state
382+
state.updatedValue = .paidMessages(StarsAmount(value: amount, nanos: 0))
383+
return state
384+
}
385+
})
386+
pushControllerImpl?(starsScreen)
368387
}
369388
)
370389

submodules/TelegramCallsUI/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ swift_library(
121121
"//submodules/FastBlur",
122122
"//submodules/InviteLinksUI",
123123
"//third-party/td:TdBinding",
124+
"//submodules/TelegramUI/Components/AnimatedTextComponent",
124125
],
125126
visibility = [
126127
"//visibility:public",

0 commit comments

Comments
 (0)