Skip to content

Commit

Permalink
fix: Incorrect strings and logics (#1619)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAabedKhan authored Jan 11, 2024
1 parent 0d45fe4 commit 4f22e88
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lib/services/manager_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ class ManagerAPI {
String? integrationsVersion = '';

bool isDefaultPatchesRepo() {
return getPatchesRepo().toLowerCase() == 'revanced/revanced-patches';
return getPatchesRepo().toLowerCase() == defaultPatchesRepo;
}

bool isDefaultIntegrationsRepo() {
return getIntegrationsRepo().toLowerCase() ==
'revanced/revanced-integrations';
defaultIntegrationsRepo;
}

Future<void> initialize() async {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/revanced_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RevancedAPI {
final response = await _dio.get('/contributors');
final List<dynamic> repositories = response.data['repositories'];
for (final Map<String, dynamic> repo in repositories) {
final String name = repo['name'];
final String name = repo['name'].toLowerCase();
contributors[name] = repo['contributors'];
}
} on Exception catch (e) {
Expand All @@ -54,7 +54,7 @@ class RevancedAPI {
final List<dynamic> tools = response.data['tools'];
return tools.firstWhereOrNull(
(t) =>
t['repository'] == repoName &&
(t['repository'] as String).toLowerCase() == repoName.toLowerCase() &&
(t['name'] as String).endsWith(extension),
);
} on Exception catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/views/contributors/contributors_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class ContributorsViewModel extends BaseViewModel {
final Map<String, List<dynamic>> contributors =
await _managerAPI.getContributors();
patcherContributors = contributors[_managerAPI.defaultPatcherRepo] ?? [];
patchesContributors = contributors[_managerAPI.getPatchesRepo()] ?? [];
patchesContributors = contributors[_managerAPI.getPatchesRepo().toLowerCase()] ?? [];
integrationsContributors =
contributors[_managerAPI.getIntegrationsRepo()] ?? [];
contributors[_managerAPI.getIntegrationsRepo().toLowerCase()] ?? [];
cliContributors = contributors[_managerAPI.defaultCliRepo] ?? [];
managerContributors = contributors[_managerAPI.defaultManagerRepo] ?? [];
notifyListeners();
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/views/home/home_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ class HomeViewModel extends BaseViewModel {
Future<void> initialize(BuildContext context) async {
_managerAPI.rePatchedSavedApps().then((_) => _getPatchedApps());

_latestManagerVersion = await _managerAPI.getLatestManagerVersion();
if (!_managerAPI.getPatchesConsent()) {
await showPatchesConsent(context);
}

_latestManagerVersion = await _managerAPI.getLatestManagerVersion();

await _patcherAPI.initialize();

await flutterLocalNotificationsPlugin.initialize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ class SManageApiUrl extends BaseViewModel {
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText('settingsView.selectApiURL').toString(),
labelText: FlutterI18n.translate(
context,
'settingsView.selectApiURL',
),
hintText: apiUrl,
),
),
Expand Down
25 changes: 15 additions & 10 deletions lib/ui/views/settings/settingsFragment/settings_manage_sources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ class SManageSources extends BaseViewModel {
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText(
labelText: FlutterI18n.translate(
context,
'settingsView.hostRepositoryLabel',
).toString(),
),
hintText: hostRepository,
),
),
Expand All @@ -76,9 +77,10 @@ class SManageSources extends BaseViewModel {
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText(
labelText: FlutterI18n.translate(
context,
'settingsView.orgPatchesLabel',
).toString(),
),
hintText: patchesRepo.split('/')[0],
),
),
Expand All @@ -94,9 +96,10 @@ class SManageSources extends BaseViewModel {
color: Colors.transparent,
),
border: const OutlineInputBorder(),
labelText: I18nText(
labelText: FlutterI18n.translate(
context,
'settingsView.sourcesPatchesLabel',
).toString(),
),
hintText: patchesRepo.split('/')[1],
),
),
Expand All @@ -112,9 +115,10 @@ class SManageSources extends BaseViewModel {
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText(
labelText: FlutterI18n.translate(
context,
'settingsView.orgIntegrationsLabel',
).toString(),
),
hintText: integrationsRepo.split('/')[0],
),
),
Expand All @@ -130,9 +134,10 @@ class SManageSources extends BaseViewModel {
color: Colors.transparent,
),
border: const OutlineInputBorder(),
labelText: I18nText(
labelText: FlutterI18n.translate(
context,
'settingsView.sourcesIntegrationsLabel',
).toString(),
),
hintText: integrationsRepo.split('/')[1],
),
),
Expand Down

0 comments on commit 4f22e88

Please sign in to comment.