Commit 838a564c authored by Felix Paul Kühne's avatar Felix Paul Kühne

first steps: show correct IP within the wifi tutorial

parent 21304a0f
......@@ -26,11 +26,11 @@
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="sidebar.png" translatesAutoresizingMaskIntoConstraints="NO" id="CUV-JT-ySO">
<rect key="frame" x="51" y="346" width="79" height="125"/>
<rect key="frame" x="65" y="346" width="79" height="125"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="top" fixedFrame="YES" text="Open the sidebar to select Your Cloud provider and access Your media for downloading or streaming." textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="9" adjustsLetterSpacingToFitWidth="YES" preferredMaxLayoutWidth="284" translatesAutoresizingMaskIntoConstraints="NO" id="JUN-oP-TvH">
<rect key="frame" x="177" y="317" width="284" height="182"/>
<rect key="frame" x="191" y="317" width="284" height="182"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
......@@ -50,15 +50,15 @@
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="filledcloud.png" translatesAutoresizingMaskIntoConstraints="NO" id="wJh-b0-w2G">
<rect key="frame" x="84" y="426" width="85" height="45"/>
<rect key="frame" x="98" y="426" width="85" height="45"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="Drive.png" translatesAutoresizingMaskIntoConstraints="NO" id="gdI-Lw-xVt">
<rect key="frame" x="129" y="443" width="24" height="22"/>
<rect key="frame" x="143" y="443" width="24" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="Dropbox.png" translatesAutoresizingMaskIntoConstraints="NO" id="frX-b4-iG2">
<rect key="frame" x="101" y="442" width="24" height="22"/>
<rect key="frame" x="115" y="442" width="24" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
......
......@@ -8,6 +8,7 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCFirstStepsThirdPageViewController">
<connections>
<outlet property="connectDescriptionLabel" destination="nDQ-H5-FRU" id="h7L-Ld-8oU"/>
<outlet property="currentAddressLabel" destination="HJx-49-xU2" id="m1d-Zq-fHC"/>
<outlet property="uploadDescriptionLabel" destination="3RO-Ph-Lzw" id="sVL-yX-hud"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
......@@ -37,6 +38,14 @@
<rect key="frame" x="170" y="34" width="61" height="49"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="http://localhost" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HJx-49-xU2">
<rect key="frame" x="73" y="71" width="89" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.16078431369999999" green="0.16078431369999999" blue="0.16078431369999999" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" name="Chalkduster" family="Chalkduster" pointSize="9"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.12" alpha="1" colorSpace="calibratedWhite"/>
</view>
......
......@@ -8,6 +8,7 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCFirstStepsThirdPageViewController">
<connections>
<outlet property="connectDescriptionLabel" destination="nDQ-H5-FRU" id="h7L-Ld-8oU"/>
<outlet property="currentAddressLabel" destination="5oQ-Ob-zL6" id="hZv-7n-2bx"/>
<outlet property="uploadDescriptionLabel" destination="3RO-Ph-Lzw" id="sVL-yX-hud"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
......@@ -37,6 +38,14 @@
<rect key="frame" x="170" y="34" width="61" height="49"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="http://localhost" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5oQ-Ob-zL6">
<rect key="frame" x="73" y="71" width="89" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.16078431369999999" green="0.16078431369999999" blue="0.16078431369999999" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" name="Chalkduster" family="Chalkduster" pointSize="9"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.12" alpha="1" colorSpace="calibratedWhite"/>
</view>
......
......@@ -53,3 +53,9 @@
#define kSupportedAudioFileExtensions @"\\.(aac|aiff|aif|amr|aob|ape|axa|flac|it|m2a|m4a|mka|mlp|mod|mp1|mp2|mp3|mpa|mpc|oga|oma|opus|rmi|s3m|spx|tta|voc|vqf|wav|wma|wv|xa|xm)$"
#define kBlobHash @"521923d214b9ae628da7987cf621e94c4afdd726"
#if TARGET_IPHONE_SIMULATOR
#define WifiInterfaceName @"en1"
#else
#define WifiInterfaceName@"en0"
#endif
......@@ -16,6 +16,7 @@
@property (nonatomic, strong) IBOutlet UILabel *connectDescriptionLabel;
@property (nonatomic, strong) IBOutlet UILabel *uploadDescriptionLabel;
@property (nonatomic, strong) IBOutlet UILabel *currentAddressLabel;
@property (readonly) NSString *pageTitle;
@property (readonly) NSUInteger page;
......
......@@ -11,6 +11,8 @@
*****************************************************************************/
#import "VLCFirstStepsThirdPageViewController.h"
#import <ifaddrs.h>
#import <arpa/inet.h>
@interface VLCFirstStepsThirdPageViewController ()
......@@ -24,6 +26,25 @@
self.connectDescriptionLabel.text = [NSString stringWithFormat:NSLocalizedString(@"FIRST_STEPS_WIFI_CONNECT_DETAILS",@""), [[UIDevice currentDevice] model]];
self.uploadDescriptionLabel.text = NSLocalizedString(@"FIRST_STEPS_WIFI_UPLOAD_DETAILS", @"");
NSString *address = @"192.168.1.2"; // something generic
struct ifaddrs *interfaces = NULL;
struct ifaddrs *temp_addr = NULL;
int success = getifaddrs(&interfaces);
if (success == 0) {
temp_addr = interfaces;
while (temp_addr != NULL) {
if (temp_addr->ifa_addr->sa_family == AF_INET) {
if([@(temp_addr->ifa_name) isEqualToString:WifiInterfaceName])
address = @(inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr));
}
temp_addr = temp_addr->ifa_next;
}
}
freeifaddrs(interfaces);
self.currentAddressLabel.text = [NSString stringWithFormat:@"http://%@", address];
}
- (NSString *)pageTitle
......
......@@ -22,12 +22,6 @@
#import <ifaddrs.h>
#import <arpa/inet.h>
#if TARGET_IPHONE_SIMULATOR
NSString *const WifiInterfaceName = @"en1";
#else
NSString *const WifiInterfaceName = @"en0";
#endif
@implementation VLCHTTPUploaderController
- (id)init
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment