forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This puts the History and Favorites playlists (up to five items each) in the Top Shelf menu. In order for this to be enabled you must build it yourself and change the app identifiers for the TV app and Top Shelf extension, and add both of them to an app group.
- Loading branch information
1 parent
0df031a
commit 7379d33
Showing
18 changed files
with
457 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// ContentProvider.h | ||
// RetroArchTopShelfExtension | ||
// | ||
// Created by Eric Warmenhoven on 2/17/24. | ||
// Copyright © 2024 RetroArch. All rights reserved. | ||
// | ||
|
||
#import <TVServices/TVServices.h> | ||
|
||
#define kRetroArchAppGroup @"group.com.libretro.dist.tvos.RetroArchAppGroup" | ||
|
||
@interface ContentProvider : TVTopShelfContentProvider | ||
|
||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// ContentProvider.m | ||
// RetroArchTopShelfExtension | ||
// | ||
// Created by Eric Warmenhoven on 2/17/24. | ||
// Copyright © 2024 RetroArch. All rights reserved. | ||
// | ||
|
||
#import "ContentProvider.h" | ||
|
||
@implementation ContentProvider | ||
|
||
- (void)loadTopShelfContentWithCompletionHandler:(void (^) (id<TVTopShelfContent> content))completionHandler | ||
{ | ||
NSUserDefaults *ud = [[NSUserDefaults alloc] initWithSuiteName:kRetroArchAppGroup]; | ||
|
||
NSDictionary *contentDict = [ud objectForKey:@"topshelf"]; | ||
|
||
NSMutableArray *collections = [NSMutableArray arrayWithCapacity:[contentDict count]]; | ||
for (NSString *key in [contentDict allKeys]) | ||
{ | ||
NSArray *contentArray = [contentDict objectForKey:key]; | ||
NSMutableArray *items = [NSMutableArray arrayWithCapacity:[contentArray count]]; | ||
|
||
for (NSDictionary *item in contentArray) | ||
{ | ||
TVTopShelfSectionedItem *tsitem = [[TVTopShelfSectionedItem alloc] initWithIdentifier:item[@"id"]]; | ||
tsitem.title = item[@"title"]; | ||
[tsitem setImageURL:[NSURL URLWithString:item[@"img"]] forTraits:(TVTopShelfItemImageTraitScreenScale1x | TVTopShelfItemImageTraitScreenScale2x)]; | ||
[tsitem setImageShape:TVTopShelfSectionedItemImageShapeSquare]; | ||
[tsitem setDisplayAction:[[TVTopShelfAction alloc] initWithURL:[NSURL URLWithString:item[@"play"]]]]; | ||
[items addObject:tsitem]; | ||
} | ||
|
||
TVTopShelfItemCollection<TVTopShelfSectionedItem *> *collection = [[TVTopShelfItemCollection alloc] initWithItems:items]; | ||
collection.title = key; | ||
[collections addObject:collection]; | ||
} | ||
TVTopShelfSectionedContent *content = [[TVTopShelfSectionedContent alloc] initWithSections:collections]; | ||
completionHandler(content); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.tv-top-shelf</string> | ||
<key>NSExtensionPrincipalClass</key> | ||
<string>ContentProvider</string> | ||
</dict> | ||
</dict> | ||
</plist> |
5 changes: 5 additions & 0 deletions
5
pkg/apple/RetroArchTopShelfExtension/RetroArchTopShelfExtension.entitlements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict/> | ||
</plist> |
Oops, something went wrong.