-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/dashevo/dash-wallet into …
…dashpay
- Loading branch information
Showing
142 changed files
with
4,356 additions
and
771 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
25 changes: 25 additions & 0 deletions
25
common/src/main/java/org/dash/wallet/common/data/ExchangeRatesConfig.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 org.dash.wallet.common.data | ||
|
||
import android.content.Context | ||
import androidx.datastore.preferences.core.booleanPreferencesKey | ||
import androidx.datastore.preferences.core.longPreferencesKey | ||
import org.dash.wallet.common.WalletDataProvider | ||
import javax.inject.Inject | ||
|
||
class ExchangeRatesConfig | ||
@Inject | ||
constructor( | ||
context: Context, | ||
walletDataProvider: WalletDataProvider | ||
) : BaseConfig( | ||
context, | ||
PREFERENCES_NAME, | ||
walletDataProvider | ||
) { | ||
companion object { | ||
private const val PREFERENCES_NAME = "exchange_rates_config" | ||
val EXCHANGE_RATES_RETRIEVAL_TIME = longPreferencesKey("exchange_rates_retrieval_time") | ||
val EXCHANGE_RATES_RETRIEVAL_FAILURE = booleanPreferencesKey("exchange_rates_retrieval_error") | ||
val EXCHANGE_RATES_PREVIOUS_RETRIEVAL_TIME = longPreferencesKey("exchange_rates_previous_retrieval_time") | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
common/src/main/java/org/dash/wallet/common/services/RateRetrievalState.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,26 @@ | ||
/* | ||
* Copyright 2024 Dash Core Group. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.dash.wallet.common.services | ||
|
||
data class RateRetrievalState( | ||
val lastAttemptFailed: Boolean = false, | ||
val staleRates: Boolean, | ||
val volatile: Boolean | ||
) { | ||
val isStale = lastAttemptFailed || staleRates || volatile | ||
} |
30 changes: 30 additions & 0 deletions
30
common/src/main/java/org/dash/wallet/common/ui/components/ComposeHostFrameLayout.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,30 @@ | ||
package org.dash.wallet.common.ui.components | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.widget.FrameLayout | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.platform.ComposeView | ||
|
||
class ComposeHostFrameLayout | ||
@JvmOverloads | ||
constructor( | ||
context: Context, | ||
attrs: AttributeSet? = null, | ||
defStyleAttr: Int = 0 | ||
) : FrameLayout(context, attrs, defStyleAttr) { | ||
private var composeView: ComposeView? = null | ||
|
||
fun setContent(content: @Composable () -> Unit) { | ||
if (composeView == null) { | ||
composeView = ComposeView(context) | ||
addView(composeView) | ||
} | ||
composeView?.setContent(content) | ||
} | ||
|
||
override fun removeAllViews() { | ||
composeView = null | ||
super.removeAllViews() | ||
} | ||
} |
Oops, something went wrong.