浏览代码

Merge PLEX and ftp login panel, drop previous insecure bookmarks implementation

Felix Paul Kühne 10 年之前
父节点
当前提交
2639057fcc

+ 51 - 17
Resources/VLCNetworkLoginViewController.xib

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E33b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E36b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
     <dependencies>
         <deployment identifier="iOS"/>
         <development version="5000" identifier="xcode"/>
@@ -12,19 +12,22 @@
                 <outlet property="historyLogin" destination="105" id="106"/>
                 <outlet property="loginHelpLabel" destination="lGc-Rk-dDO" id="q9y-NH-Vuw"/>
                 <outlet property="passwordField" destination="94" id="98"/>
-                <outlet property="serverAddressField" destination="7" id="99"/>
-                <outlet property="serverAddressHelpLabel" destination="LCc-UZ-fl6" id="sJc-p7-cmN"/>
+                <outlet property="portField" destination="apI-bG-FZ2" id="MIF-Oo-nwz"/>
+                <outlet property="portLabel" destination="Zhl-CE-wU8" id="zn0-t5-T93"/>
+                <outlet property="protocolSegmentedControl" destination="NYh-cy-I1V" id="ceN-Fw-Wvi"/>
+                <outlet property="serverField" destination="7" id="1wI-tJ-SsR"/>
+                <outlet property="serverLabel" destination="LPm-mG-2Dr" id="wuB-QJ-2n3"/>
                 <outlet property="usernameField" destination="44" id="101"/>
                 <outlet property="view" destination="1" id="3"/>
             </connections>
         </placeholder>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <view contentMode="scaleToFill" id="1">
-            <rect key="frame" x="0.0" y="0.0" width="320" height="478"/>
+            <rect key="frame" x="0.0" y="0.0" width="320" height="522"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
-                <textField clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="ftp://yourserver.local" textAlignment="center" minimumFontSize="17" clearButtonMode="unlessEditing" id="7">
-                    <rect key="frame" x="0.0" y="5" width="320" height="31"/>
+                <textField clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="yourserver.local" textAlignment="center" minimumFontSize="17" clearButtonMode="unlessEditing" id="7">
+                    <rect key="frame" x="104" y="44" width="216" height="31"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                     <color key="backgroundColor" red="0.28627450980392155" green="0.28627450980392155" blue="0.28627450980392155" alpha="1" colorSpace="calibratedRGB"/>
                     <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -32,7 +35,7 @@
                     <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardAppearance="alert"/>
                 </textField>
                 <button contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="6">
-                    <rect key="frame" x="0.0" y="41" width="320" height="40"/>
+                    <rect key="frame" x="0.0" y="122" width="320" height="40"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                     <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
                     <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
@@ -42,7 +45,7 @@
                     </connections>
                 </button>
                 <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsVerticalScrollIndicator="NO" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="105">
-                    <rect key="frame" x="0.0" y="286" width="320" height="192"/>
+                    <rect key="frame" x="0.0" y="330" width="320" height="192"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                     <color key="separatorColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                     <connections>
@@ -51,17 +54,17 @@
                     </connections>
                 </tableView>
                 <button contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="axZ-sK-2Iz">
-                    <rect key="frame" x="0.0" y="238" width="320" height="40"/>
+                    <rect key="frame" x="0.0" y="282" width="320" height="40"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                     <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
                     <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
                     <state key="normal" title="Save"/>
                     <connections>
-                        <action selector="saveFTP:" destination="-1" eventType="touchUpInside" id="4dc-vT-XPz"/>
+                        <action selector="saveServer:" destination="-1" eventType="touchUpInside" id="ZeK-OS-WaT"/>
                     </connections>
                 </button>
                 <textField clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Password" textAlignment="center" minimumFontSize="17" clearButtonMode="unlessEditing" id="94">
-                    <rect key="frame" x="0.0" y="162" width="320" height="31"/>
+                    <rect key="frame" x="0.0" y="206" width="320" height="31"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                     <color key="backgroundColor" red="0.28627450980392155" green="0.28627450980392155" blue="0.28627450980392155" alpha="1" colorSpace="calibratedRGB"/>
                     <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -69,7 +72,7 @@
                     <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardAppearance="alert" secureTextEntry="YES"/>
                 </textField>
                 <textField clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="User" textAlignment="center" minimumFontSize="17" clearButtonMode="unlessEditing" id="44">
-                    <rect key="frame" x="0.0" y="126" width="320" height="31"/>
+                    <rect key="frame" x="0.0" y="170" width="320" height="31"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                     <color key="backgroundColor" red="0.28627450980392155" green="0.28627450980392155" blue="0.28627450980392155" alpha="1" colorSpace="calibratedRGB"/>
                     <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -77,24 +80,55 @@
                     <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardAppearance="alert"/>
                 </textField>
                 <label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="If required by the server, enter user name and password." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="9" id="lGc-Rk-dDO">
-                    <rect key="frame" x="13" y="199" width="294" height="34"/>
+                    <rect key="frame" x="13" y="243" width="294" height="34"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                     <color key="backgroundColor" red="0.15686274510000001" green="0.15686274510000001" blue="0.15686274510000001" alpha="1" colorSpace="calibratedRGB"/>
                     <fontDescription key="fontDescription" type="system" pointSize="14"/>
                     <color key="textColor" red="0.58823529411764708" green="0.58823529411764708" blue="0.58823529411764708" alpha="1" colorSpace="calibratedRGB"/>
                     <nil key="highlightedColor"/>
                 </label>
-                <label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Enter the IP or the name of the server you want to connect to." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="9" id="LCc-UZ-fl6">
-                    <rect key="frame" x="20" y="81" width="280" height="42"/>
-                    <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+                <label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Server" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="9" id="LPm-mG-2Dr">
+                    <rect key="frame" x="8" y="51" width="88" height="17"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                     <color key="backgroundColor" red="0.15686274510000001" green="0.15686274510000001" blue="0.15686274510000001" alpha="1" colorSpace="calibratedRGB"/>
                     <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                    <color key="textColor" red="0.58823529411764708" green="0.58823529411764708" blue="0.58823529411764708" alpha="1" colorSpace="calibratedRGB"/>
+                    <color key="textColor" red="0.58823529409999997" green="0.58823529409999997" blue="0.58823529409999997" alpha="1" colorSpace="calibratedRGB"/>
                     <nil key="highlightedColor"/>
                 </label>
