fix scan card
This commit is contained in:
@@ -131,7 +131,7 @@ public class ScannerActivity extends AppCompatActivity implements
|
||||
|
||||
@Override
|
||||
public void handleResult(Result raw) {
|
||||
handleBarcode(raw.getText());
|
||||
handleBarcode(raw.getText(), SearchType.CARD);
|
||||
scannerView.postDelayed(() -> scannerView.resumeCameraPreview(ScannerActivity.this), SCAN_INTERVAL_PERIOD);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public class ScannerActivity extends AppCompatActivity implements
|
||||
private void initManualInput() {
|
||||
mInputField = findViewById(R.id.manual_input);
|
||||
mInputField.setOnEditorActionListener((v, actionId, event) -> {
|
||||
handleBarcode(v.getText().toString());
|
||||
handleBarcode(v.getText().toString(), mSearchType);
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -195,8 +195,8 @@ public class ScannerActivity extends AppCompatActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
public void handleBarcode(final @NonNull String searchString) {
|
||||
mClient.findUser(searchString, mSearchType, new Callback() {
|
||||
public void handleBarcode(final @NonNull String searchString, final @NonNull SearchType searchType) {
|
||||
mClient.findUser(searchString, searchType, new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
handleFail(searchString);
|
||||
|
||||
@@ -260,11 +260,11 @@ import ZXingObjC
|
||||
|
||||
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||
print("User from manual input: \(textField.text!)")
|
||||
sendResult(textField.text!)
|
||||
sendResult(textField.text!, buttonState)
|
||||
return true
|
||||
}
|
||||
|
||||
func sendResult(_ str: String) {
|
||||
func sendResult(_ str: String, _ buttonState: ButtonState) {
|
||||
platformChannel?.invokeMethod("findUser", arguments: [str, buttonState.searchType], result: { (result: Any?) in
|
||||
if result is FlutterError {
|
||||
print("Result is nil (ios code)");
|
||||
@@ -423,7 +423,7 @@ import ZXingObjC
|
||||
points.append(windowPointValue)
|
||||
}
|
||||
print("User from scanner: \(result.text)")
|
||||
sendResult(result.text)
|
||||
sendResult(result.text, ButtonState.card)
|
||||
print(result.text)
|
||||
self.capture.stop()
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(2 * Double(NSEC_PER_SEC)) / Double(NSEC_PER_SEC), execute: {() -> Void in
|
||||
|
||||
Reference in New Issue
Block a user