From 9bee25f6c6acfd7f980747f7849a67e213aae681 Mon Sep 17 00:00:00 2001
From: Niels Andriesse
Date: Wed, 28 Aug 2019 16:38:20 +1000
Subject: [PATCH] Clean
---
Signal/src/Loki/LokiRSSFeedPoller.swift | 2 +-
Signal/src/Loki/NewConversationViewController.swift | 6 +++---
SignalServiceKit/src/Loki/API/LokiAPI.swift | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Signal/src/Loki/LokiRSSFeedPoller.swift b/Signal/src/Loki/LokiRSSFeedPoller.swift
index 4539a851a..4cac9710b 100644
--- a/Signal/src/Loki/LokiRSSFeedPoller.swift
+++ b/Signal/src/Loki/LokiRSSFeedPoller.swift
@@ -35,7 +35,7 @@ public final class LokiRSSFeedPoller : NSObject {
guard let title = item.title, let description = item.description, let date = item.pubDate else { return }
let timestamp = UInt64(date.timeIntervalSince1970 * 1000)
let urlRegex = try! NSRegularExpression(pattern: "]*?\\s+)?href=\"([^\"]*)\".*?>(.*?)<.*?\\/a>")
- var bodyAsHTML = "\(title)
\(description)"
+ var bodyAsHTML = "\(title)
\(description)".replacingOccurrences(of: "
", with: "
")
while true {
guard let match = urlRegex.firstMatch(in: bodyAsHTML, options: [], range: NSRange(location: 0, length: bodyAsHTML.utf16.count)) else { break }
let matchRange = match.range(at: 0)
diff --git a/Signal/src/Loki/NewConversationViewController.swift b/Signal/src/Loki/NewConversationViewController.swift
index 8d41efe70..a7e89efcb 100644
--- a/Signal/src/Loki/NewConversationViewController.swift
+++ b/Signal/src/Loki/NewConversationViewController.swift
@@ -44,7 +44,7 @@ final class NewConversationViewController : OWSViewController, OWSQRScannerDeleg
// Next button
let nextButtonFont = UIFont.ows_dynamicTypeBodyClamped.ows_mediumWeight()
let nextButtonHeight = nextButtonFont.pointSize * 48 / 17
- let nextButton = OWSFlatButton.button(title: NSLocalizedString("Next", comment: ""), font: nextButtonFont, titleColor: .white, backgroundColor: .lokiGreen(), target: self, selector: #selector(startNewConversationIfPossible))
+ let nextButton = OWSFlatButton.button(title: NSLocalizedString("Next", comment: ""), font: nextButtonFont, titleColor: .white, backgroundColor: .lokiGreen(), target: self, selector: #selector(handleNextButtonTapped))
nextButton.autoSetDimension(.height, toSize: nextButtonHeight)
// Stack view
let stackView = UIStackView(arrangedSubviews: [
@@ -95,12 +95,12 @@ final class NewConversationViewController : OWSViewController, OWSQRScannerDeleg
startNewConversationIfPossible(with: hexEncodedPublicKey)
}
- private func handleNextButtonTapped() {
+ @objc private func handleNextButtonTapped() {
let hexEncodedPublicKey = publicKeyTextField.text?.trimmingCharacters(in: .whitespaces) ?? ""
startNewConversationIfPossible(with: hexEncodedPublicKey)
}
- @objc private func startNewConversationIfPossible(with hexEncodedPublicKey: String) {
+ private func startNewConversationIfPossible(with hexEncodedPublicKey: String) {
if !ECKeyPair.isValidHexEncodedPublicKey(candidate: hexEncodedPublicKey) {
let alert = UIAlertController(title: NSLocalizedString("Invalid Public Key", comment: ""), message: NSLocalizedString("Please check the public key you entered and try again.", comment: ""), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
diff --git a/SignalServiceKit/src/Loki/API/LokiAPI.swift b/SignalServiceKit/src/Loki/API/LokiAPI.swift
index a79a45eac..04e74f481 100644
--- a/SignalServiceKit/src/Loki/API/LokiAPI.swift
+++ b/SignalServiceKit/src/Loki/API/LokiAPI.swift
@@ -12,7 +12,7 @@ public final class LokiAPI : NSObject {
private static let defaultTimeout: TimeInterval = 20
private static let longPollingTimeout: TimeInterval = 40
public static let defaultMessageTTL: UInt64 = 24 * 60 * 60 * 1000
- internal static var powDifficulty: UInt = 100
+ internal static var powDifficulty: UInt = 40
// MARK: Types
public typealias RawResponse = Any