+                <label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Port" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="9" id="Zhl-CE-wU8">
+                    <rect key="frame" x="8" y="90" width="88" height="17"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                    <color key="backgroundColor" red="0.15686274510000001" green="0.15686274510000001" blue="0.15686274510000001" alpha="1" colorSpace="calibratedRGB"/>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <color key="textColor" red="0.58823529409999997" green="0.58823529409999997" blue="0.58823529409999997" alpha="1" colorSpace="calibratedRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+                <segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" id="NYh-cy-I1V">
+                    <rect key="frame" x="8" y="8" width="304" height="29"/>
+                    <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+                    <segments>
+                        <segment title="SMB"/>
+                        <segment title="FTP"/>
+                        <segment title="PLEX"/>
+                    </segments>
+                    <color key="tintColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
+                    <connections>
+                        <action selector="protocolSelectionChanged:" destination="-1" eventType="touchUpInside" id="X3V-Yt-aLq"/>
+                        <action selector="protocolSelectionChanged:" destination="-1" eventType="valueChanged" id="ngV-iM-5Bw"/>
+                    </connections>
+                </segmentedControl>
+                <textField clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="1234" textAlignment="center" minimumFontSize="17" clearButtonMode="unlessEditing" id="apI-bG-FZ2">
+                    <rect key="frame" x="104" y="83" width="216" height="31"/>
+                    <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+                    <color key="backgroundColor" red="0.28627450980000002" green="0.28627450980000002" blue="0.28627450980000002" alpha="1" colorSpace="calibratedRGB"/>
+                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardAppearance="alert"/>
+                </textField>
             </subviews>
             <color key="backgroundColor" red="0.15686274509803921" green="0.15686274509803921" blue="0.15686274509803921" alpha="1" colorSpace="calibratedRGB"/>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <point key="canvasLocation" x="380" y="373"/>
         </view>
     </objects>
     <simulatedMetricsContainer key="defaultSimulatedMetrics">

+ 0 - 120
Resources/VLCPlexConnectServerViewController.xib

@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E33b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
-    <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
-    </dependencies>
-    <objects>
-        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCPlexConnectServerViewController">
-            <connections>
-                <outlet property="bookmarkButton" destination="axZ-sK-2Iz" id="2mV-Id-d8X"/>
-                <outlet property="bookmarkLabel" destination="zDw-Zb-GT1" id="x4w-tB-Moz"/>
-                <outlet property="connectButton" destination="6" id="ZVh-ZT-GxG"/>
-                <outlet property="portField" destination="44" id="hMY-NU-2k6"/>
-                <outlet property="portLabel" destination="Qzy-U8-tjZ" id="mLF-yD-pdj"/>
-                <outlet property="scrollView" destination="mUz-s7-1VB" id="lxr-x8-abJ"/>
-                <outlet property="serverAddressField" destination="7" id="DLF-Dd-P4c"/>
-                <outlet property="serverAddressHelpLabel" destination="LCc-UZ-fl6" id="Zcc-X6-iZK"/>
-                <outlet property="serverAddressLabel" destination="Mql-Cg-dnG" id="4kM-9A-Hfj"/>
-                <outlet property="serverPlexBookmark" destination="105" id="tjj-ra-NML"/>
-                <outlet property="view" destination="1" id="xQw-Iz-yjA"/>
-            </connections>
-        </placeholder>
-        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <view contentMode="scaleToFill" id="1">
-            <rect key="frame" x="0.0" y="0.0" width="320" height="478"/>
-            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-            <subviews>
-                <scrollView multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" id="mUz-s7-1VB">
-                    <rect key="frame" x="0.0" y="0.0" width="320" height="478"/>
-                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                    <subviews>
-                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Server" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Mql-Cg-dnG">
-                            <rect key="frame" x="0.0" y="0.0" width="52" height="31"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                            <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
-                            <nil key="highlightedColor"/>
-                        </label>
-                        <textField clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="yourserver.local" textAlignment="center" minimumFontSize="17" clearButtonMode="unlessEditing" id="7">
-                            <rect key="frame" x="58.000000108545628" y="5" width="260" height="31"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxY="YES"/>
-                            <color key="backgroundColor" red="0.28627450980392155" green="0.28627450980392155" blue="0.28627450980392155" alpha="1" colorSpace="calibratedRGB"/>
-                            <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                            <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardAppearance="alert"/>
-                        </textField>
-                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Port" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Qzy-U8-tjZ">
-                            <rect key="frame" x="0.0" y="39" width="52" height="31"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                            <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
-                            <nil key="highlightedColor"/>
-                        </label>
-                        <textField clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="32400" textAlignment="center" minimumFontSize="17" clearButtonMode="unlessEditing" id="44">
-                            <rect key="frame" x="58.000000108545613" y="39" width="260" height="31"/>
-                            <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxY="YES"/>
-                            <color key="backgroundColor" red="0.28627450980392155" green="0.28627450980392155" blue="0.28627450980392155" alpha="1" colorSpace="calibratedRGB"/>
-                            <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                            <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardAppearance="alert"/>
-                        </textField>
-                        <button contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="6">
-                            <rect key="frame" x="0.0" y="78" width="320" height="40"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
-                            <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
-                            <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
-                            <state key="normal" title="Connect"/>
-                            <connections>
-                                <action selector="connectToServer:" destination="-1" eventType="touchUpInside" id="isI-8i-6LQ"/>
-                            </connections>
-                        </button>
-                        <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsVerticalScrollIndicator="NO" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="105">
-                            <rect key="frame" x="0.0" y="245" width="320" height="232"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
-                            <color key="separatorColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
-                            <connections>
-                                <outlet property="dataSource" destination="-1" id="1fS-Dx-iQ6"/>
-                                <outlet property="delegate" destination="-1" id="NMO-N4-N3u"/>
-                            </connections>
-                        </tableView>
-                        <label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Enter the IP or the name of the server you want to connect to." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="9" id="LCc-UZ-fl6">
-                            <rect key="frame" x="0.0" y="120" width="320" height="42"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
-                            <color key="backgroundColor" red="0.15686274510000001" green="0.15686274510000001" blue="0.15686274510000001" alpha="1" colorSpace="calibratedRGB"/>
-                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                            <color key="textColor" red="0.58823529411764708" green="0.58823529411764708" blue="0.58823529411764708" alpha="1" colorSpace="calibratedRGB"/>
-                            <nil key="highlightedColor"/>
-                        </label>
-                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="BookMark" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="zDw-Zb-GT1">
-                            <rect key="frame" x="0.0" y="215" width="320" height="21"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
-                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                            <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
-                            <nil key="highlightedColor"/>
-                        </label>
-                        <button contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="axZ-sK-2Iz">
-                            <rect key="frame" x="0.0" y="168" width="320" height="40"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
-                            <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
-                            <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
-                            <state key="normal" title="Save"/>
-                            <connections>
-                                <action selector="savePlexServer:" destination="-1" eventType="touchUpInside" id="wza-A5-qL6"/>
-                            </connections>
-                        </button>
-                    </subviews>
-                </scrollView>
-            </subviews>
-            <color key="backgroundColor" red="0.15686274509803921" green="0.15686274509803921" blue="0.15686274509803921" alpha="1" colorSpace="calibratedRGB"/>
-            <nil key="simulatedStatusBarMetrics"/>
-            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
-            <point key="canvasLocation" x="47" y="379"/>
-        </view>
-    </objects>
-    <simulatedMetricsContainer key="defaultSimulatedMetrics">
-        <simulatedStatusBarMetrics key="statusBar"/>
-        <simulatedOrientationMetrics key="orientation"/>
-        <simulatedScreenMetrics key="destination" type="retina4"/>
-    </simulatedMetricsContainer>
-</document>

