feat: Mark as seen on typing

feat: Save to RyukGram album
feat: Hide trailing action buttons on preserved messages
feat: Confirmation when pulling to refresh the DMs tab if preserved messages would be cleared
This commit is contained in:
faroukbmiled
2026-04-07 03:04:50 +01:00
parent e634359acc
commit 6e96140895
12 changed files with 379 additions and 34 deletions
+20 -20
View File
@@ -1,4 +1,5 @@
#import "Download.h"
#import "../PhotoAlbum.h"
#import <Photos/Photos.h>
#pragma mark - SCIDownloadPillView
@@ -217,30 +218,14 @@
return;
}
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
NSString *ext = [[fileURL pathExtension] lowercaseString];
BOOL isVideo = [@[@"mp4", @"mov", @"m4v"] containsObject:ext];
if (isVideo) {
PHAssetCreationRequest *req = [PHAssetCreationRequest creationRequestForAsset];
PHAssetResourceCreationOptions *opts = [[PHAssetResourceCreationOptions alloc] init];
opts.shouldMoveFile = YES;
[req addResourceWithType:PHAssetResourceTypeVideo fileURL:fileURL options:opts];
req.creationDate = [NSDate date];
} else {
PHAssetCreationRequest *req = [PHAssetCreationRequest creationRequestForAsset];
PHAssetResourceCreationOptions *opts = [[PHAssetResourceCreationOptions alloc] init];
opts.shouldMoveFile = YES;
[req addResourceWithType:PHAssetResourceTypePhoto fileURL:fileURL options:opts];
req.creationDate = [NSDate date];
}
} completionHandler:^(BOOL success, NSError *error) {
BOOL useAlbum = [SCIUtils getBoolPref:@"save_to_ryukgram_album"];
void (^onDone)(BOOL, NSError *) = ^(BOOL success, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (success) {
SCIDownloadPillView *donePill = [[SCIDownloadPillView alloc] init];
donePill.progressRing.hidden = YES;
donePill.subtitleLabel.text = nil;
[donePill setText:@"Saved to Photos"];
[donePill setText:useAlbum ? @"Saved to RyukGram" : @"Saved to Photos"];
UIView *hostView = topMostController().view;
if (hostView) {
[donePill showInView:hostView];
@@ -250,7 +235,22 @@
[SCIUtils showErrorHUDWithDescription:@"Failed to save to Photos"];
}
});
}];
};
if (useAlbum) {
[SCIPhotoAlbum saveFileToAlbum:fileURL completion:onDone];
} else {
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
NSString *ext = [[fileURL pathExtension] lowercaseString];
BOOL isVideo = [@[@"mp4", @"mov", @"m4v"] containsObject:ext];
PHAssetCreationRequest *req = [PHAssetCreationRequest creationRequestForAsset];
PHAssetResourceCreationOptions *opts = [[PHAssetResourceCreationOptions alloc] init];
opts.shouldMoveFile = YES;
[req addResourceWithType:(isVideo ? PHAssetResourceTypeVideo : PHAssetResourceTypePhoto)
fileURL:fileURL options:opts];
req.creationDate = [NSDate date];
} completionHandler:onDone];
}
}];
break;
}