mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-24 08:22:26 +00:00
chore: remove ServiceBase
This commit is contained in:
parent
71e8f05279
commit
8620c362ed
11 changed files with 19 additions and 22 deletions
|
@ -6,7 +6,7 @@ import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class AddressService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
class AddressService {
|
||||||
var numAddresses = 1
|
var numAddresses = 1
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import net.mynero.wallet.model.BalanceInfo
|
import net.mynero.wallet.model.BalanceInfo
|
||||||
|
|
||||||
class BalanceService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
class BalanceService {
|
||||||
private val _balanceInfo = MutableLiveData<BalanceInfo?>(null)
|
private val _balanceInfo = MutableLiveData<BalanceInfo?>(null)
|
||||||
var balanceInfo: LiveData<BalanceInfo?> = _balanceInfo
|
var balanceInfo: LiveData<BalanceInfo?> = _balanceInfo
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import net.mynero.wallet.model.Wallet.ConnectionStatus
|
import net.mynero.wallet.model.Wallet.ConnectionStatus
|
||||||
import net.mynero.wallet.model.WalletManager
|
import net.mynero.wallet.model.WalletManager
|
||||||
|
|
||||||
class BlockchainService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
class BlockchainService {
|
||||||
private val _currentHeight = MutableLiveData(0L)
|
private val _currentHeight = MutableLiveData(0L)
|
||||||
var height: LiveData<Long> = _currentHeight
|
var height: LiveData<Long> = _currentHeight
|
||||||
var daemonHeight: Long = 0
|
var daemonHeight: Long = 0
|
||||||
|
|
|
@ -3,7 +3,7 @@ package net.mynero.wallet.service
|
||||||
import net.mynero.wallet.data.Node
|
import net.mynero.wallet.data.Node
|
||||||
import net.mynero.wallet.livedata.SingleLiveEvent
|
import net.mynero.wallet.livedata.SingleLiveEvent
|
||||||
|
|
||||||
class DaemonService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
class DaemonService {
|
||||||
val daemonChangeEvents: SingleLiveEvent<Node> = SingleLiveEvent()
|
val daemonChangeEvents: SingleLiveEvent<Node> = SingleLiveEvent()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import net.mynero.wallet.model.TransactionInfo
|
import net.mynero.wallet.model.TransactionInfo
|
||||||
import net.mynero.wallet.model.WalletManager
|
import net.mynero.wallet.model.WalletManager
|
||||||
|
|
||||||
class HistoryService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
class HistoryService {
|
||||||
private val _history = MutableLiveData<List<TransactionInfo>>()
|
private val _history = MutableLiveData<List<TransactionInfo>>()
|
||||||
var history: LiveData<List<TransactionInfo>> = _history
|
var history: LiveData<List<TransactionInfo>> = _history
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,12 @@ class MoneroHandlerThread(val wallet: Wallet, val context: Context) : Thread(nul
|
||||||
val thread = MoneroHandlerThread(wallet, context)
|
val thread = MoneroHandlerThread(wallet, context)
|
||||||
|
|
||||||
TxService(thread)
|
TxService(thread)
|
||||||
BalanceService(thread)
|
BalanceService()
|
||||||
AddressService(thread)
|
AddressService()
|
||||||
HistoryService(thread)
|
HistoryService()
|
||||||
BlockchainService(thread)
|
BlockchainService()
|
||||||
DaemonService(thread)
|
DaemonService()
|
||||||
UTXOService(thread)
|
UTXOService()
|
||||||
thread.start()
|
thread.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class MoneroHandlerThread(val wallet: Wallet, val context: Context) : Thread(nul
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
val prefService = PrefService.instance ?: return
|
val prefService = PrefService.instance
|
||||||
val usesTor = ProxyService.instance?.usingProxy == true
|
val usesTor = ProxyService.instance?.usingProxy == true
|
||||||
val currentNode = prefService.node
|
val currentNode = prefService.node
|
||||||
val isLocalIp =
|
val isLocalIp =
|
||||||
|
|
|
@ -12,7 +12,7 @@ import net.mynero.wallet.util.Constants
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class PrefService(application: MoneroApplication) : ServiceBase(null) {
|
class PrefService(application: MoneroApplication) {
|
||||||
|
|
||||||
private val preferences = application.getSharedPreferences(
|
private val preferences = application.getSharedPreferences(
|
||||||
application.applicationInfo.packageName,
|
application.applicationInfo.packageName,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.mynero.wallet.livedata.SingleLiveEvent
|
||||||
import net.mynero.wallet.model.WalletManager
|
import net.mynero.wallet.model.WalletManager
|
||||||
import net.mynero.wallet.util.Constants
|
import net.mynero.wallet.util.Constants
|
||||||
|
|
||||||
class ProxyService(application: Application) : ServiceBase(null) {
|
class ProxyService(application: Application) {
|
||||||
val proxyChangeEvents: SingleLiveEvent<String> = SingleLiveEvent()
|
val proxyChangeEvents: SingleLiveEvent<String> = SingleLiveEvent()
|
||||||
var samouraiTorManager: SamouraiTorManager? = null
|
var samouraiTorManager: SamouraiTorManager? = null
|
||||||
var usingProxy: Boolean = false
|
var usingProxy: Boolean = false
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
package net.mynero.wallet.service
|
|
||||||
|
|
||||||
open class ServiceBase(val thread: MoneroHandlerThread?)
|
|
|
@ -2,7 +2,7 @@ package net.mynero.wallet.service
|
||||||
|
|
||||||
import net.mynero.wallet.model.PendingTransaction
|
import net.mynero.wallet.model.PendingTransaction
|
||||||
|
|
||||||
class TxService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
class TxService(val thread: MoneroHandlerThread) {
|
||||||
init {
|
init {
|
||||||
instance = this
|
instance = this
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class TxService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
||||||
feePriority: PendingTransaction.Priority,
|
feePriority: PendingTransaction.Priority,
|
||||||
selectedUtxos: ArrayList<String>
|
selectedUtxos: ArrayList<String>
|
||||||
): PendingTransaction? {
|
): PendingTransaction? {
|
||||||
return thread?.createTx(address, amount, sendAll, feePriority, selectedUtxos)
|
return thread.createTx(address, amount, sendAll, feePriority, selectedUtxos)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
|
@ -25,11 +25,11 @@ class TxService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
||||||
feePriority: PendingTransaction.Priority,
|
feePriority: PendingTransaction.Priority,
|
||||||
selectedUtxos: ArrayList<String>
|
selectedUtxos: ArrayList<String>
|
||||||
): PendingTransaction? {
|
): PendingTransaction? {
|
||||||
return thread?.createTx(dests, sendAll, feePriority, selectedUtxos)
|
return thread.createTx(dests, sendAll, feePriority, selectedUtxos)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendTx(pendingTransaction: PendingTransaction): Boolean {
|
fun sendTx(pendingTransaction: PendingTransaction): Boolean {
|
||||||
return thread?.sendTx(pendingTransaction) == true
|
return thread.sendTx(pendingTransaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.json.JSONArray
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
|
|
||||||
class UTXOService(thread: MoneroHandlerThread?) : ServiceBase(thread) {
|
class UTXOService {
|
||||||
private val _utxos = MutableLiveData<List<CoinsInfo>>()
|
private val _utxos = MutableLiveData<List<CoinsInfo>>()
|
||||||
var utxos: LiveData<List<CoinsInfo>> = _utxos
|
var utxos: LiveData<List<CoinsInfo>> = _utxos
|
||||||
private var internalCachedUtxos: List<CoinsInfo> = ArrayList()
|
private var internalCachedUtxos: List<CoinsInfo> = ArrayList()
|
||||||
|
|
Loading…
Reference in a new issue