二进制
Resources/en.lproj/Localizable.strings


+ 0 - 3
Sources/VLCConstants.h

@@ -66,9 +66,6 @@
 #define kVLCFTPServer @"ftp-server"
 #define kVLCFTPLogin @"ftp-login"
 #define kVLCFTPPassword @"ftp-pass"
-#define kVLCLastFTPServer @"last-ftp-server"
-#define kVLCLastFTPLogin @"last-ftp-login"
-#define kVLCLastFTPPassword @"last-ftp-pass"
 
 #define kVLCPLEXServer @"plex-server"
 #define kVLCPLEXPort @"plex-port"

+ 24 - 11
Sources/VLCNetworkLoginViewController.h

@@ -2,7 +2,7 @@
  * VLCNetworkLoginViewController.h
  * VLC for iOS
  *****************************************************************************
- * Copyright (c) 2013 VideoLAN. All rights reserved.
+ * Copyright (c) 2013-2015 VideoLAN. All rights reserved.
  * $Id$
  *
  * Authors: Felix Paul Kühne <fkuehne # videolan.org>
@@ -13,32 +13,45 @@
 
 #import <UIKit/UIKit.h>
 
-@protocol VLCNetworkLoginViewController <NSObject>
+typedef NS_ENUM(NSInteger, VLCServerProtocol) {
+    VLCServerProtocolSMB,
+    VLCServerProtocolFTP,
+    VLCServerProtocolPLEX,
+    VLCServerProtocolUndefined,
+};
+
+@protocol VLCNetworkLoginViewControllerDelegate <NSObject>
 @required
-- (void)loginToURL:(NSURL *)url confirmedWithUsername:(NSString *)username andPassword:(NSString *)thePassword;
+- (void)loginToServer:(NSString *)server
+                 port:(NSString *)port
+             protocol:(VLCServerProtocol)protocol
+confirmedWithUsername:(NSString *)username
+          andPassword:(NSString *)password;
 @end
 
 @interface VLCNetworkLoginViewController : UIViewController
 
-@property (nonatomic, strong) IBOutlet UITextField *serverAddressField;
+@property (nonatomic, strong) IBOutlet UISegmentedControl *protocolSegmentedControl;
+@property (nonatomic, strong) IBOutlet UITextField *serverField;
+@property (nonatomic, strong) IBOutlet UILabel *serverLabel;
+@property (nonatomic, strong) IBOutlet UITextField *portField;
+@property (nonatomic, strong) IBOutlet UILabel *portLabel;
 @property (nonatomic, strong) IBOutlet UIButton *connectButton;
 @property (nonatomic, strong) IBOutlet UITextField *usernameField;
-@property (nonatomic, strong) IBOutlet UILabel *usernameLabel;
 @property (nonatomic, strong) IBOutlet UITextField *passwordField;
-@property (nonatomic, strong) IBOutlet UILabel *passwordLabel;
-@property (nonatomic, strong) IBOutlet UILabel *serverAddressHelpLabel;
 @property (nonatomic, strong) IBOutlet UILabel *loginHelpLabel;
 @property (weak, nonatomic) IBOutlet UITableView *historyLogin;
+
+@property (nonatomic, readwrite) NSInteger serverProtocol;
 @property (nonatomic, retain) NSString *hostname;
+@property (nonatomic, retain) NSString *port;
 @property (nonatomic, retain) NSString *username;
 @property (nonatomic, retain) NSString *password;
 
 @property (nonatomic, retain) id delegate;
 
-- (IBAction)dismiss:(id)sender;
-- (IBAction)dismissWithAnimation:(id)sender;
 - (IBAction)connectToServer:(id)sender;
-- (IBAction)saveFTP:(id)sender;
-
+- (IBAction)saveServer:(id)sender;
+- (IBAction)protocolSelectionChanged:(id)sender;
 
 @end

+ 95 - 92
Sources/VLCNetworkLoginViewController.m

@@ -2,7 +2,7 @@
  * VLCNetworkLoginViewController.m
  * VLC for iOS
  *****************************************************************************
- * Copyright (c) 2013 VideoLAN. All rights reserved.
+ * Copyright (c) 2013-2015 VideoLAN. All rights reserved.
  * $Id$
  *
  * Authors: Felix Paul Kühne <fkuehne # videolan.org>
@@ -15,9 +15,6 @@
 
 @interface VLCNetworkLoginViewController () <UITableViewDataSource, UITableViewDelegate, UITextFieldDelegate>
 {
-    NSMutableArray *_saveServer;
-    NSMutableArray *_saveLogin;
-    NSMutableArray *_savePass;
     NSString *_hostname;
     NSString *_username;
     NSString *_password;
@@ -26,45 +23,37 @@
 
 @implementation VLCNetworkLoginViewController
 
-+ (void)initialize
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
-    NSDictionary *loginDefaults = @{kVLCFTPServer : @[], kVLCFTPLogin : @[],kVLCFTPServer : @[]};
-
-    [defaults registerDefaults:loginDefaults];
-}
-
 - (void)viewDidLoad
 {
     [super viewDidLoad];
 
     self.modalPresentationStyle = UIModalPresentationFormSheet;
 
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
-        UIBarButtonItem *dismissButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(dismissWithAnimation:)];
-        self.navigationItem.leftBarButtonItem = dismissButton;
-    }
-
     self.title = NSLocalizedString(@"CONNECT_TO_SERVER", nil);
     [self.connectButton setTitle:NSLocalizedString(@"BUTTON_CONNECT", nil) forState:UIControlStateNormal];
-    self.serverAddressHelpLabel.text = NSLocalizedString(@"ENTER_SERVER_ADDRESS_HELP", nil);
+    self.serverLabel.text = NSLocalizedString(@"SERVER", nil);
+    self.portLabel.text = NSLocalizedString(@"SERVER_PORT", nil);
     self.loginHelpLabel.text = NSLocalizedString(@"ENTER_SERVER_CREDS_HELP", nil);
-    self.usernameLabel.text = NSLocalizedString(@"USER_LABEL", nil);
-    self.passwordLabel.text = NSLocalizedString(@"PASSWORD_LABEL", nil);
 
-    self.serverAddressField.delegate = self;
-    self.serverAddressField.returnKeyType = UIReturnKeyNext;
-    self.serverAddressField.clearButtonMode = UITextFieldViewModeWhileEditing;
+    self.serverField.delegate = self;
+    self.serverField.returnKeyType = UIReturnKeyNext;
+    self.serverField.clearButtonMode = UITextFieldViewModeWhileEditing;
+    self.portField.delegate = self;
+    self.portField.returnKeyType = UIReturnKeyNext;
+    self.portField.clearButtonMode = UITextFieldViewModeWhileEditing;
     self.usernameField.delegate = self;
     self.usernameField.returnKeyType = UIReturnKeyNext;
     self.usernameField.clearButtonMode = UITextFieldViewModeWhileEditing;
     self.passwordField.delegate = self;
     self.passwordField.returnKeyType = UIReturnKeyDone;
     self.passwordField.clearButtonMode = UITextFieldViewModeWhileEditing;
