mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-25 19:27:24 +02:00
common: Only upload if sync is activated
This commit is contained in:
parent
322ed3f81e
commit
3f5743e2f5
5 changed files with 16 additions and 48 deletions
|
|
@ -64,19 +64,13 @@ class _EnsembleEditorState extends State<EnsembleEditor> {
|
|||
synced: false,
|
||||
);
|
||||
|
||||
final success = await backend.client.putEnsemble(ensemble);
|
||||
await backend.db.updateEnsemble(ensemble);
|
||||
|
||||
setState(() {
|
||||
uploading = false;
|
||||
});
|
||||
|
||||
if (success) {
|
||||
Navigator.pop(context, ensemble);
|
||||
} else {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text('Failed to upload'),
|
||||
));
|
||||
}
|
||||
Navigator.pop(context, ensemble);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -64,20 +64,13 @@ class _InstrumentEditorState extends State<InstrumentEditor> {
|
|||
synced: false,
|
||||
);
|
||||
|
||||
final success =
|
||||
await backend.client.putInstrument(instrument);
|
||||
await backend.db.updateInstrument(instrument);
|
||||
|
||||
setState(() {
|
||||
uploading = false;
|
||||
});
|
||||
|
||||
if (success) {
|
||||
Navigator.pop(context, instrument);
|
||||
} else {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text('Failed to upload'),
|
||||
));
|
||||
}
|
||||
Navigator.pop(context, instrument);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -67,19 +67,13 @@ class _PersonEditorState extends State<PersonEditor> {
|
|||
synced: false,
|
||||
);
|
||||
|
||||
final success = await backend.client.putPerson(person);
|
||||
await backend.db.updatePerson(person);
|
||||
|
||||
setState(() {
|
||||
uploading = false;
|
||||
});
|
||||
|
||||
if (success) {
|
||||
Navigator.pop(context, person);
|
||||
} else {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text('Failed to upload'),
|
||||
));
|
||||
}
|
||||
Navigator.pop(context, person);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -144,26 +144,19 @@ class _RecordingEditorState extends State<RecordingEditor> {
|
|||
performances: _performanceInfos,
|
||||
);
|
||||
|
||||
final success =
|
||||
await _backend.client.putRecording(recordingInfo);
|
||||
await _backend.db.updateRecording(recordingInfo);
|
||||
|
||||
setState(() {
|
||||
_uploading = false;
|
||||
});
|
||||
|
||||
if (success) {
|
||||
Navigator.pop(
|
||||
context,
|
||||
RecordingSelectorResult(
|
||||
workInfo: _workInfo,
|
||||
recordingInfo: recordingInfo,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text('Failed to upload'),
|
||||
));
|
||||
}
|
||||
Navigator.pop(
|
||||
context,
|
||||
RecordingSelectorResult(
|
||||
workInfo: _workInfo,
|
||||
recordingInfo: recordingInfo,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -322,19 +322,13 @@ class _WorkEditorState extends State<WorkEditor> {
|
|||
sections: sections,
|
||||
);
|
||||
|
||||
final success = await backend.client.putWork(workInfo);
|
||||
await backend.db.updateWork(workInfo);
|
||||
|
||||
setState(() {
|
||||
uploading = false;
|
||||
});
|
||||
|
||||
if (success) {
|
||||
Navigator.pop(context, workInfo);
|
||||
} else {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text('Failed to upload'),
|
||||
));
|
||||
}
|
||||
Navigator.pop(context, workInfo);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue