-
Notifications
You must be signed in to change notification settings - Fork 169
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
Restore Identity from First Public Key #513
Conversation
This allows loading an identity before the credit funding transaction is found.
…o chain-sync-phase-3a
…n PlatformRepo.kt This resolves a crash when accessing the More menu before registring a username
… into chain-sync-phase-3a
fun Context.lifecycleOwner(): LifecycleOwner? { | ||
var curContext = this | ||
var maxDepth = 20 | ||
while (maxDepth-- > 0 && curContext !is LifecycleOwner) { | ||
curContext = (curContext as ContextWrapper).baseContext | ||
} | ||
return if (curContext is LifecycleOwner) { | ||
curContext as LifecycleOwner | ||
} else { | ||
null | ||
} | ||
} |
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 needed a way to get the LifeCycleOwner of a View that is derived from a ConstraintLayout for an observer.
@@ -8,7 +8,7 @@ | |||
<string name="blockchain_state_progress_days">%1$s, %2$d days behind</string> | |||
<string name="blockchain_state_progress_weeks">%1$s, %2$d weeks behind</string> | |||
<string name="blockchain_state_progress_months">%1$s, %2$d months behind</string> | |||
<string name="blockchain_state_progress_downloading">Synchronizing with network</string> | |||
<string name="blockchain_state_progress_downloading">Synchronizing with network (%1$s%%)</string> |
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 used by the Notification for the foreground service.
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.
To display the percent complete like this (5%)
@@ -31,6 +31,7 @@ import org.dashevo.dpp.identity.IdentityPublicKey | |||
data class BlockchainIdentityData(var creationState: CreationState = CreationState.NONE, | |||
var creationStateErrorMessage: String?, | |||
var username: String?, | |||
var userId: String?, |
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 need to store the userId because if we are restoring a recovery phrase, we won't have the credit funding transaction until later in the sync process.
@@ -66,7 +67,7 @@ class MoreFragment : Fragment(R.layout.activity_more) { | |||
} | |||
|
|||
val blockchainIdentity = PlatformRepo.getInstance().getBlockchainIdentity() | |||
if (blockchainIdentity != null) { | |||
if (blockchainIdentity != null && blockchainIdentity.registrationStatus == BlockchainIdentity.RegistrationStatus.REGISTERED) { |
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.
Prevents crash if no user is registered on the More Screen.
//and sent as a Resource.error | ||
val creditFundingTx = wallet.getCreditFundingTransaction(wallet.getTransaction(blockchainIdentityData.creditFundingTxId)) | ||
val userId = creditFundingTx.creditBurnIdentityIdentifier.toStringBase58() | ||
val userId = blockchainIdentity.uniqueIdString |
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.
since the userId is saved in the database, we don't need to load it from the wallet.
uniqueId = Sha256Hash.wrap(Base58.decode(blockchainIdentityData.userId)) | ||
} | ||
} else { | ||
return blockchainIdentity |
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 return the blockchainIdentity because this is during the registration process and there is no other data to load.
log.info("update contacts not completed: blockchainIdentity has not been initialized") | ||
} | ||
|
||
val userId = blockchainIdentity.uniqueIdString!! //blockchainIdentityData!!.getIdentity(walletApplication.wallet) ?: return |
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.
oops. left a comment
// If new keychains were added to the wallet, then update the bloom filters | ||
if (addedContact) { | ||
val intent = Intent(BlockchainService.ACTION_RESET_BLOOMFILTERS, null, walletApplication, | ||
BlockchainServiceImpl::class.java) | ||
walletApplication.startService(intent) | ||
} | ||
|
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 was moved up in case there is an exception when processing profiles.
Issue being fixed or feature implemented
NMA-590
Due to the changes made, the identity, username and contacts will be loaded at 30%, instead of the normal 90-100 percent which results in missing transactions and requires a blockchain rescan.
This resolves some causes of missing payments from contacts after restoring a wallet from a recovery phrase.
Related PR's and Dependencies
dashpay/android-dashpay#24
Screenshots / Videos
How Has This Been Tested?
Checklist: