Skip to content

Commit

Permalink
fix: import patches
Browse files Browse the repository at this point in the history
  • Loading branch information
lovegaoshi committed Sep 13, 2024
1 parent dd0585c commit 8304283
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 11 deletions.
52 changes: 41 additions & 11 deletions patches/react-native+0.75.3.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
diff --git a/node_modules/react-native/Libraries/ReactNative/AppRegistry.js b/node_modules/react-native/Libraries/ReactNative/AppRegistry.js
index 68bd389..0170fa0 100644
--- a/node_modules/react-native/Libraries/ReactNative/AppRegistry.js
+++ b/node_modules/react-native/Libraries/ReactNative/AppRegistry.js
@@ -14,6 +14,7 @@ import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
import type {DisplayModeType} from './DisplayMode';

import BatchedBridge from '../BatchedBridge/BatchedBridge';
+import registerCallableModule from '../Core/registerCallableModule';
import BugReporting from '../BugReporting/BugReporting';
import createPerformanceLogger from '../Utilities/createPerformanceLogger';
import infoLog from '../Utilities/infoLog';
@@ -369,6 +370,7 @@ global.RN$SurfaceRegistry = {

if (global.RN$Bridgeless === true) {
console.log('Bridgeless mode is enabled');
+ registerCallableModule('AppRegistry', AppRegistry);
} else {
BatchedBridge.registerCallableModule('AppRegistry', AppRegistry);
}
diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java
index 70a8f7c..bb74bab 100644
index 70a8f7c..d0e2802 100644
--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java
+++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java
@@ -14,10 +14,13 @@ import android.content.Context;
Expand Down Expand Up @@ -54,7 +74,7 @@ index 70a8f7c..bb74bab 100644
} else {
invokeStartTask(reactContext, taskConfig);
}
@@ -114,17 +109,17 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
@@ -114,31 +109,29 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ

private void invokeStartTask(ReactContext reactContext, final HeadlessJsTaskConfig taskConfig) {
final HeadlessJsTaskContext headlessJsTaskContext =
Expand All @@ -80,16 +100,27 @@ index 70a8f7c..bb74bab 100644
}

@Override
@@ -136,7 +131,7 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext != null) {
HeadlessJsTaskContext headlessJsTaskContext =
public void onDestroy() {
super.onDestroy();
+ ReactContext reactContext = getReactContext();

- if (getReactNativeHost().hasInstance()) {
- ReactInstanceManager reactInstanceManager = getReactNativeHost().getReactInstanceManager();
- ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
- if (reactContext != null) {
- HeadlessJsTaskContext headlessJsTaskContext =
- HeadlessJsTaskContext.getInstance(reactContext);
+ HeadlessJsTaskContext.getInstance(reactContext);
headlessJsTaskContext.removeTaskEventListener(this);
}
- headlessJsTaskContext.removeTaskEventListener(this);
- }
+
+ if (reactContext != null) {
+ HeadlessJsTaskContext headlessJsTaskContext =
+ HeadlessJsTaskContext.getInstance(reactContext);
+ headlessJsTaskContext.removeTaskEventListener(this);
}
@@ -166,4 +161,55 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
if (sWakeLock != null) {
sWakeLock.release();
@@ -166,4 +159,55 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
protected ReactNativeHost getReactNativeHost() {
return ((ReactApplication) getApplication()).getReactNativeHost();
}
Expand Down Expand Up @@ -145,7 +176,6 @@ index 70a8f7c..bb74bab 100644
+ }
+ }
}
\ No newline at end of file
diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt
index 5f09366..84351e2 100644
--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt
Expand Down
26 changes: 26 additions & 0 deletions patches/react-native-track-player+4.1.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt b/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt
index 9d6d869..d781ff0 100644
--- a/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt
+++ b/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt
@@ -741,19 +741,14 @@ class MusicService : HeadlessJsTaskService() {

@MainThread
private fun emit(event: String, data: Bundle? = null) {
- reactNativeHost.reactInstanceManager.currentReactContext
- ?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
- ?.emit(event, data?.let { Arguments.fromBundle(it) })
+ reactContext.emitDeviceEvent(event, data?.let { Arguments.fromBundle(it) })
}

@MainThread
private fun emitList(event: String, data: List<Bundle> = emptyList()) {
val payload = Arguments.createArray()
data.forEach { payload.pushMap(Arguments.fromBundle(it)) }
-
- reactNativeHost.reactInstanceManager.currentReactContext
- ?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
- ?.emit(event, payload)
+ reactContext.emitDeviceEvent(event, payload)
}

override fun getTaskConfig(intent: Intent?): HeadlessJsTaskConfig {

0 comments on commit 8304283

Please sign in to comment.