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
@@ -133,7 +133,7 @@ a reason to go higher.
133
133
  libraries*, add:
134
134
 
135
135
  ```json
136
- { "bubble-whatsapp-status": "1.0.0" }
136
+ { "bubble-whatsapp-status": "^1.1.1" }
137
137
  ```
138
138
 
139
139
  3. Create a **development build** (or a new production build) so the native
@@ -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.ACTION_VIEW).apply {
69
- data = Uri.parse("https://wa.me/status")
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
- activity.startActivity(intent)
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bubble-whatsapp-status",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Native WhatsApp Share-to-Status bridge (Android + iOS) for Bubble native mobile plugins.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",