Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/new arch support #4

Merged
merged 25 commits into from Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9ff76f6
feat(*): add support for new architecture
ThibaultBee Aug 1, 2023
213f72b
fix(ci): use macos-13 as a workaround to build for iOS
ThibaultBee Aug 3, 2023
a117d21
feat(android): check read video permission before uploading a file
ThibaultBee Aug 4, 2023
38991e6
feat(android): use workmanager to support upload in background
ThibaultBee Aug 8, 2023
e37853d
feat(*): request read video permission directly in the Android library
ThibaultBee Aug 10, 2023
bf4ee3f
feat(*): add API to set timeout
ThibaultBee Aug 10, 2023
2ae4b60
feat(*): add API to upload by upload token and video id
ThibaultBee Aug 10, 2023
40bcbef
feat(example): add launcher icon
ThibaultBee Aug 11, 2023
6e5f5ed
doc(README): add how to generate the sample
ThibaultBee Aug 11, 2023
6adceaf
chore(src): rename types file
ThibaultBee Aug 11, 2023
e7cc7ba
chore(android): rename legacy and turbo folders
ThibaultBee Aug 11, 2023
be3ecc2
chore(ci): add release from changelog workflow
ThibaultBee Aug 17, 2023
eb7d272
chore(ci): add lint workflow
ThibaultBee Aug 17, 2023
36199b5
chore(android): rename TAG to UploaderModule
ThibaultBee Aug 18, 2023
93b9062
feat(android): merge architecture from flutter
ThibaultBee Aug 25, 2023
76feb1f
feat(ios): merge architecture from flutter
ThibaultBee Aug 28, 2023
629b42b
feat(*): upgrade to RN 0.73
ThibaultBee Dec 7, 2023
d7acd2c
chore(ci): upgrade workflow actions
ThibaultBee Dec 7, 2023
f4c40a1
feat(package.json): add keyword
ThibaultBee Dec 7, 2023
f71363f
fix(ci): macos-13 to build ios part instead of macos-latest
ThibaultBee Dec 8, 2023
88910a9
fix(android): fix upload when targeting Android >= 34
ThibaultBee Dec 18, 2023
001cfe6
feat(android): remove already required permissions
ThibaultBee Dec 18, 2023
f06358d
chore(android): upgrade to android video uploader 1.3.4
ThibaultBee Feb 12, 2024
6396a8d
feat(*): upgrade to RN 0.73.4
ThibaultBee Feb 15, 2024
6387a7e
fix(ios): fix error on ci due to errno::EEXIST - File exists @ syserr…
ThibaultBee Feb 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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