Skip to content
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

feat(dashpay): use mock state repository #1181

Merged
merged 5 commits into from
Aug 21, 2023

Conversation

HashEngineering
Copy link
Collaborator

@HashEngineering HashEngineering commented Aug 14, 2023

Issue being fixed or feature implemented

This will open up DashPay functions by "faking it until we make it". Mocking is done in the dashpay libraries

Related PR's and Dependencies

dashpay/android-dpp#40
dashpay/android-dashpay#73

Screenshots / Videos

How Has This Been Tested?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

@HashEngineering HashEngineering self-assigned this Aug 14, 2023
@HashEngineering HashEngineering changed the base branch from master to dashpay August 14, 2023 23:41
Comment on lines +53 to +54
implementation 'org.dashj.platform:dashpay:0.24-MOCK-SNAPSHOT'
implementation 'org.dashj.platform:platform-core:0.24-MOCK-SNAPSHOT'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All data mocking is handled here. Any data created in DashPay won't be saved there. I didn't want to add more code to this PR requiring changes to DB tables, etc.

For now these changes will allow a username to be created or restored.

Comment on lines +214 to +219
state: PoolState?,
message: PoolMessage?,
address: MasternodeAddress?,
joined: Boolean
) {
super.onSessionComplete(wallet, sessionId, denomination, message)
super.onSessionComplete(wallet, sessionId, denomination, state, message, address, joined)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are new 19.1-CJ-SNAPSHOT changes, but I haven't published it yet.

if (platformRepo.hasIdentity || walletApplication.wallet == null) {
if (!platformRepo.hasIdentity || walletApplication.wallet == null) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are some bugs leftover from merging Core 19 changes, masternode changes, etc -- but we didn't actually test this to see if it was working.

@@ -216,6 +217,8 @@ class PlatformRepo private constructor(val walletApplication: WalletApplication)
dashPayProfileDao.loadAll().forEach {
platform.stateRepository.addValidIdentity(it.userIdentifier)
}

platform.stateRepository.storeIdentity(blockchainIdentity.identity!!)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we could add other documents that we created, but at this point it doesn't seem necessary to modify DB tables to save those documents.

} else {
null
}
platform.stateRepository.fetchIdentityFromPubKeyHash(firstIdentityKey.pubKeyHash)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as in Android DashPay Library, platform.stateRepository. is the better way to make platform calls, so the "intercepter" will catch the calls.

Copy link
Member

@Syn-McJ Syn-McJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@@ -656,6 +656,7 @@ class CreateIdentityService : LifecycleService() {
blockchainIdentityData = BlockchainIdentityData(CreationState.NONE, null, null, null, true)

val authExtension = walletApplication.wallet!!.getKeyChainExtension(AuthenticationGroupExtension.EXTENSION_ID) as AuthenticationGroupExtension
//authExtension.setWallet(walletApplication.wallet!!) // why is the wallet not set? we didn't deserialize it probably!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is in danger of being abandoned here forever. Maybe TODO should be added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This line will be removed as the bug was fixed elsewhere.

@HashEngineering HashEngineering merged commit 6bc7613 into dashpay Aug 21, 2023
1 check passed
@Syn-McJ Syn-McJ deleted the dashpay-feature-mock-staterepo branch August 23, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants