Skip to content

Commit

Permalink
changed extension identification
Browse files Browse the repository at this point in the history
  • Loading branch information
em-ad committed Oct 4, 2021
1 parent 7d5d082 commit e855a9b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
21 changes: 20 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions chatkitlight/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 97
versionName "3.0.47.2.1"
versionCode 98
versionName "3.0.47.3"
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,12 @@ public ConversationViewHolder(LawoneConversationClientFileBinding clientFileBind
if (FileHelper.checkFileExistence(context, getItem(getBindingAdapterPosition()).getFileName())) {
Uri fileUri = FileHelper.getFileUri(context, getItem(getBindingAdapterPosition()).getFileName());
String type = FileHelper.getMimeType(context, fileUri);
String extension = ExtensionHelper.getUriExtension(getItem(getBindingAdapterPosition()).getMessage());
String extension = "";
try{
extension = ExtensionHelper.getUriExtension(getItem(getBindingAdapterPosition()).getMessage());
} catch (StringIndexOutOfBoundsException exception){
extension = ExtensionHelper.getUriExtension(getItem(getBindingAdapterPosition()).getFileName());
}
if (extension.contains(PublicValue.PDF) || extension.contains(PublicValue.DOC) || extension.contains(PublicValue.DOCX))
OnFileClicked(fileUri);
else
Expand Down Expand Up @@ -1377,8 +1382,12 @@ public ConversationViewHolder(LawoneConversationServerFileBinding serverFileBind
if (FileHelper.checkFileExistence(context, getItem(getBindingAdapterPosition()).getFileName())) {
Uri fileUri = FileHelper.getFileUri(context, getItem(getBindingAdapterPosition()).getFileName());
String type = FileHelper.getMimeType(context, fileUri);
String extension = ExtensionHelper.getUriExtension(fileUri);

String extension = "";
try{
extension = ExtensionHelper.getUriExtension(getItem(getBindingAdapterPosition()).getMessage());
} catch (StringIndexOutOfBoundsException exception){
extension = ExtensionHelper.getUriExtension(getItem(getBindingAdapterPosition()).getFileName());
}
if (extension.contains(PublicValue.PDF) || extension.contains(PublicValue.DOC) || extension.contains(PublicValue.DOCX))
OnFileClicked(fileUri);
else
Expand Down

0 comments on commit e855a9b

Please sign in to comment.