mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 09:07:47 +01:00
fix: Get changelogs for alternative sources (#1766)
This commit is contained in:
parent
d53f8cf130
commit
c7298424e5
2 changed files with 15 additions and 6 deletions
|
@ -69,7 +69,8 @@ class ManagerAPI {
|
|||
}
|
||||
|
||||
// Migrate to new API URL if not done yet as the old one is sunset.
|
||||
final bool hasMigratedToNewApi = _prefs.getBool('migratedToNewApiUrl') ?? false;
|
||||
final bool hasMigratedToNewApi =
|
||||
_prefs.getBool('migratedToNewApiUrl') ?? false;
|
||||
if (!hasMigratedToNewApi) {
|
||||
final String apiUrl = getApiUrl().toLowerCase();
|
||||
if (apiUrl.contains('releases.revanced.app')) {
|
||||
|
@ -78,11 +79,14 @@ class ManagerAPI {
|
|||
}
|
||||
}
|
||||
|
||||
final bool hasMigratedToAlternativeSource = _prefs.getBool('migratedToAlternativeSource') ?? false;
|
||||
final bool hasMigratedToAlternativeSource =
|
||||
_prefs.getBool('migratedToAlternativeSource') ?? false;
|
||||
if (!hasMigratedToAlternativeSource) {
|
||||
final String patchesRepo = getPatchesRepo();
|
||||
final String integrationsRepo = getIntegrationsRepo();
|
||||
final bool usingAlternativeSources = patchesRepo.toLowerCase() != defaultPatchesRepo || integrationsRepo.toLowerCase() != defaultIntegrationsRepo;
|
||||
final bool usingAlternativeSources =
|
||||
patchesRepo.toLowerCase() != defaultPatchesRepo ||
|
||||
integrationsRepo.toLowerCase() != defaultIntegrationsRepo;
|
||||
_prefs.setBool('useAlternativeSources', usingAlternativeSources);
|
||||
_prefs.setBool('migratedToAlternativeSource', true);
|
||||
}
|
||||
|
@ -119,6 +123,9 @@ class ManagerAPI {
|
|||
}
|
||||
|
||||
String getPatchesRepo() {
|
||||
if (!isUsingAlternativeSources()) {
|
||||
return defaultPatchesRepo;
|
||||
}
|
||||
return _prefs.getString('patchesRepo') ?? defaultPatchesRepo;
|
||||
}
|
||||
|
||||
|
@ -452,7 +459,7 @@ class ManagerAPI {
|
|||
|
||||
Future<File?> downloadPatches() async {
|
||||
try {
|
||||
final String repoName = !isUsingAlternativeSources() ? defaultPatchesRepo : getPatchesRepo();
|
||||
final String repoName = getPatchesRepo();
|
||||
final String currentVersion = await getCurrentPatchesVersion();
|
||||
final String url = getPatchesDownloadURL();
|
||||
return await _githubAPI.getReleaseFile(
|
||||
|
@ -471,7 +478,9 @@ class ManagerAPI {
|
|||
|
||||
Future<File?> downloadIntegrations() async {
|
||||
try {
|
||||
final String repoName = !isUsingAlternativeSources() ? defaultIntegrationsRepo : getIntegrationsRepo();
|
||||
final String repoName = !isUsingAlternativeSources()
|
||||
? defaultIntegrationsRepo
|
||||
: getIntegrationsRepo();
|
||||
final String currentVersion = await getCurrentIntegrationsVersion();
|
||||
final String url = getIntegrationsDownloadURL();
|
||||
return await _githubAPI.getReleaseFile(
|
||||
|
|
|
@ -484,7 +484,7 @@ class HomeViewModel extends BaseViewModel {
|
|||
|
||||
Future<String?> getLatestPatchesChangelog() async {
|
||||
final release =
|
||||
await _githubAPI.getLatestRelease(_managerAPI.defaultPatchesRepo);
|
||||
await _githubAPI.getLatestRelease(_managerAPI.getPatchesRepo());
|
||||
return release?['body'];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue