Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hcmpre 717 GitHub actions build apk #588

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b9b65bb
Removed privacy policy from main app to digit component (#569)
rachana-egov Sep 10, 2024
6317df4
wayBillNumber key change from waybillNumber (#571)
naveenr-egov Sep 17, 2024
cb53365
Added github actions as push and pull
Shashwat12-egov Sep 30, 2024
bb6cde1
Added github actions as push and pull
Shashwat12-egov Sep 30, 2024
d33e35f
Added github actions as push and pull
Shashwat12-egov Sep 30, 2024
cf771d8
Added github actions as push and pull
Shashwat12-egov Sep 30, 2024
39c5bd7
Added github actions as push and pull
Shashwat12-egov Sep 30, 2024
b3dcf76
Added github actions as push and pull
Shashwat12-egov Sep 30, 2024
3d33f39
Added github actions as push and pull
Shashwat12-egov Sep 30, 2024
428f43b
Added github actions as push and pull
Shashwat12-egov Oct 1, 2024
c46b34b
Hcmpre 716 :- Added Count-based Search for facility and stock (#581)
yashita-egov Oct 10, 2024
30409b8
Update flutter-build-apk.yml
naveen-egov Oct 11, 2024
7d4d064
Update flutter-build-apk.yml
naveen-egov Oct 11, 2024
3930c9e
Update flutter-build-apk.yml
naveen-egov Oct 11, 2024
21bd69f
Checking Github actions
Shashwat12-egov Oct 14, 2024
3bbbac0
Uploading on the artifact
Shashwat12-egov Oct 14, 2024
257ef01
Using the env variables from github variables
Shashwat12-egov Oct 14, 2024
e6d686c
Using the env variables from github variables
Shashwat12-egov Oct 14, 2024
735224b
Using the env variables from github variables
Shashwat12-egov Oct 14, 2024
011cbd5
Changed the uploaded path for apk
Shashwat12-egov Oct 14, 2024
900ba38
Changed the uploaded path for apk
Shashwat12-egov Oct 14, 2024
df02414
Using only github workflow to build apk
Shashwat12-egov Oct 15, 2024
f166b87
Running the install_bricks.sh file
Shashwat12-egov Oct 15, 2024
0047a98
Running the install_bricks.sh file
Shashwat12-egov Oct 15, 2024
d9a807b
Pgr and survey_form package merge (#573)
naveenr-egov Oct 21, 2024
9fd1c4e
Merge branch 'develop' into hcmpre-717-github-actions-build-apk
naveen-egov Oct 25, 2024
0e30b80
Update flutter-build-apk.yml
Shashwat12-egov Nov 21, 2024
a1a27b2
Update flutter-build-apk.yml
Shashwat12-egov Nov 21, 2024
5e5c74a
Update flutter-build-apk.yml
Shashwat12-egov Nov 21, 2024
d066c26
Update flutter-build-apk.yml
Shashwat12-egov Dec 18, 2024
b687b9c
Update flutter-build-apk.yml
Shashwat12-egov Dec 18, 2024
95643b1
Update flutter-build-apk.yml
Shashwat12-egov Dec 18, 2024
aa1c872
Update flutter-build-apk.yml
Shashwat12-egov Dec 19, 2024
a860a70
Update flutter-build-apk.yml
naveenr-egov Dec 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"flutter": "3.16.5"
}
79 changes: 79 additions & 0 deletions .github/workflows/flutter-build-apk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build APK Workflow

on:
push:
branches: ['develop', 'hcmpre-717-github-actions-build-apk'] # This specifies that the workflow will run on any push to the 'main' branch
pull_request:
branches: ['develop', 'hcmpre-717-github-actions-build-apk'] # Optionally, run on pull requests targeting the 'main' branch

jobs:
build-apk:
runs-on: ubuntu-latest
environment: QA # Reference the QA environment

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin' # Specify the Java distribution

- name: Flutter action
uses: subosito/[email protected]
with:
flutter-version: "3.22.2"

- name: Set up Android SDK
uses: android-actions/setup-android@v2
with:
api-level: 33
build-tools: 33.0.2

- name: Install Dependencies
run: flutter pub get

- name: Print Environment Variables
run: |
echo "BASE_URL=${{ vars.BASE_URL }}"

- name: Create .env file
run: |
echo "BASE_URL=${{ vars.BASE_URL }}" >> apps/health_campaign_field_worker_app/.env
echo "MDMS_API_PATH=${{ vars.MDMS_API_PATH }}" >> apps/health_campaign_field_worker_app/.env
echo "TENANT_ID=${{ vars.TENANT_ID }}" >> apps/health_campaign_field_worker_app/.env
echo "ACTIONS_API_PATH=${{ vars.ACTIONS_API_PATH }}" >> apps/health_campaign_field_worker_app/.env
echo "SYNC_DOWN_RETRY_COUNT=${{ vars.SYNC_DOWN_RETRY_COUNT }}" >> apps/health_campaign_field_worker_app/.env
echo "RETRY_TIME_INTERVAL=${{ vars.RETRY_TIME_INTERVAL }}" >> apps/health_campaign_field_worker_app/.env
echo "CONNECT_TIMEOUT=${{ vars.CONNECT_TIMEOUT }}" >> apps/health_campaign_field_worker_app/.env
echo "RECEIVE_TIMEOUT=${{ vars.RECEIVE_TIMEOUT }}" >> apps/health_campaign_field_worker_app/.env
echo "SEND_TIMEOUT=${{ vars.SEND_TIMEOUT }}" >> apps/health_campaign_field_worker_app/.env
echo "CHECK_BANDWIDTH_API=${{ vars.CHECK_BANDWIDTH_API }}" >> apps/health_campaign_field_worker_app/.env
echo "HIERARCHY_TYPE=${{ vars.HIERARCHY_TYPE }}" >> apps/health_campaign_field_worker_app/.env
echo "ENV_NAME=${{ vars.ENV_NAME }}" >> apps/health_campaign_field_worker_app/.env

- name: Verify .env file
run: |
ls -l apps/health_campaign_field_worker_app/.env
cat apps/health_campaign_field_worker_app/.env

- name: Run APK build script
env:
BUILD_CONFIG: release # or profile depending on your choice
run: bash ./tools/generate-apk.sh

# Archive the APK as a build artifact so it can be downloaded
- name: Upload APKs
uses: actions/upload-artifact@v3
with:
name: app-release-apk
path: apps/health_campaign_field_worker_app/build/app/outputs/flutter-apk/app-release.apk

- name: Upload .env as artifact
uses: actions/upload-artifact@v3
with:
name: env-file
path: apps/health_campaign_field_worker_app/.env
include-hidden-files: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ migrate_working_dir/
*.iws
.idea/


# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
Expand Down Expand Up @@ -57,3 +56,7 @@ pubspec_overrides.yaml
apps/health_campaign_field_worker_app/.env
apps/health_campaign_field_worker_app/libisar.dylib
*.properties

# FVM Version Cache
.fvm/
.fvmrc
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ class _ChecklistDataShowcaseData {
import '../../../utils/i18_key_constants.dart' as i18;
import '../showcase_wrappers.dart';

part 'checklist_data.dart';
part 'survey_form_data.dart';

final checklistDataShowcaseData = _ChecklistDataShowcaseData();
```
Expand Down
4 changes: 4 additions & 0 deletions apps/health_campaign_field_worker_app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

# FVM Version Cache
.fvm/
.fvmrc
13 changes: 12 additions & 1 deletion apps/health_campaign_field_worker_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,23 @@ if (flutterVersionName == null) {

apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'

if (project.hasProperty('USE_GOOGLE_SERVICES')) {
apply plugin: 'com.google.gms.google-services'
}

// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
if (!project.hasProperty('USE_GOOGLE_SERVICES')) {
tasks.whenTaskAdded { task ->
if (task.name.contains("GoogleServices")) {
task.enabled = false
}
}
}
compileSdkVersion 34
ndkVersion flutter.ndkVersion

Expand Down
8 changes: 8 additions & 0 deletions apps/health_campaign_field_worker_app/lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:attendance_management/attendance_management.dart';
import 'package:survey_form/survey_form.dart';
import 'package:closed_household/blocs/closed_household.dart';
import 'package:closed_household/closed_household.dart';
import 'package:digit_components/digit_components.dart';
Expand All @@ -25,6 +26,8 @@ import 'blocs/localization/localization.dart';
import 'blocs/project/project.dart';
import 'data/local_store/app_shared_preferences.dart';
import 'data/network_manager.dart';
import 'data/remote_client.dart';
import 'data/repositories/remote/bandwidth_check.dart';
import 'data/repositories/remote/localization.dart';
import 'data/repositories/remote/mdms.dart';
import 'router/app_navigator_observer.dart';
Expand Down Expand Up @@ -201,6 +204,11 @@ class MainApplicationState extends State<MainApplication>
),
BlocProvider(
create: (ctx) => ProjectBloc(
bandwidthCheckRepository: BandwidthCheckRepository(
DioClient().dio,
bandwidthPath:
envConfig.variables.checkBandwidthApiPath,
),
mdmsRepository: MdmsRepository(widget.client),
dashboardRemoteRepository:
DashboardRemoteRepository(widget.client),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ class MdmsConfig {
final List<ServiceRegistry> serviceRegistryList;
final DashboardConfigSchema? dashboardConfigSchema;


const MdmsConfig(
{required this.appConfigs,
required this.serviceRegistryList,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:collection/collection.dart';
import 'package:digit_data_model/data/local_store/sql_store/sql_store.dart';
import 'package:flutter/material.dart';
import 'package:isar/isar.dart';
import '../../data/local_store/no_sql/schema/app_configuration.dart';
import 'app_localization.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:async';
import 'dart:core';

import 'package:attendance_management/attendance_management.dart';
import 'package:survey_form/survey_form.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:digit_components/digit_components.dart';
import 'package:digit_data_model/data_model.dart';
Expand All @@ -19,10 +20,12 @@ import '../../data/local_store/no_sql/schema/app_configuration.dart';
import '../../data/local_store/no_sql/schema/row_versions.dart';
import '../../data/local_store/no_sql/schema/service_registry.dart';
import '../../data/local_store/secure_store/secure_store.dart';
import '../../data/repositories/remote/bandwidth_check.dart';
import '../../data/repositories/remote/mdms.dart';
import '../../models/app_config/app_config_model.dart';
import '../../models/auth/auth_model.dart';
import '../../models/entities/roles_type.dart';
import '../../utils/background_service.dart';
import '../../utils/environment_config.dart';
import '../../utils/utils.dart';

Expand All @@ -35,6 +38,8 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {
final Isar isar;
final MdmsRepository mdmsRepository;

final BandwidthCheckRepository bandwidthCheckRepository;

/// Project Staff Repositories
final RemoteRepository<ProjectStaffModel, ProjectStaffSearchModel>
projectStaffRemoteRepository;
Expand Down Expand Up @@ -76,6 +81,7 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {
final RemoteRepository<StockModel, StockSearchModel> stockRemoteRepository;
final LocalRepository<StockModel, StockSearchModel> stockLocalRepository;

/// Service Definition Repositories
final RemoteRepository<ServiceDefinitionModel, ServiceDefinitionSearchModel>
serviceDefinitionRemoteRepository;
final LocalRepository<ServiceDefinitionModel, ServiceDefinitionSearchModel>
Expand Down Expand Up @@ -103,6 +109,7 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {

ProjectBloc({
LocalSecureStore? localSecureStore,
required this.bandwidthCheckRepository,
required this.projectStaffRemoteRepository,
required this.projectRemoteRepository,
required this.projectStaffLocalRepository,
Expand Down Expand Up @@ -169,6 +176,7 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {
}

FutureOr<void> _loadOnline(ProjectEmitter emit) async {
final batchSize = await _getBatchSize();
final userObject = await localSecureStore.userRequestModel;
final uuid = userObject?.uuid;

Expand Down Expand Up @@ -288,8 +296,11 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {
}

if (projects.isNotEmpty) {

// INFO : Need to add project load functions

try {
await _loadProjectFacilities(projects);
await _loadProjectFacilities(projects, batchSize);
} catch (_) {
emit(
state.copyWith(
Expand Down Expand Up @@ -360,7 +371,8 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {
);
}

FutureOr<void> _loadProjectFacilities(List<ProjectModel> projects) async {
FutureOr<void> _loadProjectFacilities(
List<ProjectModel> projects, int batchSize) async {
final projectFacilities = await projectFacilityRemoteRepository.search(
ProjectFacilitySearchModel(
projectId: projects.map((e) => e.id).toList(),
Expand All @@ -371,6 +383,7 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {

final facilities = await facilityRemoteRepository.search(
FacilitySearchModel(tenantId: envConfig.variables.tenantId),
limit: batchSize,
);

await facilityLocalRepository.bulkCreate(facilities);
Expand Down Expand Up @@ -584,8 +597,6 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {
loading: false,
syncError: ProjectSyncErrorType.boundary,
));

return;
}

emit(state.copyWith(
Expand All @@ -594,6 +605,25 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {
syncError: null,
));
}

FutureOr<int> _getBatchSize() async {
try {
final configs = await isar.appConfigurations.where().findAll();

final double speed = await bandwidthCheckRepository.pingBandwidthCheck(
bandWidthCheckModel: null,
);

int configuredBatchSize = getBatchSizeToBandwidth(
speed,
configs,
isDownSync: true,
);
return configuredBatchSize;
} catch (e) {
rethrow;
}
}
}

@freezed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import 'package:complaints/complaints.dart';

import 'package:attendance_management/models/entities/attendance_log.dart';
import 'package:survey_form/survey_form.dart';
import 'package:digit_data_model/data/local_store/no_sql/schema/entity_mapper_listener.dart';
import 'package:digit_data_model/data_model.dart';
import 'package:inventory_management/models/entities/stock.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class NetworkManager {
return isSyncCompleted;
}

//

FutureOr<void> writeToEntityDB(
Map<String, dynamic> response,
List<LocalRepository> localRepositories,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BandwidthCheckRepository {
final speed = (((800 / timeconsumed) / 1000));

return speed;
} on DioError catch (e) {
} on DioException catch (e) {
rethrow;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ class MdmsRepository {

final List<ChecklistTypes>? checklistTypes =
element?.checklistTypes.map((e) {
final checklist = ChecklistTypes()
final surveyForm = ChecklistTypes()
..name = e.name
..code = e.code;

return checklist;
return surveyForm;
}).toList();

final List<TransportTypes>? transportTypes =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:collection/collection.dart';
import 'package:digit_data_model/data_model.dart';


class RepositoryType {
static RemoteRepository getRemoteForType(
DataModelType type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ class PerformSyncDown {
.whereNotNull()
.toList(),
),
limit: bandwidthModel.batchSize,
);

for (var element in operationGroupedEntity.value) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:complaints/complaints.dart';

import 'dart:async';

import 'package:collection/collection.dart';
Expand Down Expand Up @@ -213,6 +215,7 @@ class PerformSyncUp {
final entities = getEntityModel(sublist, local);
if (operationGroupedEntity.key == DataOperation.create) {
switch (typeGroupedEntity.key) {

case DataModelType.complaints:
for (final entity in entities) {
if (remote is PgrServiceRemoteRepository &&
Expand Down Expand Up @@ -284,6 +287,7 @@ class PerformSyncUp {
}
}
break;

default:
await remote.bulkCreate(entities);
}
Expand Down
1 change: 0 additions & 1 deletion apps/health_campaign_field_worker_app/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:collection/collection.dart';
import 'package:digit_components/digit_components.dart';
import 'package:digit_data_model/data/local_store/sql_store/sql_store.dart';
import 'package:dio/dio.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter_portal/flutter_portal.dart';
import 'package:isar/isar.dart';
import 'package:location/location.dart';
import 'package:registration_delivery/registration_delivery.dart';
import 'package:survey_form/survey_form.dart';

import '../blocs/localization/app_localization.dart';
import '../blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart';
Expand Down
Loading
Loading