Skip to content

Commit ceca805

Browse files
committed
Various improvements
1 parent 07bddcd commit ceca805

5 files changed

Lines changed: 31 additions & 11 deletions

File tree

submodules/SettingsUI/Sources/Data and Storage/IntentsSettingsController.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private enum IntentsSettingsSection: Int32 {
4747

4848
private enum IntentsSettingsControllerEntry: ItemListNodeEntry {
4949
case accountHeader(PresentationTheme, String)
50-
case account(PresentationTheme, EnginePeer, Bool, Int32)
50+
case account(PresentationTheme, Account, EnginePeer, Bool, Int32)
5151
case accountInfo(PresentationTheme, String)
5252

5353
case chatsHeader(PresentationTheme, String)
@@ -80,7 +80,7 @@ private enum IntentsSettingsControllerEntry: ItemListNodeEntry {
8080
switch self {
8181
case .accountHeader:
8282
return 0
83-
case let .account(_, _, _, index):
83+
case let .account(_, _, _, _, index):
8484
return 1 + index
8585
case .accountInfo:
8686
return 1000
@@ -115,8 +115,8 @@ private enum IntentsSettingsControllerEntry: ItemListNodeEntry {
115115
} else {
116116
return false
117117
}
118-
case let .account(lhsTheme, lhsPeer, lhsSelected, lhsIndex):
119-
if case let .account(rhsTheme, rhsPeer, rhsSelected, rhsIndex) = rhs, lhsTheme === rhsTheme, lhsPeer == rhsPeer, lhsSelected == rhsSelected, lhsIndex == rhsIndex {
118+
case let .account(lhsTheme, lhsAccount, lhsPeer, lhsSelected, lhsIndex):
119+
if case let .account(rhsTheme, rhsAccount, rhsPeer, rhsSelected, rhsIndex) = rhs, lhsTheme === rhsTheme, lhsAccount === rhsAccount, lhsPeer == rhsPeer, lhsSelected == rhsSelected, lhsIndex == rhsIndex {
120120
return true
121121
} else {
122122
return false
@@ -200,8 +200,8 @@ private enum IntentsSettingsControllerEntry: ItemListNodeEntry {
200200
switch self {
201201
case let .accountHeader(_, text):
202202
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
203-
case let .account(_, peer, selected, _):
204-
return ItemListPeerItem(presentationData: presentationData, systemStyle: .glass, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: .firstLast, context: arguments.context.sharedContext.makeTempAccountContext(account: arguments.context.account), peer: peer, height: .generic, aliasHandling: .standard, nameStyle: .plain, presence: nil, text: .none, label: .none, editing: ItemListPeerItemEditing(editable: true, editing: false, revealed: false), revealOptions: nil, switchValue: ItemListPeerItemSwitch(value: selected, style: .check), enabled: true, selectable: true, sectionId: self.section, action: {
203+
case let .account(_, account, peer, selected, _):
204+
return ItemListPeerItem(presentationData: presentationData, systemStyle: .glass, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: .firstLast, context: arguments.context.sharedContext.makeTempAccountContext(account: account), peer: peer, height: .generic, aliasHandling: .standard, nameStyle: .plain, presence: nil, text: .none, label: .none, editing: ItemListPeerItemEditing(editable: true, editing: false, revealed: false), revealOptions: nil, switchValue: ItemListPeerItemSwitch(value: selected, style: .check), enabled: true, selectable: true, sectionId: self.section, action: {
205205
arguments.updateSettings { $0.withUpdatedAccount(peer.id) }
206206
}, setPeerIdWithRevealedOptions: { _, _ in}, removePeer: { _ in })
207207
case let .accountInfo(_, text):
@@ -251,8 +251,8 @@ private func intentsSettingsControllerEntries(context: AccountContext, presentat
251251
if accounts.count > 1 {
252252
entries.append(.accountHeader(presentationData.theme, presentationData.strings.IntentsSettings_MainAccount.uppercased()))
253253
var index: Int32 = 0
254-
for (_, peer) in accounts {
255-
entries.append(.account(presentationData.theme, peer, peer.id == settings.account, index))
254+
for (account, peer) in accounts {
255+
entries.append(.account(presentationData.theme, account, peer, peer.id == settings.account, index))
256256
index += 1
257257
}
258258
entries.append(.accountInfo(presentationData.theme, presentationData.strings.IntentsSettings_MainAccountInfo))

submodules/TelegramUI/Components/Gifts/GiftCraftScreen/Sources/CraftTableComponent.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ final class CraftTableComponent: Component {
9898
super.init(frame: frame)
9999

100100
self.addSubview(self.animationView)
101+
102+
self.animationView.onStickerLaunch = {
103+
HapticFeedback().impact(.soft)
104+
}
101105
}
102106

103107
required init?(coder: NSCoder) {
@@ -139,7 +143,9 @@ final class CraftTableComponent: Component {
139143
self.failWillFinish = true
140144
self.component?.willFinish(false)
141145

142-
self.craftFailPlayOnce.invoke(Void())
146+
Queue.mainQueue().after(0.1) {
147+
self.craftFailPlayOnce.invoke(Void())
148+
}
143149
})
144150

145151
Queue.mainQueue().after(0.5, {
@@ -408,8 +414,13 @@ final class CraftTableComponent: Component {
408414
for index in component.gifts.keys.sorted() {
409415
indices.append(Int(index))
410416
}
417+
418+
Queue.mainQueue().after(0.55) {
419+
HapticFeedback().impact(.light)
420+
}
421+
411422
self.anvilPlayOnce.invoke(Void())
412-
Queue.mainQueue().after(0.6, {
423+
Queue.mainQueue().after(0.75, {
413424
self.animationView.startStickerSequence(indices: indices)
414425

415426
switch component.result {

submodules/TelegramUI/Components/Gifts/GiftCraftScreen/Sources/CubeAnimationView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ final class CubeAnimationView: UIView {
8282

8383
var isSuccess = false
8484

85+
var onStickerLaunch: (() -> Void)?
8586
var onFinishApproach: ((Bool) -> Void)?
8687

8788
private let defaultStickOrder: [Int] = [0, 5, 4, 3]
@@ -520,6 +521,8 @@ final class CubeAnimationView: UIView {
520521
return
521522
}
522523

524+
self.onStickerLaunch?()
525+
523526
if let animationView, animationView !== sticker {
524527
animationView.removeFromSuperview()
525528
self.warpSnapshot = nil

submodules/TelegramUI/Components/Gifts/GiftCraftScreen/Sources/GiftCraftScreen.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,9 @@ private final class CraftGiftPageContent: Component {
12151215

12161216
HapticFeedback().success()
12171217
} else {
1218-
HapticFeedback().error()
1218+
Queue.mainQueue().after(0.15) {
1219+
HapticFeedback().error()
1220+
}
12191221
}
12201222
}
12211223
)

submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,10 @@ public final class GlassBackgroundContainerView: UIView {
689689
return nil
690690
}
691691

692+
if result === self.contentView {
693+
return nil
694+
}
695+
692696
return result
693697
}
694698

0 commit comments

Comments
 (0)