Skip to content

Commit

Permalink
fix: rename in app listener keys (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahroz16 committed Jan 27, 2023
1 parent fc2a08e commit f540eaf
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ max_line_length = off
# * no-wildcard-imports - allow wildcard imports statements. This is because by default, intellij automatically adds wildcard imports
# * enum-entry-name-case - allow enum class "case" names to be in format: "lowercase_snakecase". We often use enum classes for
# JSON values to send to the API. Currently, the majority of enums are used for this purpose.
disabled_rules = no-wildcard-imports,enum-entry-name-case
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_enum-entry-name-case = disabled
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import io.customer.base.extenstions.hasPassed
import io.customer.base.extenstions.isOlderThan
import io.customer.base.extenstions.subtract
import io.customer.base.extenstions.unixTimeToDate
import java.text.SimpleDateFormat
import java.util.*
import java.util.concurrent.TimeUnit
import org.amshove.kluent.shouldBeEqualTo
import org.amshove.kluent.shouldBeFalse
import org.amshove.kluent.shouldBeTrue
import org.junit.Test
import java.text.SimpleDateFormat
import java.util.*
import java.util.concurrent.TimeUnit

class DateExtensionsTest {

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/io.customer/android/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object Versions {
internal const val FIREBASE_MESSAGING = "23.1.0"
internal const val GRADLE_NEXUS_PUBLISH_PLUGIN = "1.1.0"
internal const val GRADLE_VERSIONS_PLUGIN = "0.39.0"
internal const val GIST = "3.0.2"
internal const val GIST = "3.0.3"
internal const val GOOGLE_PLAY_SERVICES_BASE = "17.6.0"
internal const val KLUENT = "1.72"
internal const val KOTLIN_BINARY_VALIDATOR = "0.10.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ enum class TestCustomAttributesDataSet {
data class CustomAttributesTestDataClass(val foo: String)

enum class CustomAttributesTestEnum {
enum, ENUM;
enum, ENUM
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ internal constructor(
event = MetricEvent.opened
)
}, onAction = { deliveryID: String, _: String, _: String, _: String ->
logger.debug("in-app message clicked $deliveryID")
trackRepository.trackInAppMetric(
deliveryID = deliveryID,
event = MetricEvent.clicked
)
}, onError = { errorMessage ->
logger.error("in-app message error occurred $errorMessage")
})
logger.debug("in-app message clicked $deliveryID")
trackRepository.trackInAppMetric(
deliveryID = deliveryID,
event = MetricEvent.clicked
)
}, onError = { errorMessage ->
logger.error("in-app message error occurred $errorMessage")
})
}

