Files
notesnook/apps/mobile/patches/react-native-orientation+3.1.3.patch
2024-08-10 16:29:05 +05:00

119 lines
4.8 KiB
Diff

diff --git a/node_modules/react-native-orientation/android/build.gradle b/node_modules/react-native-orientation/android/build.gradle
index e09fb27..b19fac8 100644
--- a/node_modules/react-native-orientation/android/build.gradle
+++ b/node_modules/react-native-orientation/android/build.gradle
@@ -1,20 +1,26 @@
apply plugin: 'com.android.library'
+
+def DEFAULT_COMPILE_SDK_VERSION = 28
+def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
+def DEFAULT_MIN_SDK_VERSION = 16
+def DEFAULT_TARGET_SDK_VERSION = 26
+
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.1"
+ compileSdkVersion rootProject.ext.has('compileSdkVersion') ? rootProject.ext.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
+ buildToolsVersion rootProject.ext.has('buildToolsVersion') ? rootProject.ext.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
defaultConfig {
- minSdkVersion 16
- targetSdkVersion 22
+ minSdkVersion rootProject.ext.has('minSdkVersion') ? rootProject.ext.minSdkVersion : DEFAULT_MIN_SDK_VERSION
+ targetSdkVersion rootProject.ext.has('targetSdkVersion') ? rootProject.ext.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
versionCode 1
versionName "1.0"
ndk {
- abiFilters "armeabi-v7a", "x86"
+ abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
}
dependencies {
- compile "com.facebook.react:react-native:+"
+ implementation "com.facebook.react:react-native:+"
}
diff --git a/node_modules/react-native-orientation/android/src/main/java/com/github/yamill/orientation/OrientationModule.java b/node_modules/react-native-orientation/android/src/main/java/com/github/yamill/orientation/OrientationModule.java
index 85331ae..32e1002 100644
--- a/node_modules/react-native-orientation/android/src/main/java/com/github/yamill/orientation/OrientationModule.java
+++ b/node_modules/react-native-orientation/android/src/main/java/com/github/yamill/orientation/OrientationModule.java
@@ -1,5 +1,6 @@
package com.github.yamill.orientation;
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -20,6 +21,7 @@ import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.modules.core.DeviceEventManagerModule;
+import android.os.Build;
import java.util.HashMap;
import java.util.Map;
@@ -57,6 +59,18 @@ public class OrientationModule extends ReactContextBaseJavaModule implements Lif
return "Orientation";
}
+ @ReactMethod
+ public void addListener(String eventName) {
+ // Keep: Required for RN built in Event Emitter Calls.
+ }
+
+ @ReactMethod
+ public void removeListeners(Integer count) {
+ // Keep: Required for RN built in Event Emitter Calls.
+ }
+
+
+
@ReactMethod
public void getOrientation(Callback callback) {
final int orientationInt = getReactApplicationContext().getResources().getConfiguration().orientation;
@@ -142,6 +156,7 @@ public class OrientationModule extends ReactContextBaseJavaModule implements Lif
}
}
+ @SuppressLint({"UnspecifiedRegisterReceiverFlag", "WrongConstant"})
@Override
public void onHostResume() {
final Activity activity = getCurrentActivity();
@@ -150,7 +165,13 @@ public class OrientationModule extends ReactContextBaseJavaModule implements Lif
FLog.e(ReactConstants.TAG, "no activity to register receiver");
return;
}
- activity.registerReceiver(receiver, new IntentFilter("onConfigurationChanged"));
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ activity.registerReceiver(receiver, new IntentFilter("onConfigurationChanged"), Context.RECEIVER_NOT_EXPORTED);
+ } else {
+ activity.registerReceiver(receiver, new IntentFilter("onConfigurationChanged"));
+ }
+
}
@Override
public void onHostPause() {
diff --git a/node_modules/react-native-orientation/iOS/RCTOrientation/Orientation.m b/node_modules/react-native-orientation/iOS/RCTOrientation/Orientation.m
index 15e9927..2e4d4b9 100644
--- a/node_modules/react-native-orientation/iOS/RCTOrientation/Orientation.m
+++ b/node_modules/react-native-orientation/iOS/RCTOrientation/Orientation.m
@@ -137,6 +137,15 @@ - (NSString *)getSpecificOrientationStr: (UIDeviceOrientation)orientation {
RCT_EXPORT_MODULE();
+
+RCT_EXPORT_METHOD(addListener : (NSString *)eventName) {
+ // Keep: Required for RN built in Event Emitter Calls.
+}
+
+RCT_EXPORT_METHOD(removeListeners : (NSInteger)count) {
+ // Keep: Required for RN built in Event Emitter Calls.
+}
+
RCT_EXPORT_METHOD(getOrientation:(RCTResponseSenderBlock)callback)
{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];