Skip to content

Commit

Permalink
v0.10.1 (501)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaigner committed May 6, 2022
1 parent ab001da commit 57c53e4
Show file tree
Hide file tree
Showing 63 changed files with 1,708 additions and 808 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.en.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Changelog

## [0.10.0 (495)] - 2022-03-24
## [0.10.1 (501)] - 2022-03-24

- New behavior of your address book! Now, an Olvid user becomes a contact only if you explicitly agree. You are now in full control of your address book!
- It is now possible to reply to a message or to mark it as read right from the notification!
- If you like a particular reaction made by another user, you can now easily add it to the list of your preferred reactions.
- Fixes a bug preventing a received message from being edited by the sender.
- Fixes an issue preventing the minimum supported and recommended Olvid version would not be properly updated.
- Background tasks are more reliable.

## [0.10.0 (495)] - 2022-03-21

- New behavior of your address book! Now, an Olvid user becomes a contact *only* if you explicitly agree. You are now in full control of your address book!
- A new list of "other" Olvid users is now accessible from the "Contacts" tab. Typically, these users are part of the same discussion groups as you. Inviting these users to be a contact of yours can be done in one tap!
- A group invite from a contact is now automatically accepted.
- You still need to explicitly accept group invites from Olvid users who are not part of your contacts.
Expand Down
12 changes: 10 additions & 2 deletions CHANGELOG.fr.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Changelog

## [0.10.0 (495)] - 2022-03-24
## [0.10.1 (501)] - 2022-03-24

- Nouveau comportement de votre carnet d'adresse Olvid ! Maintenant, un autre utilisateur d'Olvid devient un contact uniquement si vous l'acceptez explicitement. Vous avez enfin un contrôle total sur votre carnet d'adresse ;-)
- Il est maintenant possible de répondre à un message, ou de le marquer comme lu, directement depuis la notification !
- Si vous appréciez une réaction faite par un autre utilisateur, vous pouvez facilement l'ajouter à la liste de vos réactions préférées.
- Corrige un problème empêchant un message reçu d'être édité par son envoyeur.
- Corrige un problème empêchant la bonne mise à jour des versions supportées et recommandées d'Olvid.
- Les tâches de fonds sont plus robustes.

## [0.10.0 (495)] - 2022-03-21

- Nouveau comportement de votre carnet d'adresse Olvid ! Maintenant, un autre utilisateur d'Olvid devient un contact *uniquement* si vous l'acceptez explicitement. Vous avez enfin un contrôle total sur votre carnet d'adresse ;-)
- Une nouvelle liste « d'autres » utilisateurs d'Olvid est maintenant accessible depuis l'écran de Contacts. Ces utilisateurs sont typiquement ceux qui font partie des mêmes groupes que vous mais qui ne sont néanmoins pas des contacts. Pour vous les inviter en une touche !
- Maintenant, une invitation à un groupe provenant d'un contact est automatiquement acceptée.
- Vous devez toujours accepter explicitement une invitation à un groupe si elle provient d'un utilisateur qui ne fait partie de vos contacts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ final class Backup: NSManagedObject, ObvManagedObject {

