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

Paul/bitwave csv #4397

Merged
merged 3 commits into from
Aug 28, 2023
Merged

Paul/bitwave csv #4397

merged 3 commits into from
Aug 28, 2023

Conversation

paullinator
Copy link
Member

@paullinator paullinator commented Aug 16, 2023

CHANGELOG

added: Export Bitwave format CSV

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

@paullinator paullinator force-pushed the paul/bitwaveCsv branch 2 times, most recently from 6cb626f to 99d76f2 Compare August 17, 2023 16:22
Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

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

The export logic is simple enough, but there is a problem with the toggle switches on Android.

Comment on lines 151 to 188
isExportQbo: !state.isExportQbo,
isExportBitwave: !state.isExportBitwave
Copy link
Contributor

Choose a reason for hiding this comment

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

The Android toggles are messed up. We need to do the following:

  handleQboToggle = () => {
    if (android) {
      this.setState({ isExportQbo: true, isExportCsv: false, isExportBitwave: false })
   } else { 
     this.setState(state => ({ isExportQbo: !state.isExportQbo }))
   }
  }

And likewise for the other 2 handlers. Then in the renderAndroidSwitches, we use these 3 handlers, instead of the generic handleAndroidToggle.

This is because Android can only choose one option at a time. With two options, it doesn't really matter which is which, but with 3 options, it suddenly matters which switch you choose, so we need separate handlers.

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch. will do.

@paullinator paullinator force-pushed the paul/bitwaveCsv branch 2 times, most recently from f224d01 to da8bd7d Compare August 28, 2023 00:46
Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

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

It's closer, and we could merge it if we really had to, but I see a way the user could crash it.

Comment on lines 149 to 153
if (Platform.OS === 'android' && !this.state.isExportQbo) {
this.setState({ isExportCsv: false, isExportBitwave: false })
}

this.setState(state => ({ isExportQbo: !state.isExportQbo }))
Copy link
Contributor

Choose a reason for hiding this comment

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

If you press the radio button once on Android, it will select the option. If the press the ratio button again, it will de-select the option and leave nothing chosen. Then, when you hit submit, you will get a crash, because files[0] is undefined.

The way I wrote the handler in my original review comment would have avoided this possibility, by ensuring exactly one item can be selected on Android.

Copy link
Member Author

@paullinator paullinator Aug 28, 2023

Choose a reason for hiding this comment

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

You can't submit if nothing is selected. The Next button is hidden. This is also true on iOS. I did test this case. But it's fair to say the user shouldn't be allowed to select nothing. Admittedly I was trying to keep the logic similar to iOS wrt allowing a deselection

@paullinator
Copy link
Member Author

/rebase

@paullinator paullinator merged commit 8a3bb4c into develop Aug 28, 2023
2 checks passed
@paullinator paullinator deleted the paul/bitwaveCsv branch August 28, 2023 21:15
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