GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(mobile): attaching a photo on Android no longer fails while the +… · patroza/t3code@429e921

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • patches
    • [email protected]
  • pnpm-lock.yaml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎patches/[email protected]‎

Copy file name to clipboardExpand all lines: patches/[email protected]
+59Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,62 @@ index c732ab419395526d42a51df664e63afe88a79302..2e3f40e1f966167584ceb853faad8f84
4040
}
4141

4242
override fun forceLayout() {
43+
diff --git a/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt b/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt
44+
index 4955e93..fbb8a52 100644
45+
--- a/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt
46+
+++ b/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt
47+
@@ -231,7 +231,9 @@ class AppContextActivityResultRegistry(
48+
launchedKeys.add(key)
49+
50+
try {
51+
- onLaunch(requestCode, contract, input)
52+
+ // Starting an Activity walks the window's views, which races the UI thread when run from
53+
+ // the module's IO dispatcher (a view removed mid-walk throws a NullPointerException).
54+
+ runOnMainThread { onLaunch(requestCode, contract, input) }
55+
} catch (e: Exception) {
56+
launchedKeys.remove(key)
57+
throw e
58+
@@ -255,24 +257,28 @@ class AppContextActivityResultRegistry(
59+
fallbackCallback: AppContextActivityResultFallbackCallback<I, O>
60+
): Int? {
61+
val liveActivity = activity
62+
+ runOnMainThread { register(key, liveActivity, contract, fallbackCallback) }
63+
+ return keyToRequestCode[key]
64+
+ }
65+
+
66+
+ private fun runOnMainThread(block: () -> Unit) {
67+
if (Looper.myLooper() == Looper.getMainLooper()) {
68+
- register(key, liveActivity, contract, fallbackCallback)
69+
- } else {
70+
- val registered = CountDownLatch(1)
71+
- var failure: Throwable? = null
72+
- Handler(Looper.getMainLooper()).post {
73+
- try {
74+
- register(key, liveActivity, contract, fallbackCallback)
75+
- } catch (e: Throwable) {
76+
- failure = e
77+
- } finally {
78+
- registered.countDown()
79+
- }
80+
+ block()
81+
+ return
82+
+ }
83+
+ val done = CountDownLatch(1)
84+
+ var failure: Throwable? = null
85+
+ Handler(Looper.getMainLooper()).post {
86+
+ try {
87+
+ block()
88+
+ } catch (e: Throwable) {
89+
+ failure = e
90+
+ } finally {
91+
+ done.countDown()
92+
}
93+
- registered.await()
94+
- failure?.let { throw it }
95+
}
96+
- return keyToRequestCode[key]
97+
+ done.await()
98+
+ failure?.let { throw it }
99+
}
100+
101+
/**
Collapse file

‎pnpm-lock.yaml‎

Copy file name to clipboardExpand all lines: pnpm-lock.yaml
+3-3Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.