ios demo version
This commit is contained in:
@@ -7,10 +7,11 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Flutter
|
||||
|
||||
extension ZBarSymbolSet: Sequence {
|
||||
public typealias Element = ZBarSymbol
|
||||
public typealias Iterator = NSFastEnumerationIterator
|
||||
//public typealias Element = ZBarSymbol
|
||||
//public typealias Iterator = NSFastEnumerationIterator
|
||||
|
||||
public func makeIterator() -> NSFastEnumerationIterator {
|
||||
return NSFastEnumerationIterator(self)
|
||||
@@ -18,7 +19,8 @@ extension ZBarSymbolSet: Sequence {
|
||||
}
|
||||
|
||||
@objc class ScannerViewController: UIViewController, ZBarReaderDelegate {
|
||||
|
||||
var platformChannel: FlutterMethodChannel?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
}
|
||||
@@ -28,20 +30,35 @@ extension ZBarSymbolSet: Sequence {
|
||||
let readerViewController = ZBarReaderViewController()
|
||||
readerViewController.readerDelegate = self
|
||||
readerViewController.readerView.zoom = 1.0
|
||||
readerViewController.showsZBarControls = false
|
||||
readerViewController.showsZBarControls = true
|
||||
self.present(readerViewController, animated: true)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
|
||||
guard let symbols = info[ZBarReaderControllerResults] as? ZBarSymbolSet else { return }
|
||||
|
||||
for symbol in symbols {
|
||||
|
||||
if let symbol = symbol as? ZBarSymbol, let data = symbol.data {
|
||||
|
||||
let toast = UIAlertView()
|
||||
toast.message = data
|
||||
toast.show()
|
||||
|
||||
if let platformChannel = self.platformChannel {
|
||||
self.dismiss(animated: true, completion: {
|
||||
self.presentingViewController?.dismiss(animated: true, completion: {
|
||||
platformChannel.invokeMethod("findUserAndPurchase", arguments: [data], result: { (result: Any?) in
|
||||
print("\(result ?? "")")
|
||||
})
|
||||
})
|
||||
})
|
||||
// let result = platformChannel.invokeMethod("getUserByCode", arguments: [data], handleResult(result: FlutterResult))
|
||||
// print(result);
|
||||
}
|
||||
|
||||
// let toast = UIAlertView()
|
||||
// toast.message = data
|
||||
// toast.show()
|
||||
|
||||
navigationController?.popViewController(animated: true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user