mirror of https://github.com/oxen-io/session-ios
Fixed a few more bugs and tweaked attachment download logic
Updated the code to only auto-start attachment downloads when a user opens a conversation (and only for the current page of messages) Updated the GarbageCollectionJob to default to handling all cases (instead of requiring the cases to be defined) - this means we can add future cases without having to recreate the default job Added logic to remove approved blinded contact records as part of the GarbageCollectionJob Added code to better handle "invalid" attachments when migrating Added a mechanism to retrieve the details for currently running jobs (ie. allows us to check for duplicate concurrent jobs) Resolved the remaining TODOs in the GRDB migration code Cleaned up DB update logic to update only the targeted columns Fixed a bug due to a typo in a localised string Fixed a bug where link previews without images or with custom copy weren't being processed as link previews Fixed a bug where Open Groups could display with an empty name valuepull/612/head
parent
f2bd72b3ae
commit
eb0118ac10
@ -1,40 +0,0 @@
|
||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||
|
||||
import Foundation
|
||||
|
||||
@objc(SNBlindedIdMapping)
|
||||
public final class BlindedIdMapping: NSObject, NSCoding { // NSObject/NSCoding conformance is needed for YapDatabase compatibility
|
||||
@objc public let blindedId: String
|
||||
@objc public let sessionId: String
|
||||
@objc public let serverPublicKey: String
|
||||
|
||||
// MARK: - Initialization
|
||||
|
||||
@objc public init(blindedId: String, sessionId: String, serverPublicKey: String) {
|
||||
self.blindedId = blindedId
|
||||
self.sessionId = sessionId
|
||||
self.serverPublicKey = serverPublicKey
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
private override init() { preconditionFailure("Use init(blindedId:sessionId:) instead.") }
|
||||
|
||||
// MARK: - Coding
|
||||
|
||||
public required init?(coder: NSCoder) {
|
||||
guard let blindedId: String = coder.decodeObject(forKey: "blindedId") as! String? else { return nil }
|
||||
guard let sessionId: String = coder.decodeObject(forKey: "sessionId") as! String? else { return nil }
|
||||
guard let serverPublicKey: String = coder.decodeObject(forKey: "serverPublicKey") as! String? else { return nil }
|
||||
|
||||
self.blindedId = blindedId
|
||||
self.sessionId = sessionId
|
||||
self.serverPublicKey = serverPublicKey
|
||||
}
|
||||
|
||||
public func encode(with coder: NSCoder) {
|
||||
coder.encode(blindedId, forKey: "blindedId")
|
||||
coder.encode(sessionId, forKey: "sessionId")
|
||||
coder.encode(serverPublicKey, forKey: "serverPublicKey")
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||
|
||||
import Foundation
|
||||
|
||||
import Quick
|
||||
import Nimble
|
||||
|
||||
@testable import SessionMessagingKit
|
||||
|
||||
class BlindedIdLookupSpec: QuickSpec {
|
||||
// MARK: - Spec
|
||||
|
||||
override func spec() {
|
||||
describe("a BlindedIdLookup") {
|
||||
context("when initializing") {
|
||||
it("sets the values correctly") {
|
||||
let lookup: BlindedIdLookup = BlindedIdLookup(
|
||||
blindedId: "testBlindedId",
|
||||
sessionId: "testSessionId",
|
||||
openGroupServer: "testServer",
|
||||
openGroupPublicKey: "testPublicKey"
|
||||
)
|
||||
|
||||
expect(lookup.blindedId).to(equal("testBlindedId"))
|
||||
expect(lookup.sessionId).to(equal("testSessionId"))
|
||||
expect(lookup.openGroupServer).to(equal("testServer"))
|
||||
expect(lookup.openGroupPublicKey).to(equal("testPublicKey"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||
|
||||
import Foundation
|
||||
|
||||
import Quick
|
||||
import Nimble
|
||||
|
||||
@testable import SessionMessagingKit
|
||||
|
||||
class BlindedIdMappingSpec: QuickSpec {
|
||||
// MARK: - Spec
|
||||
|
||||
override func spec() {
|
||||
describe("a BlindedIdMapping") {
|
||||
context("when initializing") {
|
||||
it("sets the values correctly") {
|
||||
let mapping: BlindedIdMapping = BlindedIdMapping(
|
||||
blindedId: "testBlindedId",
|
||||
sessionId: "testSessionId",
|
||||
serverPublicKey: "testPublicKey"
|
||||
)
|
||||
|
||||
expect(mapping.blindedId).to(equal("testBlindedId"))
|
||||
expect(mapping.sessionId).to(equal("testSessionId"))
|
||||
expect(mapping.serverPublicKey).to(equal("testPublicKey"))
|
||||
}
|
||||
}
|
||||
|
||||
context("when NSCoding") {
|
||||
// Note: Unit testing NSCoder is horrible so we won't do it properly - wait until we refactor it to Codable
|
||||
it("successfully encodes and decodes") {
|
||||
let mappingToEncode: BlindedIdMapping = BlindedIdMapping(
|
||||
blindedId: "testBlindedId",
|
||||
sessionId: "testSessionId",
|
||||
serverPublicKey: "testPublicKey"
|
||||
)
|
||||
let encodedData: Data = try! NSKeyedArchiver.archivedData(withRootObject: mappingToEncode, requiringSecureCoding: false)
|
||||
let mapping: BlindedIdMapping? = try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(encodedData) as? BlindedIdMapping
|
||||
|
||||
expect(mapping).toNot(beNil())
|
||||
expect(mapping?.blindedId).to(equal("testBlindedId"))
|
||||
expect(mapping?.sessionId).to(equal("testSessionId"))
|
||||
expect(mapping?.serverPublicKey).to(equal("testPublicKey"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue