Skip to content

Commit

Permalink
Merge pull request #813 from tari-project/release/0.18.0
Browse files Browse the repository at this point in the history
feat: release/0.18.0
  • Loading branch information
alexandrVakhtinTari authored Jan 9, 2023
2 parents 177e8ef + 23dcb80 commit 7b1148f
Show file tree
Hide file tree
Showing 588 changed files with 8,793 additions and 7,047 deletions.
41 changes: 0 additions & 41 deletions app/src/androidTest/java/com/tari/android/wallet/FFIWalletTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -244,47 +244,6 @@ class FFIWalletTests {
wallet.getKeyValue(key)
}

// test for finding broken symbols for encryption password
// @Test
fun testEncryptionEnablingWithBrokenBytes() {
// for finding broken chars
// for (char in Char(65000)..Char.MAX_VALUE) {
// Log.i("code", char.code.toString())
// Log.i("char", char.toString())
// val str = char.toString()
// Log.i("whole str", str)
// if (skippingBytes.contains(char)) continue
//
// sharedPrefsRepository.databasePassphrase = null
// wallet.removeEncryption()
// wallet.enableEncryption(str)
// }

// for speed up the process
for (char in Char.MIN_VALUE..Char.MAX_VALUE step 50) {
val strBuilder = StringBuilder()
for (i in char..(char + 51)) {
if (SharedPrefsRepository.isBrokenCharForPassphrase(i)) continue
strBuilder.append(i)
}
val str = strBuilder.toString()

sharedPrefsRepository.databasePassphrase = null
wallet.removeEncryption()
wallet.enableEncryption(str)
}
}

@Test
fun testGeneratingPasswordForEncryptionEnabling() {
for (i in 0 until 100) {
sharedPrefsRepository.databasePassphrase = null
wallet.removeEncryption()
val password = sharedPrefsRepository.generateDatabasePassphrase()
wallet.enableEncryption(password)
}
}

private class TestAddRecipientAddNodeListener : FFIWalletListener {

val receivedTxs = mutableListOf<PendingInboundTx>()
Expand Down
36 changes: 6 additions & 30 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme.Light"
tools:replace="android:supportsRtl,android:allowBackup">
<!-- Tari foreground service -->
<service
Expand Down Expand Up @@ -68,7 +68,7 @@
<activity
android:name=".ui.fragment.onboarding.activity.OnboardingFlowActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="stateAlwaysHidden" /> <!-- local authentication -->
<activity
android:name=".ui.fragment.auth.AuthActivity"
Expand All @@ -80,7 +80,7 @@
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -126,14 +126,8 @@
<activity
android:name="com.tari.android.wallet.ui.fragment.qr.QRScannerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="stateAlwaysHidden" /> <!-- send tari -->
<activity
android:name=".ui.fragment.send.activity.SendTariActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:parentActivityName=".ui.fragment.home.HomeActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" /> <!-- wallet info -->
<activity
android:name=".ui.fragment.send.finalize.YatFinalizeSendTxActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
Expand All @@ -145,32 +139,14 @@
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:parentActivityName=".ui.fragment.home.HomeActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity
android:name="com.tari.android.wallet.ui.fragment.settings.backup.activity.BackupSettingsActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:parentActivityName=".ui.fragment.home.HomeActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity
android:name="com.tari.android.wallet.ui.fragment.settings.deleteWallet.DeleteWalletActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:parentActivityName="com.tari.android.wallet.ui.fragment.settings.deleteWallet.DeleteWalletActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity
android:name=".ui.fragment.settings.backgroundService.BackgroundServiceSettingsActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:parentActivityName=".ui.fragment.settings.backgroundService.BackgroundServiceSettingsActivity"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity
android:name="com.tari.android.wallet.ui.fragment.restore.activity.WalletRestoreActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:parentActivityName=".ui.fragment.onboarding.activity.OnboardingFlowActivity"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme.Light"
android:windowSoftInputMode="adjustResize" />
<receiver
android:name=".service.BootDeviceReceiver"
Expand Down
26 changes: 0 additions & 26 deletions app/src/main/cpp/jniWallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,32 +1135,6 @@ Java_com_tari_android_wallet_ffi_FFIWallet_jniSendTx(
});
}

