bubble-whatsapp-status 1.1.0 → 1.1.2
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.
package/README.md
CHANGED
|
@@ -65,8 +65,15 @@ class WhatsAppStatusModule : Module() {
|
|
|
65
65
|
return@AsyncFunction mapOf("opened" to false, "reason" to "FILE_PROVIDER_ERROR")
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
val intent = Intent(Intent.
|
|
69
|
-
|
|
68
|
+
val intent = Intent(Intent.ACTION_SEND).apply {
|
|
69
|
+
// Official API reference variant: ACTION_SEND + MIME type + share_type.
|
|
70
|
+
// The sample's ACTION_VIEW + wa.me/status variant only opens WhatsApp.
|
|
71
|
+
type = when {
|
|
72
|
+
mimeType.startsWith("video/") -> "video/*"
|
|
73
|
+
mimeType.startsWith("image/") -> "image/*"
|
|
74
|
+
mimeType.isNotBlank() -> mimeType
|
|
75
|
+
else -> "*/*"
|
|
76
|
+
}
|
|
70
77
|
setPackage("com.whatsapp")
|
|
71
78
|
putExtra(Intent.EXTRA_STREAM, uri)
|
|
72
79
|
putExtra("share_type", "SHARE_TO_STATUS")
|
|
@@ -76,7 +83,11 @@ class WhatsAppStatusModule : Module() {
|
|
|
76
83
|
}
|
|
77
84
|
|
|
78
85
|
try {
|
|
79
|
-
|
|
86
|
+
context.grantUriPermission("com.whatsapp", uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
|
87
|
+
// The official Share-to-Status flow starts the intent FOR RESULT.
|
|
88
|
+
// With plain startActivity, WhatsApp ignores SHARE_TO_STATUS and just
|
|
89
|
+
// opens its main screen.
|
|
90
|
+
activity.startActivityForResult(intent, 0)
|
|
80
91
|
} catch (e: android.content.ActivityNotFoundException) {
|
|
81
92
|
return@AsyncFunction mapOf("opened" to false, "reason" to "WHATSAPP_NOT_INSTALLED")
|
|
82
93
|
} catch (e: Exception) {
|