Merge remote-tracking branch 'upstream/dev' into feature/uniform-type-identifiers-refactoring

# Conflicts:
#	Session/Meta/Translations/InfoPlist.xcstrings
pull/1034/head
Morgan Pretty 7 months ago
commit d570e10430

@ -88,20 +88,6 @@ local sim_delete_cmd = 'if [ -f build/artifacts/sim_uuid ]; then rm -f /Users/$U
status: ['failure', 'success'], status: ['failure', 'success'],
}, },
}, },
{
name: 'Install Codecov CLI',
commands: [
'mkdir -p build/artifacts',
'pip3 install codecov-cli',
'find $HOME/Library/Python -name codecovcli -print -quit > ./build/artifacts/codecov_path',
|||
if [[ ! -s ./build/artifacts/codecov_path ]]; then
which codecovcli > ./build/artifacts/codecov_path
fi
|||,
'$(<./build/artifacts/codecov_path) --version',
],
},
{ {
name: 'Convert xcresult to xml', name: 'Convert xcresult to xml',
commands: [ commands: [
@ -109,17 +95,6 @@ local sim_delete_cmd = 'if [ -f build/artifacts/sim_uuid ]; then rm -f /Users/$U
], ],
depends_on: ['Build and Run Tests'], depends_on: ['Build and Run Tests'],
}, },
{
// No token needed for public repos
name: 'Upload coverage to Codecov',
commands: [
'$(<./build/artifacts/codecov_path) upload-process --fail-on-error -f ./build/artifacts/coverage.xml',
],
depends_on: [
'Convert xcresult to xml',
'Install Codecov CLI',
],
},
], ],
}, },
// Validate build artifact was created by the direct branch push (PRs only) // Validate build artifact was created by the direct branch push (PRs only)

@ -1 +1 @@
Subproject commit f19df114e5f4f6c29112f49c0b4897d7b93b78f1 Subproject commit 10f15aeb1f9712452adf55a8d0826be6271c10e4

