mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-04-20 23:22:09 +00:00
Remove ?si= Tracking + Fix iSB compiling errors
This commit is contained in:
parent
0cf621a695
commit
59cc39107f
3 changed files with 102 additions and 7 deletions
|
|
@ -87,9 +87,7 @@
|
|||
@end
|
||||
|
||||
// YTTapToSeek - https://github.com/bhackel/YTTapToSeek
|
||||
@interface YTMainAppVideoPlayerOverlayViewController : UIViewController
|
||||
- (CGFloat)totalTime;
|
||||
@end
|
||||
// Header has been moved to https://github.com/arichornlover/YouTubeHeader/blob/main/YTMainAppVideoPlayerOverlayViewController.h
|
||||
|
||||
// Enable Premium logo - @bhackel
|
||||
@interface YTITopbarLogoRenderer : NSObject
|
||||
|
|
@ -161,10 +159,6 @@
|
|||
- (void)confirmAlertDidPressConfirm;
|
||||
@end
|
||||
|
||||
@interface YTMainAppControlsOverlayView : UIView
|
||||
@property(readonly, nonatomic) YTQTMButton *watchCollapseButton;
|
||||
@end
|
||||
|
||||
@interface YTTransportControlsButtonView : UIView
|
||||
@end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
#import <UIKit/UIActivityViewController.h>
|
||||
#import <YouTubeHeader/YTUIUtils.h>
|
||||
#import <YouTubeHeader/YTColorPalette.h>
|
||||
#import <YouTubeHeader/YTCommonColorPalette.h>
|
||||
#import "Tweaks/protobuf/objectivec/GPBDescriptor.h"
|
||||
#import "Tweaks/protobuf/objectivec/GPBUnknownField.h"
|
||||
#import "Tweaks/protobuf/objectivec/GPBUnknownFieldSet.h"
|
||||
#import "uYouPlus.h"
|
||||
|
||||
@interface PlayerManager : NSObject
|
||||
|
|
@ -53,3 +58,29 @@
|
|||
@interface UILabel (uYou)
|
||||
+ (id)_defaultColor;
|
||||
@end
|
||||
|
||||
// YouTube Native Share Headers - https://github.com/jkhsjdhjs/youtube-native-share - @jkhsjdhjs
|
||||
@interface CustomGPBMessage : GPBMessage
|
||||
+ (instancetype)deserializeFromString:(NSString*)string;
|
||||
@end
|
||||
|
||||
// @interface YTICommand : GPBMessage
|
||||
// @end
|
||||
|
||||
@interface ELMPBCommand : GPBMessage
|
||||
@end
|
||||
|
||||
@interface ELMPBShowActionSheetCommand : GPBMessage
|
||||
@property (nonatomic, strong, readwrite) ELMPBCommand *onAppear;
|
||||
@property (nonatomic, assign, readwrite) BOOL hasOnAppear;
|
||||
@end
|
||||
|
||||
@interface YTIUpdateShareSheetCommand
|
||||
@property (nonatomic, assign, readwrite) BOOL hasSerializedShareEntity;
|
||||
@property (nonatomic, copy, readwrite) NSString *serializedShareEntity;
|
||||
+ (GPBExtensionDescriptor*)updateShareSheetCommand;
|
||||
@end
|
||||
|
||||
@interface YTIInnertubeCommandExtensionRoot
|
||||
+ (GPBExtensionDescriptor*)innertubeCommand;
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -91,6 +91,76 @@ static void repositionCreateTab(YTIGuideResponse *response) {
|
|||
}
|
||||
%end
|
||||
|
||||
// YouTube Native Share - https://github.com/jkhsjdhjs/youtube-native-share - @jkhsjdhjs
|
||||
typedef NS_ENUM(NSInteger, ShareEntityType) {
|
||||
ShareEntityFieldVideo = 1,
|
||||
ShareEntityFieldPlaylist = 2,
|
||||
ShareEntityFieldChannel = 3,
|
||||
ShareEntityFieldClip = 8
|
||||
};
|
||||
|
||||
static inline NSString* extractIdWithFormat(GPBUnknownFieldSet *fields, NSInteger fieldNumber, NSString *format) {
|
||||
if (![fields hasField:fieldNumber])
|
||||
return nil;
|
||||
GPBUnknownField *idField = [fields getField:fieldNumber];
|
||||
if ([idField.lengthDelimitedList count] != 1)
|
||||
return nil;
|
||||
NSString *id = [[NSString alloc] initWithData:[idField.lengthDelimitedList firstObject] encoding:NSUTF8StringEncoding];
|
||||
return [NSString stringWithFormat:format, id];
|
||||
}
|
||||
|
||||
%hook ELMPBShowActionSheetCommand
|
||||
- (void)executeWithCommandContext:(id)_context handler:(id)_handler {
|
||||
if (!self.hasOnAppear)
|
||||
return %orig;
|
||||
GPBExtensionDescriptor *innertubeCommandDescriptor = [%c(YTIInnertubeCommandExtensionRoot) innertubeCommand];
|
||||
if (![self.onAppear hasExtension:innertubeCommandDescriptor])
|
||||
return %orig;
|
||||
YTICommand *innertubeCommand = [self.onAppear getExtension:innertubeCommandDescriptor];
|
||||
GPBExtensionDescriptor *updateShareSheetCommandDescriptor = [%c(YTIUpdateShareSheetCommand) updateShareSheetCommand];
|
||||
if(![innertubeCommand hasExtension:updateShareSheetCommandDescriptor])
|
||||
return %orig;
|
||||
YTIUpdateShareSheetCommand *updateShareSheetCommand = [innertubeCommand getExtension:updateShareSheetCommandDescriptor];
|
||||
if (!updateShareSheetCommand.hasSerializedShareEntity)
|
||||
return %orig;
|
||||
|
||||
GPBMessage *shareEntity = [%c(GPBMessage) deserializeFromString:updateShareSheetCommand.serializedShareEntity];
|
||||
GPBUnknownFieldSet *fields = shareEntity.unknownFields;
|
||||
NSString *shareUrl;
|
||||
|
||||
if ([fields hasField:ShareEntityFieldClip]) {
|
||||
GPBUnknownField *shareEntityClip = [fields getField:ShareEntityFieldClip];
|
||||
if ([shareEntityClip.lengthDelimitedList count] != 1)
|
||||
return %orig;
|
||||
GPBMessage *clipMessage = [%c(GPBMessage) parseFromData:[shareEntityClip.lengthDelimitedList firstObject] error:nil];
|
||||
shareUrl = extractIdWithFormat(clipMessage.unknownFields, 1, @"https://youtube.com/clip/%@");
|
||||
}
|
||||
|
||||
if (!shareUrl)
|
||||
shareUrl = extractIdWithFormat(fields, ShareEntityFieldChannel, @"https://youtube.com/channel/%@");
|
||||
|
||||
if (!shareUrl) {
|
||||
shareUrl = extractIdWithFormat(fields, ShareEntityFieldPlaylist, @"%@");
|
||||
if (shareUrl) {
|
||||
if (![shareUrl hasPrefix:@"PL"] && ![shareUrl hasPrefix:@"FL"])
|
||||
shareUrl = [shareUrl stringByAppendingString:@"&playnext=1"];
|
||||
shareUrl = [@"https://youtube.com/playlist?list=" stringByAppendingString:shareUrl];
|
||||
}
|
||||
}
|
||||
|
||||
if (!shareUrl)
|
||||
shareUrl = extractIdWithFormat(fields, ShareEntityFieldVideo, @"https://youtube.com/watch?v=%@");
|
||||
|
||||
if (!shareUrl)
|
||||
return %orig;
|
||||
|
||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"enableSystemShareSheet"]) {
|
||||
UIActivityViewController *activityViewController = [[UIActivityViewController alloc]initWithActivityItems:@[shareUrl] applicationActivities:nil];
|
||||
[[%c(YTUIUtils) topViewControllerForPresenting] presentViewController:activityViewController animated:YES completion:^{}];
|
||||
}
|
||||
}
|
||||
%end
|
||||
|
||||
// iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224
|
||||
// %group iOS16
|
||||
// %hook OBPrivacyLinkButton
|
||||
|
|
|
|||
Loading…
Reference in a new issue