Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(unified_activity): AND-6643 Unified Activity (#4024)
- Loading branch information
1 parent
56380f4
commit 71f7d10
Showing
33 changed files
with
766 additions
and
25 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
39 changes: 39 additions & 0 deletions
39
blockchainApi/src/main/java/com/blockchain/api/selfcustody/ActivityRequest.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,39 @@ | ||
package com.blockchain.api.selfcustody | ||
|
||
import com.blockchain.domain.wallet.PubKeyStyle | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ActivityRequest( | ||
@SerialName("auth") | ||
val auth: AuthInfo, | ||
@SerialName("params") | ||
val params: ActivityRequestParams, | ||
@SerialName("nextPage") | ||
val nextPage: String? | ||
) | ||
|
||
@Serializable | ||
data class ActivityRequestParams( | ||
@SerialName("timezoneIana") | ||
val timezone: String, | ||
@SerialName("fiatCurrency") | ||
val fiatCurrency: String, | ||
@SerialName("acceptLanguage") | ||
val acceptLanguage: String, | ||
@SerialName("network") | ||
val networkTicker: String, | ||
@SerialName("pubKeyInfo") | ||
val pubKeyInfo: ActivityPubKeyInfo | ||
) | ||
|
||
@Serializable | ||
data class ActivityPubKeyInfo( | ||
@SerialName("pubKey") | ||
val pubKey: String, | ||
@SerialName("style") | ||
val style: PubKeyStyle, | ||
@SerialName("descriptor") | ||
val descriptor: String | ||
) |
15 changes: 15 additions & 0 deletions
15
blockchainApi/src/main/java/com/blockchain/api/selfcustody/PubKeyInfo.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,15 @@ | ||
package com.blockchain.api.selfcustody | ||
|
||
import com.blockchain.domain.wallet.PubKeyStyle | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PubKeyInfo( | ||
@SerialName("pubKey") | ||
val pubKey: String, | ||
@SerialName("style") | ||
val style: PubKeyStyle, | ||
@SerialName("descriptor") | ||
val descriptor: Int = 0 | ||
) |
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
45 changes: 45 additions & 0 deletions
45
...chainApi/src/main/java/com/blockchain/api/selfcustody/activity/ActivityDetailGroupsDto.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,45 @@ | ||
package com.blockchain.api.selfcustody.activity | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.modules.SerializersModuleBuilder | ||
import kotlinx.serialization.modules.polymorphic | ||
import kotlinx.serialization.modules.subclass | ||
|
||
@Serializable | ||
sealed interface ActivityDetailGroupsDto { | ||
@Serializable | ||
@SerialName("GROUPED_ITEMS") | ||
data class GroupedItems( | ||
@SerialName("title") | ||
val title: String, | ||
@SerialName("subtitle") | ||
val subtitle: String, | ||
@SerialName("icon") | ||
val icon: ActivityIconDto, | ||
@SerialName("itemGroups") | ||
val items: List<DetailGroup>, | ||
@SerialName("floatingActions") | ||
val floatingActions: List<ActivityViewItemDto> | ||
) : ActivityDetailGroupsDto { | ||
|
||
@Serializable | ||
data class DetailGroup( | ||
@SerialName("title") | ||
val title: String?, | ||
@SerialName("itemGroup") | ||
val itemGroup: List<ActivityViewItemDto> | ||
) | ||
} | ||
|
||
@Serializable | ||
@SerialName("UNKNOWN") | ||
object Unknown : ActivityDetailGroupsDto | ||
} | ||
|
||
fun SerializersModuleBuilder.activityDetailSerializer() { | ||
polymorphic(ActivityDetailGroupsDto::class) { | ||
subclass(ActivityDetailGroupsDto.GroupedItems::class) | ||
default { ActivityDetailGroupsDto.Unknown.serializer() } | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
blockchainApi/src/main/java/com/blockchain/api/selfcustody/activity/ActivityIconDto.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,43 @@ | ||
package com.blockchain.api.selfcustody.activity | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.modules.SerializersModuleBuilder | ||
import kotlinx.serialization.modules.polymorphic | ||
import kotlinx.serialization.modules.subclass | ||
|
||
@Serializable | ||
sealed interface ActivityIconDto { | ||
@Serializable | ||
@SerialName("SMALL_TAG") | ||
data class SmallTag( | ||
val main: String, | ||
val tag: String | ||
) : ActivityIconDto | ||
|
||
@Serializable | ||
@SerialName("OVERLAPPING_PAIR") | ||
data class OverlappingPair( | ||
val front: String, | ||
val back: String | ||
) : ActivityIconDto | ||
|
||
@Serializable | ||
@SerialName("SINGLE_ICON") | ||
data class SingleIcon( | ||
val url: String | ||
) : ActivityIconDto | ||
|
||
@Serializable | ||
@SerialName("UNKNOWN") | ||
object Unknown : ActivityIconDto | ||
} | ||
|
||
fun SerializersModuleBuilder.activityIconSerializer() { | ||
polymorphic(ActivityIconDto::class) { | ||
subclass(ActivityIconDto.SmallTag::class) | ||
subclass(ActivityIconDto.OverlappingPair::class) | ||
subclass(ActivityIconDto.SingleIcon::class) | ||
default { ActivityIconDto.Unknown.serializer() } | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
blockchainApi/src/main/java/com/blockchain/api/selfcustody/activity/ActivityResponse.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 com.blockchain.api.selfcustody.activity | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ActivityResponse( | ||
@SerialName("activity") | ||
val activity: List<ActivityItemDto>, | ||
@SerialName("nextPage") | ||
val nextPage: String? | ||
) | ||
|
||
@Serializable | ||
data class ActivityItemDto( | ||
@SerialName("id") | ||
val id: String, | ||
@SerialName("externalUrl") | ||
val externalUrl: String, | ||
@SerialName("item") | ||
val summary: ActivityViewItemDto, | ||
@SerialName("detail") | ||
val detail: ActivityDetailGroupsDto, | ||
@SerialName("state") | ||
val status: String, | ||
@SerialName("timestamp") | ||
val timestamp: Long | ||
) |
46 changes: 46 additions & 0 deletions
46
blockchainApi/src/main/java/com/blockchain/api/selfcustody/activity/ActivityViewItemDto.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,46 @@ | ||
package com.blockchain.api.selfcustody.activity | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.modules.SerializersModuleBuilder | ||
import kotlinx.serialization.modules.polymorphic | ||
import kotlinx.serialization.modules.subclass | ||
|
||
@Serializable | ||
sealed interface ActivityViewItemDto { | ||
@Serializable | ||
@SerialName("STACK_VIEW") | ||
data class Stack( | ||
@SerialName("leadingImage") | ||
val leadingImage: ActivityIconDto?, | ||
@SerialName("leading") | ||
val leading: List<StackComponentDto>, | ||
@SerialName("trailing") | ||
val trailing: List<StackComponentDto>, | ||
) : ActivityViewItemDto | ||
|
||
@Serializable | ||
@SerialName("BUTTON") | ||
data class Button( | ||
@SerialName("text") | ||
val value: String, | ||
@SerialName("buttonStyle") | ||
val style: String, | ||
@SerialName("actionType") | ||
val actionType: String, | ||
@SerialName("actionData") | ||
val actionData: String | ||
) : ActivityViewItemDto | ||
|
||
@Serializable | ||
@SerialName("UNKNOWN") | ||
object Unknown : ActivityViewItemDto | ||
} | ||
|
||
fun SerializersModuleBuilder.activityViewItemSerializer() { | ||
polymorphic(ActivityViewItemDto::class) { | ||
subclass(ActivityViewItemDto.Stack::class) | ||
subclass(ActivityViewItemDto.Button::class) | ||
default { ActivityViewItemDto.Unknown.serializer() } | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
blockchainApi/src/main/java/com/blockchain/api/selfcustody/activity/StackComponentDto.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,50 @@ | ||
package com.blockchain.api.selfcustody.activity | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.modules.SerializersModuleBuilder | ||
import kotlinx.serialization.modules.polymorphic | ||
import kotlinx.serialization.modules.subclass | ||
|
||
@Serializable | ||
data class ActivityTextStyleDto( | ||
@SerialName("style") | ||
val style: String, | ||
@SerialName("color") | ||
val color: String, | ||
@SerialName("strikethrough") | ||
val strikethrough: Boolean | ||
) | ||
|
||
@Serializable | ||
sealed interface StackComponentDto { | ||
@Serializable | ||
@SerialName("TEXT") | ||
data class Text( | ||
@SerialName("value") | ||
val value: String, | ||
@SerialName("style") | ||
val style: ActivityTextStyleDto | ||
) : StackComponentDto | ||
|
||
@Serializable | ||
@SerialName("BADGE") | ||
data class Tag( | ||
@SerialName("value") | ||
val value: String, | ||
@SerialName("style") | ||
val style: String | ||
) : StackComponentDto | ||
|
||
@Serializable | ||
@SerialName("UNKNOWN") | ||
object Unknown : StackComponentDto | ||
} | ||
|
||
fun SerializersModuleBuilder.stackComponentSerializer() { | ||
polymorphic(StackComponentDto::class) { | ||
subclass(StackComponentDto.Text::class) | ||
subclass(StackComponentDto.Tag::class) | ||
default { StackComponentDto.Unknown.serializer() } | ||
} | ||
} |
Oops, something went wrong.