Skip to content

Commit

Permalink
v2.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dayanch96 committed Feb 22, 2024
1 parent 9a43e1b commit 123215f
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 71 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ endif
DEBUG=0
FINALPACKAGE=1
ARCHS = arm64
PACKAGE_VERSION = 2.6.2
PACKAGE_VERSION = 2.6.3
TARGET := iphone:clang:latest:13.0

include $(THEOS)/makefiles/common.mk
Expand Down
2 changes: 1 addition & 1 deletion Settings.x
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static YTSettingsSectionItem *createSwitchItem(NSString *title, NSString *titleD
createSwitchItem(LOC(@"PostManager"), LOC(@"PostManagerDesc"), @"postManager", &kPostManager, selfObject),
createSwitchItem(LOC(@"SavePostImage"), LOC(@"SavePostImageDesc"), @"savePostImage", &kSavePostImage, selfObject),
createSwitchItem(LOC(@"SaveProfilePhoto"), LOC(@"SaveProfilePhotoDesc"), @"saveProfilePhoto", &kSaveProfilePhoto, selfObject),
createSwitchItem(LOC(@"CopyCommentText"), LOC(@"CopyCommentTextDesc"), @"copyCommentText", &kCopyCommentText, selfObject),
createSwitchItem(LOC(@"CommentManager"), LOC(@"CommentManagerDesc"), @"commentManager", &kCommentManager, selfObject),
createSwitchItem(LOC(@"FixAlbums"), LOC(@"FixAlbumsDesc"), @"fixAlbums", &kFixAlbums, selfObject),
createSwitchItem(LOC(@"RemovePlayNext"), LOC(@"RemovePlayNextDesc"), @"removePlayNext", &kRemovePlayNext, selfObject),
createSwitchItem(LOC(@"NoContinueWatching"), LOC(@"NoContinueWatchingDesc"), @"noContinueWatching", &kNoContinueWatching, selfObject),
Expand Down
4 changes: 2 additions & 2 deletions YTLite.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ BOOL kCopyVideoInfo;
BOOL kPostManager;
BOOL kSavePostImage;
BOOL kSaveProfilePhoto;
BOOL kCopyCommentText;
BOOL kCommentManager;
BOOL kSavePost;
BOOL kFixAlbums;
BOOL kRemovePlayNext;
Expand Down Expand Up @@ -316,7 +316,7 @@ int kPivotIndex;
- (void)postManager:(UILongPressGestureRecognizer *)sender;
- (void)saveImage:(UILongPressGestureRecognizer *)sender;
- (void)savePFP:(UILongPressGestureRecognizer *)sender;
- (void)copyComment:(UILongPressGestureRecognizer *)sender;
- (void)commentManager:(UILongPressGestureRecognizer *)sender;
@end

@interface MLHAMQueuePlayer : NSObject
Expand Down
53 changes: 40 additions & 13 deletions YTLite.x
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,10 @@ static BOOL isOverlayShown = YES;
%end

%hook ASDisplayNode
- (void)didLoad {
- (void)setFrame:(CGRect)frame {
%orig;

if (kCopyCommentText && [[self valueForKey:@"_accessibilityIdentifier"] isEqualToString:@"id.comment.content.label"]) {
if (kCommentManager && [[self valueForKey:@"_accessibilityIdentifier"] isEqualToString:@"id.comment.content.label"]) {
ASTextNode *textNode = (ASTextNode *)self;
NSString *comment = textNode.attributedText.string;

Expand All @@ -661,7 +661,6 @@ static BOOL isOverlayShown = YES;
if (kPostManager && [self isKindOfClass:NSClassFromString(@"ELMExpandableTextNode")]) {
ELMExpandableTextNode *expandableTextNode = (ELMExpandableTextNode *)self;
ASTextNode *textNode = (ASTextNode *)expandableTextNode.currentTextNode;

NSString *text = textNode.attributedText.string;

NSMutableArray *allObjects = self.supernodes.allObjects;
Expand Down Expand Up @@ -730,7 +729,7 @@ static void genImageFromLayer(CALayer *layer, UIColor *backgroundColor, void (^c
@{@"selector": @"postManager:", @"text": @"id.ui.backstage.original_post", @"key": @(kPostManager)},
@{@"selector": @"saveImage:", @"text": @"YTImageZoomNode-View", @"key": @(kSavePostImage)},
@{@"selector": @"savePFP:", @"text": @"ELMImageNode-View", @"key": @(kSaveProfilePhoto)},
@{@"selector": @"copyComment:", @"text": @"id.ui.comment_cell", @"key": @(kCopyCommentText)}
@{@"selector": @"commentManager:", @"text": @"id.ui.comment_cell", @"key": @(kCommentManager)}
];

for (NSDictionary *gestureInfo in gesturesInfo) {
Expand Down Expand Up @@ -832,18 +831,46 @@ static void genImageFromLayer(CALayer *layer, UIColor *backgroundColor, void (^c
}

%new
- (void)copyComment:(UILongPressGestureRecognizer *)sender {
- (void)commentManager:(UILongPressGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateBegan) {
ELMContainerNode *containerNode = (ELMContainerNode *)self.keepalive_node;
NSString *comment = containerNode.copiedComment;

if (comment) {
[UIPasteboard generalPasteboard].string = comment;
CALayer *layer = self.layer;
UIColor *backgroundColor = containerNode.closestViewController.view.backgroundColor;

UIResponder *responder = self.nextResponder;
while (responder && ![responder isKindOfClass:[UIViewController class]]) responder = responder.nextResponder;
if (responder) [[%c(YTToastResponderEvent) eventWithMessage:LOC(@"Copied") firstResponder:responder] send];
}
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:LOC(@"SelectAction") message:nil preferredStyle:UIAlertControllerStyleActionSheet];
alertController.view.tintColor = [UIColor labelColor];

[alertController addAction:[UIAlertAction actionWithTitle:LOC(@"CopyCommentText") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if (comment) {
[UIPasteboard generalPasteboard].string = comment;
[[%c(YTToastResponderEvent) eventWithMessage:LOC(@"Copied") firstResponder:containerNode.closestViewController] send];
}
}]];

[alertController addAction:[UIAlertAction actionWithTitle:LOC(@"SaveCommentAsImage") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
genImageFromLayer(layer, backgroundColor, ^(UIImage *image) {
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetCreationRequest *request = [PHAssetCreationRequest creationRequestForAssetFromImage:image];
request.creationDate = [NSDate date];
} completionHandler:^(BOOL success, NSError *error) {
NSString *message = success ? LOC(@"Saved") : [NSString stringWithFormat:LOC(@"%@: %@"), LOC(@"Error"), error.localizedDescription];
[[%c(YTToastResponderEvent) eventWithMessage:message firstResponder:containerNode.closestViewController] send];
}];
});
}]];

[alertController addAction:[UIAlertAction actionWithTitle:LOC(@"CopyCommentAsImage") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
genImageFromLayer(layer, backgroundColor, ^(UIImage *image) {
[UIPasteboard generalPasteboard].image = image;
[[%c(YTToastResponderEvent) eventWithMessage:LOC(@"Copied") firstResponder:containerNode.closestViewController] send];
});
}]];

[alertController addAction:[UIAlertAction actionWithTitle:LOC(@"Cancel") style:UIAlertActionStyleCancel handler:nil]];

[containerNode.closestViewController presentViewController:alertController animated:YES completion:nil];
}
}
%end
Expand Down Expand Up @@ -1134,7 +1161,7 @@ static void reloadPrefs() {
kPostManager = [prefs[@"postManager"] boolValue] ?: NO;
kSavePostImage = [prefs[@"savePostImage"] boolValue] ?: NO;
kSaveProfilePhoto = [prefs[@"savePostImage"] boolValue] ?: NO;
kCopyCommentText = [prefs[@"copyCommentText"] boolValue] ?: NO;
kCommentManager = [prefs[@"commentManager"] boolValue] ?: NO;
kFixAlbums = [prefs[@"fixAlbums"] boolValue] ?: NO;
kRemovePlayNext = [prefs[@"removePlayNext"] boolValue] ?: NO;
kNoContinueWatching = [prefs[@"noContinueWatching"] boolValue] ?: NO;
Expand Down Expand Up @@ -1220,7 +1247,7 @@ static void reloadPrefs() {
@"postManager" : @(kPostManager),
@"savePostImage" : @(kSavePostImage),
@"saveProfilePhoto" : @(kSaveProfilePhoto),
@"copyCommentText" : @(kCopyCommentText),
@"commentManager" : @(kCommentManager),
@"fixAlbums" : @(kFixAlbums),
@"removePlayNext" : @(kRemovePlayNext),
@"noContinueWatching" : @(kNoContinueWatching),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
"SavePostImageDesc" = "Saves community post image to the Photos app by long tap.";
"SaveProfilePhoto" = "Save profile picture";
"SaveProfilePhotoDesc" = "Saves profile picture to the Photos app by long tap.";
"CopyCommentText" = "Copy comments text";
"CopyCommentTextDesc" = "Copies comments text to the clipboard by long tap.";
"CommentManager" = "Save comment information";
"CommentManagerDesc" = "Allows to copy comment text and save comment as image by long tap.";
"FixAlbums" = "Fix covers";
"FixAlbumsDesc" = "Fixes the display of covers for users from Russia.";
"RemovePlayNext" = "Remove \"Play next in queue\"";
Expand Down Expand Up @@ -209,6 +209,9 @@
"CopyPostText" = "Copy post text";
"SavePostAsImage" = "Save post as image";
"CopyPostAsImage" = "Copy post as image";
"CopyCommentText" = "Copy comment text";
"SaveCommentAsImage" = "Save comment as image";
"CopyCommentAsImage" = "Copy comment as image";
"Cancel" = "Cancel";
"Copied" = "Copied to clipboard";
"Saved" = "Saved to Photos";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
"SavePostImageDesc" = "Guarda la imagen de las publicaciones de la comunidad en la aplicación Fotos con un toque prolongado";
"SaveProfilePhoto" = "Guardar foto de perfil";
"SaveProfilePhotoDesc" = "Guarda la imagen de perfil en la aplicación Fotos con un toque prolongado";
"CopyCommentText" = "Copy comments text";
"CopyCommentTextDesc" = "Copies comments text to the clipboard by long tap.";
"CommentManager" = "Save comment information";
"CommentManagerDesc" = "Allows to copy comment text and save comment as image by long tap.";
"FixAlbums" = "Arreglar portadas";
"FixAlbumsDesc" = "Corrige la visualización de portadas para usuarios de Rusia";
"RemovePlayNext" = "Eliminar \"Reproducir siguiente en cola\"";
Expand Down Expand Up @@ -209,6 +209,9 @@
"CopyPostText" = "Copy post text";
"SavePostAsImage" = "Save post as image";
"CopyPostAsImage" = "Copy post as image";
"CopyCommentText" = "Copy comment text";
"SaveCommentAsImage" = "Save comment as image";
"CopyCommentAsImage" = "Copy comment as image";
"Cancel" = "Cancel";
"Copied" = "Copiado al portapapeles";
"Done" = "Done";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
"SavePostImageDesc" = "Enregistre l'image des publications de la communauté dans l'application Photos en appuyant longuement.";
"SaveProfilePhoto" = "Enregistrer la photo de profil";
"SaveProfilePhotoDesc" = "Enregistre la photo de profil dans l'application Photos en appuyant longuement.";
"CopyCommentText" = "Copier le texte des commentaires";
"CopyCommentTextDesc" = "Copie le texte des commentaires dans le presse-papiers par un appui long.";
"CommentManager" = "Save comment information";
"CommentManagerDesc" = "Allows to copy comment text and save comment as image by long tap.";
"FixAlbums" = "Réparer les couvertures";
"FixAlbumsDesc" = "Répare l'affichage des couvertures pour les utilisateurs de Russie.";
"RemovePlayNext" = "Supprimer \"Placer en première position dans la file d'attente\"";
Expand Down Expand Up @@ -209,6 +209,9 @@
"CopyPostText" = "Copy post text";
"SavePostAsImage" = "Save post as image";
"CopyPostAsImage" = "Copy post as image";
"CopyCommentText" = "Copy comment text";
"SaveCommentAsImage" = "Save comment as image";
"CopyCommentAsImage" = "Copy comment as image";
"Cancel" = "Annuler";
"Copied" = "Copié dans le presse-papiers";
"Saved" = "Enregistré dans Photos";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
"SavePostImageDesc" = "Saves community posts image to the Photos app by long tap.";
"SaveProfilePhoto" = "Save profile picture";
"SaveProfilePhotoDesc" = "Saves profile picture to the Photos app by long tap.";
"CopyCommentText" = "Copy comments text";
"CopyCommentTextDesc" = "Copies comments text to the clipboard by long tap.";
"CommentManager" = "Save comment information";
"CommentManagerDesc" = "Allows to copy comment text and save comment as image by long tap.";
"FixAlbums" = "Fix covers";
"FixAlbumsDesc" = "Fixes the display of covers for users from Russia.";
"RemovePlayNext" = "\"次に再生\"を削除";
Expand Down Expand Up @@ -209,6 +209,9 @@
"CopyPostText" = "Copy post text";
"SavePostAsImage" = "Save post as image";
"CopyPostAsImage" = "Copy post as image";
"CopyCommentText" = "Copy comment text";
"SaveCommentAsImage" = "Save comment as image";
"CopyCommentAsImage" = "Copy comment as image";
"Cancel" = "Cancel";
"Copied" = "Copied to clipboard";
"Saved" = "Saved to Photos";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
"SaveProfilePhotoDesc" = "Сохраняет фото профиля в «Фото» долгим нажатием по нему.";
"CopyCommentText" = "Копировать текст комментариев";
"CopyCommentTextDesc" = "Копирует текст комментариев в буфер обмена долгим нажатием.";
"CommentManager" = "Сохранять информацию с комментариев";
"CommentManagerDesc" = "Позволяет скопировать текст из комментария или сохранить комментарий как фото долгим нажатием по нему.";
"FixAlbums" = "Исправить отображение обложек";
"FixAlbumsDesc" = "Исправляет отображение обложек в том случае, если вы из России.";
"RemovePlayNext" = "Убрать «Добавить в начало очереди»";
Expand Down Expand Up @@ -206,9 +208,12 @@
"SelectAction" = "Выберите действие";
"CopyTitle" = "Скопировать название";
"CopyDescription" = "Скопировать описание";
"CopyPostText" = "Копировать текст поста";
"CopyPostText" = "Скопировать текст поста";
"SavePostAsImage" = "Сохранить пост как фото";
"CopyPostAsImage" = "Скопировать пост как фото";
"CopyCommentText" = "Скопировать текст комментария";
"SaveCommentAsImage" = "Сохранить комментарий как фото";
"CopyCommentAsImage" = "Скопировать комментарий как фото";
"Cancel" = "Отмена";
"Copied" = "Скопировано в буфер обмена";
"Saved" = "Сохранено в Фото";
Expand Down
Loading

0 comments on commit 123215f

Please sign in to comment.