Skip to content

Commit 5d6d881

Browse files
Merge pull request #31 from ionic-team/feat/RMET-4099/camera-unification
feat(android,ios): merge to main
2 parents 5532756 + 9810dbe commit 5d6d881

154 files changed

Lines changed: 25612 additions & 451 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
build
2+
.build
23
dist
4+
example-app

.github/actions/setup-tools/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ runs:
1111
# Ensure npm 11.5.1 or later is installed for Trusted publishing
1212
- name: Update npm
1313
shell: bash
14-
run: npm install -g npm@latest
14+
run: npm install -g npm@~11.10.0
1515
- name: Install dependencies
1616
shell: bash
1717
run: npm i
18+
- name: Set Xcode 26.0 # minimum support Xcode version by Capacitor 8
19+
if: runner.os == 'macOS'
20+
shell: bash
21+
run: sudo xcode-select --switch /Applications/Xcode_26.0.app

.github/workflows/continuous_integration.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: 'macos-15'
2828
timeout-minutes: 30
2929
steps:
30-
- uses: actions/checkout@v5
30+
- uses: actions/checkout@v6
3131
- name: 'Setup Tools'
3232
uses: ./.github/actions/setup-tools
3333
- name: 'Verify Android'
@@ -38,8 +38,36 @@ jobs:
3838
runs-on: 'macos-15'
3939
timeout-minutes: 30
4040
steps:
41-
- uses: actions/checkout@v5
41+
- uses: actions/checkout@v6
4242
- name: 'Setup Tools'
4343
uses: ./.github/actions/setup-tools
4444
- name: 'Verify iOS'
4545
run: npm run verify:ios
46+
47+
build-example-app-android:
48+
needs: ['verify-plugin-ios', 'verify-plugin-android']
49+
runs-on: 'macos-15'
50+
timeout-minutes: 30
51+
steps:
52+
- uses: actions/checkout@v6
53+
- name: 'Setup Tools'
54+
uses: ./.github/actions/setup-tools
55+
- name: 'Prepare example app'
56+
uses: ./.github/actions/prepare-example-app
57+
- name: 'Build Android example app'
58+
working-directory: ./example-app/android
59+
run: ./gradlew clean assembleDebug
60+
61+
build-example-app-ios:
62+
needs: ['verify-plugin-ios', 'verify-plugin-android']
63+
runs-on: 'macos-15'
64+
timeout-minutes: 30
65+
steps:
66+
- uses: actions/checkout@v6
67+
- name: 'Setup Tools'
68+
uses: ./.github/actions/setup-tools
69+
- name: 'Prepare example app'
70+
uses: ./.github/actions/prepare-example-app
71+
- name: 'Build iOS example app'
72+
working-directory: ./example-app/ios/App
73+
run: xcodebuild clean build -project App.xcodeproj -scheme App CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

.github/workflows/reusable_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: "ubuntu-24.04"
1212
timeout-minutes: 30
1313
steps:
14-
- uses: actions/checkout@v5
14+
- uses: actions/checkout@v6
1515
with:
1616
fetch-depth: 0
1717
token: ${{ secrets.THE_GH_RELEASE_TOKEN || github.token }}

.github/workflows/reusable_lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: 'macos-15'
1212
timeout-minutes: 30
1313
steps:
14-
- uses: actions/checkout@v5
14+
- uses: actions/checkout@v6
1515
with:
1616
token: ${{ secrets.THE_GH_RELEASE_TOKEN || github.token }}
1717

.github/workflows/reusable_setup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ${{ matrix.os }}
1515
timeout-minutes: 30
1616
steps:
17-
- uses: actions/checkout@v5
17+
- uses: actions/checkout@v6
1818
with:
1919
token: ${{ secrets.THE_GH_RELEASE_TOKEN || github.token }}
2020

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
.build
3+
dist
4+
example-app

