mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-21 15:02:25 +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.Locale
|
||||
|
||||
class AddressService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
||||
class AddressService {
|
||||
var numAddresses = 1
|
||||
private set
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import androidx.lifecycle.LiveData
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import net.mynero.wallet.model.BalanceInfo
|
||||
|
||||
class BalanceService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
||||
class BalanceService {
|
||||
private val _balanceInfo = MutableLiveData<BalanceInfo?>(null)
|
||||
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.WalletManager
|
||||
|
||||
class BlockchainService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
||||
class BlockchainService {
|
||||
private val _currentHeight = MutableLiveData(0L)
|
||||
var height: LiveData<Long> = _currentHeight
|
||||
var daemonHeight: Long = 0
|
||||
|
|
|
@ -3,7 +3,7 @@ package net.mynero.wallet.service
|
|||
import net.mynero.wallet.data.Node
|
||||
import net.mynero.wallet.livedata.SingleLiveEvent
|
||||
|
||||
class DaemonService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
||||
class DaemonService {
|
||||
val daemonChangeEvents: SingleLiveEvent<Node> = SingleLiveEvent()
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData
|
|||
import net.mynero.wallet.model.TransactionInfo
|
||||
import net.mynero.wallet.model.WalletManager
|
||||
|
||||
class HistoryService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
||||
class HistoryService {
|
||||
private val _history = MutableLiveData<List<TransactionInfo>>()
|
||||
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)
|
||||
|
||||
TxService(thread)
|
||||
BalanceService(thread)
|
||||
AddressService(thread)
|
||||
HistoryService(thread)
|
||||
BlockchainService(thread)
|
||||
DaemonService(thread)
|
||||
UTXOService(thread)
|
||||
BalanceService()
|
||||
AddressService()
|
||||
HistoryService()
|
||||
BlockchainService()
|
||||
DaemonService()
|
||||
UTXOService()
|
||||
thread.start()
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ class MoneroHandlerThread(val wallet: Wallet, val context: Context) : Thread(nul
|
|||
}
|
||||
|
||||
override fun run() {
|
||||
val prefService = PrefService.instance ?: return
|
||||
val prefService = PrefService.instance
|
||||
val usesTor = ProxyService.instance?.usingProxy == true
|
||||
val currentNode = prefService.node
|
||||
val isLocalIp =
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.mynero.wallet.util.Constants
|
|||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
|
||||
class PrefService(application: MoneroApplication) : ServiceBase(null) {
|
||||
class PrefService(application: MoneroApplication) {
|
||||
|
||||
private val preferences = application.getSharedPreferences(
|
||||
application.applicationInfo.packageName,
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.mynero.wallet.livedata.SingleLiveEvent
|
|||
import net.mynero.wallet.model.WalletManager
|
||||
import net.mynero.wallet.util.Constants
|
||||
|
||||
class ProxyService(application: Application) : ServiceBase(null) {
|
||||
class ProxyService(application: Application) {
|
||||
val proxyChangeEvents: SingleLiveEvent<String> = SingleLiveEvent()
|
||||
var samouraiTorManager: SamouraiTorManager? = null
|
||||
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
|
||||
|
||||
class TxService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
||||
class TxService(val thread: MoneroHandlerThread) {
|
||||
init {
|
||||
instance = this
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class TxService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
|||
feePriority: PendingTransaction.Priority,
|
||||
selectedUtxos: ArrayList<String>
|
||||
): PendingTransaction? {
|
||||
return thread?.createTx(address, amount, sendAll, feePriority, selectedUtxos)
|
||||
return thread.createTx(address, amount, sendAll, feePriority, selectedUtxos)
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
|
@ -25,11 +25,11 @@ class TxService(thread: MoneroHandlerThread) : ServiceBase(thread) {
|
|||
feePriority: PendingTransaction.Priority,
|
||||
selectedUtxos: ArrayList<String>
|
||||
): PendingTransaction? {
|
||||
return thread?.createTx(dests, sendAll, feePriority, selectedUtxos)
|
||||
return thread.createTx(dests, sendAll, feePriority, selectedUtxos)
|
||||
}
|
||||
|
||||
fun sendTx(pendingTransaction: PendingTransaction): Boolean {
|
||||
return thread?.sendTx(pendingTransaction) == true
|
||||
return thread.sendTx(pendingTransaction)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.json.JSONArray
|
|||
import org.json.JSONException
|
||||
import java.util.Collections
|
||||
|
||||
class UTXOService(thread: MoneroHandlerThread?) : ServiceBase(thread) {
|
||||
class UTXOService {
|
||||
private val _utxos = MutableLiveData<List<CoinsInfo>>()
|
||||
var utxos: LiveData<List<CoinsInfo>> = _utxos
|
||||
private var internalCachedUtxos: List<CoinsInfo> = ArrayList()
|
||||
|
|
Loading…
Reference in a new issue