Hi,
i’m trying to implement QR/EAN barcode scanner and i will use for this existing module https://github.com/bolav/fuse-barcodescanner
I downloaded actual version of MTBBarcodeScanner library and i have it integrated in this module. Now is it builded correctly after few modifications.
But what i don’t understand is, how can i make this UIView, in which will be camera, visible with UX ?
This is part of UNO implementation.
using Uno;
using Uno.Collections;
using Fuse;
using Fuse.Scripting;
using Fuse.Reactive;
using Uno.Compiler.ExportTargetInterop;
[Require("Source.Include", "MTBBarcodeScanner.h")]
[ForeignInclude(Language.ObjC, "MTBBasicExampleViewController.h")]
public class BarcodeScanner : NativeModule {
public BarcodeScanner(){
AddMember(new NativeFunction("scanner",
(NativeCallback)Scanner));
}
object Scanner(Context c, object[] args){
Scanner();
return null;
}
[Foreign(Language.ObjC)]
static extern(iOS) void Scanner()
@{
UIView *previewView = [UIApplication sharedApplication].keyWindow;
NSLog(@"This is it: %@", @"This is my string text!");
MTBBarcodeScanner *scanner = [[MTBBarcodeScanner alloc] initWithPreviewView:previewView];
[MTBBarcodeScanner requestCameraPermissionWithSuccess:^(BOOL success) {
if (success) {
NSError *error;
[self.scanner startScanningWithResultBlock:^(NSArray *codes) {
AVMetadataMachineReadableCodeObject *code = [codes firstObject];
NSLog(@"Found code: %@", code.stringValue);
[self.scanner stopScanning];
} error:&error];
} else {
NSLog(@"The user denied access to the camera");
// The user denied access to the camera
}
}];
@}
static extern(!iOS) void Scanner(){
debug_log("Barcode Scanner is not supported on this platform");
}
}