Skip to content

Commit

Permalink
v0.11.0 (542)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaigner committed Sep 21, 2022
1 parent 6d00b52 commit 9448fb4
Show file tree
Hide file tree
Showing 621 changed files with 11,692 additions and 7,992 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.en.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [0.11.0 (542)] - 2022-07-20

- Starting Olvid is way faster than before!
- The information screen about a sent message now shows information about the reception of its attachments and, if the recipient allows it, information about whether the attachment was seen or not.
- Return receipts on messages and attachments are sent (and thus received) much faster than before.
- A red badge allows to distinguish between audio messages you already listened to from those you did not.
- Fixes an issue sometimes preventing messages to be marked as "not new" when entering a discussion.
- Fixes a potential crash occurring when deleting a message while the corresponding discussion is displayed on screen.
- Fixes an issue sometimes preventing the UI to update itself at the end of the download of an attachment.

## [0.10.3 (533)] - 2022-06-29

- It is now possible to customize the alert sound for message notifications. You should definitively try our very exclusive, never heard before, unprecedented polyphonic sounds :-)
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.fr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [0.11.0 (542)] - 2022-07-20

- Le démarrage d'Olvid devrait être beaucoup plus rapide qu'avant !
- La vue d'information d'un message envoyé affiche maintenant des informations concernant la bonne réception des pièces jointes du message et, si le destinataire le permet, une information indiquant si la pièce jointe a été visualisée ou pas.
- Les accusés de réception de message / pièce jointe sont envoyés (et donc reçus) beaucoup plus rapidement.
- Un badge rouge permet de bien distinguer les messages audios que vous n'avez pas encore écoutés.
- Corrige un bug empêchant parfois certains messages non lus d'être marqués comme « lus ».
- Corrige un bug empêchant parfois l'interface de se mettre à jour au moment de la finalisation du téléchargement d'une pièce jointe.
- Corrige un bug pouvant parfois entraîner un crash au moment de la suppression d'un message dont la discussion correspondante est affichée à l'écran.

## [0.10.3 (533)] - 2022-06-29

- Vous pouvez maintenant choisir la sonnerie associée aux alertes des messages d'une discussion ! N'hésitez pas à essayer nos sons polyphoniques exclusifs, jamais entendus auparavant, absolument uniques :-)
Expand Down
5 changes: 4 additions & 1 deletion CoreDataStack/CoreDataStack/CoreDataStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ import Foundation
import CoreData
import SwiftUI
import OlvidUtils
import os.log

final public class CoreDataStack<PersistentContainerType: NSPersistentContainer> {

private let modelName: String
private let transactionAuthor: String
private var notificationTokens = [NSObjectProtocol]()
private let log: OSLog

private var automaticallyMergesChangesFromParentWithAnimationWasCalled = false

public init(modelName: String, transactionAuthor: String) {
self.modelName = modelName
self.transactionAuthor = transactionAuthor
self.log = OSLog(subsystem: "io.olvid.messenger", category: "CoreDataStack-\(modelName)")
}

private lazy var persistentContainer: PersistentContainerType = {
Expand Down Expand Up @@ -60,7 +63,7 @@ final public class CoreDataStack<PersistentContainerType: NSPersistentContainer>
} catch let error as NSError {
fatalError("Error excluding \(persistentStoreURL) from backup \(error)")
}
debugPrint("The App persistent store was excluded from iCloud and iTunes backup")
os_log("The App persistent store was excluded from iCloud and iTunes backup", log: log, type: .info)

}

Expand Down
10 changes: 6 additions & 4 deletions CoreDataStack/CoreDataStack/DataMigrationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ open class DataMigrationManager<PersistentContainerType: NSPersistentContainer>
public let modelName: String
private let storeName: String
private let transactionAuthor: String
private let log = OSLog(subsystem: "io.olvid.messenger", category: "CoreDataStack")
private let log: OSLog
private var kvObservations = [NSKeyValueObservation]()

private static func makeError(code: Int = 0, message: String) -> Error {
Expand Down Expand Up @@ -139,18 +139,20 @@ open class DataMigrationManager<PersistentContainerType: NSPersistentContainer>
self.transactionAuthor = transactionAuthor
self.enableMigrations = enableMigrations
self.migrationRunningLog = migrationRunningLog
let logCategory = "CoreDataStack-\(storeName)"
self.log = OSLog(subsystem: "io.olvid.messenger", category: logCategory)
}


