Skip to content

Commit

Permalink
test(ios): Cavy: podspec location + AGP8 compat; ios no channels
Browse files Browse the repository at this point in the history
without the Cavy patch auto-linking fails as it requires the podspec
at module root in modern react-native, and it has apparently been
failing long enough that a bit of android-specific testing crept out
of the android-specific testing area

this also prepares the cavy native reporter for AGP8
  • Loading branch information
mikehardy committed Dec 13, 2023
1 parent d0c55db commit 4e59dcf
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
6 changes: 6 additions & 0 deletions tests_react_native/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PODS:
- boost (1.76.0)
- CavyNativeReporter (0.1.3):
- React-Core
- DoubleConversion (1.1.6)
- FBLazyVector (0.69.12)
- FBReactNativeSpec (0.69.12):
Expand Down Expand Up @@ -358,6 +360,7 @@ PODS:

DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- CavyNativeReporter (from `../node_modules/cavy-native-reporter`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
Expand Down Expand Up @@ -412,6 +415,8 @@ SPEC REPOS:
EXTERNAL SOURCES:
boost:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
CavyNativeReporter:
:path: "../node_modules/cavy-native-reporter"
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
FBLazyVector:
Expand Down Expand Up @@ -487,6 +492,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
CavyNativeReporter: 22479f189ecd26513573801d005244bd47abb188
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
FBLazyVector: 6fab494fa11340bd4206edaebed07279a6bafad4
FBReactNativeSpec: 76d7b03876b0ad0b86bc5c84d23af8e64db8e096
Expand Down
55 changes: 55 additions & 0 deletions tests_react_native/patches/cavy-native-reporter+0.1.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/node_modules/cavy-native-reporter/ios/CavyNativeReporter.podspec b/node_modules/cavy-native-reporter/CavyNativeReporter.podspec
similarity index 81%
rename from node_modules/cavy-native-reporter/ios/CavyNativeReporter.podspec
rename to node_modules/cavy-native-reporter/CavyNativeReporter.podspec
index dd101c9..1019194 100644
--- a/node_modules/cavy-native-reporter/ios/CavyNativeReporter.podspec
+++ b/node_modules/cavy-native-reporter/CavyNativeReporter.podspec
@@ -1,4 +1,4 @@
-package = JSON.parse(File.read(File.join(__dir__, (File.join('..', 'package.json')))))
+package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
s.name = "CavyNativeReporter"
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.author = { "author" => "[email protected]" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/pixielabs/cavy-native-reporter.git", :tag => "v#{s.version}" }
- s.source_files = "*.{h,m}"
+ s.source_files = "ios/*.{h,m}"
s.requires_arc = true
s.dependency "React-Core"
end
diff --git a/node_modules/cavy-native-reporter/android/build.gradle b/node_modules/cavy-native-reporter/android/build.gradle
index 6c17279..b862d6b 100644
--- a/node_modules/cavy-native-reporter/android/build.gradle
+++ b/node_modules/cavy-native-reporter/android/build.gradle
@@ -1,17 +1,27 @@

buildscript {
+ // The Android Gradle plugin is only required when opening the android folder stand-alone.
+ // This avoids unnecessary downloads and potential conflicts when the library is included as a
+ // module dependency in an application project.
+ if (project == rootProject) {
repositories {
jcenter()
}
-
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
+ }
}

apply plugin: 'com.android.library'

android {
+ def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
+ // Check AGP version for backward compatibility w/react-native versions still on gradle plugin 6
+ if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
+ namespace = "com.cavynativereporter"
+ }
+
compileSdkVersion 28
buildToolsVersion "28.0.3"

3 changes: 1 addition & 2 deletions tests_react_native/specs/notification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ export function NotificationSpec(spec: TestScope): void {
const customSoundChannel = await notifee.getChannel('new_custom_sound');
console.warn('customSoundChannel looks like: ' + JSON.stringify(customSoundChannel));

expect(customSoundChannel).not.null;

if (Platform.OS === 'android' && customSoundChannel) {
expect(customSoundChannel).not.null;
expect(customSoundChannel.soundURI).contains('horse.mp3');
expect(customSoundChannel.sound).equals('horse.mp3');
}
Expand Down

0 comments on commit 4e59dcf

Please sign in to comment.