pull/311/head
nielsandriesse 4 years ago
parent 8de5605edd
commit f706e38ef7

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,11 +1,12 @@
@objc public protocol AttachmentStream {
var encryptionKey: Data { get set }
var digest: Data { get set }
var serverId: UInt64 { get set }
var isUploaded: Bool { get set }
var downloadURL: String { get set }
@objc(SNAttachmentStream)
public protocol AttachmentStream {
@objc var encryptionKey: Data { get set }
@objc var digest: Data { get set }
@objc var serverId: UInt64 { get set }
@objc var isUploaded: Bool { get set }
@objc var downloadURL: String { get set }
func readDataFromFile() throws -> Data
func save()
@objc func readDataFromFile() throws -> Data
@objc func save()
}

@ -1152,6 +1152,10 @@
C3C2AC0A2553C9A100C340D1 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2AC092553C9A100C340D1 /* Configuration.swift */; };
C3C2AC2E2553CBEB00C340D1 /* String+Trimming.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2AC2D2553CBEB00C340D1 /* String+Trimming.swift */; };
C3C2AC372553CCE600C340D1 /* SessionUtilitiesKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3C2A679255388CC00C340D1 /* SessionUtilitiesKit.framework */; };
C3CA3AA2255CDADA00F4C6D4 /* english.txt in Resources */ = {isa = PBXBuildFile; fileRef = C3CA3AA1255CDADA00F4C6D4 /* english.txt */; };
C3CA3AB4255CDAE600F4C6D4 /* japanese.txt in Resources */ = {isa = PBXBuildFile; fileRef = C3CA3AB3255CDAE600F4C6D4 /* japanese.txt */; };
C3CA3ABE255CDB0D00F4C6D4 /* portuguese.txt in Resources */ = {isa = PBXBuildFile; fileRef = C3CA3ABD255CDB0D00F4C6D4 /* portuguese.txt */; };
C3CA3AC8255CDB2900F4C6D4 /* spanish.txt in Resources */ = {isa = PBXBuildFile; fileRef = C3CA3AC7255CDB2900F4C6D4 /* spanish.txt */; };
C3D0972B2510499C00F6E3E4 /* BackgroundPoller.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D0972A2510499C00F6E3E4 /* BackgroundPoller.swift */; };
C3DAB3242480CB2B00725F25 /* SRCopyableLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DAB3232480CB2A00725F25 /* SRCopyableLabel.swift */; };
C3DFFAC623E96F0D0058DAF8 /* Sheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DFFAC523E96F0D0058DAF8 /* Sheet.swift */; };
@ -2517,6 +2521,10 @@
C3C2AC092553C9A100C340D1 /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = "<group>"; };
C3C2AC2D2553CBEB00C340D1 /* String+Trimming.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Trimming.swift"; sourceTree = "<group>"; };
C3C3CF8824D8EED300E1CCE7 /* TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
C3CA3AA1255CDADA00F4C6D4 /* english.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = english.txt; sourceTree = "<group>"; };
C3CA3AB3255CDAE600F4C6D4 /* japanese.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = japanese.txt; sourceTree = "<group>"; };
C3CA3ABD255CDB0D00F4C6D4 /* portuguese.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = portuguese.txt; sourceTree = "<group>"; };
C3CA3AC7255CDB2900F4C6D4 /* spanish.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = spanish.txt; sourceTree = "<group>"; };
C3D0972A2510499C00F6E3E4 /* BackgroundPoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundPoller.swift; sourceTree = "<group>"; };
C3DAB3232480CB2A00725F25 /* SRCopyableLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SRCopyableLabel.swift; sourceTree = "<group>"; };
C3DFFAC523E96F0D0058DAF8 /* Sheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sheet.swift; sourceTree = "<group>"; };
@ -4345,6 +4353,17 @@
path = "Shared Sender Keys";
sourceTree = "<group>";
};
C3CA3AA0255CDA7000F4C6D4 /* Mnemonic */ = {
isa = PBXGroup;
children = (
C3CA3AA1255CDADA00F4C6D4 /* english.txt */,
C3CA3AB3255CDAE600F4C6D4 /* japanese.txt */,
C3CA3ABD255CDB0D00F4C6D4 /* portuguese.txt */,
C3CA3AC7255CDB2900F4C6D4 /* spanish.txt */,
);
path = Mnemonic;
sourceTree = "<group>";
};
C3F0A58F255C8E3D007BE2A3 /* Meta */ = {
isa = PBXGroup;
children = (
@ -4353,6 +4372,7 @@
B633C4FD1A1D190B0059AC12 /* Images */,
B66DBF4919D5BBC8006EA940 /* Images.xcassets */,
D221A099169C9E5E00537ABF /* main.m */,
C3CA3AA0255CDA7000F4C6D4 /* Mnemonic */,
B67EBF5C19194AC60084CCFD /* Settings.bundle */,
B657DDC91911A40500F45B0C /* Signal.entitlements */,
45B201741DAECBFD00C461E0 /* Signal-Bridging-Header.h */,
@ -5180,6 +5200,7 @@
34330A5C1E787A9800DF2FB9 /* dripicons-v2.ttf in Resources */,
B633C5C41A1D190B0059AC12 /* mute_on@2x.png in Resources */,
B633C5CE1A1D190B0059AC12 /* quit@2x.png in Resources */,
C3CA3AA2255CDADA00F4C6D4 /* english.txt in Resources */,
AD83FF441A73426500B5C81A /* audio_pause_button.png in Resources */,
B6F509971AA53F760068F56A /* Localizable.strings in Resources */,
B633C59D1A1D190B0059AC12 /* endcall@2x.png in Resources */,
@ -5198,6 +5219,7 @@
34C3C78D20409F320000134C /* Opening.m4r in Resources */,
FC5CDF3A1A3393DD00B47253 /* warning_white@2x.png in Resources */,
B633C58D1A1D190B0059AC12 /* contact_default_feed.png in Resources */,
C3CA3AB4255CDAE600F4C6D4 /* japanese.txt in Resources */,
B10C9B621A7049EC00ECA2BF /* play_icon@2x.png in Resources */,
B633C5861A1D190B0059AC12 /* call@2x.png in Resources */,
B67EBF5D19194AC60084CCFD /* Settings.bundle in Resources */,
@ -5230,6 +5252,7 @@
45B74A7C2044AAB600CD42F8 /* hello-quiet.aifc in Resources */,
C35E8AA82485C85800ACB629 /* GeoLite2-Country-Locations-English.csv in Resources */,
45B74A792044AAB600CD42F8 /* input.aifc in Resources */,
C3CA3ABE255CDB0D00F4C6D4 /* portuguese.txt in Resources */,
45B74A8C2044AAB600CD42F8 /* input-quiet.aifc in Resources */,
45B74A7A2044AAB600CD42F8 /* keys.aifc in Resources */,
45B74A762044AAB600CD42F8 /* keys-quiet.aifc in Resources */,
@ -5238,6 +5261,7 @@
45B74A842044AAB600CD42F8 /* popcorn.aifc in Resources */,
45B74A7D2044AAB600CD42F8 /* popcorn-quiet.aifc in Resources */,
45B74A822044AAB600CD42F8 /* pulse.aifc in Resources */,
C3CA3AC8255CDB2900F4C6D4 /* spanish.txt in Resources */,
34B6A90B218BA1D1007C4606 /* typing-animation.gif in Resources */,
45B74A802044AAB600CD42F8 /* pulse-quiet.aifc in Resources */,
45B74A8B2044AAB600CD42F8 /* synth.aifc in Resources */,

@ -24,8 +24,7 @@ public enum Mnemonic {
if let cachedResult = Language.wordSetCache[self] {
return cachedResult
} else {
let bundleID = "org.cocoapods.SessionServiceKit"
let url = Bundle(identifier: bundleID)!.url(forResource: filename, withExtension: "txt")!
let url = Bundle.main.url(forResource: filename, withExtension: "txt")!
let contents = try! String(contentsOf: url)
let result = contents.split(separator: ",").map { String($0) }
Language.wordSetCache[self] = result

@ -106,7 +106,7 @@ static const CGFloat kAttachmentUploadProgressTheta = 0.001f;
{
OWSLogDebug(@"started uploading data for attachment: %@", self.attachmentId);
NSError *error;
NSData *attachmentData = [attachmentStream readDataFromFileWithError:&error];
NSData *attachmentData = [attachmentStream readDataFromFileAndReturnError:&error];
if (error) {
OWSLogError(@"Failed to read attachment data with error: %@", error);
error.isRetryable = YES;

@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
typedef void (^OWSThumbnailSuccess)(UIImage *image);
typedef void (^OWSThumbnailFailure)(void);
@interface TSAttachmentStream : TSAttachment
@interface TSAttachmentStream : TSAttachment <SNAttachmentStream>
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithContentType:(NSString *)contentType
@ -52,7 +52,7 @@ typedef void (^OWSThumbnailFailure)(void);
+ (BOOL)hasThumbnailForMimeType:(NSString *)contentType;
- (nullable NSData *)readDataFromFileWithError:(NSError **)error;
- (nullable NSData *)readDataFromFileAndReturnError:(NSError **)error;
- (BOOL)writeData:(NSData *)data error:(NSError **)error;
- (BOOL)writeDataSource:(DataSource *)dataSource;

@ -168,7 +168,7 @@ typedef void (^OWSLoadedThumbnailSuccess)(OWSLoadedThumbnail *loadedThumbnail);
#pragma mark - File Management
- (nullable NSData *)readDataFromFileWithError:(NSError **)error
- (nullable NSData *)readDataFromFileAndReturnError:(NSError **)error
{
*error = nil;
NSString *_Nullable filePath = self.originalFilePath;

Loading…
Cancel
Save