-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from nidp/Merging_from_document_scanner
Merging from document scanner
- Loading branch information
Showing
28 changed files
with
1,714 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
android/app/src/main/java/io/mosip/registration_client/api_services/DocumentDetailsApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package io.mosip.registration_client.api_services; | ||
|
||
import android.util.Log; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
import io.mosip.registration.clientmanager.spi.RegistrationService; | ||
import io.mosip.registration_client.model.DocumentDataPigeon; | ||
|
||
import org.apache.commons.lang3.ArrayUtils; | ||
|
||
@Singleton | ||
public class DocumentDetailsApi implements DocumentDataPigeon.DocumentApi { | ||
private final RegistrationService registrationService; | ||
|
||
@Inject | ||
public DocumentDetailsApi(RegistrationService registrationService) { | ||
this.registrationService = registrationService; | ||
} | ||
|
||
|
||
@Override | ||
public void addDocument(@NonNull String fieldId, @NonNull String docType, @NonNull String reference, @NonNull List<String> bytes, @NonNull DocumentDataPigeon.Result<Void> result) { | ||
byte[] byteArray = new byte[0]; | ||
for (String str : bytes) { | ||
byteArray = ArrayUtils.addAll(byteArray, str.getBytes()); | ||
} | ||
try { | ||
|
||
this.registrationService.getRegistrationDto().addDocument(fieldId, docType,reference,byteArray); | ||
Log.e(getClass().getSimpleName(), "Document Added!"+this.registrationService.getRegistrationDto().getDocuments() ); | ||
} catch (Exception e) { | ||
Log.e(getClass().getSimpleName(), "Add Document failed!" + Arrays.toString(e.getStackTrace())); | ||
} | ||
} | ||
|
||
@Override | ||
public void removeDocument(@NonNull String fieldId, @NonNull Long pageIndex, @NonNull DocumentDataPigeon.Result<Void> result) { | ||
|
||
} | ||
|
||
@Override | ||
public void getScannedPages(@NonNull String fieldId, @NonNull DocumentDataPigeon.Result<List<String>> result) { | ||
|
||
} | ||
|
||
@Override | ||
public void hasDocument(@NonNull String fieldId, @NonNull DocumentDataPigeon.Result<Boolean> result) { | ||
|
||
} | ||
|
||
@Override | ||
public void removeDocumentField(@NonNull String fieldId, @NonNull DocumentDataPigeon.Result<Void> result) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" | ||
#include "Generated.xcconfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" | ||
#include "Generated.xcconfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Uncomment this line to define a global platform for your project | ||
# platform :ios, '11.0' | ||
|
||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. | ||
ENV['COCOAPODS_DISABLE_STATS'] = 'true' | ||
|
||
project 'Runner', { | ||
'Debug' => :debug, | ||
'Profile' => :release, | ||
'Release' => :release, | ||
} | ||
|
||
def flutter_root | ||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) | ||
unless File.exist?(generated_xcode_build_settings_path) | ||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" | ||
end | ||
|
||
File.foreach(generated_xcode_build_settings_path) do |line| | ||
matches = line.match(/FLUTTER_ROOT\=(.*)/) | ||
return matches[1].strip if matches | ||
end | ||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" | ||
end | ||
|
||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) | ||
|
||
flutter_ios_podfile_setup | ||
|
||
target 'Runner' do | ||
use_frameworks! | ||
use_modular_headers! | ||
|
||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) | ||
end | ||
|
||
post_install do |installer| | ||
installer.pods_project.targets.each do |target| | ||
flutter_additional_ios_build_settings(target) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import 'dart:developer'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:registration_client/pigeon/document_pigeon.dart'; | ||
import 'package:registration_client/platform_spi/document.dart'; | ||
|
||
class DocumentImpl implements Document { | ||
@override | ||
Future<void> addDocument(String fieldId, String docType, String reference, | ||
List<String> bytes) async { | ||
try { | ||
await DocumentApi().addDocument(fieldId, docType, reference, bytes); | ||
} on PlatformException { | ||
debugPrint('DocumentApi call failed'); | ||
} catch (e) { | ||
debugPrint('Document not added ${e.toString()}'); | ||
} | ||
} | ||
|
||
@override | ||
Future<void> removeDocument(String fieldId, int pageIndex) async { | ||
try { | ||
await DocumentApi().removeDocument(fieldId, pageIndex); | ||
} on PlatformException { | ||
debugPrint('DocumentApi call failed'); | ||
} catch (e) { | ||
debugPrint('Document not removed ${e.toString()}'); | ||
} | ||
} | ||
|
||
@override | ||
Future<List<String?>> getScannedPages(String fieldId) async { | ||
List<String?> scannedPages = []; | ||
try { | ||
scannedPages = await DocumentApi().getScannedPages(fieldId); | ||
} on PlatformException { | ||
debugPrint('DocumentApi call failed'); | ||
} catch (e) { | ||
debugPrint('get scanned pages failed ${e.toString()}'); | ||
} | ||
return scannedPages; | ||
} | ||
|
||
@override | ||
Future<bool?> hasDocument(String fieldId) async { | ||
bool hasdocument = false; | ||
try { | ||
hasdocument = await DocumentApi().hasDocument(fieldId); | ||
} on PlatformException { | ||
debugPrint('DocumentApi call failed'); | ||
} catch (e) { | ||
debugPrint('has document call failed ${e.toString()}'); | ||
} | ||
return hasdocument; | ||
} | ||
|
||
@override | ||
Future<bool?> removeDocumentField(String fieldId) async { | ||
bool removeDocument = false; | ||
try { | ||
await DocumentApi().removeDocumentField(fieldId); | ||
} on PlatformException { | ||
debugPrint('DocumentApi call failed'); | ||
} catch (e) { | ||
debugPrint('remove document field failed ${e.toString()}'); | ||
} | ||
} | ||
} | ||
|
||
Document getDocumentImpl() => DocumentImpl(); |
Oops, something went wrong.