feat: add live draw feature and clean up docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
jjbruntonandClaude Opus 4.5 committed 2026-02-01 14:35:16 +00:00
1 parent 520d0a8444
commit 4c18afaeae
63 files changed
+6728 -12854

No files matched your search

@@ -0,0 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
@@ -0,0 +1,48 @@
package expo.modules.widgetbridge
import android.appwidget.AppWidgetManager
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
class WidgetBridgeModule : Module() {
override fun definition() = ModuleDefinition {
Name("WidgetBridge")
Function("setWidgetData") { key: String, value: String ->
val ctx = requireNotNull(appContext.reactContext)
ctx.getSharedPreferences("${ctx.packageName}.widgetdata", Context.MODE_PRIVATE)
.edit()
.putString(key, value)
.apply()
}
Function("reloadWidgets") {
val ctx = requireNotNull(appContext.reactContext)
val intent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)
val widgetManager = AppWidgetManager.getInstance(ctx)
val providers = ctx.packageManager.queryBroadcastReceivers(
Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE),
PackageManager.GET_META_DATA
)
for (provider in providers) {
if (provider.activityInfo.packageName == ctx.packageName) {
val component = ComponentName(
provider.activityInfo.packageName,
provider.activityInfo.name
)
val ids = widgetManager.getAppWidgetIds(component)
if (ids.isNotEmpty()) {
val updateIntent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)
updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
updateIntent.component = component
ctx.sendBroadcast(updateIntent)
}
}
}
}
}
}