Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .github/workflows/build-test-expo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Build Test (Expo)

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-expo-android:
name: Build Expo Android
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' }}

- name: Install root dependencies
run: yarn install --frozen-lockfile

- name: Build SDK
run: yarn prepare

- name: Install Expo CLI
run: npm install -g expo-cli

- name: Install example_expo dependencies
working-directory: example_expo
run: yarn install --frozen-lockfile

- name: Generate native projects (prebuild)
working-directory: example_expo
run: npx expo prebuild --platform android --clean

- name: Build Android Release
working-directory: example_expo/android
run: ./gradlew assembleRelease --no-daemon --console=plain

build-expo-ios:
name: Build Expo iOS
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install root dependencies
run: yarn install --frozen-lockfile

- name: Build SDK
run: yarn prepare

- name: Install Expo CLI
run: npm install -g expo-cli

- name: Install example_expo dependencies
working-directory: example_expo
run: yarn install --frozen-lockfile

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true

- name: Install CocoaPods and xcpretty
run: gem install cocoapods xcpretty

- name: Generate native projects (prebuild)
working-directory: example_expo
run: npx expo prebuild --platform ios --clean

- name: Cache CocoaPods
uses: actions/cache@v4
with:
path: example_expo/ios/Pods
key: ${{ runner.os }}-expo-pods-${{ hashFiles('example_expo/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-expo-pods-

- name: Install Pods
working-directory: example_expo/ios
run: |
# Clear stale Local Podspecs to avoid version mismatch with freshly prebuilt project
rm -rf Pods/Local\ Podspecs
pod install

- name: Build iOS Simulator
working-directory: example_expo/ios
run: |
xcodebuild \
-workspace exampleexponew.xcworkspace \
-scheme exampleexponew \
-configuration Release \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \
-derivedDataPath build \
CODE_SIGNING_ALLOWED=NO \
| xcpretty --color
135 changes: 135 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Build Test

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-and-typecheck:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run linter
run: yarn lint

- name: Run TypeScript typecheck
run: yarn typescript

- name: Run unit tests
run: yarn test

build-android:
name: Build Android
runs-on: ubuntu-latest
needs: lint-and-typecheck
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' }}

- name: Install root dependencies
run: yarn install --frozen-lockfile

- name: Build SDK
run: yarn prepare

- name: Install example app dependencies
run: yarn --cwd example install --frozen-lockfile

- name: Build Android Release
working-directory: example/android
run: ./gradlew assembleRelease --no-daemon --console=plain

build-ios:
name: Build iOS
runs-on: macos-latest
needs: lint-and-typecheck
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install root dependencies
run: yarn install --frozen-lockfile

- name: Build SDK
run: yarn prepare

- name: Install example app dependencies
run: yarn --cwd example install --frozen-lockfile

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
working-directory: example/ios

- name: Install CocoaPods and xcpretty
run: gem install cocoapods xcpretty

- name: Cache CocoaPods
uses: actions/cache@v4
with:
path: example/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-

- name: Install Pods
working-directory: example/ios
run: pod install

- name: Build iOS Simulator
working-directory: example/ios
run: |
xcodebuild \
-workspace AwesomeModuleExample.xcworkspace \
-scheme AwesomeModuleExample \
-configuration Release \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \
-derivedDataPath build \
CODE_SIGNING_ALLOWED=NO \
| xcpretty --color
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}

Expand Down Expand Up @@ -136,8 +136,8 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'io.rownd:android:2.16.2'
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
implementation 'io.rownd:android:4.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0"
implementation 'androidx.compose.ui:ui-unit:1.3.0'
implementation 'androidx.compose.ui:ui-graphics:1.3.0'
// From node_modules
Expand Down
10 changes: 5 additions & 5 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RowndPlugin_kotlinVersion=1.7.0
RowndPlugin_minSdkVersion=21
RowndPlugin_targetSdkVersion=31
RowndPlugin_compileSdkVersion=31
RowndPlugin_ndkversion=21.4.7075529
RowndPlugin_kotlinVersion=2.0.21
RowndPlugin_minSdkVersion=26
RowndPlugin_targetSdkVersion=35
RowndPlugin_compileSdkVersion=35
RowndPlugin_ndkversion=26.1.10909125
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ import io.rownd.android.*
import io.rownd.android.Rownd
import io.rownd.android.RowndSignInHint
import io.rownd.android.RowndSignInOptions
import io.rownd.android.models.ConnectionActionPayload
import io.rownd.android.models.FirebaseGetIdTokenResponse
import io.rownd.android.models.RowndCustomizations
import io.rownd.android.models.repos.GlobalState
import io.rownd.android.util.RowndException
import kotlinx.coroutines.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.json.Json

class AppCustomizations(app: FragmentActivity) : RowndCustomizations() {
Expand Down Expand Up @@ -180,8 +176,9 @@ class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBas
}

@ReactMethod
@Suppress("UNCHECKED_CAST")
fun setUserData(data: ReadableMap) {
Rownd.user.set(data.toHashMap())
Rownd.user.set(data.toHashMap() as Map<String, Any>)
}

@ReactMethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package com.reactnativerowndplugin
import android.app.Application
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.NativeModule
Expand Down
3 changes: 1 addition & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,11 @@ android {
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation project(":rownd_react-native")

if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
3 changes: 2 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.awesomemoduleexample">

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {
Expand All @@ -34,7 +35,7 @@ class MainApplication : Application(), ReactApplication {

override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
Expand Down
26 changes: 11 additions & 15 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
buildscript {
ext {
buildToolsVersion = "34.0.0"
buildToolsVersion = "35.0.0"
minSdkVersion = 26
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
compileSdkVersion = 35
targetSdkVersion = 35
ndkVersion = "27.1.12297006"
kotlinVersion = "2.0.21"
}
}

apply plugin: "com.facebook.react.rootproject"
plugins {
id("com.android.application") version "8.6.0" apply false
id("com.android.library") version "8.6.0" apply false
id("org.jetbrains.kotlin.android") version "2.0.21" apply false
id("com.facebook.react.rootproject")
}
Loading