mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Various fixes
This commit is contained in:
@@ -258,7 +258,7 @@ final class DrawingTextEntityView: DrawingEntityView, UITextViewDelegate {
|
|||||||
self.textView.minimumZoomScale = 1.0
|
self.textView.minimumZoomScale = 1.0
|
||||||
self.textView.maximumZoomScale = 1.0
|
self.textView.maximumZoomScale = 1.0
|
||||||
self.textView.keyboardAppearance = .dark
|
self.textView.keyboardAppearance = .dark
|
||||||
self.textView.autocorrectionType = .default
|
self.textView.autocorrectionType = .no
|
||||||
self.textView.spellCheckingType = .no
|
self.textView.spellCheckingType = .no
|
||||||
|
|
||||||
super.init(context: context, entity: entity)
|
super.init(context: context, entity: entity)
|
||||||
|
|||||||
@@ -996,7 +996,7 @@ private class DrawingSlice {
|
|||||||
self.rect = rect
|
self.rect = rect
|
||||||
self.path = NSTemporaryDirectory() + "/drawing_\(uuid.hashValue).slice"
|
self.path = NSTemporaryDirectory() + "/drawing_\(uuid.hashValue).slice"
|
||||||
|
|
||||||
DrawingSlice.queue.async {
|
DrawingSlice.queue.after(2.0) {
|
||||||
let image = UIImage(cgImage: image)
|
let image = UIImage(cgImage: image)
|
||||||
if let data = image.pngData() as? NSData {
|
if let data = image.pngData() as? NSData {
|
||||||
try? data.write(toFile: self.path)
|
try? data.write(toFile: self.path)
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ final class PenTool: DrawingElement {
|
|||||||
let minRenderArrowLength = max(10.0, max(drawingSize.width, drawingSize.height) * 0.02)
|
let minRenderArrowLength = max(10.0, max(drawingSize.width, drawingSize.height) * 0.02)
|
||||||
|
|
||||||
self.renderLineWidth = lineWidth
|
self.renderLineWidth = lineWidth
|
||||||
self.renderMinLineWidth = isEraser || isBlur ? lineWidth : minLineWidth + (lineWidth - minLineWidth) * 0.3
|
self.renderMinLineWidth = isEraser || isBlur ? lineWidth : minLineWidth + (lineWidth - minLineWidth) * 0.2
|
||||||
self.renderArrowLength = max(minRenderArrowLength, lineWidth * 3.0)
|
self.renderArrowLength = max(minRenderArrowLength, lineWidth * 3.0)
|
||||||
self.renderArrowLineWidth = max(minLineWidth * 1.8, lineWidth * 0.75)
|
self.renderArrowLineWidth = max(minLineWidth * 1.8, lineWidth * 0.75)
|
||||||
|
|
||||||
@@ -235,13 +235,7 @@ final class PenTool: DrawingElement {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let filterDistance: CGFloat
|
let filterDistance: CGFloat = 20.0
|
||||||
if point.velocity > 1200.0 {
|
|
||||||
filterDistance = 25.0
|
|
||||||
} else {
|
|
||||||
filterDistance = 15.0
|
|
||||||
}
|
|
||||||
|
|
||||||
if let previousPoint, point.location.distance(to: previousPoint) < filterDistance, state == .changed, self.segments.count > 1 {
|
if let previousPoint, point.location.distance(to: previousPoint) < filterDistance, state == .changed, self.segments.count > 1 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -252,14 +246,13 @@ final class PenTool: DrawingElement {
|
|||||||
velocity = 1000.0
|
velocity = 1000.0
|
||||||
}
|
}
|
||||||
|
|
||||||
var effectiveRenderLineWidth = max(self.renderMinLineWidth, min(self.renderLineWidth - (velocity / 150.0), self.renderLineWidth))
|
var effectiveRenderLineWidth = max(self.renderMinLineWidth, min(self.renderLineWidth - (velocity / 100.0), self.renderLineWidth))
|
||||||
if let previousRenderLineWidth = self.previousRenderLineWidth {
|
if let previousRenderLineWidth = self.previousRenderLineWidth {
|
||||||
effectiveRenderLineWidth = effectiveRenderLineWidth * 0.2 + previousRenderLineWidth * 0.8
|
effectiveRenderLineWidth = effectiveRenderLineWidth * 0.2 + previousRenderLineWidth * 0.8
|
||||||
}
|
}
|
||||||
self.previousRenderLineWidth = effectiveRenderLineWidth
|
self.previousRenderLineWidth = effectiveRenderLineWidth
|
||||||
|
|
||||||
let rect = append(point: Point(position: point.location, width: effectiveRenderLineWidth))
|
let rect = append(point: Point(position: point.location, width: effectiveRenderLineWidth))
|
||||||
|
|
||||||
if let currentRenderView = self.currentRenderView as? RenderView, let rect = rect {
|
if let currentRenderView = self.currentRenderView as? RenderView, let rect = rect {
|
||||||
currentRenderView.draw(element: self, rect: rect)
|
currentRenderView.draw(element: self, rect: rect)
|
||||||
}
|
}
|
||||||
@@ -461,7 +454,7 @@ final class PenTool: DrawingElement {
|
|||||||
|
|
||||||
let segmentDistance: CGFloat = 6.0
|
let segmentDistance: CGFloat = 6.0
|
||||||
let distance = midPoint1.distance(to: midPoint2)
|
let distance = midPoint1.distance(to: midPoint2)
|
||||||
let numberOfSegments = min(128, max(floor(distance / segmentDistance), 32))
|
let numberOfSegments = min(48, max(floor(distance / segmentDistance), 24))
|
||||||
|
|
||||||
let step = 1.0 / numberOfSegments
|
let step = 1.0 / numberOfSegments
|
||||||
for t in stride(from: 0, to: 1, by: step) {
|
for t in stride(from: 0, to: 1, by: step) {
|
||||||
|
|||||||
@@ -1379,7 +1379,7 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
let setText: String
|
let setText: String
|
||||||
if user.photo.first?.isPersonal == true {
|
if user.photo.first?.isPersonal == true || state.updatingAvatar != nil {
|
||||||
setText = presentationData.strings.UserInfo_ChangeCustomPhoto(compactName).string
|
setText = presentationData.strings.UserInfo_ChangeCustomPhoto(compactName).string
|
||||||
} else {
|
} else {
|
||||||
setText = presentationData.strings.UserInfo_SetCustomPhoto(compactName).string
|
setText = presentationData.strings.UserInfo_SetCustomPhoto(compactName).string
|
||||||
@@ -3117,7 +3117,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
let firstName = strongSelf.headerNode.editingContentNode.editingTextForKey(.firstName) ?? ""
|
let firstName = strongSelf.headerNode.editingContentNode.editingTextForKey(.firstName) ?? ""
|
||||||
let lastName = strongSelf.headerNode.editingContentNode.editingTextForKey(.lastName) ?? ""
|
let lastName = strongSelf.headerNode.editingContentNode.editingTextForKey(.lastName) ?? ""
|
||||||
|
|
||||||
if peer.firstName != firstName || peer.lastName != lastName {
|
if (peer.firstName ?? "") != firstName || (peer.lastName ?? "") != lastName {
|
||||||
if firstName.isEmpty && lastName.isEmpty {
|
if firstName.isEmpty && lastName.isEmpty {
|
||||||
if strongSelf.hapticFeedback == nil {
|
if strongSelf.hapticFeedback == nil {
|
||||||
strongSelf.hapticFeedback = HapticFeedback()
|
strongSelf.hapticFeedback = HapticFeedback()
|
||||||
@@ -7179,7 +7179,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
confirmationAction = nil
|
confirmationAction = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasDeleteButton, hasViewButton: false, personalPhoto: strongSelf.isSettings, isVideo: currentIsVideo, saveEditedPhotos: false, saveCapturedMedia: false, signup: false, forum: isForum, title: title, isSuggesting: mode == .suggest)!
|
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasDeleteButton, hasViewButton: false, personalPhoto: strongSelf.isSettings, isVideo: currentIsVideo, saveEditedPhotos: false, saveCapturedMedia: false, signup: false, forum: isForum, title: title, isSuggesting: [.custom, .suggest].contains(mode))!
|
||||||
mixin.stickersContext = paintStickersContext
|
mixin.stickersContext = paintStickersContext
|
||||||
let _ = strongSelf.currentAvatarMixin.swap(mixin)
|
let _ = strongSelf.currentAvatarMixin.swap(mixin)
|
||||||
mixin.requestSearchController = { [weak self] assetsController in
|
mixin.requestSearchController = { [weak self] assetsController in
|
||||||
|
|||||||
Reference in New Issue
Block a user