mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-21 15:02:25 +00:00
0.5.8: Work on reducing apk file size and removing unnecessary dependencies
This commit is contained in:
parent
f23548b279
commit
44dd9e1d7a
9 changed files with 49 additions and 90 deletions
|
@ -8,10 +8,10 @@ android {
|
|||
ndkVersion '17.2.4988734'
|
||||
defaultConfig {
|
||||
applicationId "net.mynero.wallet"
|
||||
minSdkVersion 21
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 34
|
||||
versionCode 50700
|
||||
versionName "0.5.7 'Fluorine Fermi'"
|
||||
versionCode 50800
|
||||
versionName "0.5.8 'Fluorine Fermi'"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
@ -113,48 +113,27 @@ static def getId(name) {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
// Android stuff
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.3.2'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||
|
||||
implementation 'com.google.android.material:material:1.10.0'
|
||||
implementation 'com.ncorti:slidetoact:0.9.0'
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
implementation "com.jakewharton.timber:timber:5.0.1"
|
||||
|
||||
implementation fileTree(dir: 'libs/classes', include: ['*.jar'])
|
||||
|
||||
implementation 'org.slf4j:slf4j-nop:1.7.36'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.5'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.7.5'
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.12.0'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
// Slide to Send tx sliders
|
||||
implementation 'com.ncorti:slidetoact:0.9.0'
|
||||
|
||||
// QR Code stuff
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
|
||||
// Tor
|
||||
def vTor = '4.8.6-0'
|
||||
def vKmpTor = '1.4.4'
|
||||
|
||||
implementation 'io.samourai.code.wallet:android-tor-binary:0.4.7.12'
|
||||
implementation "io.matthewnelson.kotlin-components:kmp-tor:$vTor-$vKmpTor"
|
||||
|
||||
//noinspection GradleDependency
|
||||
testImplementation "junit:junit:4.13.2"
|
||||
testImplementation "org.mockito:mockito-all:1.10.19"
|
||||
testImplementation "com.squareup.okhttp3:mockwebserver:4.9.3"
|
||||
testImplementation 'org.json:json:20230227'
|
||||
testImplementation 'net.jodah:concurrentunit:0.4.6'
|
||||
}
|
||||
|
||||
//https://stackoverflow.com/questions/75274720/a-failure-occurred-while-executing-appcheckdebugduplicateclasses/75315276#75315276
|
||||
//Not sure why this is needed since Kotlin isn't used in this project...
|
||||
configurations.implementation {
|
||||
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
|
||||
}
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
<application
|
||||
android:name=".MoneroApplication"
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/app_name"
|
||||
android:preserveLegacyExternalStorage="true"
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
*/
|
||||
package net.mynero.wallet.data
|
||||
|
||||
import android.util.Log
|
||||
import net.mynero.wallet.model.NetworkType
|
||||
import net.mynero.wallet.model.WalletManager
|
||||
import net.mynero.wallet.util.OnionHelper
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import timber.log.Timber
|
||||
import java.io.UnsupportedEncodingException
|
||||
import java.net.InetSocketAddress
|
||||
import java.net.URLDecoder
|
||||
|
@ -93,7 +93,7 @@ class Node {
|
|||
try {
|
||||
name = URLDecoder.decode(daParts[2], "UTF-8")
|
||||
} catch (ex: UnsupportedEncodingException) {
|
||||
Timber.w(ex) // if we can't encode it, we don't use it
|
||||
Log.w("Node.kt", ex) // if we can't encode it, we don't use it
|
||||
}
|
||||
}
|
||||
this.name = name
|
||||
|
@ -224,7 +224,7 @@ class Node {
|
|||
if (name != null) try {
|
||||
sb.append("/").append(URLEncoder.encode(name, "UTF-8"))
|
||||
} catch (ex: UnsupportedEncodingException) {
|
||||
Timber.w(ex) // if we can't encode it, we don't store it
|
||||
Log.w("Node.kt", ex) // if we can't encode it, we don't store it
|
||||
}
|
||||
return sb.toString()
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ class Node {
|
|||
return try {
|
||||
Node(nodeString)
|
||||
} catch (ex: IllegalArgumentException) {
|
||||
Timber.w(ex)
|
||||
Log.w("Node.kt", ex)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
@ -263,13 +263,13 @@ class Node {
|
|||
return try {
|
||||
Node(jsonObject)
|
||||
} catch (ex: IllegalArgumentException) {
|
||||
Timber.w(ex)
|
||||
Log.w("Node.kt", ex)
|
||||
null
|
||||
} catch (ex: UnknownHostException) {
|
||||
Timber.w(ex)
|
||||
Log.w("Node.kt", ex)
|
||||
null
|
||||
} catch (ex: JSONException) {
|
||||
Timber.w(ex)
|
||||
Log.w("Node.kt", ex)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.mynero.wallet.fragment.receive
|
|||
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -18,6 +19,7 @@ import com.google.zxing.EncodeHintType
|
|||
import com.google.zxing.WriterException
|
||||
import com.google.zxing.qrcode.QRCodeWriter
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
||||
import com.journeyapps.barcodescanner.BarcodeEncoder
|
||||
import net.mynero.wallet.R
|
||||
import net.mynero.wallet.adapter.SubaddressAdapter
|
||||
import net.mynero.wallet.adapter.SubaddressAdapter.SubaddressAdapterListener
|
||||
|
@ -25,7 +27,6 @@ import net.mynero.wallet.data.Subaddress
|
|||
import net.mynero.wallet.fragment.dialog.EditAddressLabelBottomSheetDialog
|
||||
import net.mynero.wallet.fragment.dialog.EditAddressLabelBottomSheetDialog.LabelListener
|
||||
import net.mynero.wallet.util.Helper.clipBoardCopy
|
||||
import timber.log.Timber
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.util.EnumMap
|
||||
|
||||
|
@ -125,11 +126,13 @@ class ReceiveFragment : Fragment() {
|
|||
EnumMap(com.google.zxing.EncodeHintType::class.java)
|
||||
hints[EncodeHintType.CHARACTER_SET] = StandardCharsets.UTF_8
|
||||
hints[EncodeHintType.ERROR_CORRECTION] = ErrorCorrectionLevel.M
|
||||
|
||||
try {
|
||||
val bitMatrix = QRCodeWriter().encode(text, BarcodeFormat.QR_CODE, width, height, hints)
|
||||
val pixels = IntArray(width * height)
|
||||
for (i in 0 until height) {
|
||||
for (j in 0 until width) {
|
||||
val barcodeEncoder = BarcodeEncoder()
|
||||
val bitMatrix = barcodeEncoder.encode(text, BarcodeFormat.QR_CODE, width, height, hints)
|
||||
val pixels = IntArray(bitMatrix.width * bitMatrix.height)
|
||||
for (i in 0 until bitMatrix.height) {
|
||||
for (j in 0 until bitMatrix.width) {
|
||||
if (bitMatrix[j, i]) {
|
||||
pixels[i * width + j] = -0x1
|
||||
} else {
|
||||
|
@ -140,9 +143,9 @@ class ReceiveFragment : Fragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
return Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.RGB_565)
|
||||
return Bitmap.createBitmap(pixels, 0, bitMatrix.width, bitMatrix.width, bitMatrix.height, Bitmap.Config.ARGB_8888)
|
||||
} catch (ex: WriterException) {
|
||||
Timber.e(ex)
|
||||
Log.e("ReceiveFragment.kt", ex.toString())
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package net.mynero.wallet.model
|
||||
|
||||
import timber.log.Timber
|
||||
import android.util.Log
|
||||
|
||||
class Coins(private val handle: Long) {
|
||||
var all: List<CoinsInfo> = ArrayList()
|
||||
|
@ -23,7 +23,7 @@ class Coins(private val handle: Long) {
|
|||
|
||||
fun refresh() {
|
||||
val transactionInfos = refreshJ()
|
||||
Timber.d("refresh size=%d", transactionInfos.size)
|
||||
Log.d("Coins.kt", "refresh size=${transactionInfos.size}")
|
||||
all = transactionInfos
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package net.mynero.wallet.model
|
||||
|
||||
import timber.log.Timber
|
||||
import android.util.Log
|
||||
|
||||
class TransactionHistory(private val handle: Long, var accountIndex: Int) {
|
||||
var all: List<TransactionInfo> = ArrayList()
|
||||
|
@ -43,7 +43,7 @@ class TransactionHistory(private val handle: Long, var accountIndex: Int) {
|
|||
|
||||
private fun refresh() {
|
||||
val transactionInfos = refreshJ()
|
||||
Timber.d("refresh size=%d", transactionInfos.size)
|
||||
Log.d("TransactionHistory.kt", "refresh size=${transactionInfos.size}")
|
||||
val iterator = transactionInfos.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val info = iterator.next()
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
*/
|
||||
package net.mynero.wallet.model
|
||||
|
||||
import android.util.Log
|
||||
import net.mynero.wallet.data.Node
|
||||
import net.mynero.wallet.util.RestoreHeight
|
||||
import timber.log.Timber
|
||||
import java.io.File
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
|
@ -35,7 +35,7 @@ class WalletManager {
|
|||
private set
|
||||
|
||||
private fun manageWallet(wallet: Wallet) {
|
||||
Timber.d("Managing %s", wallet.name)
|
||||
Log.d("WalletManager.kt", "Managing ${wallet.name}")
|
||||
this.wallet = wallet
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class WalletManager {
|
|||
requireNotNull(wallet) { "Cannot unmanage null!" }
|
||||
checkNotNull(this.wallet) { "No wallet under management!" }
|
||||
check(this.wallet === wallet) { wallet.name + " not under management!" }
|
||||
Timber.d("Unmanaging %s", wallet.name)
|
||||
Log.d("WalletManager.kt", "Unmanaging ${wallet.name}")
|
||||
this.wallet = null
|
||||
}
|
||||
|
||||
|
@ -62,9 +62,9 @@ class WalletManager {
|
|||
if (restoreHeight != null) {
|
||||
wallet.setRestoreHeight(restoreHeight)
|
||||
}
|
||||
Timber.d("Changed Restore Height from %d to %d", oldHeight, wallet.getRestoreHeight())
|
||||
Log.d("WalletManager.kt", "Changed Restore Height from $oldHeight to ${wallet.getRestoreHeight()}")
|
||||
wallet.setPassword(password) // this rewrites the keys file (which contains the restore height)
|
||||
} else Timber.e(wallet.status.toString())
|
||||
} else Log.e("WalletManager.kt", wallet.status.toString())
|
||||
return wallet
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ class WalletManager {
|
|||
manageWallet(wallet)
|
||||
if (wallet.status.isOk) {
|
||||
wallet.setPassword(password) // this rewrites the keys file (which contains the restore height)
|
||||
} else Timber.e(wallet.status.toString())
|
||||
} else Log.e("WalletManager.kt", wallet.status.toString())
|
||||
return wallet
|
||||
}
|
||||
|
||||
|
@ -235,27 +235,7 @@ class WalletManager {
|
|||
return queryWalletDeviceJ(keysFileName, password) >= 0
|
||||
}
|
||||
|
||||
fun queryWalletDevice(keysFileName: String, password: String): Wallet.Device {
|
||||
val device = queryWalletDeviceJ(keysFileName, password)
|
||||
return Wallet.Device.values()[device + 1] // mapping is monero+1=android
|
||||
}
|
||||
|
||||
private external fun queryWalletDeviceJ(keysFileName: String, password: String): Int
|
||||
fun findWallets(path: File): List<WalletInfo> {
|
||||
val wallets: MutableList<WalletInfo> = ArrayList()
|
||||
Timber.d("Scanning: %s", path.absolutePath)
|
||||
val found =
|
||||
path.listFiles { _, filename -> filename.endsWith(".keys") } ?: return emptyList()
|
||||
for (i in found.indices) {
|
||||
val filename = found[i].name
|
||||
val f = File(
|
||||
found[i].parent,
|
||||
filename.substring(0, filename.length - 5)
|
||||
) // 5 is length of ".keys"+1
|
||||
wallets.add(WalletInfo(f))
|
||||
}
|
||||
return wallets
|
||||
}
|
||||
|
||||
// this should not be called on the main thread as it connects to the node (and takes a long time)
|
||||
fun setDaemon(node: Node?) {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package net.mynero.wallet.service
|
||||
|
||||
import android.util.Log
|
||||
import net.mynero.wallet.model.PendingTransaction
|
||||
import net.mynero.wallet.model.TransactionOutput
|
||||
import net.mynero.wallet.model.Wallet
|
||||
|
@ -25,7 +26,6 @@ import net.mynero.wallet.model.Wallet.ConnectionStatus
|
|||
import net.mynero.wallet.model.WalletListener
|
||||
import net.mynero.wallet.model.WalletManager
|
||||
import net.mynero.wallet.util.Constants
|
||||
import timber.log.Timber
|
||||
import java.security.SecureRandom
|
||||
|
||||
/**
|
||||
|
@ -93,7 +93,7 @@ class MoneroHandlerThread(name: String, val listener: Listener?, wallet: Wallet)
|
|||
if (heightDiff >= 2) {
|
||||
tryRestartConnection()
|
||||
} else {
|
||||
Timber.d("refreshed() Synchronized")
|
||||
Log.d("MoneroHandlerThread.kt", "refreshed() Synchronized")
|
||||
wallet.setSynchronized()
|
||||
wallet.store()
|
||||
refresh(true)
|
||||
|
@ -103,7 +103,7 @@ class MoneroHandlerThread(name: String, val listener: Listener?, wallet: Wallet)
|
|||
}
|
||||
|
||||
private fun tryRestartConnection() {
|
||||
Timber.d("refreshed() Starting connection retry")
|
||||
Log.d("MoneroHandlerThread.kt", "refreshed() Starting connection retry")
|
||||
listener?.onConnectionFail()
|
||||
wallet.init(0)
|
||||
wallet.startRefresh()
|
||||
|
|
|
@ -29,16 +29,14 @@ import android.graphics.Canvas
|
|||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.graphics.drawable.VectorDrawable
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import android.view.WindowManager
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.core.content.ContextCompat
|
||||
import net.mynero.wallet.R
|
||||
import net.mynero.wallet.model.WalletManager
|
||||
import timber.log.Timber
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.InputStreamReader
|
||||
|
@ -69,12 +67,12 @@ object Helper {
|
|||
fun getStorage(context: Context, folderName: String?): File {
|
||||
val dir = File(context.filesDir, folderName)
|
||||
if (!dir.exists()) {
|
||||
Timber.i("Creating %s", dir.absolutePath)
|
||||
Log.i("Helper.kt", "Creating ${dir.absolutePath}")
|
||||
dir.mkdirs() // try to make it
|
||||
}
|
||||
if (!dir.isDirectory) {
|
||||
val msg = "Directory " + dir.absolutePath + " does not exist."
|
||||
Timber.e(msg)
|
||||
Log.e("Helper.kt",msg)
|
||||
throw IllegalStateException(msg)
|
||||
}
|
||||
return dir
|
||||
|
@ -85,7 +83,7 @@ object Helper {
|
|||
if (context.checkSelfPermission(Manifest.permission.CAMERA)
|
||||
== PackageManager.PERMISSION_DENIED
|
||||
) {
|
||||
Timber.w("Permission denied for CAMERA - requesting it")
|
||||
Log.w("Helper.kt", "Permission denied for CAMERA - requesting it")
|
||||
val permissions = arrayOf(Manifest.permission.CAMERA)
|
||||
context.requestPermissions(
|
||||
permissions,
|
||||
|
@ -105,7 +103,7 @@ object Helper {
|
|||
if (context.checkSelfPermission(Manifest.permission.CAMERA)
|
||||
== PackageManager.PERMISSION_DENIED
|
||||
) {
|
||||
Timber.w("Permission denied for CAMERA - requesting it")
|
||||
Log.w("Helper.kt", "Permission denied for CAMERA - requesting it")
|
||||
launcher.launch(Manifest.permission.CAMERA)
|
||||
false
|
||||
} else {
|
||||
|
@ -119,7 +117,7 @@ object Helper {
|
|||
fun getWalletFile(context: Context, aWalletName: String?): File {
|
||||
val walletDir = getWalletRoot(context)
|
||||
val f = File(walletDir, aWalletName)
|
||||
Timber.d("wallet=%s size= %d", f.absolutePath, f.length())
|
||||
Log.d("Helper.kt", "wallet=${f.absolutePath} size= ${f.length()}")
|
||||
return f
|
||||
}
|
||||
|
||||
|
@ -230,11 +228,11 @@ object Helper {
|
|||
}
|
||||
return sb.toString()
|
||||
} catch (ex: SocketTimeoutException) {
|
||||
Timber.w("C %s", ex.localizedMessage)
|
||||
Log.w("Helper.kt", "C ${ex.localizedMessage}")
|
||||
} catch (ex: MalformedURLException) {
|
||||
Timber.e("A %s", ex.localizedMessage)
|
||||
Log.e("Helper.kt","A ${ex.localizedMessage}")
|
||||
} catch (ex: IOException) {
|
||||
Timber.e("B %s", ex.localizedMessage)
|
||||
Log.e("Helper.kt","B ${ex.localizedMessage}")
|
||||
} finally {
|
||||
urlConnection?.disconnect()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue