Skip to content

Commit

Permalink
Release
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisDemyanko committed Jun 12, 2023
1 parent bb2ea42 commit e6185a4
Show file tree
Hide file tree
Showing 45 changed files with 964 additions and 375 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ android {
applicationId "com.mw.beam.beamwallet"
minSdkVersion 23
targetSdkVersion 32
versionCode 501
versionName "7.1"
versionCode 512
versionName "7.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<action android:name="android.intent.action.VIEW" />
</intent-filter>

<intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/java/com/mw/beam/beamwallet/core/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,17 @@ class App : Application() {
}

fun startBackgroundService() {
val jobScheduler: JobScheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler
val jobInfo = JobInfo.Builder(BACKGROUND_JOB_ID, ComponentName(applicationContext, BackgroundService::class.java))
.setPeriodic(TimeUnit.MINUTES.toMillis(15))
.setPersisted(true)
.build()
jobScheduler.schedule(jobInfo)
// val jobScheduler: JobScheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler
// val jobInfo = JobInfo.Builder(BACKGROUND_JOB_ID, ComponentName(applicationContext, BackgroundService::class.java))
// .setPeriodic(TimeUnit.MINUTES.toMillis(15))
// .setPersisted(true)
// .build()
// jobScheduler.schedule(jobInfo)
}

fun stopBackgroundService() {
val jobScheduler: JobScheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler
jobScheduler.cancelAll()
// val jobScheduler: JobScheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler
// jobScheduler.cancelAll()
}

fun clearLogs() {
Expand Down
48 changes: 39 additions & 9 deletions app/src/main/java/com/mw/beam/beamwallet/core/AppManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class AppManager {
var subOnBeamGameGenerated: Subject<String> = PublishSubject.create<String>().toSerialized()
var subOnPublicAddress: Subject<String> = PublishSubject.create<String>().toSerialized()
var subOnMaxPrivacyAddress: Subject<String> = PublishSubject.create<String>().toSerialized()
var subOnRegularAddress: Subject<String> = PublishSubject.create<String>().toSerialized()
var subOnOfflineAddress: Subject<String> = PublishSubject.create<String>().toSerialized()

var subOnExportToCSV: Subject<String> = PublishSubject.create<String>().toSerialized()
var subOnAddressCreated: Subject<WalletAddress> = PublishSubject.create<WalletAddress>().toSerialized()
var onCallWalletApiResult: Subject<String> = PublishSubject.create<String>().toSerialized()
Expand Down Expand Up @@ -95,11 +98,15 @@ class AppManager {
}

fun getNode():String {
val node = Api.getDefaultPeers().random()
if (!node.contains("shanghai")) {
return node
val nodes = Api.getDefaultPeers();
val result = arrayListOf<String>();
nodes.forEach {
if(!it.contains("shanghai") && !it.contains("raskul")
&& !it.contains("45.")) {
result.add(it)
}
}
return Api.getDefaultPeers().random()
return result.random()
}
}

Expand Down Expand Up @@ -132,7 +139,6 @@ class AppManager {
}

fun isMaxPrivacyEnabled(): Boolean {
// return true
val protocolEnabled = PreferencesManager.getBoolean(PreferencesManager.KEY_MOBILE_PROTOCOL, false);
return wallet?.isConnectionTrusted() == true || protocolEnabled
}
Expand Down Expand Up @@ -262,7 +268,8 @@ class AppManager {
val nodes = Api.getDefaultPeers();
val result = mutableListOf<String>();
nodes.forEach {
if(!it.contains("shanghai")) {
if(!it.contains("shanghai") && !it.contains("raskul")
&& !it.contains("45.")) {
result.add(it)
}
}
Expand Down Expand Up @@ -342,7 +349,8 @@ class AppManager {
it.displayAddress = it.address
}
else{
it.displayAddress = it.getOriginalId
it.displayAddress = it.address
// it.displayAddress = it.getOriginalId
}
}

Expand Down Expand Up @@ -993,8 +1001,20 @@ class AppManager {
item.rate = wallet?.getTransactionRate(item.id, currencyId, item.assetId.toLong())
}

transactions.forEach { tx->
if (tx.assets != null) {
val copy = tx.assets?.toMutableList()
if (copy != null) {
tx.assets = arrayListOf()
tx.assets?.addAll(copy.toTypedArray())
}
}
}

val g = Gson()
val jsonString = g.toJson(transactions)
val saved = transactions.toList()

val jsonString = g.toJson(saved)
PreferencesManager.putString(PreferencesManager.KEY_TRANSACTIONS, jsonString)

subOnTransactionsChanged.onNext(0)
Expand Down Expand Up @@ -1107,7 +1127,9 @@ class AppManager {
it.displayAddress = it.address
}
else{
it.displayAddress = it.getOriginalId
it.displayAddress = it.address

// it.displayAddress = it.getOriginalId
}
}

Expand All @@ -1131,6 +1153,14 @@ class AppManager {
subOnMaxPrivacyAddress.onNext(it)
}

WalletListener.subOnRegularAddress.subscribe {
subOnRegularAddress.onNext(it)
}

WalletListener.subOnOfflineAddress.subscribe {
subOnOfflineAddress.onNext(it)
}

WalletListener.subOnNodeConnectedStatusChanged.subscribe {
setNetworkStatus(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class AssetManager {
}
}

private fun getImage(asset: Asset):Int {
fun getImage(asset: Asset):Int {
return when {
asset.isBeam() -> {
R.drawable.ic_asset_0
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/com/mw/beam/beamwallet/core/DAOManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object DAOManager {
val url = when (BuildConfig.FLAVOR) {
AppConfig.FLAVOR_MAINNET -> "https://apps.beam.mw/appslist.json"
AppConfig.FLAVOR_TESTNET -> "https://apps-testnet.beam.mw/appslist.json"
else -> "http://3.19.141.112/app/appslist.json"
else -> "http://3.16.160.95/app/appslist.json" //"http://3.19.141.112/app/appslist.json"
}

val queue = Volley.newRequestQueue(context)
Expand All @@ -39,6 +39,9 @@ object DAOManager {
apps.addAll(array)

apps.forEach {
if (it.name == "Beam DEX" && BuildConfig.FLAVOR == AppConfig.FLAVOR_MASTERNET) {
it.url = "https://dappnet-dex.beam.mw/"
}
it.support = AppManager.instance.wallet?.appSupported(it.api_version ?: "current",
it.min_api_version ?: "")
}
Expand All @@ -56,7 +59,7 @@ object DAOManager {

fun getDaoVotingApp():DAOApp {
val url = when (BuildConfig.FLAVOR) {
AppConfig.FLAVOR_MASTERNET -> "http://3.19.141.112:80/app-same-origin/dao-voting-app/index.html\""
AppConfig.FLAVOR_MASTERNET -> "http://3.16.160.95:80/app-same-origin/dao-voting-app-beam/index.html"
AppConfig.FLAVOR_TESTNET -> "https://apps-testnet.beam.mw/app/dao-voting-app/index.html"
AppConfig.FLAVOR_MAINNET -> "https://apps.beam.mw/app/dao-voting-app/index.html"
else -> ""
Expand All @@ -67,7 +70,7 @@ object DAOManager {

fun getDaoCoreApp():DAOApp {
val url = when (BuildConfig.FLAVOR) {
AppConfig.FLAVOR_MASTERNET -> "http://3.19.141.112:80/app/plugin-dao-core/index.html"
AppConfig.FLAVOR_MASTERNET -> "http://3.16.160.95:80/app/plugin-dao-core/index.html"
AppConfig.FLAVOR_TESTNET -> "https://apps-testnet.beam.mw/app/dao-core-app/index.html"
AppConfig.FLAVOR_MAINNET -> "https://apps.beam.mw/app/dao-core-app/index.html"
else -> ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RestoreManager {
val link = when (BuildConfig.FLAVOR) {
AppConfig.FLAVOR_MAINNET -> "https://mobile-restore.beam.mw/mainnet/mainnet_recovery.bin"
AppConfig.FLAVOR_TESTNET -> "https://mobile-restore.beam.mw/testnet/testnet_recovery.bin"
else -> "https://mobile-restore.beam.mw/masternet/masternet_recovery.bin"
else -> "https://s3.eu-central-1.amazonaws.com/mobile-restore.beam.mw/dappnet/dappnet_recovery.bin" //"https://mobile-restore.beam.mw/masternet/masternet_recovery.bin"
}

val fetchConfiguration = FetchConfiguration.Builder(App.self.baseContext)
Expand Down
27 changes: 15 additions & 12 deletions app/src/main/java/com/mw/beam/beamwallet/core/entities/Asset.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
package com.mw.beam.beamwallet.core.entities

import android.os.Parcelable
import com.mw.beam.beamwallet.BuildConfig
import com.mw.beam.beamwallet.core.AppConfig
import com.mw.beam.beamwallet.core.AssetManager
import com.mw.beam.beamwallet.core.ExchangeManager
import com.mw.beam.beamwallet.core.entities.dto.SystemStateDTO
import kotlinx.android.parcel.Parcelize


class Asset(val assetId: Int,
var available: Long,
var receiving: Long,
var sending: Long,
var maturing: Long,
var shielded: Long,
var maxPrivacy: Long,
var updateLastTime: Long,
var updateDone: Int,
var updateTotal: Int,
var system: SystemStateDTO) {
@Parcelize
data class Asset(val assetId: Int,
var available: Long = 0L,
var receiving: Long = 0L,
var sending: Long = 0L,
var maturing: Long = 0L,
var shielded: Long = 0L,
var maxPrivacy: Long = 0L,
var updateLastTime: Long = 0L,
var updateDone: Int = 0,
var updateTotal: Int = 0,
var system: SystemStateDTO = SystemStateDTO("", 0L)) : Parcelable {

var unitName: String = ""
var nthUnitName: String = ""
Expand All @@ -35,7 +38,7 @@ class Asset(val assetId: Int,
}

fun isBeamX():Boolean {
if (BuildConfig.FLAVOR == AppConfig.FLAVOR_MASTERNET && assetId == 31) {
if (BuildConfig.FLAVOR == AppConfig.FLAVOR_MASTERNET && assetId == 3) {
return true
}
else if (BuildConfig.FLAVOR == AppConfig.FLAVOR_TESTNET && assetId == 12) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
*/
package com.mw.beam.beamwallet.core.entities

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Parcelable
import androidx.core.content.ContextCompat
import com.mw.beam.beamwallet.R
import com.mw.beam.beamwallet.core.App
import com.mw.beam.beamwallet.core.entities.dto.TxDescriptionDTO
import com.mw.beam.beamwallet.core.entities.dto.WalletStatusDTO
import com.mw.beam.beamwallet.core.helpers.TxFailureReason
import com.mw.beam.beamwallet.core.helpers.TxSender
import com.mw.beam.beamwallet.core.helpers.TxStatus
Expand All @@ -31,48 +33,81 @@ import kotlinx.android.parcel.Parcelize
* 10/2/18.
*/
@Parcelize
class TxDescription(val source: TxDescriptionDTO) : Parcelable {
val id: String = source.id
val amount: Long = if (source.amount >= 0) {
source.amount
}
else {
source.amount * (-1)
}
val fee: Long = source.fee
val change: Long = source.change
val minHeight: Long = source.minHeight
val peerId: String = source.peerId.replaceFirst(Regex("^0+"), "")
val myId: String = source.myId.replaceFirst(Regex("^0+"), "")
var message: String = source.message?.capitalize() ?: ""
val createTime: Long = source.createTime
val modifyTime: Long = source.modifyTime
val sender: TxSender = TxSender.fromValue(source.getSenderValue())
val status: TxStatus = TxStatus.fromValue(source.status)
val kernelId: String = source.kernelId
val selfTx: Boolean = source.selfTx
val failureReason: TxFailureReason = TxFailureReason.fromValue(source.failureReason)
val failureReasonID: Int = source.failureReason
val identity: String? = source.identity
val isShielded = source.isShielded
val isMaxPrivacy = source.isMaxPrivacy
val isPublicOffline = source.isPublicOffline
val token = source.token
val senderIdentity = source.senderIdentity
val receiverIdentity = source.receiverIdentity
val receiverAddress = source.receiverAddress
val senderAddress = source.senderAddress
val assetId = source.assetId
var asset:Asset? = null
data class TxDescription(var id: String,
var amount: Long,
var fee: Long,
var change: Long,
var minHeight: Long,
var peerId: String,
var myId: String,
var message: String,
var createTime: Long,
var modifyTime: Long,
var sender: TxSender,
var status: TxStatus,
var kernelId: String,
var selfTx: Boolean,
var failureReason: TxFailureReason,
var failureReasonID: Int,
var identity: String?,
var isShielded: Boolean,
var isMaxPrivacy: Boolean,
var isPublicOffline: Boolean,
var token: String,
var senderIdentity: String,
var receiverIdentity: String,
var receiverAddress: String,
var senderAddress: String,
var assetId: Int,
var asset:Asset? = null,
var assets: java.util.ArrayList<WalletStatusDTO>? = null,
var isDapps:Boolean? = null,
var appName:String? = null,
var appID:String? = null,
var contractCids:String? = null,
var minConfirmationsProgress:String? = null,
var minConfirmations:Int? = null,
var rate:Long? = null
) : Parcelable {

var isDapps:Boolean? = source.isDapps
var appName:String? = source.appName
var appID:String? = source.appID
var contractCids:String? = source.contractCids
var minConfirmationsProgress:String? = source.minConfirmationsProgress
var minConfirmations:Int? = source.minConfirmations
constructor(source: TxDescriptionDTO) : this(
source.id,
if (source.amount >= 0) source.amount else source.amount * (-1),
source.fee,
source.change,
source.minHeight,
source.peerId.replaceFirst(Regex("^0+"), ""),
source.myId.replaceFirst(Regex("^0+"), ""),
source.message?.capitalize() ?: "",
source.createTime,
source.modifyTime,
TxSender.fromValue(source.getSenderValue()),
TxStatus.fromValue(source.status),
source.kernelId,
source.selfTx,
TxFailureReason.fromValue(source.failureReason),
source.failureReason,
source.identity,
source.isShielded,
source.isMaxPrivacy,
source.isPublicOffline,
source.token,
source.senderIdentity,
source.receiverIdentity,
source.receiverAddress,
source.senderAddress,
source.assetId,
null, // Initialize asset to null, to be set later.
null, // Initialize assets to null, to be set later.
source.isDapps,
source.appName,
source.appID,
source.contractCids,
source.minConfirmationsProgress,
source.minConfirmations,
null // Initialize rate to null, to be set later.
)

var rate:Long? = null

fun isInProgress():Boolean {
return (status == TxStatus.Pending || status==TxStatus.Registered || status==TxStatus.InProgress)
Expand Down Expand Up @@ -125,6 +160,7 @@ class TxDescription(val source: TxDescriptionDTO) : Parcelable {
return this.status
}

@SuppressLint("SuspiciousIndentation")
fun getStatusString(context: Context) : String {
var status = when (getStatusEnum()) {
TxStatus.Confirming -> {
Expand Down
Loading

0 comments on commit e6185a4

Please sign in to comment.