Various fixes

This commit is contained in:
Ilya Laktyushin 2023-08-11 17:21:19 +02:00
parent 9b011942e8
commit 779e90dffe
10 changed files with 143 additions and 15 deletions

View File

@ -9798,3 +9798,9 @@ Sorry for the inconvenience.";
"Premium.MaxStoriesMonthlyFinalText" = "You have reached the limit of **%@** stories per month.";
"MediaPicker.Recents" = "Recents";
"Location.AddThisLocation" = "Add This Location";
"Location.AddMyLocation" = "Add My Current Location";
"Location.TypeCity" = "City";
"Location.TypeStreet" = "Street";
"Location.TypeLocation" = "Location";

View File

@ -224,7 +224,12 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
case .black, .transparent, .blur:
textColor = .white
case .custom:
textColor = .white
let color = self.locationEntity.color.toUIColor()
if color.lightness > 0.705 {
textColor = .black
} else {
textColor = .white
}
}
text.addAttribute(.foregroundColor, value: textColor, range: range)
@ -256,8 +261,15 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
self.backgroundView.isHidden = false
self.blurredBackgroundView.isHidden = true
case .custom:
self.textView.textColor = .white
self.backgroundView.backgroundColor = self.locationEntity.color.toUIColor()
let color = self.locationEntity.color.toUIColor()
let textColor: UIColor
if color.lightness > 0.705 {
textColor = .black
} else {
textColor = .white
}
self.textView.textColor = textColor
self.backgroundView.backgroundColor = color
self.backgroundView.isHidden = false
self.blurredBackgroundView.isHidden = true
case .blur:

View File