+    self.historyLogin.backgroundColor = [UIColor VLCDarkBackgroundColor];
 
     UIColor *color = [UIColor VLCLightTextColor];
-    self.serverAddressField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"ftp://yourserver.local" attributes:@{NSForegroundColorAttributeName: color}];
+    self.protocolSegmentedControl.selectedSegmentIndex = 1; // FTP
+    self.serverProtocol = VLCServerProtocolFTP;
+    self.serverField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"yourserver.local" attributes:@{NSForegroundColorAttributeName: color}];
+    self.portField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"21" attributes:@{NSForegroundColorAttributeName: color}];
     self.usernameField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"USER_LABEL", nil) attributes:@{NSForegroundColorAttributeName: color}];
     self.passwordField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"PASSWORD_LABEL", nil) attributes:@{NSForegroundColorAttributeName: color}];
     self.edgesForExtendedLayout = UIRectEdgeNone;
@@ -72,74 +61,65 @@
 
 - (void)viewWillAppear:(BOOL)animated
 {
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    _saveServer = [NSMutableArray arrayWithArray:[defaults objectForKey:kVLCFTPServer]];
-    _saveLogin = [NSMutableArray arrayWithArray:[defaults objectForKey:kVLCFTPLogin]];
-    _savePass = [NSMutableArray arrayWithArray:[defaults objectForKey:kVLCFTPPassword]];
-
     [super viewWillAppear:animated];
 
-    if ([defaults stringForKey:kVLCLastFTPServer])
-        self.serverAddressField.text = [defaults stringForKey:kVLCLastFTPServer];
-    if ([defaults stringForKey:kVLCLastFTPLogin])
-        self.usernameField.text = [defaults stringForKey:kVLCLastFTPLogin];
-    if ([defaults stringForKey:kVLCLastFTPPassword])
-        self.passwordField.text = [defaults stringForKey:kVLCLastFTPPassword];
-
     if (_hostname.length > 0)
-        self.serverAddressField.text = _hostname;
+        self.serverField.text = _hostname;
+    if (_port.length > 0)
+        self.portField.text = _port;
     if (_username.length > 0)
         self.usernameField.text = _username;
     if (_password.length > 0)
         self.passwordField.text = _password;
-}
+    if (self.serverProtocol != VLCServerProtocolUndefined) {
+        self.protocolSegmentedControl.selectedSegmentIndex = self.serverProtocol;
+        self.protocolSegmentedControl.enabled = NO;
+    } else {
+        self.protocolSegmentedControl.enabled = YES;
+    }
 
-- (void)viewWillDisappear:(BOOL)animated
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    [defaults setObject:self.serverAddressField.text forKey:kVLCLastFTPServer];
-    [defaults setObject:self.usernameField.text forKey:kVLCLastFTPLogin];
-    [defaults setObject:self.passwordField.text forKey:kVLCLastFTPPassword];
+    // FIXME: persistent state
+    /* 
+     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+     _bookmarkServer = [NSMutableArray arrayWithArray:[defaults objectForKey:kVLCPLEXServer]];
+     _bookmarkPort = [NSMutableArray arrayWithArray:[defaults objectForKey:kVLCPLEXPort]];
 
-    [super viewWillDisappear:animated];
-}
+     [super viewWillAppear:animated];
 
-- (IBAction)dismissWithAnimation:(id)sender
-{
-    self.navigationController.navigationBar.translucent = YES;
+     if ([defaults stringForKey:kVLCLastPLEXServer])
+     self.serverAddressField.text = [defaults stringForKey:kVLCLastPLEXServer];
+     if ([defaults stringForKey:kVLCLastPLEXPort])
+     self.portField.text = [defaults stringForKey:kVLCLastPLEXPort];
 
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
-        [self.navigationController popViewControllerAnimated:YES];
-    else
-        [self dismissViewControllerAnimated:YES completion:nil];
+     if (self.portField.text.length < 1)
+     self.portField.text = kPlexMediaServerPortDefault;
+     */
 }
 
-- (IBAction)dismiss:(id)sender
+- (void)viewWillDisappear:(BOOL)animated
 {
-    self.navigationController.navigationBar.translucent = YES;
-
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
-        [self.navigationController popViewControllerAnimated:NO];
-    else
-        [self dismissViewControllerAnimated:NO completion:nil];
+    // FIXME: persistent state?!
+    [super viewWillDisappear:animated];
 }
 
 - (IBAction)connectToServer:(id)sender
 {
-    [self dismiss:nil];
-
     if (self.delegate) {
-        if ([self.delegate respondsToSelector:@selector(loginToURL:confirmedWithUsername:andPassword:)]) {
-            NSString *string = self.serverAddressField.text;
-            if (![string hasPrefix:@"ftp://"])
-                string = [NSString stringWithFormat:@"ftp://%@", string];
-            [self.delegate loginToURL:[NSURL URLWithString:string] confirmedWithUsername:self.usernameField.text andPassword:self.passwordField.text];
+        if ([self.delegate respondsToSelector:@selector(loginToServer:port:protocol:confirmedWithUsername:andPassword:)]) {
+
+            [self.delegate loginToServer:self.serverField.text
+                                    port:self.portField.text
+                                protocol:self.protocolSegmentedControl.selectedSegmentIndex
+                   confirmedWithUsername:self.usernameField.text
+                             andPassword:self.passwordField.text];
         }
     }
 }
 
-- (IBAction)saveFTP:(id)sender
+- (IBAction)saveServer:(id)sender
 {
+    // FIXME:
+    /*
     NSString *serverAddress = self.serverAddressField.text;
     if (!serverAddress)
         return;
@@ -149,19 +129,49 @@
     [_saveServer addObject:serverAddress];
     [_saveLogin addObject:self.usernameField.text];
     [_savePass  addObject:self.passwordField.text];
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    [defaults setObject:[NSArray arrayWithArray:_saveServer] forKey:kVLCFTPServer];
-    [defaults setObject:[NSArray arrayWithArray:_saveLogin] forKey:kVLCFTPLogin];
-    [defaults setObject:[NSArray arrayWithArray:_savePass] forKey:kVLCFTPPassword];
-    [defaults synchronize];
-    [self.historyLogin reloadData];
+
+     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+     [defaults setObject:[NSArray arrayWithArray:_bookmarkServer] forKey:kVLCPLEXServer];
+     [defaults setObject:[NSArray arrayWithArray:_bookmarkPort] forKey:kVLCPLEXPort];
+
+     [self.historyLogin reloadData];*/
+}
+
+- (IBAction)protocolSelectionChanged:(id)sender
+{
+    UIColor *color = [UIColor VLCLightTextColor];
+
+    switch (self.protocolSegmentedControl.selectedSegmentIndex) {
+        case VLCServerProtocolFTP:
+        {
+            self.portField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"21" attributes:@{NSForegroundColorAttributeName: color}];
+            self.usernameField.enabled = self.passwordField.enabled = YES;
+            break;
+        }
+        case VLCServerProtocolPLEX:
+        {
+            self.portField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"32400" attributes:@{NSForegroundColorAttributeName: color}];
+            self.usernameField.enabled = self.passwordField.enabled = NO;
+            break;
+        }
+        case VLCServerProtocolSMB:
+        {
+            self.portField.placeholder = @"";
+            self.portField.enabled = NO;
+            self.usernameField.enabled = self.passwordField.enabled = YES;
+        }
+
+        default:
+            break;
+    }
+
 }
 
 #pragma mark - text view delegate
 - (BOOL)textFieldShouldReturn:(UITextField *)textField
 {
-    if ([self.serverAddressField isFirstResponder]) {
-        [self.serverAddressField resignFirstResponder];
+    if ([self.serverField isFirstResponder]) {
+        [self.serverField resignFirstResponder];
         [self.usernameField becomeFirstResponder];
     } else if ([self.usernameField isFirstResponder]) {
         [self.usernameField resignFirstResponder];
@@ -181,7 +191,7 @@
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    return _saveServer.count;
+    return 0; // FIXME: _saveServer.count;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@@ -196,8 +206,9 @@
     }
 
     NSInteger row = indexPath.row;
+/*  FIXME: fetch from storage
     cell.textLabel.text = [_saveServer[row] lastPathComponent];
-    cell.detailTextLabel.text = _saveLogin[row];
+    cell.detailTextLabel.text = _saveLogin[row];*/
 
     return cell;
 }
@@ -217,23 +228,14 @@
 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
 {
     if (editingStyle == UITableViewCellEditingStyleDelete) {
-        [_saveServer removeObjectAtIndex:indexPath.row];
-        [_saveLogin removeObjectAtIndex:indexPath.row];
-        [_savePass removeObjectAtIndex:indexPath.row];
+        // FIXME: remove from storage
         [tableView reloadData];
-        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-        [defaults setObject:[NSArray arrayWithArray:_saveServer] forKey:kVLCFTPServer];
-        [defaults setObject:[NSArray arrayWithArray:_saveLogin] forKey:kVLCFTPLogin];
-        [defaults setObject:[NSArray arrayWithArray:_savePass] forKey:kVLCFTPPassword];
-        [defaults synchronize];
     }
 }
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    [self.serverAddressField setText:_saveServer[indexPath.row]];
-    [self.usernameField setText:_saveLogin[indexPath.row]];
-    [self.passwordField setText:_savePass[indexPath.row]];
+    // FIXME: fetch from storage
 
     [self.historyLogin deselectRowAtIndexPath:indexPath animated:NO];
 }
