Skip to content

Commit

Permalink
Merge pull request #4 from apivideo/feature/new_arch_support
Browse files Browse the repository at this point in the history
Feature/new arch support
  • Loading branch information
ThibaultBee committed Feb 16, 2024
2 parents aebb158 + 6387a7e commit 6476f2e
Show file tree
Hide file tree
Showing 135 changed files with 12,170 additions and 8,479 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/android-ci.yml
@@ -0,0 +1,36 @@
name: Build Android

on: [push]

jobs:
build:
strategy:
matrix:
newArchEnabled: [false, true]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
- name: Install package npm dependencies
run: yarn --frozen-lockfile
shell: bash
- name: Install example npm dependencies
run: yarn example --frozen-lockfile
shell: bash
- name: Build Android test app
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: -PnewArchEnabled=${{matrix.newArchEnabled}} :app:assembleRelease
build-root-directory: example/android
timeout-minutes: 60
62 changes: 0 additions & 62 deletions .github/workflows/build.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/create-release-from-changelog.yml
@@ -0,0 +1,18 @@
name: Create draft release from CHANGELOG.md

on:
push:
paths:
- 'CHANGELOG.md'

jobs:
update-documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create draft release if needed
uses: apivideo/api.video-release-from-changelog-action@main
with:
github-auth-token: ${{ secrets.GITHUB_TOKEN }}
prefix: v

37 changes: 37 additions & 0 deletions .github/workflows/ios-ci.yml
@@ -0,0 +1,37 @@
name: Build iOS

on: [push]

jobs:
build:
strategy:
matrix:
extraEnv: [RCT_NEW_ARCH_ENABLED=0, RCT_NEW_ARCH_ENABLED=1]
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install latest Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
- name: Install package npm dependencies
run: yarn --frozen-lockfile
shell: bash
- name: Install example npm dependencies
run: yarn example --frozen-lockfile
shell: bash
- name: Install Ruby gems
run: gem install cocoapods -v 1.15.2
- name: Install Pods
run: ${{matrix.extraEnv}} pod install
working-directory: example/ios
- name: Build iOS test app
run: xcodebuild -workspace Example.xcworkspace -scheme Example -destination "platform=iOS Simulator,name=iPhone 14" CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO build
working-directory: example/ios
timeout-minutes: 60
16 changes: 16 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,16 @@
name: Lint

on: [push]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
- name: Install dependencies
run: yarn install
- name: Lint
run: yarn lint
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
@@ -1,13 +1,15 @@
name: Release React Native Uploader package
name: Publish package

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
- run: yarn
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/update-documentation.yml
@@ -1,13 +1,15 @@
name: Update readme.io documentation

on:
push:
branches:
- main

jobs:
update-documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Update readme.io documentation
uses: apivideo/api.video-readmeio-document-sync-action@1.2
with:
Expand Down
16 changes: 13 additions & 3 deletions .gitignore
Expand Up @@ -28,25 +28,32 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
.xcode.env.local

# Android/IJ
#
.idea
.classpath
.cxx
.gradle
.idea
.project
.settings
local.properties
android.iml

# Cocoapods
#
example/ios/Pods

# Ruby
example/vendor/

# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
package-lock.json

# BUCK
buck-out/
Expand All @@ -55,7 +62,10 @@ android/app/libs
android/keystores/debug.keystore

# Expo
.expo/*
.expo/

# Turborepo
.turbo/

# generated by bob
lib/
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
v18
1 change: 1 addition & 0 deletions .watchmanconfig
@@ -0,0 +1 @@
{}
48 changes: 41 additions & 7 deletions README.md
Expand Up @@ -14,8 +14,11 @@
- [Getting started](#getting-started)
- [Installation](#installation)
- [Code sample](#code-sample)
- [Android](#android)
- [Permissions](#permissions)
- [Notifications](#notifications)
- [Example](#example)
- [Plugins](#plugins)
- [Dependencies](#dependencies)
- [FAQ](#faq)

<!--</documentation_excluded>-->
Expand Down Expand Up @@ -64,7 +67,7 @@ cd ios && pod install
```js
import ApiVideoUploader from '@api.video/react-native-video-uploader';

ApiVideoUploader.uploadWithUploadToken('MY_VIDEO_TOKEN', 'my-video.mp4')
ApiVideoUploader.uploadWithUploadToken('YOUR_UPLOAD_TOKEN', 'path/to/my-video.mp4')
.then((value: Video) => {
// Manages success here
})
Expand All @@ -73,13 +76,45 @@ ApiVideoUploader.uploadWithUploadToken('MY_VIDEO_TOKEN', 'my-video.mp4')
});
```

### Android

#### Permissions

Permissions `android.permission.READ_MEDIA_VIDEO` (for API 33+) or `android.permission.READ_EXTERNAL_STORAGE` (for API < 33) will be requested by this library at runtime.

On Android 33+, the upload comes with a notification to show the progress. So if your application targets Android 33+, you might request `android.permission.POST_NOTIFICATIONS` permission at runtime.

When targeting Android API Level 34+, you must declare the service type in your application's manifest file.
In your `AndroidManifest.xml` file, add the following lines in the `<application>` tag:

```xml
<service
android:name="androidx.work.impl.foreground.SystemForegroundService"
android:foregroundServiceType="location|dataSync"
tools:node="merge" />
```

#### Notifications

To customize the notification to your own brand, you can change the icon, color or channel name by overwriting the following resources in your own application resources:
- the icon: `R.drawable.ic_upload_notification`
- the color: `R.color.upload_notification_color`
- the channel name: `R.string.upload_notification_channel_name`


## Example

An example that demonstrates how to use the API is provided in folder [example/](https://github.com/apivideo/api.video-reactnative-uploader/tree/master/example).
An example that demonstrates how to use the API is provided in folder [example/](https://github.com/apivideo/api.video-reactnative-uploader/tree/main/example).

To run the example:
- for Android:
`yarn && yarn example android`
- for iOS:
`yarn && yarn example ios`

## Plugins
## Dependencies

api.video-reactnative-uploader is using external native library for upload
api.video-reactnative-uploader is using external libraries.

| Plugin | README |
| ---------------------- | ------------------------ |
Expand All @@ -88,8 +123,7 @@ api.video-reactnative-uploader is using external native library for upload

## FAQ

If you have any questions, ask [our community](https://community.api.video).
Or use [Issues].
If you have any questions, ask [our community](https://community.api.video) or use [Issues].

[//]: # "These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax"
[swift-video-uploader]: https://github.com/apivideo/api.video-swift-uploader
Expand Down

0 comments on commit 6476f2e

Please sign in to comment.