Open anvmn opened 1 year ago
@adamhstewart
Photos do not appear in the whatsapp image:
The images are served directly from cache, and I did not find an easy solution that can work with html2canvas
.
I suggest checking the necessity of images at sent screenshot. Considering the resolution, I don't think you can see much at ANC report anyway, and photo at details page does not seem mandatory.
If images are must, we may need to search for another utility to take screenshots'.
The screenshot we send can be quite large (over 1MB), as the report is long. The images that are being received at WhatsApp message are small (~70KB), which results in poor image quality.
Seems to me that with Twilio, resolution is better even though images size is still small. I think we better get some feedbacks from site before we try making improvements (which will required Twillio support).
@adamhstewart
Made few more attempts today of service pictures to html2canvas. For the context, device stores images in cache. Service worker intercepts the requests, and serves images from device cache, instead of sending the request to back-end. Service worker runs on browser, and we have no ability to make use of it in non web world (where html2canvas operates). Therefore, html2canvas requests are sent to back-end (if device is connected to internet). Even if there's internet, since there's no authentication, the response if HTTP 403. BTW, the case where you saw screenshots with images happens if you're running while logged in on back-end, since you're already authenticated and have access to images.
The conclusion still remains the same - If images are must, we need to search for another utility to take screenshots.
Follows up on #292 and https://github.com/Gizra/ihangane/issues/3050
The problem:
html2canvas
loads photos, by issuing fetch requests to image urls. On our APP however, we have SW layer that catches photos fetch requests and maps the urls to photos locations at device cache, where real images are stored.html2canvas
can't use SW, and therefore, it can't get the images.