mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-08-21 18:48:45 -04:00
Fix playback in feeds on iPad
This commit is contained in:
@@ -266,7 +266,7 @@ static const NSInteger YTLiteSection = 789;
|
|||||||
return [YTSettingsSectionItemClass itemWithTitle:LOC(sectionLabel)
|
return [YTSettingsSectionItemClass itemWithTitle:LOC(sectionLabel)
|
||||||
accessibilityIdentifier:nil
|
accessibilityIdentifier:nil
|
||||||
detailTextBlock:^NSString *() {
|
detailTextBlock:^NSString *() {
|
||||||
return sectionGestureSelectedModeToString(GetSelection(sectionKey));
|
return sectionGestureSelectedModeToString(GetInteger(sectionKey));
|
||||||
}
|
}
|
||||||
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
|
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
|
||||||
NSArray <YTSettingsSectionItem *> *rows = @[
|
NSArray <YTSettingsSectionItem *> *rows = @[
|
||||||
@@ -280,7 +280,7 @@ static const NSInteger YTLiteSection = 789;
|
|||||||
initWithNavTitle:LOC(sectionLabel)
|
initWithNavTitle:LOC(sectionLabel)
|
||||||
pickerSectionTitle:nil
|
pickerSectionTitle:nil
|
||||||
rows:rows
|
rows:rows
|
||||||
selectedItemIndex:GetSelection(sectionKey)
|
selectedItemIndex:GetInteger(sectionKey)
|
||||||
parentResponder:[self parentResponder]
|
parentResponder:[self parentResponder]
|
||||||
];
|
];
|
||||||
[settingsViewController pushViewController:picker];
|
[settingsViewController pushViewController:picker];
|
||||||
@@ -559,7 +559,7 @@ static const NSInteger YTLiteSection = 789;
|
|||||||
YTSettingsSectionItem *themeGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"THEME_OPTIONS")
|
YTSettingsSectionItem *themeGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"THEME_OPTIONS")
|
||||||
accessibilityIdentifier:nil
|
accessibilityIdentifier:nil
|
||||||
detailTextBlock:^NSString *() {
|
detailTextBlock:^NSString *() {
|
||||||
switch (GetSelection(@"appTheme")) {
|
switch (GetInteger(@"appTheme")) {
|
||||||
case 1:
|
case 1:
|
||||||
return LOC(@"OLD_DARK_THEME");
|
return LOC(@"OLD_DARK_THEME");
|
||||||
case 0:
|
case 0:
|
||||||
@@ -583,7 +583,7 @@ static const NSInteger YTLiteSection = 789;
|
|||||||
BASIC_SWITCH(LOC(@"LOW_CONTRAST_MODE"), LOC(@"LOW_CONTRAST_MODE_DESC"), @"lowContrastMode_enabled"),
|
BASIC_SWITCH(LOC(@"LOW_CONTRAST_MODE"), LOC(@"LOW_CONTRAST_MODE_DESC"), @"lowContrastMode_enabled"),
|
||||||
lowContrastModeSection
|
lowContrastModeSection
|
||||||
];
|
];
|
||||||
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"THEME_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:GetSelection(@"appTheme") parentResponder:[self parentResponder]];
|
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"THEME_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:GetInteger(@"appTheme") parentResponder:[self parentResponder]];
|
||||||
[settingsViewController pushViewController:picker];
|
[settingsViewController pushViewController:picker];
|
||||||
return YES;
|
return YES;
|
||||||
}];
|
}];
|
||||||
@@ -595,7 +595,8 @@ static const NSInteger YTLiteSection = 789;
|
|||||||
YTSettingsSectionItem *playbackInFeedsGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"PLAYBACK_IN_FEEDS")
|
YTSettingsSectionItem *playbackInFeedsGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"PLAYBACK_IN_FEEDS")
|
||||||
accessibilityIdentifier:nil
|
accessibilityIdentifier:nil
|
||||||
detailTextBlock:^NSString *() {
|
detailTextBlock:^NSString *() {
|
||||||
switch (GetSelection(@"inline_muted_playback_enabled")) {
|
// The specific values were gathered by checking the value for each setting
|
||||||
|
switch (GetInteger(@"inline_muted_playback_enabled")) {
|
||||||
case 3:
|
case 3:
|
||||||
return LOC(@"PLAYBACK_IN_FEEDS_WIFI_ONLY");
|
return LOC(@"PLAYBACK_IN_FEEDS_WIFI_ONLY");
|
||||||
case 1:
|
case 1:
|
||||||
@@ -624,9 +625,14 @@ static const NSInteger YTLiteSection = 789;
|
|||||||
}],
|
}],
|
||||||
];
|
];
|
||||||
// It seems values greater than 3 act the same as Always On (Index 1)
|
// It seems values greater than 3 act the same as Always On (Index 1)
|
||||||
int (^getInlineSelection)() = ^int() {
|
// Convert the stored value to an index for a picker (0 to 2)
|
||||||
int selection = GetSelection(@"inline_muted_playback_enabled") - 1;
|
NSInteger (^getInlineSelection)(void) = ^NSInteger(void) {
|
||||||
return selection > 3 ? 1 : selection;
|
NSInteger selection = GetInteger(@"inline_muted_playback_enabled") - 1;
|
||||||
|
// Check if selection is within the valid bounds [0, 1, 2]
|
||||||
|
if (selection < 0 || selection > 2) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return selection;
|
||||||
};
|
};
|
||||||
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"PLAYBACK_IN_FEEDS") pickerSectionTitle:nil rows:rows selectedItemIndex:getInlineSelection() parentResponder:[self parentResponder]];
|
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"PLAYBACK_IN_FEEDS") pickerSectionTitle:nil rows:rows selectedItemIndex:getInlineSelection() parentResponder:[self parentResponder]];
|
||||||
[settingsViewController pushViewController:picker];
|
[settingsViewController pushViewController:picker];
|
||||||
|
@@ -59,8 +59,8 @@
|
|||||||
|
|
||||||
// Helper methods for key retrieval
|
// Helper methods for key retrieval
|
||||||
#define IsEnabled(key) [[NSUserDefaults standardUserDefaults] boolForKey:key]
|
#define IsEnabled(key) [[NSUserDefaults standardUserDefaults] boolForKey:key]
|
||||||
#define GetSelection(key) [[NSUserDefaults standardUserDefaults] integerForKey:key]
|
#define GetInteger(key) [[NSUserDefaults standardUserDefaults] integerForKey:key] // NSInteger type
|
||||||
#define GetFloat(key) [[NSUserDefaults standardUserDefaults] floatForKey:key]
|
#define GetFloat(key) [[NSUserDefaults standardUserDefaults] floatForKey:key] // float type
|
||||||
|
|
||||||
|
|
||||||
// Player Gesture selected mode enum
|
// Player Gesture selected mode enum
|
||||||
|
@@ -723,7 +723,7 @@ BOOL isTabSelected = NO;
|
|||||||
void (^runSelectedGesture)(NSString*, CGFloat, CGFloat, CGFloat, CGFloat)
|
void (^runSelectedGesture)(NSString*, CGFloat, CGFloat, CGFloat, CGFloat)
|
||||||
= ^(NSString *sectionKey, CGFloat translationX, CGFloat initialBrightness, CGFloat initialVolume, CGFloat currentTime) {
|
= ^(NSString *sectionKey, CGFloat translationX, CGFloat initialBrightness, CGFloat initialVolume, CGFloat currentTime) {
|
||||||
// Determine the selected gesture mode using the section key
|
// Determine the selected gesture mode using the section key
|
||||||
GestureMode selectedGestureMode = (GestureMode)GetSelection(sectionKey);
|
GestureMode selectedGestureMode = (GestureMode)GetInteger(sectionKey);
|
||||||
// Handle the gesture action based on the selected mode
|
// Handle the gesture action based on the selected mode
|
||||||
switch (selectedGestureMode) {
|
switch (selectedGestureMode) {
|
||||||
case GestureModeVolume:
|
case GestureModeVolume:
|
||||||
@@ -760,21 +760,21 @@ BOOL isTabSelected = NO;
|
|||||||
if (startLocation.y <= viewHeight / 3.0) {
|
if (startLocation.y <= viewHeight / 3.0) {
|
||||||
gestureSection = GestureSectionTop;
|
gestureSection = GestureSectionTop;
|
||||||
// Cancel the gesture if the mode is disabled
|
// Cancel the gesture if the mode is disabled
|
||||||
if (GetSelection(@"playerGestureTopSelection") == GestureModeDisabled) {
|
if (GetInteger(@"playerGestureTopSelection") == GestureModeDisabled) {
|
||||||
panGestureRecognizer.state = UIGestureRecognizerStateCancelled;
|
panGestureRecognizer.state = UIGestureRecognizerStateCancelled;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (startLocation.y <= 2 * viewHeight / 3.0) {
|
} else if (startLocation.y <= 2 * viewHeight / 3.0) {
|
||||||
gestureSection = GestureSectionMiddle;
|
gestureSection = GestureSectionMiddle;
|
||||||
// Cancel the gesture if the mode is disabled
|
// Cancel the gesture if the mode is disabled
|
||||||
if (GetSelection(@"playerGestureMiddleSelection") == GestureModeDisabled) {
|
if (GetInteger(@"playerGestureMiddleSelection") == GestureModeDisabled) {
|
||||||
panGestureRecognizer.state = UIGestureRecognizerStateCancelled;
|
panGestureRecognizer.state = UIGestureRecognizerStateCancelled;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (startLocation.y <= viewHeight) {
|
} else if (startLocation.y <= viewHeight) {
|
||||||
gestureSection = GestureSectionBottom;
|
gestureSection = GestureSectionBottom;
|
||||||
// Cancel the gesture if the mode is disabled
|
// Cancel the gesture if the mode is disabled
|
||||||
if (GetSelection(@"playerGestureBottomSelection") == GestureModeDisabled) {
|
if (GetInteger(@"playerGestureBottomSelection") == GestureModeDisabled) {
|
||||||
panGestureRecognizer.state = UIGestureRecognizerStateCancelled;
|
panGestureRecognizer.state = UIGestureRecognizerStateCancelled;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user