Skip to content
This repository
Browse code

[atv2] - fix the annoyance to need to click twice to startup xbmc on …

…atv2 running ios5.x - we have a single click startup now woohoo :D
  • Loading branch information...
commit 92787f3b30530f5349759ebed9c2d292c37959c5 1 parent 85030ee
Memphiz authored February 17, 2013

Showing 1 changed file with 26 additions and 1 deletion. Show diff stats Hide diff stats

  1. 27  xbmc/osx/atv2/XBMCAppliance.m
27  xbmc/osx/atv2/XBMCAppliance.m
@@ -142,7 +142,32 @@ - (void) dealloc
142 142
 
143 143
 - (id) applianceCategories
144 144
 {
145  
-	return _applianceCategories;
  145
+  // on ios 5.x this gets called whenever a user hits the xbmc icon
  146
+  // in the frontrow mainmenu
  147
+  // we use this indication for faking the "select" key.
  148
+  // This leads to a one click start of XBMC instead of needing
  149
+  // to hit select on the only XBMC category called "XBMC" again ;)
  150
+  Class cls = NSClassFromString(@"ATVVersionInfo");
  151
+  if (cls != nil && [[cls currentOSVersion] rangeOfString:@"5."].location != NSNotFound)
  152
+  {
  153
+    // eventaction 5 == kBREventRemoteActionPlay from XBMCController.m
  154
+    // value == 1 meanse we pressed that key
  155
+    BREvent *eventKeySelect = [BREvent eventWithAction:5 value:1];
  156
+    // when we suppress the sound below
  157
+    // this will even suppress the initial click
  158
+    // sound because this is threaded
  159
+    // thats why we just play that first click sound
  160
+    // directly here before suppressing the sounds
  161
+    // and doing the fake click (which would result in an unwanted
  162
+    // second click sound without that hack)
  163
+    [BRSoundHandler playSound:1];// sound number 1 is the ios click sound
  164
+    // ios >= 5 only - so ignore the compiler warning on older SDKs
  165
+    // since we guarded that code with the currentOSVersion above
  166
+    [BRSoundHandler setSoundSuppressed:TRUE];
  167
+    [[BRApplication sharedApplication] postEvent:eventKeySelect];
  168
+  }
  169
+
  170
+  return _applianceCategories;
146 171
 }
147 172
 
148 173
 - (id) identifierForContentAlias:(id)contentAlias

0 notes on commit 92787f3

Please sign in to comment.
Something went wrong with that request. Please try again.