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

[ENH] Upload complete broadcast #686

Merged
merged 6 commits into from
Feb 14, 2024
Merged

Conversation

rksh
Copy link
Contributor

@rksh rksh commented Feb 6, 2024

Implementing #683 - sending a broadcast intent on upload success or failure.
These are (respectively) net.wigle.wigleandroid.UPLOAD_COMPLETE and net.wigle.wigleandroid.UPLOAD_FAILED.

As a part of this change, I've also moved the OkFileUploader core call contents to WiGLEApiManager, our API implementation class. This necessitated numerous changes and begged certain cleanups, including:

  • making the global state api manager instance public, since we reference it outside of its package
  • cleanups of some literal strings and statuses, including two non-enumerated/conflicting integer states
  • eliminating some unused, duplicative code
  • a few safety checks that really should have been there from the start
  • parsing and inclusion of the upload results, including transIds
  • state handling cleanup - this is still not perfect, but should be cleaner

Some of the changes here may benefit from further refactoring, but this change set is getting large, and further changes (e.g. combining our various progress interaction implementations) would increase risk.

Copy link
Member

@bobzilladev bobzilladev left a comment

Choose a reason for hiding this comment

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

lgtm, except for one un-intent-ional thing to fix.

getApplicationContext().unbindService(state.serviceConnection);
final Context c = getApplicationContext();
if (null != c) {
getApplicationContext().unbindService(state.serviceConnection);
Copy link
Member

Choose a reason for hiding this comment

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

Missed changing to reference c

.map(UploadReseponse.UploadTransaction::getTransId)
.collect(Collectors.toList());
if (transIds.size() > 0) {
intent.putExtra("transIds", transIds.toString());
Copy link
Member

Choose a reason for hiding this comment

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

do we care about doing this toString() more than once?
i suppose these are not frequent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's sillier than that- the client doesn't currently support multiple CSVs/archive upload - so transIds will always be a single-item list. Just doing this to correctly process the API response should we start supporting multi-archive. Cleaning up.

@rksh rksh merged commit 122ae13 into wiglenet:main Feb 14, 2024
1 check passed
@rksh rksh deleted the upload_complete_broadcast branch April 2, 2024 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants