Skip to content

Commit c4005e7

Browse files
fercarcedopocmo
authored andcommitted
Issue mozilla-mobile#485: Remove List.toJSONArray extension method
Closes mozilla-mobile#485: Remove List.toJSONArray extension method
1 parent 28ff23d commit c4005e7

File tree

3 files changed

+2
-42
lines changed
  • components
    • service/fretboard/src/main/java/mozilla/components/service/fretboard
    • support/ktx/src
      • main/java/mozilla/components/support/ktx/kotlin
      • test/java/mozilla/components/support/ktx/kotlin

3 files changed

+2
-42
lines changed

components/service/fretboard/src/main/java/mozilla/components/service/fretboard/JSONExperimentParser.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package mozilla.components.service.fretboard
66

77
import mozilla.components.support.ktx.kotlin.putIfNotNull
8-
import mozilla.components.support.ktx.kotlin.toJsonArray
98
import mozilla.components.support.ktx.kotlin.toList
109
import mozilla.components.support.ktx.kotlin.tryGetInt
1110
import mozilla.components.support.ktx.kotlin.tryGetLong
@@ -81,7 +80,7 @@ class JSONExperimentParser {
8180
matchObject.putIfNotNull(DEVICE_KEY, experiment.match?.device)
8281
matchObject.putIfNotNull(LANG_KEY, experiment.match?.language)
8382
matchObject.putIfNotNull(MANUFACTURER_KEY, experiment.match?.manufacturer)
84-
matchObject.putIfNotNull(REGIONS_KEY, experiment.match?.regions?.toJsonArray())
83+
matchObject.putIfNotNull(REGIONS_KEY, experiment.match?.regions?.let { JSONArray(it) })
8584
matchObject.putIfNotNull(RELEASE_CHANNEL_KEY, experiment.match?.releaseChannel)
8685
matchObject.putIfNotNull(VERSION_KEY, experiment.match?.version)
8786
return matchObject
@@ -110,7 +109,7 @@ class JSONExperimentParser {
110109
for (key in payload.getKeys()) {
111110
val value = payload.get(key)
112111
when (value) {
113-
is List<*> -> jsonObject.put(key, value.toJsonArray())
112+
is List<*> -> jsonObject.put(key, JSONArray(value))
114113
else -> jsonObject.put(key, value)
115114
}
116115
}

components/support/ktx/src/main/java/mozilla/components/support/ktx/kotlin/List.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

components/support/ktx/src/test/java/mozilla/components/support/ktx/kotlin/ListTest.kt

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)