@@ -241,12 +243,12 @@
 - (void)setHostname:(NSString *)theHostname
 {
     _hostname = theHostname;
-    self.serverAddressField.text = theHostname;
+    self.serverField.text = theHostname;
 }
 
 - (NSString *)hostname
 {
-    return self.serverAddressField.text;
+    return self.serverField.text;
 }
 
 - (void)setUsername:(NSString *)theUsername
@@ -271,4 +273,5 @@
     return self.passwordField.text;
 }
 
+
 @end

+ 0 - 31
Sources/VLCPlexConnectServerViewController.h

@@ -1,31 +0,0 @@
-/*****************************************************************************
- * VLCPlexConnectServerViewController.h
- * VLC for iOS
- *****************************************************************************
- * Copyright (c) 2015 VideoLAN. All rights reserved.
- *
- * Authors: Felix Paul Kühne <fkuehne # videolan.org>
- *          Pierre SAGASPE <pierre.sagaspe # me.com>
- *
- * Refer to the COPYING file of the official project for license.
- *****************************************************************************/
-
-#import <UIKit/UIKit.h>
-
-@interface VLCPlexConnectServerViewController : UIViewController
-
-@property (nonatomic, strong) IBOutlet UIScrollView *scrollView;
-@property (nonatomic, strong) IBOutlet UITextField *serverAddressField;
-@property (nonatomic, strong) IBOutlet UIButton *connectButton;
-@property (nonatomic, strong) IBOutlet UITextField *portField;
-@property (nonatomic, strong) IBOutlet UILabel *serverAddressLabel;
-@property (nonatomic, strong) IBOutlet UILabel *portLabel;
-@property (nonatomic, strong) IBOutlet UILabel *serverAddressHelpLabel;
-@property (nonatomic, strong) IBOutlet UITableView *serverPlexBookmark;
-@property (nonatomic, strong) IBOutlet UIButton *bookmarkButton;
-@property (strong, nonatomic) IBOutlet UILabel *bookmarkLabel;
-
-- (IBAction)connectToServer:(id)sender;
-- (IBAction)savePlexServer:(id)sender;
-
-@end

+ 0 - 279
Sources/VLCPlexConnectServerViewController.m