// MARK: - Persistent store

private var storeURL: URL {
lazy private var storeURL: URL = {
let directory = PersistentContainerType.defaultDirectoryURL()
let storeFileName = [storeName, "sqlite"].joined(separator: ".")
let url = URL(fileURLWithPath: storeFileName, relativeTo: directory)
debugPrint("Store URL is: \(url)")
os_log("Store URL is %{public}@", log: log, type: .info, url.path)
return url
}
}()

private func storeExists() -> Bool {
let res = FileManager.default.fileExists(atPath: storeURL.path)
Expand Down
4 changes: 2 additions & 2 deletions Engine/JWS/JWS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = VMDQ4PU27W;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -318,7 +318,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = VMDQ4PU27W;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down
16 changes: 8 additions & 8 deletions Engine/ObvBackupManager/.swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ disabled_rules:
- redundant_objc_attribute
- nsobject_prefer_isequal
- unused_setter_value
#custom_rules:
# commented_code:
# regex: '(?<!:|\/)\/\/\h*[a-z.](?!wiftlint)'
# message: "Comment starting with lowercase letter - did you forget to delete old code?"
# multiline_commented_code:
# regex: '^\s*[a-z]'
# match_kinds: comment
# message: "Comment starting with lowercase letter - did you forget to delete old code?"
custom_rules:
commented_code:
regex: '(?<!:|\/)\/\/\h*[a-z.](?!wiftlint)'
message: "Comment starting with lowercase letter - did you forget to delete old code?"
multiline_commented_code:
regex: '^\s*[a-z]'
match_kinds: comment
message: "Comment starting with lowercase letter - did you forget to delete old code?"
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = VMDQ4PU27W;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -381,7 +381,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = VMDQ4PU27W;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -718,18 +718,26 @@ extension ObvBackupManagerImplementation {
ObvEngineDelegateType.ObvNotificationDelegate]
}


public func finalizeInitialization(flowId: FlowIdentifier, runningLog: RunningLogError) throws {

// Observe `observeBackupableManagerDatabaseContentChanged` notifications for automatic backups
notificationTokens.append(ObvBackupNotification.observeBackupableManagerDatabaseContentChanged(within: delegateManager.notificationDelegate, queue: internalNotificationQueue) { [weak self] (flowId) in
self?.isBackupRequired = true
})
notificationTokens.append(contentsOf: [
ObvBackupNotification.observeBackupableManagerDatabaseContentChanged(within: delegateManager.notificationDelegate, queue: internalNotificationQueue) { [weak self] (flowId) in
self?.isBackupRequired = true
}
])

evaluateIfBackupIsRequired(flowId: flowId)

}


public func applicationAppearedOnScreen(forTheFirstTime: Bool, flowId: FlowIdentifier) async {
if forTheFirstTime {
evaluateIfBackupIsRequired(flowId: flowId)
}
}


private func evaluateIfBackupIsRequired(flowId: FlowIdentifier) {

let log = self.log
Expand Down Expand Up @@ -781,9 +789,6 @@ extension ObvBackupManagerImplementation {
}
}

public func applicationDidStartRunning(flowId: FlowIdentifier) {}
public func applicationDidEnterBackground() {}

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ final public class ObvBackupManagerImplementationDummy: ObvBackupDelegate {
self.log = OSLog(subsystem: logSubsystem, category: "ObvBackupManagerImplementationDummy")
}

public func applicationDidStartRunning(flowId: FlowIdentifier) {}
public func applicationDidEnterBackground() {}
public func applicationAppearedOnScreen(forTheFirstTime: Bool, flowId: FlowIdentifier) async {}

private static let errorDomain = "ObvBackupManagerImplementationDummy"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,84 +20,81 @@
import Foundation
import ObvTypes
import OlvidUtils

import os.log

