Skip to content

feat(dashpay): use mock state repository#1181

Merged
HashEngineering merged 5 commits intodashpayfrom
dashpay-feature-mock-staterepo
Aug 21, 2023
Merged

feat(dashpay): use mock state repository#1181
HashEngineering merged 5 commits intodashpayfrom
dashpay-feature-mock-staterepo

Conversation

@HashEngineering
Copy link
Copy Markdown
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 thread wallet/build.gradle
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
Copy Markdown
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
Copy Markdown
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 there is no wallet or identity, then skip the remaining steps of the update
if (platformRepo.hasIdentity || walletApplication.wallet == null) {
if (!platformRepo.hasIdentity || walletApplication.wallet == null) {
Copy link
Copy Markdown
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.

platform.stateRepository.addValidIdentity(it.userIdentifier)
}

platform.stateRepository.storeIdentity(blockchainIdentity.identity!!)
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

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
Copy Markdown
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
Copy Markdown
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
@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