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
- val intent: Intent = if (isGallery) {
86
- // TÜM ANDROIDLERDE ÇALIŞAN GALERİ
87
- Intent(Intent.ACTION_GET_CONTENT).apply {
88
- type = "image/*"
89
- addCategory(Intent.CATEGORY_OPENABLE)
90
- if (multipleFiles) {
91
- putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
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
- } else {
95
- // GENEL DOSYA SEÇİCİ
96
- val fileTypes = options.takeIf { it.hasKey("fileTypes") }
97
- ?.getArray("fileTypes")
98
- ?.toArrayList()
99
- ?.mapNotNull { it.toString() }
100
- ?: listOf("*/*")
101
-
102
- Intent(Intent.ACTION_GET_CONTENT).apply {
103
- type = "*/*"
104
- addCategory(Intent.CATEGORY_OPENABLE)
105
- putExtra(Intent.EXTRA_MIME_TYPES, fileTypes.toTypedArray())
106
- if (multipleFiles) {
107
- putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-my-uploader-android",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "file uploader for android",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./src/index.d.ts",