final class GateKeeper {



private let readOnly: Bool

private let slotManager: ObvContextSlotManager


init(readOnly: Bool) {
self.readOnly = readOnly
self.slotManager = ObvContextSlotManager()
}

private let contextOperationQueue: ContextOperationQueue = {
let queue = ContextOperationQueue()
queue.maxConcurrentOperationCount = 1
queue.isSuspended = false
return queue
}()


func waitUntilSlotIsAvailableForObvContext(_ obvContext: ObvContext) throws {

if self.readOnly {

// If the context is read-only (which is the case when the engine is initialized by the notification extension), we make sure that the context is never saved
try obvContext.addContextWillSaveCompletionHandler {
assertionFailure("The channel manager expects this context to be read only")
return
}

} else {
// If the context is not read-only, we ensure that two contexts cannot access the channel manager at the same time.
if try contextOperationQueue.getContextOfExecutingOperation() != obvContext {
let contextOperation = ContextOperation(obvContext: obvContext)
contextOperationQueue.addOperation(contextOperation)
contextOperation.operationStarted.wait()
}

slotManager.waitUntilSlotIsAvailableForObvContext(obvContext)

}
}

}


// MARK: - ObvContextSlotManager

fileprivate final class ObvContextSlotManager {

fileprivate final class ContextOperation: Operation {
private let semaphore = DispatchSemaphore(value: 1) // Tested

let operationStarted = DispatchSemaphore(value: 0)
private let contextFreed = DispatchSemaphore(value: 0)
let obvContext: ObvContext
private let queueForCurrentContextInSlot = DispatchQueue(label: "ObvContextSlotManager queue for context in slot", attributes: [.concurrent])
private var _currentContextInSlot: ObvContext?

init(obvContext: ObvContext) {
self.obvContext = obvContext
super.init()
self.obvContext.addEndOfScopeCompletionHandler { [weak self] in
debugPrint("🧠 End of scope of the context \(obvContext.name)")
self?.contextFreed.signal()
private var currentContextInSlot: ObvContext? {
get {
return queueForCurrentContextInSlot.sync { return _currentContextInSlot }
}
set {
queueForCurrentContextInSlot.async(flags: .barrier) { [weak self] in self?._currentContextInSlot = newValue }
}
}

override func main() {
operationStarted.signal()
debugPrint("🧠 About to wait for the end of scope of the context \(obvContext.name)")
contextFreed.wait()
}

}

func waitUntilSlotIsAvailableForObvContext(_ obvContext: ObvContext) {

fileprivate final class ContextOperationQueue: OperationQueue {

private static var errorDomain: String { "GateKeeper" }

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


func getContextOfExecutingOperation() throws -> ObvContext? {
let executingOperations = operations.filter { $0.isExecuting }
guard executingOperations.count < 2 else {
throw ContextOperationQueue.makeError(message: "Expecting at most 1 executing operation, found \(executingOperations.count)")
// If the slot is taken by the obvContext we just reaceived (which happens for re-entrant calls), we can return immediately

guard currentContextInSlot != obvContext else {
return
}

semaphore.wait()

assert(currentContextInSlot == nil)

currentContextInSlot = obvContext

obvContext.addEndOfScopeCompletionHandler { [weak self] in
assert(self?.currentContextInSlot == obvContext)
self?.currentContextInSlot = nil
self?.semaphore.signal()
}
return (executingOperations.first as? ContextOperation)?.obvContext


}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class ObliviousChannelLifeManager: ObliviousChannelLifeDelegate {
weak var delegateManager: ObvChannelDelegateManager?
private static let logCategory = "ObliviousChannelLifeManager"

func finalizeInitialization(within obvContext: ObvContext) throws {
func deleteExpiredKeyMaterialsAndProvisions(within obvContext: ObvContext) throws {

guard let delegateManager = delegateManager else {
let log = OSLog(subsystem: ObvChannelDelegateManager.defaultLogSubsystem, category: ObliviousChannelLifeManager.logCategory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import OlvidUtils

protocol ObliviousChannelLifeDelegate {

func finalizeInitialization(within: ObvContext) throws
func deleteExpiredKeyMaterialsAndProvisions(within: ObvContext) throws

func deleteAllObliviousChannelsBetweenTheCurrentDeviceOf(ownedIdentity: ObvCryptoIdentity, andTheDevicesOfContactIdentity: ObvCryptoIdentity, within: ObvContext) throws

Expand Down
Loading

0 comments on commit 9448fb4

Please sign in to comment.