mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-15 21:21:45 +00:00
now pass stream configuration through the segue
This commit is contained in:
@@ -16,9 +16,8 @@
|
|||||||
#import "SWRevealViewController.h"
|
#import "SWRevealViewController.h"
|
||||||
|
|
||||||
@interface MainFrameViewController : UICollectionViewController <DiscoveryCallback, PairCallback, HostCallback, AppCallback, AppAssetCallback, NSURLConnectionDelegate, SWRevealViewControllerDelegate>
|
@interface MainFrameViewController : UICollectionViewController <DiscoveryCallback, PairCallback, HostCallback, AppCallback, AppAssetCallback, NSURLConnectionDelegate, SWRevealViewControllerDelegate>
|
||||||
|
|
||||||
@property (strong, nonatomic) IBOutlet UIButton *limelightLogoButton;
|
@property (strong, nonatomic) IBOutlet UIButton *limelightLogoButton;
|
||||||
@property (weak, nonatomic) IBOutlet UIBarButtonItem *computerNameButton;
|
@property (weak, nonatomic) IBOutlet UIBarButtonItem *computerNameButton;
|
||||||
|
|
||||||
+ (StreamConfiguration*) getStreamConfiguration;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#import "CryptoManager.h"
|
#import "CryptoManager.h"
|
||||||
#import "HttpManager.h"
|
#import "HttpManager.h"
|
||||||
#import "Connection.h"
|
#import "Connection.h"
|
||||||
#import "VideoDecoderRenderer.h"
|
|
||||||
#import "StreamManager.h"
|
#import "StreamManager.h"
|
||||||
#import "Utils.h"
|
#import "Utils.h"
|
||||||
#import "UIComputerView.h"
|
#import "UIComputerView.h"
|
||||||
@@ -21,6 +20,7 @@
|
|||||||
#import "WakeOnLanManager.h"
|
#import "WakeOnLanManager.h"
|
||||||
#import "AppListResponse.h"
|
#import "AppListResponse.h"
|
||||||
#import "ServerInfoResponse.h"
|
#import "ServerInfoResponse.h"
|
||||||
|
#import "StreamFrameViewController.h"
|
||||||
|
|
||||||
@implementation MainFrameViewController {
|
@implementation MainFrameViewController {
|
||||||
NSOperationQueue* _opQueue;
|
NSOperationQueue* _opQueue;
|
||||||
@@ -30,17 +30,13 @@
|
|||||||
NSString* _currentGame;
|
NSString* _currentGame;
|
||||||
DiscoveryManager* _discMan;
|
DiscoveryManager* _discMan;
|
||||||
AppAssetManager* _appManager;
|
AppAssetManager* _appManager;
|
||||||
|
StreamConfiguration* _streamConfig;
|
||||||
UIAlertView* _pairAlert;
|
UIAlertView* _pairAlert;
|
||||||
UIScrollView* hostScrollView;
|
UIScrollView* hostScrollView;
|
||||||
int currentPosition;
|
int currentPosition;
|
||||||
}
|
}
|
||||||
static NSMutableSet* hostList;
|
static NSMutableSet* hostList;
|
||||||
static NSArray* appList;
|
static NSArray* appList;
|
||||||
static StreamConfiguration* streamConfig;
|
|
||||||
|
|
||||||
+ (StreamConfiguration*) getStreamConfiguration {
|
|
||||||
return streamConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)showPIN:(NSString *)PIN {
|
- (void)showPIN:(NSString *)PIN {
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
@@ -219,11 +215,11 @@ static StreamConfiguration* streamConfig;
|
|||||||
|
|
||||||
- (void) appClicked:(App *)app {
|
- (void) appClicked:(App *)app {
|
||||||
NSLog(@"Clicked app: %@", app.appName);
|
NSLog(@"Clicked app: %@", app.appName);
|
||||||
streamConfig = [[StreamConfiguration alloc] init];
|
_streamConfig = [[StreamConfiguration alloc] init];
|
||||||
streamConfig.host = _selectedHost.address;
|
_streamConfig.host = _selectedHost.address;
|
||||||
streamConfig.hostAddr = [Utils resolveHost:_selectedHost.address];
|
_streamConfig.hostAddr = [Utils resolveHost:_selectedHost.address];
|
||||||
streamConfig.appID = app.appId;
|
_streamConfig.appID = app.appId;
|
||||||
if (streamConfig.hostAddr == 0) {
|
if (_streamConfig.hostAddr == 0) {
|
||||||
[self displayDnsFailedDialog];
|
[self displayDnsFailedDialog];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -231,10 +227,10 @@ static StreamConfiguration* streamConfig;
|
|||||||
DataManager* dataMan = [[DataManager alloc] init];
|
DataManager* dataMan = [[DataManager alloc] init];
|
||||||
Settings* streamSettings = [dataMan retrieveSettings];
|
Settings* streamSettings = [dataMan retrieveSettings];
|
||||||
|
|
||||||
streamConfig.frameRate = [streamSettings.framerate intValue];
|
_streamConfig.frameRate = [streamSettings.framerate intValue];
|
||||||
streamConfig.bitRate = [streamSettings.bitrate intValue];
|
_streamConfig.bitRate = [streamSettings.bitrate intValue];
|
||||||
streamConfig.height = [streamSettings.height intValue];
|
_streamConfig.height = [streamSettings.height intValue];
|
||||||
streamConfig.width = [streamSettings.width intValue];
|
_streamConfig.width = [streamSettings.width intValue];
|
||||||
|
|
||||||
|
|
||||||
if (currentPosition != FrontViewPositionLeft) {
|
if (currentPosition != FrontViewPositionLeft) {
|
||||||
@@ -292,14 +288,21 @@ static StreamConfiguration* streamConfig;
|
|||||||
currentPosition = position;
|
currentPosition = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||||
|
if ([segue.destinationViewController isKindOfClass:[StreamFrameViewController class]]) {
|
||||||
|
StreamFrameViewController* streamFrame = segue.destinationViewController;
|
||||||
|
streamFrame.streamConfig = _streamConfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)viewDidLoad
|
- (void)viewDidLoad
|
||||||
{
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
// Set the side bar button action. When it's tapped, it'll show up the sidebar.
|
// Set the side bar button action. When it's tapped, it'll show the sidebar.
|
||||||
[_limelightLogoButton addTarget:self.revealViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchDown];
|
[_limelightLogoButton addTarget:self.revealViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchDown];
|
||||||
|
|
||||||
// Set the host name button action. When it's tapped, it'll show up the host selection view.
|
// Set the host name button action. When it's tapped, it'll show the host selection view.
|
||||||
[_computerNameButton setTarget:self];
|
[_computerNameButton setTarget:self];
|
||||||
[_computerNameButton setAction:@selector(showHostSelectionView)];
|
[_computerNameButton setAction:@selector(showHostSelectionView)];
|
||||||
|
|
||||||
@@ -313,12 +316,12 @@ static StreamConfiguration* streamConfig;
|
|||||||
currentPosition = FrontViewPositionLeft;
|
currentPosition = FrontViewPositionLeft;
|
||||||
|
|
||||||
// Set up crypto
|
// Set up crypto
|
||||||
_opQueue = [[NSOperationQueue alloc] init];
|
|
||||||
[CryptoManager generateKeyPairUsingSSl];
|
[CryptoManager generateKeyPairUsingSSl];
|
||||||
_uniqueId = [CryptoManager getUniqueID];
|
_uniqueId = [CryptoManager getUniqueID];
|
||||||
_cert = [CryptoManager readCertFromFile];
|
_cert = [CryptoManager readCertFromFile];
|
||||||
|
|
||||||
_appManager = [[AppAssetManager alloc] initWithCallback:self];
|
_appManager = [[AppAssetManager alloc] initWithCallback:self];
|
||||||
|
_opQueue = [[NSOperationQueue alloc] init];
|
||||||
|
|
||||||
// Only initialize the host picker list once
|
// Only initialize the host picker list once
|
||||||
if (hostList == nil) {
|
if (hostList == nil) {
|
||||||
@@ -467,4 +470,5 @@ static StreamConfiguration* streamConfig;
|
|||||||
- (BOOL)shouldAutorotate {
|
- (BOOL)shouldAutorotate {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "Connection.h"
|
#import "Connection.h"
|
||||||
|
#import "StreamConfiguration.h"
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@interface StreamFrameViewController : UIViewController <ConnectionCallbacks>
|
@interface StreamFrameViewController : UIViewController <ConnectionCallbacks>
|
||||||
@property (strong, nonatomic) IBOutlet UILabel *stageLabel;
|
@property (strong, nonatomic) IBOutlet UILabel *stageLabel;
|
||||||
@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *spinner;
|
@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *spinner;
|
||||||
|
@property (nonatomic) StreamConfiguration* streamConfig;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
_controllerSupport = [[ControllerSupport alloc] init];
|
_controllerSupport = [[ControllerSupport alloc] init];
|
||||||
|
|
||||||
_streamMan = [[StreamManager alloc] initWithConfig:[MainFrameViewController getStreamConfiguration]
|
_streamMan = [[StreamManager alloc] initWithConfig:self.streamConfig
|
||||||
renderView:self.view
|
renderView:self.view
|
||||||
connectionCallbacks:self];
|
connectionCallbacks:self];
|
||||||
NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];
|
NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];
|
||||||
|
|||||||
Reference in New Issue
Block a user