diff --git a/Cargo.lock b/Cargo.lock index ac3e1bd6..76e8e73a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5158,7 +5158,7 @@ dependencies = [ [[package]] name = "tauri-plugin-barcode-scanner" -version = "0.0.0" +version = "1.0.0" dependencies = [ "log", "serde", diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index cf30b3a8..aac427de 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -47,7 +47,7 @@ tauri-plugin-global-shortcut = { path = "../../../plugins/global-shortcut", vers tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-alpha.0" } [target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies] -tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner" } +tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "1.0.0" } [target."cfg(target_os = \"windows\")".dependencies] window-shadows = "0.2" diff --git a/examples/api/src-tauri/gen/apple/.gitignore b/examples/api/src-tauri/gen/apple/.gitignore new file mode 100644 index 00000000..6726e2f8 --- /dev/null +++ b/examples/api/src-tauri/gen/apple/.gitignore @@ -0,0 +1,3 @@ +xcuserdata/ +build/ +Externals/ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png new file mode 100644 index 00000000..f8b128e3 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png new file mode 100644 index 00000000..6bbd9e3c Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png new file mode 100644 index 00000000..6bbd9e3c Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png new file mode 100644 index 00000000..f702cc04 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png new file mode 100644 index 00000000..c5e92f78 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png new file mode 100644 index 00000000..1c607d5c Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png new file mode 100644 index 00000000..1c607d5c Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png new file mode 100644 index 00000000..60e93a6a Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png new file mode 100644 index 00000000..6bbd9e3c Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png new file mode 100644 index 00000000..819410f9 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png new file mode 100644 index 00000000..819410f9 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png new file mode 100644 index 00000000..e00ae5a6 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png new file mode 100644 index 00000000..f5301f37 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512x512@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512x512@2x.png new file mode 100644 index 00000000..5e9add73 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-512x512@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png new file mode 100644 index 00000000..e00ae5a6 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png new file mode 100644 index 00000000..3546ca10 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png new file mode 100644 index 00000000..d8367101 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png new file mode 100644 index 00000000..29925f2a Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png new file mode 100644 index 00000000..dfd22619 Binary files /dev/null and b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png differ diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/Contents.json b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..90eea7ec --- /dev/null +++ b/examples/api/src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -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" + } +} \ No newline at end of file diff --git a/examples/api/src-tauri/gen/apple/Assets.xcassets/Contents.json b/examples/api/src-tauri/gen/apple/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/examples/api/src-tauri/gen/apple/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/api/src-tauri/gen/apple/ExportOptions.plist b/examples/api/src-tauri/gen/apple/ExportOptions.plist new file mode 100644 index 00000000..b69cf1de --- /dev/null +++ b/examples/api/src-tauri/gen/apple/ExportOptions.plist @@ -0,0 +1,8 @@ + + + + + method + development + + diff --git a/examples/api/src-tauri/gen/apple/Podfile b/examples/api/src-tauri/gen/apple/Podfile new file mode 100644 index 00000000..90e8885d --- /dev/null +++ b/examples/api/src-tauri/gen/apple/Podfile @@ -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 diff --git a/examples/api/src-tauri/gen/apple/Sources/api/bindings/bindings.h b/examples/api/src-tauri/gen/apple/Sources/api/bindings/bindings.h new file mode 100644 index 00000000..51522007 --- /dev/null +++ b/examples/api/src-tauri/gen/apple/Sources/api/bindings/bindings.h @@ -0,0 +1,8 @@ +#pragma once + +namespace ffi { + extern "C" { + void start_app(); + } +} + diff --git a/examples/api/src-tauri/gen/apple/Sources/api/main.mm b/examples/api/src-tauri/gen/apple/Sources/api/main.mm new file mode 100644 index 00000000..7793a9d5 --- /dev/null +++ b/examples/api/src-tauri/gen/apple/Sources/api/main.mm @@ -0,0 +1,6 @@ +#include "bindings/bindings.h" + +int main(int argc, char * argv[]) { + ffi::start_app(); + return 0; +} diff --git a/examples/api/src-tauri/gen/apple/api.xcodeproj/project.pbxproj b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.pbxproj new file mode 100644 index 00000000..7683a9e5 --- /dev/null +++ b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.pbxproj @@ -0,0 +1,448 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 2ECFC1BC47D948875C8CEC41 /* libapi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FC53D4128D7F74E4E6338455 /* libapi.a */; }; + 3043432501C9BC2DB6B4CB95 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71EB788DE4662CFC0D97F567 /* CoreGraphics.framework */; }; + 328B4ADB3700C1873BEB7B10 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 90D3B673AFAB8D8AB561F616 /* main.mm */; }; + 6F379F15DA085785BA2624D4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6B7E79E23E646BA7968B457C /* Assets.xcassets */; }; + 9AADB041D25772D04E543F15 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62601E25FA39E62BE119B74D /* Metal.framework */; }; + 9DDA3BE70DD0E4013973FE38 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6082E363D51372A7658C351 /* UIKit.framework */; }; + AFA0CA286325FD7A34968CA2 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 384966E551417F94A02D2706 /* Security.framework */; }; + B60763BD194DFACA215EC7DA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC377692DC31A070A0188C9D /* QuartzCore.framework */; }; + C6D80743F168BDF017B7769E /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 59CFE20DCF760BE67D9CE3D6 /* WebKit.framework */; }; + DFFF888045C8D9D9FB69E8FD /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 338E66700FD330B99D434DD7 /* MetalKit.framework */; }; + F86717F05E27C72C9FA1FB27 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = 74A8FDFB350B966F5AAD4A24 /* assets */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0E96CE07CD20273DD46BF325 /* main.rs */ = {isa = PBXFileReference; path = main.rs; sourceTree = ""; }; + 1C1AB1B414CA2795AFBEDDB9 /* tray.rs */ = {isa = PBXFileReference; path = tray.rs; sourceTree = ""; }; + 338E66700FD330B99D434DD7 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; }; + 384966E551417F94A02D2706 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 59CFE20DCF760BE67D9CE3D6 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + 5AC703CEBA41A121596066F3 /* api_iOS.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = api_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 62601E25FA39E62BE119B74D /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; + 6B7E79E23E646BA7968B457C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 71EB788DE4662CFC0D97F567 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 74A8FDFB350B966F5AAD4A24 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = assets; sourceTree = SOURCE_ROOT; }; + 785D025E9542F7E098BF22B5 /* lib.rs */ = {isa = PBXFileReference; path = lib.rs; sourceTree = ""; }; + 90D3B673AFAB8D8AB561F616 /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; + B6082E363D51372A7658C351 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + DC377692DC31A070A0188C9D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + EC8C7948C50C3C9B5D96CB61 /* bindings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bindings.h; sourceTree = ""; }; + F835F52713CE8F029D5D252C /* cmd.rs */ = {isa = PBXFileReference; path = cmd.rs; sourceTree = ""; }; + FC53D4128D7F74E4E6338455 /* libapi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libapi.a; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 11E18DCDB3ADFE87C18915EF /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2ECFC1BC47D948875C8CEC41 /* libapi.a in Frameworks */, + 3043432501C9BC2DB6B4CB95 /* CoreGraphics.framework in Frameworks */, + 9AADB041D25772D04E543F15 /* Metal.framework in Frameworks */, + DFFF888045C8D9D9FB69E8FD /* MetalKit.framework in Frameworks */, + B60763BD194DFACA215EC7DA /* QuartzCore.framework in Frameworks */, + AFA0CA286325FD7A34968CA2 /* Security.framework in Frameworks */, + 9DDA3BE70DD0E4013973FE38 /* UIKit.framework in Frameworks */, + C6D80743F168BDF017B7769E /* WebKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0677CEAF1F282F38CBA0F140 = { + isa = PBXGroup; + children = ( + 74A8FDFB350B966F5AAD4A24 /* assets */, + 6B7E79E23E646BA7968B457C /* Assets.xcassets */, + 86D903732E10FAC4D300E8DF /* Externals */, + 7A9A7AC155D9E22E54D6D847 /* Sources */, + CF9AA87D2F6E9C389B7AB70B /* src */, + 10C9FC3FA3E12D6A4A67999D /* Frameworks */, + 4AC51E67B71E27F15B02C5CD /* Products */, + ); + sourceTree = ""; + }; + 07051859D6E2D8109C8FB128 /* bindings */ = { + isa = PBXGroup; + children = ( + EC8C7948C50C3C9B5D96CB61 /* bindings.h */, + ); + path = bindings; + sourceTree = ""; + }; + 10C9FC3FA3E12D6A4A67999D /* Frameworks */ = { + isa = PBXGroup; + children = ( + 71EB788DE4662CFC0D97F567 /* CoreGraphics.framework */, + FC53D4128D7F74E4E6338455 /* libapi.a */, + 62601E25FA39E62BE119B74D /* Metal.framework */, + 338E66700FD330B99D434DD7 /* MetalKit.framework */, + DC377692DC31A070A0188C9D /* QuartzCore.framework */, + 384966E551417F94A02D2706 /* Security.framework */, + B6082E363D51372A7658C351 /* UIKit.framework */, + 59CFE20DCF760BE67D9CE3D6 /* WebKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4AC51E67B71E27F15B02C5CD /* Products */ = { + isa = PBXGroup; + children = ( + 5AC703CEBA41A121596066F3 /* api_iOS.app */, + ); + name = Products; + sourceTree = ""; + }; + 7A9A7AC155D9E22E54D6D847 /* Sources */ = { + isa = PBXGroup; + children = ( + A3574F52DBC5463B9C3D043D /* api */, + ); + path = Sources; + sourceTree = ""; + }; + 86D903732E10FAC4D300E8DF /* Externals */ = { + isa = PBXGroup; + children = ( + ); + path = Externals; + sourceTree = ""; + }; + A3574F52DBC5463B9C3D043D /* api */ = { + isa = PBXGroup; + children = ( + 90D3B673AFAB8D8AB561F616 /* main.mm */, + 07051859D6E2D8109C8FB128 /* bindings */, + ); + path = api; + sourceTree = ""; + }; + CF9AA87D2F6E9C389B7AB70B /* src */ = { + isa = PBXGroup; + children = ( + F835F52713CE8F029D5D252C /* cmd.rs */, + 785D025E9542F7E098BF22B5 /* lib.rs */, + 0E96CE07CD20273DD46BF325 /* main.rs */, + 1C1AB1B414CA2795AFBEDDB9 /* tray.rs */, + ); + name = src; + path = ../../src; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 54DC6E273C78071F3BA12EF3 /* api_iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 01CBC40275452376830D79B1 /* Build configuration list for PBXNativeTarget "api_iOS" */; + buildPhases = ( + FF948951157DE71465B5BD5F /* Build Rust Code */, + 71E73CC9AB5F1323EC1F6365 /* Sources */, + CA2BEC44B6EDA1F21B6155CD /* Resources */, + 11E18DCDB3ADFE87C18915EF /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = api_iOS; + productName = api_iOS; + productReference = 5AC703CEBA41A121596066F3 /* api_iOS.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9BC88C3717DA5D4B78A51C15 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1200; + TargetAttributes = { + 54DC6E273C78071F3BA12EF3 = { + DevelopmentTeam = Q93MBH6S2F; + }; + }; + }; + buildConfigurationList = 8FA67D0F928A09CD639137D1 /* Build configuration list for PBXProject "api" */; + compatibilityVersion = "Xcode 11.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = 0677CEAF1F282F38CBA0F140; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 54DC6E273C78071F3BA12EF3 /* api_iOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + CA2BEC44B6EDA1F21B6155CD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6F379F15DA085785BA2624D4 /* Assets.xcassets in Resources */, + F86717F05E27C72C9FA1FB27 /* assets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + FF948951157DE71465B5BD5F /* Build Rust Code */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Build Rust Code"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(SRCROOT)/target/aarch64-apple-ios/${CONFIGURATION}/deps/libapi.a", + "$(SRCROOT)/target/x86_64-apple-ios/${CONFIGURATION}/deps/libapi.a", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "node /Users/lucas/projects/tauri/plugins-workspace/examples/api/./node_modules/.bin/../../../../node_modules/.pnpm/@tauri-apps+cli@2.0.0-alpha.9/node_modules/@tauri-apps/cli/tauri.js ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths \"${FRAMEWORK_SEARCH_PATHS:?}\" --header-search-paths \"${HEADER_SEARCH_PATHS:?}\" --gcc-preprocessor-definitions \"${GCC_PREPROCESSOR_DEFINITIONS:-}\" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?}"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 71E73CC9AB5F1323EC1F6365 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 328B4ADB3700C1873BEB7B10 /* main.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + A83F70B4C02DD0222038C7F1 /* release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + }; + name = release; + }; + B6AD77E490F315562F75D3D7 /* debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = debug; + }; + BF284FE6E7AE0C8DDCCE398B /* debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ARCHS = ( + arm64, + "arm64-sim", + ); + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = Q93MBH6S2F; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\".\"", + ); + INFOPLIST_FILE = api_iOS/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; + "LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; + "LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api; + PRODUCT_NAME = api; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "arm64 arm64-sim"; + }; + name = debug; + }; + DB0E254D0FD84970B57F6410 /* release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ARCHS = ( + arm64, + "arm64-sim", + ); + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = Q93MBH6S2F; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\".\"", + ); + INFOPLIST_FILE = api_iOS/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + "LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; + "LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; + "LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api; + PRODUCT_NAME = api; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "arm64 arm64-sim"; + }; + name = release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 01CBC40275452376830D79B1 /* Build configuration list for PBXNativeTarget "api_iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BF284FE6E7AE0C8DDCCE398B /* debug */, + DB0E254D0FD84970B57F6410 /* release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = debug; + }; + 8FA67D0F928A09CD639137D1 /* Build configuration list for PBXProject "api" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B6AD77E490F315562F75D3D7 /* debug */, + A83F70B4C02DD0222038C7F1 /* release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9BC88C3717DA5D4B78A51C15 /* Project object */; +} diff --git a/examples/api/src-tauri/gen/apple/api.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/examples/api/src-tauri/gen/apple/api.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..ac90d5ac --- /dev/null +++ b/examples/api/src-tauri/gen/apple/api.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,10 @@ + + + + + BuildSystemType + Original + DisableBuildSystemDeprecationDiagnostic + + + diff --git a/examples/api/src-tauri/gen/apple/api.xcodeproj/xcshareddata/xcschemes/api_iOS.xcscheme b/examples/api/src-tauri/gen/apple/api.xcodeproj/xcshareddata/xcschemes/api_iOS.xcscheme new file mode 100644 index 00000000..a85d0d05 --- /dev/null +++ b/examples/api/src-tauri/gen/apple/api.xcodeproj/xcshareddata/xcschemes/api_iOS.xcscheme @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/api/src-tauri/gen/apple/api_iOS/Info.plist b/examples/api/src-tauri/gen/apple/api_iOS/Info.plist new file mode 100644 index 00000000..76115824 --- /dev/null +++ b/examples/api/src-tauri/gen/apple/api_iOS/Info.plist @@ -0,0 +1,46 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 2.0.0 + CFBundleVersion + 2.0.0 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + arm64 + metal + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + NSCameraUsageDescription + To be able to scan barcodes + + diff --git a/examples/api/src-tauri/gen/apple/project.yml b/examples/api/src-tauri/gen/apple/project.yml new file mode 100644 index 00000000..514a2fb9 --- /dev/null +++ b/examples/api/src-tauri/gen/apple/project.yml @@ -0,0 +1,85 @@ +name: api +options: + bundleIdPrefix: com.tauri + deploymentTarget: + iOS: 13.0 +fileGroups: [../../src] +configs: + debug: debug + release: release +settingGroups: + app: + base: + PRODUCT_NAME: api + PRODUCT_BUNDLE_IDENTIFIER: com.tauri.api + DEVELOPMENT_TEAM: Q93MBH6S2F +targetTemplates: + app: + type: application + sources: + - path: Sources + scheme: + environmentVariables: + RUST_BACKTRACE: full + RUST_LOG: info + settings: + groups: [app] +targets: + api_iOS: + type: application + platform: iOS + sources: + - path: Sources + - path: Assets.xcassets + - path: Externals + - path: assets + buildPhase: resources + type: folder + info: + path: api_iOS/Info.plist + properties: + LSRequiresIPhoneOS: true + UILaunchStoryboardName: LaunchScreen + UIRequiredDeviceCapabilities: [arm64, metal] + UISupportedInterfaceOrientations: + - UIInterfaceOrientationPortrait + - UIInterfaceOrientationLandscapeLeft + - UIInterfaceOrientationLandscapeRight + UISupportedInterfaceOrientations~ipad: + - UIInterfaceOrientationPortrait + - UIInterfaceOrientationPortraitUpsideDown + - UIInterfaceOrientationLandscapeLeft + - UIInterfaceOrientationLandscapeRight + CFBundleShortVersionString: 2.0.0 + CFBundleVersion: 2.0.0 + scheme: + environmentVariables: + RUST_BACKTRACE: full + RUST_LOG: info + settings: + base: + ENABLE_BITCODE: false + ARCHS: [arm64, arm64-sim] + VALID_ARCHS: arm64 arm64-sim + LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) + LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) + LIBRARY_SEARCH_PATHS[arch=arm64-sim]: $(inherited) $(PROJECT_DIR)/Externals/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: true + groups: [app] + dependencies: + - framework: libapi.a + embed: false + - sdk: CoreGraphics.framework + - sdk: Metal.framework + - sdk: MetalKit.framework + - sdk: QuartzCore.framework + - sdk: Security.framework + - sdk: UIKit.framework + - sdk: WebKit.framework + preBuildScripts: + - script: node /Users/lucas/projects/tauri/plugins-workspace/examples/api/./node_modules/.bin/../../../../node_modules/.pnpm/@tauri-apps+cli@2.0.0-alpha.9/node_modules/@tauri-apps/cli/tauri.js ios xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths "${FRAMEWORK_SEARCH_PATHS:?}" --header-search-paths "${HEADER_SEARCH_PATHS:?}" --gcc-preprocessor-definitions "${GCC_PREPROCESSOR_DEFINITIONS:-}" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?} + name: Build Rust Code + basedOnDependencyAnalysis: false + outputFiles: + - $(SRCROOT)/target/aarch64-apple-ios/${CONFIGURATION}/deps/libapi.a + - $(SRCROOT)/target/x86_64-apple-ios/${CONFIGURATION}/deps/libapi.a \ No newline at end of file diff --git a/examples/api/src-tauri/src/lib.rs b/examples/api/src-tauri/src/lib.rs index 378ef5dd..14a1207d 100644 --- a/examples/api/src-tauri/src/lib.rs +++ b/examples/api/src-tauri/src/lib.rs @@ -51,6 +51,10 @@ pub fn run() { app.handle() .plugin(tauri_plugin_updater::Builder::new().build())?; } + #[cfg(mobile)] + { + app.handle().plugin(tauri_plugin_barcode_scanner::init())?; + } #[cfg(mobile)] { diff --git a/examples/api/src/views/Scanner.svelte b/examples/api/src/views/Scanner.svelte index 3a358ec5..e70c6c03 100644 --- a/examples/api/src/views/Scanner.svelte +++ b/examples/api/src/views/Scanner.svelte @@ -5,10 +5,12 @@ let scanning = false; let windowed = true; + let formats = ["QR_CODE"]; + const supportedFormats = ["QR_CODE", "EAN_13"]; function startScan() { scanning = true; - scan({ windowed }) + scan({ windowed, formats }) .then((res) => { scanning = false; onMessage(res); @@ -26,6 +28,13 @@ +
+ +
diff --git a/plugins/barcode-scanner/Cargo.toml b/plugins/barcode-scanner/Cargo.toml index 9288c264..b0f491bc 100644 --- a/plugins/barcode-scanner/Cargo.toml +++ b/plugins/barcode-scanner/Cargo.toml @@ -1,18 +1,17 @@ [package] name = "tauri-plugin-barcode-scanner" -version = "0.0.0" -edition.workspace = true -authors.workspace = true -license.workspace = true - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +version = "1.0.0" +edition = { workspace = true } +authors = { workspace = true } +license = { workspace = true } +links = "tauri-plugin-barcode-scanner" [build-dependencies] -tauri-build.workspace = true +tauri-build = { workspace = true } [dependencies] -serde.workspace = true -serde_json.workspace = true -tauri.workspace = true -log.workspace = true -thiserror.workspace = true \ No newline at end of file +serde = { workspace = true } +serde_json = { workspace = true } +tauri = { workspace = true } +log = { workspace = true } +thiserror = { workspace = true } diff --git a/plugins/barcode-scanner/android/src/main/java/BarcodeScannerPlugin.kt b/plugins/barcode-scanner/android/src/main/java/BarcodeScannerPlugin.kt index beac6a61..aa1b807f 100644 --- a/plugins/barcode-scanner/android/src/main/java/BarcodeScannerPlugin.kt +++ b/plugins/barcode-scanner/android/src/main/java/BarcodeScannerPlugin.kt @@ -174,12 +174,17 @@ class BarcodeScannerPlugin(private val activity: Activity) : Plugin(activity), ContextCompat.getMainExecutor(activity), this ) - camera = cameraProvider.bindToLifecycle( - activity as LifecycleOwner, - cameraSelector, - preview, - imageAnalysis - ) + + try { + camera = cameraProvider.bindToLifecycle( + activity as LifecycleOwner, + cameraSelector, + preview, + imageAnalysis + ) + } catch (e: Exception) { + // TODO + } } } @@ -281,11 +286,20 @@ class BarcodeScannerPlugin(private val activity: Activity) : Plugin(activity), val barcode = barcodes[0] val bounds = barcode.boundingBox val rawValue = barcode.rawValue ?: "" + val rawFormat = barcode.format + var format: String? = null + + for (entry in supportedFormats.entries) { + if (entry.value == rawFormat) { + format = entry.key + break + } + } - // add vibration logic here val s = bounds?.flattenToString() val jsObject = JSObject() jsObject.put("content", rawValue) + jsObject.put("format", format) jsObject.put("bounds", s) savedInvoke?.resolve(jsObject) diff --git a/plugins/barcode-scanner/guest-js/index.ts b/plugins/barcode-scanner/guest-js/index.ts index 17fe7510..ec5274f1 100644 --- a/plugins/barcode-scanner/guest-js/index.ts +++ b/plugins/barcode-scanner/guest-js/index.ts @@ -1,6 +1,6 @@ import { invoke } from "@tauri-apps/api/tauri"; -type PermissionState = "granted" | "denied"; +type PermissionState = "granted" | "denied" | "default"; type Format = | "QR_CODE" @@ -30,6 +30,7 @@ interface PrepareOptions { interface Scanned { content: string; + format: Format; bounds: unknown; } diff --git a/plugins/barcode-scanner/ios/Package.swift b/plugins/barcode-scanner/ios/Package.swift index 55995d12..08dc1ad6 100644 --- a/plugins/barcode-scanner/ios/Package.swift +++ b/plugins/barcode-scanner/ios/Package.swift @@ -4,28 +4,28 @@ import PackageDescription let package = Package( - name: "tauri-plugin-barcode-scanner", - platforms: [ - .iOS(.v13), - ], - products: [ - // Products define the executables and libraries a package produces, and make them visible to other packages. - .library( - name: "tauri-plugin-barcode-scanner", - type: .static, - targets: ["tauri-plugin-barcode-scanner"]), - ], - dependencies: [ - .package(name: "Tauri", path: "../.tauri/tauri-api") - ], - targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages this package depends on. - .target( - name: "tauri-plugin-barcode-scanner", - dependencies: [ - .byName(name: "Tauri") - ], - path: "Sources") - ] + name: "tauri-plugin-barcode-scanner", + platforms: [ + .iOS(.v13) + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "tauri-plugin-barcode-scanner", + type: .static, + targets: ["tauri-plugin-barcode-scanner"]) + ], + dependencies: [ + .package(name: "Tauri", path: "../.tauri/tauri-api") + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "tauri-plugin-barcode-scanner", + dependencies: [ + .byName(name: "Tauri") + ], + path: "Sources") + ] ) diff --git a/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift b/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift new file mode 100644 index 00000000..7cccc91f --- /dev/null +++ b/plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift @@ -0,0 +1,318 @@ +import AVFoundation +import Tauri +import UIKit +import WebKit + +enum SupportedFormat: String, CaseIterable { + // UPC_A not supported + case UPC_E + case EAN_8 + case EAN_13 + case CODE_39 + case CODE_93 + case CODE_128 + // CODABAR not supported + case ITF + case AZTEC + case DATA_MATRIX + case PDF_417 + case QR_CODE + + var value: AVMetadataObject.ObjectType { + switch self { + case .UPC_E: return AVMetadataObject.ObjectType.upce + case .EAN_8: return AVMetadataObject.ObjectType.ean8 + case .EAN_13: return AVMetadataObject.ObjectType.ean13 + case .CODE_39: return AVMetadataObject.ObjectType.code39 + case .CODE_93: return AVMetadataObject.ObjectType.code93 + case .CODE_128: return AVMetadataObject.ObjectType.code128 + case .ITF: return AVMetadataObject.ObjectType.interleaved2of5 + case .AZTEC: return AVMetadataObject.ObjectType.aztec + case .DATA_MATRIX: return AVMetadataObject.ObjectType.dataMatrix + case .PDF_417: return AVMetadataObject.ObjectType.pdf417 + case .QR_CODE: return AVMetadataObject.ObjectType.qr + } + } +} + +enum CaptureError: Error { + case backCameraUnavailable + case frontCameraUnavailable + case couldNotCaptureInput(error: NSError) +} + +class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate { + var webView: WKWebView! + var cameraView: CameraView! + var captureSession: AVCaptureSession? + var captureVideoPreviewLayer: AVCaptureVideoPreviewLayer? + var metaOutput: AVCaptureMetadataOutput? + + var currentCamera = 0 + var frontCamera: AVCaptureDevice? + var backCamera: AVCaptureDevice? + + var isScanning = false + var cameraReady = false + + var windowed = false + var previousBackgroundColor: UIColor? = UIColor.white + + var invoke: Invoke? = nil + + var scanFormats = [AVMetadataObject.ObjectType]() + + public override func load(webview: WKWebView) { + self.webView = webview + self.cameraView = CameraView( + frame: CGRect( + x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)) + self.cameraView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + } + + public func metadataOutput( + _ captureOutput: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], + from connection: AVCaptureConnection + ) { + if metadataObjects.count == 0 || !self.isScanning { + // while nothing is detected, or if scanning is false, do nothing. + return + } + + let found = metadataObjects[0] as! AVMetadataMachineReadableCodeObject + if scanFormats.contains(found.type) { + var jsObject: JsonObject = [:] + + jsObject["format"] = formatStringFromMetadata(found.type) + if found.stringValue != nil { + jsObject["content"] = found.stringValue + } + + invoke?.resolve(jsObject) + destroy() + + } + } + + private func setupCamera(direction: String, windowed: Bool) { + do { + var cameraDirection = direction + cameraView.backgroundColor = UIColor.clear + if windowed { + webView.superview?.insertSubview(cameraView, belowSubview: webView) + } else { + webView.superview?.insertSubview(cameraView, aboveSubview: webView) + } + + let availableVideoDevices = discoverCaptureDevices() + for device in availableVideoDevices { + if device.position == AVCaptureDevice.Position.back { + backCamera = device + } else if device.position == AVCaptureDevice.Position.front { + frontCamera = device + } + } + + // older iPods have no back camera + if cameraDirection == "back" { + if backCamera == nil { + cameraDirection = "front" + } + } else { + if frontCamera == nil { + cameraDirection = "back" + } + } + + let input: AVCaptureDeviceInput + input = try createCaptureDeviceInput( + cameraDirection: cameraDirection, backCamera: backCamera, frontCamera: frontCamera) + captureSession = AVCaptureSession() + captureSession!.addInput(input) + metaOutput = AVCaptureMetadataOutput() + captureSession!.addOutput(metaOutput!) + metaOutput!.setMetadataObjectsDelegate(self, queue: DispatchQueue.main) + captureVideoPreviewLayer = AVCaptureVideoPreviewLayer(session: captureSession!) + cameraView.addPreviewLayer(captureVideoPreviewLayer) + + self.windowed = windowed + if windowed { + self.previousBackgroundColor = self.webView.backgroundColor + self.webView.isOpaque = false + self.webView.backgroundColor = UIColor.clear + self.webView.scrollView.backgroundColor = UIColor.clear + } + + self.cameraReady = true + } catch CaptureError.backCameraUnavailable { + // + } catch CaptureError.frontCameraUnavailable { + // + } catch CaptureError.couldNotCaptureInput { + // + } catch { + // + } + } + + private func dismantleCamera() { + DispatchQueue.main.async { + if self.captureSession != nil { + self.captureSession!.stopRunning() + self.cameraView.removePreviewLayer() + self.captureVideoPreviewLayer = nil + self.metaOutput = nil + self.captureSession = nil + self.frontCamera = nil + self.backCamera = nil + } + } + + self.isScanning = false + self.cameraReady = false + } + + private func destroy() { + dismantleCamera() + invoke = nil + if windowed { + let backgroundColor = previousBackgroundColor ?? UIColor.white + webView.isOpaque = true + webView.backgroundColor = backgroundColor + webView.scrollView.backgroundColor = backgroundColor + } + } + + private func prepareInternal(_ direction: String, _ windowed: Bool) { + dismantleCamera() + + DispatchQueue.main.async { [self] in + // setup camera with new config + self.setupCamera(direction: direction, windowed: windowed) + } + } + + private func getPermissionState() -> String { + var permissionState: String + + switch AVCaptureDevice.authorizationStatus(for: .video) { + case .authorized: + permissionState = "granted" + case .denied: + permissionState = "denied" + default: + permissionState = "default" + } + + return permissionState + } + + @objc override func checkPermissions(_ invoke: Invoke) { + let permissionState = getPermissionState() + invoke.resolve(["camera": permissionState]) + } + + @objc override func requestPermissions(_ invoke: Invoke) { + let state = getPermissionState() + if state == "default" { + AVCaptureDevice.requestAccess(for: .video) { (authorized) in + invoke.resolve(["camera": authorized ? "granted" : "denied"]) + } + } else { + invoke.resolve(["camera": state]) + } + } + + @objc func openAppSettings(_ invoke: Invoke) { + guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else { + return + } + + DispatchQueue.main.async { + if UIApplication.shared.canOpenURL(settingsUrl) { + UIApplication.shared.open( + settingsUrl, + completionHandler: { (success) in + invoke.resolve() + }) + } + } + } + + @objc private func prepare(_ invoke: Invoke) { + prepareInternal( + invoke.getString("cameraDirection") ?? "back", invoke.getBool("windowed") ?? false) + invoke.resolve() + } + + private func runScanner(_ invoke: Invoke) { + self.cameraReady = false + + scanFormats = [AVMetadataObject.ObjectType]() + + if (invoke.data["formats"]) != nil { + let _scanFormats = invoke.getArray("formats", String.self) + + if _scanFormats != nil && _scanFormats?.count ?? 0 > 0 { + _scanFormats?.forEach { targetedFormat in + if let value = SupportedFormat(rawValue: targetedFormat)?.value { + scanFormats.append(value) + } + } + } + } + + if scanFormats.count == 0 { + for supportedFormat in SupportedFormat.allCases { + scanFormats.append(supportedFormat.value) + } + } + + DispatchQueue.main.async { + self.metaOutput!.metadataObjectTypes = self.scanFormats + self.captureSession!.startRunning() + } + + self.isScanning = true + } + + @objc private func scan(_ invoke: Invoke) { + self.invoke = invoke + + if self.cameraReady { + runScanner(invoke) + } else { + var iOS14min: Bool = false + if #available(iOS 14.0, *) { iOS14min = true } + if !iOS14min && self.getPermissionState() != "granted" { + var authorized = false + AVCaptureDevice.requestAccess(for: .video) { (isAuthorized) in + authorized = isAuthorized + } + if !authorized { + invoke.reject("denied by the user") + return + } + } + + DispatchQueue.main.async { + self.load(webview: self.webView) + self.prepareInternal( + invoke.getString("cameraDirection") ?? "back", invoke.getBool("windowed") ?? false) + self.runScanner(invoke) + } + } + } + + @objc private func cancel(_ invoke: Invoke) { + self.invoke?.reject("cancelled") + + destroy() + invoke.resolve() + } +} + +@_cdecl("init_plugin_barcode_scanner") +func initPlugin() -> Plugin { + return BarcodeScannerPlugin() +} diff --git a/plugins/barcode-scanner/ios/Sources/CameraView.swift b/plugins/barcode-scanner/ios/Sources/CameraView.swift new file mode 100644 index 00000000..65144b7b --- /dev/null +++ b/plugins/barcode-scanner/ios/Sources/CameraView.swift @@ -0,0 +1,53 @@ +import AVFoundation +import UIKit + +class CameraView: UIView { + var videoPreviewLayer: AVCaptureVideoPreviewLayer? + + func interfaceOrientationToVideoOrientation(_ orientation: UIInterfaceOrientation) + -> AVCaptureVideoOrientation + { + switch orientation { + case UIInterfaceOrientation.portrait: + return AVCaptureVideoOrientation.portrait + case UIInterfaceOrientation.portraitUpsideDown: + return AVCaptureVideoOrientation.portraitUpsideDown + case UIInterfaceOrientation.landscapeLeft: + return AVCaptureVideoOrientation.landscapeLeft + case UIInterfaceOrientation.landscapeRight: + return AVCaptureVideoOrientation.landscapeRight + default: + return AVCaptureVideoOrientation.portraitUpsideDown + } + } + + override func layoutSubviews() { + super.layoutSubviews() + if let sublayers = self.layer.sublayers { + for layer in sublayers { + layer.frame = self.bounds + } + } + + if let interfaceOrientation = UIApplication.shared.windows.first(where: { $0.isKeyWindow })? + .windowScene?.interfaceOrientation + { + self.videoPreviewLayer?.connection?.videoOrientation = interfaceOrientationToVideoOrientation( + interfaceOrientation) + } + } + + func addPreviewLayer(_ previewLayer: AVCaptureVideoPreviewLayer?) { + previewLayer!.videoGravity = AVLayerVideoGravity.resizeAspectFill + previewLayer!.frame = self.bounds + self.layer.addSublayer(previewLayer!) + self.videoPreviewLayer = previewLayer + } + + func removePreviewLayer() { + if self.videoPreviewLayer != nil { + self.videoPreviewLayer!.removeFromSuperlayer() + self.videoPreviewLayer = nil + } + } +} diff --git a/plugins/barcode-scanner/ios/Sources/ExamplePlugin.swift b/plugins/barcode-scanner/ios/Sources/ExamplePlugin.swift deleted file mode 100644 index 86140b74..00000000 --- a/plugins/barcode-scanner/ios/Sources/ExamplePlugin.swift +++ /dev/null @@ -1,16 +0,0 @@ -import UIKit -import WebKit -import Tauri -import SwiftRs - -class ExamplePlugin: Plugin { - @objc public func ping(_ invoke: Invoke) throws { - let value = invoke.getString("value") - invoke.resolve(["value": value as Any]) - } -} - -@_cdecl("init_plugin_{{ plugin_name_snake_case }}") -func initPlugin(name: SRString, webview: WKWebView?) { - Tauri.registerPlugin(webview: webview, name: name.toString(), plugin: ExamplePlugin()) -} diff --git a/plugins/barcode-scanner/ios/Sources/Utils.swift b/plugins/barcode-scanner/ios/Sources/Utils.swift new file mode 100644 index 00000000..61de1f4d --- /dev/null +++ b/plugins/barcode-scanner/ios/Sources/Utils.swift @@ -0,0 +1,82 @@ +import AVFoundation + +func createCaptureDeviceInput( + cameraDirection: String, backCamera: AVCaptureDevice?, frontCamera: AVCaptureDevice? +) throws + -> AVCaptureDeviceInput +{ + var captureDevice: AVCaptureDevice + if cameraDirection == "back" { + if backCamera != nil { + captureDevice = backCamera! + } else { + throw CaptureError.backCameraUnavailable + } + } else { + if frontCamera != nil { + captureDevice = frontCamera! + } else { + throw CaptureError.frontCameraUnavailable + } + } + let captureDeviceInput: AVCaptureDeviceInput + do { + captureDeviceInput = try AVCaptureDeviceInput(device: captureDevice) + } catch let error as NSError { + throw CaptureError.couldNotCaptureInput(error: error) + } + return captureDeviceInput +} + +@available( + swift, deprecated: 5.6, + message: + "New Xcode? Check if `AVCaptureDevice.DeviceType` has new types and add them accordingly." +) +func discoverCaptureDevices() -> [AVCaptureDevice] { + if #available(iOS 13.0, *) { + return AVCaptureDevice.DiscoverySession( + deviceTypes: [ + .builtInTripleCamera, .builtInDualCamera, .builtInTelephotoCamera, + .builtInTrueDepthCamera, + .builtInUltraWideCamera, .builtInDualWideCamera, .builtInWideAngleCamera, + ], mediaType: .video, position: .unspecified + ).devices + } else { + return AVCaptureDevice.DiscoverySession( + deviceTypes: [ + .builtInDualCamera, .builtInWideAngleCamera, .builtInTelephotoCamera, + .builtInTrueDepthCamera, + ], mediaType: .video, position: .unspecified + ).devices + } +} + +func formatStringFromMetadata(_ type: AVMetadataObject.ObjectType) -> String { + switch type { + case AVMetadataObject.ObjectType.upce: + return "UPC_E" + case AVMetadataObject.ObjectType.ean8: + return "EAN_8" + case AVMetadataObject.ObjectType.ean13: + return "EAN_13" + case AVMetadataObject.ObjectType.code39: + return "CODE_39" + case AVMetadataObject.ObjectType.code93: + return "CODE_93" + case AVMetadataObject.ObjectType.code128: + return "CODE_128" + case AVMetadataObject.ObjectType.interleaved2of5: + return "ITF" + case AVMetadataObject.ObjectType.aztec: + return "AZTEC" + case AVMetadataObject.ObjectType.dataMatrix: + return "DATA_MATRIX" + case AVMetadataObject.ObjectType.pdf417: + return "PDF_417" + case AVMetadataObject.ObjectType.qr: + return "QR_CODE" + default: + return type.rawValue + } +} diff --git a/plugins/barcode-scanner/src/api-iife.js b/plugins/barcode-scanner/src/api-iife.js index 3236f86e..11547767 100644 --- a/plugins/barcode-scanner/src/api-iife.js +++ b/plugins/barcode-scanner/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_BARCODESCANNER__=function(e){"use strict";var n=Object.defineProperty,t=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)},r=(e,n,r)=>(t(e,n,"read from private field"),r?r.call(e):n.get(e)),a=(e,n,r,a)=>(t(e,n,"write to private field"),a?a.call(e,r):n.set(e,r),r);function i(e,n=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${t}`;return Object.defineProperty(window,r,{value:t=>(n&&Reflect.deleteProperty(window,r),e?.(t)),writable:!1,configurable:!0}),t}((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})({},{Channel:()=>c,PluginListener:()=>o,addPluginListener:()=>l,convertFileSrc:()=>d,invoke:()=>u,transformCallback:()=>i});var s,c=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)})(this,s,(()=>{})),this.id=i((e=>{r(this,s).call(this,e)}))}set onmessage(e){a(this,s,e)}get onmessage(){return r(this,s)}toJSON(){return`__CHANNEL__:${this.id}`}};s=new WeakMap;var o=class{constructor(e,n,t){this.plugin=e,this.event=n,this.channelId=t}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function l(e,n,t){let r=new c;return r.onmessage=t,u(`plugin:${e}|register_listener`,{event:n,handler:r}).then((()=>new o(e,n,r.id)))}async function u(e,n={}){return new Promise(((t,r)=>{let a=i((e=>{t(e),Reflect.deleteProperty(window,`_${s}`)}),!0),s=i((e=>{r(e),Reflect.deleteProperty(window,`_${a}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:a,error:s,...n})}))}function d(e,n="asset"){let t=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${n}.localhost/${t}`:`${n}://localhost/${t}`}return e.cancel=async function(){return await u("plugin:barcodeScanner|cancel")},e.checkPermissions=async function(){return await u("plugin:barcodeScanner|check_permissions").then((e=>e.camera))},e.openAppSettings=async function(){return await u("plugin:barcodeScanner|open_app_settings")},e.prepare=async function(e){return await u("plugin:barcodeScanner|prepare",{...e})},e.requestPermissions=async function(){return await u("plugin:barcodeScanner|request_permissions").then((e=>e.camera))},e.scan=async function(e){return await u("plugin:barcodeScanner|scan",{...e})},e}({});Object.defineProperty(window.__TAURI__,"barcodeScanner",{value:__TAURI_BARCODESCANNER__})} +if("__TAURI__"in window){var __TAURI_TAURIPLUGINBARCODESCANNERAPI__=function(e){"use strict";var n=Object.defineProperty,t=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)},r=(e,n,r)=>(t(e,n,"read from private field"),r?r.call(e):n.get(e)),i=(e,n,r,i)=>(t(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r);function a(e,n=!1){let t=window.crypto.getRandomValues(new Uint32Array(1))[0],r=`_${t}`;return Object.defineProperty(window,r,{value:t=>(n&&Reflect.deleteProperty(window,r),e?.(t)),writable:!1,configurable:!0}),t}((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})({},{Channel:()=>c,PluginListener:()=>o,addPluginListener:()=>l,convertFileSrc:()=>d,invoke:()=>u,transformCallback:()=>a});var s,c=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)})(this,s,(()=>{})),this.id=a((e=>{r(this,s).call(this,e)}))}set onmessage(e){i(this,s,e)}get onmessage(){return r(this,s)}toJSON(){return`__CHANNEL__:${this.id}`}};s=new WeakMap;var o=class{constructor(e,n,t){this.plugin=e,this.event=n,this.channelId=t}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function l(e,n,t){let r=new c;return r.onmessage=t,u(`plugin:${e}|register_listener`,{event:n,handler:r}).then((()=>new o(e,n,r.id)))}async function u(e,n={}){return new Promise(((t,r)=>{let i=a((e=>{t(e),Reflect.deleteProperty(window,`_${s}`)}),!0),s=a((e=>{r(e),Reflect.deleteProperty(window,`_${i}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:i,error:s,...n})}))}function d(e,n="asset"){let t=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${n}.localhost/${t}`:`${n}://localhost/${t}`}return e.cancel=async function(){u("plugin:barcodeScanner|cancel")},e.checkPermissions=async function(){return u("plugin:barcodeScanner|check_permissions").then((e=>e.camera))},e.openAppSettings=async function(){u("plugin:barcodeScanner|open_app_settings")},e.prepare=async function(e){u("plugin:barcodeScanner|prepare",{...e})},e.requestPermissions=async function(){return u("plugin:barcodeScanner|request_permissions").then((e=>e.camera))},e.scan=async function(e){u("plugin:barcodeScanner|scan",{...e})},e}({});Object.defineProperty(window.__TAURI__,"tauriPluginBarcodeScannerApi",{value:__TAURI_TAURIPLUGINBARCODESCANNERAPI__})}