Skip to content

Commit 327224d

Browse files
authored
fix: [SDK-4160] exclude OkHttp 5.x from OneSignal transitive dependencies (#1921)
1 parent 0cf3109 commit 327224d

8 files changed

Lines changed: 28 additions & 59 deletions

File tree

.cursor/rules/bun.mdc

Lines changed: 0 additions & 14 deletions
This file was deleted.

.cursor/rules/pr-conventions.mdc

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/cd.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ jobs:
1818
github.event.pull_request.merged == true &&
1919
contains(github.event.pull_request.title, 'chore: Release')
2020
uses: OneSignal/sdk-shared/.github/workflows/publish-npm-github.yml@main
21+
secrets:
22+
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
2123
with:
2224
branch: ${{ github.event.pull_request.base.ref }}

.github/workflows/create-release-pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
9595
# Get versions from target branch (not the release branch)
9696
CURRENT_VERSION=$(git show origin/${{ inputs.target_branch }}:package.json | jq -r .version)
97-
ANDROID_VERSION=$(git show origin/${{ inputs.target_branch }}:android/build.gradle | grep "api 'com.onesignal:OneSignal:" | sed -E "s/.*OneSignal:([0-9.]+).*/\1/")
97+
ANDROID_VERSION=$(git show origin/${{ inputs.target_branch }}:android/build.gradle | grep "com.onesignal:OneSignal:" | sed -E "s/.*OneSignal:([0-9.]+).*/\1/")
9898
IOS_VERSION=$(git show origin/${{ inputs.target_branch }}:react-native-onesignal.podspec | grep "OneSignalXCFramework" | sed -E "s/.*'([0-9.]+)'.*/\1/")
9999
100100
echo "rn_from=$CURRENT_VERSION" >> $GITHUB_OUTPUT
@@ -116,8 +116,8 @@ jobs:
116116
exit 1
117117
fi
118118
119-
# Update Android SDK version in build.gradle
120-
sed -i '' "s/api 'com.onesignal:OneSignal:[^']*'/api 'com.onesignal:OneSignal:$VERSION'/" android/build.gradle
119+
# Update Android SDK version in build.gradle (handles both api '...' and api('...') syntax)
120+
sed -i '' -E "s/(com\.onesignal:OneSignal:)[0-9.]+/\1$VERSION/" android/build.gradle
121121
echo "✓ Updated android/build.gradle with Android SDK ${VERSION}"
122122
123123
# Only commit if there are changes
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Move Linear tickets to Deployed
2+
3+
on:
4+
release:
5+
types: [published, edited]
6+
7+
jobs:
8+
linear-deployed:
9+
uses: OneSignal/sdk-shared/.github/workflows/linear-deployed.yml@main
10+
with:
11+
release_body: ${{ github.event.release.body }}
12+
secrets:
13+
LINEAR_GITHUB_API_KEY: ${{ secrets.LINEAR_GITHUB_API_KEY }}

android/build.gradle

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ dependencies {
3232

3333
// api is used instead of implementation so the parent :app project can access any of the OneSignal Java
3434
// classes if needed. Such as com.onesignal.NotificationExtenderService
35-
api 'com.onesignal:OneSignal:5.7.2'
36-
35+
//
36+
// Exclude OkHttp from OneSignal's transitive deps: the 5.7.x otel module pulls in OkHttp 5.x
37+
// (via opentelemetry-exporter-sender-okhttp) which is binary-incompatible with React Native's
38+
// networking stack (okhttp3.internal.Util removed in 5.x). React Native already provides OkHttp 4.x.
39+
api('com.onesignal:OneSignal:5.7.2') {
40+
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
41+
}
42+
3743
testImplementation 'junit:junit:4.12'
38-
}
44+
}

examples/demo/android/app/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,6 @@ android {
109109

110110
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
111111

112-
configurations.all {
113-
resolutionStrategy {
114-
force 'com.squareup.okhttp3:okhttp:4.12.0'
115-
}
116-
}
117-
118112
dependencies {
119113
// The version of react-native is set by the React Native Gradle Plugin
120114
implementation("com.facebook.react:react-android")

examples/demo/bun.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)