Revert "Apply fixes"

This reverts commit e1c4ddc9aed227439a95a77b31489ed8f7adae0a.
This commit is contained in:
Ali 2020-09-26 12:34:40 +04:00
parent 7f77b9946e
commit 9e892ca79a
20 changed files with 34 additions and 80 deletions

@ -1 +1 @@
Subproject commit 2583fa0bfd6909e7936da5b30e3547ba13e198dc
Subproject commit b8755bd2884d6bf651827c30e00bd0ea318e41a2

@ -1 +1 @@
Subproject commit 4f4b7f012e714eaecc7f16534690e1183aa1b9ca
Subproject commit 44e8c29afe3baa7f5fc434f4a7e83f7ac786644e

View File

@ -106,13 +106,7 @@ extension CameraOutput: AVCaptureMetadataOutputObjectsDelegate {
func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) {
let codes: [CameraCode] = metadataObjects.filter { $0.type == .qr }.compactMap { object in
if let object = object as? AVMetadataMachineReadableCodeObject, let stringValue = object.stringValue, !stringValue.isEmpty {
let corners: [CGPoint]
#if targetEnvironment(simulator)
corners = []
#else
corners = object.corners
#endif
return CameraCode(type: .qr, message: stringValue, corners: corners)
return CameraCode(type: .qr, message: stringValue, corners: object.corners)
} else {
return nil
}

View File

@ -989,7 +989,7 @@ func chatListFilterPresetController(context: AccountContext, currentPreset: Chat
includePeers.setPeers(state.additionallyIncludePeers)
var updatedFilter = ChatListFilter(id: currentPreset?.id ?? -1, title: state.name, emoticon: currentPreset?.emoticon, data: ChatListFilterData(categories: state.includeCategories, excludeMuted: state.excludeMuted, excludeRead: state.excludeRead, excludeArchived: state.excludeArchived, includePeers: includePeers, excludePeers: state.additionallyExcludePeers))
if currentPreset == nil {
updatedFilter.id = generateNewChatListFilterId(filters: filters)
updatedFilter.id = max(2, filters.map({ $0.id + 1 }).max() ?? 2)
}
var filters = filters
if let _ = currentPreset {

View File

@ -555,7 +555,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
let propertyAnimator = propertyAnimator as? UIViewPropertyAnimator
propertyAnimator?.stopAnimation(true)
}
self.effectView.effect = makeCustomZoomBlurEffect(isLight: presentationData.theme.rootController.keyboardColor == .light)
self.effectView.effect = makeCustomZoomBlurEffect()
self.effectView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2 * animationDurationFactor)
self.propertyAnimator = UIViewPropertyAnimator(duration: 0.2 * animationDurationFactor * UIView.animationDurationFactor(), curve: .easeInOut, animations: {
})
@ -573,7 +573,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
}
} else {
UIView.animate(withDuration: 0.2 * animationDurationFactor, animations: {
self.effectView.effect = makeCustomZoomBlurEffect(isLight: self.presentationData.theme.rootController.keyboardColor == .light)
self.effectView.effect = makeCustomZoomBlurEffect()
}, completion: { [weak self] _ in
self?.didCompleteAnimationIn = true
self?.actionsContainerNode.animateIn()
@ -1082,7 +1082,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
propertyAnimator?.stopAnimation(true)
}
}
self.effectView.effect = makeCustomZoomBlurEffect(isLight: presentationData.theme.rootController.keyboardColor == .light)
self.effectView.effect = makeCustomZoomBlurEffect()
self.dimNode.alpha = 1.0
}
self.dimNode.isHidden = false

View File

