pull/44/head
Niels Andriesse 6 years ago
parent 1313c9c8d3
commit 9bee25f6c6

@ -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: "<a\\s+(?:[^>]*?\\s+)?href=\"([^\"]*)\".*?>(.*?)<.*?\\/a>")
var bodyAsHTML = "\(title)<br>\(description)"
var bodyAsHTML = "\(title)<br><br>\(description)".replacingOccurrences(of: "</p>", with: "</p><br>")
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)

@ -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))

@ -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

Loading…
Cancel
Save