Skip to content

Commit acf5f3c

Browse files
author
Isaac
committed
Merge commit 'de6f737bc106c29f9c0478d9456dd0d0bcee2d33'
2 parents 997134f + de6f737 commit acf5f3c

File tree

25 files changed

+363
-177
lines changed

25 files changed

+363
-177
lines changed

submodules/FeaturedStickersScreen/Sources/FeaturedStickersScreen.swift

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,7 @@ private final class FeaturedPaneSearchContentNode: ASDisplayNode {
12441244

12451245
let query = text.trimmingCharacters(in: .whitespacesAndNewlines)
12461246
if query.isSingleEmoji {
1247-
signals = .single([context.engine.stickers.searchStickers(query: [text.basicEmoji.0])
1247+
signals = .single([context.engine.stickers.searchStickers(query: nil, emoticon: [text.basicEmoji.0], inputLanguageCode: "")
12481248
|> map { (nil, $0.items) }])
12491249
} else if query.count > 1, let languageCode = languageCode, !languageCode.isEmpty && languageCode != "emoji" {
12501250
var signal = context.engine.stickers.searchEmojiKeywords(inputLanguageCode: languageCode, query: query.lowercased(), completeMatch: query.count < 3)
@@ -1260,17 +1260,11 @@ private final class FeaturedPaneSearchContentNode: ASDisplayNode {
12601260
)
12611261
}
12621262
}
1263-
12641263
signals = signal
12651264
|> map { keywords -> [Signal<(String?, [FoundStickerItem]), NoError>] in
1266-
var signals: [Signal<(String?, [FoundStickerItem]), NoError>] = []
1267-
let emoticons = keywords.flatMap { $0.emoticons }
1268-
for emoji in emoticons {
1269-
signals.append(context.engine.stickers.searchStickers(query: [emoji.basicEmoji.0])
1270-
|> take(1)
1271-
|> map { (emoji, $0.items) })
1272-
}
1273-
return signals
1265+
let emoticon = keywords.flatMap { $0.emoticons }.map { $0.basicEmoji.0 }
1266+
return [context.engine.stickers.searchStickers(query: query, emoticon: emoticon, inputLanguageCode: languageCode)
1267+
|> map { (nil, $0.items) }]
12741268
}
12751269
}
12761270

submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGPhotoCaptionInputMixin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@
2626
@property (nonatomic, copy) void (^timerUpdated)(NSNumber *timeout);
2727
@property (nonatomic, copy) void (^captionIsAboveUpdated)(bool captionIsAbove);
2828

29+
@property (nonatomic, readonly) bool editing;
30+
2931
- (void)createInputPanelIfNeeded;
3032
- (void)beginEditing;
33+
- (void)finishEditing;
3134
- (void)enableDismissal;
3235

3336
- (void)onAnimateOut;

submodules/LegacyComponents/Sources/TGMediaPickerGalleryInterfaceView.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,15 @@ - (instancetype)initWithContext:(id<LegacyComponentsContext>)context focusItem:(
175175
[strongSelf.window endEditing:true];
176176
strongSelf->_portraitToolbarView.doneButton.userInteractionEnabled = false;
177177
strongSelf->_landscapeToolbarView.doneButton.userInteractionEnabled = false;
178-
strongSelf->_donePressed(strongSelf->_currentItem);
178+
179+
if (strongSelf->_captionMixin.editing) {
180+
[strongSelf->_captionMixin finishEditing];
181+
TGDispatchAfter(0.1, dispatch_get_main_queue(), ^{
182+
strongSelf->_donePressed(strongSelf->_currentItem);
183+
});
184+
} else {
185+
strongSelf->_donePressed(strongSelf->_currentItem);
186+
}
179187

180188
[strongSelf->_captionMixin onAnimateOut];
181189
};
@@ -1428,7 +1436,7 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
14281436
|| [view isDescendantOfView:_landscapeToolbarView]
14291437
|| [view isDescendantOfView:_selectedPhotosView]
14301438
|| [view isDescendantOfView:_captionMixin.inputPanelView]
1431-
|| [view isDescendantOfView:_captionMixin.dismissView]
1439+
|| ([view isDescendantOfView:_captionMixin.dismissView] && _captionMixin.dismissView.alpha > 0.0)
14321440
|| [view isKindOfClass:[TGMenuButtonView class]])
14331441