@ -19,8 +19,8 @@ public func springAnimationValueAt(_ animation: CABasicAnimation, _ t: CGFloat)
return springAnimationValueAtImpl(animation, t)
}
public func makeCustomZoomBlurEffect(isLight: Bool) -> UIBlurEffect? {
return makeCustomZoomBlurEffectImpl(isLight)
public func makeCustomZoomBlurEffect() -> UIBlurEffect? {
return makeCustomZoomBlurEffectImpl()
}
public func applySmoothRoundedCorners(_ layer: CALayer) {

View File

@ -855,9 +855,6 @@ func instantPageLayoutForWebPage(_ webPage: TelegramMediaWebpage, boundingWidth:
if let image = loadedContent.image, let id = image.id {
media[id] = image
}
if let video = loadedContent.file, let id = video.id {
media[id] = video
}
var mediaIndexCounter: Int = 0
var embedIndexCounter: Int = 0

View File

@ -1120,7 +1120,7 @@
[_playerItemDisposable setDisposable:[[itemSignal deliverOn:[SQueue mainQueue]] startWithNext:^(AVPlayerItem *playerItem)
{
__strong TGMediaPickerGalleryVideoItemView *strongSelf = weakSelf;
if (strongSelf == nil || ![playerItem isKindOfClass:[AVPlayerItem class]])
if (strongSelf == nil)
return;
strongSelf->_player = [AVPlayer playerWithPlayerItem:playerItem];

View File

@ -87,7 +87,6 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f;
_textView.autocorrectionType = UITextAutocorrectionTypeNo;
_textView.spellCheckingType = UITextSpellCheckingTypeNo;
_textView.font = [UIFont boldSystemFontOfSize:_baseFontSize];
_textView.typingAttributes = @{NSFontAttributeName: _textView.font};
// _textView.frameWidthInset = floor(_baseFontSize * 0.03);
[self setSwatch:entity.swatch];
@ -176,7 +175,6 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f;
{
_font = font;
_textView.font = [UIFont boldSystemFontOfSize:_baseFontSize];
_textView.typingAttributes = @{NSFontAttributeName: _textView.font};
// _textView.frameWidthInset = floor(_baseFontSize * 0.03);
[self sizeToFit];
@ -482,9 +480,6 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f;
@implementation TGPhotoTextView
{
UIFont *_font;
}
- (instancetype)initWithFrame:(CGRect)frame
{
@ -559,29 +554,10 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f;
- (void)setFont:(UIFont *)font {
[super setFont:font];
_font = font;
self.layoutManager.textContainers.firstObject.lineFragmentPadding = floor(font.pointSize * 0.3);
}
- (void)insertText:(NSString *)text {
[self fixTypingAttributes];
[super insertText:text];
[self fixTypingAttributes];
}
- (void)paste:(id)sender {
[self fixTypingAttributes];
[super paste:sender];
[self fixTypingAttributes];
}
- (void)fixTypingAttributes {
if (_font != nil) {
self.typingAttributes = @{NSFontAttributeName: _font};
}
}
@end
@ -826,6 +802,8 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f;
return [_impl attributesAtIndex:location effectiveRange:range];
}
- (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str {
[self beginEditing];
[_impl replaceCharactersInRange:range withString:str];

View File

@ -48,7 +48,7 @@ public enum LocationActionListItemIcon: Equatable {
}
private func generateLocationIcon(theme: PresentationTheme) -> UIImage {
return generateImage(CGSize(width: 40.0, height: 40.0), rotatedContext: { size, context in
return generateImage(CGSize(width: 40.0, height: 40.0)) { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
context.setFillColor(theme.chat.inputPanel.actionControlFillColor.cgColor)
context.fillEllipse(in: CGRect(origin: CGPoint(), size: size))
@ -60,11 +60,11 @@ private func generateLocationIcon(theme: PresentationTheme) -> UIImage {
if let image = generateTintedImage(image: UIImage(bundleImageName: "Location/SendLocationIcon"), color: theme.chat.inputPanel.actionControlForegroundColor) {
context.draw(image.cgImage!, in: CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0)), size: image.size))
}
})!
}!
}
private func generateLiveLocationIcon(theme: PresentationTheme) -> UIImage {
return generateImage(CGSize(width: 40.0, height: 40.0), rotatedContext: { size, context in
return generateImage(CGSize(width: 40.0, height: 40.0)) { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
context.setFillColor(UIColor(rgb: 0x6cc139).cgColor)
context.fillEllipse(in: CGRect(origin: CGPoint(), size: size))
@ -76,7 +76,7 @@ private func generateLiveLocationIcon(theme: PresentationTheme) -> UIImage {
if let image = generateTintedImage(image: UIImage(bundleImageName: "Location/SendLiveLocationIcon"), color: .white) {
context.draw(image.cgImage!, in: CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0)), size: image.size))
}
})!
}!
}
final class LocationActionListItem: ListViewItem {

View File

@ -15,7 +15,7 @@ import AccountContext
let locationPinReuseIdentifier = "locationPin"
private func generateSmallBackgroundImage(color: UIColor) -> UIImage? {
return generateImage(CGSize(width: 56.0, height: 56.0), contextGenerator: { size, context in
return generateImage(CGSize(width: 56.0, height: 56.0)) { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
context.setShadow(offset: CGSize(), blur: 4.0, color: UIColor(rgb: 0x000000, alpha: 0.5).cgColor)
@ -25,7 +25,7 @@ private func generateSmallBackgroundImage(color: UIColor) -> UIImage? {
context.setShadow(offset: CGSize(), blur: 0.0, color: nil)
context.setFillColor(color.cgColor)
context.fillEllipse(in: CGRect(x: 17.0 + UIScreenPixel, y: 17.0 + UIScreenPixel, width: 22.0 - 2.0 * UIScreenPixel, height: 22.0 - 2.0 * UIScreenPixel))
})
}
}
class LocationPinAnnotation: NSObject, MKAnnotation {

View File

@ -10,7 +10,7 @@ private let panelSize = CGSize(width: 46.0, height: 90.0)
private func generateBackgroundImage(theme: PresentationTheme) -> UIImage? {
let cornerRadius: CGFloat = 9.0
return generateImage(CGSize(width: (cornerRadius + panelInset) * 2.0, height: (cornerRadius + panelInset) * 2.0), rotatedContext: { size, context in
return generateImage(CGSize(width: (cornerRadius + panelInset) * 2.0, height: (cornerRadius + panelInset) * 2.0)) { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
context.setShadow(offset: CGSize(), blur: 10.0, color: UIColor(rgb: 0x000000, alpha: 0.2).cgColor)
@ -18,11 +18,11 @@ private func generateBackgroundImage(theme: PresentationTheme) -> UIImage? {
let path = UIBezierPath(roundedRect: CGRect(origin: CGPoint(x: panelInset, y: panelInset), size: CGSize(width: cornerRadius * 2.0, height: cornerRadius * 2.0)), cornerRadius: cornerRadius)
context.addPath(path.cgPath)
context.fillPath()
})?.stretchableImage(withLeftCapWidth: Int(cornerRadius + panelInset), topCapHeight: Int(cornerRadius + panelInset))
}?.stretchableImage(withLeftCapWidth: Int(cornerRadius + panelInset), topCapHeight: Int(cornerRadius + panelInset))
}
private func generateShadowImage(theme: PresentationTheme, highlighted: Bool) -> UIImage? {
return generateImage(CGSize(width: 26.0, height: 14.0), rotatedContext: { size, context in
return generateImage(CGSize(width: 26.0, height: 14.0)) { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
context.setShadow(offset: CGSize(), blur: 10.0, color: UIColor(rgb: 0x000000, alpha: 0.2).cgColor)
@ -30,7 +30,7 @@ private func generateShadowImage(theme: PresentationTheme, highlighted: Bool) ->
let path = UIBezierPath(roundedRect: CGRect(origin: CGPoint(x: 0.0, y: 4.0), size: CGSize(width: 26.0, height: 20.0)), cornerRadius: 9.0)
context.addPath(path.cgPath)
context.fillPath()
})?.stretchableImage(withLeftCapWidth: 13, topCapHeight: 0)
}?.stretchableImage(withLeftCapWidth: 13, topCapHeight: 0)
}
final class LocationMapHeaderNode: ASDisplayNode {

View File

@ -69,7 +69,7 @@ private class LocationMapView: MKMapView, UIGestureRecognizerDelegate {
}
private func generateHeadingArrowImage() -> UIImage? {
return generateImage(CGSize(width: 28.0, height: 28.0), contextGenerator: { size, context in
return generateImage(CGSize(width: 28.0, height: 28.0)) { size, context in
let bounds = CGRect(origin: CGPoint(), size: size)
context.clear(bounds)
@ -83,7 +83,7 @@ private func generateHeadingArrowImage() -> UIImage? {
context.setBlendMode(.clear)
context.fillEllipse(in: bounds.insetBy(dx: 5.0, dy: 5.0))
})
}
}
final class LocationMapNode: ASDisplayNode, MKMapViewDelegate {

View File

@ -306,9 +306,7 @@ final class TabBarAccountSwitchControllerNode: ViewControllerTracingNode {
propertyAnimator?.stopAnimation(true)
}
self.propertyAnimator = UIViewPropertyAnimator(duration: 0.2 * animationDurationFactor, curve: .easeInOut, animations: { [weak self] in
if let strongSelf = self {
strongSelf.effectView.effect = makeCustomZoomBlurEffect(isLight: strongSelf.presentationData.theme.rootController.keyboardColor == .light)
}
self?.effectView.effect = makeCustomZoomBlurEffect()
})
}
@ -321,7 +319,7 @@ final class TabBarAccountSwitchControllerNode: ViewControllerTracingNode {
}
} else {
UIView.animate(withDuration: 0.2 * animationDurationFactor, animations: {
self.effectView.effect = makeCustomZoomBlurEffect(isLight: self.presentationData.theme.rootController.keyboardColor == .light)
self.effectView.effect = makeCustomZoomBlurEffect()
}, completion: { _ in
})
}

View File

@ -12,7 +12,7 @@ import AvatarNode
import AccountContext
private let savedMessagesAvatar: UIImage = {
return generateImage(CGSize(width: 60.0, height: 60.0), contextGenerator: { size, context in
return generateImage(CGSize(width: 60.0, height: 60.0)) { size, context in
var locations: [CGFloat] = [1.0, 0.0]
let colorSpace = CGColorSpaceCreateDeviceRGB()
@ -28,7 +28,7 @@ private let savedMessagesAvatar: UIImage = {
if let savedMessagesIcon = generateTintedImage(image: UIImage(bundleImageName: "Avatar/SavedMessagesIcon"), color: .white) {
context.draw(savedMessagesIcon.cgImage!, in: CGRect(origin: CGPoint(x: floor((size.width - savedMessagesIcon.size.width) / 2.0), y: floor((size.height - savedMessagesIcon.size.height) / 2.0)), size: savedMessagesIcon.size))
}
})!
}!
}()
public enum SendMessageIntentContext {

View File

@ -383,15 +383,8 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible {
if telegramFile.isAnimatedSticker, (self.message.id.peerId.namespace == Namespaces.Peer.SecretChat || !telegramFile.previewRepresentations.isEmpty), let size = telegramFile.size, size > 0 && size <= 128 * 1024 {
if self.message.id.peerId.namespace == Namespaces.Peer.SecretChat {
if telegramFile.fileId.namespace == Namespaces.Media.CloudFile {
inner: for attribute in telegramFile.attributes {
if case let .Sticker(_, packReference, _) = attribute {
if case .name = packReference {
viewClassName = ChatMessageAnimatedStickerItemNode.self
}
break inner
}
}
}
} else {
viewClassName = ChatMessageAnimatedStickerItemNode.self
}

View File

@ -395,7 +395,7 @@ final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode,
UIView.animate(withDuration: 0.2, animations: {
if #available(iOS 9.0, *) {
self.effectView.effect = makeCustomZoomBlurEffect(isLight: self.presentationData.theme.rootController.keyboardColor == .light)
self.effectView.effect = makeCustomZoomBlurEffect()
} else {
self.effectView.alpha = 1.0
}

View File

@ -7,5 +7,5 @@ CABasicAnimation * _Nonnull makeSpringAnimationImpl(NSString * _Nonnull keyPath)
CABasicAnimation * _Nonnull makeSpringBounceAnimationImpl(NSString * _Nonnull keyPath, CGFloat initialVelocity, CGFloat damping);
CGFloat springAnimationValueAtImpl(CABasicAnimation * _Nonnull animation, CGFloat t);
UIBlurEffect *makeCustomZoomBlurEffectImpl(bool isLight);
UIBlurEffect *makeCustomZoomBlurEffectImpl();
void applySmoothRoundedCornersImpl(CALayer * _Nonnull layer);

View File

@ -159,14 +159,8 @@ static void setBoolField(CustomBlurEffect *object, NSString *name, BOOL value) {
[inv invoke];
}
UIBlurEffect *makeCustomZoomBlurEffectImpl(bool isLight) {
if (@available(iOS 13.0, *)) {
if (isLight) {
return [UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemUltraThinMaterialLight];
} else {
return [UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemUltraThinMaterialDark];
}
} else if (@available(iOS 11.0, *)) {
UIBlurEffect *makeCustomZoomBlurEffectImpl() {
if (@available(iOS 11.0, *)) {
NSString *string = [@[@"_", @"UI", @"Custom", @"BlurEffect"] componentsJoinedByString:@""];
CustomBlurEffect *result = (CustomBlurEffect *)[NSClassFromString(string) effectWithStyle:0];

@ -1 +1 @@
Subproject commit 11255bcfff3180210a012f368e2d2bcd169b6877
Subproject commit e4d49e73cd8206518e7b3dd75d54af0f0ef5b810