Рамка вокруг сканнера iOS

This commit is contained in:
Ivan Murashov
2018-04-23 21:52:59 +03:00
parent bc02327b3e
commit 2d912ff2f6
8 changed files with 204 additions and 20 deletions

View File

@@ -29,4 +29,5 @@ Flutter/Flutter.framework
Flutter/Generated.xcconfig
ServiceDefinitions.json
Podfile.lock
Pods/

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AD_UNIT_ID_FOR_BANNER_TEST</key>
<string>ca-app-pub-3940256099942544/2934735716</string>
<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
<string>ca-app-pub-3940256099942544/4411468910</string>
<key>CLIENT_ID</key>
<string>930872418262-g3cgir5nalm3lkrcnn1aoi1t3mkg63b7.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.930872418262-g3cgir5nalm3lkrcnn1aoi1t3mkg63b7</string>
<key>API_KEY</key>
<string>AIzaSyCZr-Ra2PdsMDs9reukPrW7BHY5bbp0VN0</string>
<key>GCM_SENDER_ID</key>
<string>930872418262</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.dinect.checker.autoclub.app</string>
<key>PROJECT_ID</key>
<string>choker-d8897</string>
<key>STORAGE_BUCKET</key>
<string>choker-d8897.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<true></true>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<false></false>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:930872418262:ios:c192655afeda9a29</string>
<key>DATABASE_URL</key>
<string>https://choker-d8897.firebaseio.com</string>
</dict>
</plist>

View File

@@ -8,6 +8,7 @@ end
target Runner do
# Pods for Runner
pod 'Firebase'
# Flutter Pods
pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR']
@@ -28,7 +29,8 @@ target Runner do
end
end
target Dinect do
# Pods for Runner
# Pods for Dinect
pod 'Firebase'
# Flutter Pods
pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR']
@@ -49,7 +51,8 @@ target Dinect do
end
end
target Crypto do
# Pods for Runner
# Pods for Crypto
pod 'Firebase'
# Flutter Pods
pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR']

View File

