mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01: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,
|
synced: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final success = await backend.client.putEnsemble(ensemble);
|
await backend.db.updateEnsemble(ensemble);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
uploading = false;
|
uploading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (success) {
|
Navigator.pop(context, ensemble);
|
||||||
Navigator.pop(context, ensemble);
|
|
||||||
} else {
|
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
|
||||||
content: Text('Failed to upload'),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -64,20 +64,13 @@ class _InstrumentEditorState extends State<InstrumentEditor> {
|
||||||
synced: false,
|
synced: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final success =
|
await backend.db.updateInstrument(instrument);
|
||||||
await backend.client.putInstrument(instrument);
|
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
uploading = false;
|
uploading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (success) {
|
Navigator.pop(context, instrument);
|
||||||
Navigator.pop(context, instrument);
|
|
||||||
} else {
|
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
|
||||||
content: Text('Failed to upload'),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -67,19 +67,13 @@ class _PersonEditorState extends State<PersonEditor> {
|
||||||
synced: false,
|
synced: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final success = await backend.client.putPerson(person);
|
await backend.db.updatePerson(person);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
uploading = false;
|
uploading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (success) {
|
Navigator.pop(context, person);
|
||||||
Navigator.pop(context, person);
|
|
||||||
} else {
|
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
|
||||||
content: Text('Failed to upload'),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -144,26 +144,19 @@ class _RecordingEditorState extends State<RecordingEditor> {
|
||||||
performances: _performanceInfos,
|
performances: _performanceInfos,
|
||||||
);
|
);
|
||||||
|
|
||||||
final success =
|
await _backend.db.updateRecording(recordingInfo);
|
||||||
await _backend.client.putRecording(recordingInfo);
|
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_uploading = false;
|
_uploading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (success) {
|
Navigator.pop(
|
||||||
Navigator.pop(
|
context,
|
||||||
context,
|
RecordingSelectorResult(
|
||||||
RecordingSelectorResult(
|
workInfo: _workInfo,
|
||||||
workInfo: _workInfo,
|
recordingInfo: recordingInfo,
|
||||||
recordingInfo: recordingInfo,
|
),
|
||||||
),
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
|
||||||
content: Text('Failed to upload'),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -322,19 +322,13 @@ class _WorkEditorState extends State<WorkEditor> {
|
||||||
sections: sections,
|
sections: sections,
|
||||||
);
|
);
|
||||||
|
|
||||||
final success = await backend.client.putWork(workInfo);
|
await backend.db.updateWork(workInfo);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
uploading = false;
|
uploading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (success) {
|
Navigator.pop(context, workInfo);
|
||||||
Navigator.pop(context, workInfo);
|
|
||||||
} else {
|
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
|
||||||
content: Text('Failed to upload'),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue