mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Respond to CR.
This commit is contained in:
parent
e8eac9f30b
commit
4ad7ca79b7
|
@ -117,6 +117,7 @@ NSString *const kOWSPrimaryStorage_MayHaveLinkedDevices = @"kTSStorageManager_Ma
|
|||
OWSDevice *device = [MTLJSONAdapter modelOfClass:[self class] fromJSONDictionary:deviceAttributes error:error];
|
||||
if (device.deviceId < OWSDevicePrimaryDeviceId) {
|
||||
OWSFailDebug(@"Invalid device id: %lu", (unsigned long)device.deviceId);
|
||||
*error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecodeJson, @"Invalid device id.");
|
||||
return nil;
|
||||
}
|
||||
return device;
|
||||
|
@ -181,7 +182,7 @@ NSString *const kOWSPrimaryStorage_MayHaveLinkedDevices = @"kTSStorageManager_Ma
|
|||
}
|
||||
*success = NO;
|
||||
OWSLogError(@"unable to decode date from %@", value);
|
||||
*error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecodeJson, @"Unable to decode date from %@");
|
||||
*error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecodeJson, @"Unable to decode date from JSON.");
|
||||
return nil;
|
||||
}
|
||||
reverseBlock:^id(id value, BOOL *success, NSError **error) {
|
||||
|
@ -194,7 +195,7 @@ NSString *const kOWSPrimaryStorage_MayHaveLinkedDevices = @"kTSStorageManager_Ma
|
|||
}
|
||||
}
|
||||
OWSLogError(@"unable to encode date from %@", value);
|
||||
*error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToEncodeJson, @"Unable to encode date");
|
||||
*error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToEncodeJson, @"Unable to encode date to JSON.");
|
||||
*success = NO;
|
||||
return nil;
|
||||
}];
|
||||
|
|
|
@ -54,6 +54,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
- (nullable NSData *)encrypt:(NSData *)dataToEncrypt
|
||||
{
|
||||
@try {
|
||||
// Exceptions can be thrown in a number of places in encryptUnsafe, e.g.:
|
||||
//
|
||||
// * Curve25519's generateSharedSecretFromPublicKey.
|
||||
// * [HKDFKit deriveKey].
|
||||
return [self encryptUnsafe:dataToEncrypt];
|
||||
} @catch (NSException *exception) {
|
||||
OWSFailDebug(@"exception: %@ of type: %@ with reason: %@, user info: %@.",
|
||||
|
|
|
@ -54,15 +54,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
+ (nullable TSAttachmentPointer *)attachmentPointerFromProto:(SSKProtoAttachmentPointer *)attachmentProto
|
||||
{
|
||||
if (attachmentProto.id < 1) {
|
||||
OWSFailDebug("Invalid attachment id.");
|
||||
OWSFailDebug(@"Invalid attachment id.");
|
||||
return nil;
|
||||
}
|
||||
if (attachmentProto.key.length < 1) {
|
||||
OWSFailDebug("Invalid attachment key.");
|
||||
OWSFailDebug(@"Invalid attachment key.");
|
||||
return nil;
|
||||
}
|
||||
if (attachmentProto.contentType.length < 1) {
|
||||
OWSFailDebug("Invalid attachment content type.");
|
||||
OWSFailDebug(@"Invalid attachment content type.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
|
@ -1174,7 +1174,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
case SSKProtoGroupContextTypeQuit: {
|
||||
if (!oldGroupThread) {
|
||||
OWSFailDebug(@"ignoring quit group message from unknown group.");
|
||||
OWSLogWarn(@"ignoring quit group message from unknown group.");
|
||||
return nil;
|
||||
}
|
||||
[newMemberIds removeObject:envelope.source];
|
||||
|
|
|
@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
for (NSData *data in datas) {
|
||||
[result appendData:data];
|
||||
}
|
||||
return result;
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
- (NSData *)dataByAppendingData:(NSData *)data
|
||||
|
|
Loading…
Reference in a new issue