-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PERA-1353 :: Add new bottomsheet for HD Wallet flow #141
base: epic/pera-798-common-dev-update
Are you sure you want to change the base?
PERA-1353 :: Add new bottomsheet for HD Wallet flow #141
Conversation
...lgorand/android/modules/algosdk/domain/mapper/TransactionParametersResponseMapperImplTest.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/com/algorand/android/ui/compose/widget/MnemonicTypeCard.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/com/algorand/android/ui/compose/widget/MnemonicTypeCard.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/com/algorand/android/ui/compose/theme/PeraTheme.kt
Outdated
Show resolved
Hide resolved
...algorand/android/modules/onboarding/recoverypassphrase/info/ui/RecoverAccountInfoFragment.kt
Outdated
Show resolved
Hide resolved
...gorand/android/modules/onboarding/recoverypassphrase/info/ui/RecoveryAccountInfoViewModel.kt
Outdated
Show resolved
Hide resolved
@@ -111,6 +111,11 @@ | |||
android:defaultValue="@null" | |||
app:argType="string" | |||
app:nullable="true" /> | |||
<argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation creates potential bugs. There is already mnemonic args. We can pass 24 mnemonic and 25 word counts.
Arg type can be a sealed interface with 2 different classes that implement this interface. passing two different arg that serves to same purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I switched to passing AccountType
instead of word count so i think this issue is addressed. QR code parsing will default to word count when split checking since we don't know what account type it is (24 or 25 word passphrase)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in some of my prvious comments. Using account type as an argument is not a correct implementation.
We are coupling a model that uses local account and account information with account creation arg.
@@ -28,6 +28,11 @@ | |||
android:defaultValue="@null" | |||
app:argType="string" | |||
app:nullable="true" /> | |||
<argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation creates potential bugs. There is already mnemonic args. We can pass 24 mnemonic and 25 word counts.
Arg type can be a sealed interface with 2 different classes that implement this interface. passing two different arg that serves to same purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one variable is the input mnenomic string (empty for user to enter into form or qr code value that prefills the form)...the other variable is number of word text fields to show on the passphrase form. So instead of passing two input variables you want one? We can chat about this tomorrow in team meeting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I switched to passing AccountType
instead of word count so i think this issue is addressed
...oarding/recoverypassphrase/enterpassphrase/ui/usecase/RecoverWithPassphrasePreviewUseCase.kt
Outdated
Show resolved
Hide resolved
@get:Rule | ||
var hiltRule = HiltAndroidRule(this) | ||
|
||
@Inject | ||
lateinit var aesPlatformManager: AESPlatformManager | ||
|
||
@Before | ||
fun setup() { | ||
hiltRule.inject() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this, we are testing provided AESPlatformManager. What we need to do is to create instance of the object manually like;
private val sut = AESPlatformManagerImpl(...)
- This adds extra processing which makes test slower
- This tests the implementation of the real class. Unit test needs to be isolated, that's why we should be testing implementation, not provided interface
@Test | ||
fun testEncryptDecryptAlgo25SecretKey_shouldMatchOriginal() { | ||
// Given | ||
val originalSecretKey = Sdk.generateSK() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't use Sdk
functions, or any other library functions in our unit tests. By calling this function,
- If
Sdk.generateSK
fails, the test will fail as well, even ifsut
works perfectly. - Any change in
Sdk.generateSK
may break out tests.
Our tests should be independent of external libraries
val wordCount = Mnemonics.WordCount.COUNT_24 | ||
val originalEntropy = Mnemonics.MnemonicCode(wordCount).toEntropy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
|
||
@Test | ||
fun testEncryptDecryptEntropy_withEmptyArray() { | ||
// Given |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there shouldn't be any given
- when
- then
comments in our tests.
We are separating those sections by using new line.
|
||
sealed interface AccountType: Parcelable { | ||
|
||
@Parcelize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't use parcelize
in our common-sdk domain models.
There are a few models doing that already, and I'll remove them as well. Our component needs to be platform-independent. This also makes things harder when we want to unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we seem to need this though because we're passing accountType
as a nav graph bundle param between onboarding screens...i'm open to suggestions.
@@ -111,6 +111,11 @@ | |||
android:defaultValue="@null" | |||
app:argType="string" | |||
app:nullable="true" /> | |||
<argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in some of my prvious comments. Using account type as an argument is not a correct implementation.
We are coupling a model that uses local account and account information with account creation arg.
@@ -0,0 +1,4 @@ | |||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this when we remove hilt injection in our test class
import com.algorand.wallet.encryption.SecretKeyEncryptionManager | ||
import javax.inject.Inject | ||
|
||
internal class GetHdWalletEntropyFromSeedIdUseCase @Inject constructor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is local account specific usecase. We should move this usecase into local account package
|
||
fun updateHdSeedCustomNameAsFlow(hdSeed: HdSeed): Flow<Unit> | ||
|
||
fun addHdSeedAsFlow(hdSeed: HdSeed, encryptedEntropy: ByteArray, encryptedSeed: ByteArray): Flow<Unit> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this function? Why do we need to do this as flow?
|
||
suspend fun getAllHdSeed(entropyCustomName: String): List<HdSeed> | ||
|
||
fun updateHdSeedCustomNameAsFlow(hdSeed: HdSeed): Flow<Unit> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this function? Why do we need to do this as flow?
4c2a5f3
to
90e73e0
Compare
Pull Request Template
Description
Related Issues
Checklist
Additional Notes
Here are some screenshots of bottom sheet