mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Improve asserts and logging in attachment adapters.
// FREEBIE
This commit is contained in:
parent
b1f7cf0d62
commit
964e6f1adf
4 changed files with 44 additions and 6 deletions
|
@ -266,6 +266,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSString *utiType = [MIMETypeUtil utiTypeForMIMEType:self.attachment.contentType];
|
||||
OWSAssert(utiType.length > 0);
|
||||
NSData *data = [NSData dataWithContentsOfURL:self.attachment.mediaURL];
|
||||
if (!data) {
|
||||
OWSAssert(data);
|
||||
DDLogError(@"%@ Could not load data: %@", [self tag], [self.attachment mediaURL]);
|
||||
return;
|
||||
}
|
||||
[UIPasteboard.generalPasteboard setData:data forPasteboardType:utiType];
|
||||
} else {
|
||||
// Shouldn't get here, as only supported actions should be exposed via canPerformEditingAction
|
||||
|
@ -290,6 +295,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
}
|
||||
|
||||
#pragma mark - Logging
|
||||
|
||||
+ (NSString *)tag
|
||||
{
|
||||
return [NSString stringWithFormat:@"[%@]", self.class];
|
||||
}
|
||||
|
||||
- (NSString *)tag
|
||||
{
|
||||
return self.class.tag;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -57,8 +57,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (nonatomic) uint64_t expiresAtSeconds;
|
||||
@property (nonatomic) uint32_t expiresInSeconds;
|
||||
|
||||
@property (nonatomic, copy) NSDate *messageDate;
|
||||
@property (nonatomic, retain) NSString *messageBody;
|
||||
@property (nonatomic) NSDate *messageDate;
|
||||
@property (nonatomic) NSString *messageBody;
|
||||
|
||||
@property (nonatomic) NSString *interactionUniqueId;
|
||||
|
||||
|
|
|
@ -400,6 +400,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
utiType = (NSString *)kUTTypeVideo;
|
||||
}
|
||||
NSData *data = [NSData dataWithContentsOfURL:self.fileURL];
|
||||
if (!data) {
|
||||
OWSAssert(data);
|
||||
DDLogError(@"%@ Could not load data: %@", [self tag], [self.attachment mediaURL]);
|
||||
return;
|
||||
}
|
||||
[UIPasteboard.generalPasteboard setData:data forPasteboardType:utiType];
|
||||
return;
|
||||
} else if (action == NSSelectorFromString(@"save:")) {
|
||||
|
@ -418,7 +423,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
|
||||
NSData *data = [NSData dataWithContentsOfURL:self.fileURL];
|
||||
if (!data) {
|
||||
OWSAssert(data);
|
||||
DDLogError(@"%@ Could not load data: %@", [self tag], [self.attachment mediaURL]);
|
||||
return;
|
||||
}
|
||||
[UIPasteboard.generalPasteboard setData:data forPasteboardType:utiType];
|
||||
}
|
||||
} else {
|
||||
|
@ -446,6 +455,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
}
|
||||
|
||||
#pragma mark - Logging
|
||||
|
||||
+ (NSString *)tag
|
||||
{
|
||||
return [NSString stringWithFormat:@"[%@]", self.class];
|
||||
}
|
||||
|
||||
- (NSString *)tag
|
||||
{
|
||||
return self.class.tag;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -758,11 +758,11 @@ typedef enum : NSUInteger {
|
|||
[[YapDatabaseViewMappings alloc] initWithGroups:@[ thread.uniqueId ] view:TSMessageDatabaseViewExtensionName];
|
||||
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
[self.messageMappings updateWithTransaction:transaction];
|
||||
}];
|
||||
self.page = 0;
|
||||
[self updateRangeOptionsForPage:self.page];
|
||||
[self.collectionView reloadData];
|
||||
}];
|
||||
[self updateLoadEarlierVisible];
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
- (BOOL)userLeftGroup
|
||||
|
|
Loading…
Reference in a new issue