mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
bca83c695b
commit
e4bd4de246
@ -717,7 +717,11 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
||||
self.minimize()
|
||||
self.openAppUrl(url)
|
||||
} else {
|
||||
decisionHandler(.allow, preferences)
|
||||
if let scheme = navigationAction.request.url?.scheme, !["http", "https", "tonsite"].contains(scheme.lowercased()) {
|
||||
self.context.sharedContext.openExternalUrl(context: self.context, urlContext: .generic, url: url, forceExternal: true, presentationData: self.presentationData, navigationController: nil, dismissInput: {})
|
||||
} else {
|
||||
decisionHandler(.allow, preferences)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
decisionHandler(.allow, preferences)
|
||||
|
@ -209,7 +209,7 @@ public final class DrawingLinkEntityView: DrawingEntityView, UITextViewDelegate
|
||||
if !self.linkEntity.name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||
string = self.linkEntity.name.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
||||
} else {
|
||||
string = self.linkEntity.url.uppercased().replacingOccurrences(of: "http://", with: "").replacingOccurrences(of: "https://", with: "")
|
||||
string = self.linkEntity.url.uppercased().replacingOccurrences(of: "http://", with: "").replacingOccurrences(of: "https://", with: "").replacingOccurrences(of: "tonsite://", with: "")
|
||||
}
|
||||
let text = NSMutableAttributedString(string: string)
|
||||
let range = NSMakeRange(0, text.length)
|
||||
|
@ -33,12 +33,15 @@ private func currentTemperatureUnit() -> TemperatureUnit {
|
||||
return temperatureUnit
|
||||
}
|
||||
|
||||
public func stringForTemperature(_ value: Double) -> String {
|
||||
private var formatter: MeasurementFormatter = {
|
||||
let formatter = MeasurementFormatter()
|
||||
formatter.locale = Locale.current
|
||||
formatter.unitStyle = .short
|
||||
formatter.numberFormatter.maximumFractionDigits = 0
|
||||
formatter.unitOptions = .temperatureWithoutUnit
|
||||
return formatter
|
||||
}()
|
||||
|
||||
public func stringForTemperature(_ value: Double) -> String {
|
||||
let valueString = formatter.string(from: Measurement(value: value, unit: UnitTemperature.celsius)).trimmingCharacters(in: CharacterSet(charactersIn: "0123456789-,.").inverted)
|
||||
return valueString + currentTemperatureUnit().suffix
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user