Skip to content

Commit 4b8bffe

Browse files
authored
Merge pull request #296 from mindbox-moscow/release-2.4.0
Release 2.4.0
2 parents 16d7b59 + a2b99c7 commit 4b8bffe

File tree

62 files changed

+2867
-618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2867
-618
lines changed

dependencies.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ ext {
2323
koin: 'io.insert-koin:koin-android:3.2.2',
2424
koin_test: 'io.insert-koin:koin-test:3.2.2',
2525
koin_junit4: 'io.insert-koin:koin-test-junit4:3.2.2',
26-
constraint_layout: 'androidx.constraintlayout:constraintlayout:2.1.4'
26+
constraint_layout: 'androidx.constraintlayout:constraintlayout:2.1.4',
27+
jdk_libs: 'com.android.tools:desugar_jdk_libs:1.2.2'
2728
]
2829

2930
testDependencies = [
@@ -34,7 +35,7 @@ ext {
3435
turbine: 'app.cash.turbine:turbine:0.12.1',
3536
mockk: 'io.mockk:mockk:1.13.2',
3637
mockk_android: 'io.mockk:mockk-android:1.13.2',
37-
mockk_agent: 'io.mockk:mockk-agent:1.13.2',
38+
mockk_agent: 'io.mockk:mockk-agent:1.13.2'
3839
]
3940

4041
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ android.enableJetifier=true
2121
kotlin.code.style=official
2222

2323
# SDK version property
24-
SDK_VERSION_NAME=2.3.0
24+
SDK_VERSION_NAME=2.4.0

mindbox-firebase/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies {
1414

1515
implementation sdkDependencies.androidx_core_ktx
1616
implementation sdkDependencies.kotlinx_coroutines_core
17+
coreLibraryDesugaring sdkDependencies.jdk_libs
1718

1819
implementation sdkDependencies.gson
1920

mindbox-huawei/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ dependencies {
1717
implementation sdkDependencies.hms_ads_identifier
1818
implementation sdkDependencies.gson
1919
implementation sdkDependencies.androidx_annotations
20+
coreLibraryDesugaring sdkDependencies.jdk_libs
2021
}

modulesCommon.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ android {
3333
}
3434

3535
compileOptions {
36+
coreLibraryDesugaringEnabled true
37+
3638
sourceCompatibility JavaVersion.VERSION_1_8
3739
targetCompatibility JavaVersion.VERSION_1_8
3840
}

sdk/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ dependencies {
2424

2525
implementation sdkDependencies.kotlin_stdlib
2626
implementation sdkDependencies.androidx_core_ktx
27+
coreLibraryDesugaring sdkDependencies.jdk_libs
2728
testImplementation testDependencies.junit
2829
androidTestImplementation testDependencies.androidx_junit
2930
androidTestImplementation testDependencies.espresso
@@ -35,6 +36,7 @@ dependencies {
3536
testImplementation testDependencies.mockk_agent
3637

3738

39+
3840
// ConstraintLayout
3941
implementation sdkDependencies.constraint_layout
4042
// Koin for Android
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,37 @@
11
package cloud.mindbox.mobile_sdk
22

3+
import android.util.Log
34
import cloud.mindbox.mobile_sdk.utils.LoggingExceptionHandler
5+
import java.time.*
6+
import java.time.format.DateTimeFormatter
47

58
internal fun Map<String, String>.toUrlQueryString() = LoggingExceptionHandler.runCatching(
69
defaultValue = ""
710
) {
811
this.map { (k, v) -> "$k=$v" }
912
.joinToString(prefix = "?", separator = "&")
1013
}
14+
15+
internal fun ZonedDateTime.convertToString() = runCatching {
16+
this.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))
17+
}.getOrElse {
18+
Log.e("Mindbox", "Error converting date", it)
19+
""
20+
}
21+
22+
internal fun Instant.convertToZonedDateTimeAtUTC(): ZonedDateTime {
23+
return this.atZone(ZoneId.systemDefault()).withZoneSameInstant(ZoneOffset.UTC)
24+
}
25+
26+
27+
internal fun String.convertToZonedDateTime(): ZonedDateTime = runCatching {
28+
return LocalDateTime.parse(this, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")).atZone(
29+
ZoneOffset.UTC
30+
)
31+
}.getOrElse {
32+
Log.e("Mindbox", "Error converting date", it)
33+
LocalDateTime.parse("1970-01-01T00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))
34+
.atZone(
35+
ZoneId.systemDefault()
36+
)
37+
}

0 commit comments

Comments
 (0)