Skip to content

Commit 3bb1709

Browse files
committed
finalize storage creation
1 parent 913d6cd commit 3bb1709

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

core/src/main/java/com/segment/analytics/kotlin/core/utilities/StorageImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ object ConcreteStorageProvider : StorageProvider {
218218
}
219219
}
220220

221-
object InMemoryStorageProvider: StorageProvider {
221+
class InMemoryStorageProvider: StorageProvider {
222222
override fun createStorage(vararg params: Any): Storage {
223223
if (params.isEmpty() || params[0] !is Analytics) {
224224
throw IllegalArgumentException("Invalid parameters for InMemoryStorageProvider. InMemoryStorageProvider requires at least 1 parameter and the first argument has to be an instance of Analytics")

core/src/test/kotlin/com/segment/analytics/kotlin/core/StorageTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class StorageTest {
6868

6969
@Test
7070
fun inMemoryStorageProviderTest() {
71-
val storage = InMemoryStorageProvider.createStorage(analytics) as StorageImpl
71+
val storage = InMemoryStorageProvider().createStorage(analytics) as StorageImpl
7272
assertTrue(storage.eventStream is InMemoryEventStream)
7373
assertTrue(storage.propertiesFile is InMemoryPrefs)
7474
}

core/src/test/kotlin/com/segment/analytics/kotlin/core/utilities/InMemoryStorageTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ internal class InMemoryStorageTest {
4949
)
5050
val analytics = testAnalytics(config, testScope, testDispatcher)
5151
store = analytics.store
52-
storage = InMemoryStorageProvider.createStorage(analytics) as StorageImpl
52+
storage = InMemoryStorageProvider().createStorage(analytics) as StorageImpl
5353
storage.initialize()
5454
}
5555

samples/kotlin-android-app/src/main/java/com/segment/analytics/next/EncryptedEventStream.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,14 @@ class EncryptedEventStream(
5858
}
5959
}
6060

61-
object EncryptedStorageProvider : StorageProvider {
61+
class EncryptedStorageProvider(val key: Key) : StorageProvider {
6262

6363
override fun createStorage(vararg params: Any): Storage {
64-
if (params.isEmpty() || params[0] !is Analytics || params[1] !is Key) {
64+
if (params.isEmpty() || params[0] !is Analytics) {
6565
throw IllegalArgumentException("Invalid parameters for ConcreteStorageProvider. ConcreteStorageProvider requires at least 1 parameter and the first argument has to be an instance of Analytics")
6666
}
6767

6868
val analytics = params[0] as Analytics
69-
val key = params[1] as Key
7069
val config = analytics.configuration
7170

7271
val directory = File("/tmp/analytics-kotlin/${config.writeKey}")

0 commit comments

Comments
 (0)