Skip to content

Commit bfe2e81

Browse files
committed
crash fix: remove experimental time
1 parent 0bc7857 commit bfe2e81

File tree

8 files changed

+11
-26
lines changed

8 files changed

+11
-26
lines changed

common/src/main/java/jp/co/soramitsu/common/view/Extensions.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ import androidx.lifecycle.LifecycleCoroutineScope
77
import jp.co.soramitsu.common.R
88
import jp.co.soramitsu.common.utils.bindTo
99
import kotlinx.coroutines.flow.MutableStateFlow
10-
import kotlin.time.ExperimentalTime
11-
import kotlin.time.milliseconds
10+
import kotlin.time.DurationUnit
11+
import kotlin.time.toDuration
1212

1313
private val TIMER_TAG = R.string.common_time_left
1414

15-
@ExperimentalTime
1615
fun TextView.startTimer(millis: Long, timeLeftTimestamp: Long? = null, onFinish: ((view: TextView) -> Unit)? = null) {
1716
val deltaTime = if (timeLeftTimestamp != null) System.currentTimeMillis() - timeLeftTimestamp else 0L
1817

@@ -24,7 +23,7 @@ fun TextView.startTimer(millis: Long, timeLeftTimestamp: Long? = null, onFinish:
2423

2524
val newTimer = object : CountDownTimer(millis - deltaTime, 1000) {
2625
override fun onTick(millisUntilFinished: Long) {
27-
val days = millisUntilFinished.milliseconds.inDays.toInt()
26+
val days = millisUntilFinished.toDuration(DurationUnit.DAYS).toInt(DurationUnit.DAYS)
2827

2928
this@startTimer.text = if (days > 0)
3029
resources.getQuantityString(R.plurals.staking_payouts_days_left, days, days)

feature-staking-impl/src/main/java/jp/co/soramitsu/feature_staking_impl/presentation/payouts/list/PayoutAdapter.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import kotlinx.android.synthetic.main.item_list_default.view.itemListElementDesc
1515
import kotlinx.android.synthetic.main.item_list_default.view.itemListElementDescriptionRight
1616
import kotlinx.android.synthetic.main.item_list_default.view.itemListElementTitleLeft
1717
import kotlinx.android.synthetic.main.item_list_default.view.itemListElementTitleRight
18-
import kotlin.time.ExperimentalTime
1918

2019
class PayoutAdapter(
2120
private val itemHandler: ItemHandler,
@@ -31,7 +30,6 @@ class PayoutAdapter(
3130
return PayoutViewHolder(view)
3231
}
3332

34-
@ExperimentalTime
3533
override fun onBindViewHolder(holder: PayoutViewHolder, position: Int) {
3634
val item = getItem(position)
3735

@@ -41,7 +39,6 @@ class PayoutAdapter(
4139

4240
class PayoutViewHolder(override val containerView: View) : RecyclerView.ViewHolder(containerView), LayoutContainer {
4341

44-
@ExperimentalTime
4542
fun bind(payout: PendingPayoutModel, itemHandler: PayoutAdapter.ItemHandler) = with(containerView) {
4643
with(payout) {
4744
itemListElementDescriptionLeft.startTimer(timeLeft, createdAt) {

feature-staking-impl/src/main/java/jp/co/soramitsu/feature_staking_impl/presentation/staking/balance/UnbondingsAdapter.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import kotlinx.android.synthetic.main.item_list_default.view.itemListElementDesc
1414
import kotlinx.android.synthetic.main.item_list_default.view.itemListElementDescriptionRight
1515
import kotlinx.android.synthetic.main.item_list_default.view.itemListElementTitleLeft
1616
import kotlinx.android.synthetic.main.item_list_default.view.itemListElementTitleRight
17-
import kotlin.time.ExperimentalTime
1817

1918
class UnbondingsAdapter : ListAdapter<UnbondingModel, UnbondingsHolder>(UnbondingModelDiffCallback()) {
2019

@@ -24,7 +23,6 @@ class UnbondingsAdapter : ListAdapter<UnbondingModel, UnbondingsHolder>(Unbondin
2423
return UnbondingsHolder(view)
2524
}
2625

27-
@ExperimentalTime
2826
override fun onBindViewHolder(holder: UnbondingsHolder, position: Int) {
2927
val item = getItem(position)
3028

@@ -34,7 +32,6 @@ class UnbondingsAdapter : ListAdapter<UnbondingModel, UnbondingsHolder>(Unbondin
3432

3533
class UnbondingsHolder(override val containerView: View) : RecyclerView.ViewHolder(containerView), LayoutContainer {
3634

37-
@ExperimentalTime
3835
fun bind(unbonding: UnbondingModel) = with(containerView) {
3936
with(unbonding) {
4037
itemListElementDescriptionLeft.startTimer(timeLeft, calculatedAt)

feature-staking-impl/src/main/java/jp/co/soramitsu/feature_staking_impl/presentation/staking/main/StakingFragment.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import kotlinx.android.synthetic.main.fragment_staking.stakingEstimate
3030
import kotlinx.android.synthetic.main.fragment_staking.stakingNetworkInfo
3131
import kotlinx.android.synthetic.main.fragment_staking.stakingStakeSummary
3232
import kotlinx.android.synthetic.main.fragment_staking.startStakingBtn
33-
import kotlin.time.ExperimentalTime
3433

3534
class StakingFragment : BaseFragment<StakingViewModel>() {
3635

@@ -68,7 +67,6 @@ class StakingFragment : BaseFragment<StakingViewModel>() {
6867
.inject(this)
6968
}
7069

71-
@ExperimentalTime
7270
override fun subscribe(viewModel: StakingViewModel) {
7371
observeValidations(viewModel)
7472

@@ -180,7 +178,6 @@ class StakingFragment : BaseFragment<StakingViewModel>() {
180178
}
181179
}
182180

183-
@ExperimentalTime
184181
private fun <S> StakeSummaryView.bindStakeSummary(
185182
stakingViewState: StakeViewState<S>,
186183
mapStatus: (StakeSummaryModel<S>) -> StakeSummaryView.Status

feature-staking-impl/src/main/java/jp/co/soramitsu/feature_staking_impl/presentation/view/StakeSummaryView.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class StakeSummaryView @JvmOverloads constructor(
4141
}
4242
}
4343

44-
@ExperimentalTime
4544
fun setElectionStatus(status: Status) {
4645
with(stakeSummaryStatus) {
4746
setCompoundDrawableTint(status.tintRes)

feature-wallet-api/src/main/java/jp/co/soramitsu/feature_wallet_api/domain/interfaces/WalletRepository.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package jp.co.soramitsu.feature_wallet_api.domain.interfaces
22

3-
import java.math.BigDecimal
4-
import java.math.BigInteger
53
import jp.co.soramitsu.common.data.model.CursorPage
64
import jp.co.soramitsu.fearless_utils.runtime.extrinsic.ExtrinsicBuilder
75
import jp.co.soramitsu.feature_wallet_api.domain.model.Asset
@@ -12,6 +10,9 @@ import jp.co.soramitsu.feature_wallet_api.domain.model.Transfer
1210
import jp.co.soramitsu.feature_wallet_api.domain.model.TransferValidityStatus
1311
import jp.co.soramitsu.feature_wallet_api.domain.model.WalletAccount
1412
import kotlinx.coroutines.flow.Flow
13+
import java.math.BigDecimal
14+
import java.math.BigInteger
15+
import kotlin.time.ExperimentalTime
1516

1617
interface WalletRepository {
1718

feature-wallet-impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/data/mappers/OperationMappers.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import jp.co.soramitsu.feature_wallet_impl.presentation.model.OperationModel
1717
import jp.co.soramitsu.feature_wallet_impl.presentation.model.OperationParcelizeModel
1818
import jp.co.soramitsu.feature_wallet_impl.presentation.model.OperationStatusAppearance
1919
import java.math.BigInteger
20-
import kotlin.time.ExperimentalTime
21-
import kotlin.time.seconds
20+
import kotlin.time.DurationUnit
21+
import kotlin.time.toDuration
2222

2323
fun mapOperationStatusToOperationLocalStatus(status: Operation.Status) = when (status) {
2424
Operation.Status.PENDING -> OperationLocal.Status.PENDING
@@ -64,7 +64,6 @@ private fun Operation.rewardOrNull() = type as? Operation.Type.Reward
6464
private fun Operation.transferOrNull() = type as? Operation.Type.Transfer
6565
private fun Operation.extrinsicOrNull() = type as? Operation.Type.Extrinsic
6666

67-
@ExperimentalTime
6867
fun mapOperationToOperationLocalDb(operation: Operation, source: OperationLocal.Source): OperationLocal {
6968
val typeLocal = when (operation.type) {
7069
is Operation.Type.Transfer -> OperationLocal.Type.TRANSFER
@@ -134,7 +133,6 @@ fun mapOperationLocalToOperation(operationLocal: OperationLocal): Operation {
134133
}
135134
}
136135

137-
@ExperimentalTime
138136
fun mapNodeToOperation(
139137
node: SubqueryHistoryElementResponse.Query.HistoryElements.Node,
140138
tokenType: Token.Type,
@@ -179,7 +177,7 @@ fun mapNodeToOperation(
179177
id = node.id,
180178
address = node.address,
181179
type = type,
182-
time = node.timestamp.toLong().seconds.toLongMilliseconds(),
180+
time = node.timestamp.toLong().toDuration(DurationUnit.SECONDS).inWholeMilliseconds,
183181
tokenType = tokenType,
184182
)
185183
}

feature-wallet-impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/data/repository/WalletRepositoryImpl.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package jp.co.soramitsu.feature_wallet_impl.data.repository
22

3-
import java.math.BigDecimal
4-
import java.util.Locale
53
import jp.co.soramitsu.common.data.model.CursorPage
64
import jp.co.soramitsu.common.data.network.HttpExceptionHandler
75
import jp.co.soramitsu.common.data.network.coingecko.PriceInfo
@@ -41,13 +39,14 @@ import jp.co.soramitsu.feature_wallet_impl.data.network.model.request.SubqueryHi
4139
import jp.co.soramitsu.feature_wallet_impl.data.network.phishing.PhishingApi
4240
import jp.co.soramitsu.feature_wallet_impl.data.network.subquery.SubQueryOperationsApi
4341
import jp.co.soramitsu.feature_wallet_impl.data.storage.TransferCursorStorage
44-
import kotlin.time.ExperimentalTime
4542
import kotlinx.coroutines.Dispatchers
4643
import kotlinx.coroutines.coroutineScope
4744
import kotlinx.coroutines.flow.Flow
4845
import kotlinx.coroutines.flow.map
4946
import kotlinx.coroutines.flow.mapLatest
5047
import kotlinx.coroutines.withContext
48+
import java.math.BigDecimal
49+
import java.util.Locale
5150

5251
class WalletRepositoryImpl(
5352
private val substrateSource: SubstrateRemoteSource,
@@ -100,7 +99,6 @@ class WalletRepositoryImpl(
10099
}
101100
}
102101

103-
@ExperimentalTime
104102
override suspend fun syncOperationsFirstPage(
105103
pageSize: Int,
106104
filters: Set<TransactionFilter>,
@@ -115,7 +113,6 @@ class WalletRepositoryImpl(
115113
cursorStorage.saveCursor(account.address, page.nextCursor)
116114
}
117115

118-
@ExperimentalTime
119116
override suspend fun getOperations(
120117
pageSize: Int,
121118
cursor: String?,

0 commit comments

Comments
 (0)