-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into IPC-293-removable-poweredby
* main: Pp 354 user analytics feature (#449) fix(health-sdk): Fix invoices upload in the example app fix(health-sdk): Fix copying of extractions in the tests feat(health-sdk): Code fix feat(health-sdk): Fixed tests for payable check feat(health-sdk): Fixed payment state retrieve feat(health-sdk): Changed method of checking if document is payable feat(bank-sdk): Migrate to registerForActivityResult feat(capture-sdk): Migrate to registerForActivityResult Revert "Pp 197 migrate from start activity for result to register for result" feat(bank-sdk): Migrate to registerForActivityResult feat(capture-sdk): Migrate to registerForActivityResult refactor(health-sdk): Use `async` in example app to parallelize test invoice uploads and refresh requests fix(health-sdk): Fix `paymentComponentView` not collecting again after setting `documentId` and\or `isPayable` fix(health-sdk): Fix `paymentComponent` listener not called after config change fix(health-sdk): Fix mutability of `PendingIntent` fix(health-sdk): Make resetting the `openBankState` flow's PaymentState to NoAction non-cancellable fix(health-sdk): Fix `Share With` flow broken when clients pop backstack after getting payment request callback
- Loading branch information
Showing
86 changed files
with
3,640 additions
and
919 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...i-library/library/src/main/java/net/gini/android/bank/api/TrackingAnalysisRemoteSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package net.gini.android.bank.api | ||
|
||
import kotlinx.coroutines.withContext | ||
import net.gini.android.bank.api.models.AmplitudeRoot | ||
import net.gini.android.bank.api.requests.toAmplitudeRequestBody | ||
import net.gini.android.core.api.requests.SafeApiRequest | ||
import kotlin.coroutines.CoroutineContext | ||
|
||
/** | ||
* Internal use only. | ||
*/ | ||
class TrackingAnalysisRemoteSource internal constructor( | ||
private val coroutineContext: CoroutineContext, | ||
private val trackingAnalysisService: TrackingAnalysisService | ||
) { | ||
|
||
suspend fun sendEvents(amplitudeRoot: AmplitudeRoot): Unit = | ||
withContext(coroutineContext) { | ||
SafeApiRequest.apiRequest { | ||
trackingAnalysisService.sendEvents(amplitudeRoot.toAmplitudeRequestBody()) | ||
} | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
bank-api-library/library/src/main/java/net/gini/android/bank/api/TrackingAnalysisService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package net.gini.android.bank.api | ||
|
||
import net.gini.android.bank.api.requests.AmplitudeRequestBody | ||
import net.gini.android.core.api.DocumentService | ||
import okhttp3.ResponseBody | ||
import retrofit2.Response | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
internal interface TrackingAnalysisService: DocumentService { | ||
|
||
@POST("/batch") | ||
suspend fun sendEvents(@Body amplitudeBody: AmplitudeRequestBody): Response<ResponseBody> | ||
} |
28 changes: 28 additions & 0 deletions
28
bank-api-library/library/src/main/java/net/gini/android/bank/api/models/AmplitudeEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package net.gini.android.bank.api.models | ||
|
||
data class AmplitudeRoot( | ||
val apiKey: String, | ||
val events: List<AmplitudeEvent>, | ||
) | ||
|
||
data class AmplitudeEvent( | ||
val userId: String, | ||
val deviceId: String, | ||
val eventType: String, | ||
val sessionId: String, | ||
val eventId: String, | ||
val time: Long, | ||
val platform: String, | ||
val osVersion: String, | ||
val deviceManufacturer: String, | ||
val deviceBrand: String, | ||
val deviceModel: String, | ||
val versionName: String, | ||
val osName: String, | ||
val carrier: String, | ||
val language: String, | ||
val eventProperties: Map<String, Any>? = null, | ||
val userProperties: Map<String, Any>? = null, | ||
) | ||
|
||
|
11 changes: 11 additions & 0 deletions
11
bank-api-library/library/src/main/java/net/gini/android/bank/api/models/Configuration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package net.gini.android.bank.api.models | ||
|
||
data class Configuration( | ||
val clientID: String, | ||
val isUserJourneyAnalyticsEnabled: Boolean, | ||
val isSkontoEnabled: Boolean, | ||
val isReturnAssistantEnabled: Boolean, | ||
val mixpanelToken: String?, | ||
val amplitudeApiKey: String?, | ||
|
||
) |
60 changes: 60 additions & 0 deletions
60
bank-api-library/library/src/main/java/net/gini/android/bank/api/requests/AmplitudeBody.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package net.gini.android.bank.api.requests | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
import net.gini.android.bank.api.models.AmplitudeEvent | ||
import net.gini.android.bank.api.models.AmplitudeRoot | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class AmplitudeRequestBody( | ||
@Json(name = "api_key") val apiKey: String, | ||
@Json(name = "events") val events: List<AmplitudeEventBody>, | ||
) | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class AmplitudeEventBody( | ||
@Json(name = "user_id") val userId: String, | ||
@Json(name = "device_id") val deviceId: String, | ||
@Json(name = "event_type") val eventType: String, | ||
@Json(name = "session_id") val sessionId: String, | ||
@Json(name = "event_id") val eventId: String, | ||
@Json(name = "time") val time: Long = 0, | ||
@Json(name = "platform") val platform: String, | ||
@Json(name = "os_version") val osVersion: String, | ||
@Json(name = "device_manufacturer") val deviceManufacturer: String, | ||
@Json(name = "device_brand") val deviceBrand: String, | ||
@Json(name = "device_model") val deviceModel: String, | ||
@Json(name = "version_name") val versionName: String, | ||
@Json(name = "os_name") val osName: String, | ||
@Json(name = "carrier") val carrier: String, | ||
@Json(name = "language") val language: String, | ||
@Json(name = "ip") val ip: String = "\$remote", | ||
@Json(name = "event_properties") val eventProperties: Map<String, Any>? = null, | ||
@Json(name = "user_properties") val userProperties: Map<String, Any>? = null, | ||
) | ||
|
||
|
||
internal fun AmplitudeRoot.toAmplitudeRequestBody() = AmplitudeRequestBody( | ||
apiKey = apiKey, | ||
events = events.map { it.toAmplitudeEventBody() } | ||
) | ||
|
||
internal fun AmplitudeEvent.toAmplitudeEventBody() = AmplitudeEventBody( | ||
userId = userId, | ||
deviceId = deviceId, | ||
eventType = eventType, | ||
sessionId = sessionId, | ||
eventId = eventId, | ||
time = time, | ||
platform = platform, | ||
osVersion = osVersion, | ||
deviceManufacturer = deviceManufacturer, | ||
deviceBrand = deviceBrand, | ||
deviceModel = deviceModel, | ||
versionName = versionName, | ||
osName = osName, | ||
carrier = carrier, | ||
language = language, | ||
eventProperties = eventProperties, | ||
userProperties = userProperties, | ||
) |
25 changes: 25 additions & 0 deletions
25
...library/library/src/main/java/net/gini/android/bank/api/response/ConfigurationResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.gini.android.bank.api.response | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
import net.gini.android.bank.api.models.Configuration | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class ConfigurationResponse( | ||
@Json(name = "clientID") val clientID: String?, | ||
@Json(name = "userJourneyAnalyticsEnabled") val userJourneyAnalyticsEnabled: Boolean?, | ||
@Json(name = "skontoEnabled") val skontoEnabled: Boolean?, | ||
@Json(name = "returnAssistantEnabled") val returnAssistantEnabled: Boolean?, | ||
@Json(name = "mixpanelToken") val mixpanelToken: String?, | ||
@Json(name = "amplitudeApiKey") val amplitudeApiKey: String?, | ||
) | ||
|
||
internal fun ConfigurationResponse.toConfiguration() = Configuration( | ||
clientID = clientID ?: "", | ||
isUserJourneyAnalyticsEnabled = userJourneyAnalyticsEnabled ?: false, | ||
isSkontoEnabled = skontoEnabled ?: false, | ||
isReturnAssistantEnabled = returnAssistantEnabled ?: false, | ||
mixpanelToken = mixpanelToken, | ||
amplitudeApiKey = amplitudeApiKey | ||
) | ||
|
Oops, something went wrong.