14341442
{

submodules/LegacyComponents/Sources/TGMediaPickerGalleryVideoScrubber.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ - (instancetype)initWithFrame:(CGRect)frame
100100
_currentTimeLabel.text = @"0:00";
101101
_currentTimeLabel.textColor = [UIColor whiteColor];
102102
_currentTimeLabel.layer.shadowOffset = CGSizeMake(0.0, 0.0);
103-
_currentTimeLabel.layer.shadowRadius = 2.0;
103+
_currentTimeLabel.layer.shadowRadius = 4.0;
104104
_currentTimeLabel.layer.shadowColor = [UIColor blackColor].CGColor;
105-
_currentTimeLabel.layer.shadowOpacity = 0.4;
105+
_currentTimeLabel.layer.shadowOpacity = 0.6;
106106
_currentTimeLabel.layer.rasterizationScale = TGScreenScaling();
107107
_currentTimeLabel.layer.shouldRasterize = true;
108108
[self addSubview:_currentTimeLabel];
@@ -115,9 +115,9 @@ - (instancetype)initWithFrame:(CGRect)frame
115115
_inverseTimeLabel.textAlignment = NSTextAlignmentRight;
116116
_inverseTimeLabel.textColor = [UIColor whiteColor];
117117
_inverseTimeLabel.layer.shadowOffset = CGSizeMake(0.0, 0.0);
118-
_inverseTimeLabel.layer.shadowRadius = 2.0;
118+
_inverseTimeLabel.layer.shadowRadius = 4.0;
119119
_inverseTimeLabel.layer.shadowColor = [UIColor blackColor].CGColor;
120-
_inverseTimeLabel.layer.shadowOpacity = 0.4;
120+
_inverseTimeLabel.layer.shadowOpacity = 0.6;
121121
_inverseTimeLabel.layer.rasterizationScale = TGScreenScaling();
122122
_inverseTimeLabel.layer.shouldRasterize = true;
123123
[self addSubview:_inverseTimeLabel];

submodules/LegacyComponents/Sources/TGPhotoCaptionInputMixin.m

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ - (void)createInputPanelIfNeeded
6161
_inputPanel.sendPressed = ^(NSAttributedString *string) {
6262
__strong TGPhotoCaptionInputMixin *strongSelf = weakSelf;
6363
[TGViewController enableAutorotation];
64-
strongSelf->_dismissView.hidden = true;
6564

6665
strongSelf->_editing = false;
6766

@@ -74,9 +73,7 @@ - (void)createInputPanelIfNeeded
7473
[TGViewController disableAutorotation];
7574

7675
[strongSelf beginEditing];
77-
78-
strongSelf->_dismissView.hidden = false;
79-
76+
8077
if (strongSelf.panelFocused != nil)
8178
strongSelf.panelFocused();
8279

@@ -129,12 +126,13 @@ - (void)createDismissViewIfNeeded
129126

130127
_dismissView = [[UIView alloc] initWithFrame:parentView.bounds];
131128
_dismissView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
129+
_dismissView.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.4];
132130

133131
_dismissTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDismissTap:)];
134132
_dismissTapRecognizer.enabled = false;
135133
[_dismissView addGestureRecognizer:_dismissTapRecognizer];
136134

137-
//[parentView insertSubview:_dismissView belowSubview:_backgroundView];
135+
[parentView insertSubview:_dismissView belowSubview:_inputPanelView];
138136
}
139137

140138
- (void)setCaption:(NSAttributedString *)caption
@@ -168,6 +166,12 @@ - (void)beginEditing
168166

169167
[self createDismissViewIfNeeded];
170168
[self createInputPanelIfNeeded];
169+
170+
_dismissView.alpha = 0.0;
171+
[UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
172+
_dismissView.alpha = 1.0f;
173+
} completion:^(BOOL finished) {
174+
}];
171175
}
172176

173177
- (void)enableDismissal
@@ -177,21 +181,23 @@ - (void)enableDismissal
177181

178182
#pragma mark -
179183

180-
- (void)handleDismissTap:(UITapGestureRecognizer *)gestureRecognizer
181-
{
182-
if (gestureRecognizer.state != UIGestureRecognizerStateRecognized)
183-
return;
184-
184+
- (void)finishEditing {
185185
if ([self.inputPanel dismissInput]) {
186186
_editing = false;
187-
188-
[_dismissView removeFromSuperview];
189-
187+
190188
if (self.finishedWithCaption != nil)
191189
self.finishedWithCaption([_inputPanel caption]);
192190
}
193191
}
194192

193+
- (void)handleDismissTap:(UITapGestureRecognizer *)gestureRecognizer
194+
{
195+
if (gestureRecognizer.state != UIGestureRecognizerStateRecognized)
196+
return;
197+
198+
[self finishEditing];
199+
}
200+
195201
#pragma mark - Input Panel Delegate
196202

197203
- (void)setContentAreaHeight:(CGFloat)contentAreaHeight
@@ -228,6 +234,19 @@ - (void)keyboardWillChangeFrame:(NSNotification *)notification
228234

229235
_keyboardHeight = keyboardHeight;
230236

237+
CGFloat fadeAlpha = 1.0;
238+
if (keyboardHeight < FLT_EPSILON) {
239+
fadeAlpha = 0.0;
240+
}
241+
242+
if (ABS(_dismissView.alpha - fadeAlpha) > FLT_EPSILON) {
243+
[UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
244+
_dismissView.alpha = fadeAlpha;
245+
} completion:^(BOOL finished) {
246+
247+
}];
248+
}
249+
231250
if (!UIInterfaceOrientationIsPortrait([[LegacyComponentsGlobals provider] applicationStatusBarOrientation]) && !TGIsPad())
232251
return;
233252

