Skip to content

Commit

Permalink
TW-789 Fix open apk
Browse files Browse the repository at this point in the history
  • Loading branch information
drminh2807 authored and hoangdat committed Oct 19, 2023
1 parent 47ce448 commit d84a2b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class SupportedPreviewFileTypes {

static const pdfMimeTypes = ['application/pdf', 'application/rtf'];

static const apkMimeTypes = ['application/vnd.android.package-archive'];

static const xlsMimeTypes = [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.oasis.opendocument.spreadsheet',
Expand Down
5 changes: 5 additions & 0 deletions lib/pages/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,11 @@ class ChatController extends State<Chat>
required DownloadFileForPreviewResponse downloadFileForPreviewResponse,
}) async {
final mimeType = downloadFileForPreviewResponse.mimeType;
if (Platform.isAndroid &&
SupportedPreviewFileTypes.apkMimeTypes.contains(mimeType)) {
await Share.shareXFiles([XFile(downloadFileForPreviewResponse.filePath)]);
return;
}
final openResults = await OpenFile.open(
downloadFileForPreviewResponse.filePath,
type: mimeType,
Expand Down

0 comments on commit d84a2b8

Please sign in to comment.