react-native-my-uploader-android 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -82,46 +82,47 @@ class MyUploaderModule(private val reactContext: ReactApplicationContext) :
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
try {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
val activity = currentActivity
|
|
86
|
+
?: throw IllegalStateException("Activity is null")
|
|
87
|
+
|
|
88
|
+
val intent: Intent = if (isGallery) {
|
|
89
|
+
// ✅ TÜM ANDROID SÜRÜMLERİNDE ÇALIŞAN GALERİ
|
|
90
|
+
Intent(Intent.ACTION_GET_CONTENT).apply {
|
|
91
|
+
type = "image/*"
|
|
92
|
+
addCategory(Intent.CATEGORY_OPENABLE)
|
|
93
|
+
if (multipleFiles) {
|
|
94
|
+
putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
|
|
93
95
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
// ✅ GENEL DOSYA SEÇİCİ
|
|
99
|
+
val fileTypes = options.takeIf { it.hasKey("fileTypes") }
|
|
100
|
+
?.getArray("fileTypes")
|
|
101
|
+
?.toArrayList()
|
|
102
|
+
?.mapNotNull { it.toString() }
|
|
103
|
+
?: listOf("*/*")
|
|
104
|
+
|
|
105
|
+
Intent(Intent.ACTION_GET_CONTENT).apply {
|
|
106
|
+
type = "*/*"
|
|
107
|
+
addCategory(Intent.CATEGORY_OPENABLE)
|
|
108
|
+
putExtra(Intent.EXTRA_MIME_TYPES, fileTypes.toTypedArray())
|
|
109
|
+
if (multipleFiles) {
|
|
110
|
+
putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
|
-
|
|
112
|
-
// ✅ HER ZAMAN CHOOSER → MIUI SAFE
|
|
113
|
-
activity.startActivityForResult(
|
|
114
|
-
Intent.createChooser(intent, "Bir uygulama seçin"),
|
|
115
|
-
REQUEST_CODE
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
} catch (e: Exception) {
|
|
119
|
-
pickerPromise?.reject(
|
|
120
|
-
E_FAILED_TO_OPEN_DOCUMENT,
|
|
121
|
-
e.localizedMessage ?: "Dosya seçici açılamadı."
|
|
122
|
-
)
|
|
123
|
-
pickerPromise = null
|
|
124
113
|
}
|
|
114
|
+
|
|
115
|
+
val chooserIntent = Intent.createChooser(intent, "Bir uygulama seçin")
|
|
116
|
+
activity.startActivityForResult(chooserIntent, REQUEST_CODE)
|
|
117
|
+
|
|
118
|
+
} catch (e: Exception) {
|
|
119
|
+
pickerPromise?.reject(
|
|
120
|
+
E_FAILED_TO_OPEN_DOCUMENT,
|
|
121
|
+
e.localizedMessage ?: "Dosya seçici açılamadı."
|
|
122
|
+
)
|
|
123
|
+
pickerPromise = null
|
|
124
|
+
}
|
|
125
|
+
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
@ReactMethod
|