@@ -1,279 +0,0 @@
-/*****************************************************************************
- * VLCPlexConnectServerViewController.m
- * VLC for iOS
- *****************************************************************************
- * Copyright (c) 2015 VideoLAN. All rights reserved.
- *
- * Authors: Felix Paul Kühne <fkuehne # videolan.org>
- *          Pierre SAGASPE <pierre.sagaspe # me.com>
- *
- * Refer to the COPYING file of the official project for license.
- *****************************************************************************/
-
-#import "VLCPlexConnectServerViewController.h"
-#import "VLCLocalPlexFolderListViewController.h"
-
-#define kPlexMediaServerPortDefault @"32400"
-
-@interface VLCPlexConnectServerViewController () <UITableViewDataSource, UITableViewDelegate, UITextFieldDelegate>
-{
-    NSMutableArray *_bookmarkServer;
-    NSMutableArray *_bookmarkPort;
-
-    UIActivityIndicatorView *_activityIndicator;
-}
-@end
-
-@implementation VLCPlexConnectServerViewController
-
-+ (void)initialize
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    NSDictionary *loginDefaults = @{kVLCPLEXServer : @[], kVLCPLEXPort : @[]};
-    [defaults registerDefaults:loginDefaults];
-}
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-
-    self.title = @"Plex Media Server";
-    [self.connectButton setTitle:NSLocalizedString(@"BUTTON_CONNECT", nil) forState:UIControlStateNormal];
-    self.serverAddressHelpLabel.text = NSLocalizedString(@"ENTER_SERVER_ADDRESS_HELP", nil);
-    self.serverAddressLabel.text = NSLocalizedString(@"SERVER", nil);
-    self.portLabel.text = NSLocalizedString(@"SERVER_PORT", nil);
-    self.bookmarkLabel.text = NSLocalizedString(@"BOOKMARK", nil);
-
-    self.serverAddressField.delegate = self;
-    self.serverAddressField.returnKeyType = UIReturnKeyNext;
-    self.serverAddressField.clearButtonMode = UITextFieldViewModeWhileEditing;
-    self.serverAddressField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
-    self.portField.delegate = self;
-    self.portField.returnKeyType = UIReturnKeyDone;
-    self.portField.clearButtonMode = UITextFieldViewModeWhileEditing;
-    self.portField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
-
-    self.serverPlexBookmark.backgroundColor = [UIColor VLCDarkBackgroundColor];
-    self.serverPlexBookmark.showsVerticalScrollIndicator = YES;
-    self.serverPlexBookmark.indicatorStyle = UIScrollViewIndicatorStyleWhite;
-
-    UIColor *color = [UIColor VLCLightTextColor];
-    self.serverAddressField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"192.168.0.0" attributes:@{NSForegroundColorAttributeName: color}];
-    self.portField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:kPlexMediaServerPortDefault attributes:@{NSForegroundColorAttributeName: color}];
-
-    self.edgesForExtendedLayout = UIRectEdgeNone;
-
-    _activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
-    _activityIndicator.center = self.view.center;
-    _activityIndicator.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin;
-    _activityIndicator.hidesWhenStopped = YES;
-    [self.view addSubview:_activityIndicator];
-
-    self.scrollView.contentSize = self.view.frame.size;
-    [self.scrollView setBackgroundColor:[UIColor VLCDarkBackgroundColor]];
-    [self.scrollView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    _bookmarkServer = [NSMutableArray arrayWithArray:[defaults objectForKey:kVLCPLEXServer]];
-    _bookmarkPort = [NSMutableArray arrayWithArray:[defaults objectForKey:kVLCPLEXPort]];
-
-    [super viewWillAppear:animated];
-
-    if ([defaults stringForKey:kVLCLastPLEXServer])
-        self.serverAddressField.text = [defaults stringForKey:kVLCLastPLEXServer];
-    if ([defaults stringForKey:kVLCLastPLEXPort])
-        self.portField.text = [defaults stringForKey:kVLCLastPLEXPort];
-
-    if (self.portField.text.length < 1)
-        self.portField.text = kPlexMediaServerPortDefault;
-}
-
-- (void)viewWillDisappear:(BOOL)animated
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    [defaults setObject:self.serverAddressField.text forKey:kVLCLastPLEXServer];
-    [defaults setObject:self.portField.text forKey:kVLCLastPLEXPort];
-
-    [super viewWillDisappear:animated];
-}
-
-#pragma mark - IBAction
-
-- (IBAction)connectToServer:(id)sender
-{
-    [_activityIndicator startAnimating];
-    [self performSelector:@selector(connectToPlexMediaServer) withObject:nil afterDelay:0.1];
-}
-
-- (void)connectToPlexMediaServer
-{
-    NSString *server = [NSString stringWithFormat:@"%@", self.serverAddressField.text];
-    NSString *port = [NSString stringWithFormat:@"%@", self.portField.text];
-
-    if ([port isEqualToString:@""]) {
-        self.portField.text = kPlexMediaServerPortDefault;
-        port = kPlexMediaServerPortDefault;
-    }
-
-    if ([self isValidPort:port] && [self isValidAddress:server]) {
-        if ([self isValidURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@:%@", server, port]]]) {
-            VLCLocalPlexFolderListViewController *targetViewController = [[VLCLocalPlexFolderListViewController alloc] initWithPlexServer:server serverAddress:server portNumber:[NSString stringWithFormat:@":%@", port] atPath:@"" authentification:@""];
-            [[self navigationController] pushViewController:targetViewController animated:YES];
-        } else {
-            VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:nil
-                                                              message:NSLocalizedString(@"HTTP_UPLOAD_SERVER_OFF", nil)
-                                                             delegate:self
-                                                    cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
-                                                    otherButtonTitles:nil];
-            [alert show];
-        }
-    } else {
-        VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:nil
-                                                          message:NSLocalizedString(@"INVALID_IP_PORT", nil)
-                                                         delegate:self
-                                                cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
-                                                otherButtonTitles:nil];
-        [alert show];
-
-        if (![self isValidPort:port])
-            self.portField.text = kPlexMediaServerPortDefault;
-    }
-    [_activityIndicator stopAnimating];
-}
-
-- (IBAction)savePlexServer:(id)sender
-{
-    NSString *server = [NSString stringWithFormat:@"%@", self.serverAddressField.text];
-    NSString *port = [NSString stringWithFormat:@"%@", self.portField.text];
-
-    if ([self isValidPort:port] && [self isValidAddress:server]) {
-        [_bookmarkServer addObject:self.serverAddressField.text];
-        [_bookmarkPort addObject:self.portField.text];
-        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-        [defaults setObject:[NSArray arrayWithArray:_bookmarkServer] forKey:kVLCPLEXServer];
-        [defaults setObject:[NSArray arrayWithArray:_bookmarkPort] forKey:kVLCPLEXPort];
-        [defaults synchronize];
-        [self.serverPlexBookmark reloadData];
-    } else {
-        VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:nil
-                                                          message:NSLocalizedString(@"INVALID_IP_PORT", nil)
-                                                         delegate:self
-                                                cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
-                                                otherButtonTitles:nil];
-        [alert show];
-    }
-}
-
-#pragma mark - text view delegate
-
-- (BOOL)textFieldShouldReturn:(UITextField *)textField
-{
-    if ([self.serverAddressField isFirstResponder]) {
-        [self.serverAddressField resignFirstResponder];
-        [self.portField becomeFirstResponder];
-    } else if ([self.portField isFirstResponder]) {
-        [self.portField resignFirstResponder];
-    }
-    return NO;
-}
-
-#pragma mark - table view data source
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
-{
-    return 1;
-}
-
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-{
-    return _bookmarkServer.count;
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    static NSString *CellIdentifier = @"PLEXbookmarkCell";
-
-    UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
-    if (cell == nil) {
-        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
-        cell.textLabel.textColor = [UIColor whiteColor];
-        cell.detailTextLabel.textColor = [UIColor VLCLightTextColor];
-    }
-
-    NSInteger row = indexPath.row;
-    cell.textLabel.text = _bookmarkServer[row];
-    cell.detailTextLabel.text = _bookmarkPort[row];
-
-    return cell;
-}
-
-#pragma mark - table view delegate
-
-- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    cell.backgroundColor = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor VLCDarkBackgroundColor];
-}
-
-- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    return YES;
-}
-
-- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    if (editingStyle == UITableViewCellEditingStyleDelete) {
-        [_bookmarkServer removeObjectAtIndex:indexPath.row];
-        [_bookmarkPort removeObjectAtIndex:indexPath.row];
-        [tableView reloadData];
-        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-        [defaults setObject:[NSArray arrayWithArray:_bookmarkServer] forKey:kVLCPLEXServer];
-        [defaults setObject:[NSArray arrayWithArray:_bookmarkPort] forKey:kVLCPLEXPort];
-        [defaults synchronize];
-    }
-}
-
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    [self.serverAddressField setText:_bookmarkServer[indexPath.row]];
-    [self.portField setText:_bookmarkPort[indexPath.row]];
-
-    [self.serverPlexBookmark deselectRowAtIndexPath:indexPath animated:NO];
-}
-
-#pragma mark - isValid
-
-- (BOOL)isValidPort:(NSString *)port
-{
-    NSString *portRegex = @"^([0-9]{2,5})$";
-    NSPredicate *portTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", portRegex];
-    return [portTest evaluateWithObject:port];
-}
-
-- (BOOL)isValidAddress:(NSString *)address
-{
-    NSString *addressRegex = @"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
-    NSPredicate *addressTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", addressRegex];
-    if ([addressTest evaluateWithObject:address] || [[address pathExtension] isEqualToString:@"local"])
-        return YES;
-    else
-        return NO;
-}
-
-- (BOOL)isValidURL:(NSURL*)url
-{
-    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:5.0];
-    //[request setHTTPMethod:@"HEAD"];
-    NSHTTPURLResponse *response = nil;
-    NSError *error = nil;
-    NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
-    NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-    if (([response statusCode] == 200) || ([responseString rangeOfString:@"Unauthorized"].location != NSNotFound))
-        return YES;
-    else
-        return NO;
-}
-
-@end