@ -134,7 +134,7 @@ public struct VenueIconArguments: TransformImageCustomArguments {
}
}
public func venueIcon(engine: TelegramEngine, type: String, background: Bool) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
public func venueIcon(engine: TelegramEngine, type: String, flag: String? = nil, background: Bool) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
let isBuiltinIcon = ["", "home", "work"].contains(type)
let data: Signal<Data?, NoError> = isBuiltinIcon ? .single(nil) : venueIconData(engine: engine, resource: VenueIconResource(type: type))
return data |> map { data in

View File

@ -620,10 +620,10 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
case .share:
if source == .story {
if let initialLocation = strongSelf.controller?.initialLocation {
title = "Add This Location"
title = presentationData.strings.Location_AddThisLocation
coordinate = initialLocation
} else {
title = "Add My Current Location"
title = presentationData.strings.Location_AddMyLocation
}
} else {
title = presentationData.strings.Map_SendMyCurrentLocation
@ -633,10 +633,10 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
}
if source == .story {
if state.city != "" {
entries.append(.city(presentationData.theme, state.city ?? presentationData.strings.Map_Locating, "City", nil, nil, nil, coordinate, state.city, state.countryCode))
entries.append(.city(presentationData.theme, state.city ?? presentationData.strings.Map_Locating, presentationData.strings.Location_TypeCity, nil, nil, nil, coordinate, state.city, state.countryCode))
}
if state.street != "" {
entries.append(.location(presentationData.theme, state.street ?? presentationData.strings.Map_Locating, state.isStreet ? "Street" : "Location", nil, nil, nil, coordinate, state.street, nil, false))
entries.append(.location(presentationData.theme, state.street ?? presentationData.strings.Map_Locating, state.isStreet ? presentationData.strings.Location_TypeStreet : presentationData.strings.Location_TypeLocation, nil, nil, nil, coordinate, state.street, nil, false))
}
} else {
entries.append(.location(presentationData.theme, title, (userLocation?.horizontalAccuracy).flatMap { presentationData.strings.Map_AccurateTo(stringForDistance(strings: presentationData.strings, distance: $0)).string } ?? presentationData.strings.Map_Locating, nil, nil, nil, coordinate, state.street, nil, true))
@ -809,7 +809,7 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
streetName = ""
}
if streetName == "" && cityName == "" {
streetName = "Location"
streetName = presentationData.strings.Location_TypeLocation
}
strongSelf.updateState { state in
var state = state
@ -854,7 +854,7 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
streetName = ""
}
if streetName == "" && cityName == "" {
streetName = "Location"
streetName = presentationData.strings.Location_TypeLocation
}
strongSelf.updateState { state in
var state = state

View File

@ -86,7 +86,7 @@ final class MediaPickerTitleView: UIView {
self.arrowNode = ASImageNode()
self.arrowNode.displaysAsynchronously = false
self.arrowNode.image = generateTintedImage(image: UIImage(bundleImageName: "Stories/SelectorArrowDown"), color: theme.rootController.navigationBar.secondaryTextColor)
self.arrowNode.image = generateTintedImage(image: UIImage(bundleImageName: "Media Editor/DownArrow"), color: theme.rootController.navigationBar.secondaryTextColor)
self.arrowNode.isHidden = true
self.segmentedControlNode = SegmentedControlNode(theme: SegmentedControlTheme(theme: theme), items: segments.map { SegmentedControlItem(title: $0) }, selectedIndex: selectedIndex)

View File

@ -743,7 +743,7 @@ final class StoryItemContentComponent: Component {
if let current = self.mediaAreasEffectView {
mediaAreasEffectView = current
} else {
mediaAreasEffectView = StoryItemLoadingEffectView(effectAlpha: 0.35, borderAlpha: 0.45, gradientWidth: 150.0, duration: 1.5, hasCustomBorder: false, playOnce: true)
mediaAreasEffectView = StoryItemLoadingEffectView(effectAlpha: 0.35, borderAlpha: 0.45, gradientWidth: 150.0, duration: 1.2, hasCustomBorder: false, playOnce: true)
self.mediaAreasEffectView = mediaAreasEffectView
self.addSubview(mediaAreasEffectView)
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "DownArrow.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,92 @@
%PDF-1.7
1 0 obj
<< >>
endobj
2 0 obj
<< /Length 3 0 R >>
stream
/DeviceRGB CS
/DeviceRGB cs
q
1.000000 0.000000 0.000000 -1.000000 1.500000 7.822266 cm
0.000000 0.000000 0.000000 scn
-0.586899 2.409164 m
-0.911034 2.085029 -0.911034 1.559502 -0.586899 1.235367 c
-0.262763 0.911232 0.262763 0.911232 0.586899 1.235367 c
-0.586899 2.409164 l
h
4.500000 6.322266 m
5.086899 6.909164 l
4.762764 7.233299 4.237236 7.233299 3.913101 6.909164 c
4.500000 6.322266 l
h
8.413101 1.235367 m
8.737237 0.911232 9.262763 0.911232 9.586899 1.235367 c
9.911034 1.559502 9.911034 2.085029 9.586899 2.409164 c
8.413101 1.235367 l
h
0.586899 1.235367 m
5.086899 5.735367 l
3.913101 6.909164 l
-0.586899 2.409164 l
0.586899 1.235367 l
h
3.913101 5.735367 m
8.413101 1.235367 l
9.586899 2.409164 l
5.086899 6.909164 l
3.913101 5.735367 l
h
f
n
Q
endstream
endobj
3 0 obj
762
endobj
4 0 obj
<< /Annots []
/Type /Page
/MediaBox [ 0.000000 0.000000 12.000000 8.000000 ]
/Resources 1 0 R
/Contents 2 0 R
/Parent 5 0 R
>>
endobj
5 0 obj
<< /Kids [ 4 0 R ]
/Count 1
/Type /Pages
>>
endobj
6 0 obj
<< /Pages 5 0 R
/Type /Catalog
>>
endobj
xref
0 7
0000000000 65535 f
0000000010 00000 n
0000000034 00000 n
0000000852 00000 n
0000000874 00000 n
0000001046 00000 n
0000001120 00000 n
trailer
<< /ID [ (some) (id) ]
/Root 6 0 R
/Size 7
>>
startxref
1179
%%EOF

View File

@ -1427,7 +1427,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
}
}
let updatedImageFrame: CGRect
var updatedImageFrame: CGRect
var contextContentFrame: CGRect
if let _ = emojiString {
updatedImageFrame = imageFrame
@ -1458,8 +1458,11 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
strongSelf.contextSourceNode.contentRect = contextContentFrame
strongSelf.containerNode.targetNodeForActivationProgressContentRect = strongSelf.contextSourceNode.contentRect
let animationNodeFrame = updatedContentFrame.insetBy(dx: imageInset, dy: imageInset)
var animationNodeFrame = updatedContentFrame.insetBy(dx: imageInset, dy: imageInset)
if let telegramFile, telegramFile.isPremiumSticker {
animationNodeFrame = animationNodeFrame.offsetBy(dx: 0.0, dy: 20.0)
}
var file: TelegramMediaFile?
if let emojiFile = emojiFile {
file = emojiFile

View File

@ -117,6 +117,9 @@ public func navigateToChatControllerImpl(_ params: NavigateToChatControllerParam
if let attachBotStart = params.attachBotStart {
controller.presentAttachmentBot(botId: attachBotStart.botId, payload: attachBotStart.payload, justInstalled: attachBotStart.justInstalled)
}
if let botAppStart = params.botAppStart, case let .peer(peer) = params.chatLocation {
controller.presentBotApp(botApp: botAppStart.botApp, botPeer: peer, payload: botAppStart.payload)
}
params.setupController(controller)
found = true
break