Revert "Partially revert "Android: Clean up hardcoded platform names""

This reverts commit 98bdf3b1ceae94a35e3f47158966967d1c947d99.
This commit is contained in:
JosJuice 2022-06-26 09:24:19 +02:00
parent 2b36587af7
commit 1d772176a2
3 changed files with 8 additions and 9 deletions

View File

@ -87,7 +87,7 @@ public class SyncChannelJobService extends JobService
}
else
{
subscriptions = TvUtil.createUniversalSubscriptions();
subscriptions = TvUtil.createUniversalSubscriptions(context);
for (HomeScreenChannel subscription : subscriptions)
{
long channelId = createChannel(subscription);

View File

@ -98,7 +98,8 @@ public class SyncProgramsJobService extends JobService
Channel channel = TvUtil.getChannelById(context, channelId);
for (Platform platform : Platform.values())
{
if (channel != null && channel.getDisplayName().equals(platform.getIdString()))
if (channel != null &&
channel.getAppLinkIntentUri().equals(AppLinkHelper.buildBrowseUri(platform)))
{
getGamesByPlatform(platform);
syncPrograms(channelId);

View File

@ -254,21 +254,19 @@ public class TvUtil
/**
* Generates all subscriptions for homescreen channels.
*/
public static List<HomeScreenChannel> createUniversalSubscriptions()
public static List<HomeScreenChannel> createUniversalSubscriptions(Context context)
{
return new ArrayList<>(createPlatformSubscriptions());
return new ArrayList<>(createPlatformSubscriptions(context));
}
private static List<HomeScreenChannel> createPlatformSubscriptions()
private static List<HomeScreenChannel> createPlatformSubscriptions(Context context)
{
List<HomeScreenChannel> subs = new ArrayList<>();
for (Platform platform : Platform.values())
{
// TODO: Replace the getIdString calls with getHeaderName to get localized names.
// This would require SyncProgramsJobService to stop using the display name as a key
subs.add(new HomeScreenChannel(
platform.getIdString(),
platform.getIdString(),
context.getString(platform.getHeaderName()),
context.getString(platform.getHeaderName()),
AppLinkHelper.buildBrowseUri(platform)));
}
return subs;