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/> <true/>
<key>UIApplicationSupportsIndirectInputEvents</key> <key>UIApplicationSupportsIndirectInputEvents</key>
<true/> <true/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>infuse</string>
<string>open-vidhub</string>
<string>vlc</string>
<string>outplayer</string>
</array>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>

View file

@ -52,6 +52,8 @@ class _ExploreAddonState extends State<ExploreAddon> {
return "explorer_page_${selectedType}_${selectedId}_$selectedGenre"; return "explorer_page_${selectedType}_${selectedId}_$selectedGenre";
} }
final titles = {};
InfiniteQuery<List<Meta>, int> buildQuery() { InfiniteQuery<List<Meta>, int> buildQuery() {
return InfiniteQuery( return InfiniteQuery(
key: queryKey, key: queryKey,
@ -146,9 +148,13 @@ class _ExploreAddonState extends State<ExploreAddon> {
continue; continue;
} }
if (value.extraRequired?.where((res) => res != "genre").isEmpty ==
true) {
titles[value.id] = value.name;
types.add(value.id); types.add(value.id);
} }
} }
}
categories = types.toList(); categories = types.toList();
} }
@ -192,9 +198,12 @@ class _ExploreAddonState extends State<ExploreAddon> {
child: ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
itemCount: items.length, itemCount: items.length,
itemBuilder: (context, index) => ListTile( itemBuilder: (context, index) {
return ListTile(
title: Text( title: Text(
items[index] titles.containsKey(items[index])
? titles[items[index]]
: items[index]
.replaceAll(".", " ") .replaceAll(".", " ")
.split(" ") .split(" ")
.map((item) => item.capitalize) .map((item) => item.capitalize)
@ -224,7 +233,8 @@ class _ExploreAddonState extends State<ExploreAddon> {
Navigator.pop(context); Navigator.pop(context);
}, },
), );
},
), ),
), ),
], ],

View file

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