/
Implementation rough notes

The thought process is to keep the complete business logic in Flutter (Dart files),

only for the below functions, we should reach to platform-specific code:

  1. Data fetch from & store to DB (we have to live with this until the August release),

  2. crypto functions - enc, dec, trust validations

  3. SDK calls for bio matches/dedupe

  4. Creating Registration packet


  • State management with providers


  • Separating platform-specific code with conditional imports (During the build process, Flutter analyzes the conditional imports and includes only the necessary platform-specific files based on the current platform. The platform-specific files are then compiled into the final app bundle)

Eg: https://stackoverflow.com/questions/58710226/how-to-import-platform-specific-dependency-in-flutter-dart-combine-web-with-an

screens(Only UI) ---------------- providers(state-mgmt & Business-logic) -----------may or may not--------- platform-specific code


Project structure:

1project/ 2 lib/ 3 providers/ 4 auth_provider.dart 5 models/ 6 user_detail.dart 7 screens/ 8 home 9 dashboard.dart 10 settings.dart 11 home.dart 12 onboard 13 onboard.dart 14 onboard_landing.dart 15 registration 16 language_selection.dart 17 registration.dart 18 registration_listing.dart 19 preview.dart 20 acknowledgment.dart 21 auth 22 pwd_auth.dart 23 finger_auth.dart 24 iris_auth.dart 25 face_auth.dart 26 widgets/ 27 checkbox.dart 28 radio_button.dart 29 textbox.dart 30 dropdown.dart 31 utils/ 32 constants.dart 33 file_storage.dart 34 validators/ 35 regex.dart 36 mvel.dart 37 platform_spi/ 38 auth_service.dart 39 user_service.dart 40 registration_service.dart 41 platform_android/ 42 auth_service_impl.dart 43 user_service_impl.dart 44 registration_service_impl.dart 45 platform_web/ 46 auth_service_impl.dart 47 user_service_impl.dart 48 registration_service_impl.dart 49 50 main.dart


For each scenario, here we are listing down the possible method channel calls to platform-specific code with the expected response DTO structure.

1 View(TODO) ---------- channels ------------- Pigeon ------------------ Platform specific code 2 3SCENE:on_launch 4 1. ------------------------ getCenterMachineDetails() -------------------> 5 ResponseWrapper -> 6 { 7 response : { 8 centerName 9 centerId 10 centerStatus 11 machineName 12 machineId 13 machineStatus 14 }, 15 errorCode : "" 16 } 17 "NOT_INITIALIZED" 18 19 20 //DO machine status check 21 //DO center status check 22 23 2. ------------------------ getGlobalParams() -------------------> 24 25 load all the global params (key-value pairs) in the context. 26 27 28SCENE:Login user_validation -------------------getUserDetail(userId)-------------------------------> 29 ResponseWrapper -> 30 { 31 response : { 32 userId 33 is_active 34 is_locked 35 is_onboarded 36 centerName 37 centerId 38 machineName 39 machineId 40 failedAttempts 41 authMethods: [] 42 }, 43 errorCode : "" 44 } 45 46 //DO user validation 47 48 49 online: ---------------------------------------- auth endpoint call -----------------------------> enc(response) 50 <---------------------------------------------------------------------------------- decrypted(response) 51 //validate auth token (signature check & expiry & aud & iss check) 52 //parse token ----------------------------- saveUserDetail(userId) 53 { 54 username 55 password(plain) 56 roles 57 auth-token 58 refresh-token 59 } 60 61 62 offline: 63 credential_check ------------(offline) getStoredCredential(userId, authMethod)-------------------> 64 65 ResponseWrapper -> 66 { 67 response : [{ 68 credential : <string> 69 salt: <string> 70 type: <string> 71 subType: <string> 72 }], 73 errorCode : "" 74 } 75 //Do pwd comparision 76 77 //store user logged in details in 78 SharedPreferences 79 80NAVIGATION:Load onboard page only if valid user session details found in sharedPreferences & is_onboarded is false 81NAVIGATION:Load homepage only if valid user session details found in sharedPreferences 82 83SCENE:Sync 84 only when ONLINE and valid auth-token session (either OPERATOR/SUPERVISOR): 85 policy_certificate_sync ------------------------------------------------------------------ API call 86 store in DB 87 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 88 configuration_sync ------------------------------------------------------------------ API call 89 store in DB 90 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 91 schema_sync ------------------------------------------------------------------ API call 92 store in DB 93 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 94 masterdata_sync------------------------------------------------------------------ API call 95 store in DB 96 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 97 userdetails_sync------------------------------------------------------------------ API call 98 store in DB 99 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 100 trust_certs_sync------------------------------------------------------------------ API call 101 store in DB 102 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 103 prereg_data_sync------------------------------------------------------------------ API call 104 store in DB 105 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 106 //Handle progress & errors 107 108 offline: Machine is offline 109 //DO nothing 110 111 112SCENE:Registration 113 // TODO 114 115 116