Skip to content

Commit

Permalink
Revert "Revert "Merge branch 'master' into issue-2077""
Browse files Browse the repository at this point in the history
This reverts commit 30a9915.
  • Loading branch information
ekigamba committed Aug 19, 2022
1 parent 8b45f8c commit 1f0d364
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
16 changes: 16 additions & 0 deletions opensrp-chw-hf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ android {
includeCompileClasspath = true
}
}

if (project.rootProject.file("local.properties").exists()) {
Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
if (properties != null &&
properties.containsKey("mapbox.sdk.token")) {
buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", properties["mapbox.sdk.token"]
} else {
println("Mapbox key config variables is not set in your local.properties")
buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\""
}

} else {
println("local.properties does not exist")
buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\""
}
}

android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import com.evernote.android.job.JobManager;
import com.mapbox.mapboxsdk.Mapbox;

import org.jetbrains.annotations.NotNull;
import org.smartregister.AllConstants;
Expand Down Expand Up @@ -226,6 +227,8 @@ public void onCreate() {
}
// set up processor
FamilyLibrary.getInstance().setClientProcessorForJava(HfClientProcessor.getInstance(getApplicationContext()));

Mapbox.getInstance(this, BuildConfig.MAPBOX_SDK_ACCESS_TOKEN);
}

@Override
Expand Down
1 change: 0 additions & 1 deletion opensrp-chw-hf/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@
<string name="error_opening_profile">Error opening client\'s profile</string>
<string name="family">%s Family</string>
<string name="created">Created: %s</string>
<string name="mapbox_access_token">pk.eyJ1IjoiYm9yZXNoYS1hZnlhIiwiYSI6ImNrYTZzODVudDBhMWIycm1vbzF6dHc4YzgifQ.EPhVvPOIeQEkKwAyyU7fIg</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

import androidx.test.core.app.ApplicationProvider;

import com.mapbox.mapboxsdk.net.ConnectivityReceiver;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
Expand Down Expand Up @@ -42,6 +45,11 @@ public class LoginActivityTest extends BaseActivityUnitTest {
@Mock
private Button loginButton;

@BeforeClass
public static void beforeAppInitialize() {
ReflectionHelpers.setStaticField(ConnectivityReceiver.class, "INSTANCE", Mockito.mock(ConnectivityReceiver.class));
}

@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
Expand Down

0 comments on commit 1f0d364

Please sign in to comment.