refactor: Introduce the API connection repository #440
No reviewers
Labels
No Label
Blocked
Bug
Contributions welcome
Did not do
Errata
Feature request
Fixed
How To
Invalid
Needs design
No resolution
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Providers
Digital Ocean
Providers
Hetzner
Refactor
Severity
High
Severity
Low
Severity
Medium
Source
Community
Source
Core Team
Source
Stakeholders
Translations
Under investigation
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Blocks
#464 Add website and support links to the About page
SelfPrivacy/selfprivacy.org.app
Reference: SelfPrivacy/selfprivacy.org.app#440
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "api-connection-refactor"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Major refactor to remove connections between cubits.
Also:
Closes #277
Closes #166
Closes #254
DO NOT MERGE until API supports system rebuild tracking (SelfPrivacy/selfprivacy-rest-api#91)There is a fallback available now. PR is too big now, and there seems to be no regressions.4b735483bf
to831a0e95eb
@ -0,0 +30,4 @@
);
}
on<ServicesListUpdate>(
imho handler registration should preceed event subscription. not sure how it works for bloc default state now, but it could easily drop event from 26 line, because handler was not yet registered.
@ -52,7 +52,8 @@ class _ServicesPageState extends State<ServicesPage> {
)
: RefreshIndicator(
onRefresh: () async {
could just write:
@ -426,3 +417,3 @@
onTap: preventActions
? null
: () => {context.read<BackupsCubit>().forceUpdateBackups()},
: () => {
should probably fix this project-wide, callbacks should not return sets of values.
callbacks could still work as intended, BUT this could become a habit and introduce real tricky bugs.
WIP: refactior: Introduce the API connection repositoryto WIP: refactor: Introduce the API connection repositoryWIP: refactor: Introduce the API connection repositoryto refactor: Introduce the API connection repository@ -59,0 +82,4 @@
),
message: result.parsedData!.system.runSystemUpgrade.message,
);
} else {
What the hell 😨 , looks scary. is this how it's supposed to be now for all GraphQL requests?
I think there can be a better approach, but in general, yeah, every request must return a GenericResult or something like that.
@ -0,0 +147,4 @@
final Emitter<BackupsState> emit,
) async {
if (state is! BackupsUnititialized) {
return;
This is quite extreme, is this impossible to trigger? Do we need a notification for it?
Better safe than sorry. Events now trigger these functions, and not the direct calls.
@ -0,0 +131,4 @@
final List<Backup> list = _backupList;
list.sort((final a, final b) => b.time.compareTo(a.time));
return list;
} on UnsupportedError {
Why specifically
UnsupportedError
? We don't care about other possible errors in this block?@ -0,0 +37,4 @@
final DevicesListChanged event,
final Emitter<DevicesState> emit,
) async {
if (state is DevicesDeleting) {
This really scares me. I suspect it's in all other blocs like this... what do you think?
@ -0,0 +73,4 @@
emit(
DevicesLoaded(
devices: state.devices
.where((final d) => d.name != event.device.name)
Duplication with line 62?
There are different states emited
@ -450,3 +442,1 @@
onTap: preventActions
? null
: () => {context.read<BackupsCubit>().reuploadKey()},
// onTap: preventActions
Why? Probs you wanted to just
?
@ -73,0 +325,4 @@
? 0.0
: ((rebuildJob.progress ?? 0) < 1)
? null
: rebuildJob.progress! / 100.0,
I can already see how we create tickets to refactor all that
Welp...
Server API does not return the progress value yet, but might return later.
When we pass
null
, it does the cute loading animation.@ -73,0 +223,4 @@
],
);
},
),
it's so over
@ -163,0 +371,4 @@
final String timezone;
@override
Future<(bool, String)> execute() async =>
Can't we use
GenericResult
everywhere? Is it overkill?@ -27,8 +27,9 @@ class ServerHostingDetails {
@HiveField(2)
final DateTime? startTime;
// TODO: Check if it is still needed
I am 99% sure it isn't 🙏 will do some cleaning evenetually