Skip to content

Commit

Permalink
Update yat lib
Browse files Browse the repository at this point in the history
FFi update
Deeplink fixes
Erica issues
Adrian issues
Black theme fixes
  • Loading branch information
alexandrVakhtinTari committed Nov 13, 2023
1 parent 0c5bc1a commit 850255c
Show file tree
Hide file tree
Showing 66 changed files with 480 additions and 628 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ CMakeCache.txt

jniLibs/
libwallet/wallet.h
libwallet/arm64-v8a/libtari_wallet_ffi.a
libwallet/x86_64/libtari_wallet_ffi.a
libwallet/arm64-v8a/libminotari_wallet_ffi.a
libwallet/x86_64/libminotari_wallet_ffi.a
!app/src/main/jniLibs/
52 changes: 26 additions & 26 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
// coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.fragment:fragment-ktx:1.6.1"
implementation "androidx.fragment:fragment-ktx:1.6.2"
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"

// kotlin extensions
Expand All @@ -224,30 +224,30 @@ dependencies {
// android jetpack
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
// recycler view
implementation "androidx.recyclerview:recyclerview:1.3.1"
implementation "androidx.recyclerview:recyclerview:1.3.2"
// the new view pager
implementation "androidx.viewpager2:viewpager2:1.0.0"
// for tab layout
implementation "com.google.android.material:material:1.9.0"
implementation "com.google.android.material:material:1.10.0"
// lottie
implementation 'com.airbnb.android:lottie:6.0.0'
implementation 'com.airbnb.android:lottie:6.1.0'
// Glide - image processing & caching library
implementation 'com.github.bumptech.glide:glide:4.15.1'
kapt 'com.github.bumptech.glide:compiler:4.15.1'
implementation 'com.github.bumptech.glide:glide:4.16.0'
kapt 'com.github.bumptech.glide:compiler:4.16.0'

// biometric
implementation "androidx.biometric:biometric:1.1.0"

// joda
implementation 'net.danlew:android.joda:2.12.1'
implementation 'net.danlew:android.joda:2.12.5'

// parceler
implementation "org.parceler:parceler-api:1.1.13"
kapt "org.parceler:parceler:1.1.13"

// dagger - DI
implementation 'com.google.dagger:dagger:2.45'
kapt 'com.google.dagger:dagger-compiler:2.45'
implementation 'com.google.dagger:dagger:2.48.1'
kapt 'com.google.dagger:dagger-compiler:2.48.1'

// rx
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
Expand All @@ -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.8"
implementation "info.guardianproject:tor-android:0.4.7.14"
implementation "info.guardianproject:jtorctl:0.4.5.7"

// used to read log files
Expand All @@ -277,27 +277,27 @@ dependencies {
// Retrofit2 - Popular (2020) REST API wrapper with Java interface
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.10"
implementation "com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.11"

// Google services & Google drive
implementation platform('com.google.firebase:firebase-bom:31.2.3')
implementation 'com.google.firebase:firebase-crashlytics'

implementation 'com.google.android.gms:play-services-auth:20.4.1'
implementation 'com.google.http-client:google-http-client-gson:1.43.1'
implementation 'com.google.android.gms:play-services-auth:20.7.0'
implementation 'com.google.http-client:google-http-client-gson:1.43.3'
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') {
exclude group: "org.apache.httpcomponents"
}
// sentry - crash analytics
implementation 'io.sentry:sentry-android:6.16.0'
implementation 'io.sentry:sentry-android:6.33.1'

implementation "com.dropbox.core:dropbox-core-sdk:5.4.4"

implementation "com.github.yat-labs:yat-lib-android:0.1.42"
implementation "com.dropbox.core:dropbox-core-sdk:5.4.6"

// implementation "com.github.yat-labs:yat-lib-android:0.1.42"
implementation project(":yatlib")

// custom libraries region
// flex layout
Expand All @@ -306,31 +306,31 @@ dependencies {
implementation "io.github.everythingme:overscroll-decor-android:1.1.1"

// giphy, don"t update to 2.2.0 because of not compatible yet
implementation 'com.giphy.sdk:ui:2.3.1'
implementation 'com.giphy.sdk:ui:2.3.13'
// spring animation
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
implementation "com.github.MasayukiSuda:EasingInterpolator:v1.3.2"

// seismic - device shake detector
implementation "com.squareup:seismic:1.0.3"

implementation "net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.2.0"
implementation "net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.3.0"

implementation 'com.itextpdf:itext7-core:7.2.5'
implementation 'com.itextpdf:itext7-core:8.0.2'

implementation("org.apache.maven:maven-artifact:3.0.3")
implementation("org.apache.maven:maven-artifact:3.9.5")

// debugImplementation because LeakCanary should only run in debug builds.
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.12'

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

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

// test
testImplementation "junit:junit:4.13.2"
testImplementation 'io.mockk:mockk:1.13.4'
androidTestImplementation 'io.mockk:mockk-android:1.13.4'
testImplementation 'io.mockk:mockk:1.13.8'
androidTestImplementation 'io.mockk:mockk-android:1.13.8'
androidTestImplementation "androidx.test:core:1.5.0"
androidTestImplementation "androidx.test.ext:junit:1.1.5"
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
Expand Down
Binary file modified app/regular/release/app-regular-release.aab
Binary file not shown.
18 changes: 16 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> <!-- remove billing support in case it gets included by a 3rd party lib -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<uses-permission
android:name="com.android.vending.BILLING"
tools:node="remove" />

<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
Expand All @@ -55,7 +58,8 @@
android:name=".service.service.WalletService"
android:description="@string/wallet_service_desc"
android:enabled="true"
android:exported="false">
android:exported="false"
android:foregroundServiceType="dataSync">
<intent-filter>
<action android:name="com.tari.android.wallet.service.TariWalletService" />
</intent-filter>
Expand All @@ -81,6 +85,7 @@
android:name=".ui.fragment.splash.SplashActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Splash"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
Expand All @@ -93,18 +98,21 @@
<activity
android:name=".ui.fragment.onboarding.activity.OnboardingFlowActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
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: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:screenOrientation="portrait"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
<intent-filter>
Expand Down Expand Up @@ -146,6 +154,7 @@
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<action android:name="android.nfc.action.TAG_DISCOVERED" />

<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
Expand All @@ -160,13 +169,15 @@
android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity"
android:excludeFromRecents="true"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/GoogleSignInActivity"
tools:replace="android:theme" />
<activity
android:name="com.dropbox.core.android.AuthActivity"
android:configChanges="orientation|keyboard"
android:exported="true"
android:launchMode="singleTask">
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>

<data android:scheme="db-${dropboxApiKey}" />
Expand All @@ -186,6 +197,7 @@
android:name=".ui.fragment.send.finalize.YatFinalizeSendTxActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/YatLibTheme.TransparentCompat"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
Expand All @@ -194,6 +206,7 @@
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ui.fragment.home.HomeActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity
Expand All @@ -202,6 +215,7 @@
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ui.fragment.onboarding.activity.OnboardingFlowActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="adjustResize" />

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ add_library(
set_target_properties(
wallet
PROPERTIES
IMPORTED_LOCATION ${libs_DIR}/${ANDROID_ABI}/libtari_wallet_ffi.a
IMPORTED_LOCATION ${libs_DIR}/${ANDROID_ABI}/libminotari_wallet_ffi.a
IMPORTED_LINK_INTERFACE_LIBRARIES "ssl;sqlite3"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import javax.inject.Singleton
@Singleton
class MigrationManager @Inject constructor(private val manager: WalletManager) {

private val minValidVersion = DefaultArtifactVersion("0.50.0-hotfix.1")
private val minValidVersion = DefaultArtifactVersion("v0.52.0")
private val simpleViewModel = SimpleViewModel()

fun validateVersion(onValid: () -> Unit, onError: () -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class BaseNodes(
}.addTo(compositeDisposable)
}

val onionRegex = "(.+::[A-Za-z0-9 ]{64}::/onion3/[A-Za-z0-9]+:[\\d]+)"
val ipV4Regex = "(.+::[A-Za-z0-9 ]{64}::/ip4/[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}/tcp/[0-9]{2,6})"

/**
* Returns the list of base nodes in the resource file base_nodes.txt as pairs of
* ({name}, {public_key_hex}, {public_address}).
Expand All @@ -55,8 +58,20 @@ class BaseNodes(
"UTF-8"
)
Logger.t(this::class.simpleName).e("baseNodeList: $fileContent")
Regex("(.+::[A-Za-z0-9 ]{64}::/onion3/[A-Za-z0-9]+:[\\d]+)").findAll(fileContent).map { matchResult ->
val list = mutableListOf<BaseNodeDto>()
val onionBaseNodes = findAndAddBaseNode(fileContent, onionRegex).toList()
val ipV4BaseNodes = findAndAddBaseNode(fileContent, ipV4Regex).toList()
list.addAll(onionBaseNodes)
list.addAll(ipV4BaseNodes)
list.sortedBy { it.name }
}

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]}")
BaseNodeDto(tripleString[0], tripleString[1], tripleString[2])
}
Expand Down Expand Up @@ -102,7 +117,6 @@ class BaseNodes(
startSync()
}
}

@Suppress("UNUSED_EXPRESSION")
private fun getBaseNodeResource(network: Network): Int = when (network) {
else -> R.raw.stagenet_base_nodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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

/**
Expand All @@ -50,16 +51,15 @@ sealed class DeepLink {
// tari://esmeralda/contacts?list[0][alias]=Name&list[0][hex]=hex&list[1][alias]=Name&list[1][hex]=hex
class Contacts(val contacts: List<DeeplinkContact>) : DeepLink() {

constructor(params: Map<String, String>) : this(
params.filterKeys { it.startsWith("list[") }
constructor(params: Map<String, String>) : this(params.filterKeys { it.startsWith("list[") }
.map { FormatExtractor(it.key, it.value) }
.groupBy { it.index }
.map {
val alias = it.value.firstOrNull { it.name == aliasKey }?.value.orEmpty()
val hex = it.value.firstOrNull { it.name == hexKey }?.value.orEmpty()
DeeplinkContact(alias, hex)
}
)
.filter { TariWalletAddress.validate(it.hex) })

override fun getParams(): Map<String, String> = hashMapOf<String, String>().apply {
contacts.forEachIndexed { index, contact ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.tari.android.wallet.application.deeplinks
import android.net.Uri
import com.tari.android.wallet.data.sharedPrefs.network.NetworkRepository
import com.tari.android.wallet.data.sharedPrefs.tor.TorBridgeConfiguration
import com.tari.android.wallet.model.TariWalletAddress
import java.net.URLDecoder
import javax.inject.Inject
import javax.inject.Singleton
Expand Down Expand Up @@ -30,7 +31,13 @@ class DeeplinkFormatter @Inject constructor(private val networkRepository: Netwo
}.toMap()
paramentrs = values.toMutableMap()
}
return DeepLink.getByCommand(command, paramentrs)

val parsedDeeplink = DeepLink.getByCommand(command, paramentrs)

if (parsedDeeplink is DeepLink.Send && !TariWalletAddress.validate(parsedDeeplink.walletAddressHex)) return null
if (parsedDeeplink is DeepLink.UserProfile && !TariWalletAddress.validate(parsedDeeplink.tariAddressHex)) return null

return parsedDeeplink
}

fun toDeeplink(deepLink: DeepLink): String {
Expand Down
Loading

0 comments on commit 850255c

Please sign in to comment.