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

show politeia proposals #503

Merged
merged 51 commits into from
Jan 29, 2021
Merged

show politeia proposals #503

merged 51 commits into from
Jan 29, 2021

Conversation

dreacot
Copy link
Contributor

@dreacot dreacot commented Aug 7, 2020

Requires planetdecred/dcrlibwallet#161

This PR allows users to;

  1. View Decred politeia proposals
  2. View politeia proposals details
  3. View vote status of politeia proposals
  4. Receive notifications for proposals on (new proposal, vote started, vote finished)

How the notifications work

When the client launches the app for the first time, a sync is initiated and all proposals are fetched, now when next the client launches the app the sync initiates again, and if there are new proposals or changes to the proposals fetched initially, our callback listeners are triggered

We have listeners for onNewProposal, onVoteStarted, and onVoteEnded . When any of the listeners are triggered, it sends the appropriate notification to the client

When the client taps on a particular notification, it takes them to the proposal details page for that particular proposal

Screenshots

@dreacot dreacot marked this pull request as ready for review September 1, 2020 22:27
app/src/main/java/com/dcrandroid/HomeActivity.kt Outdated Show resolved Hide resolved
app/src/main/java/com/dcrandroid/HomeActivity.kt Outdated Show resolved Hide resolved
app/src/main/java/com/dcrandroid/HomeActivity.kt Outdated Show resolved Hide resolved
app/src/main/java/com/dcrandroid/HomeActivity.kt Outdated Show resolved Hide resolved
app/src/main/java/com/dcrandroid/HomeActivity.kt Outdated Show resolved Hide resolved
app/src/main/java/com/dcrandroid/util/NetworkTask.kt Outdated Show resolved Hide resolved
app/src/main/java/com/dcrandroid/util/Utils.kt Outdated Show resolved Hide resolved
app/src/main/res/values-fr/strings.xml Outdated Show resolved Hide resolved
app/src/main/java/com/dcrandroid/data/Constants.java Outdated Show resolved Hide resolved
Comment on lines 28 to 32
currentFragment = PoliteiaFragment()
supportFragmentManager
.beginTransaction()
.replace(R.id.container, currentFragment)
.commit()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the activity displaying a single fragment? Move the fragment code to this activity if it's not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the code from the activity was moved to a fragment, so the sync function can be accessed from the base fragment

app/src/main/res/layout/fragment_politeia.xml Outdated Show resolved Hide resolved
feat: fetched proposal details from api
style: modified some layouts
feat: added approporiate message for proposal status(publishes, abandoned)
feat: implemeted politeia from dcrlibwallet
perf: updated proposal status util
chore: refined code in proposal class
chore: added yes/no votes to proposal details
chore: cleaned up code
…oved, rejected and abandoned) proposals

feat: added category filter for proposals
chore: made green background darker so text can be more readeable
chore: centered percentage in progress bar
}

override fun onNothingSelected(parent: AdapterView<*>?) {}
}

go_back.setOnClickListener {
multiWallet!!.politeia.clearSavedProposals()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

why does going back clear all fetched proposals?, shouldn't it still remain saved for when next the user needs to access them?

also after going back the first time, entering the proposal page again and going back again crashes the app, because there's no data to be cleared

Copy link
Contributor

Choose a reason for hiding this comment

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

That was for debugging, will remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright

tv_sync_label.setText(R.string.stop_sync)

if(multiWallet!!.politeia.synced()) {
sync_icon.animation = null
Copy link
Contributor Author

Choose a reason for hiding this comment

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

tv_sync_label.setText("Synced")

after the sync completes, the text could be changed to disconnect or something similar, so the user can know the sync is done, right now it shows stop sync

Copy link
Contributor

Choose a reason for hiding this comment

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

Sync doesn't 'complete', what completed is the fetching of all unfetched proposals and dcrlibwallet will continue to check every 30 minutes for proposal updates.

This is why I don't really support that 'Sync' phrase in this part of the app because it's going to be confused with normal syncing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh i see, yes it's a bit confusing, we might have to find a suitable synonym

@dreacot
Copy link
Contributor Author

dreacot commented Jan 26, 2021

Reviewed and everything looks good

@beansgum beansgum merged commit 267da06 into planetdecred:master Jan 29, 2021
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.

2 participants