...
screens(Only UI) ---------------- providers(state-mgmt & Business-logic) -----------may or may not--------- platform-specific code--- platform-specific code
Project structure:
Code Block | ||
---|---|---|
| ||
project/
lib/
providers/
auth_provider.dart
models/
user_detail.dart
screens/
home
dashboard.dart
settings.dart
home.dart
onboard
onboard.dart
onboard_landing.dart
registration
language_selection.dart
registration.dart
registration_listing.dart
preview.dart
acknowledgment.dart
auth
pwd_auth.dart
finger_auth.dart
iris_auth.dart
face_auth.dart
widgets/
checkbox.dart
radio_button.dart
textbox.dart
dropdown.dart
utils/
constants.dart
file_storage.dart
validators/
regex.dart
mvel.dart
platform_spi/
auth_service.dart
user_service.dart
registration_service.dart
platform_android/
auth_service_impl.dart
user_service_impl.dart
registration_service_impl.dart
platform_web/
auth_service_impl.dart
user_service_impl.dart
registration_service_impl.dart
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.
Code Block | ||
---|---|---|
| ||
View(TODO) ---------- channels ------------- Pigeon ------------------ Platform specific code SCENE:on_launch 1. ------------------------ getCenterMachineDetails() -------------------> ResponseWrapper -> { response : { centerName centerId centerStatus machineName machineId machineStatus }, errorCode : "" } "NOT_INITIALIZED" //DO machine status check //DO center status check 2. ------------------------ getGlobalParams() -------------------> load all the global params (key-value pairs) in the context. SCENE:Login user_validation -------------------getUserDetail(userId)-------------------------------> ResponseWrapper -> { response : { userId is_active is_locked is_onboarded centerName centerId machineName machineId failedAttempts authMethods: [] }, errorCode : "" } //DO user validation online: ---------------------------------------- auth endpoint call -----------------------------> enc(response) <---------------------------------------------------------------------------------- decrypted(response) //validate auth token (signature check & expiry & aud & iss check) //parse token ----------------------------- saveUserDetail(userId) { username password(plain) roles auth-token refresh-token } offline: credential_check ------------(offline) getStoredCredential(userId, authMethod)-------------------> ResponseWrapper -> { response : [{ credential : <string> salt: <string> type: <string> subType: <string> }], errorCode : "" } //Do pwd comparision //store user logged in details in SharedPreferences NAVIGATION:Load onboard page only if valid user session details found in sharedPreferences & is_onboarded is false NAVIGATION:Load homepage only if valid user session details found in sharedPreferences SCENE:Sync only when ONLINE and valid auth-token session (either OPERATOR/SUPERVISOR): policy_certificate_sync ------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } configuration_sync ------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } schema_sync ------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } masterdata_sync------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } userdetails_sync------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } trust_certs_sync------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } prereg_data_sync------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } //Handle progress & errors offline: Machine is offline //DO nothing SCENE:Registration // TODO |