@@ -1,10 +1,32 @@
PODS:
- Firebase (4.9.0):
- Firebase/Core (= 4.9.0)
- Firebase/Core (4.9.0):
- FirebaseAnalytics (= 4.0.9)
- FirebaseCore (= 4.0.15)
- FirebaseAnalytics (4.0.9):
- FirebaseCore (~> 4.0)
- FirebaseInstanceID (~> 2.0)
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
- nanopb (~> 0.3)
- FirebaseCore (4.0.15):
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
- FirebaseInstanceID (2.0.9):
- FirebaseCore (~> 4.0)
- Flutter (1.0.0)
- FMDB (2.7.2):
- FMDB/standard (= 2.7.2)
- FMDB/standard (2.7.2)
- GoogleToolboxForMac/Defines (2.1.3)
- GoogleToolboxForMac/NSData+zlib (2.1.3):
- GoogleToolboxForMac/Defines (= 2.1.3)
- image_picker (0.0.1):
- Flutter
- nanopb (0.3.8):
- nanopb/decode (= 0.3.8)
- nanopb/encode (= 0.3.8)
- nanopb/decode (0.3.8)
- nanopb/encode (0.3.8)
- path_provider (0.0.1):
- Flutter
- sqflite (0.0.1):
@@ -15,30 +37,37 @@ PODS:
- ZXingObjC/All (3.2.2)
DEPENDENCIES:
- Flutter (from `/Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release`)
- image_picker (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios`)
- path_provider (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios`)
- sqflite (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/sqflite-0.8.4/ios`)
- Firebase
- Flutter (from `/Users/kifio/flutter/bin/cache/artifacts/engine/ios`)
- image_picker (from `/Users/kifio/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios`)
- path_provider (from `/Users/kifio/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios`)
- sqflite (from `/Users/kifio/.pub-cache/hosted/pub.dartlang.org/sqflite-0.8.4/ios`)
- ZXingObjC (~> 3.2.2)
EXTERNAL SOURCES:
Flutter:
:path: /Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release
:path: /Users/kifio/flutter/bin/cache/artifacts/engine/ios
image_picker:
:path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios
:path: /Users/kifio/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios
path_provider:
:path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios
:path: /Users/kifio/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios
sqflite:
:path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/sqflite-0.8.4/ios
:path: /Users/kifio/.pub-cache/hosted/pub.dartlang.org/sqflite-0.8.4/ios
SPEC CHECKSUMS:
Firebase: 632216af3ed7f31e3be34776947fdc7546cfb572
FirebaseAnalytics: 388b630c15713f5dbf364071f5f3d6077fb52f4e
FirebaseCore: 3bd047463058fa6b5d312c97502c52e45401cdfb
FirebaseInstanceID: d2058a35e9bebda1b6dd42486b84917bde552a9d
Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
FMDB: 6198a90e7b6900cfc046e6bc0ef6ebb7be9236aa
GoogleToolboxForMac: 2501e2ad72a52eb3dfe7bd9aee7dad11b858bd20
image_picker: ee00aab0487cedc80a304085219503cc6d0f2e22
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
path_provider: 09407919825bfe3c2deae39453b7a5b44f467873
sqflite: d1612813fa7db7c667bed9f1d1b508deffc56999
ZXingObjC: 2c95a0dc52daac69b23ec78fad8fa2fec05f8981
PODFILE CHECKSUM: bc84f52b27b79dc608eec3537282fdff2347d9b4
PODFILE CHECKSUM: a023f10f95f916199687af47ef83b54859958d0d
COCOAPODS: 1.4.0

View File

@@ -4,6 +4,11 @@
<dict>
<key>SchemeUserState</key>
<dict>
<key>BioChecker.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>14</integer>
</dict>
<key>Dinect INT.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
@@ -12,13 +17,18 @@
<key>Dinect-Crypto.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>5</integer>
</dict>
<key>Dinect.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>11</integer>
</dict>
<key>Dinect.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>13</integer>
</dict>
<key>Runner.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>

View File

@@ -1,10 +1,12 @@
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "Autobonus-Swift.h"
@import Firebase;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];
[GeneratedPluginRegistrant registerWithRegistry:self];
@@ -123,6 +125,8 @@
result(buildSettings[@"showBonus"]);
} else if ([@"getVersionName" isEqualToString:call.method]) {
result([[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"]);
} else if ([@"logError" isEqualToString:call.method]) {
NSLog(@"%@", call.arguments[@"message"]);
} else {
result(FlutterMethodNotImplemented);
}

View File

@@ -104,7 +104,7 @@ import Flutter
settingButton.setImage(self.buttonState.icon, for: .normal)
textField.placeholder = self.getInputHint()
// textField.text = "79087654321"
// textField.text = "79087654321"
}
override func viewWillAppear(_ animated: Bool) {
@@ -115,12 +115,108 @@ import Flutter
applyOrientation()
}
// TODO: Вынести эту копипасту в методы, когда будет время
override func viewWillLayoutSubviews() {
scanRectView.frame = view.bounds
topView.frame = CGRect(x: 0, y: 0, width: view.frame.size.width, height: 56)
settingButton.frame = CGRect(x: 8, y: 26, width: 20, height: 20)
textField.frame = CGRect(x: settingButton.frame.maxX + 8, y: 21,
width: view.frame.size.width - settingButton.frame.maxX - 16, height: 30)
var path = UIBezierPath()
path.move(to: CGPoint(x: 32, y: view.frame.size.height / 2))
path.addLine(to: CGPoint(x: view.frame.size.width - 32, y: view.frame.size.height / 2))
var shapeLayer = CAShapeLayer()
shapeLayer.path = path.cgPath
shapeLayer.strokeColor = UIColor.red.cgColor
shapeLayer.fillColor = UIColor.clear.cgColor
shapeLayer.lineWidth = 2
view.layer.addSublayer(shapeLayer)
path = UIBezierPath()
path.move(to: CGPoint(x: 32, y: (view.frame.size.height / 2) - 32))
path.addLine(to: CGPoint(x: 32, y: (view.frame.size.height / 2) - 64))
path.addLine(to: CGPoint(x: 64, y: (view.frame.size.height / 2) - 64))
path.move(to: CGPoint(x: view.frame.size.width - 64, y: (view.frame.size.height / 2) - 64))
path.addLine(to: CGPoint(x: view.frame.size.width - 32, y: (view.frame.size.height / 2) - 64))
path.addLine(to: CGPoint(x: view.frame.size.width - 32, y: (view.frame.size.height / 2) - 32))
path.move(to: CGPoint(x: 32, y: (view.frame.size.height / 2) + 32))
path.addLine(to: CGPoint(x: 32, y: (view.frame.size.height / 2) + 64))
path.addLine(to: CGPoint(x: 64, y: (view.frame.size.height / 2) + 64))
path.move(to: CGPoint(x: view.frame.size.width - 32, y: (view.frame.size.height / 2) + 32))
path.addLine(to: CGPoint(x: view.frame.size.width - 32, y: (view.frame.size.height / 2) + 64))
path.addLine(to: CGPoint(x: view.frame.size.width - 64, y: (view.frame.size.height / 2) + 64))
shapeLayer = CAShapeLayer()
shapeLayer.path = path.cgPath
shapeLayer.strokeColor = UIColor.green.cgColor
shapeLayer.fillColor = UIColor.clear.cgColor
shapeLayer.lineWidth = 2
view.layer.addSublayer(shapeLayer)
path = UIBezierPath()
path.move(to: CGPoint(x: 0, y: 56))
path.addLine(to: CGPoint(x: view.frame.size.width, y: 56))
path.addLine(to: CGPoint(x: view.frame.size.width, y: (view.frame.size.height / 2) - 64))
path.addLine(to: CGPoint(x: 0, y: (view.frame.size.height / 2) - 64))
path.addLine(to: CGPoint(x: 0, y: 56))
path.close()
shapeLayer = CAShapeLayer()
shapeLayer.path = path.cgPath
shapeLayer.fillColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5).cgColor
view.layer.addSublayer(shapeLayer)
path = UIBezierPath()
path.move(to: CGPoint(x: 0, y: (view.frame.size.height / 2) - 64))
path.addLine(to: CGPoint(x: 32, y: (view.frame.size.height / 2) - 64))
path.addLine(to: CGPoint(x: 32, y: (view.frame.size.height / 2) + 64))
path.addLine(to: CGPoint(x: 0, y: (view.frame.size.height / 2) + 64))
path.addLine(to: CGPoint(x: 0, y: (view.frame.size.height / 2) - 64))
path.close()
shapeLayer = CAShapeLayer()
shapeLayer.path = path.cgPath
shapeLayer.fillColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5).cgColor
view.layer.addSublayer(shapeLayer)
path = UIBezierPath()
path.move(to: CGPoint(x: view.frame.size.width, y: (view.frame.size.height / 2) - 64))
path.addLine(to: CGPoint(x: view.frame.size.width - 32, y: (view.frame.size.height / 2) - 64))
path.addLine(to: CGPoint(x: view.frame.size.width - 32, y: (view.frame.size.height / 2) + 64))
path.addLine(to: CGPoint(x: view.frame.size.width, y: (view.frame.size.height / 2) + 64))
path.addLine(to: CGPoint(x: view.frame.size.width, y: (view.frame.size.height / 2) - 64))
path.close()
shapeLayer = CAShapeLayer()
shapeLayer.path = path.cgPath
shapeLayer.fillColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5).cgColor
view.layer.addSublayer(shapeLayer)
path = UIBezierPath()
path.move(to: CGPoint(x: view.frame.size.width, y: (view.frame.size.height / 2) + 64))
path.addLine(to: CGPoint(x: 0, y: (view.frame.size.height / 2) + 64))
path.addLine(to: CGPoint(x: 0, y: view.frame.size.height))
path.addLine(to: CGPoint(x: view.frame.size.width, y: view.frame.size.height))
path.addLine(to: CGPoint(x: view.frame.size.width, y: (view.frame.size.height / 2) + 64))
path.close()
shapeLayer = CAShapeLayer()
shapeLayer.path = path.cgPath
shapeLayer.fillColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5).cgColor
view.layer.addSublayer(shapeLayer)
}
func hideKeyboard() {
@@ -134,7 +230,7 @@ import Flutter
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
print("User from manual input: \(textField.text)")
print("User from manual input: \(textField.text!)")
sendResult(textField.text!)
return true
}
@@ -306,3 +402,4 @@ import Flutter
})
}
}