mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various fixes
This commit is contained in:
parent
140bd3c526
commit
364045f8cd
@ -11650,6 +11650,8 @@ Sorry for the inconvenience.";
|
||||
"Birthday.Save" = "Save";
|
||||
"Birthday.Added" = "Date of birth added.";
|
||||
|
||||
"Birthday.FloodError" = "Sorry, you can’t change your birthday so often.";
|
||||
|
||||
"Chat.BirthdayTooltip" = "🎂 %1$@ is having a birthday today. You can give %2$@ **Telegram Premium** as a birthday gift.";
|
||||
|
||||
"ChatList.AddBirthdayTitle" = "Add your birthday! 🎂";
|
||||
|
@ -146,10 +146,7 @@ private func getPathFromMaskImage(_ image: CIImage, size: CGSize, values: MediaE
|
||||
}
|
||||
let minSide = min(size.width, size.height)
|
||||
let scaledImageSize = image.extent.size.aspectFilled(CGSize(width: minSide, height: minSide))
|
||||
let positionOffset = CGPoint(
|
||||
x: (size.width - scaledImageSize.width) / 2.0,
|
||||
y: (size.height - scaledImageSize.height) / 2.0
|
||||
)
|
||||
|
||||
|
||||
var contour = findContours(pixelBuffer: pixelBuffer)
|
||||
contour = simplify(contour, tolerance: 1.4)
|
||||
@ -163,6 +160,11 @@ private func getPathFromMaskImage(_ image: CIImage, size: CGSize, values: MediaE
|
||||
let rotation = values.cropRotation
|
||||
let scale = values.cropScale
|
||||
|
||||
let positionOffset = CGPoint(
|
||||
x: (size.width - scaledImageSize.width * scale) / 2.0,
|
||||
y: (size.height - scaledImageSize.height * scale) / 2.0
|
||||
)
|
||||
|
||||
transform = transform.translatedBy(x: positionOffset.x + position.x * secondScale, y: positionOffset.y + position.y * secondScale)
|
||||
transform = transform.rotated(by: rotation)
|
||||
transform = transform.scaledBy(x: scale * firstScale, y: scale * firstScale)
|
||||
|
@ -3703,24 +3703,34 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
||||
let peerBio = cachedData.about ?? ""
|
||||
|
||||
if (peer.firstName ?? "") != firstName || (peer.lastName ?? "") != lastName || (bio ?? "") != peerBio || (cachedData.birthday != birthday) {
|
||||
var updateNameSignal: Signal<Void, NoError> = .complete()
|
||||
var updateNameSignal: Signal<Void, UpdateInfoError> = .complete()
|
||||
var hasProgress = false
|
||||
if (peer.firstName ?? "") != firstName || (peer.lastName ?? "") != lastName {
|
||||
updateNameSignal = context.engine.accountData.updateAccountPeerName(firstName: firstName, lastName: lastName)
|
||||
|> castError(UpdateInfoError.self)
|
||||
hasProgress = true
|
||||
}
|
||||
var updateBioSignal: Signal<Void, NoError> = .complete()
|
||||
|
||||
enum UpdateInfoError {
|
||||
case generic
|
||||
case birthdayFlood
|
||||
}
|
||||
|
||||
var updateBioSignal: Signal<Void, UpdateInfoError> = .complete()
|
||||
if let bio, bio != cachedData.about {
|
||||
updateBioSignal = context.engine.accountData.updateAbout(about: bio)
|
||||
|> `catch` { _ -> Signal<Void, NoError> in
|
||||
|> `catch` { _ -> Signal<Void, UpdateInfoError> in
|
||||
return .complete()
|
||||
}
|
||||
hasProgress = true
|
||||
}
|
||||
var updatedBirthdaySignal: Signal<Never, NoError> = .complete()
|
||||
var updatedBirthdaySignal: Signal<Never, UpdateInfoError> = .complete()
|
||||
if let birthday, birthday != cachedData.birthday {
|
||||
updatedBirthdaySignal = context.engine.accountData.updateBirthday(birthday: birthday)
|
||||
|> `catch` { _ -> Signal<Never, NoError> in
|
||||
|> `catch` { error -> Signal<Never, UpdateInfoError> in
|
||||
if case .flood = error {
|
||||
return .fail(.birthdayFlood)
|
||||
}
|
||||
return .complete()
|
||||
}
|
||||
hasProgress = true
|
||||
@ -3738,7 +3748,17 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
||||
strongSelf.controller?.present(statusController, in: .window(.root))
|
||||
}
|
||||
strongSelf.activeActionDisposable.set((combineLatest(updateNameSignal, updateBioSignal, updatedBirthdaySignal) |> deliverOnMainQueue
|
||||
|> deliverOnMainQueue).startStrict(completed: {
|
||||
|> deliverOnMainQueue).startStrict(error: { [weak self] error in
|
||||
dismissStatus?()
|
||||
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if case .birthdayFlood = error {
|
||||
self.controller?.present(textAlertController(context: self.context, updatedPresentationData: self.controller?.updatedPresentationData, title: nil, text: self.presentationData.strings.Birthday_FloodError, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
}
|
||||
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil)
|
||||
}, completed: {
|
||||
dismissStatus?()
|
||||
|
||||
guard let strongSelf = self else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user