Commit 2639057f authored by Felix Paul Kühne's avatar Felix Paul Kühne

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

parent d2230f68
<?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">
......
<?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>
B"CHOOSE_AUDIO_TRACK"="Choose Audio Track";
......
......@@ -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"
......
......@@ -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
......@@ -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;
}