CONTRIBUTING.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Contributing
2+
3+
This guide provides instructions for contributing to this Capacitor plugin.
4+
5+
## Native code
6+
7+
This repository contains minimal code for native Android and iOS. The implementation for native mobile exists in separate repositories:
8+
9+
- [Contributing for Android](https://github.com/ionic-team/ion-android-camera?tab=readme-ov-file#contributing)
10+
- [Contributing for iOS](https://github.com/ionic-team/ion-ios-camera?tab=readme-ov-file#contributing)
11+
12+
## Developing
13+
14+
### Local Setup
15+
16+
1. Fork and clone the repo.
17+
2. Install the dependencies to use the plugin.
18+
19+
```shell
20+
npm install
21+
```
22+
23+
3. Install SwiftLint if you're on macOS.
24+
25+
```shell
26+
brew install swiftlint
27+
```
28+
29+
### Scripts
30+
31+
#### `npm run build`
32+
33+
Build the plugin web assets and generate plugin API documentation using [`@capacitor/docgen`](https://github.com/ionic-team/capacitor-docgen).
34+
35+
It will compile the TypeScript code from `src/` into ESM JavaScript in `dist/esm/`. These files are used in apps with bundlers when your plugin is imported.
36+
37+
Then, Rollup will bundle the code into a single file at `dist/plugin.js`. This file is used in apps without bundlers by including it as a script in `index.html`.
38+
39+
#### `npm run verify`
40+
41+
Build and validate the web and native projects.
42+
43+
This is run in CI to verify that the plugin builds for all platforms.
44+
45+
#### `npm run lint` / `npm run fmt`
46+
47+
Check formatting and code quality, autoformat/autofix if possible.
48+
49+
The `lint` command is run in CI. We recommend running `lint` and/or `fmt` before opening a PR,
50+
51+
## Commits/PR's
52+
53+
Commits and PR's should use the [conventional-commits](https://www.conventionalcommits.org/) format so the release process can version and create changelog correctly.
54+
55+
## Publishing
56+
57+
Publishing is automated based on the branch committed to. When a commit or merge is made to a branch a release that corresponds with the branch will be created (main requires manual trigger):
58+
59+
| Branch Name | Build Type | NPM Tag | Example NPM Version |
60+
| ----------- | ----------------------------- | ------- | ---------------------------------- |
61+
| development | dev | dev | @capacitor/camera@1.0.0-dev.1 |
62+
| next | next (these are betas/alphas) | next | @capacitor/camera@1.0.0-next.1 |
63+
| main | latest | latest | @capacitor/camera@1.0.0 |
64+
65+
- In general new developments will go straight to `main`. If we want to have non-stable versions (e.g. for new Capacitor versions or when there are many changes), we may use `next` or `development` branch, and then once they are ready for stable version, open a PR to main (should be merged to keep commit hashes for `semantic-release`).
66+
67+
> **Note**: The [`files`](https://docs.npmjs.com/cli/configuring-npm/package-json) array in `package.json` specifies which files get published. If you rename files/directories or add files elsewhere, you may need to update it.

CapacitorCamera.podspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ Pod::Spec.new do |s|
99
s.license = package['license']
1010
s.homepage = 'https://capacitorjs.com'
1111
s.author = package['author']
12-
s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
13-
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'camera/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
12+
s.source = { :git => 'https://github.com/ionic-team/capacitor-camera.git', :tag => "v#{s.version}" }
13+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}',
1414
s.ios.deployment_target = '15.0'
1515
s.dependency 'Capacitor'
16+
s.dependency 'IONCameraLib', spec='~> 1.0.0'
1617
s.swift_version = '5.1'
1718
end

Package.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ let package = Package(
1010
targets: ["CameraPlugin"])
1111
],
1212
dependencies: [
13-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
13+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
14+
.package(url: "https://github.com/ionic-team/ion-ios-camera.git", from: "1.0.0")
1415
],
1516
targets: [
1617
.target(
1718
name: "CameraPlugin",
1819
dependencies: [
1920
.product(name: "Capacitor", package: "capacitor-swift-pm"),
20-
.product(name: "Cordova", package: "capacitor-swift-pm")
21+
.product(name: "Cordova", package: "capacitor-swift-pm"),
22+
.product(name: "IONCameraLib", package: "ion-ios-camera")
2123
],
2224
path: "ios/Sources/CameraPlugin"),
2325
.testTarget(

0 commit comments

Comments
 (0)