diff --git a/.gitignore b/.gitignore index f86aed5..29e8da3 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ publish/src publish/package demo/report/report.html demo/report/stats.json + +src/native-src/ios/*/build diff --git a/src/.npmignore b/src/.npmignore index 0ba0a4d..16ceb93 100644 --- a/src/.npmignore +++ b/src/.npmignore @@ -5,4 +5,5 @@ !barcodescanner-common.d.ts !index.d.ts tsconfig.json -platforms/android/AndroidManifest.xml \ No newline at end of file +platforms/android/AndroidManifest.xml +native-src \ No newline at end of file diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.pbxproj b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.pbxproj new file mode 100644 index 0000000..8f05a8f --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.pbxproj @@ -0,0 +1,376 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 3CAF979828344751005D243B /* BarcodeScannerFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CAF979728344751005D243B /* BarcodeScannerFramework.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3CAF97AD28344830005D243B /* QRCodeReaderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CAF97A22834482F005D243B /* QRCodeReaderViewController.m */; }; + 3CAF97AE28344830005D243B /* QRCameraSwitchButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CAF97A82834482F005D243B /* QRCameraSwitchButton.m */; }; + 3CAF97AF28344830005D243B /* QRCodeReaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CAF97A62834482F005D243B /* QRCodeReaderView.m */; }; + 3CAF97B028344830005D243B /* QRCodeReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CAF97A32834482F005D243B /* QRCodeReader.m */; }; + 3CAF97B128344830005D243B /* QRToggleTorchButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CAF97AC28344830005D243B /* QRToggleTorchButton.m */; }; + 3CAF97B228344835005D243B /* QRCameraSwitchButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CAF97A52834482F005D243B /* QRCameraSwitchButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3CAF97B328344839005D243B /* QRCodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CAF97A72834482F005D243B /* QRCodeReader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3CAF97B42834483C005D243B /* QRCodeReaderDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CAF97AA2834482F005D243B /* QRCodeReaderDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3CAF97B52834483F005D243B /* QRCodeReaderView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CAF97AB28344830005D243B /* QRCodeReaderView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3CAF97B628344843005D243B /* QRCodeReaderViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CAF97A42834482F005D243B /* QRCodeReaderViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3CAF97B728344846005D243B /* QRToggleTorchButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CAF97A92834482F005D243B /* QRToggleTorchButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 3CAF979428344751005D243B /* BarcodeScannerFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BarcodeScannerFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3CAF979728344751005D243B /* BarcodeScannerFramework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BarcodeScannerFramework.h; sourceTree = ""; }; + 3CAF97A22834482F005D243B /* QRCodeReaderViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QRCodeReaderViewController.m; sourceTree = ""; }; + 3CAF97A32834482F005D243B /* QRCodeReader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QRCodeReader.m; sourceTree = ""; }; + 3CAF97A42834482F005D243B /* QRCodeReaderViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QRCodeReaderViewController.h; sourceTree = ""; }; + 3CAF97A52834482F005D243B /* QRCameraSwitchButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QRCameraSwitchButton.h; sourceTree = ""; }; + 3CAF97A62834482F005D243B /* QRCodeReaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QRCodeReaderView.m; sourceTree = ""; }; + 3CAF97A72834482F005D243B /* QRCodeReader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QRCodeReader.h; sourceTree = ""; }; + 3CAF97A82834482F005D243B /* QRCameraSwitchButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QRCameraSwitchButton.m; sourceTree = ""; }; + 3CAF97A92834482F005D243B /* QRToggleTorchButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QRToggleTorchButton.h; sourceTree = ""; }; + 3CAF97AA2834482F005D243B /* QRCodeReaderDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QRCodeReaderDelegate.h; sourceTree = ""; }; + 3CAF97AB28344830005D243B /* QRCodeReaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QRCodeReaderView.h; sourceTree = ""; }; + 3CAF97AC28344830005D243B /* QRToggleTorchButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QRToggleTorchButton.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3CAF979128344751005D243B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3CAF978A28344751005D243B = { + isa = PBXGroup; + children = ( + 3CAF979628344751005D243B /* BarcodeScannerFramework */, + 3CAF979528344751005D243B /* Products */, + ); + sourceTree = ""; + }; + 3CAF979528344751005D243B /* Products */ = { + isa = PBXGroup; + children = ( + 3CAF979428344751005D243B /* BarcodeScannerFramework.framework */, + ); + name = Products; + sourceTree = ""; + }; + 3CAF979628344751005D243B /* BarcodeScannerFramework */ = { + isa = PBXGroup; + children = ( + 3CAF97A52834482F005D243B /* QRCameraSwitchButton.h */, + 3CAF97A82834482F005D243B /* QRCameraSwitchButton.m */, + 3CAF97A72834482F005D243B /* QRCodeReader.h */, + 3CAF97A32834482F005D243B /* QRCodeReader.m */, + 3CAF97AA2834482F005D243B /* QRCodeReaderDelegate.h */, + 3CAF97AB28344830005D243B /* QRCodeReaderView.h */, + 3CAF97A62834482F005D243B /* QRCodeReaderView.m */, + 3CAF97A42834482F005D243B /* QRCodeReaderViewController.h */, + 3CAF97A22834482F005D243B /* QRCodeReaderViewController.m */, + 3CAF97A92834482F005D243B /* QRToggleTorchButton.h */, + 3CAF97AC28344830005D243B /* QRToggleTorchButton.m */, + 3CAF979728344751005D243B /* BarcodeScannerFramework.h */, + ); + path = BarcodeScannerFramework; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 3CAF978F28344751005D243B /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3CAF97B628344843005D243B /* QRCodeReaderViewController.h in Headers */, + 3CAF97B42834483C005D243B /* QRCodeReaderDelegate.h in Headers */, + 3CAF97B728344846005D243B /* QRToggleTorchButton.h in Headers */, + 3CAF97B228344835005D243B /* QRCameraSwitchButton.h in Headers */, + 3CAF97B52834483F005D243B /* QRCodeReaderView.h in Headers */, + 3CAF97B328344839005D243B /* QRCodeReader.h in Headers */, + 3CAF979828344751005D243B /* BarcodeScannerFramework.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 3CAF979328344751005D243B /* BarcodeScannerFramework */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3CAF979B28344751005D243B /* Build configuration list for PBXNativeTarget "BarcodeScannerFramework" */; + buildPhases = ( + 3CAF978F28344751005D243B /* Headers */, + 3CAF979028344751005D243B /* Sources */, + 3CAF979128344751005D243B /* Frameworks */, + 3CAF979228344751005D243B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BarcodeScannerFramework; + productName = BarcodeScannerFramework; + productReference = 3CAF979428344751005D243B /* BarcodeScannerFramework.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3CAF978B28344751005D243B /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 1320; + TargetAttributes = { + 3CAF979328344751005D243B = { + CreatedOnToolsVersion = 13.2.1; + }; + }; + }; + buildConfigurationList = 3CAF978E28344751005D243B /* Build configuration list for PBXProject "BarcodeScannerFramework" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 3CAF978A28344751005D243B; + productRefGroup = 3CAF979528344751005D243B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3CAF979328344751005D243B /* BarcodeScannerFramework */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 3CAF979228344751005D243B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3CAF979028344751005D243B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3CAF97AF28344830005D243B /* QRCodeReaderView.m in Sources */, + 3CAF97AD28344830005D243B /* QRCodeReaderViewController.m in Sources */, + 3CAF97B128344830005D243B /* QRToggleTorchButton.m in Sources */, + 3CAF97B028344830005D243B /* QRCodeReader.m in Sources */, + 3CAF97AE28344830005D243B /* QRCameraSwitchButton.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 3CAF979928344751005D243B /* 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++17"; + 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; + CURRENT_PROJECT_VERSION = 1; + 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 = ( + "DEBUG=1", + "$(inherited)", + ); + 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 = 15.2; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 3CAF979A28344751005D243B /* 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++17"; + 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; + CURRENT_PROJECT_VERSION = 1; + 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 = 15.2; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 3CAF979C28344751005D243B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.telerik.BarcodeScannerFramework; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 3CAF979D28344751005D243B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.telerik.BarcodeScannerFramework; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3CAF978E28344751005D243B /* Build configuration list for PBXProject "BarcodeScannerFramework" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3CAF979928344751005D243B /* Debug */, + 3CAF979A28344751005D243B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3CAF979B28344751005D243B /* Build configuration list for PBXNativeTarget "BarcodeScannerFramework" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3CAF979C28344751005D243B /* Debug */, + 3CAF979D28344751005D243B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3CAF978B28344751005D243B /* Project object */; +} diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.xcworkspace/xcuserdata/eduardosperoni.xcuserdatad/UserInterfaceState.xcuserstate b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.xcworkspace/xcuserdata/eduardosperoni.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..f8088dc Binary files /dev/null and b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/project.xcworkspace/xcuserdata/eduardosperoni.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/xcuserdata/eduardosperoni.xcuserdatad/xcschemes/xcschememanagement.plist b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/xcuserdata/eduardosperoni.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..dd00332 --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework.xcodeproj/xcuserdata/eduardosperoni.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + BarcodeScannerFramework.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/BarcodeScannerFramework.h b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/BarcodeScannerFramework.h old mode 100755 new mode 100644 similarity index 61% rename from src/platforms/ios/BarcodeScannerFramework.framework/Headers/BarcodeScannerFramework.h rename to src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/BarcodeScannerFramework.h index fc28b36..a989e30 --- a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/BarcodeScannerFramework.h +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/BarcodeScannerFramework.h @@ -1,8 +1,18 @@ -// In this header, you should import all the public headers of your framework using statements +// +// BarcodeScannerFramework.h +// BarcodeScannerFramework +// +// Created by Eduardo Speroni on 5/17/22. +// + #import "QRCodeReaderViewController.h" //! Project version number for BarcodeScannerFramework. FOUNDATION_EXPORT double BarcodeScannerFrameworkVersionNumber; //! Project version string for BarcodeScannerFramework. -FOUNDATION_EXPORT const unsigned char BarcodeScannerFrameworkVersionString[]; \ No newline at end of file +FOUNDATION_EXPORT const unsigned char BarcodeScannerFrameworkVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCameraSwitchButton.h b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCameraSwitchButton.h new file mode 100644 index 0000000..f63e997 --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCameraSwitchButton.h @@ -0,0 +1,66 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +/** + * The camera switch button. + * @since 2.0.0 + */ +@interface QRCameraSwitchButton : UIButton + +#pragma mark - Managing Properties +/** @name Managing Properties */ + +/** + * @abstract The edge color of the drawing. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeColor; + +/** + * @abstract The fill color of the drawing. + * @discussion The default color is the darkgray. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillColor; + +/** + * @abstract The edge color of the drawing when the button is touched. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeHighlightedColor; + +/** + * @abstract The fill color of the drawing when the button is touched. + * @discussion The default color is the black. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillHighlightedColor; + +@end diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCameraSwitchButton.m b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCameraSwitchButton.m new file mode 100644 index 0000000..c7494ad --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCameraSwitchButton.m @@ -0,0 +1,197 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import "QRCameraSwitchButton.h" + +@implementation QRCameraSwitchButton + +- (id)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) { + _edgeColor = [UIColor whiteColor]; + _fillColor = [UIColor darkGrayColor]; + _edgeHighlightedColor = [UIColor whiteColor]; + _fillHighlightedColor = [UIColor blackColor]; + } + return self; +} + +- (void)drawRect:(CGRect)rect +{ + CGFloat width = rect.size.width; + CGFloat height = rect.size.height; + CGFloat center = width / 2; + CGFloat middle = height / 2; + + CGFloat strokeLineWidth = 2; + + // Colors + + UIColor *paintColor = (self.state != UIControlStateHighlighted) ? _fillColor : _fillHighlightedColor; + UIColor *strokeColor = (self.state != UIControlStateHighlighted) ? _edgeColor : _edgeHighlightedColor; + + // Camera box + + CGFloat cameraWidth = width * 0.4; + CGFloat cameraHeight = cameraWidth * 0.6; + CGFloat cameraX = center - cameraWidth / 2; + CGFloat cameraY = middle - cameraHeight / 2; + CGFloat cameraRadius = cameraWidth / 80; + + UIBezierPath *boxPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(cameraX, cameraY, cameraWidth, cameraHeight) cornerRadius:cameraRadius]; + + // Camera lens + + CGFloat outerLensSize = cameraHeight * 0.8; + CGFloat outerLensX = center - outerLensSize / 2; + CGFloat outerLensY = middle - outerLensSize / 2; + + CGFloat innerLensSize = outerLensSize * 0.7; + CGFloat innerLensX = center - innerLensSize / 2; + CGFloat innerLensY = middle - innerLensSize / 2; + + UIBezierPath *outerLensPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(outerLensX, outerLensY, outerLensSize, outerLensSize)]; + UIBezierPath *innerLensPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(innerLensX, innerLensY, innerLensSize, innerLensSize)]; + + // Draw flash box + + CGFloat flashBoxWidth = cameraWidth * 0.8; + CGFloat flashBoxHeight = cameraHeight * 0.17; + CGFloat flashBoxDeltaWidth = flashBoxWidth * 0.14; + CGFloat flashLeftMostX = cameraX + (cameraWidth - flashBoxWidth) * 0.5; + CGFloat flashBottomMostY = cameraY; + + UIBezierPath *flashPath = [UIBezierPath bezierPath]; + [flashPath moveToPoint:CGPointMake(flashLeftMostX, flashBottomMostY)]; + [flashPath addLineToPoint:CGPointMake(flashLeftMostX + flashBoxWidth, flashBottomMostY)]; + [flashPath addLineToPoint:CGPointMake(flashLeftMostX + flashBoxWidth - flashBoxDeltaWidth, flashBottomMostY - flashBoxHeight)]; + [flashPath addLineToPoint:CGPointMake(flashLeftMostX + flashBoxDeltaWidth, flashBottomMostY - flashBoxHeight)]; + [flashPath closePath]; + + flashPath.lineCapStyle = kCGLineCapRound; + flashPath.lineJoinStyle = kCGLineJoinRound; + + // Arrows + + CGFloat arrowHeadHeigth = cameraHeight * 0.5; + CGFloat arrowHeadWidth = ((width - cameraWidth) / 2) * 0.3; + CGFloat arrowTailHeigth = arrowHeadHeigth * 0.6; + CGFloat arrowTailWidth = ((width - cameraWidth) / 2) * 0.7; + + // Draw left arrow + + CGFloat arrowLeftX = center - cameraWidth * 0.2; + CGFloat arrowLeftY = middle + cameraHeight * 0.45; + + UIBezierPath *leftArrowPath = [UIBezierPath bezierPath]; + [leftArrowPath moveToPoint:CGPointMake(arrowLeftX, arrowLeftY)]; + [leftArrowPath addLineToPoint:CGPointMake(arrowLeftX - arrowHeadWidth, arrowLeftY - arrowHeadHeigth / 2)]; + [leftArrowPath addLineToPoint:CGPointMake(arrowLeftX - arrowHeadWidth, arrowLeftY - arrowTailHeigth / 2)]; + [leftArrowPath addLineToPoint:CGPointMake(arrowLeftX - arrowHeadWidth - arrowTailWidth, arrowLeftY - arrowTailHeigth / 2)]; + [leftArrowPath addLineToPoint:CGPointMake(arrowLeftX - arrowHeadWidth - arrowTailWidth, arrowLeftY + arrowTailHeigth / 2)]; + [leftArrowPath addLineToPoint:CGPointMake(arrowLeftX - arrowHeadWidth, arrowLeftY + arrowTailHeigth / 2)]; + [leftArrowPath addLineToPoint:CGPointMake(arrowLeftX - arrowHeadWidth, arrowLeftY + arrowHeadHeigth / 2)]; + [leftArrowPath closePath]; + + // Right arrow + + CGFloat arrowRightX = center + cameraWidth * 0.2; + CGFloat arrowRightY = middle + cameraHeight * 0.60; + + UIBezierPath *rigthArrowPath = [UIBezierPath bezierPath]; + [rigthArrowPath moveToPoint:CGPointMake(arrowRightX, arrowRightY)]; + [rigthArrowPath addLineToPoint:CGPointMake(arrowRightX + arrowHeadWidth, arrowRightY - arrowHeadHeigth / 2)]; + [rigthArrowPath addLineToPoint:CGPointMake(arrowRightX + arrowHeadWidth, arrowRightY - arrowTailHeigth / 2)]; + [rigthArrowPath addLineToPoint:CGPointMake(arrowRightX + arrowHeadWidth + arrowTailWidth, arrowRightY - arrowTailHeigth / 2)]; + [rigthArrowPath addLineToPoint:CGPointMake(arrowRightX + arrowHeadWidth + arrowTailWidth, arrowRightY + arrowTailHeigth / 2)]; + [rigthArrowPath addLineToPoint:CGPointMake(arrowRightX + arrowHeadWidth, arrowRightY + arrowTailHeigth / 2)]; + [rigthArrowPath addLineToPoint:CGPointMake(arrowRightX + arrowHeadWidth, arrowRightY + arrowHeadHeigth / 2)]; + [rigthArrowPath closePath]; + + // Drawing + + [paintColor setFill]; + [rigthArrowPath fill]; + [strokeColor setStroke]; + rigthArrowPath.lineWidth = strokeLineWidth; + [rigthArrowPath stroke]; + + [paintColor setFill]; + [boxPath fill]; + [strokeColor setStroke]; + boxPath.lineWidth = strokeLineWidth; + [boxPath stroke]; + + [strokeColor setFill]; + [outerLensPath fill]; + + [paintColor setFill]; + [innerLensPath fill]; + + [paintColor setFill]; + [flashPath fill]; + [strokeColor setStroke]; + flashPath.lineWidth = strokeLineWidth; + [flashPath stroke]; + + [paintColor setFill]; + [leftArrowPath fill]; + [strokeColor setStroke]; + leftArrowPath.lineWidth = strokeLineWidth; + [leftArrowPath stroke]; +} + +// MARK: - UIResponder Methods + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesBegan:touches withEvent:event]; + + [self setNeedsDisplay]; +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesMoved:touches withEvent:event]; + + [self setNeedsDisplay]; +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesEnded:touches withEvent:event]; + + [self setNeedsDisplay]; +} + +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesCancelled:touches withEvent:event]; + + [self setNeedsDisplay]; +} + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReader.h b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReader.h old mode 100755 new mode 100644 similarity index 80% rename from src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReader.h rename to src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReader.h index 8193ac4..af4c92f --- a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReader.h +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReader.h @@ -1,3 +1,29 @@ +/* + * QRCodeReader + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + #import #import #import @@ -172,6 +198,7 @@ * is nil. * @since 3.0.0 */ +// - (void)setCompletionWithBlock:(nullable void (^) (NSString * _Nullable resultAsString))completionBlock; - (void)setCompletionWithBlock:(nullable void (^) (NSString * _Nullable resultAsString, NSString * _Nullable typeAsString))completionBlock; @end diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReader.m b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReader.m new file mode 100644 index 0000000..cc90cb3 --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReader.m @@ -0,0 +1,265 @@ +/* + * QRCodeReader + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import "QRCodeReader.h" + +@interface QRCodeReader () +@property (strong, nonatomic) AVCaptureDevice *defaultDevice; +@property (strong, nonatomic) AVCaptureDeviceInput *defaultDeviceInput; +@property (strong, nonatomic) AVCaptureDevice *frontDevice; +@property (strong, nonatomic) AVCaptureDeviceInput *frontDeviceInput; +@property (strong, nonatomic) AVCaptureMetadataOutput *metadataOutput; +@property (strong, nonatomic) AVCaptureSession *session; +@property (strong, nonatomic) AVCaptureVideoPreviewLayer *previewLayer; + +@property (copy, nonatomic) void (^completionBlock) (NSString *, NSString *); + +@end + +@implementation QRCodeReader + +- (id)init +{ + if ((self = [super init])) { + _metadataObjectTypes = @[AVMetadataObjectTypeQRCode]; + + [self setupAVComponents]; + [self configureDefaultComponents]; + } + return self; +} + +- (id)initWithMetadataObjectTypes:(NSArray *)metadataObjectTypes +{ + if ((self = [super init])) { + _metadataObjectTypes = metadataObjectTypes; + + [self setupAVComponents]; + [self configureDefaultComponents]; + } + return self; +} + ++ (instancetype)readerWithMetadataObjectTypes:(NSArray *)metadataObjectTypes +{ + return [[self alloc] initWithMetadataObjectTypes:metadataObjectTypes]; +} + +#pragma mark - Initializing the AV Components + +- (void)setupAVComponents +{ + self.defaultDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; + + if (_defaultDevice) { + self.defaultDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:_defaultDevice error:nil]; + self.metadataOutput = [[AVCaptureMetadataOutput alloc] init]; + self.session = [[AVCaptureSession alloc] init]; + self.previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.session]; + + for (AVCaptureDevice *device in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) { + if (device.position == AVCaptureDevicePositionFront) { + self.frontDevice = device; + } + } + + if (_frontDevice) { + self.frontDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:_frontDevice error:nil]; + } + } +} + +- (void)configureDefaultComponents +{ + [_session addOutput:_metadataOutput]; + + if (_defaultDeviceInput) { + [_session addInput:_defaultDeviceInput]; + } + + [_metadataOutput setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()]; + NSMutableSet *available = [NSMutableSet setWithArray:[_metadataOutput availableMetadataObjectTypes]]; + NSSet *desired = [NSSet setWithArray:_metadataObjectTypes]; + [available intersectSet:desired]; + [_metadataOutput setMetadataObjectTypes:available.allObjects]; + [_previewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill]; +} + +- (void)switchDeviceInput +{ + if (_frontDeviceInput) { + [_session beginConfiguration]; + + AVCaptureDeviceInput *currentInput = [_session.inputs firstObject]; + [_session removeInput:currentInput]; + + AVCaptureDeviceInput *newDeviceInput = (currentInput.device.position == AVCaptureDevicePositionFront) ? _defaultDeviceInput : _frontDeviceInput; + [_session addInput:newDeviceInput]; + + [_session commitConfiguration]; + } +} + +- (BOOL)hasFrontDevice +{ + return _frontDevice != nil; +} + +- (BOOL)isTorchAvailable +{ + return _defaultDevice.hasTorch; +} + +- (void)toggleTorch +{ + NSError *error = nil; + + [_defaultDevice lockForConfiguration:&error]; + + if (error == nil) { + AVCaptureTorchMode mode = _defaultDevice.torchMode; + + _defaultDevice.torchMode = mode == AVCaptureTorchModeOn ? AVCaptureTorchModeOff : AVCaptureTorchModeOn; + } + + [_defaultDevice unlockForConfiguration]; +} + +#pragma mark - Controlling Reader + +- (void)startScanning +{ + if (![self.session isRunning]) { + [self.session startRunning]; + } +} + +- (void)stopScanning +{ + if ([self.session isRunning]) { + [self.session stopRunning]; + } +} + +- (BOOL)running { + return self.session.running; +} + +#pragma mark - Managing the Orientation + ++ (AVCaptureVideoOrientation)videoOrientationFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + switch (interfaceOrientation) { + case UIInterfaceOrientationLandscapeLeft: + return AVCaptureVideoOrientationLandscapeLeft; + case UIInterfaceOrientationLandscapeRight: + return AVCaptureVideoOrientationLandscapeRight; + case UIInterfaceOrientationPortrait: + return AVCaptureVideoOrientationPortrait; + default: + return AVCaptureVideoOrientationPortraitUpsideDown; + } +} + +#pragma mark - Checking the Reader Availabilities + ++ (BOOL)isAvailable +{ + @autoreleasepool { + AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; + + if (!captureDevice) { + return NO; + } + + NSError *error; + AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:&error]; + + if (!deviceInput || error) { + return NO; + } + + return YES; + } +} + ++ (BOOL)supportsMetadataObjectTypes:(NSArray *)metadataObjectTypes +{ + if (![self isAvailable]) { + return NO; + } + + @autoreleasepool { + // Setup components + AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; + AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:nil]; + AVCaptureMetadataOutput *output = [[AVCaptureMetadataOutput alloc] init]; + AVCaptureSession *session = [[AVCaptureSession alloc] init]; + + [session addInput:deviceInput]; + [session addOutput:output]; + + if (metadataObjectTypes == nil || metadataObjectTypes.count == 0) { + // Check the QRCode metadata object type by default + metadataObjectTypes = @[AVMetadataObjectTypeQRCode]; + } + + for (NSString *metadataObjectType in metadataObjectTypes) { + if (![output.availableMetadataObjectTypes containsObject:metadataObjectType]) { + return NO; + } + } + + return YES; + } +} + +#pragma mark - Managing the Block + +- (void)setCompletionWithBlock:(void (^) (NSString *resultAsString, NSString *typeAsString))completionBlock +{ + self.completionBlock = completionBlock; +} + +#pragma mark - AVCaptureMetadataOutputObjects Delegate Methods + +- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection +{ + for (AVMetadataObject *current in metadataObjects) { + if ([current isKindOfClass:[AVMetadataMachineReadableCodeObject class]] + && [_metadataObjectTypes containsObject:current.type]) { + NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *)current stringValue]; + + if (_completionBlock) { + _completionBlock(scannedResult, current.type); + } + + break; + } + } +} + +@end diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderDelegate.h b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderDelegate.h new file mode 100644 index 0000000..77ae1be --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderDelegate.h @@ -0,0 +1,60 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +@class QRCodeReaderViewController; + +/** + * This protocol defines delegate methods for objects that implements the + * `QRCodeReaderDelegate`. The methods of the protocol allow the delegate to be + * notified when the reader did scan result and or when the user wants to stop + * to read some QRCodes. + */ +@protocol QRCodeReaderDelegate + +@optional + +#pragma mark - Listening for Reader Status +/** @name Listening for Reader Status */ + +/** + * @abstract Tells the delegate that the reader did scan a QRCode. + * @param reader The reader view controller that scanned a QRCode. + * @param result The content of the QRCode as a string. + * @since 1.0.0 + */ +// - (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result; +- (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result forType:(NSString *)type; + +/** + * @abstract Tells the delegate that the user wants to stop scanning QRCodes. + * @param reader The reader view controller that the user wants to stop. + * @since 1.0.0 + */ +- (void)readerDidCancel:(QRCodeReaderViewController *)reader; + +@end diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderView.h b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderView.h new file mode 100644 index 0000000..260350f --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderView.h @@ -0,0 +1,36 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +/** + * Overlay over the camera view to display the area (a square) where to scan the + * code. + * @since 2.0.0 + */ +@interface QRCodeReaderView : UIView + +@end diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderView.m b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderView.m new file mode 100644 index 0000000..60a1192 --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderView.m @@ -0,0 +1,80 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import "QRCodeReaderView.h" + +@interface QRCodeReaderView () +@property (nonatomic, strong) CAShapeLayer *overlay; + +@end + +@implementation QRCodeReaderView + +- (id)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) { + [self addOverlay]; + } + + return self; +} + +- (void)drawRect:(CGRect)rect +{ + CGRect innerRect = CGRectInset(rect, 50, 50); + + CGFloat minSize = MIN(innerRect.size.width, innerRect.size.height); + if (innerRect.size.width != minSize) { + innerRect.origin.x += (innerRect.size.width - minSize) / 2; + innerRect.size.width = minSize; + } + else if (innerRect.size.height != minSize) { + innerRect.origin.y += (innerRect.size.height - minSize) / 2; + innerRect.size.height = minSize; + } + + CGRect offsetRect = CGRectOffset(innerRect, 0, 15); + + + _overlay.path = [UIBezierPath bezierPathWithRoundedRect:offsetRect cornerRadius:5].CGPath; +} + +#pragma mark - Private Methods + +- (void)addOverlay +{ + _overlay = [[CAShapeLayer alloc] init]; + _overlay.backgroundColor = [UIColor clearColor].CGColor; + _overlay.fillColor = [UIColor clearColor].CGColor; + _overlay.strokeColor = [UIColor whiteColor].CGColor; + _overlay.lineWidth = 3; + _overlay.lineDashPattern = @[@7.0, @7.0]; + _overlay.lineDashPhase = 0; + + [self.layer addSublayer:_overlay]; +} + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReaderViewController.h b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderViewController.h old mode 100755 new mode 100644 similarity index 81% rename from src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReaderViewController.h rename to src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderViewController.h index 672285c..7967660 --- a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReaderViewController.h +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderViewController.h @@ -1,3 +1,29 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + #import #import "QRCodeReaderDelegate.h" #import "QRCodeReader.h" @@ -128,6 +154,7 @@ * scanning the codes when the view will appear. * @since 4.0.0 */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton; - (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton cancelButtonBackgroundColor:(nullable NSString *)cancelButtonBackgroundColor; /** @@ -139,11 +166,11 @@ * scanning the codes when the view will appear. * @param showSwitchCameraButton Flag to display the switch camera button. * @param showTorchButton Flag to know whether the view controller start - * @param showTorchButton Flag to know whether the view controller start * scanning the codes when the view will appear. * @see initWithCancelButtonTitle:codeReader:startScanningAtLoad:showSwitchCameraButton:showTorchButton: * @since 4.0.0 */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton; + (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton cancelButtonBackgroundColor:(nullable NSString *)cancelButtonBackgroundColor; #pragma mark - Controlling the Reader @@ -180,6 +207,7 @@ * is nil. * @since 1.0.1 */ +// - (void)setCompletionWithBlock:(nullable void (^) (NSString * __nullable resultAsString))completionBlock; - (void)setCompletionWithBlock:(nullable void (^) (NSString * __nullable resultAsString, NSString * __nullable typeAsString))completionBlock; #pragma mark - Managing the Reader diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderViewController.m b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderViewController.m new file mode 100644 index 0000000..9e3843d --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRCodeReaderViewController.m @@ -0,0 +1,391 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import "QRCodeReaderViewController.h" +#import "QRCameraSwitchButton.h" +#import "QRCodeReaderView.h" +#import "QRToggleTorchButton.h" + +@interface QRCodeReaderViewController () +@property (strong, nonatomic) QRCameraSwitchButton *switchCameraButton; +@property (strong, nonatomic) QRToggleTorchButton *toggleTorchButton; +@property (strong, nonatomic) QRCodeReaderView *cameraView; +@property (strong, nonatomic) UIButton *cancelButton; +@property (strong, nonatomic) QRCodeReader *codeReader; +@property (assign, nonatomic) BOOL startScanningAtLoad; +@property (assign, nonatomic) BOOL showSwitchCameraButton; +@property (assign, nonatomic) BOOL showTorchButton; + +@property (copy, nonatomic) void (^completionBlock) (NSString * __nullable, NSString * __nullable); + +@end + +@implementation QRCodeReaderViewController + +- (void)dealloc +{ + [self stopScanning]; + + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (id)init +{ + return [self initWithCancelButtonTitle:nil]; +} + +- (id)initWithCancelButtonTitle:(NSString *)cancelTitle +{ + return [self initWithCancelButtonTitle:cancelTitle metadataObjectTypes:@[AVMetadataObjectTypeQRCode]]; +} + +- (id)initWithMetadataObjectTypes:(NSArray *)metadataObjectTypes +{ + return [self initWithCancelButtonTitle:nil metadataObjectTypes:metadataObjectTypes]; +} + +- (id)initWithCancelButtonTitle:(NSString *)cancelTitle metadataObjectTypes:(NSArray *)metadataObjectTypes +{ + QRCodeReader *reader = [QRCodeReader readerWithMetadataObjectTypes:metadataObjectTypes]; + + return [self initWithCancelButtonTitle:cancelTitle codeReader:reader]; +} + +- (id)initWithCancelButtonTitle:(NSString *)cancelTitle codeReader:(QRCodeReader *)codeReader +{ + return [self initWithCancelButtonTitle:cancelTitle codeReader:codeReader startScanningAtLoad:true]; +} + +- (id)initWithCancelButtonTitle:(NSString *)cancelTitle codeReader:(QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad +{ + return [self initWithCancelButtonTitle:cancelTitle codeReader:codeReader startScanningAtLoad:startScanningAtLoad showSwitchCameraButton:YES showTorchButton:NO]; +} + +- (id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton +{ + return [self initWithCancelButtonTitle:cancelTitle codeReader:codeReader startScanningAtLoad:startScanningAtLoad showSwitchCameraButton:showSwitchCameraButton showTorchButton:showTorchButton cancelButtonBackgroundColor:NULL]; +} + +- (id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton cancelButtonBackgroundColor:(nullable NSString *)cancelButtonBackgroundColor +{ + if ((self = [super init])) { + self.view.backgroundColor = [UIColor blackColor]; + self.codeReader = codeReader; + self.startScanningAtLoad = startScanningAtLoad; + self.showSwitchCameraButton = showSwitchCameraButton; + self.showTorchButton = showTorchButton; + + if (cancelTitle == nil) { + cancelTitle = NSLocalizedString(@"Cancel", @"Cancel"); + } + + [self setupUIComponentsWithCancelButtonTitle:cancelTitle cancelButtonBackgroundColor:cancelButtonBackgroundColor]; + [self setupAutoLayoutConstraints]; + + [_cameraView.layer insertSublayer:_codeReader.previewLayer atIndex:0]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; + + __weak __typeof__(self) weakSelf = self; + + [codeReader setCompletionWithBlock:^(NSString *resultAsString, NSString *typeAsString) { + if (weakSelf.completionBlock != nil) { + weakSelf.completionBlock(resultAsString, typeAsString); + } + + if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(reader:didScanResult:forType:)]) { + [weakSelf.delegate reader:weakSelf didScanResult:resultAsString forType:typeAsString]; + } + }]; + } + return self; +} + ++ (instancetype)readerWithCancelButtonTitle:(NSString *)cancelTitle +{ + return [[self alloc] initWithCancelButtonTitle:cancelTitle]; +} + ++ (instancetype)readerWithMetadataObjectTypes:(NSArray *)metadataObjectTypes +{ + return [[self alloc] initWithMetadataObjectTypes:metadataObjectTypes]; +} + ++ (instancetype)readerWithCancelButtonTitle:(NSString *)cancelTitle metadataObjectTypes:(NSArray *)metadataObjectTypes +{ + return [[self alloc] initWithCancelButtonTitle:cancelTitle metadataObjectTypes:metadataObjectTypes]; +} + ++ (instancetype)readerWithCancelButtonTitle:(NSString *)cancelTitle codeReader:(QRCodeReader *)codeReader +{ + return [[self alloc] initWithCancelButtonTitle:cancelTitle codeReader:codeReader]; +} + ++ (instancetype)readerWithCancelButtonTitle:(NSString *)cancelTitle codeReader:(QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad +{ + return [[self alloc] initWithCancelButtonTitle:cancelTitle codeReader:codeReader startScanningAtLoad:startScanningAtLoad]; +} + ++ (instancetype)readerWithCancelButtonTitle:(NSString *)cancelTitle codeReader:(QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton +{ + return [[self alloc] initWithCancelButtonTitle:cancelTitle codeReader:codeReader startScanningAtLoad:startScanningAtLoad showSwitchCameraButton:showSwitchCameraButton showTorchButton:showTorchButton]; +} + ++ (instancetype)readerWithCancelButtonTitle:(NSString *)cancelTitle codeReader:(QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton cancelButtonBackgroundColor:(nullable NSString *)cancelButtonBackgroundColor +{ + return [[self alloc] initWithCancelButtonTitle:cancelTitle codeReader:codeReader startScanningAtLoad:startScanningAtLoad showSwitchCameraButton:showSwitchCameraButton showTorchButton:showTorchButton cancelButtonBackgroundColor:cancelButtonBackgroundColor]; +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + if (_startScanningAtLoad) { + [self startScanning]; + } +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [self stopScanning]; + + [super viewWillDisappear:animated]; +} + +- (void)viewWillLayoutSubviews +{ + [super viewWillLayoutSubviews]; + + _codeReader.previewLayer.frame = self.view.bounds; +} + +- (BOOL)shouldAutorotate +{ + return YES; +} + +#pragma mark - Controlling the Reader + +- (void)startScanning { + [_codeReader startScanning]; +} + +- (void)stopScanning { + [_codeReader stopScanning]; +} + +#pragma mark - Managing the Orientation + +- (void)orientationChanged:(NSNotification *)notification +{ + [_cameraView setNeedsDisplay]; + + if (_codeReader.previewLayer.connection.isVideoOrientationSupported) { + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; + + _codeReader.previewLayer.connection.videoOrientation = [QRCodeReader videoOrientationFromInterfaceOrientation: + orientation]; + } +} + +#pragma mark - Managing the Block + +- (void)setCompletionWithBlock:(void (^) (NSString *resultAsString, NSString * __nullable typeAsString))completionBlock +{ + self.completionBlock = completionBlock; +} + +#pragma mark - Initializing the AV Components + +- (UIColor*) hex:(NSString*)hexCode { + + NSString *noHashString = [hexCode stringByReplacingOccurrencesOfString:@"#" withString:@""]; + NSScanner *scanner = [NSScanner scannerWithString:noHashString]; + [scanner setCharactersToBeSkipped:[NSCharacterSet symbolCharacterSet]]; + + unsigned hex; + if (![scanner scanHexInt:&hex]) return nil; + int a; + int r; + int g; + int b; + + switch (noHashString.length) { + case 3: + a = 255; + r = (hex >> 8) * 17; + g = ((hex >> 4) & 0xF) * 17; + b = ((hex >> 0) & 0xF) * 17; + break; + case 6: + a = 255; + r = (hex >> 16); + g = (hex >> 8) & 0xFF; + b = (hex) & 0xFF; + break; + case 8: + a = (hex >> 24); + r = (hex >> 16) & 0xFF; + g = (hex >> 8) & 0xFF; + b = (hex) & 0xFF; + break; + + default: + a = 255.0; + r = 255.0; + b = 255.0; + g = 255.0; + break; + } + + return [UIColor colorWithRed:r / 255.0f green:g / 255.0f blue:b / 255.0f alpha:a / 255]; +} + +- (void)setupUIComponentsWithCancelButtonTitle:(NSString *)cancelButtonTitle cancelButtonBackgroundColor:(NSString *)cancelButtonBackgroundColor +{ + self.cameraView = [[QRCodeReaderView alloc] init]; + _cameraView.translatesAutoresizingMaskIntoConstraints = NO; + _cameraView.clipsToBounds = YES; + [self.view addSubview:_cameraView]; + + [_codeReader.previewLayer setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; + + if ([_codeReader.previewLayer.connection isVideoOrientationSupported]) { + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; + + _codeReader.previewLayer.connection.videoOrientation = [QRCodeReader videoOrientationFromInterfaceOrientation:orientation]; + } + + if (_showSwitchCameraButton && [_codeReader hasFrontDevice]) { + _switchCameraButton = [[QRCameraSwitchButton alloc] init]; + + [_switchCameraButton setTranslatesAutoresizingMaskIntoConstraints:false]; + [_switchCameraButton addTarget:self action:@selector(switchCameraAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:_switchCameraButton]; + } + + if (_showTorchButton && [_codeReader isTorchAvailable]) { + _toggleTorchButton = [[QRToggleTorchButton alloc] init]; + + [_toggleTorchButton setTranslatesAutoresizingMaskIntoConstraints:false]; + [_toggleTorchButton addTarget:self action:@selector(toggleTorchAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:_toggleTorchButton]; + } + + self.cancelButton = [[UIButton alloc] init]; + if(cancelButtonBackgroundColor) { + @try { + self.cancelButton.backgroundColor = [self hex:cancelButtonBackgroundColor]; + } + @catch (NSException * e) { + NSLog(@"Exception: %@", e); + } + } + _cancelButton.translatesAutoresizingMaskIntoConstraints = NO; + [_cancelButton setTitle:cancelButtonTitle forState:UIControlStateNormal]; + [_cancelButton setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; + [_cancelButton addTarget:self action:@selector(cancelAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:_cancelButton]; +} + +- (void)setupAutoLayoutConstraints +{ + NSLayoutYAxisAnchor * topLayoutAnchor; + NSLayoutYAxisAnchor * bottomLayoutAnchor; + NSLayoutXAxisAnchor * leftLayoutAnchor; + NSLayoutXAxisAnchor * rightLayoutAnchor; + if (@available(iOS 11.0, *)) { + topLayoutAnchor = self.view.safeAreaLayoutGuide.topAnchor; + bottomLayoutAnchor = self.view.safeAreaLayoutGuide.bottomAnchor; + leftLayoutAnchor = self.view.safeAreaLayoutGuide.leftAnchor; + rightLayoutAnchor = self.view.safeAreaLayoutGuide.rightAnchor; + } else { + topLayoutAnchor = self.topLayoutGuide.topAnchor; + bottomLayoutAnchor = self.bottomLayoutGuide.bottomAnchor; + leftLayoutAnchor = self.view.leftAnchor; + rightLayoutAnchor = self.view.rightAnchor; + } + + NSDictionary *views = NSDictionaryOfVariableBindings(_cameraView, _cancelButton); + + [self.view addConstraints: + [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_cameraView][_cancelButton(40)]" options:0 metrics:nil views:views]]; + [[bottomLayoutAnchor constraintEqualToAnchor:_cancelButton.bottomAnchor] setActive:YES]; + [self.view addConstraints: + [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_cameraView]|" options:0 metrics:nil views:views]]; + [self.view addConstraints: + [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_cancelButton]-|" options:0 metrics:nil views:views]]; + + if (_switchCameraButton) { + [NSLayoutConstraint activateConstraints:@[ + [topLayoutAnchor constraintEqualToAnchor:_switchCameraButton.topAnchor], + [rightLayoutAnchor constraintEqualToAnchor:_switchCameraButton.rightAnchor], + [_switchCameraButton.heightAnchor constraintEqualToConstant:50], + [_switchCameraButton.widthAnchor constraintEqualToConstant:70] + ]]; + } + + if (_toggleTorchButton) { + [NSLayoutConstraint activateConstraints:@[ + [topLayoutAnchor constraintEqualToAnchor:_toggleTorchButton.topAnchor], + [leftLayoutAnchor constraintEqualToAnchor:_toggleTorchButton.leftAnchor], + [_toggleTorchButton.heightAnchor constraintEqualToConstant:50], + [_toggleTorchButton.widthAnchor constraintEqualToConstant:70] + ]]; + } +} + +- (void)switchDeviceInput +{ + [_codeReader switchDeviceInput]; +} + +#pragma mark - Catching Button Events + +- (void)cancelAction:(UIButton *)button +{ + [_codeReader stopScanning]; + + if (_completionBlock) { + _completionBlock(nil, nil); + } + + if (_delegate && [_delegate respondsToSelector:@selector(readerDidCancel:)]) { + [_delegate readerDidCancel:self]; + } +} + +- (void)switchCameraAction:(UIButton *)button +{ + [self switchDeviceInput]; +} + +- (void)toggleTorchAction:(UIButton *)button +{ + [_codeReader toggleTorch]; +} + +@end diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRToggleTorchButton.h b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRToggleTorchButton.h new file mode 100644 index 0000000..37727cc --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRToggleTorchButton.h @@ -0,0 +1,66 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +/** + * The toggle toch button. + * @since 4.0.0 + */ +@interface QRToggleTorchButton : UIButton + +#pragma mark - Managing Properties +/** @name Managing Properties */ + +/** + * @abstract The edge color of the drawing. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeColor; + +/** + * @abstract The fill color of the drawing. + * @discussion The default color is the darkgray. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillColor; + +/** + * @abstract The edge color of the drawing when the button is touched. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeHighlightedColor; + +/** + * @abstract The fill color of the drawing when the button is touched. + * @discussion The default color is the black. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillHighlightedColor; + +@end diff --git a/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRToggleTorchButton.m b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRToggleTorchButton.m new file mode 100644 index 0000000..cbf9797 --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/BarcodeScannerFramework/QRToggleTorchButton.m @@ -0,0 +1,130 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import "QRToggleTorchButton.h" + +@implementation QRToggleTorchButton + +- (id)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) { + _edgeColor = [UIColor whiteColor]; + _fillColor = [UIColor darkGrayColor]; + _edgeHighlightedColor = [UIColor whiteColor]; + _fillHighlightedColor = [UIColor blackColor]; + } + return self; +} + +- (void)drawRect:(CGRect)rect +{ + // Colors + + UIColor *paintColor = (self.state != UIControlStateHighlighted) ? _fillColor : _fillHighlightedColor; + UIColor *strokeColor = (self.state != UIControlStateHighlighted) ? _edgeColor : _edgeHighlightedColor; + + // Torch box + + CGFloat width = rect.size.width; + CGFloat height = rect.size.height; + CGFloat centerX = width / 2; + CGFloat centerY = height / 2; + + CGFloat strokeLineWidth = 2; + CGFloat circleRadius = width / 10; + CGFloat lineLength = width / 10; + CGFloat lineOffset = width / 10; + CGFloat lineOriginFromCenter = circleRadius + lineOffset; + + //Circle + UIBezierPath *circlePath = [UIBezierPath bezierPath]; + [circlePath addArcWithCenter:CGPointMake(centerX, centerY) radius:circleRadius startAngle:0.0 endAngle:M_PI clockwise:YES]; + [circlePath addArcWithCenter:CGPointMake(centerX, centerY) radius:circleRadius startAngle:M_PI endAngle:M_PI * 2 clockwise:YES]; + + // Draw beams + [paintColor setFill]; + + for (int i = 0; i < 8; i++) { + CGFloat angle = ((2 * M_PI) / 8) * i; + + CGPoint startPoint = CGPointMake(centerX + cos(angle) * lineOriginFromCenter, centerY + sin(angle) * lineOriginFromCenter); + CGPoint endPoint = CGPointMake(centerX + cos(angle) * (lineOriginFromCenter + lineLength), centerY + sin(angle) * (lineOriginFromCenter + lineLength)); + + UIBezierPath *beamPath = [self linePathWithStartPoint:startPoint endPoint:endPoint thickness:strokeLineWidth]; + [beamPath stroke]; + } + + // Draw circle + [strokeColor setFill]; + + circlePath.lineWidth = strokeLineWidth; + [circlePath fill]; + [circlePath stroke]; +} + +- (UIBezierPath *)linePathWithStartPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint thickness:(CGFloat)thickness { + UIBezierPath *linePath = [UIBezierPath bezierPath]; + + [linePath moveToPoint:startPoint]; + [linePath addLineToPoint:endPoint]; + + linePath.lineCapStyle = kCGLineCapRound; + linePath.lineWidth = thickness; + + return linePath; +} + +// MARK: - UIResponder Methods + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesBegan:touches withEvent:event]; + + [self setNeedsDisplay]; +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesMoved:touches withEvent:event]; + + [self setNeedsDisplay]; +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesEnded:touches withEvent:event]; + + [self setNeedsDisplay]; +} + +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +{ + [super touchesCancelled:touches withEvent:event]; + + [self setNeedsDisplay]; +} + +@end diff --git a/src/native-src/ios/BarcodeScannerFramework/build.sh b/src/native-src/ios/BarcodeScannerFramework/build.sh new file mode 100755 index 0000000..2785815 --- /dev/null +++ b/src/native-src/ios/BarcodeScannerFramework/build.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +echo "Set exit on simple errors" +set -e + +PACKAGENAME=BarcodeScannerFramework +OUTPUTPATH=$(PWD)/build +COPYPATH=../../../platforms/ios +# make xcode builds deterministic +export ZERO_AR_DATE=1 + +rm -rf $OUTPUTPATH + +echo "Build for iphonesimulator" +xcodebuild \ + -project $PACKAGENAME.xcodeproj \ + -scheme $PACKAGENAME \ + -sdk iphonesimulator \ + -configuration Release \ + clean build \ + BUILD_DIR=$OUTPUTPATH \ + SKIP_INSTALL=NO \ + -quiet + +echo "Build for iphoneos" +xcodebuild \ + -project $PACKAGENAME.xcodeproj \ + -scheme $PACKAGENAME \ + -sdk iphoneos \ + -configuration Release \ + clean build \ + BUILD_DIR=$OUTPUTPATH \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + SKIP_INSTALL=NO \ + -quiet + +echo "Creating XCFramework" +xcodebuild \ + -create-xcframework \ + -framework $OUTPUTPATH/Release-iphoneos/$PACKAGENAME.framework \ + -debug-symbols $OUTPUTPATH/Release-iphoneos/$PACKAGENAME.framework.dSYM \ + -framework $OUTPUTPATH/Release-iphonesimulator/$PACKAGENAME.framework \ + -debug-symbols $OUTPUTPATH/Release-iphonesimulator/$PACKAGENAME.framework.dSYM \ + -output $OUTPUTPATH/$PACKAGENAME.xcframework + + +mkdir -p $COPYPATH +cp -R $OUTPUTPATH/$PACKAGENAME.xcframework $COPYPATH/ \ No newline at end of file diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/BarcodeScannerFramework b/src/platforms/ios/BarcodeScannerFramework.framework/BarcodeScannerFramework deleted file mode 100755 index b7ce9a4..0000000 Binary files a/src/platforms/ios/BarcodeScannerFramework.framework/BarcodeScannerFramework and /dev/null differ diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCameraSwitchButton.h b/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCameraSwitchButton.h deleted file mode 100755 index c0e4d96..0000000 --- a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCameraSwitchButton.h +++ /dev/null @@ -1,40 +0,0 @@ -#import - -/** - * The camera switch button. - * @since 2.0.0 - */ -@interface QRCameraSwitchButton : UIButton - -#pragma mark - Managing Properties -/** @name Managing Properties */ - -/** - * @abstract The edge color of the drawing. - * @discussion The default color is the white. - * @since 2.0.0 - */ -@property (nonatomic, strong) UIColor *edgeColor; - -/** - * @abstract The fill color of the drawing. - * @discussion The default color is the darkgray. - * @since 2.0.0 - */ -@property (nonatomic, strong) UIColor *fillColor; - -/** - * @abstract The edge color of the drawing when the button is touched. - * @discussion The default color is the white. - * @since 2.0.0 - */ -@property (nonatomic, strong) UIColor *edgeHighlightedColor; - -/** - * @abstract The fill color of the drawing when the button is touched. - * @discussion The default color is the black. - * @since 2.0.0 - */ -@property (nonatomic, strong) UIColor *fillHighlightedColor; - -@end diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReaderDelegate.h b/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReaderDelegate.h deleted file mode 100755 index c45f590..0000000 --- a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReaderDelegate.h +++ /dev/null @@ -1,31 +0,0 @@ -@class QRCodeReaderViewController; - -/** - * This protocol defines delegate methods for objects that implements the - * `QRCodeReaderDelegate`. The methods of the protocol allow the delegate to be - * notified when the reader did scan result and or when the user wants to stop - * to read some QRCodes. - */ -@protocol QRCodeReaderDelegate - -@optional - -#pragma mark - Listening for Reader Status -/** @name Listening for Reader Status */ - -/** - * @abstract Tells the delegate that the reader did scan a QRCode. - * @param reader The reader view controller that scanned a QRCode. - * @param result The content of the QRCode as a string. - * @since 1.0.0 - */ -- (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result forType:(NSString *)type; - -/** - * @abstract Tells the delegate that the user wants to stop scanning QRCodes. - * @param reader The reader view controller that the user wants to stop. - * @since 1.0.0 - */ -- (void)readerDidCancel:(QRCodeReaderViewController *)reader; - -@end \ No newline at end of file diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReaderView.h b/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReaderView.h deleted file mode 100755 index 46dd6ee..0000000 --- a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRCodeReaderView.h +++ /dev/null @@ -1,8 +0,0 @@ -#import - -/** - * Overlay over the camera view to display the area (a square) where to scan the code. - */ -@interface QRCodeReaderView : UIView - -@end diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRToggleTorchButton.h b/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRToggleTorchButton.h deleted file mode 100755 index 70e7851..0000000 --- a/src/platforms/ios/BarcodeScannerFramework.framework/Headers/QRToggleTorchButton.h +++ /dev/null @@ -1,40 +0,0 @@ -#import - -/** - * The toggle toch button. - * @since 4.0.0 - */ -@interface QRToggleTorchButton : UIButton - -#pragma mark - Managing Properties -/** @name Managing Properties */ - -/** - * @abstract The edge color of the drawing. - * @discussion The default color is the white. - * @since 2.0.0 - */ -@property (nonatomic, strong) UIColor *edgeColor; - -/** - * @abstract The fill color of the drawing. - * @discussion The default color is the darkgray. - * @since 2.0.0 - */ -@property (nonatomic, strong) UIColor *fillColor; - -/** - * @abstract The edge color of the drawing when the button is touched. - * @discussion The default color is the white. - * @since 2.0.0 - */ -@property (nonatomic, strong) UIColor *edgeHighlightedColor; - -/** - * @abstract The fill color of the drawing when the button is touched. - * @discussion The default color is the black. - * @since 2.0.0 - */ -@property (nonatomic, strong) UIColor *fillHighlightedColor; - -@end diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/Info.plist b/src/platforms/ios/BarcodeScannerFramework.framework/Info.plist deleted file mode 100644 index 6e7f58f..0000000 Binary files a/src/platforms/ios/BarcodeScannerFramework.framework/Info.plist and /dev/null differ diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/beep.caf b/src/platforms/ios/BarcodeScannerFramework.framework/beep.caf deleted file mode 100755 index 4bce167..0000000 Binary files a/src/platforms/ios/BarcodeScannerFramework.framework/beep.caf and /dev/null differ diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/Info.plist b/src/platforms/ios/BarcodeScannerFramework.xcframework/Info.plist new file mode 100644 index 0000000..4f8e1f0 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/Info.plist @@ -0,0 +1,44 @@ + + + + + AvailableLibraries + + + DebugSymbolsPath + dSYMs + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + BarcodeScannerFramework.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + DebugSymbolsPath + dSYMs + LibraryIdentifier + ios-arm64 + LibraryPath + BarcodeScannerFramework.framework + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/BarcodeScannerFramework b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/BarcodeScannerFramework new file mode 100755 index 0000000..e643145 Binary files /dev/null and b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/BarcodeScannerFramework differ diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/BarcodeScannerFramework.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/BarcodeScannerFramework.h new file mode 100644 index 0000000..a989e30 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/BarcodeScannerFramework.h @@ -0,0 +1,18 @@ +// +// BarcodeScannerFramework.h +// BarcodeScannerFramework +// +// Created by Eduardo Speroni on 5/17/22. +// + +#import "QRCodeReaderViewController.h" + +//! Project version number for BarcodeScannerFramework. +FOUNDATION_EXPORT double BarcodeScannerFrameworkVersionNumber; + +//! Project version string for BarcodeScannerFramework. +FOUNDATION_EXPORT const unsigned char BarcodeScannerFrameworkVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCameraSwitchButton.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCameraSwitchButton.h new file mode 100644 index 0000000..f63e997 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCameraSwitchButton.h @@ -0,0 +1,66 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +/** + * The camera switch button. + * @since 2.0.0 + */ +@interface QRCameraSwitchButton : UIButton + +#pragma mark - Managing Properties +/** @name Managing Properties */ + +/** + * @abstract The edge color of the drawing. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeColor; + +/** + * @abstract The fill color of the drawing. + * @discussion The default color is the darkgray. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillColor; + +/** + * @abstract The edge color of the drawing when the button is touched. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeHighlightedColor; + +/** + * @abstract The fill color of the drawing when the button is touched. + * @discussion The default color is the black. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillHighlightedColor; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReader.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReader.h new file mode 100644 index 0000000..af4c92f --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReader.h @@ -0,0 +1,204 @@ +/* + * QRCodeReader + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import +#import +#import + +/** + * Reader object base on the `AVCaptureDevice` to read / scan 1D and 2D codes. + */ +@interface QRCodeReader : NSObject + +#pragma mark - Creating and Inializing QRCode Readers +/** @name Creating and Inializing QRCode Readers */ + +/** + * @abstract Initializes a reader with the `QRCode` metadata object type. + * @since 4.1.0 + */ +- (nonnull id)init; + +/** + * @abstract Initializes a reader with a list of metadata object types. + * @param metadataObjectTypes An array of strings identifying the types of + * metadata objects to process. + * @since 3.0.0 + */ +- (nonnull id)initWithMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Creates a reader with a list of metadata object types. + * @param metadataObjectTypes An array of strings identifying the types of + * metadata objects to process. + * @see initWithMetadataObjectTypes: + * @since 3.0.0 + */ ++ (nonnull instancetype)readerWithMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +#pragma mark - Checking the Reader Availabilities +/** @name Checking the Reader Availabilities */ + +/** + * @abstract Returns whether the reader is available with the current device. + * @return a Boolean value indicating whether the reader is available. + * @since 3.0.0 + */ ++ (BOOL)isAvailable; + +/** + * @abstract Checks and return whether the given metadata object types are + * supported by the current device. + * @return a Boolean value indicating whether the given metadata object types + * are supported by the current device. + * @since 3.2.0 + */ ++ (BOOL)supportsMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +#pragma mark - Checking the Metadata Items Types +/** @name Checking the Metadata Items Types */ + +/** + * @abstract An array of strings identifying the types of metadata objects to + * process. + * @since 3.0.0 + */ +@property (strong, nonatomic, readonly) NSArray * _Nonnull metadataObjectTypes; + +#pragma mark - Viewing the Camera +/** @name Viewing the Camera */ + +/** + * @abstract CALayer that you use to display video as it is being captured + * by an input device. + * @since 3.0.0 + */ +@property (strong, nonatomic, readonly) AVCaptureVideoPreviewLayer * _Nonnull previewLayer; + +#pragma mark - Controlling the Reader +/** @name Controlling the Reader */ + +/** + * @abstract Starts scanning the codes. + * @since 3.0.0 + */ +- (void)startScanning; + +/** + * @abstract Stops scanning the codes. + * @since 3.0.0 + */ +- (void)stopScanning; + +/** + * @abstract Indicates whether the session is currently running. + * @discussion The value of this property is a Bool indicating whether the + * receiver is running. + * Clients can key value observe the value of this property to be notified + * when the session automatically starts or stops running. + * @since 3.3.0 + */ +- (BOOL)running; + +/** + * @abstract Switch between the back and the front camera. + * @since 3.0.0 + */ +- (void)switchDeviceInput; + +/** + * @abstract Returns true whether a front device is available. + * @return true whether a front device is available. + * @since 3.0.0 + */ +- (BOOL)hasFrontDevice; + +/** + * @abstract Returns true whether a torch is available. + * @return true if a torch is available. + * @since 4.0.0 + */ +- (BOOL)isTorchAvailable; + +/** + * @abstract Toggles torch on the default device. + * @since 4.0.0 + */ +- (void)toggleTorch; + +#pragma mark - Getting Inputs and Outputs +/** @name Getting Inputs and Outputs */ + +/** + * @abstract Accessing to the `AVCaptureDeviceInput` object representing + * the default device input (generally the back camera). + * @since 3.5.0 + */ +@property (readonly) AVCaptureDeviceInput * _Nonnull defaultDeviceInput; + +/** + * @abstract Accessing to the `AVCaptureDeviceInput` object representing + * the front device input. + * @since 3.5.0 + */ +@property (readonly) AVCaptureDeviceInput * _Nullable frontDeviceInput; + +/** + * @abstract Accessing to the `AVCaptureMetadataOutput` object. + * @discussion It allows you to configure the scanner to restrict the area of + * the scan to the overlay one for example. + * @since 3.5.0 + */ +@property (readonly) AVCaptureMetadataOutput * _Nonnull metadataOutput; + +#pragma mark - Managing the Orientation +/** @name Managing the Orientation */ + +/** + * @abstract Returns the video orientation correspongind to the given interface + * orientation. + * @param interfaceOrientation An interface orientation. + * @return the video orientation correspongind to the given device orientation. + * @since 3.1.0 + */ ++ (AVCaptureVideoOrientation)videoOrientationFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; + +#pragma mark - Managing the Block +/** @name Managing the Block */ + +/** + * @abstract Sets the completion with a block that executes when a QRCode + * or when the user did stopped the scan. + * @param completionBlock The block to be executed. This block has no + * return value and takes one argument: the `resultAsString`. If the user + * stop the scan and that there is no response the `resultAsString` argument + * is nil. + * @since 3.0.0 + */ +// - (void)setCompletionWithBlock:(nullable void (^) (NSString * _Nullable resultAsString))completionBlock; +- (void)setCompletionWithBlock:(nullable void (^) (NSString * _Nullable resultAsString, NSString * _Nullable typeAsString))completionBlock; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReaderDelegate.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReaderDelegate.h new file mode 100644 index 0000000..77ae1be --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReaderDelegate.h @@ -0,0 +1,60 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +@class QRCodeReaderViewController; + +/** + * This protocol defines delegate methods for objects that implements the + * `QRCodeReaderDelegate`. The methods of the protocol allow the delegate to be + * notified when the reader did scan result and or when the user wants to stop + * to read some QRCodes. + */ +@protocol QRCodeReaderDelegate + +@optional + +#pragma mark - Listening for Reader Status +/** @name Listening for Reader Status */ + +/** + * @abstract Tells the delegate that the reader did scan a QRCode. + * @param reader The reader view controller that scanned a QRCode. + * @param result The content of the QRCode as a string. + * @since 1.0.0 + */ +// - (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result; +- (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result forType:(NSString *)type; + +/** + * @abstract Tells the delegate that the user wants to stop scanning QRCodes. + * @param reader The reader view controller that the user wants to stop. + * @since 1.0.0 + */ +- (void)readerDidCancel:(QRCodeReaderViewController *)reader; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReaderView.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReaderView.h new file mode 100644 index 0000000..260350f --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReaderView.h @@ -0,0 +1,36 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +/** + * Overlay over the camera view to display the area (a square) where to scan the + * code. + * @since 2.0.0 + */ +@interface QRCodeReaderView : UIView + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReaderViewController.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReaderViewController.h new file mode 100644 index 0000000..7967660 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRCodeReaderViewController.h @@ -0,0 +1,222 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import +#import "QRCodeReaderDelegate.h" +#import "QRCodeReader.h" + +/** + * Convenient controller to display a view to scan/read 1D or 2D bar codes like + * the QRCodes. It is based on the `AVFoundation` framework from Apple. It aims + * to replace ZXing or ZBar for iOS 7 and over. + */ +@interface QRCodeReaderViewController : UIViewController + +#pragma mark - Creating and Inializing QRCodeReader Controllers +/** @name Creating and Inializing QRCode Reader Controllers */ + +/** + * @abstract Initializes a view controller to read QRCodes from a displayed + * video preview and a cancel button to be go back. + * @param cancelTitle The title of the cancel button. + * @discussion This convenient method is used to instanciate a reader with + * only one supported metadata object types: the QRCode. + * @see initWithCancelButtonTitle:metadataObjectTypes: + * @since 1.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle; + +/** + * @abstract Creates a view controller to read QRCodes from a displayed + * video preview and a cancel button to be go back. + * @param cancelTitle The title of the cancel button. + * @see initWithCancelButtonTitle: + * @since 1.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle; + +/** + * @abstract Initializes a reader view controller with a list of metadata + * object types. + * @param metadataObjectTypes An array of strings identifying the types of + * metadata objects to process. + * @see initWithCancelButtonTitle:metadataObjectTypes: + * @since 3.0.0 + */ +- (nonnull id)initWithMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Creates a reader view controller with a list of metadata object + * types. + * @param metadataObjectTypes An array of strings identifying the types of + * metadata objects to process. + * @see initWithMetadataObjectTypes: + * @since 3.0.0 + */ ++ (nonnull instancetype)readerWithMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Initializes a view controller to read wanted metadata object + * types from a displayed video preview and a cancel button to be go back. + * @param cancelTitle The title of the cancel button. + * @param metadataObjectTypes The type (“symbology”) of barcode to scan. + * @see initWithCancelButtonTitle:codeReader: + * @since 2.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle metadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Creates a view controller to read wanted metadata object types + * from a displayed video preview and a cancel button to be go back. + * @param cancelTitle The title of the cancel button. + * @param metadataObjectTypes The type (“symbology”) of barcode to scan. + * @see initWithCancelButtonTitle:metadataObjectTypes: + * @since 2.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle metadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @see initWithCancelButtonTitle:codeReader:startScanningAtLoad: + * @since 3.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @see initWithCancelButtonTitle:codeReader: + * @since 3.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @param startScanningAtLoad Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @see initWithCancelButtonTitle:codeReader: + * @since 3.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @param startScanningAtLoad Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @see initWithCancelButtonTitle:codeReader:startScanningAtLoad:showSwitchCameraButton:showTorchButton: + * @since 3.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @param startScanningAtLoad Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @param showSwitchCameraButton Flag to display the switch camera button. + * @param showTorchButton Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @since 4.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton; +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton cancelButtonBackgroundColor:(nullable NSString *)cancelButtonBackgroundColor; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @param startScanningAtLoad Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @param showSwitchCameraButton Flag to display the switch camera button. + * @param showTorchButton Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @see initWithCancelButtonTitle:codeReader:startScanningAtLoad:showSwitchCameraButton:showTorchButton: + * @since 4.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton; ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton cancelButtonBackgroundColor:(nullable NSString *)cancelButtonBackgroundColor; + +#pragma mark - Controlling the Reader +/** @name Controlling the Reader */ + +/** + * @abstract Starts scanning the codes. + * @since 3.0.0 + */ +- (void)startScanning; + +/** + * @abstract Stops scanning the codes. + * @since 3.0.0 + */ +- (void)stopScanning; + +#pragma mark - Managing the Delegate +/** @name Managing the Delegate */ + +/** + * @abstract The object that acts as the delegate of the receiving QRCode + * reader. + * @since 1.0.0 + */ +@property (nonatomic, strong) id __nullable delegate; + +/** + * @abstract Sets the completion with a block that executes when a QRCode + * or when the user did stopped the scan. + * @param completionBlock The block to be executed. This block has no + * return value and takes one argument: the `resultAsString`. If the user + * stop the scan and that there is no response the `resultAsString` argument + * is nil. + * @since 1.0.1 + */ +// - (void)setCompletionWithBlock:(nullable void (^) (NSString * __nullable resultAsString))completionBlock; +- (void)setCompletionWithBlock:(nullable void (^) (NSString * __nullable resultAsString, NSString * __nullable typeAsString))completionBlock; + +#pragma mark - Managing the Reader +/** @name Managing the Reader */ + +/** + * @abstract The default code reader created with the controller. + * @since 3.0.0 + */ +@property (strong, nonatomic, readonly) QRCodeReader * __nonnull codeReader; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRToggleTorchButton.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRToggleTorchButton.h new file mode 100644 index 0000000..37727cc --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Headers/QRToggleTorchButton.h @@ -0,0 +1,66 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +/** + * The toggle toch button. + * @since 4.0.0 + */ +@interface QRToggleTorchButton : UIButton + +#pragma mark - Managing Properties +/** @name Managing Properties */ + +/** + * @abstract The edge color of the drawing. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeColor; + +/** + * @abstract The fill color of the drawing. + * @discussion The default color is the darkgray. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillColor; + +/** + * @abstract The edge color of the drawing when the button is touched. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeHighlightedColor; + +/** + * @abstract The fill color of the drawing when the button is touched. + * @discussion The default color is the black. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillHighlightedColor; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Info.plist b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Info.plist new file mode 100644 index 0000000..9d8ed98 Binary files /dev/null and b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Info.plist differ diff --git a/src/platforms/ios/BarcodeScannerFramework.framework/Modules/module.modulemap b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Modules/module.modulemap similarity index 100% rename from src/platforms/ios/BarcodeScannerFramework.framework/Modules/module.modulemap rename to src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/BarcodeScannerFramework.framework/Modules/module.modulemap diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Info.plist b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Info.plist new file mode 100644 index 0000000..5820dc9 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.com.telerik.BarcodeScannerFramework + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Resources/DWARF/BarcodeScannerFramework b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Resources/DWARF/BarcodeScannerFramework new file mode 100644 index 0000000..ce98094 Binary files /dev/null and b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Resources/DWARF/BarcodeScannerFramework differ diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/BarcodeScannerFramework b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/BarcodeScannerFramework new file mode 100755 index 0000000..99ed775 Binary files /dev/null and b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/BarcodeScannerFramework differ diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/BarcodeScannerFramework.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/BarcodeScannerFramework.h new file mode 100644 index 0000000..a989e30 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/BarcodeScannerFramework.h @@ -0,0 +1,18 @@ +// +// BarcodeScannerFramework.h +// BarcodeScannerFramework +// +// Created by Eduardo Speroni on 5/17/22. +// + +#import "QRCodeReaderViewController.h" + +//! Project version number for BarcodeScannerFramework. +FOUNDATION_EXPORT double BarcodeScannerFrameworkVersionNumber; + +//! Project version string for BarcodeScannerFramework. +FOUNDATION_EXPORT const unsigned char BarcodeScannerFrameworkVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCameraSwitchButton.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCameraSwitchButton.h new file mode 100644 index 0000000..f63e997 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCameraSwitchButton.h @@ -0,0 +1,66 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +/** + * The camera switch button. + * @since 2.0.0 + */ +@interface QRCameraSwitchButton : UIButton + +#pragma mark - Managing Properties +/** @name Managing Properties */ + +/** + * @abstract The edge color of the drawing. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeColor; + +/** + * @abstract The fill color of the drawing. + * @discussion The default color is the darkgray. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillColor; + +/** + * @abstract The edge color of the drawing when the button is touched. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeHighlightedColor; + +/** + * @abstract The fill color of the drawing when the button is touched. + * @discussion The default color is the black. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillHighlightedColor; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReader.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReader.h new file mode 100644 index 0000000..af4c92f --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReader.h @@ -0,0 +1,204 @@ +/* + * QRCodeReader + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import +#import +#import + +/** + * Reader object base on the `AVCaptureDevice` to read / scan 1D and 2D codes. + */ +@interface QRCodeReader : NSObject + +#pragma mark - Creating and Inializing QRCode Readers +/** @name Creating and Inializing QRCode Readers */ + +/** + * @abstract Initializes a reader with the `QRCode` metadata object type. + * @since 4.1.0 + */ +- (nonnull id)init; + +/** + * @abstract Initializes a reader with a list of metadata object types. + * @param metadataObjectTypes An array of strings identifying the types of + * metadata objects to process. + * @since 3.0.0 + */ +- (nonnull id)initWithMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Creates a reader with a list of metadata object types. + * @param metadataObjectTypes An array of strings identifying the types of + * metadata objects to process. + * @see initWithMetadataObjectTypes: + * @since 3.0.0 + */ ++ (nonnull instancetype)readerWithMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +#pragma mark - Checking the Reader Availabilities +/** @name Checking the Reader Availabilities */ + +/** + * @abstract Returns whether the reader is available with the current device. + * @return a Boolean value indicating whether the reader is available. + * @since 3.0.0 + */ ++ (BOOL)isAvailable; + +/** + * @abstract Checks and return whether the given metadata object types are + * supported by the current device. + * @return a Boolean value indicating whether the given metadata object types + * are supported by the current device. + * @since 3.2.0 + */ ++ (BOOL)supportsMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +#pragma mark - Checking the Metadata Items Types +/** @name Checking the Metadata Items Types */ + +/** + * @abstract An array of strings identifying the types of metadata objects to + * process. + * @since 3.0.0 + */ +@property (strong, nonatomic, readonly) NSArray * _Nonnull metadataObjectTypes; + +#pragma mark - Viewing the Camera +/** @name Viewing the Camera */ + +/** + * @abstract CALayer that you use to display video as it is being captured + * by an input device. + * @since 3.0.0 + */ +@property (strong, nonatomic, readonly) AVCaptureVideoPreviewLayer * _Nonnull previewLayer; + +#pragma mark - Controlling the Reader +/** @name Controlling the Reader */ + +/** + * @abstract Starts scanning the codes. + * @since 3.0.0 + */ +- (void)startScanning; + +/** + * @abstract Stops scanning the codes. + * @since 3.0.0 + */ +- (void)stopScanning; + +/** + * @abstract Indicates whether the session is currently running. + * @discussion The value of this property is a Bool indicating whether the + * receiver is running. + * Clients can key value observe the value of this property to be notified + * when the session automatically starts or stops running. + * @since 3.3.0 + */ +- (BOOL)running; + +/** + * @abstract Switch between the back and the front camera. + * @since 3.0.0 + */ +- (void)switchDeviceInput; + +/** + * @abstract Returns true whether a front device is available. + * @return true whether a front device is available. + * @since 3.0.0 + */ +- (BOOL)hasFrontDevice; + +/** + * @abstract Returns true whether a torch is available. + * @return true if a torch is available. + * @since 4.0.0 + */ +- (BOOL)isTorchAvailable; + +/** + * @abstract Toggles torch on the default device. + * @since 4.0.0 + */ +- (void)toggleTorch; + +#pragma mark - Getting Inputs and Outputs +/** @name Getting Inputs and Outputs */ + +/** + * @abstract Accessing to the `AVCaptureDeviceInput` object representing + * the default device input (generally the back camera). + * @since 3.5.0 + */ +@property (readonly) AVCaptureDeviceInput * _Nonnull defaultDeviceInput; + +/** + * @abstract Accessing to the `AVCaptureDeviceInput` object representing + * the front device input. + * @since 3.5.0 + */ +@property (readonly) AVCaptureDeviceInput * _Nullable frontDeviceInput; + +/** + * @abstract Accessing to the `AVCaptureMetadataOutput` object. + * @discussion It allows you to configure the scanner to restrict the area of + * the scan to the overlay one for example. + * @since 3.5.0 + */ +@property (readonly) AVCaptureMetadataOutput * _Nonnull metadataOutput; + +#pragma mark - Managing the Orientation +/** @name Managing the Orientation */ + +/** + * @abstract Returns the video orientation correspongind to the given interface + * orientation. + * @param interfaceOrientation An interface orientation. + * @return the video orientation correspongind to the given device orientation. + * @since 3.1.0 + */ ++ (AVCaptureVideoOrientation)videoOrientationFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; + +#pragma mark - Managing the Block +/** @name Managing the Block */ + +/** + * @abstract Sets the completion with a block that executes when a QRCode + * or when the user did stopped the scan. + * @param completionBlock The block to be executed. This block has no + * return value and takes one argument: the `resultAsString`. If the user + * stop the scan and that there is no response the `resultAsString` argument + * is nil. + * @since 3.0.0 + */ +// - (void)setCompletionWithBlock:(nullable void (^) (NSString * _Nullable resultAsString))completionBlock; +- (void)setCompletionWithBlock:(nullable void (^) (NSString * _Nullable resultAsString, NSString * _Nullable typeAsString))completionBlock; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReaderDelegate.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReaderDelegate.h new file mode 100644 index 0000000..77ae1be --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReaderDelegate.h @@ -0,0 +1,60 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +@class QRCodeReaderViewController; + +/** + * This protocol defines delegate methods for objects that implements the + * `QRCodeReaderDelegate`. The methods of the protocol allow the delegate to be + * notified when the reader did scan result and or when the user wants to stop + * to read some QRCodes. + */ +@protocol QRCodeReaderDelegate + +@optional + +#pragma mark - Listening for Reader Status +/** @name Listening for Reader Status */ + +/** + * @abstract Tells the delegate that the reader did scan a QRCode. + * @param reader The reader view controller that scanned a QRCode. + * @param result The content of the QRCode as a string. + * @since 1.0.0 + */ +// - (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result; +- (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result forType:(NSString *)type; + +/** + * @abstract Tells the delegate that the user wants to stop scanning QRCodes. + * @param reader The reader view controller that the user wants to stop. + * @since 1.0.0 + */ +- (void)readerDidCancel:(QRCodeReaderViewController *)reader; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReaderView.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReaderView.h new file mode 100644 index 0000000..260350f --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReaderView.h @@ -0,0 +1,36 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +/** + * Overlay over the camera view to display the area (a square) where to scan the + * code. + * @since 2.0.0 + */ +@interface QRCodeReaderView : UIView + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReaderViewController.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReaderViewController.h new file mode 100644 index 0000000..7967660 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRCodeReaderViewController.h @@ -0,0 +1,222 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import +#import "QRCodeReaderDelegate.h" +#import "QRCodeReader.h" + +/** + * Convenient controller to display a view to scan/read 1D or 2D bar codes like + * the QRCodes. It is based on the `AVFoundation` framework from Apple. It aims + * to replace ZXing or ZBar for iOS 7 and over. + */ +@interface QRCodeReaderViewController : UIViewController + +#pragma mark - Creating and Inializing QRCodeReader Controllers +/** @name Creating and Inializing QRCode Reader Controllers */ + +/** + * @abstract Initializes a view controller to read QRCodes from a displayed + * video preview and a cancel button to be go back. + * @param cancelTitle The title of the cancel button. + * @discussion This convenient method is used to instanciate a reader with + * only one supported metadata object types: the QRCode. + * @see initWithCancelButtonTitle:metadataObjectTypes: + * @since 1.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle; + +/** + * @abstract Creates a view controller to read QRCodes from a displayed + * video preview and a cancel button to be go back. + * @param cancelTitle The title of the cancel button. + * @see initWithCancelButtonTitle: + * @since 1.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle; + +/** + * @abstract Initializes a reader view controller with a list of metadata + * object types. + * @param metadataObjectTypes An array of strings identifying the types of + * metadata objects to process. + * @see initWithCancelButtonTitle:metadataObjectTypes: + * @since 3.0.0 + */ +- (nonnull id)initWithMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Creates a reader view controller with a list of metadata object + * types. + * @param metadataObjectTypes An array of strings identifying the types of + * metadata objects to process. + * @see initWithMetadataObjectTypes: + * @since 3.0.0 + */ ++ (nonnull instancetype)readerWithMetadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Initializes a view controller to read wanted metadata object + * types from a displayed video preview and a cancel button to be go back. + * @param cancelTitle The title of the cancel button. + * @param metadataObjectTypes The type (“symbology”) of barcode to scan. + * @see initWithCancelButtonTitle:codeReader: + * @since 2.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle metadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Creates a view controller to read wanted metadata object types + * from a displayed video preview and a cancel button to be go back. + * @param cancelTitle The title of the cancel button. + * @param metadataObjectTypes The type (“symbology”) of barcode to scan. + * @see initWithCancelButtonTitle:metadataObjectTypes: + * @since 2.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle metadataObjectTypes:(nonnull NSArray *)metadataObjectTypes; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @see initWithCancelButtonTitle:codeReader:startScanningAtLoad: + * @since 3.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @see initWithCancelButtonTitle:codeReader: + * @since 3.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @param startScanningAtLoad Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @see initWithCancelButtonTitle:codeReader: + * @since 3.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @param startScanningAtLoad Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @see initWithCancelButtonTitle:codeReader:startScanningAtLoad:showSwitchCameraButton:showTorchButton: + * @since 3.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @param startScanningAtLoad Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @param showSwitchCameraButton Flag to display the switch camera button. + * @param showTorchButton Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @since 4.0.0 + */ +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton; +- (nonnull id)initWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton cancelButtonBackgroundColor:(nullable NSString *)cancelButtonBackgroundColor; + +/** + * @abstract Initializes a view controller using a cancel button title and + * a code reader. + * @param cancelTitle The title of the cancel button. + * @param codeReader The reader to decode the codes. + * @param startScanningAtLoad Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @param showSwitchCameraButton Flag to display the switch camera button. + * @param showTorchButton Flag to know whether the view controller start + * scanning the codes when the view will appear. + * @see initWithCancelButtonTitle:codeReader:startScanningAtLoad:showSwitchCameraButton:showTorchButton: + * @since 4.0.0 + */ ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton; ++ (nonnull instancetype)readerWithCancelButtonTitle:(nullable NSString *)cancelTitle codeReader:(nonnull QRCodeReader *)codeReader startScanningAtLoad:(BOOL)startScanningAtLoad showSwitchCameraButton:(BOOL)showSwitchCameraButton showTorchButton:(BOOL)showTorchButton cancelButtonBackgroundColor:(nullable NSString *)cancelButtonBackgroundColor; + +#pragma mark - Controlling the Reader +/** @name Controlling the Reader */ + +/** + * @abstract Starts scanning the codes. + * @since 3.0.0 + */ +- (void)startScanning; + +/** + * @abstract Stops scanning the codes. + * @since 3.0.0 + */ +- (void)stopScanning; + +#pragma mark - Managing the Delegate +/** @name Managing the Delegate */ + +/** + * @abstract The object that acts as the delegate of the receiving QRCode + * reader. + * @since 1.0.0 + */ +@property (nonatomic, strong) id __nullable delegate; + +/** + * @abstract Sets the completion with a block that executes when a QRCode + * or when the user did stopped the scan. + * @param completionBlock The block to be executed. This block has no + * return value and takes one argument: the `resultAsString`. If the user + * stop the scan and that there is no response the `resultAsString` argument + * is nil. + * @since 1.0.1 + */ +// - (void)setCompletionWithBlock:(nullable void (^) (NSString * __nullable resultAsString))completionBlock; +- (void)setCompletionWithBlock:(nullable void (^) (NSString * __nullable resultAsString, NSString * __nullable typeAsString))completionBlock; + +#pragma mark - Managing the Reader +/** @name Managing the Reader */ + +/** + * @abstract The default code reader created with the controller. + * @since 3.0.0 + */ +@property (strong, nonatomic, readonly) QRCodeReader * __nonnull codeReader; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRToggleTorchButton.h b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRToggleTorchButton.h new file mode 100644 index 0000000..37727cc --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Headers/QRToggleTorchButton.h @@ -0,0 +1,66 @@ +/* + * QRCodeReaderViewController + * + * Copyright 2014-present Yannick Loriot. + * http://yannickloriot.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#import + +/** + * The toggle toch button. + * @since 4.0.0 + */ +@interface QRToggleTorchButton : UIButton + +#pragma mark - Managing Properties +/** @name Managing Properties */ + +/** + * @abstract The edge color of the drawing. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeColor; + +/** + * @abstract The fill color of the drawing. + * @discussion The default color is the darkgray. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillColor; + +/** + * @abstract The edge color of the drawing when the button is touched. + * @discussion The default color is the white. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *edgeHighlightedColor; + +/** + * @abstract The fill color of the drawing when the button is touched. + * @discussion The default color is the black. + * @since 2.0.0 + */ +@property (nonatomic, strong) UIColor *fillHighlightedColor; + +@end diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Info.plist b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Info.plist new file mode 100644 index 0000000..e7f7033 Binary files /dev/null and b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Info.plist differ diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Modules/module.modulemap b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Modules/module.modulemap new file mode 100644 index 0000000..2687093 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module BarcodeScannerFramework { + umbrella header "BarcodeScannerFramework.h" + + export * + module * { export * } +} diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/_CodeSignature/CodeResources b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..651cca8 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/BarcodeScannerFramework.framework/_CodeSignature/CodeResources @@ -0,0 +1,190 @@ + + + + + files + + Headers/BarcodeScannerFramework.h + + 39opdctdJ66yULCT4nIz+6PoR/o= + + Headers/QRCameraSwitchButton.h + + 0mr1FdMaNpSnIKM8Ec4jrBzWR4Y= + + Headers/QRCodeReader.h + + LDTahdPGo74JFyism9MSdiedr30= + + Headers/QRCodeReaderDelegate.h + + FFwPBmS8ujG02c6PfPP+ZlhUyYI= + + Headers/QRCodeReaderView.h + + wvVwtc7tda5Uvox7ABAB2VNLhls= + + Headers/QRCodeReaderViewController.h + + QrTk7t6/g8LJvnz3TSJHVy+bvHk= + + Headers/QRToggleTorchButton.h + + e4wzMZ3V9oGELw6k1LEX2rFOrXg= + + Info.plist + + 5vkv/321f580xLLgQBls4eIttpM= + + Modules/module.modulemap + + FbeEYX+rJuU9ln+MtY+g4Ky3Gcw= + + + files2 + + Headers/BarcodeScannerFramework.h + + hash2 + + pSECB/XbTxpdeIMimJt8FkL8dPOof1tttfvQ3HUBJhQ= + + + Headers/QRCameraSwitchButton.h + + hash2 + + p+jx2O1XYIkLDzdqEchOgLXR+vAFpcMAetRvm1+ZVMo= + + + Headers/QRCodeReader.h + + hash2 + + MbEXVmXya5C6StZkcXaoZA014bRbILp8wyv1hjlcDck= + + + Headers/QRCodeReaderDelegate.h + + hash2 + + X8cnZ5Za44vs6K2DD2R+klXSe3YxsZ3Hu9ZDrnTNP7g= + + + Headers/QRCodeReaderView.h + + hash2 + + QvPKJGz0HUMdKJ/C4/4mltMEkDEJK6GogHzy/6I7/f0= + + + Headers/QRCodeReaderViewController.h + + hash2 + + VFVGaNCLvSA9nWuQ3XGlp6sal8WlKrSdjIrXSwr1n0I= + + + Headers/QRToggleTorchButton.h + + hash2 + + KUkHn7mowwkQL0V7gyUKKHLN8VTbb4QkfB5QIyUFK88= + + + Modules/module.modulemap + + hash2 + + Sz/3Wy1BBymXakDXVqnRa6PoFflH2p9V8an5dA+HXes= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Info.plist b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Info.plist new file mode 100644 index 0000000..5820dc9 --- /dev/null +++ b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.com.telerik.BarcodeScannerFramework + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Resources/DWARF/BarcodeScannerFramework b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Resources/DWARF/BarcodeScannerFramework new file mode 100644 index 0000000..2e49e99 Binary files /dev/null and b/src/platforms/ios/BarcodeScannerFramework.xcframework/ios-arm64_x86_64-simulator/dSYMs/BarcodeScannerFramework.framework.dSYM/Contents/Resources/DWARF/BarcodeScannerFramework differ diff --git a/src/platforms/ios/typings/BarcodeScannerFramework.d.ts b/src/platforms/ios/typings/BarcodeScannerFramework.d.ts index 815dd7b..4d301c5 100644 --- a/src/platforms/ios/typings/BarcodeScannerFramework.d.ts +++ b/src/platforms/ios/typings/BarcodeScannerFramework.d.ts @@ -1,113 +1,119 @@ + declare var BarcodeScannerFrameworkVersionNumber: number; declare var BarcodeScannerFrameworkVersionString: interop.Reference; declare class QRCodeReader extends NSObject { - static alloc(): QRCodeReader; // inherited from NSObject + static alloc(): QRCodeReader; // inherited from NSObject - static isAvailable(): boolean; + static isAvailable(): boolean; - static new(): QRCodeReader; // inherited from NSObject + static new(): QRCodeReader; // inherited from NSObject - static readerWithMetadataObjectTypes(metadataObjectTypes: NSArray): QRCodeReader; + static readerWithMetadataObjectTypes(metadataObjectTypes: NSArray | any[]): QRCodeReader; - static supportsMetadataObjectTypes(metadataObjectTypes: NSArray): boolean; + static supportsMetadataObjectTypes(metadataObjectTypes: NSArray | any[]): boolean; - static videoOrientationFromInterfaceOrientation(interfaceOrientation: UIInterfaceOrientation): AVCaptureVideoOrientation; + static videoOrientationFromInterfaceOrientation(interfaceOrientation: UIInterfaceOrientation): AVCaptureVideoOrientation; - readonly defaultDeviceInput: AVCaptureDeviceInput; + readonly defaultDeviceInput: AVCaptureDeviceInput; - readonly frontDeviceInput: AVCaptureDeviceInput; + readonly frontDeviceInput: AVCaptureDeviceInput; - readonly metadataObjectTypes: NSArray; + readonly metadataObjectTypes: NSArray; - readonly metadataOutput: AVCaptureMetadataOutput; + readonly metadataOutput: AVCaptureMetadataOutput; - readonly previewLayer: AVCaptureVideoPreviewLayer; + readonly previewLayer: AVCaptureVideoPreviewLayer; - constructor(o: { metadataObjectTypes: NSArray; }); + constructor(o: { metadataObjectTypes: NSArray | any[]; }); - hasFrontDevice(): boolean; + hasFrontDevice(): boolean; - initWithMetadataObjectTypes(metadataObjectTypes: NSArray): this; + initWithMetadataObjectTypes(metadataObjectTypes: NSArray | any[]): this; - isTorchAvailable(): boolean; + isTorchAvailable(): boolean; - running(): boolean; + running(): boolean; - setCompletionWithBlock(completionBlock: (p1: string, p2: string) => void): void; + setCompletionWithBlock(completionBlock: (p1: string, p2: string) => void): void; - startScanning(): void; + startScanning(): void; - stopScanning(): void; + stopScanning(): void; - switchDeviceInput(): void; + switchDeviceInput(): void; - toggleTorch(): void; + toggleTorch(): void; } interface QRCodeReaderDelegate extends NSObjectProtocol { - readerDidCancel?(reader: QRCodeReaderViewController): void; + readerDidCancel?(reader: QRCodeReaderViewController): void; - readerDidScanResultForType?(reader: QRCodeReaderViewController, result: string, type: string): void; + readerDidScanResultForType?(reader: QRCodeReaderViewController, result: string, type: string): void; } - declare var QRCodeReaderDelegate: { - prototype: QRCodeReaderDelegate; + prototype: QRCodeReaderDelegate; }; declare class QRCodeReaderViewController extends UIViewController { - static alloc(): QRCodeReaderViewController; // inherited from NSObject + static alloc(): QRCodeReaderViewController; // inherited from NSObject + + static new(): QRCodeReaderViewController; // inherited from NSObject + + static readerWithCancelButtonTitle(cancelTitle: string): QRCodeReaderViewController; + + static readerWithCancelButtonTitleCodeReader(cancelTitle: string, codeReader: QRCodeReader): QRCodeReaderViewController; - static new(): QRCodeReaderViewController; // inherited from NSObject + static readerWithCancelButtonTitleCodeReaderStartScanningAtLoad(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean): QRCodeReaderViewController; - static readerWithCancelButtonTitle(cancelTitle: string): QRCodeReaderViewController; + static readerWithCancelButtonTitleCodeReaderStartScanningAtLoadShowSwitchCameraButtonShowTorchButton(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean, showSwitchCameraButton: boolean, showTorchButton: boolean): QRCodeReaderViewController; - static readerWithCancelButtonTitleCodeReader(cancelTitle: string, codeReader: QRCodeReader): QRCodeReaderViewController; + static readerWithCancelButtonTitleCodeReaderStartScanningAtLoadShowSwitchCameraButtonShowTorchButtonCancelButtonBackgroundColor(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean, showSwitchCameraButton: boolean, showTorchButton: boolean, cancelButtonBackgroundColor: string): QRCodeReaderViewController; - static readerWithCancelButtonTitleCodeReaderStartScanningAtLoad(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean): QRCodeReaderViewController; + static readerWithCancelButtonTitleMetadataObjectTypes(cancelTitle: string, metadataObjectTypes: NSArray | any[]): QRCodeReaderViewController; - static readerWithCancelButtonTitleCodeReaderStartScanningAtLoadShowSwitchCameraButtonShowTorchButtonCancelButtonBackgroundColor(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean, showSwitchCameraButton: boolean, showTorchButton: boolean, cancelButtonBackgroundColor: string): QRCodeReaderViewController; + static readerWithMetadataObjectTypes(metadataObjectTypes: NSArray | any[]): QRCodeReaderViewController; - static readerWithCancelButtonTitleMetadataObjectTypes(cancelTitle: string, metadataObjectTypes: NSArray): QRCodeReaderViewController; + readonly codeReader: QRCodeReader; - static readerWithMetadataObjectTypes(metadataObjectTypes: NSArray): QRCodeReaderViewController; + delegate: QRCodeReaderDelegate; - readonly codeReader: QRCodeReader; + constructor(o: { cancelButtonTitle: string; }); - delegate: QRCodeReaderDelegate; + constructor(o: { cancelButtonTitle: string; codeReader: QRCodeReader; }); - constructor(o: { cancelButtonTitle: string; }); + constructor(o: { cancelButtonTitle: string; codeReader: QRCodeReader; startScanningAtLoad: boolean; }); - constructor(o: { cancelButtonTitle: string; codeReader: QRCodeReader; }); + constructor(o: { cancelButtonTitle: string; codeReader: QRCodeReader; startScanningAtLoad: boolean; showSwitchCameraButton: boolean; showTorchButton: boolean; }); - constructor(o: { cancelButtonTitle: string; codeReader: QRCodeReader; startScanningAtLoad: boolean; }); + constructor(o: { cancelButtonTitle: string; codeReader: QRCodeReader; startScanningAtLoad: boolean; showSwitchCameraButton: boolean; showTorchButton: boolean; cancelButtonBackgroundColor: string; }); - constructor(o: { cancelButtonTitle: string; codeReader: QRCodeReader; startScanningAtLoad: boolean; showSwitchCameraButton: boolean; showTorchButton: boolean; cancelButtonBackgroundColor: string; }); + constructor(o: { cancelButtonTitle: string; metadataObjectTypes: NSArray | any[]; }); - constructor(o: { cancelButtonTitle: string; metadataObjectTypes: NSArray; }); + constructor(o: { metadataObjectTypes: NSArray | any[]; }); - constructor(o: { metadataObjectTypes: NSArray; }); + initWithCancelButtonTitle(cancelTitle: string): this; - initWithCancelButtonTitle(cancelTitle: string): this; + initWithCancelButtonTitleCodeReader(cancelTitle: string, codeReader: QRCodeReader): this; - initWithCancelButtonTitleCodeReader(cancelTitle: string, codeReader: QRCodeReader): this; + initWithCancelButtonTitleCodeReaderStartScanningAtLoad(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean): this; - initWithCancelButtonTitleCodeReaderStartScanningAtLoad(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean): this; + initWithCancelButtonTitleCodeReaderStartScanningAtLoadShowSwitchCameraButtonShowTorchButton(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean, showSwitchCameraButton: boolean, showTorchButton: boolean): this; - initWithCancelButtonTitleCodeReaderStartScanningAtLoadShowSwitchCameraButtonShowTorchButtonCancelButtonBackgroundColor(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean, showSwitchCameraButton: boolean, showTorchButton: boolean, cancelButtonBackgroundColor: string): this; + initWithCancelButtonTitleCodeReaderStartScanningAtLoadShowSwitchCameraButtonShowTorchButtonCancelButtonBackgroundColor(cancelTitle: string, codeReader: QRCodeReader, startScanningAtLoad: boolean, showSwitchCameraButton: boolean, showTorchButton: boolean, cancelButtonBackgroundColor: string): this; - initWithCancelButtonTitleMetadataObjectTypes(cancelTitle: string, metadataObjectTypes: NSArray): this; + initWithCancelButtonTitleMetadataObjectTypes(cancelTitle: string, metadataObjectTypes: NSArray | any[]): this; - initWithMetadataObjectTypes(metadataObjectTypes: NSArray): this; + initWithMetadataObjectTypes(metadataObjectTypes: NSArray | any[]): this; - setCompletionWithBlock(completionBlock: (p1: string, p2: string) => void): void; + setCompletionWithBlock(completionBlock: (p1: string, p2: string) => void): void; - startScanning(): void; + startScanning(): void; - stopScanning(): void; + stopScanning(): void; }