+ 2 - 2
Sources/VLCPlexParser.m

@@ -67,13 +67,13 @@
                 data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
                 if ([response statusCode] != 200) {
                     VLCAlertView *alertView = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"PLEX_ERROR_ACCOUNT", nil) message:NSLocalizedString(@"PLEX_CHECK_ACCOUNT", nil) cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) otherButtonTitles:nil];
-                    [alertView show];
+                    [alertView performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:NO];
                 }
                 [_containerInfo removeAllObjects];
                 [_dicoInfo removeAllObjects];
             } else {
                 VLCAlertView *alertView = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"UNAUTHORIZED", nil) message:NSLocalizedString(@"PLEX_CHECK_ACCOUNT", nil) cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) otherButtonTitles:nil];
-                [alertView show];
+                [alertView performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:NO];
             }
         } else
             APLog(@"PlexParser url Errors : %ld", (long)[response statusCode]);

+ 39 - 25
Sources/VLCServerListViewController.m

@@ -18,7 +18,6 @@
 #import "VLCNetworkListCell.h"
 
 #import "VLCLocalPlexFolderListViewController.h"
-#import "VLCPlexConnectServerViewController.h"
 
 #import "VLCFTPServerListViewController.h"
 #import "VLCUPnPServerListViewController.h"
@@ -34,7 +33,7 @@
 
 #define kPlexServiceType @"_plexmediasvr._tcp."
 
-@interface VLCServerListViewController () <UITableViewDataSource, UITableViewDelegate, NSNetServiceBrowserDelegate, VLCNetworkLoginViewController, NSNetServiceDelegate, VLCMediaListDelegate, UPnPDBObserver>
+@interface VLCServerListViewController () <UITableViewDataSource, UITableViewDelegate, NSNetServiceBrowserDelegate, VLCNetworkLoginViewControllerDelegate, NSNetServiceDelegate, VLCMediaListDelegate, UPnPDBObserver>
 {
     UIBarButtonItem *_backToMenuButton;
     NSArray *_sectionHeaderTexts;
@@ -246,7 +245,7 @@
     UPnPManager *managerInstance = [UPnPManager GetInstance];
     [[managerInstance SSDP] searchSSDP];
     [[managerInstance SSDP] searchForMediaServer];
-    [[managerInstance SSDP] SSDPDBUpdate];
+    [[managerInstance SSDP] performSelectorInBackground:@selector(SSDPDBUpdate) withObject:nil];
 }
 
 - (void)_stopUPNPDiscovery
@@ -409,6 +408,7 @@
         {
             VLCNetworkLoginViewController *loginViewController = [[VLCNetworkLoginViewController alloc] initWithNibName:@"VLCNetworkLoginViewController" bundle:nil];
             loginViewController.delegate = self;
+            loginViewController.serverProtocol = VLCServerProtocolUndefined;
 
             UINavigationController *navCon = [[VLCNavigationController alloc] initWithRootViewController:loginViewController];
             navCon.navigationBarHidden = NO;
@@ -439,22 +439,11 @@
 
         case 2:
         {
-            NSInteger totalRow = [tableView numberOfRowsInSection:section];
-            if (row == (totalRow - 1)) {
-                VLCPlexConnectServerViewController *_connectPlexServer;
-                _connectPlexServer = [[VLCPlexConnectServerViewController alloc] initWithNibName:@"VLCPlexConnectServerViewController" bundle:nil];
-
-                UINavigationController *navCon = [[VLCNavigationController alloc] initWithRootViewController:_connectPlexServer];
-                navCon.navigationBarHidden = NO;
-
-                [self.navigationController pushViewController:_connectPlexServer animated:YES];
-            } else {
-                NSString *name = [_PlexServicesInfo[row] objectForKey:@"name"];
-                NSString *hostName = [_PlexServicesInfo[row] objectForKey:@"hostName"];
-                NSString *portNum = [_PlexServicesInfo[row] objectForKey:@"port"];
-                VLCLocalPlexFolderListViewController *targetViewController = [[VLCLocalPlexFolderListViewController alloc] initWithPlexServer:name serverAddress:hostName portNumber:portNum atPath:@"" authentification:@""];
-                [[self navigationController] pushViewController:targetViewController animated:YES];
-            }
+            NSString *name = [_PlexServicesInfo[row] objectForKey:@"name"];
+            NSString *hostName = [_PlexServicesInfo[row] objectForKey:@"hostName"];
+            NSString *portNum = [_PlexServicesInfo[row] objectForKey:@"port"];
+            VLCLocalPlexFolderListViewController *targetViewController = [[VLCLocalPlexFolderListViewController alloc] initWithPlexServer:name serverAddress:hostName portNumber:portNum atPath:@"" authentification:@""];
+            [[self navigationController] pushViewController:targetViewController animated:YES];
             break;
         }
 
@@ -462,6 +451,7 @@
         {
             VLCNetworkLoginViewController *loginViewController = [[VLCNetworkLoginViewController alloc] initWithNibName:@"VLCNetworkLoginViewController" bundle:nil];
             loginViewController.delegate = self;
+            loginViewController.serverProtocol = VLCServerProtocolFTP;
 
             UINavigationController *navCon = [[VLCNavigationController alloc] initWithRootViewController:loginViewController];
             navCon.navigationBarHidden = NO;
@@ -551,15 +541,39 @@
 
 #pragma mark - login panel protocol
 
-- (void)loginToURL:(NSURL *)url confirmedWithUsername:(NSString *)username andPassword:(NSString *)password
+- (void)loginToServer:(NSString *)server
+                 port:(NSString *)port
+             protocol:(VLCServerProtocol)protocol
+confirmedWithUsername:(NSString *)username
+          andPassword:(NSString *)password
 {
-    if ([url.scheme isEqualToString:@"ftp"]) {
-        if (url.host.length > 0) {
-            VLCFTPServerListViewController *targetViewController = [[VLCFTPServerListViewController alloc] initWithFTPServer:url.host userName:username andPassword:password atPath:@"/"];
+    switch (protocol) {
+        case VLCServerProtocolFTP:
+        {
+            VLCFTPServerListViewController *targetViewController = [[VLCFTPServerListViewController alloc]
+                                                                    initWithFTPServer:[NSString stringWithFormat:@"ftp://%@", server]
+                                                                    userName:username
+                                                                    andPassword:password atPath:@"/"];
             [self.navigationController pushViewController:targetViewController animated:YES];
+            break;
+        }
+        case VLCServerProtocolPLEX:
+        {
+            if (port == nil || port.length == 0)
+                port = @"32400";
+            VLCLocalPlexFolderListViewController *targetViewController = [[VLCLocalPlexFolderListViewController alloc]
+                                                                          initWithPlexServer:server
+                                                                          serverAddress:server
+                                                                          portNumber:[NSString stringWithFormat:@":%@", port] atPath:@""
+                                                                          authentification:@""];
+            [[self navigationController] pushViewController:targetViewController animated:YES];
+            break;
         }
-    } else
-        APLog(@"Unsupported URL Scheme requested %@", url.scheme);
+
+        default:
+            APLog(@"Unsupported URL Scheme requested %lu", protocol);
+            break;
+    }
 }
 
 #pragma mark - custom table view appearance

+ 0 - 10
VLC for iOS.xcodeproj/project.pbxproj

@@ -13,8 +13,6 @@
 		265D511D1922746C00E38383 /* VLCPlexParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 265D511B1922746C00E38383 /* VLCPlexParser.m */; };
 		26D4AF8D1A78379000D5EC65 /* VLCSharedLibraryListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 26D4AF8A1A78379000D5EC65 /* VLCSharedLibraryListViewController.m */; };
 		26D4AF8E1A78379000D5EC65 /* VLCSharedLibraryParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 26D4AF8C1A78379000D5EC65 /* VLCSharedLibraryParser.m */; };
