Skip to content

Commit

Permalink
Merge pull request #1006 from tari-project/release/0.24.1
Browse files Browse the repository at this point in the history
feat: release 0.24.1
  • Loading branch information
igordanilcenko authored Dec 18, 2023
2 parents 9cc8d12 + 74765bf commit 698bc04
Show file tree
Hide file tree
Showing 45 changed files with 231 additions and 181 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ Aurora Android native libraries only support `armeabi-v7a`, `arm64-v8a` and `x86
Tari native wallet library version to be used by Aurora is specified by the `ext.libwalletVersion` in the `build.gradle` file in the project root directory. Aurora build script automatically fetches the native libraries of this version into the `libwallet` folder in the root directory during the build process. Any library files you place in this folder will be deleted and replaced by this automatic download process.

If you want to disable the automatic download and use the native libraries of your choice, please comment out the line `preBuild.dependsOn("downloadLibwallet")` in the file `app/build.gradle`.

### For updating openssl
https://github.com/217heidai/openssl_for_android/releases
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ dependencies {
implementation "com.github.adorsys:secure-storage-android:0.0.2"

// Tor control
implementation "info.guardianproject:tor-android:0.4.7.14"
implementation "info.guardianproject:tor-android:0.4.8.7"
implementation "info.guardianproject:jtorctl:0.4.5.7"

// used to read log files
Expand All @@ -288,7 +288,7 @@ dependencies {
implementation('com.google.api-client:google-api-client-android:2.2.0') {
exclude group: "org.apache.httpcomponents"
}
implementation('com.google.apis:google-api-services-drive:v3-rev20221023-2.0.0') {
implementation('com.google.apis:google-api-services-drive:v3-rev20230822-2.0.0') {
exclude group: "org.apache.httpcomponents"
}
// sentry - crash analytics
Expand Down Expand Up @@ -323,9 +323,9 @@ dependencies {
// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.12'

implementation 'com.github.vestrel00:contacts-android:0.2.4'
implementation 'com.github.vestrel00:contacts-android:0.3.1'

implementation "com.github.weliem:blessed-android:2.4.2"
implementation "com.github.weliem:blessed-android:2.5.0"

// test
testImplementation "junit:junit:4.13.2"
Expand Down
14 changes: 10 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:taskAffinity=""
android:theme="@style/AppTheme.Light"
tools:replace="android:supportsRtl,android:allowBackup">
<!-- Tari foreground service -->
Expand Down Expand Up @@ -85,6 +86,7 @@
android:name=".ui.fragment.splash.SplashActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Splash"
android:windowSoftInputMode="stateAlwaysHidden">
Expand All @@ -98,20 +100,22 @@
<activity
android:name=".ui.fragment.onboarding.activity.OnboardingFlowActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="stateAlwaysHidden" /> <!-- local authentication -->
<activity
android:name=".ui.fragment.auth.AuthActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="stateAlwaysHidden" /> <!-- home (transaction list) -->
<activity
android:name=".ui.fragment.home.HomeActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:launchMode="singleTask"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
Expand Down Expand Up @@ -176,7 +180,7 @@
android:name="com.dropbox.core.android.AuthActivity"
android:configChanges="orientation|keyboard"
android:exported="true"
android:launchMode="singleTask"
android:launchMode="singleInstance"
android:screenOrientation="portrait">
<intent-filter>

Expand All @@ -191,20 +195,22 @@
android:name="com.tari.android.wallet.ui.fragment.qr.QRScannerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="false"
android:launchMode="singleInstance"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="stateAlwaysHidden" /> <!-- send tari -->
<activity
android:name=".ui.fragment.send.finalize.YatFinalizeSendTxActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/YatLibTheme.TransparentCompat"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.tari.android.wallet.ui.fragment.settings.logs.activity.DebugActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="false"
android:launchMode="singleTask"
android:launchMode="singleInstance"
android:parentActivityName=".ui.fragment.home.HomeActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Light"
Expand All @@ -213,7 +219,7 @@
android:name="com.tari.android.wallet.ui.fragment.restore.activity.WalletRestoreActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="false"
android:launchMode="singleTask"
android:launchMode="singleInstance"
android:parentActivityName=".ui.fragment.onboarding.activity.OnboardingFlowActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Light"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ class BaseNodes(
private fun findAndAddBaseNode(fileContent: String, regex: String): Sequence<BaseNodeDto> {
return Regex(regex).findAll(fileContent).map { matchResult ->
val tripleString = matchResult.value.split("::")
if (tripleString.size ==2) {
1
}
Logger.t(this::class.simpleName).e("baseNodeList0: $tripleString, baseNodeList1: ${tripleString[1]}, baseNodeList2: ${tripleString[2]}")
Logger.t(this::class.simpleName).i("baseNodeList0: $tripleString, baseNodeList1: ${tripleString[1]}, baseNodeList2: ${tripleString[2]}")
BaseNodeDto(tripleString[0], tripleString[1], tripleString[2])
}
}
Expand All @@ -98,21 +95,21 @@ class BaseNodes(

fun startSync() {
try {
Logger.t(this::class.simpleName).e("startSync")
Logger.t(this::class.simpleName).i("startSync")
//essential for wallet creation flow
val baseNode = baseNodeSharedRepository.currentBaseNode ?: return
serviceConnection.currentState.service ?: return
if (EventBus.walletState.publishSubject.value != WalletState.Running) return

Logger.t(this::class.simpleName).e("startSync:publicKeyHex: ${baseNode.publicKeyHex}")
Logger.t(this::class.simpleName).e("startSync:address: ${baseNode.address}")
Logger.t(this::class.simpleName).e("startSync:address: ${Gson().toJson(baseNodeSharedRepository.userBaseNodes)}")
Logger.t(this::class.simpleName).i("startSync:publicKeyHex: ${baseNode.publicKeyHex}")
Logger.t(this::class.simpleName).i("startSync:address: ${baseNode.address}")
Logger.t(this::class.simpleName).i("startSync:address: ${Gson().toJson(baseNodeSharedRepository.userBaseNodes)}")
val baseNodeKeyFFI = FFIPublicKey(HexString(baseNode.publicKeyHex))
FFIWallet.instance?.addBaseNodePeer(baseNodeKeyFFI, baseNode.address)
baseNodeKeyFFI.destroy()
walletService.getWithError { error, wallet -> wallet.startBaseNodeSync(error) }
} catch (e: Throwable) {
Logger.t(this::class.simpleName).e("startSync")
Logger.t(this::class.simpleName).i("startSync")
setNextBaseNode()
startSync()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ package com.tari.android.wallet.application.deeplinks
import com.tari.android.wallet.data.sharedPrefs.tor.TorBridgeConfiguration
import com.tari.android.wallet.model.MicroTari
import com.tari.android.wallet.model.TariWalletAddress
import java.math.BigInteger
import com.tari.android.wallet.util.parseToBigInteger

/**
* Parses a deep link and contains the structured deep link details.
Expand Down Expand Up @@ -98,7 +98,7 @@ sealed class DeepLink {

constructor(params: Map<String, String>) : this(
params[tariAddressKey].orEmpty(),
params[amountKey]?.let { if (it.isEmpty()) null else MicroTari(BigInteger(it)) },
params[amountKey]?.let { if (it.isEmpty()) null else MicroTari(it.parseToBigInteger()) },
params[noteKey].orEmpty()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DeeplinkFormatter @Inject constructor(private val networkRepository: Netwo
return DeepLink.TorBridges(torBridges)
}

val uri = Uri.parse(URLDecoder.decode(deepLink, "UTF-8"))
val uri = runCatching { Uri.parse(URLDecoder.decode(deepLink, "UTF-8")) }.getOrNull() ?: return null

if (!uri.authority.equals(networkRepository.currentNetwork!!.network.uriComponent)) {
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SharedPrefGsonDelegate<T>(
try {
gson.fromJson(savedValue, type) as T
} catch (e: Throwable) {
logger.e(e.toString())
logger.i(e.toString())
defValue
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class FFICommsConfig() : FFIBase() {
} else {
messageBuilder.append("Permission problem.")
}
logger.e(Throwable(), messageBuilder.toString())
logger.i(messageBuilder.toString())
throw FFIException(message = messageBuilder.toString())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class BackupFileProcessor @Inject constructor(
try {
File(walletConfig.getWalletTempDirPath()).listFiles()?.forEach { it.delete() }
} catch (e: Exception) {
Logger.e(e, "Ignorable backup error while clearing temporary and old files.")
Logger.i(e.toString() + "Ignorable backup error while clearing temporary and old files.")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class LocalBackupStorage @Inject constructor(
}
}
} catch (e: Exception) {
logger.e(e, "Ignorable backup error while clearing temporary and old files.")
logger.i(e.toString() + "Ignorable backup error while clearing temporary and old files.")
}
return@withContext backupDate
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ class SingleSuccessOrErrorAdapterDecorator(private val decorated: BiometricPromp

override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
if (!isResumed.get()) {
decorated.onAuthenticationSucceeded(result)
isResumed.set(true)
if (result.cryptoObject?.cipher == null) {
decorated.onAuthenticationSucceeded(result)
isResumed.set(true)
} else {
decorated.onAuthenticationError(BiometricPrompt.ERROR_CANCELED, "Crypto object is not null")
isResumed.set(true)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ package com.tari.android.wallet.service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
import com.orhanobut.logger.Logger
import com.tari.android.wallet.data.WalletConfig
import com.tari.android.wallet.data.sharedPrefs.network.NetworkRepositoryImpl
import com.tari.android.wallet.data.sharedPrefs.tariSettings.TariSettingsSharedRepository
import com.tari.android.wallet.di.ApplicationModule
import com.tari.android.wallet.service.service.WalletServiceLauncher
import com.tari.android.wallet.ui.common.domain.ResourceManager

/**
* This receiver is responsible for starting the service after boot finish.
Expand All @@ -55,6 +55,9 @@ class BootDeviceReceiver : BroadcastReceiver() {

override fun onReceive(context: Context?, intent: Intent?) {
if (context == null || intent == null) return
// not allowed action starts from android 12 dio to new restriction
// https://developer.android.com/guide/components/foreground-services#background-start-restriction-exemptions
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) return
logger.i("Boot device broadcast received")
if (Intent.ACTION_BOOT_COMPLETED == intent.action) {
val sharedPreferences = context.getSharedPreferences(ApplicationModule.sharedPrefsFileName, Context.MODE_PRIVATE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class FFIWalletListenerImpl(
baseNodeValidationStatusMap[type] = Pair(currentStatus.first, isSuccess)
checkBaseNodeSyncCompletion()
} catch (e: Throwable) {
logger.e(e.toString())
logger.i(e.toString())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ServiceLifecycleCallbacks(private val wallet: FFIWallet): DefaultLifecycle
try {
wallet.setPowerModeNormal()
} catch (e: FFIException) {
logger.e(e, "Switching to normal power mode failed")
logger.i(e.toString() + "Switching to normal power mode failed")
}
}

Expand All @@ -53,7 +53,7 @@ class ServiceLifecycleCallbacks(private val wallet: FFIWallet): DefaultLifecycle
try {
wallet.setPowerModeLow()
} catch (e: FFIException) {
logger.e(e, "Switching to low power mode failed")
logger.i(e.toString() + "Switching to low power mode failed")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class TariWalletServiceStubImpl(
} ?: false

override fun startBaseNodeSync(error: WalletError): Boolean = runMapping(error, {
logger.e(it, "Base node sync failed")
logger.i(it.toString() + "Base node sync failed")
baseNodeSharedPrefsRepository.baseNodeLastSyncResult = false
walletServiceListener.baseNodeValidationStatusMap.clear()
EventBus.baseNodeSyncState.post(BaseNodeSyncState.Failed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,14 @@ class WalletService : Service() {
.repeat()
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.doOnError { logger.i("error during sheduled expiration check $it") }
.doOnError { logger.i("error during scheduled expiration check $it") }
.subscribe {
try {
logger.i("scheduled expiration check")
cancelExpiredPendingInboundTxs()
cancelExpiredPendingOutboundTxs()
} catch (e: Exception) {
logger.e("error during sheduled expiration check $e")
logger.i("error during scheduled expiration check $e")
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/tari/android/wallet/tor/NativeLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ object NativeLoader {

return true
} catch (e: Exception) {
logger.e(e, "Load from zip")
logger.i(e.toString() + "Load from zip")
} finally {
if (stream != null) {
try {
stream.close()
} catch (e: Exception) {
logger.e(e, "Closing stream")
logger.i(e.toString() + "Closing stream")
}
}

if (zipFile != null) {
try {
zipFile.close()
} catch (e: Exception) {
logger.e(e, "closing zip file")
logger.i(e.toString() + "closing zip file")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ abstract class CommonActivity<Binding : ViewBinding, VM : CommonViewModel> : App
}

fun popUpTo(tag: String) {
viewModel.logger.e("popUpTo $tag")
viewModel.logger.e("popUpTo:last ${supportFragmentManager.fragments.last().tag}")
viewModel.logger.e("popUpTo:all ${supportFragmentManager.fragments.map { it.tag }.joinToString(", ")}")
viewModel.logger.e("popUpTo:all ${supportFragmentManager.fragments.map { it::class.java }.joinToString(", ")}")
viewModel.logger.i("popUpTo $tag")
viewModel.logger.i("popUpTo:last ${supportFragmentManager.fragments.last().tag}")
viewModel.logger.i("popUpTo:all ${supportFragmentManager.fragments.map { it.tag }.joinToString(", ")}")
viewModel.logger.i("popUpTo:all ${supportFragmentManager.fragments.map { it::class.java }.joinToString(", ")}")
while (supportFragmentManager.fragments.last()::class.java.simpleName != tag && supportFragmentManager.backStackEntryCount > 0) {
supportFragmentManager.popBackStackImmediate()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ open class CommonViewModel : ViewModel() {

fun doOnConnected(action: (walletService: TariWalletService) -> Unit) {
serviceConnection.connection.filter { it.status == ServiceConnectionStatus.CONNECTED }.take(1)
.doOnError { logger.e(it, it.toString()) }
.doOnError { logger.i(it.toString()) }
.subscribe { action(it.service!!) }
.addTo(compositeDisposable)
}

fun doOnConnectedToWallet(action: (walletService: FFIWallet) -> Unit) {
EventBus.walletState.publishSubject.filter { it == WalletState.Running }.take(1).doOnError { Logger.e(it.toString()) }
EventBus.walletState.publishSubject.filter { it == WalletState.Running }.take(1).doOnError { Logger.i(it.toString()) }
.subscribe { action(FFIWallet.instance!!) }
.addTo(compositeDisposable)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GiphyRESTRetrofitRepository(private val gateway: GiphyRESTGateway) : GIFRe
body.data.map { GIFItem(it.id, Uri.parse(it.embedUrl), Uri.parse(it.images.fixedWidth.url)) }
else {
val exception = GIFSearchException(body?.meta?.message ?: response.message() ?: response.errorBody()?.string())
logger.e(exception, "Get all was failed")
logger.i(exception.toString() + "Get all was failed")
throw exception
}
}
Expand All @@ -33,9 +33,9 @@ class GiphyRESTRetrofitRepository(private val gateway: GiphyRESTGateway) : GIFRe
body.data.let { GIFItem(it.id, Uri.parse(it.embedUrl), Uri.parse(it.images.fixedWidth.url)) }
else {
val exception = GIFSearchException(body?.meta?.message ?: response.message() ?: response.errorBody()?.string())
logger.e(exception.message.orEmpty())
logger.e(exception.stackTraceToString())
logger.e(exception, "Get by id was failed")
logger.i(exception.message.orEmpty())
logger.i(exception.stackTraceToString())
logger.i(exception. toString() + "Get by id was failed")
throw exception
}
}
Expand Down
Loading

0 comments on commit 698bc04

Please sign in to comment.