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

refactor: Attendee fragment (#786) (#792) #796

Merged
merged 1 commit into from Dec 30, 2018

Conversation

liveHarshit
Copy link
Member

@liveHarshit liveHarshit commented Dec 29, 2018

@liveHarshit
Copy link
Member Author

@iamareebjamal Please review and suggest what else to do.

@fossasia fossasia deleted a comment Dec 29, 2018
Copy link
Member

@nikit19 nikit19 left a comment

Choose a reason for hiding this comment

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

Rest looks good


attendeeViewModel.isAttendeeCreated.observe(this, Observer { isAttendeeCreated ->
if (isAttendeeCreated) {
if (selectedPaymentOption == getString(R.string.stripe))
Copy link
Member

Choose a reason for hiding this comment

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

I guess these two if statements can be combined

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, but paypal option is also there. Again need to separate conditions in next issue. Should I combine it for now?

Copy link
Member

Choose a reason for hiding this comment

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

Yes

Copy link
Member

Choose a reason for hiding this comment

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

This is going to create trouble. Compare with a constant and not a string resource. Use string resource just for presentation

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

Copy link
Member Author

Choose a reason for hiding this comment

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

This is going to create trouble. Compare with a constant and not a string resource. Use string resource just for presentation

Sorry, this comment was missing, when I read.

@liveHarshit
Copy link
Member Author

Updated


attendeeViewModel.isAttendeeCreated.observe(this, Observer { isAttendeeCreated ->
if (isAttendeeCreated) {
if (selectedPaymentOption == getString(R.string.stripe))
Copy link
Member

Choose a reason for hiding this comment

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

This is going to create trouble. Compare with a constant and not a string resource. Use string resource just for presentation

@@ -211,7 +205,7 @@ class AttendeeFragment : Fragment() {

override fun onItemSelected(p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long) {
selectedPaymentOption = paymentOptions[p2]
if (selectedPaymentOption == "Stripe")
if (selectedPaymentOption == getString(R.string.stripe))
Copy link
Member

Choose a reason for hiding this comment

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

Not updated

Copy link
Member

Choose a reason for hiding this comment

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

This is going to create trouble. Compare with a constant and not a string resource. Use string resource just for presentation

@liveHarshit
Copy link
Member Author

Updated

@fossasia fossasia deleted a comment Dec 30, 2018
if (selectedPaymentOption == "Stripe")
override fun onItemSelected(p0: AdapterView<*>?, p1: View?, position: Int, p3: Long) {
selectedPaymentOption = position
if (position == paymentOptions.indexOf(getString(R.string.stripe)))
Copy link
Member

Choose a reason for hiding this comment

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

Use constant please

Copy link
Member Author

Choose a reason for hiding this comment

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

Can I compare directly with the position? if(position = 0 or 1).

Copy link
Member

Choose a reason for hiding this comment

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

No, for this, please remove the string resources and use constants

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm sorry to not getting it, because if (selectedPaymentOption == 0) in this case it is constant. Should I define value first like stripePaymentPosition = 0 and paypalPaymentOption = 1 and compare selectedPaymentOption with them.

Copy link
Member

Choose a reason for hiding this comment

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

Change it to selectedOption == STRIPE and don't use string resources in any of its cases

But I'm merging it now, create another issue to handle it

@iamareebjamal iamareebjamal merged commit dcb57e2 into fossasia:development Dec 30, 2018
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.

None yet

3 participants