Skip to content

Commit 84649b8

Browse files
committed
Merge branch 'master' into assign-origin-location-id-to-ooc-events
# Conflicts: # opensrp-child/src/main/java/org/smartregister/child/fragment/BaseChildRegisterFragment.java # opensrp-child/src/main/java/org/smartregister/child/util/Utils.java
2 parents d3e9040 + 0a51167 commit 84649b8

File tree

65 files changed

+1147
-837
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1147
-837
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v2
19-
- name: Set up JDK 1.8
19+
- name: Set up JDK 11
2020
uses: actions/setup-java@v1
2121
with:
22-
java-version: 1.8
22+
java-version: 11
2323
- name: Install NDK
2424
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.0.6113669" --sdk_root=${ANDROID_SDK_ROOT}
2525
- name: Grant execute permission for gradlew

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This workflow will build a Java project with Gradle
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3+
4+
name: Snapshot Release
5+
6+
on:
7+
push:
8+
tags:
9+
- v[0-9]+.[0-9]+.[0-9]+-SNAPSHOT
10+
- v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-SNAPSHOT
11+
- v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+-SNAPSHOT
12+
env:
13+
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
14+
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Cancel previous workflow runs
21+
uses: styfle/[email protected]
22+
with:
23+
access_token: ${{ github.token }}
24+
25+
- name: Checkout 🛎️
26+
uses: actions/checkout@v2
27+
with:
28+
fetch-depth: 2
29+
30+
- name: Set up JDK 11
31+
uses: actions/setup-java@v1
32+
with:
33+
java-version: 11
34+
35+
- name: Grant execute permission for gradlew
36+
run: chmod +x gradlew
37+
38+
- name: Run unit tests with Gradle
39+
run: ./gradlew :opensrp-child:clean :opensrp-child:testDebugUnitTest --stacktrace
40+
41+
- name: Generate & upload library snapshot artifact AAR (Android Archive) file
42+
run: ./gradlew :opensrp-child:uploadArchives -PmavenLocal=false --stacktrace -PsonatypeUsername=${{ secrets.NEXUS_USERNAME }} -PsonatypePassword=${{ secrets.NEXUS_PASSWORD }}
43+
44+
- name: Github Release
45+
uses: softprops/action-gh-release@v1
46+
with:
47+
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') }}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
![Build status](https://github.com/OpenSRP/opensrp-client-reveal/workflows/Android%20CI%20with%20Gradle/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/OpenSRP/opensrp-client-child/badge.svg?branch=master)](https://coveralls.io/github/OpenSRP/opensrp-client-child?branch=master)
1+
![Build status](https://github.com/OpenSRP/opensrp-client-child/workflows/Android%20CI%20with%20Gradle/badge.svg)
2+
[![Coverage Status](https://coveralls.io/repos/github/opensrp/opensrp-client-child/badge.svg?branch=master)](https://coveralls.io/github/opensrp/opensrp-client-child?branch=master)
23
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9676b69b02be4d37ad73bcab80f6c5fc)](https://www.codacy.com/gh/opensrp/opensrp-client-child/dashboard?utm_source=github.com&utm_medium=referral&utm_content=OpenSRP/opensrp-client-child&utm_campaign=Badge_Grade)
34
# opensrp-client-child
45
OpenSRP client child health module library

build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ buildscript {
77
}
88

99
dependencies {
10-
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0"
10+
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
1111
classpath 'org.smartregister:gradle-jarjar-plugin:1.0.0-SNAPSHOT'
12-
classpath 'com.android.tools.build:gradle:4.1.2'
12+
classpath 'com.android.tools.build:gradle:4.2.2'
1313
}
1414
}
1515

@@ -34,11 +34,11 @@ subprojects {
3434

3535
group = 'org.smartregister'
3636

37-
ext.androidToolsBuildGradle = '4.1.2'
38-
ext.androidBuildToolsVersion = '29.0.2'
37+
ext.androidToolsBuildGradle = '4.2.2'
38+
ext.androidBuildToolsVersion = '30.0.2'
3939
ext.androidMinSdkVersion = 18
40-
ext.androidCompileSdkVersion = 29
41-
ext.androidTargetSdkVersion = 29
40+
ext.androidCompileSdkVersion = 31
41+
ext.androidTargetSdkVersion = 31
4242

4343
ext.androidAnnotationsVersion = '3.0.1'
4444
ext.androidAnnotationsAPIVersion = '3.0.1'
@@ -48,7 +48,7 @@ subprojects {
4848
jcenter()
4949
mavenCentral()
5050
maven { url 'https://jitpack.io' }
51-
maven { url "http://acra.googlecode.com/svn/repository/releases" }
51+
maven { url "https://acra.googlecode.com/svn/repository/releases" }
5252
maven { url "https://repo.maven.apache.org/maven2" }
5353
mavenLocal()
5454
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION_NAME=0.10.2-SNAPSHOT
1+
VERSION_NAME=1.0.1-SNAPSHOT
22
VERSION_CODE=1
33
GROUP=org.smartregister
44
POM_SETTING_DESCRIPTION=OpenSRP Client Child Library
@@ -16,4 +16,4 @@ org.gradle.jvmargs=-Xmx2048m
1616
android.enableD8=true
1717
android.enableD8.desugaring=true
1818
android.enableJetifier=true
19-
android.jetifier.blacklist=shadows
19+
android.jetifier.blacklist=shadows,bcprov-jdk15on
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sun Mar 14 15:25:46 EAT 2021
1+
#Tue Jun 14 15:00:53 EAT 2022
22
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
34
distributionPath=wrapper/dists
4-
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
6+
zipStoreBase=GRADLE_USER_HOME

opensrp-child/build.gradle

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
2+
import org.gradle.api.tasks.testing.logging.TestLogEvent
3+
14
buildscript {
25
repositories {
36
gradlePluginPortal()
@@ -17,7 +20,7 @@ plugins {
1720
description = 'OpenSRP child client library'
1821

1922
jacoco {
20-
toolVersion = "0.8.5"
23+
toolVersion = "0.8.8"
2124
}
2225

2326
android {
@@ -94,6 +97,14 @@ android {
9497
tasks.withType(Test) {
9598
jacoco.includeNoLocationClasses = true
9699
jacoco.excludes = ['jdk.internal.*']
100+
testLogging {
101+
// Enables easier debugging of tests in Github Actions CI
102+
events TestLogEvent.FAILED
103+
exceptionFormat TestExceptionFormat.FULL
104+
showExceptions true
105+
showCauses true
106+
showStackTraces true
107+
}
97108
}
98109

99110
allprojects {
@@ -107,9 +118,9 @@ allprojects {
107118

108119
dependencies {
109120

110-
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
121+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.6'
111122

112-
api('org.smartregister:opensrp-client-core:5.0.6-SNAPSHOT@aar') {
123+
api('org.smartregister:opensrp-client-core:6.1.1-SNAPSHOT@aar') {
113124
transitive = true
114125
exclude group: 'com.github.bmelnychuk', module: 'atv'
115126
exclude group: 'com.google.guava', module: 'guava'
@@ -122,7 +133,7 @@ dependencies {
122133
exclude group: 'com.android.support', module: 'support-v4'
123134
}
124135

125-
api('org.smartregister:opensrp-client-native-form:2.1.18-SNAPSHOT@aar') {
136+
api('org.smartregister:opensrp-client-native-form:3.1.1-SNAPSHOT@aar') {
126137
transitive = true
127138
exclude group: 'com.android.support', module: 'recyclerview-v7'
128139
exclude group: 'com.android.support', module: 'appcompat-v7'
@@ -131,10 +142,10 @@ dependencies {
131142
exclude group: 'io.ona.rdt-capture', module: 'lib'
132143
exclude group: 'com.google.android.gms', module: 'play-services-vision'
133144
exclude group: 'com.google.code.gson', module: 'gson'
134-
exclude group: 'com.github.raihan-mpower', module:'FancyAlertDialog-Android'
145+
exclude group: 'com.github.raihan-mpower', module: 'FancyAlertDialog-Android'
135146
}
136147

137-
implementation 'com.google.code.gson:gson:2.8.6'
148+
implementation 'com.google.code.gson:gson:2.9.0'
138149

139150
api('org.smartregister:opensrp-client-configurable-views:1.1.5-SNAPSHOT@aar') {
140151
transitive = true
@@ -144,15 +155,15 @@ dependencies {
144155
exclude group: 'com.android.support', module: 'appcompat-v7'
145156
}
146157

147-
api('org.smartregister:opensrp-client-immunization:4.0.6-SNAPSHOT@aar') {
158+
api('org.smartregister:opensrp-client-immunization:5.0.0-SNAPSHOT@aar') {
148159
transitive = true
149160
exclude group: 'org.smartregister', module: 'opensrp-client-core'
150161
exclude group: 'org.smartregister', module: 'opensrp-client-native-form'
151162
exclude group: 'com.android.support', module: 'design'
152163
exclude group: 'com.android.support', module: 'appcompat-v7'
153164
}
154165

155-
api('org.smartregister:opensrp-client-growth-monitoring:2.0.7-SNAPSHOT@aar') {
166+
api('org.smartregister:opensrp-client-growth-monitoring:3.0.0-SNAPSHOT@aar') {
156167
transitive = true
157168
exclude group: 'org.smartregister', module: 'opensrp-client-core'
158169
exclude group: 'org.smartregister', module: 'opensrp-client-native-form'
@@ -161,31 +172,33 @@ dependencies {
161172
}
162173

163174
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
164-
implementation 'androidx.recyclerview:recyclerview:1.0.0'
165-
implementation 'com.google.android.material:material:1.0.0'
166-
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
175+
implementation 'com.google.android.material:material:1.6.1'
176+
implementation 'androidx.recyclerview:recyclerview:1.2.1'
167177
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
168-
implementation 'net.zetetic:android-database-sqlcipher:4.4.0@aar'
169-
implementation 'com.jakewharton.timber:timber:4.7.1'
178+
implementation 'net.zetetic:android-database-sqlcipher:4.5.1@aar'
179+
implementation 'com.jakewharton.timber:timber:5.0.1'
170180

171-
implementation 'androidx.leanback:leanback:1.0.0'
172-
implementation 'org.pcollections:pcollections:3.1.3'
181+
implementation 'androidx.leanback:leanback:1.1.0-rc02'
182+
implementation 'org.pcollections:pcollections:3.1.4'
173183

174-
implementation 'com.google.guava:guava:29.0-android'
184+
implementation 'com.google.guava:guava:31.1-android'
175185
implementation 'id.zelory:compressor:2.1.1'
176-
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
177-
implementation "androidx.constraintlayout:constraintlayout:2.0.0"
186+
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
187+
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
188+
189+
testImplementation 'junit:junit:4.13.2'
178190

179-
testImplementation 'junit:junit:4.13'
180191
def robolectricVersion = '4.1'
181192
testImplementation("org.robolectric:robolectric:$robolectricVersion") {
182193
exclude group: 'com.google.auto.service', module: 'auto-service'
183194
exclude group: 'com.android.support'
184195
}
185196
testImplementation "org.robolectric:shadows-multidex:$robolectricVersion"
186-
testImplementation "org.robolectric:shadows-support-v4:3.3.2"
197+
testImplementation("org.robolectric:shadows-support-v4:3.4-rc2") {
198+
exclude group: 'com.google.guava', module: 'guava'
199+
}
187200

188-
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0') {
201+
androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0') {
189202
exclude group: 'com.android.support', module: 'support-annotations'
190203
exclude group: 'junit', module: 'junit'
191204
}
@@ -197,9 +210,10 @@ dependencies {
197210
testImplementation "org.powermock:powermock-module-javaagent:$powerMockVersion"
198211
testImplementation "org.powermock:powermock-api-mockito2:$powerMockVersion"
199212
testImplementation("org.powermock:powermock-classloading-xstream:$powerMockVersion")
213+
200214
testImplementation 'org.apache.maven:maven-ant-tasks:2.1.3'
201215
testImplementation group: 'org.skyscreamer', name: 'jsonassert', version: '1.5.0'
202-
testImplementation 'androidx.test:core:1.3.0'
216+
testImplementation 'androidx.test:core:1.4.0-rc01'
203217
}
204218

205219
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {

opensrp-child/src/main/java/org/smartregister/child/ChildLibrary.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,30 @@ public class ChildLibrary {
3939
private LocationPickerView locationPickerView;
4040
private EventBus eventBus;
4141

42-
private ChildLibrary(Context contextArg, Repository repositoryArg, ChildMetadata metadataArg, int applicationVersion, int databaseVersion) {
42+
private ChildLibrary(Context contextArg, Repository repositoryArg, ChildMetadata metadataArg, int applicationVersion, String applicationVersionName, int databaseVersion) {
4343
this.context = contextArg;
4444
this.repository = repositoryArg;
4545
this.metadata = metadataArg;
4646
this.applicationVersion = applicationVersion;
47+
this.applicationVersionName = applicationVersionName;
4748
this.databaseVersion = databaseVersion;
4849
}
4950

50-
public static void init(Context context, Repository repository, ChildMetadata metadataArg, int applicationVersion,
51-
int databaseVersion) {
51+
public static void init(Context context, Repository repository, ChildMetadata metadataArg, int applicationVersion, String applicationVersionName, int databaseVersion) {
5252
if (instance == null) {
53-
instance = new ChildLibrary(context, repository, metadataArg, applicationVersion, databaseVersion);
53+
instance = new ChildLibrary(context, repository, metadataArg, applicationVersion, applicationVersionName, databaseVersion);
5454
}
5555
}
5656

57+
/**
58+
* This init method is deprecated, use {@link #init(Context context, Repository repository, ChildMetadata metadataArg, int applicationVersion, String applicationVersionName, int databaseVersion)} instead which adds application version name.
59+
*/
60+
@Deprecated
61+
public static void init(Context context, Repository repository, ChildMetadata metadataArg, int applicationVersion, int databaseVersion) {
62+
init(context, repository, metadataArg, applicationVersion, null, databaseVersion);
63+
64+
}
65+
5766
public static ChildLibrary getInstance() {
5867
if (instance == null) {
5968
throw new IllegalStateException(" Instance does not exist!!! Call " + ChildLibrary.class.getName() +
@@ -62,6 +71,10 @@ public static ChildLibrary getInstance() {
6271
return instance;
6372
}
6473

74+
public static void destroyInstance() {
75+
instance = null;
76+
}
77+
6578
public ChildMetadata metadata() {
6679
return metadata;
6780
}
@@ -159,5 +172,4 @@ public void setApplicationVersionName(String applicationVersionName) {
159172
public LocationRepository getLocationRepository() {
160173
return CoreLibrary.getInstance().context().getLocationRepository();
161174
}
162-
163175
}

0 commit comments

Comments
 (0)