more appletv tweaks (#351)

* redo now playing indicator

- instead of drawing an arrow overlay, add an offset green shadow

* do not show "Connection Terminated" on code 0

if an application quits successfully because it was asked to do so by
the user (errorCode = 0), then do not display an alert -- just go back
to the prior view.

* fix: add missing toggle for mutli-controller support
This commit is contained in:
Andrew Scagnelli
2019-02-14 00:03:09 -05:00
committed by Cameron Gutman
parent 335b5aef1f
commit b2c2f0837a
4 changed files with 35 additions and 11 deletions

View File

@@ -7,6 +7,7 @@
// //
#import "TemporarySettings.h" #import "TemporarySettings.h"
#import "OnScreenControls.h"
@implementation TemporarySettings @implementation TemporarySettings
@@ -35,7 +36,8 @@
self.playAudioOnPC = [[NSUserDefaults standardUserDefaults] boolForKey:@"audioOnPC"] || NO; self.playAudioOnPC = [[NSUserDefaults standardUserDefaults] boolForKey:@"audioOnPC"] || NO;
self.enableHdr = [[NSUserDefaults standardUserDefaults] boolForKey:@"enableHdr"] || NO; self.enableHdr = [[NSUserDefaults standardUserDefaults] boolForKey:@"enableHdr"] || NO;
self.optimizeGames = [[NSUserDefaults standardUserDefaults] boolForKey:@"optimizeGames"] || YES; self.optimizeGames = [[NSUserDefaults standardUserDefaults] boolForKey:@"optimizeGames"] || YES;
self.multiController = YES; self.multiController = [[NSUserDefaults standardUserDefaults] boolForKey:@"multipleControllers"] || YES;
NSInteger _screenSize = [[NSUserDefaults standardUserDefaults] integerForKey:@"streamResolution"]; NSInteger _screenSize = [[NSUserDefaults standardUserDefaults] integerForKey:@"streamResolution"];
switch (_screenSize) { switch (_screenSize) {
case 0: case 0:
@@ -52,6 +54,7 @@
self.width = [NSNumber numberWithInteger:1920]; self.width = [NSNumber numberWithInteger:1920];
break; break;
} }
self.onscreenControls = (NSInteger)OnScreenControlsLevelOff;
#else #else
self.bitrate = settings.bitrate; self.bitrate = settings.bitrate;
self.framerate = settings.framerate; self.framerate = settings.framerate;
@@ -62,8 +65,8 @@
self.enableHdr = settings.enableHdr; self.enableHdr = settings.enableHdr;
self.optimizeGames = settings.optimizeGames; self.optimizeGames = settings.optimizeGames;
self.multiController = settings.multiController; self.multiController = settings.multiController;
#endif
self.onscreenControls = settings.onscreenControls; self.onscreenControls = settings.onscreenControls;
#endif
self.uniqueId = settings.uniqueId; self.uniqueId = settings.uniqueId;
self.streamingRemotely = settings.streamingRemotely; self.streamingRemotely = settings.streamingRemotely;

View File

@@ -76,19 +76,24 @@ static UIImage* noImage;
self.frame = CGRectMake(0, 0, noImage.size.width, noImage.size.height); self.frame = CGRectMake(0, 0, noImage.size.width, noImage.size.height);
if ([_app.id isEqualToString:_app.host.currentGame]) { if ([_app.id isEqualToString:_app.host.currentGame]) {
#if TARGET_OS_TV
_appButton.layer.masksToBounds = NO;
_appButton.layer.shadowColor = [UIColor greenColor].CGColor;
_appButton.layer.shadowOffset = CGSizeMake(5,8);
_appButton.layer.shadowOpacity = 0.7;
#else
// Only create the app overlay if needed // Only create the app overlay if needed
_appOverlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Play"]]; _appOverlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Play"]];
#if !TARGET_OS_TV
_appOverlay.layer.shadowColor = [UIColor blackColor].CGColor; _appOverlay.layer.shadowColor = [UIColor blackColor].CGColor;
_appOverlay.layer.shadowOffset = CGSizeMake(0, 0); _appOverlay.layer.shadowOffset = CGSizeMake(0, 0);
_appOverlay.layer.shadowOpacity = 1; _appOverlay.layer.shadowOpacity = 1;
_appOverlay.layer.shadowRadius = 2.0; _appOverlay.layer.shadowRadius = 2.0;
#endif
[self addSubview:_appOverlay]; [self addSubview:_appOverlay];
_appOverlay.frame = CGRectMake(0, 0, noImage.size.width / 2.f, noImage.size.height / 4.f); _appOverlay.frame = CGRectMake(0, 0, noImage.size.width / 2.f, noImage.size.height / 4.f);
[_appOverlay setCenter:CGPointMake(self.frame.size.width/2, self.frame.size.height/6)]; [_appOverlay setCenter:CGPointMake(self.frame.size.width/2, self.frame.size.height/6)];
#endif
} }
BOOL noAppImage = false; BOOL noAppImage = false;
@@ -120,10 +125,11 @@ static UIImage* noImage;
#else #else
_appButton.frame = CGRectMake(0, 0, appImage.size.width / 2, appImage.size.height / 2); _appButton.frame = CGRectMake(0, 0, appImage.size.width / 2, appImage.size.height / 2);
self.frame = CGRectMake(0, 0, appImage.size.width / 2, appImage.size.height / 2); self.frame = CGRectMake(0, 0, appImage.size.width / 2, appImage.size.height / 2);
#endif
_appOverlay.frame = CGRectMake(0, 0, self.frame.size.width / 2.f, self.frame.size.height / 4.f); _appOverlay.frame = CGRectMake(0, 0, self.frame.size.width / 2.f, self.frame.size.height / 4.f);
_appOverlay.layer.shadowRadius = 4.0; _appOverlay.layer.shadowRadius = 4.0;
[_appOverlay setCenter:CGPointMake(self.frame.size.width/2, self.frame.size.height/6)]; [_appOverlay setCenter:CGPointMake(self.frame.size.width/2, self.frame.size.height/6)];
#endif
[_appButton setBackgroundImage:appImage forState:UIControlStateNormal]; [_appButton setBackgroundImage:appImage forState:UIControlStateNormal];
[self setNeedsDisplay]; [self setNeedsDisplay];
} else { } else {
@@ -176,7 +182,9 @@ static UIImage* noImage;
// Update the app image if neccessary // Update the app image if neccessary
if ((_appOverlay != nil && ![_app.id isEqualToString:_app.host.currentGame]) || if ((_appOverlay != nil && ![_app.id isEqualToString:_app.host.currentGame]) ||
(_appOverlay == nil && [_app.id isEqualToString:_app.host.currentGame])) { (_appOverlay == nil && [_app.id isEqualToString:_app.host.currentGame])) {
#if !TARGET_OS_TV
[self updateAppImage]; [self updateAppImage];
#endif
} }
// Stop updating when we detach from our parent view // Stop updating when we detach from our parent view

View File

@@ -191,12 +191,15 @@
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
// Allow the display to go to sleep now // Allow the display to go to sleep now
[UIApplication sharedApplication].idleTimerDisabled = NO; [UIApplication sharedApplication].idleTimerDisabled = NO;
if (errorCode == 0) {
UIAlertController* conTermAlert = [UIAlertController alertControllerWithTitle:@"Connection Terminated" message:@"The connection was terminated" preferredStyle:UIAlertControllerStyleAlert];
[conTermAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
[self returnToMainFrame]; [self returnToMainFrame];
}]]; } else {
[self presentViewController:conTermAlert animated:YES completion:nil]; UIAlertController* conTermAlert = [UIAlertController alertControllerWithTitle:@"Connection Terminated" message:@"The connection was terminated" preferredStyle:UIAlertControllerStyleAlert];
[conTermAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
[self returnToMainFrame];
}]];
[self presentViewController:conTermAlert animated:YES completion:nil];
}
}); });
[_streamMan stopStream]; [_streamMan stopStream];

View File

@@ -56,6 +56,16 @@
<key>DefaultValue</key> <key>DefaultValue</key>
<false/> <false/>
</dict> </dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Enable multi-controller support</string>
<key>Key</key>
<string>multipleControllers</string>
<key>DefaultValue</key>
<true/>
</dict>
<dict> <dict>
<key>Type</key> <key>Type</key>
<string>PSGroupSpecifier</string> <string>PSGroupSpecifier</string>