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

feat: add barcode scanner plugin #536

Merged
merged 49 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0a96087
feat: add Android impl
lucasfernog May 4, 2023
0c40714
Merge branch 'v2' into feat/scanner
lucasfernog May 5, 2023
ad8338e
update example
lucasfernog May 6, 2023
b9462bd
Merge remote-tracking branch 'origin/v2' into feat/scanner
lucasfernog Jun 15, 2023
8c0b2ec
feat: ios impl
lucasfernog Jun 15, 2023
7907c67
run fmt
lucasfernog Jun 16, 2023
2aa719c
remove prepare command
lucasfernog Jun 21, 2023
da4c7eb
update doc
lucasfernog Jun 21, 2023
36f9475
Merge remote-tracking branch 'origin/v2' into feat/scanner
lucasfernog Jun 21, 2023
3384970
adjust version
lucasfernog Jun 21, 2023
4024c70
fix race condition
lucasfernog Jun 22, 2023
fd3f898
add sponsors
lucasfernog Aug 7, 2023
8419ca5
add banner [skip ci]
lucasfernog Aug 7, 2023
f47737a
add metadata [skip ci]
lucasfernog Aug 7, 2023
666d185
Merge remote-tracking branch 'origin/v2' into feat/scanner
lucasfernog Aug 15, 2023
78c335d
add CN [skip ci]
lucasfernog Aug 15, 2023
cb448cc
white bg [skip ci]
lucasfernog Aug 15, 2023
74427f0
update api
lucasfernog Sep 5, 2023
1204326
update example [skip ci]
lucasfernog Sep 5, 2023
9f1bec6
license headers
lucasfernog Sep 5, 2023
d70bd92
fmt
lucasfernog Sep 5, 2023
fe1d288
update example mobile projects
lucasfernog Sep 5, 2023
6b008f4
docs [skip ci]
lucasfernog Sep 5, 2023
f5c54ae
ask for permission
lucasfernog Sep 7, 2023
7a11f3f
fix api
lucasfernog Sep 7, 2023
a12dce4
fmt
lucasfernog Sep 7, 2023
cbf57b3
license header
lucasfernog Sep 7, 2023
316a958
prepare release [skip ci]
lucasfernog Sep 7, 2023
ed3fb58
Merge branch 'v2' into feat/scanner
lucasfernog Sep 7, 2023
8d20f22
fix cancel code
lucasfernog Sep 7, 2023
c684a31
add cancel example
lucasfernog Sep 7, 2023
0be4a2c
fix permission state
lucasfernog Sep 9, 2023
e4fe0d7
Merge remote-tracking branch 'origin/v2' into feat/scanner
lucasfernog Sep 13, 2023
e172437
contributed by instead of sponsors
lucasfernog Sep 13, 2023
83f50ff
fmt
lucasfernog Sep 13, 2023
6ccc0cb
bg color [skip ci]
lucasfernog Sep 13, 2023
d3a6e5b
style [skip ci]
lucasfernog Sep 13, 2023
26f52c1
attempt theme urls [skip ci]
lucasfernog Sep 13, 2023
7dc728a
Revert "attempt theme urls [skip ci]"
lucasfernog Sep 13, 2023
60a89c2
fix links [skip ci]
lucasfernog Sep 13, 2023
c325d4f
raw imgs [skip ci]
lucasfernog Sep 13, 2023
3790ed5
adjust [skip ci]
lucasfernog Sep 14, 2023
24185a9
light
lucasfernog Sep 14, 2023
9e54d2a
width
lucasfernog Sep 14, 2023
27149e7
update
lucasfernog Sep 14, 2023
cd7f2f9
update svg
lucasfernog Sep 14, 2023
33e60de
change color
lucasfernog Sep 14, 2023
a7a5014
colored impierce
lucasfernog Sep 14, 2023
3fc8509
Merge remote-tracking branch 'origin/v2' into feat/scanner
lucasfernog Sep 14, 2023
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
11 changes: 11 additions & 0 deletions .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"publish": false,
"dependencies": [
"app",
"barcode-scanner",
"log-plugin",
"cli",
"clipboard-manager",
Expand All @@ -61,6 +62,7 @@
"publish": false,
"dependencies": [
"app-js",
"barcode-scanner-js",
"log-js",
"cli-js",
"clipboard-manager-js",
Expand Down Expand Up @@ -104,6 +106,15 @@
"manager": "javascript"
},

"barcode-scanner": {
"path": "./plugins/barcode-scanner",
"manager": "rust"
},
"barcode-scanner-js": {
"path": "./plugins/barcode-scanner",
"manager": "javascript"
},

"cli": {
"path": "./plugins/cli",
"manager": "rust"
Expand Down
6 changes: 6 additions & 0 deletions .changes/scanner-initial-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"barcode-scanner": major
"barcode-scanner-js": major
---

Initial release.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dist-js
pnpm-lock.yaml
Cargo.lock
.build
api-iife.js
api-iife.js
intermediates/
5 changes: 4 additions & 1 deletion .scripts/ci/check-license-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const ignore = [
"dist-js",
".svelte-kit",
"api-iife.js",
".build",
];

async function checkFile(file) {
Expand Down Expand Up @@ -70,7 +71,9 @@ async function checkFile(file) {
async function check(src) {
const missingHeader = [];

for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
for (const entry of fs.readdirSync(src, {
withFileTypes: true,
})) {
const p = path.join(src, entry.name);

if (entry.isSymbolicLink() || ignore.includes(entry.name)) {
Expand Down
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.6",
"@tauri-apps/plugin-app": "2.0.0-alpha.1",
"@tauri-apps/plugin-barcode-scanner": "1.0.0",
"@tauri-apps/plugin-cli": "2.0.0-alpha.1",
"@tauri-apps/plugin-clipboard-manager": "2.0.0-alpha.1",
"@tauri-apps/plugin-dialog": "2.0.0-alpha.1",
Expand Down
3 changes: 3 additions & 0 deletions examples/api/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ tauri-plugin-cli = { path = "../../../plugins/cli", version = "2.0.0-alpha.1" }
tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.0.0-alpha.1" }
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-alpha.1" }

[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]
tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "1.0.0" }

[target."cfg(target_os = \"windows\")".dependencies]
window-shadows = "0.2"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.api" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<style name="Theme.api" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.api" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<style name="Theme.api" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ open class BuildTask : DefaultTask() {

@TaskAction
fun assemble() {
val executable = """pnpm""";
val executable = """node""";
try {
runTauriCli(executable)
} catch (e: Exception) {
Expand All @@ -32,7 +32,7 @@ open class BuildTask : DefaultTask() {
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
val target = target ?: throw GradleException("target cannot be null")
val release = release ?: throw GradleException("release cannot be null")
val args = listOf("tauri", "android", "android-studio-script");
val args = listOf("/Users/lucas/projects/tauri/plugins-workspace/examples/api/./node_modules/.bin/../../../../node_modules/.pnpm/@tauri-apps+cli@2.0.0-alpha.12/node_modules/@tauri-apps/cli/tauri.js", "android", "android-studio-script");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local path


project.exec {
workingDir(File(project.projectDir, rootDirRel))
Expand Down
3 changes: 3 additions & 0 deletions examples/api/src-tauri/gen/apple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
xcuserdata/
build/
Externals/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"images": [
{
"size": "20x20",
"idiom": "iphone",
"filename": "AppIcon-20x20@2x.png",
"scale": "2x"
},
{
"size": "20x20",
"idiom": "iphone",
"filename": "AppIcon-20x20@3x.png",
"scale": "3x"
},
{
"size": "29x29",
"idiom": "iphone",
"filename": "AppIcon-29x29@2x-1.png",
"scale": "2x"
},
{
"size": "29x29",
"idiom": "iphone",
"filename": "AppIcon-29x29@3x.png",
"scale": "3x"
},
{
"size": "40x40",
"idiom": "iphone",
"filename": "AppIcon-40x40@2x.png",
"scale": "2x"
},
{
"size": "40x40",
"idiom": "iphone",
"filename": "AppIcon-40x40@3x.png",
"scale": "3x"
},
{
"size": "60x60",
"idiom": "iphone",
"filename": "AppIcon-60x60@2x.png",
"scale": "2x"
},
{
"size": "60x60",
"idiom": "iphone",
"filename": "AppIcon-60x60@3x.png",
"scale": "3x"
},
{
"size": "20x20",
"idiom": "ipad",
"filename": "AppIcon-20x20@1x.png",
"scale": "1x"
},
{
"size": "20x20",
"idiom": "ipad",
"filename": "AppIcon-20x20@2x-1.png",
"scale": "2x"
},
{
"size": "29x29",
"idiom": "ipad",
"filename": "AppIcon-29x29@1x.png",
"scale": "1x"
},
{
"size": "29x29",
"idiom": "ipad",
"filename": "AppIcon-29x29@2x.png",
"scale": "2x"
},
{
"size": "40x40",
"idiom": "ipad",
"filename": "AppIcon-40x40@1x.png",
"scale": "1x"
},
{
"size": "40x40",
"idiom": "ipad",
"filename": "AppIcon-40x40@2x-1.png",
"scale": "2x"
},
{
"size": "76x76",
"idiom": "ipad",
"filename": "AppIcon-76x76@1x.png",
"scale": "1x"
},
{
"size": "76x76",
"idiom": "ipad",
"filename": "AppIcon-76x76@2x.png",
"scale": "2x"
},
{
"size": "83.5x83.5",
"idiom": "ipad",
"filename": "AppIcon-83.5x83.5@2x.png",
"scale": "2x"
},
{
"size": "1024x1024",
"idiom": "ios-marketing",
"filename": "AppIcon-512@2x.png",
"scale": "1x"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info": {
"version": 1,
"author": "xcode"
}
}
8 changes: 8 additions & 0 deletions examples/api/src-tauri/gen/apple/ExportOptions.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>development</string>
</dict>
</plist>
21 changes: 21 additions & 0 deletions examples/api/src-tauri/gen/apple/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Uncomment the next line to define a global platform for your project

target 'api_iOS' do
platform :ios, '13.0'
# Pods for api_iOS
end

target 'api_macOS' do
platform :osx, '11.0'
# Pods for api_macOS
end

# Delete the deployment target for iOS and macOS, causing it to be inherited from the Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings.delete 'MACOSX_DEPLOYMENT_TARGET'
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

namespace ffi {
extern "C" {
void start_app();
}
}

6 changes: 6 additions & 0 deletions examples/api/src-tauri/gen/apple/Sources/api/main.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "bindings/bindings.h"

int main(int argc, char * argv[]) {
ffi::start_app();
return 0;
}
Loading