瀏覽代碼

fix empty local HTTP share view
don't convert port number to string and back to number

Tobias Conradi 9 年之前
父節點
當前提交
fb5d89b577

+ 0 - 1
Sources/VLCLocalNetworkService.h

@@ -49,7 +49,6 @@ typedef void (^VLCLocalNetworkServiceActionBlock)(void);
 
 @end
 @interface VLCLocalNetworkServiceHTTP : VLCLocalNetworkServiceNetService
-@property (nonatomic, strong) NSDictionary *seviceDescription;
 
 @end
 

+ 6 - 5
Sources/VLCLocalNetworkService.m

@@ -118,13 +118,14 @@
 }
 - (UIViewController *)detailViewController {
 
-    NSDictionary *serviceDescription = self.seviceDescription;
-    if (serviceDescription == nil) {
+    NSNetService *service = self.netService;
+    if (service.hostName == nil || service.port == 0) {
         return nil;
     }
-    NSString *name = serviceDescription[@"name"];
-    NSString *hostName = serviceDescription[@"hostName"];
-    NSString *portNum = serviceDescription[@"port"];
+
+    NSString *name = service.name;
+    NSString *hostName = service.hostName;
+    NSUInteger portNum = service.port;
     VLCSharedLibraryListViewController *targetViewController = [[VLCSharedLibraryListViewController alloc]
                                                                 initWithHttpServer:name
                                                                 serverAddress:hostName

+ 1 - 1
Sources/VLCSharedLibraryListViewController.h

@@ -16,6 +16,6 @@
 
 @property (nonatomic, strong) UITableView *tableView;
 
-- (id)initWithHttpServer:(NSString *)serverName serverAddress:(NSString *)serverAddress portNumber:(NSString *)portNumber;
+- (id)initWithHttpServer:(NSString *)serverName serverAddress:(NSString *)serverAddress portNumber:(NSUInteger)portNumber;
 
 @end

+ 4 - 4
Sources/VLCSharedLibraryListViewController.m

@@ -27,7 +27,7 @@
 
     NSString *_httpServerName;
     NSString *_httpServerAddress;
-    NSString *_httpServerPort;
+    NSUInteger _httpServerPort;
     VLCSharedLibraryParser *_httpParser;
 
     NSMutableArray *_searchData;
@@ -63,7 +63,7 @@
     self.view = _tableView;
 }
 
-- (id)initWithHttpServer:(NSString *)serverName serverAddress:(NSString *)serverAddress portNumber:(NSString *)portNumber
+- (id)initWithHttpServer:(NSString *)serverName serverAddress:(NSString *)serverAddress portNumber:(NSUInteger)portNumber
 {
     self = [super init];
     if (self) {
@@ -84,7 +84,7 @@
 {
     [super viewWillAppear:animated];
 
-    [_httpParser fetchDataFromServer:_httpServerAddress port:_httpServerPort.longLongValue];
+    [_httpParser fetchDataFromServer:_httpServerAddress port:_httpServerPort];
 }
 
 - (void)viewDidLoad
@@ -387,7 +387,7 @@
     @synchronized(self) {
         _serverDataArray = nil;
     }
-    [_httpParser fetchDataFromServer:_httpServerAddress port:_httpServerPort.longLongValue];
+    [_httpParser fetchDataFromServer:_httpServerAddress port:_httpServerPort];
 }
 
 #pragma mark - Gesture Action