Skip to content

Commit

Permalink
#1351 (gestures in vertical scrolling)
Browse files Browse the repository at this point in the history
- Restored the old scroll direction preferences, since I’ve removed the UIPageViewController approach (see #817).
- I’ll come back to this feature enhancement later, with a different solution.
  • Loading branch information
Dejal committed Jan 30, 2021
1 parent f091832 commit a1452bc
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 39 deletions.
78 changes: 39 additions & 39 deletions clients/ios/Classes/FontSettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ - (void)viewWillAppear:(BOOL)animated {
[self.autoscrollSegment setSelectedSegmentIndex:0];
}

// if ([userPreferences objectForKey:@"scroll_stories_horizontally"]){
// BOOL scrollHorizontally = [userPreferences boolForKey:@"scroll_stories_horizontally"];
// if (scrollHorizontally) {
// [self.scrollOrientationSegment setSelectedSegmentIndex:0];
// } else {
// [self.scrollOrientationSegment setSelectedSegmentIndex:1];
// }
// }
if ([userPreferences objectForKey:@"scroll_stories_horizontally"]){
BOOL scrollHorizontally = [userPreferences boolForKey:@"scroll_stories_horizontally"];
if (scrollHorizontally) {
[self.scrollOrientationSegment setSelectedSegmentIndex:0];
} else {
[self.scrollOrientationSegment setSelectedSegmentIndex:1];
}
}

NSString *theme = [ThemeManager themeManager].theme;
if ([theme isEqualToString:@"sepia"]) {
Expand Down Expand Up @@ -233,12 +233,12 @@ - (IBAction)changeAutoscroll:(id)sender {
[self.appDelegate.storyPagesViewController changedAutoscroll];
}

//- (IBAction)changeScrollOrientation:(id)sender {
// NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
// [userPreferences setBool:[sender selectedSegmentIndex] == 0 forKey:@"scroll_stories_horizontally"];
// [userPreferences synchronize];
// [self.appDelegate.storyPagesViewController changedScrollOrientation];
//}
- (IBAction)changeScrollOrientation:(id)sender {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
[userPreferences setBool:[sender selectedSegmentIndex] == 0 forKey:@"scroll_stories_horizontally"];
[userPreferences synchronize];
[self.appDelegate.storyPagesViewController changedScrollOrientation];
}

- (IBAction)changeTheme:(id)sender {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
Expand Down Expand Up @@ -269,9 +269,9 @@ - (IBAction)changeTheme:(id)sender {

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return 12;
return 13;
} else {
return 11;
return 12;
}
}

Expand All @@ -290,8 +290,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
} else if (indexPath.row == 10 - iPadOffset) {
return [self makeAutoscrollTableCell];
} else if (indexPath.row == 11 - iPadOffset) {
// return [self makeScrollOrientationTableCell];
// } else if (indexPath.row == 12 - iPadOffset) {
return [self makeScrollOrientationTableCell];
} else if (indexPath.row == 12 - iPadOffset) {
return [self makeThemeTableCell];
}

Expand Down Expand Up @@ -545,27 +545,27 @@ - (UITableViewCell *)makeAutoscrollTableCell {
return cell;
}

//- (UITableViewCell *)makeScrollOrientationTableCell {
// UITableViewCell *cell = [[UITableViewCell alloc] init];
// cell.frame = CGRectMake(0, 0, 240, kMenuOptionHeight);
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// cell.separatorInset = UIEdgeInsetsZero;
// cell.backgroundColor = UIColorFromRGB(0xffffff);
//
// self.scrollOrientationSegment.frame = CGRectMake(8, 7, cell.frame.size.width - 8*2, kMenuOptionHeight - 7*2);
// [self.scrollOrientationSegment setTitle:[@"⏩ Horizontal" uppercaseString] forSegmentAtIndex:0];
// [self.scrollOrientationSegment setTitle:[@"⏬ Vertical" uppercaseString] forSegmentAtIndex:1];
// self.scrollOrientationSegment.backgroundColor = UIColorFromRGB(0xeeeeee);
// [self.scrollOrientationSegment setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica-Bold" size:11.0f]} forState:UIControlStateNormal];
// [self.scrollOrientationSegment setContentOffset:CGSizeMake(0, 1) forSegmentAtIndex:0];
// [self.scrollOrientationSegment setContentOffset:CGSizeMake(0, 1) forSegmentAtIndex:1];
//
// [[ThemeManager themeManager] updateSegmentedControl:self.scrollOrientationSegment];
//
// [cell.contentView addSubview:self.scrollOrientationSegment];
//
// return cell;
//}
- (UITableViewCell *)makeScrollOrientationTableCell {
UITableViewCell *cell = [[UITableViewCell alloc] init];
cell.frame = CGRectMake(0, 0, 240, kMenuOptionHeight);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.separatorInset = UIEdgeInsetsZero;
cell.backgroundColor = UIColorFromRGB(0xffffff);
self.scrollOrientationSegment.frame = CGRectMake(8, 7, cell.frame.size.width - 8*2, kMenuOptionHeight - 7*2);
[self.scrollOrientationSegment setTitle:[@"⏩ Horizontal" uppercaseString] forSegmentAtIndex:0];
[self.scrollOrientationSegment setTitle:[@"⏬ Vertical" uppercaseString] forSegmentAtIndex:1];
self.scrollOrientationSegment.backgroundColor = UIColorFromRGB(0xeeeeee);
[self.scrollOrientationSegment setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica-Bold" size:11.0f]} forState:UIControlStateNormal];
[self.scrollOrientationSegment setContentOffset:CGSizeMake(0, 1) forSegmentAtIndex:0];
[self.scrollOrientationSegment setContentOffset:CGSizeMake(0, 1) forSegmentAtIndex:1];
[[ThemeManager themeManager] updateSegmentedControl:self.scrollOrientationSegment];
[cell.contentView addSubview:self.scrollOrientationSegment];
return cell;
}

- (UITableViewCell *)makeThemeTableCell {
UITableViewCell *cell = [[UITableViewCell alloc] init];
Expand Down
10 changes: 10 additions & 0 deletions clients/ios/Resources/Settings.bundle/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,16 @@
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Scroll horizontally</string>
<key>Key</key>
<string>scroll_stories_horizontally</string>
<key>DefaultValue</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
Expand Down
10 changes: 10 additions & 0 deletions clients/ios/Resources/Settings.bundle/Root~ipad.plist
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,16 @@
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Scroll horizontally</string>
<key>Key</key>
<string>scroll_stories_horizontally</string>
<key>DefaultValue</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
Expand Down

0 comments on commit a1452bc

Please sign in to comment.