Skip to content

Commit

Permalink
feat: add barcode scanner plugin (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Sep 14, 2023
1 parent eccd6f9 commit 454428c
Show file tree
Hide file tree
Showing 84 changed files with 2,992 additions and 27 deletions.
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 @@ -60,6 +61,7 @@
"publish": false,
"dependencies": [
"app-js",
"barcode-scanner-js",
"log-js",
"cli-js",
"clipboard-manager-js",
Expand Down Expand Up @@ -112,6 +114,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 @@ -6,4 +6,5 @@ pnpm-lock.yaml
Cargo.lock
.build
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.8",
"@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.2" }
tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", version = "2.0.0-alpha.2" }
tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-alpha.2" }

[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/@[email protected]/node_modules/@tauri-apps/cli/tauri.js", "android", "android-studio-script");

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": "[email protected]",
"scale": "2x"
},
{
"size": "20x20",
"idiom": "iphone",
"filename": "[email protected]",
"scale": "3x"
},
{
"size": "29x29",
"idiom": "iphone",
"filename": "[email protected]",
"scale": "2x"
},
{
"size": "29x29",
"idiom": "iphone",
"filename": "[email protected]",
"scale": "3x"
},
{
"size": "40x40",
"idiom": "iphone",
"filename": "[email protected]",
"scale": "2x"
},
{
"size": "40x40",
"idiom": "iphone",
"filename": "[email protected]",
"scale": "3x"
},
{
"size": "60x60",
"idiom": "iphone",
"filename": "[email protected]",
"scale": "2x"
},
{
"size": "60x60",
"idiom": "iphone",
"filename": "[email protected]",
"scale": "3x"
},
{
"size": "20x20",
"idiom": "ipad",
"filename": "[email protected]",
"scale": "1x"
},
{
"size": "20x20",
"idiom": "ipad",
"filename": "[email protected]",
"scale": "2x"
},
{
"size": "29x29",
"idiom": "ipad",
"filename": "[email protected]",
"scale": "1x"
},
{
"size": "29x29",
"idiom": "ipad",
"filename": "[email protected]",
"scale": "2x"
},
{
"size": "40x40",
"idiom": "ipad",
"filename": "[email protected]",
"scale": "1x"
},
{
"size": "40x40",
"idiom": "ipad",
"filename": "[email protected]",
"scale": "2x"
},
{
"size": "76x76",
"idiom": "ipad",
"filename": "[email protected]",
"scale": "1x"
},
{
"size": "76x76",
"idiom": "ipad",
"filename": "[email protected]",
"scale": "2x"
},
{
"size": "83.5x83.5",
"idiom": "ipad",
"filename": "[email protected]",
"scale": "2x"
},
{
"size": "1024x1024",
"idiom": "ios-marketing",
"filename": "[email protected]",
"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

0 comments on commit 454428c

Please sign in to comment.