Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kmp-common-sdk
Submodule kmp-common-sdk updated 0 files
3 changes: 2 additions & 1 deletion mindbox-huawei-starter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ android {

defaultConfig {
consumerProguardFiles(
"consumer-rules.pro"
"consumer-rules.pro",
"../proguard/proguard-huawei.pro"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему здесь сделал, а для firebase и rustore стартеров не стал?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

потому что там зависимости huawei нет

)
}

Expand Down
22 changes: 20 additions & 2 deletions proguard/proguard-huawei.pro
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes InnerClasses,EnclosingMethod
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep class com.huawei.hms.ads.** { *; }
-keep interface com.huawei.hms.ads.** { *; }
-keep class cloud.mindbox.mindbox_huawei.MindboxHuawei { *; }
-keep class cloud.mindbox.mindbox_huawei.MindboxHuawei { *; }

-dontwarn android.telephony.HwTelephonyManager
-dontwarn com.huawei.android.os.BuildEx$VERSION
-dontwarn com.huawei.hianalytics.process.HiAnalyticsConfig$Builder
-dontwarn com.huawei.hianalytics.process.HiAnalyticsConfig
-dontwarn com.huawei.hianalytics.process.HiAnalyticsInstance$Builder
-dontwarn com.huawei.hianalytics.process.HiAnalyticsInstance
-dontwarn com.huawei.hianalytics.process.HiAnalyticsManager
-dontwarn com.huawei.hianalytics.util.HiAnalyticTools
-dontwarn com.huawei.hms.availableupdate.UpdateAdapterMgr
-dontwarn com.huawei.libcore.io.ExternalStorageFile
-dontwarn com.huawei.libcore.io.ExternalStorageFileInputStream
-dontwarn com.huawei.libcore.io.ExternalStorageFileOutputStream
-dontwarn com.huawei.libcore.io.ExternalStorageRandomAccessFile
-dontwarn org.bouncycastle.crypto.BlockCipher
-dontwarn org.bouncycastle.crypto.engines.AESEngine
-dontwarn org.bouncycastle.crypto.prng.SP800SecureRandom
-dontwarn org.bouncycastle.crypto.prng.SP800SecureRandomBuilder
11 changes: 10 additions & 1 deletion sdk/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Keep model classes
-keepclassmembers class cloud.mindbox.mobile_sdk.models** { *; }
-keep class cloud.mindbox.mobile_sdk.MindboxConfiguration { *; }
-keep class cloud.mindbox.mobile_sdk.pushes.PushAction { *; }
-keepclassmembers class cloud.mindbox.mobile_sdk.inapp.data.dto.** { *; }
-keep class cloud.mindbox.mobile_sdk.inapp.domain.models** { *; }

-keepclasseswithmembers,allowobfuscation class cloud.mindbox.** {
@com.google.gson.annotations.SerializedName <fields>;
<init>(...);
}

-keepclassmembers class cloud.mindbox.** {
<init>(...);
<fields>;
}
Comment on lines +12 to +15
6 changes: 5 additions & 1 deletion sdk/src/main/java/cloud/mindbox/mobile_sdk/models/Event.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cloud.mindbox.mobile_sdk.models
import androidx.room.Entity
import androidx.room.PrimaryKey
import cloud.mindbox.mobile_sdk.managers.DbManager.EVENTS_TABLE_NAME
import com.google.gson.annotations.SerializedName
import com.google.gson.reflect.TypeToken
import java.util.UUID

Expand All @@ -18,7 +19,10 @@ internal data class Event(
val body: String? = null,
)

internal sealed class EventType(val operation: String, val endpoint: String) {
internal sealed class EventType(
@SerializedName("operation") val operation: String,
@SerializedName("endpoint") val endpoint: String,
) {

companion object {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package cloud.mindbox.mobile_sdk.pushes.handler

import com.google.gson.annotations.SerializedName

/**
* Current conditions under which the image is loaded
*
* @param attemptNumber The current number of attempts to correctly process the notification
* @param isMessageDisplayed The message has been shown
*/
public data class MessageHandlingState(
@SerializedName("attemptNumber")
val attemptNumber: Int,
@SerializedName("isMessageDisplayed")
val isMessageDisplayed: Boolean,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package cloud.mindbox.mobile_sdk.converters

import cloud.mindbox.mobile_sdk.models.EventType
import org.junit.Assert.assertEquals
import org.junit.Test

// Events queued by earlier SDK versions sit in the database in this format and must still be readable.
class MindboxRoomConverterTest {

@Test
fun eventTypeToString_writesOrdinalAndJsonNames() {
val stored = MindboxRoomConverter.eventTypeToString(EventType.SyncOperation("Website.Operation"))

assertEquals("""6;{"operation":"Website.Operation","endpoint":"/v3/operations/sync"}""", stored)
Comment on lines +11 to +14
}

@Test
fun stringToEventType_readsStoredOperation() {
val eventType = MindboxRoomConverter.stringToEventType(
"""5;{"operation":"Website.Operation","endpoint":"/v3/operations/async"}"""
)

assertEquals(EventType.AsyncOperation::class, eventType::class)
assertEquals("Website.Operation", eventType.operation)
assertEquals("/v3/operations/async", eventType.endpoint)
}

@Test
fun stringToEventType_readsStoredDataObject() {
val eventType = MindboxRoomConverter.stringToEventType(
"""0;{"operation":"MobilePush.ApplicationInstalled","endpoint":"/v3/operations/async"}"""
)

assertEquals(EventType.AppInstalled, eventType)
}
}
Loading