Skip to content
Closed
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
49 changes: 31 additions & 18 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
name: Node Environment
name: CI

on: [push, pull_request]

jobs:
node-lint-tests:
checks:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"

steps:
- name: checkout
uses: actions/checkout@v2

- name: setup node
uses: actions/setup-node@v1
with:
node-version: 20

- name: install node_modules
run: |
yarn install --frozen-lockfile
yarn --cwd example/RNBGUExample install --frozen-lockfile

- name: node lint
run:
yarn lint:ci
- name: checkout
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: install node_modules
run: |
yarn install --frozen-lockfile
yarn --cwd example/RNBGUExample install --frozen-lockfile

- name: lint
run: yarn lint:ci

- name: typecheck
run: yarn typecheck

- name: setup java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: android unit tests
run: |
cd example/RNBGUExample/android
./gradlew :react-native-background-upload:testDebugUnitTest
9 changes: 3 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
## Issues

Along with a bug report, provide a functional example repository which
reproduces the bug you're experiencing. We've made this very easy by providing
a full-stack (React Native + Express.js) example app, which you can fork and
alter to reproduce your bug:

[ReactNativeBackgroundUploadExample](https://github.com/Vydia/ReactNativeBackgroundUploadExample)
Along with a bug report, provide a functional reproduction using the full-stack
(React Native + Express.js) example app in this repo under `example/` β€” fork and
alter it to reproduce your bug.
87 changes: 25 additions & 62 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,89 +1,52 @@
buildscript {
ext {
kotlinVersion = '1.6.20'
buildToolsVersion = '29.0.2'
compileSdkVersion = 31 // this helps us use the latest Worker version
targetSdkVersion = 29
minSdkVersion = 18
}
ext.detoxKotlinVersion = ext.kotlinVersion

repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
// Generates NativeRNFileUploaderSpec from src/NativeRNFileUploader.ts, per the
// codegenConfig block in package.json. Required for the TurboModule.
apply plugin: 'com.facebook.react'

def DEFAULT_COMPILE_SDK_VERSION = 28
def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
def DEFAULT_TARGET_SDK_VERSION = 28

// Inherit the host app's toolchain; the fallbacks match Diana, the only consumer.
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
buildFeatures {
/*
This is a replacement for the deprecated 'kotlin-android-extensions' library. More
information can be found here: https://developer.android.com/topic/libraries/view-binding/migration
*/
viewBinding = true
}
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
namespace 'ai.openspace.backgroundupload'

compileSdkVersion safeExtGet('compileSdkVersion', 36)

defaultConfig {
minSdkVersion 24
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
lintOptions {
abortOnError false
minSdkVersion safeExtGet('minSdkVersion', 29)
targetSdkVersion safeExtGet('targetSdkVersion', 36)
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
jvmTarget = '17'
}

lint {
abortOnError false
}
}

repositories {
google()
mavenCentral()
}

def _ext = ext

def _kotlinVersion = _ext.has('detoxKotlinVersion') ? _ext.detoxKotlinVersion : '1.3.10'
def _kotlinStdlib = _ext.has('detoxKotlinStdlib') ? _ext.detoxKotlinStdlib : 'kotlin-stdlib-jdk8'

dependencies {
implementation "androidx.core:core-ktx:1.7.0"

implementation 'com.facebook.react:react-native:+'

implementation "org.jetbrains.kotlin:$_kotlinStdlib:$_kotlinVersion"

implementation("com.squareup.okhttp3:okhttp:4.10.0")

implementation 'com.google.code.gson:gson:2.8.9'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
// Version supplied by the React Native Gradle plugin.
implementation 'com.facebook.react:react-android'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.work:work-runtime-ktx:2.9.1'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1'

implementation "androidx.work:work-runtime-ktx:2.8.1"
testImplementation 'junit:junit:4.13.2'
}
5 changes: 3 additions & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!-- The package/namespace is declared in build.gradle (android.namespace); the
manifest `package` attribute is removed as AGP 8 requires. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.vydia.RNUploader">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vydia.RNUploader
package ai.openspace.backgroundupload

import android.util.Log
import com.facebook.react.bridge.Arguments
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vydia.RNUploader
package ai.openspace.backgroundupload

import android.content.BroadcastReceiver
import android.content.Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vydia.RNUploader
package ai.openspace.backgroundupload

import com.facebook.react.bridge.ReadableMap
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vydia.RNUploader
package ai.openspace.backgroundupload

import android.os.Handler
import android.os.Looper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vydia.RNUploader
package ai.openspace.backgroundupload

import kotlinx.coroutines.suspendCancellableCoroutine
import okhttp3.Call
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vydia.RNUploader
package ai.openspace.backgroundupload

import android.app.Notification
import android.app.NotificationManager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vydia.RNUploader
package ai.openspace.backgroundupload

import android.util.Log
import androidx.work.ExistingWorkPolicy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vydia.RNUploader;
package ai.openspace.backgroundupload;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
Expand Down
Loading
Loading