Skip to content

Commit 705825b

Browse files
committed
Merge branch 'master' into prelive
2 parents fae6a94 + 15d6039 commit 705825b

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

widgetssdk/src/main/java/com/glia/widgets/chat/adapter/UploadAttachmentAdapter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ private boolean isError(FileAttachment.Status status) {
120120
case ERROR_PERMISSIONS_DENIED:
121121
case ERROR_FORMAT_UNSUPPORTED:
122122
case ERROR_FILE_TOO_LARGE:
123+
case ERROR_FILE_UPLOAD_FORBIDDEN:
123124
case ERROR_ENGAGEMENT_MISSING:
124125
case ERROR_SUPPORTED_FILE_ATTACHMENT_COUNT_EXCEEDED:
125126
case ERROR_SECURITY_SCAN_FAILED:
@@ -170,6 +171,10 @@ private void setTitleText(TextView titleText, String fileName, long byteSize, Fi
170171
titleText.setTextColor(ContextCompat.getColor(itemView.getContext(), R.color.design_default_color_error));
171172
titleText.setText(R.string.glia_chat_attachment_upload_error_failed_to_check_safety);
172173
break;
174+
case ERROR_FILE_UPLOAD_FORBIDDEN:
175+
titleText.setTextColor(ContextCompat.getColor(itemView.getContext(), R.color.design_default_color_error));
176+
titleText.setText(R.string.glia_chat_attachment_upload_error_file_upload_forbidden);
177+
break;
173178
case ERROR_UNKNOWN:
174179
case ERROR_INTERNAL:
175180
titleText.setTextColor(ContextCompat.getColor(itemView.getContext(), R.color.design_default_color_error));
@@ -204,6 +209,7 @@ private void setProgressIndicatorState(LinearProgressIndicator progressIndicator
204209
case ERROR_ENGAGEMENT_MISSING:
205210
case ERROR_SUPPORTED_FILE_ATTACHMENT_COUNT_EXCEEDED:
206211
case ERROR_SECURITY_SCAN_FAILED:
212+
case ERROR_FILE_UPLOAD_FORBIDDEN:
207213
case ERROR_UNKNOWN:
208214
progressIndicator.setIndeterminate(false);
209215
progressIndicator.setProgress(100);
@@ -228,6 +234,7 @@ private String getStatusIndicatorText(Context context, FileAttachment.Status sta
228234
case ERROR_SUPPORTED_FILE_ATTACHMENT_COUNT_EXCEEDED:
229235
case ERROR_SECURITY_SCAN_FAILED:
230236
case ERROR_UNKNOWN:
237+
case ERROR_FILE_UPLOAD_FORBIDDEN:
231238
return context.getString(R.string.glia_chat_attachment_upload_failed_upload);
232239
case UPLOADING:
233240
default:

widgetssdk/src/main/java/com/glia/widgets/core/fileupload/FileAttachmentRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ private void onUploadFileError(Uri uri, GliaException exception) {
172172

173173
private FileAttachment.Status getAttachmentStatus(GliaException exception) {
174174
switch (exception.cause) {
175+
case FILE_UPLOAD_FORBIDDEN:
176+
return FileAttachment.Status.ERROR_FILE_UPLOAD_FORBIDDEN;
175177
case INVALID_INPUT:
176178
return FileAttachment.Status.ERROR_INVALID_INPUT;
177179
case NETWORK_TIMEOUT:

widgetssdk/src/main/java/com/glia/widgets/core/fileupload/model/FileAttachment.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public enum Status {
9090
ERROR_UNKNOWN,
9191
ERROR_SECURITY_SCAN_FAILED,
9292

93+
ERROR_FILE_UPLOAD_FORBIDDEN,
94+
9395
ERROR_SUPPORTED_FILE_ATTACHMENT_COUNT_EXCEEDED
9496
}
9597
}

widgetssdk/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
<string name="glia_chat_attachment_upload_error_file_count_limit_reached">Cannot upload more than 25 files</string>
131131
<string name="glia_chat_attachment_upload_error_internal_error">Internal error</string>
132132
<string name="glia_chat_attachment_upload_error_failed_to_check_safety">Failed to check the safety of the file.</string>
133+
<string name="glia_chat_attachment_upload_error_file_upload_forbidden">File uploading disabled</string>
133134
<string name="glia_chat_attachment_upload_menu_browse">Browse</string>
134135
<string name="glia_chat_attachment_upload_menu_take_photo">Take Photo</string>
135136
<string name="glia_chat_attachment_upload_menu_gallery">Photo library</string>

0 commit comments

Comments
 (0)