Merge branch 'dev' into fix-disappearing-messages-control-message

pull/1038/head
Ryan ZHAO 7 months ago
commit bfa059f415

@ -5030,59 +5030,7 @@
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
de,
es,
fr,
pt_BR,
ru,
zh_CN,
Base,
it,
fa,
pl,
ja,
"vi-VN",
"id-ID",
sk,
nl,
"zh-Hant",
hi,
fi,
hr,
sv,
th,
si,
ar,
uk,
be,
el,
"zh-TW",
ku,
sl,
da,
eo,
bg,
"es-ES",
cs,
ko,
fil,
"ne-NP",
no,
nb,
hu,
tr,
"pt-BR",
vi,
lv,
lt,
"zh-CN",
"si-LK",
id,
"sv-SE",
bn,
"pt-PT",
ro,
Base
);
mainGroup = D221A07E169C9E5E00537ABF;
packageReferences = (
@ -5266,7 +5214,7 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
FD0B1FA92CA3805C00F60F46 /* Ensure InfoPlist.xcstrings updated */ = {
9471CAA62CACFB0600090FB7 /* Generate Licenses Plist */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
@ -5276,17 +5224,17 @@
);
inputPaths = (
);
name = "Ensure InfoPlist.xcstrings updated";
name = "Generate Licenses Plist";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Scripts/LintLocalizableStrings.swift\" update\n";
shellScript = "\"${SRCROOT}/Scripts/GenerateLicenses.swift\"\n";
showEnvVarsInLog = 0;
};
9471CAA62CACFB0600090FB7 /* Generate Licenses Plist */ = {
FD0B1FA92CA3805C00F60F46 /* Ensure InfoPlist.xcstrings updated */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
@ -5296,14 +5244,14 @@
);
inputPaths = (
);
name = "Generate Licenses Plist";
name = "Ensure InfoPlist.xcstrings updated";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Scripts/GenerateLicenses.swift\"\n";
shellScript = "\"${SRCROOT}/Scripts/LintLocalizableStrings.swift\" update\n";
showEnvVarsInLog = 0;
};
FD5E93D32C12D3990038C25A /* Add App Group To Build Info Plist */ = {
@ -6655,7 +6603,6 @@
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
@ -6731,7 +6678,6 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
@ -6789,7 +6735,6 @@
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
@ -6867,7 +6812,6 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
@ -7732,6 +7676,7 @@
);
"OTHER_SWIFT_FLAGS[arch=*]" = "-D DEBUG";
SDKROOT = iphoneos;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 4.0;
VALIDATE_PRODUCT = YES;
};
@ -7806,6 +7751,7 @@
);
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 4.0;
VALIDATE_PRODUCT = YES;
@ -7873,7 +7819,6 @@
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "Session/Meta/Signal-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "Session-Swift.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -7940,7 +7885,6 @@
PROVISIONING_PROFILE = "";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "Session/Meta/Signal-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "Session-Swift.h";
SWIFT_VERSION = 5.0;
@ -8297,6 +8241,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@ -8361,6 +8306,7 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";

File diff suppressed because it is too large Load Diff

@ -610,10 +610,6 @@ extension Attachment {
}
public static func originalFilePath(id: String, mimeType: String, sourceFilename: String?) -> String? {
// Store the file in a subdirectory whose name is the uniqueId of this attachment,
// to avoid collisions between multiple attachments with the same name
let attachmentFolder: String = Attachment.attachmentsFolder.appending("/\(id)")
if let sourceFilename: String = sourceFilename, !sourceFilename.isEmpty {
// Ensure that the filename is a valid filesystem name,
// replacing invalid characters with an underscore.
@ -647,6 +643,10 @@ extension Attachment {
targetFileExtension = targetFileExtension.lowercased()
if !targetFileExtension.isEmpty {
// Store the file in a subdirectory whose name is the uniqueId of this attachment,
// to avoid collisions between multiple attachments with the same name
let attachmentFolder: String = Attachment.attachmentsFolder.appending("/\(id)")
guard case .success = Result(try FileSystem.ensureDirectoryExists(at: attachmentFolder)) else {
return nil
}
@ -660,7 +660,7 @@ extension Attachment {
UTType.fileExtensionDefault
).lowercased()
return attachmentFolder.appending("/\(id).\(targetFileExtension)")
return Attachment.attachmentsFolder.appending("/\(id).\(targetFileExtension)")
}
public static func localRelativeFilePath(from originalFilePath: String?) -> String? {

@ -25,42 +25,30 @@ extension Setting {
// MARK: - Numeric Setting
fileprivate init?<T: Numeric>(key: String, value: T?) {
guard let value: T = value else { return nil }
var targetValue: T = value
guard var value: T = value else { return nil }
self.key = key
self.value = Data(bytes: &targetValue, count: MemoryLayout.size(ofValue: targetValue))
self.value = withUnsafeBytes(of: &value) { Data($0) }
}
fileprivate func value<T: Numeric>(as type: T.Type) -> T? {
// Note: The 'assumingMemoryBound' is essentially going to try to convert
// the memory into the provided type so can result in invalid data being
// returned if the type is incorrect. But it does seem safer than the 'load'
// method which crashed under certain circumstances (an `Int` value of 0)
return value.withUnsafeBytes {
$0.baseAddress?.assumingMemoryBound(to: T.self).pointee
$0.loadUnaligned(as: T.self)
}
}
// MARK: - Bool Setting
fileprivate init?(key: String, value: Bool?) {
guard let value: Bool = value else { return nil }
var targetValue: Bool = value
guard var value: Bool = value else { return nil }
self.key = key
self.value = Data(bytes: &targetValue, count: MemoryLayout.size(ofValue: targetValue))
self.value = withUnsafeBytes(of: &value) { Data($0) }
}
public func unsafeValue(as type: Bool.Type) -> Bool? {
// Note: The 'assumingMemoryBound' is essentially going to try to convert
// the memory into the provided type so can result in invalid data being
// returned if the type is incorrect. But it does seem safer than the 'load'
// method which crashed under certain circumstances (an `Int` value of 0)
return value.withUnsafeBytes {
$0.baseAddress?.assumingMemoryBound(to: Bool.self).pointee
$0.loadUnaligned(as: Bool.self)
}
}

@ -123,7 +123,7 @@ public extension UTType {
let mimeType: String = preferredMIMEType,
let fileExtension: String = UTType.genericExtensionTypesToMimeTypes
.first(where: { _, value in value == mimeType })?
.value
.key
else { return preferredFilenameExtension }
return fileExtension

Loading…
Cancel
Save