Skip to content

Commit

Permalink
chore: android user agent client source (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 authored Sep 26, 2024
1 parent 4992774 commit a414ab2
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/deploy-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ jobs:
steps:
- uses: actions/checkout@v4

# If using sd on macos, "brew install" works great. for Linux, this is the recommended way.
- name: Install sd CLI to use later in the workflow
# uses: kenji-miyake/setup-sd@v1
uses: levibostian/setup-sd@add-file-extension # Using fork until upstream Action has bug fixed in it.

- name: Deploy git tag via semantic release
uses: cycjimmy/semantic-release-action@v4
id: semantic-release
Expand Down
3 changes: 2 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ customerio.reactnative.kotlinVersion=1.7.21
customerio.reactnative.compileSdkVersion=33
customerio.reactnative.targetSdkVersion=33
customerio.reactnative.minSdkVersion=21
customerio.reactnative.cioSDKVersionAndroid=4.1.0
# TODO: Update snapshot version to stable version before final release
customerio.reactnative.cioSDKVersionAndroid=feature-react-native-cdp-SNAPSHOT
13 changes: 13 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,17 @@

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application>
<!--
Provide source and version of Customer.io React Native SDK so user agent can be
generated based on this information.
-->
<meta-data
android:name="io.customer.sdk.android.core.SDK_SOURCE"
android:value="@string/customer_io_react_native_sdk_client_source" />
<meta-data
android:name="io.customer.sdk.android.core.SDK_VERSION"
android:value="@string/customer_io_react_native_sdk_client_version" />
</application>

</manifest>
13 changes: 13 additions & 0 deletions android/src/main/res/values/customer_io_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
SDK source to be used in user-agent string
-->
<string name="customer_io_react_native_sdk_client_source">ReactNative</string>
<!--
SDK version to be used in user-agent string
This will be updated by update-version script with React Native package version
whenever new version of React Native package is released
-->
<string name="customer_io_react_native_sdk_client_version">3.8.0</string>
</resources>
17 changes: 12 additions & 5 deletions scripts/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ set -e

NEW_VERSION="$1"

echo "Updating package.json to new version: $NEW_VERSION"

# Update new version in package.json file
PACKAGE_JSON_SOURCE_FILE="package.json"
echo "Updating package.json at: $PACKAGE_JSON_SOURCE_FILE to new version: $NEW_VERSION"
npm version "$NEW_VERSION" --no-git-tag-version --allow-same-version
echo "Done! Showing changes to confirm:"
git diff $PACKAGE_JSON_SOURCE_FILE

echo "Check package.json file. You should see version inside has been updated!"

cat package.json
# Update new version in customer_io_config.xml file
SDK_CONFIG_XML_FILE="android/src/main/res/values/customer_io_config.xml"
SDK_CONFIG_CLIENT_VERSION_KEY="customer_io_react_native_sdk_client_version"
echo "Updating customer_io_config.xml at: $SDK_CONFIG_XML_FILE to new version: $NEW_VERSION"
sd "<string name=\"$SDK_CONFIG_CLIENT_VERSION_KEY\">.*</string>" "<string name=\"$SDK_CONFIG_CLIENT_VERSION_KEY\">$NEW_VERSION</string>" $SDK_CONFIG_XML_FILE
echo "Done! Showing changes to confirm:"
git diff $SDK_CONFIG_XML_FILE

0 comments on commit a414ab2

Please sign in to comment.