@ -264,7 +264,7 @@ enum ScriptAction: String {
return return
} }
if let data: Data = try? JSONSerialization.data(withJSONObject: updatedInfoPlistJSON, options: [ .fragmentsAllowed ]) { if let data: Data = try? JSONSerialization.data(withJSONObject: updatedInfoPlistJSON, options: [ .fragmentsAllowed, .sortedKeys ]) {
do { do {
try data.write(to: URL(fileURLWithPath: projectState.infoPlistLocalizationFile.path), options: [.atomic]) try data.write(to: URL(fileURLWithPath: projectState.infoPlistLocalizationFile.path), options: [.atomic])
} catch { } catch {

@ -4634,7 +4634,6 @@
FD5E93D52C12D8120038C25A /* Add Commit Hash To Build Info Plist */, FD5E93D52C12D8120038C25A /* Add Commit Hash To Build Info Plist */,
FD5E93D72C12DA400038C25A /* Add App Group To Build Info Plist */, FD5E93D72C12DA400038C25A /* Add App Group To Build Info Plist */,
FDC498C12AC1775400EDD897 /* Ensure Localizable.strings included */, FDC498C12AC1775400EDD897 /* Ensure Localizable.strings included */,
943BC5A02C6F26370066A56A /* Ensure InfoPlist.xcstrings updated */,
); );
buildRules = ( buildRules = (
); );
@ -4777,6 +4776,7 @@
FDD82C422A2085B900425F05 /* Add Commit Hash To Build Info Plist */, FDD82C422A2085B900425F05 /* Add Commit Hash To Build Info Plist */,
FD5E93D32C12D3990038C25A /* Add App Group To Build Info Plist */, FD5E93D32C12D3990038C25A /* Add App Group To Build Info Plist */,
FDC498BF2AC1747900EDD897 /* Ensure Localizable.strings included */, FDC498BF2AC1747900EDD897 /* Ensure Localizable.strings included */,
FD0B1FA92CA3805C00F60F46 /* Ensure InfoPlist.xcstrings updated */,
); );
buildRules = ( buildRules = (
); );
@ -5263,7 +5263,7 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
943BC5A02C6F26370066A56A /* Ensure InfoPlist.xcstrings updated */ = { FD0B1FA92CA3805C00F60F46 /* Ensure InfoPlist.xcstrings updated */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1; alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -5301,6 +5301,7 @@
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "INFO_PLIST=\"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\"\nENTITLEMENTS_FILE=\"${SRCROOT}/${CODE_SIGN_ENTITLEMENTS}\"\n\n# Wait for Info.plist to be processed\nwhile [[ ! -f \"${INFO_PLIST}\" ]] && [[ ! -f \"${ENTITLEMENTS_FILE}\" ]]; do\n echo \"Waiting for plist and entitlements to be copied\"\n sleep 1\ndone\n\n# Query and save the value; suppress any error message, if key not found.\nvalue=$(/usr/libexec/PlistBuddy -c 'print :AppGroupsId' \"${INFO_PLIST}\" 2>/dev/null)\n\n# Check if value is empty\nif [ -z \"$value\" ] \nthen\n /usr/libexec/PlistBuddy -c \"Add :AppGroupsId string\" \"${INFO_PLIST}\"\nfi\n\napp_group_id=$(xmllint --xpath 'string(//key[.=\"com.apple.security.application-groups\"]/following-sibling::array/string)' \"$ENTITLEMENTS_FILE\")\n\n/usr/libexec/PlistBuddy -c \"Set :AppGroupsId ${app_group_id}\" \"${INFO_PLIST}\"\n"; shellScript = "INFO_PLIST=\"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\"\nENTITLEMENTS_FILE=\"${SRCROOT}/${CODE_SIGN_ENTITLEMENTS}\"\n\n# Wait for Info.plist to be processed\nwhile [[ ! -f \"${INFO_PLIST}\" ]] && [[ ! -f \"${ENTITLEMENTS_FILE}\" ]]; do\n echo \"Waiting for plist and entitlements to be copied\"\n sleep 1\ndone\n\n# Query and save the value; suppress any error message, if key not found.\nvalue=$(/usr/libexec/PlistBuddy -c 'print :AppGroupsId' \"${INFO_PLIST}\" 2>/dev/null)\n\n# Check if value is empty\nif [ -z \"$value\" ] \nthen\n /usr/libexec/PlistBuddy -c \"Add :AppGroupsId string\" \"${INFO_PLIST}\"\nfi\n\napp_group_id=$(xmllint --xpath 'string(//key[.=\"com.apple.security.application-groups\"]/following-sibling::array/string)' \"$ENTITLEMENTS_FILE\")\n\n/usr/libexec/PlistBuddy -c \"Set :AppGroupsId ${app_group_id}\" \"${INFO_PLIST}\"\n";
showEnvVarsInLog = 0;
}; };
FD5E93D42C12D3CB0038C25A /* Add Commit Hash To Build Info Plist */ = { FD5E93D42C12D3CB0038C25A /* Add Commit Hash To Build Info Plist */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@ -5364,6 +5365,7 @@
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "INFO_PLIST=\"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\"\nENTITLEMENTS_FILE=\"${SRCROOT}/${CODE_SIGN_ENTITLEMENTS}\"\n\n# Wait for Info.plist to be processed\nwhile [[ ! -f \"${INFO_PLIST}\" ]] && [[ ! -f \"${ENTITLEMENTS_FILE}\" ]]; do\n echo \"Waiting for plist and entitlements to be copied\"\n sleep 1\ndone\n\n# Query and save the value; suppress any error message, if key not found.\nvalue=$(/usr/libexec/PlistBuddy -c 'print :AppGroupsId' \"${INFO_PLIST}\" 2>/dev/null)\n\n# Check if value is empty\nif [ -z \"$value\" ] \nthen\n /usr/libexec/PlistBuddy -c \"Add :AppGroupsId string\" \"${INFO_PLIST}\"\nfi\n\napp_group_id=$(xmllint --xpath 'string(//key[.=\"com.apple.security.application-groups\"]/following-sibling::array/string)' \"$ENTITLEMENTS_FILE\")\n\n/usr/libexec/PlistBuddy -c \"Set :AppGroupsId ${app_group_id}\" \"${INFO_PLIST}\"\n"; shellScript = "INFO_PLIST=\"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\"\nENTITLEMENTS_FILE=\"${SRCROOT}/${CODE_SIGN_ENTITLEMENTS}\"\n\n# Wait for Info.plist to be processed\nwhile [[ ! -f \"${INFO_PLIST}\" ]] && [[ ! -f \"${ENTITLEMENTS_FILE}\" ]]; do\n echo \"Waiting for plist and entitlements to be copied\"\n sleep 1\ndone\n\n# Query and save the value; suppress any error message, if key not found.\nvalue=$(/usr/libexec/PlistBuddy -c 'print :AppGroupsId' \"${INFO_PLIST}\" 2>/dev/null)\n\n# Check if value is empty\nif [ -z \"$value\" ] \nthen\n /usr/libexec/PlistBuddy -c \"Add :AppGroupsId string\" \"${INFO_PLIST}\"\nfi\n\napp_group_id=$(xmllint --xpath 'string(//key[.=\"com.apple.security.application-groups\"]/following-sibling::array/string)' \"$ENTITLEMENTS_FILE\")\n\n/usr/libexec/PlistBuddy -c \"Set :AppGroupsId ${app_group_id}\" \"${INFO_PLIST}\"\n";
showEnvVarsInLog = 0;
}; };
FD5E93D72C12DA400038C25A /* Add App Group To Build Info Plist */ = { FD5E93D72C12DA400038C25A /* Add App Group To Build Info Plist */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@ -5505,6 +5507,7 @@
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "INFO_PLIST=\"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\"\n\n# Wait for Info.plist to be processed\nwhile [[ ! -f \"${INFO_PLIST}\" ]]; do\n echo \"Waiting for plist to be copied\"\n sleep 1\ndone\n\n# Query and save the value; suppress any error message, if key not found.\nvalue=$(/usr/libexec/PlistBuddy -c 'print :GitCommitHash' \"${INFO_PLIST}\" 2>/dev/null)\n\n# Check if value is empty\nif [ -z \"$value\" ] \nthen\n /usr/libexec/PlistBuddy -c \"Add :GitCommitHash string\" \"${INFO_PLIST}\"\nfi\n\n/usr/libexec/PlistBuddy -c \"Set :GitCommitHash `git rev-parse --short=7 HEAD`\" \"${INFO_PLIST}\"\n"; shellScript = "INFO_PLIST=\"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\"\n\n# Wait for Info.plist to be processed\nwhile [[ ! -f \"${INFO_PLIST}\" ]]; do\n echo \"Waiting for plist to be copied\"\n sleep 1\ndone\n\n# Query and save the value; suppress any error message, if key not found.\nvalue=$(/usr/libexec/PlistBuddy -c 'print :GitCommitHash' \"${INFO_PLIST}\" 2>/dev/null)\n\n# Check if value is empty\nif [ -z \"$value\" ] \nthen\n /usr/libexec/PlistBuddy -c \"Add :GitCommitHash string\" \"${INFO_PLIST}\"\nfi\n\n/usr/libexec/PlistBuddy -c \"Set :GitCommitHash `git rev-parse --short=7 HEAD`\" \"${INFO_PLIST}\"\n";
showEnvVarsInLog = 0;
}; };
FDE7214D287E50820093DF33 /* Lint Localizable.strings */ = { FDE7214D287E50820093DF33 /* Lint Localizable.strings */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;

File diff suppressed because one or more lines are too long

@ -167,6 +167,12 @@ public extension LibSession {
network_clear_cache(network) network_clear_cache(network)
} }
static func snodeCacheSize() -> Int {
guard let network: UnsafeMutablePointer<network_object> = networkCache.wrappedValue else { return 0 }
return network_get_snode_cache_size(network)
}
static func getSwarm(swarmPublicKey: String) -> AnyPublisher<Set<Snode>, Error> { static func getSwarm(swarmPublicKey: String) -> AnyPublisher<Set<Snode>, Error> {
typealias Output = Result<Set<Snode>, Error> typealias Output = Result<Set<Snode>, Error>

@ -33,8 +33,8 @@ public enum SNUtilitiesKit: MigratableTarget { // Just to make the external API
) )
} }
public static func configure(maxFileSize: UInt) { public static func configure(networkMaxFileSize: UInt) {
SNUtilitiesKitConfiguration.maxFileSize = maxFileSize SNUtilitiesKitConfiguration.maxFileSize = networkMaxFileSize
} }
} }

