if (!downloadResult.isCancelled()) {
int tickerId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_ticker : R.string.downloader_download_failed_ticker;
int contentId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_content : R.string.downloader_download_failed_content;
- mNotificationBuilder
- .setTicker(getString(tickerId))
- .setContentTitle(getString(tickerId))
- .setAutoCancel(true)
- .setOngoing(false)
- .setProgress(0, 0, false);
+
boolean needsToUpdateCredentials = (downloadResult.getCode() == ResultCode.UNAUTHORIZED ||
- // (downloadResult.isTemporalRedirection() && downloadResult.isIdPRedirection()
(downloadResult.isIdPRedirection()
&& mDownloadClient.getCredentials() == null));
- //&& MainApp.getAuthTokenTypeSamlSessionCookie().equals(mDownloadClient.getAuthTokenType())));
+ tickerId = (needsToUpdateCredentials) ?
+ R.string.downloader_download_failed_credentials_error : tickerId;
+
+ mNotificationBuilder
+ .setTicker(getString(tickerId))
+ .setContentTitle(getString(tickerId))
+ .setAutoCancel(true)
+ .setOngoing(false)
+ .setProgress(0, 0, false);
+
if (needsToUpdateCredentials) {
+
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, download.getAccount());
} else {
// / fail -> explicit failure notification
- mNotificationManager.cancel(R.string.uploader_upload_in_progress_ticker);
+ mNotificationManager.cancel(R.string.uploader_upload_in_progress_ticker);
+
NotificationCompat.Builder errorBuilder = new NotificationCompat.Builder(this);
- errorBuilder
- .setSmallIcon(R.drawable.notification_icon)
- .setTicker(getString(R.string.uploader_upload_failed_ticker))
- .setContentTitle(getString(R.string.uploader_upload_failed_ticker))
- .setAutoCancel(true);
- String content = null;
- boolean needsToUpdateCredentials = (uploadResult.getCode() == ResultCode.UNAUTHORIZED ||
- //(uploadResult.isTemporalRedirection() && uploadResult.isIdPRedirection() &&
+ String content = null;
+
+ // check credentials error
+ boolean needsToUpdateCredentials = (uploadResult.getCode() == ResultCode.UNAUTHORIZED ||
(uploadResult.isIdPRedirection() &&
mUploadClient.getCredentials() == null));
- //MainApp.getAuthTokenTypeSamlSessionCookie().equals(mUploadClient.getAuthTokenType())));
+ int tickerId = (needsToUpdateCredentials) ?
+ R.string.uploader_upload_failed_credentials_error : R.string.uploader_upload_failed_ticker;
+
+ errorBuilder
+ .setSmallIcon(R.drawable.notification_icon)
+ .setTicker(getString(tickerId))
+ .setContentTitle(getString(tickerId))
+ .setAutoCancel(true);
+
+
if (needsToUpdateCredentials) {
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
}
errorBuilder.setContentText(content);
- mNotificationManager.notify(R.string.uploader_upload_failed_ticker, errorBuilder.build());
+ mNotificationManager.notify(tickerId, errorBuilder.build());
}
}