diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 00000000..2b452b3b --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,76 @@ +name: manualbuild + +on: + workflow_dispatch: + inputs: + api_base_url: + description: URL of the REST API + required: true + default: https://release.openimis.org/rest/ + app_name: + description: Display name of the application + required: false + default: Policies Manual + app_dir: + description: Name of the folder in Documents, default IMIS-CLI + required: false + application_id: + description: Fully qualified name of the app + required: true + default: org.openimis.imispolicies.cli + cli_java_dir: + description: java source folder for custom functions. Only works with application_id_suffix .cli + required: false + cli_res_dir: + description: Resources folder for icons. Only works with application_id_suffix .cli + required: false +# Branch is chosen by default in github manual actions + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Environment info + run: | + gradle --version + echo url ${{ github.event.inputs.api_base_url }} + echo app name ${{ github.event.inputs.app_name }} + + - name: build + run: | + ./gradlew assembleCliDebug --stacktrace + env: + API_BASE_URL: "${{ github.event.inputs.api_base_url }}" + CLI_APP_NAME: "${{ github.event.inputs.app_name }}" + CLI_APP_DIR: "${{ github.event.inputs.app_dir }}" + CLI_JAVA_DIR: "${{ github.event.inputs.cli_java_dir }}" + CLI_RES_DIR: "${{ github.event.inputs.cli_res_dir }}" + APPLICATION_ID: "${{ github.event.inputs.application_id }}" + + - name: Environment info + run: | + gradle --version + + - uses: actions/upload-artifact@v2 + with: + name: openimis-policies-apk-${{github.run_number}}-${{github.sha}} + path: ./app/build/outputs/**/*.apk + +# - name: build +# run: | +# ./gradlew bundleDebug --stacktrace +# +# - uses: actions/upload-artifact@v2 +# with: +# name: openimis-claims-aab-${{github.run_number}}-${{github.sha}} +# path: ./claimManagement/build/outputs/**/*.aab + + diff --git a/app/build.gradle b/app/build.gradle index 73dbd734..a810d485 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -137,6 +137,19 @@ android { buildConfigField "boolean", "SHOW_BULK_CN_MENU", 'true' resValue "string", "app_name_policies", "Policies CHF SIT" } + niger { + applicationId "org.openimis.imispolicies.niger" + buildConfigField "String", "API_BASE_URL", '"http://oiniger.bluesquare.org/rest/"' + buildConfigField "String", "APP_DIR", '"IMIS-NIGER"' + resValue "string", "app_name_policies", "Polices Niger" + } + cli { + applicationIdSuffix System.getenv("APPLICATION_ID") ?: "org.openimis.imispolicies.cli" + buildConfigField "String", "API_BASE_URL", '"' + (System.getenv("API_BASE_URL") ?: 'http://10.0.2.2:35787/') + '"' + buildConfigField "String", "APP_DIR", '"' + (System.getenv("CLI_APP_DIR") ?: 'IMIS-CLI') + '"' + resValue "string", "app_name_claims", System.getenv("CLI_APP_NAME") ?: "Policies CLI" + dimension 'std' + } } sourceSets { chfDev.java.srcDir 'src/chf/java' @@ -154,6 +167,9 @@ android { bephaDev.java.srcDir 'src/bepha/java' bephaDev.res.srcDir 'src/bepha/res' + niger.java.srcDir 'src/niger/java' + niger.res.srcDir 'src/niger/res' + tchadDev.java.srcDir 'src/tchad/java' tchadDev.res.srcDir 'src/tchad/res' @@ -162,6 +178,9 @@ android { demoRelease.java.srcDir 'src/master/java' demoRelease.res.srcDir 'src/demoRelease/res' + + cli.java.srcDir System.getenv("CLI_JAVA_DIR") ?: 'src/master/java' + cli.res.srcDir System.getenv("CLI_RES_DIR") ?: 'src/demoProd/res' } // Apply custom flavours diff --git a/app/src/niger/java/org/openimis/imispolicies/Escape.java b/app/src/niger/java/org/openimis/imispolicies/Escape.java new file mode 100644 index 00000000..9f2a909a --- /dev/null +++ b/app/src/niger/java/org/openimis/imispolicies/Escape.java @@ -0,0 +1,53 @@ +//Copyright (c) 2016-%CurrentYear% Swiss Agency for Development and Cooperation (SDC) +// +//The program users must agree to the following terms: +// +//Copyright notices +//This program is free software: you can redistribute it and/or modify it under the terms of the GNU AGPL v3 License as published by the +//Free Software Foundation, version 3 of the License. +//This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL v3 License for more details www.gnu.org. +// +//Disclaimer of Warranty +//There is no warranty for the program, to the extent permitted by applicable law; except when otherwise stated in writing the copyright +//holders and/or other parties provide the program "as is" without warranty of any kind, either expressed or implied, including, but not +//limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and +//performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction. +// +//Limitation of Liability +//In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who modifies and/or +//conveys the program as permitted above, be liable to you for damages, including any general, special, incidental or consequential damages +//arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses +//sustained by you or third parties or a failure of the program to operate with any other programs), even if such holder or other party has been +//advised of the possibility of such damages. +// +//In case of dispute arising out or in relation to the use of the program, it is subject to the public law of Switzerland. The place of jurisdiction is Berne. + +package org.openimis.imispolicies; + +public class Escape { + public int CheckInsuranceNumber(String InsuranceNumber){ + + if (InsuranceNumber.length() == 0){ + return R.string.MissingInsuranceNumber; + } + + if (!isValidInsuranceNumber(InsuranceNumber)){ + return R.string.InvalidInsuranceNumber; + + } + + return 0; + } + + private boolean isValidInsuranceNumber(String InsuranceNumber){ + if (InsuranceNumber.length() != 10) return false; + int actualControlNumber, expectedControlNumber; + + expectedControlNumber = Integer.parseInt(InsuranceNumber.substring(9)); + actualControlNumber = Integer.parseInt(InsuranceNumber.substring(0, 9)) % 7; + + return expectedControlNumber == actualControlNumber; + } + +} diff --git a/app/src/niger/res/mipmap-hdpi/ic_launcher_policies.png b/app/src/niger/res/mipmap-hdpi/ic_launcher_policies.png new file mode 100644 index 00000000..ce426b0f Binary files /dev/null and b/app/src/niger/res/mipmap-hdpi/ic_launcher_policies.png differ diff --git a/app/src/niger/res/mipmap-mdpi/ic_launcher_policies.png b/app/src/niger/res/mipmap-mdpi/ic_launcher_policies.png new file mode 100644 index 00000000..ce426b0f Binary files /dev/null and b/app/src/niger/res/mipmap-mdpi/ic_launcher_policies.png differ diff --git a/app/src/niger/res/mipmap-xhdpi/ic_launcher_policies.png b/app/src/niger/res/mipmap-xhdpi/ic_launcher_policies.png new file mode 100644 index 00000000..ce426b0f Binary files /dev/null and b/app/src/niger/res/mipmap-xhdpi/ic_launcher_policies.png differ diff --git a/app/src/niger/res/mipmap-xxhdpi/ic_launcher_policies.png b/app/src/niger/res/mipmap-xxhdpi/ic_launcher_policies.png new file mode 100644 index 00000000..ce426b0f Binary files /dev/null and b/app/src/niger/res/mipmap-xxhdpi/ic_launcher_policies.png differ diff --git a/app/src/niger/res/mipmap-xxxhdpi/ic_launcher_policies.png b/app/src/niger/res/mipmap-xxxhdpi/ic_launcher_policies.png new file mode 100644 index 00000000..ce426b0f Binary files /dev/null and b/app/src/niger/res/mipmap-xxxhdpi/ic_launcher_policies.png differ