Skip to content

Commit 4a5bd63

Browse files
committed
Restore accidental deletions from Android plugin
1 parent de0d3e2 commit 4a5bd63

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

android/src/main/kotlin/codeux/design/filepicker/file_picker_writable/FilePickerWritablePlugin.kt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,44 @@ class FilePickerWritablePlugin : FlutterPlugin, MethodCallHandler,
8989
?: throw FilePickerException("Expected argument 'path'")
9090
impl.openFilePickerForCreate(result, path)
9191
}
92+
"isDirectoryAccessSupported" -> {
93+
result.success(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
94+
}
95+
"openDirectoryPicker" -> {
96+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
97+
val initialDirUri = call.argument<String>("initialDirUri")
98+
impl.openDirectoryPicker(result, initialDirUri)
99+
} else {
100+
throw FilePickerException("${call.method} is not supported on Android ${Build.VERSION.RELEASE}")
101+
}
102+
}
92103
"readFileWithIdentifier" -> {
93104
val identifier = call.argument<String>("identifier")
94105
?: throw FilePickerException("Expected argument 'identifier'")
95106
impl.readFileWithIdentifier(result, identifier)
96107
}
108+
"getDirectory" -> {
109+
val rootIdentifier = call.argument<String>("rootIdentifier")
110+
?: throw FilePickerException("Expected argument 'rootIdentifier'")
111+
val fileIdentifier = call.argument<String>("fileIdentifier")
112+
?: throw FilePickerException("Expected argument 'fileIdentifier'")
113+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
114+
impl.getDirectory(result, rootIdentifier, fileIdentifier)
115+
} else {
116+
throw FilePickerException("${call.method} is not supported on Android ${Build.VERSION.RELEASE}")
117+
}
118+
}
119+
"resolveRelativePath" -> {
120+
val directoryIdentifier = call.argument<String>("directoryIdentifier")
121+
?: throw FilePickerException("Expected argument 'directoryIdentifier'")
122+
val relativePath = call.argument<String>("relativePath")
123+
?: throw FilePickerException("Expected argument 'relativePath'")
124+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
125+
impl.resolveRelativePath(result, directoryIdentifier, relativePath)
126+
} else {
127+
throw FilePickerException("${call.method} is not supported on Android ${Build.VERSION.RELEASE}")
128+
}
129+
}
97130
"writeFileWithIdentifier" -> {
98131
val identifier = call.argument<String>("identifier")
99132
?: throw FilePickerException("Expected argument 'identifier'")

0 commit comments

Comments
 (0)