PowerlineApp / powerline-mobile

Other
4 stars 16 forks source link

Report Button Not Downloading Report #524

Closed jterps08 closed 7 years ago

jterps08 commented 7 years ago

Assigning first to Igor to ensure proper backend behavior. Please assign to Adam if it's a frontend issue.

Adam please reference https://github.com/PowerlineApp/powerline-mobile/issues/410#issuecomment-275981756 for more information relating to how this button is supposed to work. It's supposed download a file. And the file should download like any normal file would download for a user (show in OS notifications drawer)

jterps08 commented 7 years ago

@rudjdev I believe this is the link that the button should be referring to: https://api-dev.powerli.ne/api-doc#get--api-v2-polls-{id}-responses-link where the ID is the ID of the poll/leader-petition/fundraiser/event for which the report button appears on.

igaponov commented 7 years ago

@rudjdev first you have to get a link for download:

$ http --verify no https://api-staging.powerli.ne/api/v2/groups/136/members-link "Token:$TOKEN"       
HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: keep-alive
Content-Type: application/json
Date: Thu, 23 Feb 2017 09:36:05 GMT
Server: nginx/1.1.19
Transfer-Encoding: chunked
X-Powered-By: PHP/5.5.12-2+deb.sury.org~precise+1

{
    "expired_at": "2017-02-23T09:38:05+0000", 
    "url": "/api-public/files/f1ea2509-7b47-49d3-a796-13d5b2584506"
}

This link will be active for two minutes (see expired_at). You can download a file now: http://api-staging.powerli.ne/api-public/files/f1ea2509-7b47-49d3-a796-13d5b2584506

Same for poll responses:

$ http --verify no https://api-staging.powerli.ne/api/v2/polls/185/responses-link "Token:$TOKEN" 
HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: keep-alive
Content-Type: application/json
Date: Thu, 23 Feb 2017 09:43:21 GMT
Server: nginx/1.1.19
Transfer-Encoding: chunked
X-Powered-By: PHP/5.5.12-2+deb.sury.org~precise+1

{
    "expired_at": "2017-02-23T09:45:21+0000", 
    "url": "/api-public/files/f0dab62b-ad8d-47a7-a383-aab6e1ed80ba"
}

I've checked it on staging and it works.

rudjdev commented 7 years ago

Ok, api call gets response data of above type now.

jterps08 commented 7 years ago

@rudjdev is this what you need to make sure this report button works? Please let us knwo when this is done.

jterps08 commented 7 years ago

After 524 is done, we are deploying to PROD and we need PROD builds (IPA/APK) for testing (unsigned)... after we confirm everything passes smoke tests, we will publish signed builds to app stores...

rudjdev commented 7 years ago

@igaponov returned url doesn't include any file. ex: https://api-dev.powerli.ne/api-public/files/c586c102-350f-49ba-af6f-4d59138789f1 {"code":404, "message":"Civix\CoreBundle\Entity\TempFile object not found."}

jterps08 commented 7 years ago

apparently this works now?

jterps08 commented 7 years ago

This is not working still. Instead I get this screen. Even when I do click "Proceed Anyway", it still doesn't work. I am open to alternative suggestions.

image

igaponov commented 7 years ago

@jterps08 The first problem:

Certificate Error
There are issues with the site's certificate chain (net::ERR_CERT_DATE_INVALID).

The second problem - wrong time on the server - resolved

If you get a 404 error it means this link is expired, so try again and act fast.

Upd: it makes sense to hide a button for download using a value of expired_at attribute that is exposed with a link for download.

jterps08 commented 7 years ago

This still does not work for me. I'm on Android 6, Galaxy S7.

  1. User creates poll / fundraiser/ event / leader-petition.
  2. User has at least one response.
  3. User taps Report button
  4. App displays "Continue to download report?" message. User selects OK.
  5. App opens internet browser to start download
  6. Above error still displays / Proceed anyway still doesn't work.
jterps08 commented 7 years ago

In fact 10 minutes later, the app will randomly display the download has failed. Up until this point, it didn't even show me that a download was in progress...

image

jterps08 commented 7 years ago

Amen it was the cert issue