diff --git a/app/src/main/java/net/mynero/wallet/service/AddressService.kt b/app/src/main/java/net/mynero/wallet/service/AddressService.kt index f4751c1..2fad3a6 100644 --- a/app/src/main/java/net/mynero/wallet/service/AddressService.kt +++ b/app/src/main/java/net/mynero/wallet/service/AddressService.kt @@ -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 diff --git a/app/src/main/java/net/mynero/wallet/service/BalanceService.kt b/app/src/main/java/net/mynero/wallet/service/BalanceService.kt index edba771..783c406 100644 --- a/app/src/main/java/net/mynero/wallet/service/BalanceService.kt +++ b/app/src/main/java/net/mynero/wallet/service/BalanceService.kt @@ -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(null) var balanceInfo: LiveData = _balanceInfo diff --git a/app/src/main/java/net/mynero/wallet/service/BlockchainService.kt b/app/src/main/java/net/mynero/wallet/service/BlockchainService.kt index 107ad35..42d07c1 100644 --- a/app/src/main/java/net/mynero/wallet/service/BlockchainService.kt +++ b/app/src/main/java/net/mynero/wallet/service/BlockchainService.kt @@ -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 = _currentHeight var daemonHeight: Long = 0 diff --git a/app/src/main/java/net/mynero/wallet/service/DaemonService.kt b/app/src/main/java/net/mynero/wallet/service/DaemonService.kt index 53add24..d0db59e 100644 --- a/app/src/main/java/net/mynero/wallet/service/DaemonService.kt +++ b/app/src/main/java/net/mynero/wallet/service/DaemonService.kt @@ -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 = SingleLiveEvent() diff --git a/app/src/main/java/net/mynero/wallet/service/HistoryService.kt b/app/src/main/java/net/mynero/wallet/service/HistoryService.kt index 18b3d0c..25ce12f 100644 --- a/app/src/main/java/net/mynero/wallet/service/HistoryService.kt +++ b/app/src/main/java/net/mynero/wallet/service/HistoryService.kt @@ -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>() var history: LiveData> = _history diff --git a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.kt b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.kt index cdcfc47..647eb90 100644 --- a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.kt +++ b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.kt @@ -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 = diff --git a/app/src/main/java/net/mynero/wallet/service/PrefService.kt b/app/src/main/java/net/mynero/wallet/service/PrefService.kt index 3036603..d7728c6 100644 --- a/app/src/main/java/net/mynero/wallet/service/PrefService.kt +++ b/app/src/main/java/net/mynero/wallet/service/PrefService.kt @@ -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, diff --git a/app/src/main/java/net/mynero/wallet/service/ProxyService.kt b/app/src/main/java/net/mynero/wallet/service/ProxyService.kt index 04cc9d7..77ca8a9 100644 --- a/app/src/main/java/net/mynero/wallet/service/ProxyService.kt +++ b/app/src/main/java/net/mynero/wallet/service/ProxyService.kt @@ -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 = SingleLiveEvent() var samouraiTorManager: SamouraiTorManager? = null var usingProxy: Boolean = false diff --git a/app/src/main/java/net/mynero/wallet/service/ServiceBase.kt b/app/src/main/java/net/mynero/wallet/service/ServiceBase.kt deleted file mode 100644 index a072c55..0000000 --- a/app/src/main/java/net/mynero/wallet/service/ServiceBase.kt +++ /dev/null @@ -1,3 +0,0 @@ -package net.mynero.wallet.service - -open class ServiceBase(val thread: MoneroHandlerThread?) \ No newline at end of file diff --git a/app/src/main/java/net/mynero/wallet/service/TxService.kt b/app/src/main/java/net/mynero/wallet/service/TxService.kt index 23dc986..bca6c35 100644 --- a/app/src/main/java/net/mynero/wallet/service/TxService.kt +++ b/app/src/main/java/net/mynero/wallet/service/TxService.kt @@ -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 ): 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 ): 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 { diff --git a/app/src/main/java/net/mynero/wallet/service/UTXOService.kt b/app/src/main/java/net/mynero/wallet/service/UTXOService.kt index 3ea0e67..d753b69 100644 --- a/app/src/main/java/net/mynero/wallet/service/UTXOService.kt +++ b/app/src/main/java/net/mynero/wallet/service/UTXOService.kt @@ -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>() var utxos: LiveData> = _utxos private var internalCachedUtxos: List = ArrayList()