submodules/LegacyMediaPickerUI/Sources/LegacyAttachmentMenu.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public func legacyStoryMediaEditor(context: AccountContext, item: TGMediaEditabl
155155
})
156156
}
157157

158-
public func legacyMediaEditor(context: AccountContext, peer: Peer, threadTitle: String?, media: AnyMediaReference, mode: LegacyMediaEditorMode, initialCaption: NSAttributedString, snapshots: [UIView], transitionCompletion: (() -> Void)?, getCaptionPanelView: @escaping () -> TGCaptionPanelView?, sendMessagesWithSignals: @escaping ([Any]?, Bool, Int32) -> Void, present: @escaping (ViewController, Any?) -> Void) {
158+
public func legacyMediaEditor(context: AccountContext, peer: Peer, threadTitle: String?, media: AnyMediaReference, mode: LegacyMediaEditorMode, initialCaption: NSAttributedString, snapshots: [UIView], transitionCompletion: (() -> Void)?, getCaptionPanelView: @escaping () -> TGCaptionPanelView?, sendMessagesWithSignals: @escaping ([Any]?, Bool, Int32, Bool) -> Void, present: @escaping (ViewController, Any?) -> Void) {
159159
let _ = (fetchMediaData(context: context, postbox: context.account.postbox, userLocation: .other, mediaReference: media)
160160
|> deliverOnMainQueue).start(next: { (value, isImage) in
161161
guard case let .data(data) = value, data.complete else {
@@ -215,7 +215,8 @@ public func legacyMediaEditor(context: AccountContext, peer: Peer, threadTitle:
215215
let signals = TGCameraController.resultSignals(for: nil, editingContext: editingContext, currentItem: selectableResult, storeAssets: false, saveEditedPhotos: false, descriptionGenerator: { _1, _2, _3 in
216216
nativeGenerator(_1, _2, _3, nil)
217217
})
218-
sendMessagesWithSignals(signals, false, 0)
218+
let isCaptionAbove = editingContext?.isCaptionAbove() ?? false
219+
sendMessagesWithSignals(signals, false, 0, isCaptionAbove)
219220
}, dismissed: { [weak legacyController] in
220221
legacyController?.dismiss()
221222
})

submodules/ReactionSelectionNode/Sources/ReactionContextNode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2028,7 +2028,7 @@ public final class ReactionContextNode: ASDisplayNode, ASScrollViewDelegate {
20282028
))
20292029
return .single(resultGroups)
20302030
} else {
2031-
let remoteSignal = context.engine.stickers.searchEmoji(emojiString: Array(allEmoticons.keys))
2031+
let remoteSignal = context.engine.stickers.searchEmoji(query: query, emoticon: Array(allEmoticons.keys), inputLanguageCode: languageCode)
20322032

20332033
return combineLatest(
20342034
context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: [], namespaces: [Namespaces.ItemCollection.CloudEmojiPacks], aroundIndex: nil, count: 10000000) |> take(1),

submodules/StatisticsUI/Sources/ChannelStatsController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,9 +1628,9 @@ private func monetizationEntries(
16281628

16291629
if canViewRevenue {
16301630
entries.append(.adsTonBalanceTitle(presentationData.theme, isBot ? presentationData.strings.Monetization_Bot_BalanceTitle : presentationData.strings.Monetization_TonBalanceTitle))
1631-
entries.append(.adsTonBalance(presentationData.theme, data, isCreator && data.balances.availableBalance > 0, data.balances.withdrawEnabled))
1631+
entries.append(.adsTonBalance(presentationData.theme, data, (isCreator || isBot) && data.balances.availableBalance > 0, data.balances.withdrawEnabled))
16321632

1633-
if isCreator {
1633+
if isCreator || isBot {
16341634
let withdrawalInfoText: String
16351635
if data.balances.availableBalance == 0 {
16361636
withdrawalInfoText = presentationData.strings.Monetization_Balance_ZeroInfo

0 commit comments

Comments
 (0)