Skip to content

Commit

Permalink
Code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 committed Mar 20, 2023
1 parent 5834ef7 commit 7cddbaf
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
import org.odk.collect.metadata.DeviceDetailsProvider;
import org.odk.collect.metadata.InstallIDProvider;
import org.odk.collect.metadata.PropertyManager;
import org.odk.collect.metadata.CollectInstallIDProvider;
import org.odk.collect.metadata.SettingsInstallIDProvider;
import org.odk.collect.metadata.StaticCachingDeviceDetailsProvider;
import org.odk.collect.permissions.ContextCompatPermissionChecker;
import org.odk.collect.permissions.PermissionsChecker;
Expand Down Expand Up @@ -237,7 +237,7 @@ public SettingsProvider providesSettingsProvider(Context context) {

@Provides
InstallIDProvider providesInstallIDProvider(SettingsProvider settingsProvider) {
return new CollectInstallIDProvider(settingsProvider.getMetaSettings(), KEY_INSTALL_ID);
return new SettingsInstallIDProvider(settingsProvider.getMetaSettings(), KEY_INSTALL_ID);
}

@Provides
Expand Down
3 changes: 2 additions & 1 deletion metadata/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies {
}
implementation(Dependencies.timber)

testImplementation(Dependencies.androidx_test_ext_junit)
testImplementation(Dependencies.hamcrest)
testImplementation(Dependencies.junit)
testImplementation(Dependencies.mockito_kotlin)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface InstallIDProvider {
val installID: String
}

class CollectInstallIDProvider(
class SettingsInstallIDProvider(
private val metaPreferences: Settings,
private val preferencesKey: String
) : InstallIDProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class PropertyManagerTest {

@Test
fun `getSingularProperty should require phone state permission for phone number property only`() {
propertyManager.reload()

propertyManager.getSingularProperty(PropertyManager.PROPMGR_DEVICE_ID)
propertyManager.getSingularProperty(PropertyManager.PROPMGR_USERNAME)
propertyManager.getSingularProperty(PropertyManager.PROPMGR_EMAIL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import org.junit.Test
import org.odk.collect.shared.settings.InMemSettings
import org.odk.collect.shared.settings.Settings

class CollectInstallIDProviderTest {
class SettingsInstallIDProviderTest {
private val metaPreferences: Settings = InMemSettings()
private val provider = CollectInstallIDProvider(metaPreferences, "blah")
private val provider = SettingsInstallIDProvider(metaPreferences, "blah")

@Test
fun returnsSameValueEveryTime() {
Expand Down

0 comments on commit 7cddbaf

Please sign in to comment.