Skip to content

Commit

Permalink
Merge branch 'pr/66'
Browse files Browse the repository at this point in the history
  • Loading branch information
incrediblezayed committed Jun 26, 2023
2 parents 764d020 + 2c91d86 commit 80609b3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.

## [0.2.5]
* Added apng mime type
* Fixed repeated extension when using saveAs with MimeType.other on iOS ([GitHub issue #65](https://github.com/incrediblezayed/file_saver/issues/65))

## [0.2.4]
* Bug Fix -> Link Details not available publically
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Dialog(private val activity: Activity) : PluginRegistry.ActivityResultList

fun openFileManager(
fileName: String?,
ext: String?,
bytes: ByteArray?,
type: String?,
result: MethodChannel.Result
Expand All @@ -55,7 +56,7 @@ class Dialog(private val activity: Activity) : PluginRegistry.ActivityResultList
Intent(Intent.ACTION_CREATE_DOCUMENT)
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.putExtra(Intent.EXTRA_TITLE, fileName)
intent.putExtra(Intent.EXTRA_TITLE, "$fileName.$ext")
intent.putExtra(Intent.EXTRA_MIME_TYPES, type)
intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, Environment.getExternalStorageDirectory().path)
intent.type = type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class FileSaverPlugin : FlutterPlugin, ActivityAware, MethodCallHandler {
}
"saveAs" -> {
Log.d(tag, "Save as Method Called")
dialog!!.openFileManager(fileName = call.argument("name"), bytes = call.argument("bytes"), type = call.argument("mimeType"), result = result)
dialog!!.openFileManager(fileName = call.argument("name"), ext = call.argument("ext"), bytes = call.argument("bytes"), type = call.argument("mimeType"), result = result)

}
else -> {
Expand Down
4 changes: 1 addition & 3 deletions lib/file_saver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ class FileSaver {

_saver = Saver(
fileModel: FileModel(
name: mimeType == MimeType.other
? '$name${Helpers.getExtension(extension: ext)}'
: name,
name: name,
bytes: bytes,
ext: ext,
mimeType:
Expand Down

0 comments on commit 80609b3

Please sign in to comment.