extern "C"
JNIEXPORT void JNICALL
Java_com_tari_android_wallet_ffi_FFIWallet_jniApplyEncryption(
JNIEnv *jEnv,
jobject jThis,
jstring jPassphrase,
jobject error) {
ExecuteWithError(jEnv, error, [&](int *errorPointer) {
auto pWallet = GetPointerField<TariWallet *>(jEnv, jThis);
const char *pKey = jEnv->GetStringUTFChars(jPassphrase, JNI_FALSE);
wallet_apply_encryption(pWallet, pKey, errorPointer);
});
}

extern "C"
JNIEXPORT void JNICALL
Java_com_tari_android_wallet_ffi_FFIWallet_jniRemoveEncryption(
JNIEnv *jEnv,
jobject jThis,
jobject error) {
ExecuteWithError(jEnv, error, [&](int *errorPointer) {
auto pWallet = GetPointerField<TariWallet *>(jEnv, jThis);
wallet_remove_encryption(pWallet, errorPointer);
});
}

extern "C"
JNIEXPORT jboolean JNICALL
Java_com_tari_android_wallet_ffi_FFIWallet_jniStartRecovery(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import com.tari.android.wallet.data.repository.CommonRepository
import com.tari.android.wallet.data.sharedPrefs.baseNode.BaseNodeSharedRepository
import com.tari.android.wallet.data.sharedPrefs.delegates.SharedPrefBooleanDelegate
import com.tari.android.wallet.data.sharedPrefs.delegates.SharedPrefStringDelegate
import com.tari.android.wallet.data.sharedPrefs.delegates.SharedPrefStringSecuredDelegate
import com.tari.android.wallet.data.sharedPrefs.network.NetworkRepository
import com.tari.android.wallet.data.sharedPrefs.network.formatKey
import com.tari.android.wallet.data.sharedPrefs.tariSettings.TariSettingsSharedRepository
Expand Down Expand Up @@ -100,8 +99,6 @@ class SharedPrefsRepository(

var onboardingDisplayedAtHome: Boolean by SharedPrefBooleanDelegate(sharedPrefs, formatKey(Key.onboardingDisplayedAtHome))

var databasePassphrase: String? by SharedPrefStringSecuredDelegate(context, sharedPrefs, formatKey(Key.walletDatabasePassphrase))

var isDataCleared: Boolean by SharedPrefBooleanDelegate(sharedPrefs, formatKey(Key.isDataCleared), true)

fun clear() {
Expand All @@ -118,7 +115,6 @@ class SharedPrefsRepository(
onboardingAuthSetupStarted = false
onboardingAuthSetupCompleted = false
onboardingDisplayedAtHome = false
databasePassphrase = null
}

fun generateDatabasePassphrase(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ package com.tari.android.wallet.data.sharedPrefs.tariSettings
import android.content.SharedPreferences
import com.tari.android.wallet.data.repository.CommonRepository
import com.tari.android.wallet.data.sharedPrefs.delegates.SharedPrefBooleanDelegate
import com.tari.android.wallet.data.sharedPrefs.delegates.SharedPrefGsonDelegate
import com.tari.android.wallet.data.sharedPrefs.network.NetworkRepository
import com.tari.android.wallet.data.sharedPrefs.network.formatKey
import com.tari.android.wallet.ui.fragment.settings.themeSelector.TariTheme

class TariSettingsSharedRepository(sharedPrefs: SharedPreferences, networkRepository: NetworkRepository) : CommonRepository(networkRepository) {

Expand All @@ -45,6 +47,7 @@ class TariSettingsSharedRepository(sharedPrefs: SharedPreferences, networkReposi
const val hasVerifiedSeedWords = "tari_has_verified_seed_words"
const val backgroundServiceTurnedOnKey = "tari_background_service_turned_on"
const val isOneSidePaymentEnabledKey = "is_one_side_payment_enabled"
const val themeKey = "tari_theme_key"
}

var isRestoredWallet: Boolean by SharedPrefBooleanDelegate(sharedPrefs, formatKey(Key.isRestoredWallet))
Expand All @@ -55,6 +58,8 @@ class TariSettingsSharedRepository(sharedPrefs: SharedPreferences, networkReposi

var isOneSidePaymentEnabled: Boolean by SharedPrefBooleanDelegate(sharedPrefs, formatKey(Key.isOneSidePaymentEnabledKey), false)

var currentTheme: TariTheme? by SharedPrefGsonDelegate(sharedPrefs, Key.themeKey, TariTheme::class.java, TariTheme.AppBased)

fun clear() {
isRestoredWallet = false
hasVerifiedSeedWords = false
Expand Down
108 changes: 43 additions & 65 deletions app/src/main/java/com/tari/android/wallet/di/ApplicationComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ package com.tari.android.wallet.di
import android.content.ClipboardManager
import com.tari.android.wallet.application.TariWalletApplication
import com.tari.android.wallet.application.deeplinks.DeeplinkViewModel
import com.tari.android.wallet.service.BootDeviceReceiver
import com.tari.android.wallet.service.service.WalletService
import com.tari.android.wallet.ui.common.CommonViewModel
import com.tari.android.wallet.ui.component.networkStateIndicator.ConnectionIndicatorViewModel
import com.tari.android.wallet.ui.fragment.auth.AuthActivity
import com.tari.android.wallet.ui.fragment.auth.AuthViewModel
import com.tari.android.wallet.ui.fragment.home.HomeActivity
import com.tari.android.wallet.ui.fragment.home.HomeViewModel
import com.tari.android.wallet.ui.fragment.onboarding.activity.OnboardingFlowActivity
import com.tari.android.wallet.ui.fragment.onboarding.createWallet.CreateWalletViewModel
import com.tari.android.wallet.ui.fragment.onboarding.inroduction.IntroductionViewModel
Expand All @@ -53,9 +53,9 @@ import com.tari.android.wallet.ui.fragment.restore.chooseRestoreOption.ChooseRes
import com.tari.android.wallet.ui.fragment.restore.enterRestorationPassword.EnterRestorationPasswordViewModel
import com.tari.android.wallet.ui.fragment.restore.inputSeedWords.InputSeedWordsViewModel
import com.tari.android.wallet.ui.fragment.restore.walletRestoringFromSeedWords.WalletRestoringFromSeedWordsViewModel
import com.tari.android.wallet.ui.fragment.send.activity.SendTariActivity
import com.tari.android.wallet.ui.fragment.send.addAmount.AddAmountViewModel
import com.tari.android.wallet.ui.fragment.send.addNote.AddNoteFragment
import com.tari.android.wallet.ui.fragment.send.addNote.AddNoteViewModel
import com.tari.android.wallet.ui.fragment.send.addNote.gif.ChooseGIFDialogFragment
import com.tari.android.wallet.ui.fragment.send.addNote.gif.ThumbnailGIFsViewModel
import com.tari.android.wallet.ui.fragment.send.addRecepient.AddRecipientFragment
Expand All @@ -65,24 +65,25 @@ import com.tari.android.wallet.ui.fragment.send.requestTari.RequestTariViewModel
import com.tari.android.wallet.ui.fragment.settings.allSettings.AllSettingsViewModel
import com.tari.android.wallet.ui.fragment.settings.allSettings.about.TariAboutViewModel
import com.tari.android.wallet.ui.fragment.settings.backgroundService.BackgroundServiceSettingsViewModel
import com.tari.android.wallet.ui.fragment.settings.backup.ChangeSecurePasswordFragment
import com.tari.android.wallet.ui.fragment.settings.backup.EnterCurrentPasswordFragment
import com.tari.android.wallet.ui.fragment.settings.backup.backupSettings.BackupSettingsViewModel
import com.tari.android.wallet.ui.fragment.settings.backup.backupSettings.option.BackupOptionViewModel
import com.tari.android.wallet.ui.fragment.settings.backup.changeSecurePassword.ChangeSecurePasswordViewModel
import com.tari.android.wallet.ui.fragment.settings.backup.enterCurrentPassword.EnterCurrentPasswordViewModel
import com.tari.android.wallet.ui.fragment.settings.backup.verifySeedPhrase.VerifySeedPhraseViewModel
import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.addBaseNode.AddCustomBaseNodeViewModel
import com.tari.android.wallet.ui.fragment.settings.baseNodeConfig.changeBaseNode.ChangeBaseNodeViewModel
import com.tari.android.wallet.ui.fragment.settings.bugReporting.BugsReportingViewModel
import com.tari.android.wallet.ui.fragment.settings.deleteWallet.DeleteWalletActivity
import com.tari.android.wallet.ui.fragment.settings.deleteWallet.DeleteWalletViewModel
import com.tari.android.wallet.ui.fragment.settings.logs.LogFilesManager
import com.tari.android.wallet.ui.fragment.settings.logs.logFiles.LogFilesViewModel
import com.tari.android.wallet.ui.fragment.settings.logs.logs.LogsViewModel
import com.tari.android.wallet.ui.fragment.settings.networkSelection.NetworkSelectionViewModel
import com.tari.android.wallet.ui.fragment.settings.themeSelector.ThemeSelectorViewModel
import com.tari.android.wallet.ui.fragment.settings.torBridges.TorBridgesSelectionViewModel
import com.tari.android.wallet.ui.fragment.settings.torBridges.customBridges.CustomTorBridgesViewModel
import com.tari.android.wallet.ui.fragment.settings.userAutorization.BiometricAuthenticationViewModel
import com.tari.android.wallet.ui.fragment.splash.SplashActivity
import com.tari.android.wallet.ui.fragment.tx.TxListViewModel
import com.tari.android.wallet.ui.fragment.tx.details.TxDetailsFragment
import com.tari.android.wallet.ui.fragment.tx.details.gif.GIFViewModel
import com.tari.android.wallet.ui.fragment.utxos.list.UtxosListViewModel
import dagger.Component
Expand All @@ -108,68 +109,47 @@ import javax.inject.Singleton

interface ApplicationComponent {

/**
* Application.
*/
fun inject(application: TariWalletApplication)

/**
* Activities.
*/
fun inject(service: WalletService)

fun inject(activity: SplashActivity)
fun inject(activity: OnboardingFlowActivity)
fun inject(activity: AuthActivity)
fun inject(activity: HomeActivity)
fun inject(activity: QRScannerActivity)
fun inject(activity: SendTariActivity)
fun inject(fragment: TxDetailsFragment)
fun inject(activity: DeleteWalletActivity)
fun inject(activity: WalletRestoreActivity)

/**
* Fragments.
*/
fun inject(fragment: AddRecipientFragment)
fun inject(fragment: AddNoteFragment)
fun inject(fragment: ChooseGIFDialogFragment)
/**
* Backup.
*/
fun inject(fragment: ChangeSecurePasswordFragment)
fun inject(fragment: EnterCurrentPasswordFragment)
/**
* Restore.
*/
fun inject(activity: WalletRestoreActivity)

/**
* ViewModels.
*/
fun inject(commonViewModel: CommonViewModel)
fun inject(thumbnailGIFsViewModel: ThumbnailGIFsViewModel)
fun inject(gifViewModel: GIFViewModel)
fun inject(backgroundServiceSettingsViewModel: BackgroundServiceSettingsViewModel)
fun inject(connectionIndicatorViewModel: ConnectionIndicatorViewModel)
fun inject(chooseRestoreOptionViewModel: ChooseRestoreOptionViewModel)
fun inject(enterRestorationPasswordViewModel: EnterRestorationPasswordViewModel)
fun inject(walletRestoringFromSeedWordsViewModel: WalletRestoringFromSeedWordsViewModel)
fun inject(inputSeedWordsViewModel: InputSeedWordsViewModel)
fun inject(verifySeedPhraseViewModel: VerifySeedPhraseViewModel)
fun inject(backupSettingsViewModel: BackupSettingsViewModel)
fun inject(biometricAuthenticationViewModel: BiometricAuthenticationViewModel)
fun inject(txListViewModel: TxListViewModel)
fun inject(changeBaseNodeViewModel: ChangeBaseNodeViewModel)
fun inject(addCustomBaseNodeViewModel: AddCustomBaseNodeViewModel)
fun inject(networkSelectionViewModel: NetworkSelectionViewModel)
fun inject(allSettingsViewModel: AllSettingsViewModel)
fun inject(addRecipientViewModel: AddRecipientViewModel)
fun inject(finalizeSentTxListViewModel: FinalizeSendTxViewModel)
fun inject(walletInfoViewModel: WalletInfoViewModel)
fun inject(requestTariViewModel: RequestTariViewModel)
fun inject(addAmountViewModel: AddAmountViewModel)
fun inject(torBridgesSelectionViewModel: TorBridgesSelectionViewModel)
fun inject(customTorBridgeViewModel: CustomTorBridgesViewModel)
fun inject(deeplinkViewModel: DeeplinkViewModel)
fun inject(localAuthViewModel: LocalAuthViewModel)
fun inject(viewModel: ThumbnailGIFsViewModel)
fun inject(viewModel: GIFViewModel)
fun inject(viewModel: BackgroundServiceSettingsViewModel)
fun inject(viewModel: ConnectionIndicatorViewModel)
fun inject(viewModel: ChooseRestoreOptionViewModel)
fun inject(viewModel: EnterRestorationPasswordViewModel)
fun inject(viewModel: WalletRestoringFromSeedWordsViewModel)
fun inject(viewModel: InputSeedWordsViewModel)
fun inject(viewModel: VerifySeedPhraseViewModel)
fun inject(viewModel: BackupSettingsViewModel)
fun inject(viewModel: BiometricAuthenticationViewModel)
fun inject(viewModel: TxListViewModel)
fun inject(viewModel: ChangeBaseNodeViewModel)
fun inject(viewModel: AddCustomBaseNodeViewModel)
fun inject(viewModel: NetworkSelectionViewModel)
fun inject(viewModel: AllSettingsViewModel)
fun inject(viewModel: AddRecipientViewModel)
fun inject(viewModel: FinalizeSendTxViewModel)
fun inject(viewModel: WalletInfoViewModel)
fun inject(viewModel: RequestTariViewModel)
fun inject(viewModel: AddAmountViewModel)
fun inject(viewModel: TorBridgesSelectionViewModel)
fun inject(viewModel: CustomTorBridgesViewModel)
fun inject(viewModel: DeeplinkViewModel)
fun inject(viewModel: LocalAuthViewModel)
fun inject(viewModel: CreateWalletViewModel)
fun inject(viewModel: IntroductionViewModel)
fun inject(viewModel: AuthViewModel)
Expand All @@ -178,16 +158,14 @@ interface ApplicationComponent {
fun inject(viewModel: BugsReportingViewModel)
fun inject(viewModel: LogFilesViewModel)
fun inject(viewModel: LogsViewModel)
fun inject(backupOptionViewModel: BackupOptionViewModel)
/**
* Service(s).
*/
fun inject(service: WalletService)

/**
* Broadcast receiver
*/
fun inject(receiver: BootDeviceReceiver)
fun inject(viewModel: BackupOptionViewModel)
fun inject(viewModel: LogFilesManager)
fun inject(viewModel: ThemeSelectorViewModel)
fun inject(viewModel: DeleteWalletViewModel)
fun inject(viewModel: HomeViewModel)
fun inject(viewModel: EnterCurrentPasswordViewModel)
fun inject(viewModel: ChangeSecurePasswordViewModel)
fun inject(viewModel: AddNoteViewModel)

fun getClipboardManager(): ClipboardManager
}
Loading

0 comments on commit 7b1148f

Please sign in to comment.