Skip to content

Commit

Permalink
fix: Changelog of custom ReVanced Patches not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAabedKhan committed Mar 15, 2024
1 parent ab13895 commit 8c7119c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions lib/services/manager_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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')) {
Expand All @@ -74,11 +75,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);
}
Expand Down Expand Up @@ -115,6 +119,9 @@ class ManagerAPI {
}

String getPatchesRepo() {
if (!isUsingAlternativeSources()) {
return defaultPatchesRepo;
}
return _prefs.getString('patchesRepo') ?? defaultPatchesRepo;
}

Expand Down Expand Up @@ -419,7 +426,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.getPatchesReleaseFile(
Expand All @@ -438,7 +445,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.getPatchesReleaseFile(
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/home/home_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ class HomeViewModel extends BaseViewModel {
}

Future<Map<String, dynamic>?> getLatestPatchesRelease() {
return _githubAPI.getLatestPatchesRelease(_managerAPI.defaultPatchesRepo);
return _githubAPI.getLatestPatchesRelease(_managerAPI.getPatchesRepo());
}

Future<String?> getLatestPatchesReleaseTime() {
Expand Down

0 comments on commit 8c7119c

Please sign in to comment.