Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(mobile): bring inline context to native composer and chat #10368

Closedchrisdeeming(GitHub profile, opens in a new tab)wants to merge 125 commits intomain fromrefs/pull/10368/headopened View on GitHub

Showing 218 changed files with 70 additions and 0 deletions (loading 216).

x
0 of 218 viewed, 218 left
0 additions and 0 deletions.pnpm-store/v11/index.dbAdded
View file

Binary file not shown.

70 additions and 0 deletionsapps/mobile/modules/t3-composer-editor/android/src/main/java/expo/modules/t3composereditor/T3ComposerEditorModule.ktModified
View file
@@ -2,11 +2,73 @@
​
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
+import android.content.ClipData
+import android.content.ClipboardManager
+import android.content.Context
+import org.json.JSONObject
+import org.json.JSONArray
+​
+internal object T3ComposerClipboard {
+ fun write(context: Context, text: String, fragment: String) {
+ val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
+ val payload = try {
+ JSONObject(fragment)
+ } catch (_: Exception) {
+ null
+ }
+ val records = payload?.optJSONArray("records")
+ if (payload == null || records == null) {
+ clipboard.setPrimaryClip(ClipData.newPlainText("T3 Code", text))
+ return
+ }
+ val all = (0 until records.length()).map { records.getJSONObject(it) }
+ val selected = all.filter { text.contains("/${it.optString("contextId")})") }.toMutableList()
+ val screenshots = selected.map { it.optString("screenshotContextId") }.toSet()
+ selected.addAll(