diff --git a/README.md b/README.md
index 2823f9e..8665164 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,9 @@
+# How to fix the "remote: Repository not found." Error (buildapp.yml) ⚠️
+In order to simply fix this problem go to **Actions** and then go to **Update Submodules** and right as soon as you get there then trigger the **Run Workflow**
+
+Also please know that I can't trigger actions when my account is flagged so I can't update them on uYouEnhanced myself.
+
+# uYouEnhanced
diff --git a/Sources/uYouPlus.h b/Sources/uYouPlus.h
index bf8c680..779c5f8 100644
--- a/Sources/uYouPlus.h
+++ b/Sources/uYouPlus.h
@@ -1,53 +1,56 @@
#import
-#import
-#import
#import
-#import
+#import
#import
-#import
-#import
+#import
+#import
#import
-
-#import "uYouPlusThemes.h" // Hide "Buy Super Thanks" banner (_ASDisplayView)
-#import // Activate FLEX
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import
-#import // Fixes uYou crash when trying to play video (#1422)
-
-// Hide buttons under the video player by @PoomSmart
+#import
+#import
#import
#import
-#import
-
-// YouTube-X
-#import
-#import
#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+#import "uYouPlusThemes.h" // uYouPlus Themes
#define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil]
#define IS_ENABLED(k) [[NSUserDefaults standardUserDefaults] boolForKey:k]
@@ -58,12 +61,8 @@
#define LOWCONTRASTMODE_CUTOFF_VERSION @"17.38.10" // LowContrastMode (v17.33.2-17.38.10)
// Always show remaining time in video player - @bhackel
-@interface YTPlayerBarController : NSObject
-@property(nonatomic, strong) YTInlinePlayerBarContainerView *playerBar;
-@end
-@interface YTInlinePlayerBarContainerView (uYouEnhanced)
-@property(nonatomic, assign) BOOL shouldDisplayTimeRemaining;
-@end
+// Header has been moved to https://github.com/PoomSmart/YouTubeHeader/blob/main/YTPlayerBarController.h
+// Header has been moved to https://github.com/PoomSmart/YouTubeHeader/blob/main/YTInlinePlayerBarContainerView.h
// IAmYouTube
@interface SSOConfiguration : NSObject
@@ -85,12 +84,10 @@
// Hide Home Tab - @bhackel
@interface YTPivotBarItemViewAccessibilityControl : UIControl
@end
-@interface YTPivotBarItemView (uYouEnhanced)
-@property (nonatomic, strong) YTPivotBarItemViewAccessibilityControl *hitTarget;
-@end
+// YTPivotBarItemView Header has been moved to https://github.com/arichornloverALT/YouTubeHeader/blob/main/YTPivotBarItemView.h
// YTTapToSeek - https://github.com/bhackel/YTTapToSeek
-// Header has been moved to https://github.com/arichornlover/YouTubeHeader/blob/main/YTMainAppVideoPlayerOverlayViewController.h
+// YTMainAppVideoPlayerOverlayViewController Header has been moved to https://github.com/arichornloverALT/YouTubeHeader/blob/main/YTMainAppVideoPlayerOverlayViewController.h
// Enable Premium logo - @bhackel
@interface YTITopbarLogoRenderer : NSObject
@@ -98,36 +95,12 @@
@end
// Hide Premium Promo in You tab - @bhackel
-@interface YTIIconThumbnailRenderer : GPBMessage
-@property (nonatomic, strong) YTIIcon *icon;
-- (BOOL)hasIcon;
-@end
-@interface YTICompactListItemThumbnailSupportedRenderers : GPBMessage
-@property (nonatomic, strong) YTIIconThumbnailRenderer *iconThumbnailRenderer;
-- (BOOL)hasIconThumbnailRenderer;
-@end
-@interface YTICompactListItemRenderer : GPBMessage
-@property (nonatomic, strong) YTICompactListItemThumbnailSupportedRenderers *thumbnail;
-@property (nonatomic, strong) YTIFormattedString *title;
-- (BOOL)hasThumbnail;
-- (BOOL)hasTitle;
-@end
-@interface YTIIcon (uYouEnhanced)
-- (BOOL)hasIconType;
-@end
-@interface YTICompactLinkRenderer : GPBMessage
-@property (nonatomic, strong) YTIIcon *icon;
-@property (nonatomic, strong) YTIFormattedString *title;
-@property (nonatomic, strong) YTICompactListItemThumbnailSupportedRenderers *thumbnail;
-- (BOOL)hasIcon;
-- (BOOL)hasThumbnail;
-@end
-@interface YTIItemSectionSupportedRenderers (uYouEnhanced)
-@property(readonly, nonatomic) YTICompactLinkRenderer *compactLinkRenderer;
-@property(readonly, nonatomic) YTICompactListItemRenderer *compactListItemRenderer;
-- (BOOL)hasCompactLinkRenderer;
-- (BOOL)hasCompactListItemRenderer;
-@end
+// YTIIconThumbnailRenderer Header has been moved to https://github.com/arichornloverALT/YouTubeHeader/blob/main/YTIIconThumbnailRenderer.h
+// YTICompactListItemThumbnailSupportedRenderers Header has been moved to https://github.com/arichornloverALT/YouTubeHeader/blob/main/YTICompactListItemThumbnailSupportedRenderers.h
+// YTICompactListItemRenderer Header has been moved to https://github.com/arichornloverALT/YouTubeHeader/blob/main/YTICompactListItemRenderer.h
+// YTIIcon Header has been moved to https://github.com/arichornloverALT/YouTubeHeader/blob/main/YTIIcon.h
+// YTICompactLinkRenderer Header has been moved to https://github.com/arichornloverALT/YouTubeHeader/blob/main/YTICompactLinkRenderer.h
+// YTIItemSectionSupportedRenderers Header has been moved to https://github.com/arichornloverALT/YouTubeHeader/blob/main/YTIItemSectionSupportedRenderers.h
@interface YTAppCollectionViewController : YTInnerTubeCollectionViewController
- (void)uYouEnhancedFakePremiumModel:(YTISectionListRenderer *)model;
@end
@@ -136,13 +109,10 @@
@end
// Disable Pull to Full for landscape videos - @bhackel
-@interface YTWatchPullToFullController : NSObject
-@property(nonatomic, strong) YTWatchViewController *playerViewSource;
-@end
-@interface YTWatchViewController (uYouEnhanced)
-@property(nonatomic, strong) YTWatchPullToFullController *pullToFullController;
-- (NSUInteger) allowedFullScreenOrientations;
+// YTWatchPullToFullController Header has been moved to https://github.com/PoomSmart/YouTubeHeader/blob/main/YTWatchPullToFullController.h
+
// Fullscreen to the Right (uYouEnhanced Version) - @arichornlover
+@interface YTWatchViewController (uYouEnhanced)
- (UIInterfaceOrientationMask) supportedInterfaceOrientations;
- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation;
- (void)forceRightFullscreenOrientation;
@@ -195,17 +165,16 @@
// Buttons
@interface YTRightNavigationButtons : UIView
- (id)_viewControllerForAncestor;
-@property(readonly, nonatomic) YTQTMButton *searchButton;
-@property(readonly, nonatomic) YTQTMButton *notificationButton;
-@property(strong, nonatomic) YTQTMButton *sponsorBlockButton;
-@property(strong, nonatomic) YTQTMButton *uYouPlusButton;
+@property (readonly, nonatomic) NSArray *dynamicButtons;
+@property (readonly, nonatomic) NSArray *visibleButtons;
+@property (readonly, nonatomic) NSArray *buttons;
+@property (readonly, nonatomic) YTQTMButton *searchButton;
+@property (readonly, nonatomic) YTQTMButton *notificationButton;
+@property (strong, nonatomic) YTQTMButton *sponsorBlockButton;
+@property (strong, nonatomic) YTQTMButton *settingsButton;
+- (void)setDynamicButtons:(NSArray *)buttons;
- (void)setLeadingPadding:(CGFloat)arg1;
-- (void)uYouPlusRootOptionsAction;
-@end
-
-@interface YTISlimMetadataButtonSupportedRenderers : NSObject
-- (id)slimButton_buttonRenderer;
-- (id)slimMetadataButtonRenderer;
+- (void)settingsAction;
@end
// YTSpeed
@@ -220,9 +189,7 @@
- (void)internalSetRate;
@end
-@interface MLPlayerStickySettings (uYouPlus)
-- (void)setRate:(float)rate;
-@end
+// MLPlayerStickySettings Header has been moved to https://github.com/arichornloverALT/YouTubeHeader/blob/main/MLPlayerStickySettings.h
@interface MLPlayerEventCenter : NSObject
- (void)broadcastRateChange:(float)rate;
diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm
index 6ccf1dc..f8298fd 100644
--- a/Sources/uYouPlus.xm
+++ b/Sources/uYouPlus.xm
@@ -233,9 +233,10 @@ static __strong NSData *cellDividerData;
%end
%end
-%group gCenterYouTubeLogo
+// Center YouTube Logo - @arichornlover
+%group gCenterYouTubeLogo // BROKEN
%hook YTNavigationBarTitleView
-- (void)setShouldCenterNavBarTitleView:(BOOL)center {
+- (void)setShouldCenterNavBarTitleView:(BOOL)center { // Doesn't do anything?
%orig(YES);
}
- (BOOL)shouldCenterNavBarTitleView {
@@ -301,7 +302,7 @@ static __strong NSData *cellDividerData;
- (BOOL)enableModularPlayerBarController { return NO; } // fixes some of the iSponorBlock problems
- (BOOL)mainAppCoreClientEnableCairoSettings { return IS_ENABLED(@"newSettingsUI_enabled"); } // New grouped settings UI
- (BOOL)enableIosFloatingMiniplayer { return IS_ENABLED(@"floatingMiniplayer_enabled"); } // Floating Miniplayer
-- (BOOL)enableIosFloatingMiniplayerSwipeUpToExpand { return IS_ENABLED(@"floatingMiniplayer_enabled"); } // Floating Miniplayer - Fix Swipe Up Animation
+- (BOOL)enableIosFloatingMiniplayerSwipeUpToExpand { return IS_ENABLED(@"floatingMiniplayer_enabled"); } // Floating Miniplayer
- (BOOL)enableIosFloatingMiniplayerRepositioning { return IS_ENABLED(@"floatingMiniplayer2_enabled"); } // Floating Miniplayer (Repositioning Support, Removes Swiping Up Gesture)
%end
@@ -578,7 +579,7 @@ static __strong NSData *cellDividerData;
}
%end
-// Classic Video Player - 17.33.2+ (Restores the functionality from the YT v16.xx.x Video Player) - @arichornlover
+// Classic Video Player (Restores the v16.xx.x Video Player Functionality) - @arichornlover
// To-do: disabling "Precise Video Scrubbing" https://9to5google.com/2022/06/29/youtube-precise-video-scrubbing/
%group gClassicVideoPlayer
%hook YTColdConfig
@@ -766,7 +767,7 @@ static int contrastMode() {
%end
// YTTapToSeek - https://github.com/bhackel/YTTapToSeek
-%group YTTTS_Tweak
+%group gYTTapToSeek
%hook YTInlinePlayerBarContainerView
- (void)didPressScrubber:(id)arg1 {
%orig;
@@ -851,6 +852,32 @@ static int contrastMode() {
%end
%end
+// Fullscreen to the Right (iPhone-exclusive) - @arichornlover
+// NOTE: Please turn off the “Portrait Fullscreen” Option while the code below is active
+%group gFullscreenToTheRight
+%hook YTWatchViewController
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
+ if ([self isFullscreen] && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+ return UIInterfaceOrientationLandscapeRight;
+ }
+ return %orig;
+}
+- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
+ if ([self isFullscreen] && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+ return UIInterfaceOrientationMaskLandscape;
+ }
+ return %orig;
+}
+%new
+- (void)forceRightFullscreenOrientation { // custom void
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+ NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
+ [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
+ }
+}
+%end
+%end
+
// Disable Double tap to skip chapter - @bhackel
%hook YTDoubleTapToSeekController
- (void)didTwoFingerDoubleTap:(id)arg1 {
@@ -968,7 +995,7 @@ static int contrastMode() {
%hook YTWatchPullToFullController
- (BOOL)shouldRecognizeOverscrollEventsFromWatchOverscrollController:(id)arg1 {
// Get the current player orientation
- YTWatchViewController *watchViewController = self.playerViewSource;
+ YTWatchViewController *watchViewController = (YTWatchViewController *)self.playerViewSource;
NSUInteger allowedFullScreenOrientations = [watchViewController allowedFullScreenOrientations];
// Check if the current player orientation is portrait
if (allowedFullScreenOrientations == UIInterfaceOrientationMaskAllButUpsideDown
@@ -1334,7 +1361,7 @@ static int contrastMode() {
static BOOL findCell(ASNodeController *nodeController, NSArray *identifiers) {
for (id child in [nodeController children]) {
if ([child isKindOfClass:%c(ELMNodeController)]) {
- NSArray *elmChildren = [(ELMNodeController *)child children];
+ NSArray *elmChildren = [(ELMNodeController * _Nullable)child children];
for (ELMComponent *elmChild in elmChildren) {
for (NSString *identifier in identifiers) {
if ([[elmChild description] containsString:identifier])
@@ -1344,8 +1371,8 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide
}
if ([child isKindOfClass:%c(ASNodeController)]) {
- ASDisplayNode *childNode = ((ASNodeController *)child).node; // ELMContainerNode
- NSArray *yogaChildren = childNode.yogaChildren;
+ ASDisplayNode *childNode = ((ASNodeController * _Nullable)child).node; // ELMContainerNode
+ NSArray *yogaChildren = childNode.yogaChildren;
for (ASDisplayNode *displayNode in yogaChildren) {
if ([identifiers containsObject:displayNode.accessibilityIdentifier])
return YES;
@@ -1361,7 +1388,7 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide
%hook ASCollectionView // This stopped working on May 14th 2024 due to a Server-Side Change from YouTube.
-- (CGSize)sizeForElement:(ASCollectionElement *)element {
+- (CGSize)sizeForElement:(ASCollectionElement * _Nullable)element {
if ([self.accessibilityIdentifier isEqualToString:@"id.video.scrollable_action_bar"]) {
ASCellNode *node = [element node];
ASNodeController *nodeController = [node controller];
@@ -1676,6 +1703,9 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide
if (IS_ENABLED(@"portraitFullscreen_enabled")) {
%init(gPortraitFullscreen);
}
+ if (IS_ENABLED(@"fullscreenToTheRight_enabled")) {
+ %init(gFullscreenToTheRight);
+ }
if (IS_ENABLED(@"disableFullscreenButton_enabled")) {
%init(gHideFullscreenButton);
}
@@ -1743,7 +1773,7 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide
%init(gDisableLiveChatSection);
}
if (IS_ENABLED(@"YTTapToSeek_enabled")) {
- %init(YTTTS_Tweak);
+ %init(gYTTapToSeek);
}
if (IS_ENABLED(@"hidePremiumPromos_enabled")) {
%init(gHidePremiumPromos);
diff --git a/Sources/uYouPlusPatches.h b/Sources/uYouPlusPatches.h
index 6dcac73..e9b74f6 100644
--- a/Sources/uYouPlusPatches.h
+++ b/Sources/uYouPlusPatches.h
@@ -85,6 +85,10 @@
+ (GPBExtensionDescriptor*)innertubeCommand;
@end
+@interface YTAccountScopedCommandResponderEvent
+@property (nonatomic, strong, readwrite) YTICommand *command;
+@end
+
@interface YTIShareEntityEndpoint
@property (nonatomic, assign, readwrite) BOOL hasSerializedShareEntity;
@property (nonatomic, copy, readwrite) NSString *serializedShareEntity;
diff --git a/Sources/uYouPlusPatches.xm b/Sources/uYouPlusPatches.xm
index 7430664..24bae43 100644
--- a/Sources/uYouPlusPatches.xm
+++ b/Sources/uYouPlusPatches.xm
@@ -2,6 +2,7 @@
# pragma mark - YouTube patches
+/*
// Fix Google Sign in by @PoomSmart and @level3tjg (qnblackcat/uYouPlus#684)
%hook NSBundle
- (NSDictionary *)infoDictionary {
@@ -11,6 +12,17 @@
return info;
}
%end
+*/
+
+// Workaround for MiRO92/uYou-for-YouTube#12, qnblackcat/uYouPlus#263
+%hook YTDataUtils
++ (NSMutableDictionary *)spamSignalsDictionary {
+ return nil;
+}
++ (NSMutableDictionary *)spamSignalsDictionaryWithoutIDFA {
+ return nil;
+}
+%end
%hook YTHotConfig
- (BOOL)disableAfmaIdfaCollection { return NO; }
@@ -98,7 +110,6 @@ static inline NSString* extractIdWithFormat(GPBUnknownFieldSet *fields, NSIntege
NSString *id = [[NSString alloc] initWithData:[idField.lengthDelimitedList firstObject] encoding:NSUTF8StringEncoding];
return [NSString stringWithFormat:format, id];
}
-
static BOOL showNativeShareSheet(NSString *serializedShareEntity) {
GPBMessage *shareEntity = [%c(GPBMessage) deserializeFromString:serializedShareEntity];
GPBUnknownFieldSet *fields = shareEntity.unknownFields;
@@ -107,7 +118,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity) {
if ([fields hasField:ShareEntityFieldClip]) {
GPBUnknownField *shareEntityClip = [fields getField:ShareEntityFieldClip];
if ([shareEntityClip.lengthDelimitedList count] != 1)
- return FALSE;
+ return NO;
GPBMessage *clipMessage = [%c(GPBMessage) parseFromData:[shareEntityClip.lengthDelimitedList firstObject] error:nil];
shareUrl = extractIdWithFormat(clipMessage.unknownFields, 1, @"https://youtube.com/clip/%@");
}
@@ -128,40 +139,38 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity) {
shareUrl = extractIdWithFormat(fields, ShareEntityFieldVideo, @"https://youtube.com/watch?v=%@");
if (!shareUrl)
- return FALSE;
+ return NO;
- UIActivityViewController *activityViewController = [[UIActivityViewController alloc]initWithActivityItems:@[shareUrl] applicationActivities:nil];
- [[%c(YTUIUtils) topViewControllerForPresenting] presentViewController:activityViewController animated:YES completion:^{}];
- return TRUE;
+ UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[shareUrl] applicationActivities:nil];
+ activityViewController.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypePrint];
+
+ UIViewController *topViewController = [%c(YTUIUtils) topViewControllerForPresenting];
+
+ if (activityViewController.popoverPresentationController) {
+ activityViewController.popoverPresentationController.sourceView = topViewController.view;
+
+ CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
+ CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
+
+ activityViewController.popoverPresentationController.sourceRect = CGRectMake(screenWidth / 2.0, screenHeight, 0, 0);
+ activityViewController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
+ }
+ [topViewController presentViewController:activityViewController animated:YES completion:nil];
+ return YES;
}
-
/* -------------------- iPad Layout -------------------- */
-/*
-%hook YTShareRequestViewController
-- (id)initWithService:(id)_service parentResponder:(id)_parentResponder {
- id result = %orig;
- // disable the default share sheet behavior and force the app to call [YTAccountScopedCommandRouter handleCommand] if available
- if ([_parentResponder respondsToSelector:@selector(handleCommand:entry:fromView:sender:completionBlock:)]) {
- [_parentResponder handleCommand:nil entry:nil fromView:nil sender:nil completionBlock:nil];
- }
- return result;
-}
-%end
-*/
-
-%hook YTAccountScopedCommandRouter
-- (BOOL)handleCommand:(id)command entry:(id)_entry fromView:(id)_fromView sender:(id)_sender completionBlock:(id)_completionBlock {
+%hook YTAccountScopedCommandResponderEvent
+- (void)send {
GPBExtensionDescriptor *shareEntityEndpointDescriptor = [%c(YTIShareEntityEndpoint) shareEntityEndpoint];
- if (![command hasExtension:shareEntityEndpointDescriptor])
+ if (![self.command hasExtension:shareEntityEndpointDescriptor])
return %orig;
- YTIShareEntityEndpoint *shareEntityEndpoint = [command getExtension:shareEntityEndpointDescriptor];
- if(!shareEntityEndpoint.hasSerializedShareEntity)
+ YTIShareEntityEndpoint *shareEntityEndpoint = [self.command getExtension:shareEntityEndpointDescriptor];
+ if (!shareEntityEndpoint.hasSerializedShareEntity)
return %orig;
if (!showNativeShareSheet(shareEntityEndpoint.serializedShareEntity))
return %orig;
- return TRUE;
}
%end
@@ -186,6 +195,8 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity) {
}
%end
+//
+
// iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224
// %group iOS16
// %hook OBPrivacyLinkButton
@@ -340,7 +351,6 @@ static void refreshUYouAppearance() {
// Disable uYou's playback speed controls (prevent crash on video playback https://github.com/therealFoxster/uYouPlus/issues/2#issuecomment-1894912963)
// [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"showPlaybackRate"];
-
// Disable uYou's adblock
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"removeYouTubeAds"];
}
diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm
index b1af9ce..76dd5c5 100644
--- a/Sources/uYouPlusSettings.xm
+++ b/Sources/uYouPlusSettings.xm
@@ -201,21 +201,19 @@ extern NSBundle *uYouPlusBundle();
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
if (IS_ENABLED(@"replaceCopyandPasteButtons_enabled")) {
// Export Settings functionality
- NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+ NSURL *tempFileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"exported_settings.txt"]];
NSMutableString *settingsString = [NSMutableString string];
for (NSString *key in copyKeys) {
- if ([userDefaults objectForKey:key]) {
- NSString *value = [userDefaults objectForKey:key];
+ id value = [[NSUserDefaults standardUserDefaults] objectForKey:key];
+ if (value) {
[settingsString appendFormat:@"%@: %@\n", key, value];
}
}
- if (settingsString.length > 0) {
- UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.text"] inMode:UIDocumentPickerModeExportToService];
+ [settingsString writeToURL:tempFileURL atomically:YES encoding:NSUTF8StringEncoding error:nil];
+ UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithURL:tempFileURL inMode:UIDocumentPickerModeExportToService];
documentPicker.delegate = (id)self;
documentPicker.allowsMultipleSelection = NO;
- [UIApplication.sharedApplication.keyWindow.rootViewController presentViewController:documentPicker animated:YES completion:nil];
- }
- return YES;
+ [settingsViewController presentViewController:documentPicker animated:YES completion:nil];
} else {
// Copy Settings functionality (default behavior)
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
@@ -245,7 +243,7 @@ extern NSBundle *uYouPlusBundle();
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.text"] inMode:UIDocumentPickerModeImport];
documentPicker.delegate = (id)self;
documentPicker.allowsMultipleSelection = NO;
- [UIApplication.sharedApplication.keyWindow.rootViewController presentViewController:documentPicker animated:YES completion:nil];
+ [settingsViewController presentViewController:documentPicker animated:YES completion:nil];
return YES;
} else {
// Paste Settings functionality (default behavior)
@@ -262,7 +260,7 @@ extern NSBundle *uYouPlusBundle();
NSString *value = components[1];
[[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
}
- }
+ }
[settingsViewController reloadData];
SHOW_RELAUNCH_YT_SNACKBAR;
}
@@ -472,7 +470,7 @@ extern NSBundle *uYouPlusBundle();
LOC(@"HIDE_FULLSCREEN_ACTION_BUTTONS_DESC"),
@"hideFullscreenActions_enabled",
({
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
+ if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
// Show alert if the option is not compatible with iPad
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"iPad Compatibility Issue" message:@"This option is only compatible with iPhone devices." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
@@ -1395,18 +1393,23 @@ extern NSBundle *uYouPlusBundle();
[settingsViewController setSectionItems:sectionItems forCategory:uYouPlusSection title:@"uYouEnhanced" titleDescription:LOC(@"TITLE DESCRIPTION") headerHidden:YES];
}
-// File Manager (Paste Settings)
+// File Manager (Import Settings .txt)
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray *)urls {
if (urls.count > 0) {
- NSString *fileContents = [NSString stringWithContentsOfURL:urls.firstObject encoding:NSUTF8StringEncoding error:nil];
- NSArray *lines = [fileContents componentsSeparatedByString:@"\n"];
- for (NSString *line in lines) {
- NSArray *components = [line componentsSeparatedByString:@": "];
- if (components.count == 2) {
- NSString *key = components[0];
- NSString *value = components[1];
- [[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
+ NSURL *fileURL = urls.firstObject;
+ NSString *fileContents = [NSString stringWithContentsOfURL:fileURL encoding:NSUTF8StringEncoding error:nil];
+ if (fileContents.length > 0) {
+ NSArray *lines = [fileContents componentsSeparatedByString:@"\n"];
+ for (NSString *line in lines) {
+ NSArray *components = [line componentsSeparatedByString:@": "];
+ if (components.count == 2) {
+ NSString *key = components[0];
+ NSString *value = components[1];
+ [[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
+ }
}
+ YTSettingsViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"];
+ [settingsViewController reloadData];
}
}
}