use of de.westnordost.osmapi.common.errors.OsmAuthorizationException in project StreetComplete by westnordost.
the class QuestChangesUploadService method onHandleIntent.
@Override
protected void onHandleIntent(Intent intent) {
if (cancelState.get())
return;
try {
if (isBanned()) {
throw new VersionBannedException(banReason);
}
// let's fail early in case of no authorization
if (!oAuth.isAuthorized()) {
throw new OsmAuthorizationException(401, "Unauthorized", "User is not authorized");
}
Log.i(TAG, "Starting upload changes");
OsmNoteQuestChangesUpload noteQuestUpload = noteQuestUploadProvider.get();
noteQuestUpload.upload(cancelState);
if (cancelState.get())
return;
UndoOsmQuestChangesUpload undoOsmQuestUpload = undoQuestUploadProvider.get();
undoOsmQuestUpload.setVisibleQuestListener(visibleQuestRelay);
undoOsmQuestUpload.upload(cancelState);
if (cancelState.get())
return;
OsmQuestChangesUpload osmQuestUpload = questUploadProvider.get();
osmQuestUpload.setVisibleQuestListener(visibleQuestRelay);
osmQuestUpload.upload(cancelState);
if (cancelState.get())
return;
CreateNoteUpload createNoteUpload = createNoteUploadProvider.get();
createNoteUpload.upload(cancelState);
} catch (Exception e) {
Log.e(TAG, "Unable to upload changes", e);
if (progressListener != null) {
progressListener.onError(e);
}
}
if (progressListener != null) {
progressListener.onFinished();
}
Log.i(TAG, "Finished upload changes");
}
Aggregations