@ -68,8 +68,8 @@ public enum Log {
private static var pendingStartupLogs: Atomic<[LogInfo]> = Atomic([]) private static var pendingStartupLogs: Atomic<[LogInfo]> = Atomic([])
public static func setup(with logger: Logger) { public static func setup(with logger: Logger) {
logger.retrievePendingStartupLogs.mutate { logger.pendingLogsRetriever.mutate { callback in
$0 = { callback = {
pendingStartupLogs.mutate { pendingStartupLogs in pendingStartupLogs.mutate { pendingStartupLogs in
let logs: [LogInfo] = pendingStartupLogs let logs: [LogInfo] = pendingStartupLogs
pendingStartupLogs = [] pendingStartupLogs = []
@ -344,7 +344,7 @@ public class Logger {
private let systemLoggers: Atomic<[String: SystemLoggerType]> = Atomic([:]) private let systemLoggers: Atomic<[String: SystemLoggerType]> = Atomic([:])
fileprivate let fileLogger: DDFileLogger fileprivate let fileLogger: DDFileLogger
fileprivate let isSuspended: Atomic<Bool> = Atomic(true) fileprivate let isSuspended: Atomic<Bool> = Atomic(true)
fileprivate let retrievePendingStartupLogs: Atomic<(() -> [Log.LogInfo])?> = Atomic(nil) fileprivate let pendingLogsRetriever: Atomic<(() -> [Log.LogInfo])?> = Atomic(nil)
public init( public init(
primaryPrefix: String, primaryPrefix: String,
@ -483,11 +483,7 @@ public class Logger {
isSuspended = false isSuspended = false
// Retrieve any logs that were added during // Retrieve any logs that were added during
return retrievePendingStartupLogs.mutate { retriever in return pendingLogsRetriever.mutate { retriever in (retriever?() ?? []) }
let result: [Log.LogInfo] = (retriever?() ?? [])
retriever = nil
return result
}
} }
// If we had an error loading the extension logs then actually log it // If we had an error loading the extension logs then actually log it

@ -9,7 +9,7 @@ import SessionUtilitiesKit
public enum Configuration { public enum Configuration {
public static func performMainSetup() { public static func performMainSetup() {
// Need to do this first to ensure the legacy database exists // Need to do this first to ensure the legacy database exists
SNUtilitiesKit.configure(maxFileSize: UInt(Network.maxFileSize)) SNUtilitiesKit.configure(networkMaxFileSize: UInt(Network.maxFileSize))
SNMessagingKit.configure() SNMessagingKit.configure()
SNUIKit.configure() SNUIKit.configure()

Loading…
Cancel
Save