Преглед изворни кода

VLCSettingsViewController: Modally display about view

Mike JS. Choi пре 7 година
родитељ
комит
211a74179f

+ 1 - 0
Resources/Base.lproj/Localizable.strings

@@ -52,6 +52,7 @@
 "CONTINUE_PLAYBACK" = "Continue playback?";
 "CONTINUE_PLAYBACK_LONG" = "Would you like to continue playback of \"%@\" where you left off?";
 
+"BUTTON_ABOUT" = "About";
 "BUTTON_ALL" = "Select All";
 "BUTTON_BACK" = "Back";
 "BUTTON_EDIT" = "Edit";

+ 0 - 14
Resources/Settings.bundle/Root.inApp.plist

@@ -4,20 +4,6 @@
 <dict>
 	<key>PreferenceSpecifiers</key>
 	<array>
-        <dict>
-            <key>Type</key>
-            <string>PSGroupSpecifier</string>
-            <key>Title</key>
-            <string>SETTINGS_ABOUT_TITLE</string>
-        </dict>
-        <dict>
-            <key>Key</key>
-            <string>about</string>
-            <key>Title</key>
-            <string>ABOUT_APP_IOS</string>
-            <key>Type</key>
-            <string>IASKButtonSpecifier</string>
-        </dict>
 		<dict>
 			<key>Type</key>
 			<string>PSGroupSpecifier</string>

BIN
Resources/Settings.bundle/en.lproj/Root.strings


+ 1 - 0
Resources/en.lproj/Localizable.strings

@@ -52,6 +52,7 @@
 "CONTINUE_PLAYBACK_LONG" = "Would you like to continue playback of \"%@\" where you left off?";
 
 "BUTTON_ALL" = "Select All";
+"BUTTON_ABOUT" = "About";
 "BUTTON_BACK" = "Back";
 "BUTTON_EDIT" = "Edit";
 "BUTTON_DONE" = "Done";

+ 23 - 5
Sources/VLCAboutViewController.m

@@ -45,16 +45,29 @@
 - (void)viewDidLoad
 {
     [super viewDidLoad];
-
+    if (@available(iOS 11.0, *)) {
+        self.navigationController.navigationBar.prefersLargeTitles = NO;
+    }
+    
     self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"title"]];
-
+    [self.navigationItem.titleView setTintColor:PresentationTheme.current.colors.navigationbarTextColor];
+    
     UIBarButtonItem *contributeButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_CONTRIBUTE", nil) style:UIBarButtonItemStylePlain target:self action:@selector(openContributePage:)];
-    contributeButton.tintColor = [UIColor whiteColor];
-
-    self.navigationItem.rightBarButtonItem = contributeButton;
+    contributeButton.accessibilityIdentifier = VLCAccessibilityIdentifier.contribute;
+    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_DONE", nil) style:UIBarButtonItemStyleDone target:self action:@selector(dismiss)];
+    doneButton.accessibilityIdentifier = VLCAccessibilityIdentifier.done;
+    
+    self.navigationItem.leftBarButtonItem = contributeButton;
+    self.navigationItem.rightBarButtonItem = doneButton;
+    
     [self loadWebContent];
 }
 
+- (void)dismiss
+{
+    [self dismissViewControllerAnimated:YES completion:nil];
+}
+
 - (void)loadWebContent
 {
     NSBundle *mainBundle = [NSBundle mainBundle];
@@ -113,4 +126,9 @@
     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.videolan.org/contribute.html"]];
 }
 
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+    return PresentationTheme.current.colors.statusBarStyle;
+}
+
 @end

+ 9 - 8
Sources/VLCSettingsController.m

@@ -35,10 +35,16 @@
 
 - (void)viewDidLoad
 {
+    [super viewDidLoad];
+
     self.modalPresentationStyle = UIModalPresentationFormSheet;
     self.delegate = self;
     self.showDoneButton = NO;
     self.showCreditsFooter = NO;
+    
+    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_ABOUT", nil) style:UIBarButtonItemStylePlain target:self action:@selector(showAbout)];
+    self.navigationItem.leftBarButtonItem.accessibilityIdentifier = VLCAccessibilityIdentifier.about;
+    
     [self themeDidChange];
 }
 
@@ -123,12 +129,11 @@
     }
 }
 
-#pragma mark - IASKSettings delegate
-
-- (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForSpecifier:(IASKSpecifier*)specifier
+- (void)showAbout
 {
     VLCAboutViewController *aboutVC = [[VLCAboutViewController alloc] init];
-    [self.navigationController pushViewController:aboutVC animated:YES];
+    UINavigationController *modalNavigationController = [[UINavigationController alloc] initWithRootViewController:aboutVC];
+    [self presentViewController:modalNavigationController animated:YES completion:nil];
 }
 
 #pragma mark - PAPasscode delegate
@@ -145,14 +150,10 @@
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    IASKSpecifier *specifier  = [self.settingsReader specifierForIndexPath:indexPath];
     UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
     cell.backgroundColor = PresentationTheme.current.colors.settingsCellBackground;
     cell.textLabel.textColor = PresentationTheme.current.colors.cellTextColor;
     cell.detailTextLabel.textColor = PresentationTheme.current.colors.cellDetailTextColor;
-    if ([specifier.key isEqualToString:@"about"]) {
-        cell.accessibilityIdentifier = VLCAccessibilityIdentifier.about;
-    }
     return cell;
 }
 

+ 2 - 0
VLC-iOS-UITests/Helpers/VLCAccessibilityIdentifier.swift

@@ -19,6 +19,8 @@ import Foundation
     static let cloud = "cloud"
     static let stream = "stream"
     static let downloads = "downloads"
+    @objc static let done = "done"
+    @objc static let contribute = "contribute"
     @objc static let about = "about"
     @objc static let playPause = "playPause"
 }

+ 3 - 2
VLC-iOS-UITests/VLCTestMenu.swift

@@ -66,7 +66,8 @@ class VLCTestMenu: XCTestCase {
 
     func testNavigationToAbout() {
         helper.tapTabBarItem(VLCAccessibilityIdentifier.settings)
-        app.cells[VLCAccessibilityIdentifier.about].tap()
-        XCTAssertNotNil(app.navigationBars[VLCAccessibilityIdentifier.about])
+        app.navigationBars.buttons[VLCAccessibilityIdentifier.about].tap()
+        XCTAssertNotNil(app.navigationBars.buttons[VLCAccessibilityIdentifier.done])
+        XCTAssertNotNil(app.navigationBars.buttons[VLCAccessibilityIdentifier.contribute])
     }
 }

+ 9 - 6
vlc-ios/Images.xcassets/Library View/title.imageset/Contents.json

@@ -2,22 +2,25 @@
   "images" : [
     {
       "idiom" : "universal",
-      "scale" : "1x",
-      "filename" : "title.png"
+      "filename" : "title.png",
+      "scale" : "1x"
     },
     {
       "idiom" : "universal",
-      "scale" : "2x",
-      "filename" : "title@2x.png"
+      "filename" : "title@2x.png",
+      "scale" : "2x"
     },
     {
       "idiom" : "universal",
-      "scale" : "3x",
-      "filename" : "title@3x.png"
+      "filename" : "title@3x.png",
+      "scale" : "3x"
     }
   ],
   "info" : {
     "version" : 1,
     "author" : "xcode"
+  },
+  "properties" : {
+    "template-rendering-intent" : "template"
   }
 }