private convenience init(forExport: Bool, status: Status, backupKey: BackupKey, delegateManager: ObvBackupDelegateManager) throws {

guard let obvContext = backupKey.obvContext else { throw NSError() }
guard let obvContext = backupKey.obvContext else { throw Self.makeError(message: "The context of the backupKey is nil") }

let entityDescription = NSEntityDescription.entity(forEntityName: Self.entityName, in: obvContext)!
self.init(entity: entityDescription, insertInto: obvContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,13 +703,13 @@ extension ObvBackupManagerImplementation {
public func fulfill(requiredDelegate delegate: AnyObject, forDelegateType delegateType: ObvEngineDelegateType) throws {
switch delegateType {
case .ObvCreateContextDelegate:
guard let delegate = delegate as? ObvCreateContextDelegate else { throw NSError() }
guard let delegate = delegate as? ObvCreateContextDelegate else { throw Self.makeError(message: "The ObvCreateContextDelegate is nil") }
delegateManager.contextCreator = delegate
case .ObvNotificationDelegate:
guard let delegate = delegate as? ObvNotificationDelegate else { throw NSError() }
guard let delegate = delegate as? ObvNotificationDelegate else { throw Self.makeError(message: "The ObvNotificationDelegate is nil") }
delegateManager.notificationDelegate = delegate
default:
throw NSError()
throw Self.makeError(message: "Unexpected delegate type")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ extension NetworkReceivedMessageDecryptor {

}


/// This method is called on each new received message.
func decryptAndProcess(_ receivedMessage: ObvNetworkReceivedMessageEncrypted, within obvContext: ObvContext) throws {

guard let delegateManager = delegateManager else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ extension InboxAttachmentToInboxAttachmentMigrationPolicyV24ToV25 {
throw makeError(message: "Could not create file for writting chunks")
}

guard let fh = FileHandle(forWritingAtPath: url.path) else { throw NSError() }
guard let fh = FileHandle(forWritingAtPath: url.path) else { throw makeError(message: "Could get FileHandle") }
fh.seek(toFileOffset: UInt64(cleartextLength))
fh.closeFile()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ final class PersistedEngineDialog: NSManagedObject, ObvManagedObject {
extension PersistedEngineDialog {

func update(with obvDialog: ObvDialog) throws {
guard self.uuid == obvDialog.uuid else { throw NSError() }
guard self.uuid == obvDialog.uuid else {
throw Self.makeError(message: "Could not get obvDialog's uuid")
}
self.obvDialog = obvDialog
notificationRelatedChanges.insert(.obvDialog)
}
Expand Down
47 changes: 14 additions & 33 deletions Engine/ObvEngine/ObvEngine/NotificationSender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension ObvEngine {

func registerToInternalNotifications() throws {

guard let notificationDelegate = notificationDelegate else { throw NSError() }
guard let notificationDelegate = notificationDelegate else { throw Self.makeError(message: "The notification delegate is not set") }

notificationCenterTokens.append(ObvNetworkFetchNotificationNew.observeAppStoreReceiptVerificationSucceededButSubscriptionIsExpired(within: notificationDelegate) { [weak self] (ownedIdentity, transactionIdentifier, flowId) in
guard let _self = self else { return }
Expand Down Expand Up @@ -642,21 +642,15 @@ extension ObvEngine {
guard let createContextDelegate = _self.createContextDelegate else { return }
guard let identityDelegate = _self.identityDelegate else { return }

var obvContactIdentity: ObvContactIdentity!
var error: Error?
var obvContactIdentity: ObvContactIdentity?
let randomFlowId = FlowIdentifier()
createContextDelegate.performBackgroundTaskAndWait(flowId: randomFlowId) { (obvContext) in
let _obvContactIdentity = ObvContactIdentity(contactCryptoIdentity: contactCryptoIdentity,
ownedCryptoIdentity: ownedCryptoIdentity,
identityDelegate: identityDelegate,
within: obvContext)
guard _obvContactIdentity != nil else {
error = NSError()
return
}
obvContactIdentity = _obvContactIdentity
obvContactIdentity = ObvContactIdentity(contactCryptoIdentity: contactCryptoIdentity,
ownedCryptoIdentity: ownedCryptoIdentity,
identityDelegate: identityDelegate,
within: obvContext)
}
guard error == nil else {
guard let obvContactIdentity = obvContactIdentity else {
os_log("Could not get contact identity", log: _self.log, type: .fault)
return
}
Expand All @@ -678,25 +672,18 @@ extension ObvEngine {
guard let createContextDelegate = _self.createContextDelegate else { return }
guard let identityDelegate = _self.identityDelegate else { return }

var obvContactIdentity: ObvContactIdentity!
var error: Error?
var obvContactIdentity: ObvContactIdentity?
let randomFlowId = FlowIdentifier()
createContextDelegate.performBackgroundTaskAndWait(flowId: randomFlowId) { (obvContext) in
let _obvContactIdentity = ObvContactIdentity(contactCryptoIdentity: contactCryptoIdentity,
obvContactIdentity = ObvContactIdentity(contactCryptoIdentity: contactCryptoIdentity,
ownedCryptoIdentity: ownedCryptoIdentity,
identityDelegate: identityDelegate,
within: obvContext)
guard _obvContactIdentity != nil else {
error = NSError()
return
}
obvContactIdentity = _obvContactIdentity
}
guard error == nil else {
guard let obvContactIdentity = obvContactIdentity else {
os_log("Could not get contact identity", log: _self.log, type: .fault)
return
}

ObvEngineNotificationNew.updatedContactIdentity(obvContactIdentity: obvContactIdentity, trustedIdentityDetailsWereUpdated: false, publishedIdentityDetailsWereUpdated: true)
.postOnBackgroundQueue(within: _self.appNotificationCenter)
}
Expand Down Expand Up @@ -852,19 +839,13 @@ extension ObvEngine {
guard let createContextDelegate = _self.createContextDelegate else { return }
guard let identityDelegate = _self.identityDelegate else { return }

var obvOwnedIdentity: ObvOwnedIdentity!
var error: Error?
var obvOwnedIdentity: ObvOwnedIdentity?
let randomFlowId = FlowIdentifier()
createContextDelegate.performBackgroundTaskAndWait(flowId: randomFlowId) { (obvContext) in
let _obvOwnedIdentity = ObvOwnedIdentity(ownedCryptoIdentity: ownedCryptoIdentity,
identityDelegate: identityDelegate, within: obvContext)
guard _obvOwnedIdentity != nil else {
error = NSError()
return
}
obvOwnedIdentity = _obvOwnedIdentity
obvOwnedIdentity = ObvOwnedIdentity(ownedCryptoIdentity: ownedCryptoIdentity,
identityDelegate: identityDelegate, within: obvContext)
}
guard error == nil else {
guard let obvOwnedIdentity = obvOwnedIdentity else {
os_log("Could not get owned identity", log: _self.log, type: .fault)
return
}
Expand Down
5 changes: 2 additions & 3 deletions Engine/ObvEngine/ObvEngine/ObvEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,10 @@ extension ObvEngine {

// MARK: - Public API for managing the database

extension ObvEngine {
extension ObvEngine: ObvErrorMaker {

private static let errorDomain = "ObvEngine"
public static let errorDomain = "ObvEngine"

private static func makeError(message: String) -> Error { NSError(domain: errorDomain, code: 0, userInfo: [NSLocalizedFailureReasonErrorKey: message]) }
private func makeError(message: String) -> Error { Self.makeError(message: message) }

public func replayTransactionsHistory() {
Expand Down
22 changes: 15 additions & 7 deletions Engine/ObvEngine/ObvEngine/Types/ObvAttachment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,23 @@ public struct ObvAttachment: Hashable {
return self.status == .paused
}

private static let errorDomain = String(describing: ObvAttachment.self)

private static func makeError(message: String, code: Int = 0) -> Error {
NSError(domain: "ObvAttachment", code: code, userInfo: [NSLocalizedFailureReasonErrorKey: message])
}


init(attachmentId: AttachmentIdentifier, networkFetchDelegate: ObvNetworkFetchDelegate, identityDelegate: ObvIdentityDelegate, within obvContext: ObvContext) throws {
guard let networkReceivedAttachment = networkFetchDelegate.getAttachment(withId: attachmentId, flowId: obvContext.flowId) else { throw NSError() }
guard let networkReceivedAttachment = networkFetchDelegate.getAttachment(withId: attachmentId, flowId: obvContext.flowId) else {
throw Self.makeError(message: "Coult not get attachment")
}
try self.init(networkReceivedAttachment: networkReceivedAttachment, identityDelegate: identityDelegate, within: obvContext)
}

init(attachmentId: AttachmentIdentifier, fromContactIdentity: ObvContactIdentity, networkFetchDelegate: ObvNetworkFetchDelegate, flowId: FlowIdentifier) throws {
guard let networkReceivedAttachment = networkFetchDelegate.getAttachment(withId: attachmentId, flowId: flowId) else { throw NSError() }
guard let networkReceivedAttachment = networkFetchDelegate.getAttachment(withId: attachmentId, flowId: flowId) else {
throw Self.makeError(message: "Coult not get attachment")
}
self.fromContactIdentity = fromContactIdentity
self.attachmentId = networkReceivedAttachment.attachmentId
metadata = networkReceivedAttachment.metadata
Expand All @@ -94,7 +102,9 @@ public struct ObvAttachment: Hashable {
guard let obvContact = ObvContactIdentity(contactCryptoIdentity: networkReceivedAttachment.fromCryptoIdentity,
ownedCryptoIdentity: networkReceivedAttachment.attachmentId.messageId.ownedCryptoIdentity,
identityDelegate: identityDelegate,
within: obvContext) else { throw NSError() }
within: obvContext) else {
throw Self.makeError(message: "Could not get ObvContactIdentity")
}
self.fromContactIdentity = obvContact
self.attachmentId = networkReceivedAttachment.attachmentId
metadata = networkReceivedAttachment.metadata
Expand Down Expand Up @@ -162,9 +172,7 @@ extension ObvAttachment: Codable {
self.url = try values.decode(URL.self, forKey: .url)
let rawStatus = try values.decode(Int.self, forKey: .status)
guard let status = Status(rawValue: rawStatus) else {
let message = "Could not decode status"
let userInfo = [NSLocalizedFailureReasonErrorKey: message]
throw NSError(domain: ObvAttachment.errorDomain, code: 0, userInfo: userInfo)
throw Self.makeError(message: "Could not decode status")
}
self.status = status
self.attachmentId = try values.decode(AttachmentIdentifier.self, forKey: .attachmentId)
Expand Down
7 changes: 6 additions & 1 deletion Engine/ObvEngine/ObvEngine/Types/ObvCryptoId.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public struct ObvCryptoId {
public func belongsTo(serverURL: URL) -> Bool {
return cryptoIdentity.serverURL == serverURL
}

private static func makeError(message: String, code: Int = 0) -> Error {
NSError(domain: "ObvCryptoId", code: code, userInfo: [NSLocalizedFailureReasonErrorKey: message])
}

}


Expand Down Expand Up @@ -88,7 +93,7 @@ extension ObvCryptoId {
}

public init(identity: Data) throws {
guard let cryptoIdentity = ObvCryptoIdentity(from: identity) else { throw NSError() }
guard let cryptoIdentity = ObvCryptoIdentity(from: identity) else { throw Self.makeError(message: "Could not get ObvCryptoIdentity") }
self.cryptoIdentity = cryptoIdentity
}

Expand Down
17 changes: 13 additions & 4 deletions Engine/ObvEngine/ObvEngine/Types/ObvMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,30 @@ public struct ObvMessage {
return fromContactIdentity.ownedIdentity.cryptoId
}


private static func makeError(message: String, code: Int = 0) -> Error {
NSError(domain: "ObvMessage", code: code, userInfo: [NSLocalizedFailureReasonErrorKey: message])
}


init(messageId: MessageIdentifier, networkFetchDelegate: ObvNetworkFetchDelegate, identityDelegate: ObvIdentityDelegate, within obvContext: ObvContext) throws {

guard let networkReceivedMessage = networkFetchDelegate.getDecryptedMessage(messageId: messageId, flowId: obvContext.flowId) else { throw NSError() }
guard let networkReceivedMessage = networkFetchDelegate.getDecryptedMessage(messageId: messageId, flowId: obvContext.flowId) else {
throw Self.makeError(message: "The call to getDecryptedMessage did fail")
}

try self.init(networkReceivedMessage: networkReceivedMessage, networkFetchDelegate: networkFetchDelegate, identityDelegate: identityDelegate, within: obvContext)

}


init(networkReceivedMessage: ObvNetworkReceivedMessageDecrypted, networkFetchDelegate: ObvNetworkFetchDelegate, identityDelegate: ObvIdentityDelegate, within obvContext: ObvContext) throws {
guard let obvContact = ObvContactIdentity(contactCryptoIdentity: networkReceivedMessage.fromIdentity,
ownedCryptoIdentity: networkReceivedMessage.messageId.ownedCryptoIdentity,
identityDelegate: identityDelegate,
within: obvContext) else { throw NSError() }


within: obvContext) else {
throw Self.makeError(message: "Could not get ObvContactIdentity")
}

self.fromContactIdentity = obvContact
self.messageId = networkReceivedMessage.messageId
Expand Down
4 changes: 2 additions & 2 deletions Engine/ObvFlowManager/ObvFlowManager/ObvFlowManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ extension ObvFlowManager {
public func fulfill(requiredDelegate delegate: AnyObject, forDelegateType delegateType: ObvEngineDelegateType) throws {
switch delegateType {
case .ObvNotificationDelegate:
guard let delegate = delegate as? ObvNotificationDelegate else { throw NSError() }
guard let delegate = delegate as? ObvNotificationDelegate else { throw Self.makeError(message: "The ObvNotificationDelegate is not set") }
delegateManager.notificationDelegate = delegate
default:
throw NSError()
throw Self.makeError(message: "Unexpected delegate type")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ final class BootstrapWorker {
self?.deleteOrphanedDatabaseObjects(flowId: flowId, log: log, contextCreator: contextCreator)
self?.reschedulePendingDeleteFromServers(flowId: flowId, log: log, delegateManager: delegateManager, contextCreator: contextCreator)
delegateManager.downloadAttachmentChunksDelegate.cleanExistingOutboxAttachmentSessions(flowId: flowId)
delegateManager.wellKnownCacheDelegate.initializateCache(flowId: flowId)
}

}
Expand Down Expand Up @@ -106,6 +105,7 @@ final class BootstrapWorker {
internalQueue.addOperation { [weak self] in
// We cannot call this method in the finalizeInitialization method because the generated notifications would not be received by the app
self?.rescheduleAllInboxMessagesAndAttachments(flowId: flowId, log: log, contextCreator: contextCreator, delegateManager: delegateManager)
delegateManager.wellKnownCacheDelegate.initializateCache(flowId: flowId)
}
}

Expand Down
Loading

0 comments on commit 57c53e4

Please sign in to comment.