fix: titles in the explore page and permission for the iOS and offline ratings url persistent
Some checks are pending
Build and Deploy / build_windows (push) Waiting to run
Build and Deploy / build_android (push) Waiting to run
Build and Deploy / build_ipa (push) Waiting to run
Build and Deploy / build_linux (push) Waiting to run
Build and Deploy / build_macos (push) Waiting to run

This commit is contained in:
omkar 2025-01-31 21:14:47 +05:30
parent 2a55da488c
commit 0d7573ee22
3 changed files with 65 additions and 30 deletions

View file

@ -45,6 +45,13 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>infuse</string>
<string>open-vidhub</string>
<string>vlc</string>
<string>outplayer</string>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>

View file

@ -52,6 +52,8 @@ class _ExploreAddonState extends State<ExploreAddon> {
return "explorer_page_${selectedType}_${selectedId}_$selectedGenre";
}
final titles = {};
InfiniteQuery<List<Meta>, int> buildQuery() {
return InfiniteQuery(
key: queryKey,
@ -146,7 +148,11 @@ class _ExploreAddonState extends State<ExploreAddon> {
continue;
}
types.add(value.id);
if (value.extraRequired?.where((res) => res != "genre").isEmpty ==
true) {
titles[value.id] = value.name;
types.add(value.id);
}
}
}
@ -192,39 +198,43 @@ class _ExploreAddonState extends State<ExploreAddon> {
child: ListView.builder(
shrinkWrap: true,
itemCount: items.length,
itemBuilder: (context, index) => ListTile(
title: Text(
items[index]
.replaceAll(".", " ")
.split(" ")
.map((item) => item.capitalize)
.join(" "),
),
selected: items[index] == current,
trailing: items[index] == current
? Icon(
Icons.check_circle,
color: Theme.of(context).highlightColor,
)
: null,
onTap: () {
onSelect(items[index]);
itemBuilder: (context, index) {
return ListTile(
title: Text(
titles.containsKey(items[index])
? titles[items[index]]
: items[index]
.replaceAll(".", " ")
.split(" ")
.map((item) => item.capitalize)
.join(" "),
),
selected: items[index] == current,
trailing: items[index] == current
? Icon(
Icons.check_circle,
color: Theme.of(context).highlightColor,
)
: null,
onTap: () {
onSelect(items[index]);
if (resetTypes.contains('categories')) {
selectedId = null;
}
if (resetTypes.contains('categories')) {
selectedId = null;
}
if (resetTypes.contains('genres')) {
selectedGenre = null;
}
setFirstThing();
setOptionValues();
if (resetTypes.contains('genres')) {
selectedGenre = null;
}
setFirstThing();
setOptionValues();
setQuery();
setQuery();
Navigator.pop(context);
},
),
Navigator.pop(context);
},
);
},
),
),
],

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../models/rating_model.dart' as rating_model;
import '../services/ratings_service.dart';
@ -20,6 +21,19 @@ class _OfflineRatingsState extends State<OfflineRatings> {
bool _isLoading = false;
bool _isDownloadComplete = false;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((pref) {
final result = pref.getString("offline_rating_preference_url");
if (result != null) {
_urlController.text = result;
}
});
}
Future<void> _downloadRatings(String url) async {
if (url.isEmpty) {
setState(() {
@ -29,6 +43,10 @@ class _OfflineRatingsState extends State<OfflineRatings> {
return;
}
final pref = await SharedPreferences.getInstance();
pref.setString("offline_rating_preference_url", url);
setState(() {
_isLoading = true;
_error = null;