chore: remove ServiceBase
Some checks failed
/ build-native-libraries-arm64-v8a (push) Has been cancelled
/ build-apk-arm64-v8a (push) Has been cancelled

This commit is contained in:
- 2024-11-04 15:54:20 +01:00 committed by anoncontributorxmr
parent 71e8f05279
commit 8620c362ed
No known key found for this signature in database
GPG key ID: 318D49FCE95DEA5A
11 changed files with 19 additions and 22 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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()

View file

@ -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

View file

@ -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 =

View file

@ -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,

View file

@ -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

View file

@ -1,3 +0,0 @@
package net.mynero.wallet.service
open class ServiceBase(val thread: MoneroHandlerThread?)

View file

@ -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 {

View file

@ -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()