Skip to content

Commit

Permalink
Update YouTubeNativeShare from 0.2.4 to 0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
aricloverEXALT authored Jan 7, 2025
1 parent c421c86 commit c397afd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Sources/uYouPlusPatches.xm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ typedef NS_ENUM(NSInteger, ShareEntityType) {
ShareEntityFieldPlaylist = 2,
ShareEntityFieldChannel = 3,
ShareEntityFieldPost = 6,
ShareEntityFieldClip = 8
ShareEntityFieldClip = 8,
ShareEntityFieldShortFlag = 10
};

static inline NSString* extractIdWithFormat(GPBUnknownFields *fields, NSInteger fieldNumber, NSString *format) {
Expand Down Expand Up @@ -137,8 +138,12 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *source
}
}

if (!shareUrl)
shareUrl = extractIdWithFormat(fields, ShareEntityFieldVideo, @"https://youtube.com/watch?v=%@");
if (!shareUrl) {
NSString *format = @"https://youtube.com/watch?v=%@";
if ([fields fields:ShareEntityFieldShortFlag])
format = @"https://youtube.com/shorts/%@";
shareUrl = extractIdWithFormat(fields, ShareEntityFieldVideo, format);
}

if (!shareUrl)
shareUrl = extractIdWithFormat(fields, ShareEntityFieldPost, @"https://youtube.com/post/%@");
Expand Down

0 comments on commit c397afd

Please sign in to comment.