-		26E3A6FE1AAB76A100B32450 /* VLCPlexConnectServerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 26E3A6FD1AAB76A100B32450 /* VLCPlexConnectServerViewController.m */; };
-		26E3A7021AAB76D300B32450 /* VLCPlexConnectServerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 26E3A7001AAB76D300B32450 /* VLCPlexConnectServerViewController.xib */; };
 		26F1BFD01A770408001DF30C /* libMediaVLC.xml in Resources */ = {isa = PBXBuildFile; fileRef = 26F1BFCF1A770408001DF30C /* libMediaVLC.xml */; };
 		29125E5617492219003F03E5 /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = 29125E5417492219003F03E5 /* index.html */; };
 		2915540117490A1E00B86CAD /* DDData.m in Sources */ = {isa = PBXBuildFile; fileRef = 291553EB17490A1E00B86CAD /* DDData.m */; };
@@ -297,9 +295,6 @@
 		26D4AF8A1A78379000D5EC65 /* VLCSharedLibraryListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCSharedLibraryListViewController.m; path = Sources/VLCSharedLibraryListViewController.m; sourceTree = SOURCE_ROOT; };
 		26D4AF8B1A78379000D5EC65 /* VLCSharedLibraryParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCSharedLibraryParser.h; path = Sources/VLCSharedLibraryParser.h; sourceTree = SOURCE_ROOT; };
 		26D4AF8C1A78379000D5EC65 /* VLCSharedLibraryParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCSharedLibraryParser.m; path = Sources/VLCSharedLibraryParser.m; sourceTree = SOURCE_ROOT; };
-		26E3A6FC1AAB76A100B32450 /* VLCPlexConnectServerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCPlexConnectServerViewController.h; path = Sources/VLCPlexConnectServerViewController.h; sourceTree = SOURCE_ROOT; };
-		26E3A6FD1AAB76A100B32450 /* VLCPlexConnectServerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCPlexConnectServerViewController.m; path = Sources/VLCPlexConnectServerViewController.m; sourceTree = SOURCE_ROOT; };
-		26E3A7001AAB76D300B32450 /* VLCPlexConnectServerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = VLCPlexConnectServerViewController.xib; path = Resources/VLCPlexConnectServerViewController.xib; sourceTree = SOURCE_ROOT; };
 		26F1BFCF1A770408001DF30C /* libMediaVLC.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = libMediaVLC.xml; sourceTree = "<group>"; };
 		29125E5417492219003F03E5 /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = index.html; sourceTree = "<group>"; };
 		291553EA17490A1E00B86CAD /* DDData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDData.h; sourceTree = "<group>"; };
@@ -1216,7 +1211,6 @@
 				7DBBF18F183AB4300009A339 /* VLCNetworkListCell~iphone.xib */,
 				9B9231C3185A703700F89498 /* VLCNetworkLoginViewController.xib */,
 				7D89787C185DF794009BAB5D /* VLCOpenNetworkStreamViewController.xib */,
-				26E3A7001AAB76D300B32450 /* VLCPlexConnectServerViewController.xib */,
 			);
 			name = "Download & Network";
 			sourceTree = "<group>";
@@ -1467,8 +1461,6 @@
 				265D51191922746C00E38383 /* VLCLocalPlexFolderListViewController.m */,
 				262C71571A98FA9200F7ED34 /* VLCPlexMediaInformationViewController.h */,
 				262C71581A98FA9200F7ED34 /* VLCPlexMediaInformationViewController.m */,
-				26E3A6FC1AAB76A100B32450 /* VLCPlexConnectServerViewController.h */,
-				26E3A6FD1AAB76A100B32450 /* VLCPlexConnectServerViewController.m */,
 			);
 			name = PLEX;
 			sourceTree = "<group>";
@@ -1804,7 +1796,6 @@
 				7D9870691A3E03D5009CF27D /* papasscode_marker@2x.png in Resources */,
 				7D5DD5C717590ABF001421E3 /* About Contents.html in Resources */,
 				7DBBF19B183AB4300009A339 /* VLCCloudStorageTableViewCell~iphone.xib in Resources */,
-				26E3A7021AAB76D300B32450 /* VLCPlexConnectServerViewController.xib in Resources */,
 				7DBBF19F183AB4300009A339 /* VLCEmptyLibraryView~iphone.xib in Resources */,
 				7DBC85641A50B8860098D388 /* LiveAuthDialog_iPhone.xib in Resources */,
 				7D92897B1877467E009108FD /* VLCFirstStepsFourthPageViewController~iphone.xib in Resources */,
@@ -1993,7 +1984,6 @@
 				7D3784CC183A99BA009EE944 /* PAPasscodeViewController.m in Sources */,
 				7D3784E9183A9A15009EE944 /* main.m in Sources */,
 				7D30F3C2183AB24C00FFC021 /* VLCHTTPConnection.m in Sources */,
-				26E3A6FE1AAB76A100B32450 /* VLCPlexConnectServerViewController.m in Sources */,
 				7D30F3C3183AB24C00FFC021 /* VLCHTTPFileDownloader.m in Sources */,
 				41273A3C1A955C4100A2EF77 /* VLCMigrationViewController.m in Sources */,
 				7D30F3C4183AB24C00FFC021 /* VLCHTTPUploaderController.m in Sources */,