private fun setupHooks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ internal class GistInAppMessagesProvider(private val provider: GistApi) :
override fun onAction(message: Message, currentRoute: String, action: String, name: String) {
listener?.messageActionTaken(
InAppMessage.getFromGistMessage(message),
action = action,
name = name
actionValue = action,
actionName = name
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ interface InAppEventListener {
fun messageShown(message: InAppMessage)
fun messageDismissed(message: InAppMessage)
fun errorWithMessage(message: InAppMessage)
fun messageActionTaken(message: InAppMessage, action: String, name: String)
fun messageActionTaken(message: InAppMessage, actionValue: String, actionName: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ internal class InAppMessagesProviderTest : BaseTest() {
val givenAction = String.random
val givenName = String.random
gistInAppMessagesProvider.onAction(givenMessage, givenCurrentRoute, givenAction, givenName)
verify(eventListenerMock).messageActionTaken(expectedInAppMessage, action = givenAction, name = givenName)
verify(eventListenerMock).messageActionTaken(expectedInAppMessage, actionValue = givenAction, actionName = givenName)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import io.customer.sdk.extensions.random
import io.customer.sdk.hooks.HookModule
import io.customer.sdk.hooks.HooksManager
import io.customer.sdk.repository.preference.SitePreferenceRepository
import java.lang.reflect.Field
import org.amshove.kluent.shouldBe
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.*
import java.lang.reflect.Field

@RunWith(AndroidJUnit4::class)
internal class ModuleMessagingInAppTest : BaseTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import io.customer.sdk.data.request.MetricEvent
import io.customer.sdk.di.CustomerIOComponent
import io.customer.sdk.di.CustomerIOStaticComponent
import io.customer.sdk.util.Logger
import java.net.URL
import kotlin.math.abs
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import java.net.URL
import kotlin.math.abs

/**
* Class to handle PushNotification.
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-ktlint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
set -e

INSTALL_PATH="$PWD"
KTLINT_VERSION="0.46.1"
KTLINT_VERSION="0.48.2"

install_ktlint() {
echo "Downloading ktlint CLI to path $INSTALL_PATH"
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/main/java/io/customer/sdk/api/HttpRequestRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import io.customer.sdk.error.CustomerIOError
import io.customer.sdk.repository.preference.SitePreferenceRepository
import io.customer.sdk.util.JsonAdapter
import io.customer.sdk.util.Logger
import kotlinx.coroutines.delay
import retrofit2.Response
import java.util.*
import java.util.concurrent.TimeUnit
import kotlinx.coroutines.delay
import retrofit2.Response

internal interface HttpRequestRunner {
suspend fun <R> performAndProcessRequest(makeRequest: suspend () -> Response<R>): Result<R>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package io.customer.sdk.api.interceptors
import android.util.Base64
import io.customer.sdk.CustomerIOConfig
import io.customer.sdk.data.store.CustomerIOStore
import java.nio.charset.StandardCharsets
import okhttp3.Interceptor
import okhttp3.Response
import java.nio.charset.StandardCharsets

internal class HeadersInterceptor(
private val store: CustomerIOStore,
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/io/customer/sdk/data/model/EventType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = false)
enum class EventType {
event, screen;
event, screen
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package io.customer.sdk.data.moshi.adapter
import com.squareup.moshi.*
import io.customer.base.extenstions.getUnixTimestamp
import io.customer.base.extenstions.unixTimeToDate
import org.json.JSONObject.NULL
import java.io.IOException
import java.util.*
import org.json.JSONObject.NULL

// Help from: https://github.com/square/moshi/blob/fd128875c308a90288e705162e03a835220a74d9/moshi-adapters/src/main/java/com/squareup/moshi/adapters/Rfc3339DateJsonAdapter.kt
// The Customer.io API uses unix date format. Use this date format for all Dates with JSON.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import io.customer.sdk.repository.*
import io.customer.sdk.repository.preference.SitePreferenceRepository
import io.customer.sdk.repository.preference.SitePreferenceRepositoryImpl
import io.customer.sdk.util.*
import java.util.concurrent.TimeUnit
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import java.util.concurrent.TimeUnit

/**
* Configuration class to configure/initialize low-level operations and objects.
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/main/java/io/customer/sdk/queue/QueueStorage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ internal class QueueStorageImpl internal constructor(

if (!saveInventory(existingInventory) || !fileStorage.delete(
FileType.QueueTask(
taskStorageId
)
taskStorageId
)
)
) {
logger.error("error trying to delete task with storage id: $taskStorageId from queue")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import io.customer.sdk.error.CustomerIOApiErrorsResponse
import io.customer.sdk.error.CustomerIOError
import io.customer.sdk.extensions.random
import io.customer.sdk.repository.preference.SitePreferenceRepository
import java.io.IOException
import java.util.*
import java.util.concurrent.TimeUnit
import kotlinx.coroutines.runBlocking
import okhttp3.ResponseBody.Companion.toResponseBody
import org.amshove.kluent.shouldBeEqualTo
Expand All @@ -26,9 +29,6 @@ import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyNoInteractions
import org.mockito.kotlin.whenever
import retrofit2.Response
import java.io.IOException
import java.util.*
import java.util.concurrent.TimeUnit

@RunWith(AndroidJUnit4::class)
class HttpRequestRunnerTest : BaseTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package io.customer.sdk.data.store
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.customer.commontest.BaseTest
import io.customer.sdk.extensions.random
import java.io.File
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test
import org.junit.runner.RunWith
import java.io.File

@RunWith(AndroidJUnit4::class)
class FileTypeTest : BaseTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import io.customer.sdk.queue.type.QueueStatus
import io.customer.sdk.queue.type.QueueTaskGroup
import io.customer.sdk.queue.type.QueueTaskMetadata
import io.customer.sdk.queue.type.QueueTaskRunResults
import java.util.*
import java.util.concurrent.TimeUnit
import org.amshove.kluent.*
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.util.*
import java.util.concurrent.TimeUnit

@RunWith(AndroidJUnit4::class)
class QueueStorageIntegrationTest : BaseTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package io.customer.sdk.repository
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.customer.commontest.BaseTest
import io.customer.sdk.repository.preference.*
import java.util.*
import org.amshove.kluent.shouldBeEqualTo
import org.amshove.kluent.shouldBeFalse
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.util.*

@RunWith(AndroidJUnit4::class)
class SharedPreferenceRepositoryTest : BaseTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import io.customer.base.extenstions.unixTimeToDate
import io.customer.commontest.BaseTest
import io.customer.sdk.repository.preference.SitePreferenceRepository
import io.customer.sdk.repository.preference.SitePreferenceRepositoryImpl
import java.util.*
import org.amshove.kluent.shouldBeEqualTo
import org.amshove.kluent.shouldBeNull
import org.amshove.kluent.shouldNotBeNull
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.util.*

@RunWith(AndroidJUnit4::class)
class SitePreferenceRepositoryTest : BaseTest() {
Expand Down

0 comments on commit f540eaf

Please sign in to comment.