Skip to content

Commit 4e5f031

Browse files
author
LaksCastro
committed
(#62) Remove unused code and expressions
1 parent 26a70e8 commit 4e5f031

2 files changed

Lines changed: 1 addition & 70 deletions

File tree

android/src/main/kotlin/io/lakscastro/sharedstorage/storageaccessframework/lib/DocumentCommon.kt

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,6 @@ import io.lakscastro.sharedstorage.plugin.API_24
1515
import java.io.ByteArrayOutputStream
1616
import java.io.Closeable
1717

18-
/**
19-
* Helper class to make more easy to handle callbacks using Kotlin syntax
20-
*/
21-
data class CallbackHandler<T>(
22-
var onSuccess: (T.() -> Unit)? = null,
23-
var onEnd: (() -> Unit)? = null
24-
)
25-
26-
/**
27-
* Generate the `DocumentFile` reference from string `uri` (Single `DocumentFile`)
28-
*/
29-
@RequiresApi(API_21)
30-
fun documentFromSingleUri(context: Context, uri: String): DocumentFile? =
31-
documentFromSingleUri(context, Uri.parse(uri))
32-
33-
/**
34-
* Generate the `DocumentFile` reference from string `uri` (Single `DocumentFile`)
35-
*/
36-
@RequiresApi(API_21)
37-
fun documentFromSingleUri(context: Context, uri: Uri): DocumentFile? {
38-
val documentUri = DocumentsContract.buildDocumentUri(
39-
uri.authority,
40-
DocumentsContract.getDocumentId(uri)
41-
)
42-
43-
return DocumentFile.fromSingleUri(context, documentUri)
44-
}
45-
46-
47-
4818
/**
4919
* Generate the `DocumentFile` reference from string `uri`
5020
*/
@@ -67,38 +37,6 @@ fun documentFromUri(
6737
}
6838
}
6939

70-
/**
71-
* Generate the `DocumentFile` reference of a child
72-
* document (subfolder of a granted Uri) from URI `uri`
73-
*/
74-
@RequiresApi(API_21)
75-
fun childDocumentFromUri(
76-
context: Context,
77-
uri: Uri
78-
): DocumentFile? {
79-
val documentId = DocumentsContract.getDocumentId(uri)
80-
val documentUri = if (isTreeUri(uri)) {
81-
DocumentsContract.buildDocumentUri(uri.authority, documentId)
82-
} else {
83-
DocumentsContract.buildDocumentUri(uri.authority, documentId)
84-
}
85-
86-
return if (isTreeUri(uri)) {
87-
DocumentFile.fromTreeUri(context, uri)
88-
} else {
89-
DocumentFile.fromSingleUri(context, uri)
90-
}
91-
}
92-
93-
/**
94-
* Generate the `DocumentFile` reference of a child
95-
* document (subfolder of a granted Uri) from URI `uri`
96-
*/
97-
@RequiresApi(API_21)
98-
fun childDocumentFromUri(
99-
context: Context,
100-
uri: String
101-
): DocumentFile? = childDocumentFromUri(context, Uri.parse(uri))
10240

10341
/**
10442
* Standard map encoding of a `DocumentFile` and must be used before returning any `DocumentFile`
@@ -197,7 +135,7 @@ fun traverseDirectoryEntries(
197135
rootUri: Uri,
198136
block: (data: Map<String, Any>, isLast: Boolean) -> Unit
199137
): Boolean {
200-
var childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(
138+
val childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(
201139
rootUri,
202140
DocumentsContract.getDocumentId(targetUri)
203141
)

android/src/main/kotlin/io/lakscastro/sharedstorage/storageaccessframework/lib/StorageAccessFrameworkConstant.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,19 @@ package io.lakscastro.sharedstorage.storageaccessframework.lib
33
/**
44
* Exceptions
55
*/
6-
const val EXCEPTION_PARENT_DOCUMENT_MUST_BE_DIRECTORY =
7-
"EXCEPTION_PARENT_DOCUMENT_MUST_BE_DIRECTORY"
86
const val EXCEPTION_MISSING_PERMISSIONS = "EXCEPTION_MISSING_PERMISSIONS"
97
const val EXCEPTION_CANT_OPEN_DOCUMENT_FILE =
108
"EXCEPTION_CANT_OPEN_DOCUMENT_FILE"
119
const val EXCEPTION_ACTIVITY_NOT_FOUND = "EXCEPTION_ACTIVITY_NOT_FOUND"
1210
const val EXCEPTION_CANT_OPEN_FILE_DUE_SECURITY_POLICY =
1311
"EXCEPTION_CANT_OPEN_FILE_DUE_SECURITY_POLICY"
14-
const val EXCEPTION_INVALID_ARGUMENTS =
15-
"EXCEPTION_INVALID_ARGUMENTS"
1612

1713
/**
1814
* Others
1915
*/
2016
const val DOCUMENTS_CONTRACT_EXTRA_INITIAL_URI =
2117
"android.provider.extra.INITIAL_URI"
2218

23-
const val PLUGIN_FILE_PROVIDER_PACKAGE_NAME =
24-
"fileprovider.io.lakscastro.sharedstorage.storageaccessframework.lib"
25-
2619
/**
2720
* Available DocumentFile Method Channel APIs
2821
*/

0 commit comments

Comments
 (0)