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

PDF Viewing Feature #3353

Merged
merged 27 commits into from
May 23, 2024
Merged

PDF Viewing Feature #3353

merged 27 commits into from
May 23, 2024

Conversation

VitorVieiraZ
Copy link
Contributor

@VitorVieiraZ VitorVieiraZ commented Apr 23, 2024

This feature can be used to open PDF files using the user’s system default application viewer, and can open formats such as links, PDFs, Docx, etc.

  1. In a form that allows multiline entries, add text to the "Form Layout" widgets. This can be done in the "Default Value" section, or within the "HtmlWidget" field.
  2. To embed a PDF file in the project, use the following HTML format:
  • For the "Default Value" section, enter:
    - '<a href="project://dummy.pdf">Open File</a>' (include the HTML code inside single quotes).
  • For direct entry in the "HtmlWidget", use:
    - <a href="project://dummy.pdf">Open File</a> (able to enter the HTML code without quotes).
  1. After synchronizing the project, check the app to ensure that the fields display the link reference correctly.
HTML Link Invalid File
  1. When clicking into the HTML button, the PDF file will be opened using the default application of the system.
  2. Additional Note:
  • In the case of a file inside a folder in the project directory, use the following format:
    <a href="project://files/sample.pdf">Open PDF File inside folder "files"</a>
    sample.pdf file inside 'files' folder

@VitorVieiraZ VitorVieiraZ changed the title WIP - Ios PDF Viewing PDF Viewing Feature Apr 24, 2024
app/android/src/uk/co/lutraconsulting/InputActivity.java Outdated Show resolved Hide resolved
app/android/src/uk/co/lutraconsulting/InputActivity.java Outdated Show resolved Hide resolved
app/inpututils.cpp Outdated Show resolved Hide resolved
app/inpututils.cpp Outdated Show resolved Hide resolved
app/inpututils.cpp Outdated Show resolved Hide resolved
@tomasMizera
Copy link
Collaborator

Please merge master branch here to make CI working. We can then proceed with testing

Copy link

github-actions bot commented May 2, 2024

Pull Request Test Coverage Report for Build 9207444860

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 275 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.03%) to 59.953%

Files with Coverage Reduction New Missed Lines %
input/app/ios/iosutils.cpp 2 17.24%
input/app/androidutils.cpp 12 4.76%
input/app/inpututils.cpp 261 50.74%
Totals Coverage Status
Change from base Build 9161804447: -0.03%
Covered Lines: 7668
Relevant Lines: 12790

💛 - Coveralls

@VitorVieiraZ VitorVieiraZ linked an issue May 2, 2024 that may be closed by this pull request
@tomasMizera
Copy link
Collaborator

Windows build is failing here @VitorVieiraZ, please check the error log

Copy link
Collaborator

@tomasMizera tomasMizera left a comment

Choose a reason for hiding this comment

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

Just one small comment, otherwise it looks good :)

app/inpututils.cpp Outdated Show resolved Hide resolved
@tomasMizera tomasMizera added ready-for-testing Ready to be tested by testers crew - passed review by devs and removed ready-for-testing Ready to be tested by testers crew - passed review by devs labels May 7, 2024
@tomasMizera
Copy link
Collaborator

Let's merge to master and then test from there

@jozef-budac
Copy link

I just tried this feature on the APK from this ticket and I always get an error message, that the file does not exist. Can you please check it?

My project is tc05_forms_derived and there is a tab called Files

@VitorVieiraZ
Copy link
Contributor Author

I just tried this feature on the APK from this ticket and I always get an error message, that the file does not exist. Can you please check it?

My project is tc05_forms_derived and there is a tab called Files

Tests successfully conducted. In the case of a file inside a folder in the project directory, use the following format:

<a href="project://files/sample.pdf">Open PDF File inside folder "files"</a>

sample.pdf file inside 'files' folder

@jozef-budac
Copy link

@VitorVieiraZ I checked the project and I don't see a problem in the configuration. Do you see it? I tried it again and I was able to open TXT and DOCX files, but the PDF file was still unavailable.
The configuration for it is '<a href="project://sample.pdf">Open PDF File</a>' and the sample.pdf file it is located in the root directory of the project. Am I doing something wrong?

Screen_Recording_20240514_094720_My.Files.mp4

@tomasMizera tomasMizera added the test-failed Label to use for PR testing label May 15, 2024
@tomasMizera tomasMizera modified the milestones: 2024.1.1, 2024.2.0 May 15, 2024
@jozef-budac
Copy link

Now it looks great! I didn't find any more problems.

@jozef-budac
Copy link

Unfortunately, the files in sub-directories stopped working

Screen_Recording_20240515_230806.mp4

@tomasMizera
Copy link
Collaborator

@VitorVieiraZ please merge master branch here - it will upload the build to iOS then too :)

@tomasMizera
Copy link
Collaborator

tomasMizera commented May 20, 2024

@jozef-budac Can you please retest this PR? We are mainly interested in PDFs so if they work we can merge it and fix other file types later. This is the build to test it with: https://github.com/MerginMaps/mobile/actions/runs/9158230910?pr=3353

@tomasMizera tomasMizera added ready-for-testing Ready to be tested by testers crew - passed review by devs and removed test-failed Label to use for PR testing labels May 20, 2024
@jozef-budac
Copy link

Right now I can't install the package

image

@tomasMizera
Copy link
Collaborator

@jozef-budac you can now test it on iOS too :)

@tomasMizera
Copy link
Collaborator

@jozef-budac you can now test it on iOS too :)

24.5.622711

@tomasMizera
Copy link
Collaborator

I can confirm that the apk is now invalid @VitorVieiraZ

@tomasMizera
Copy link
Collaborator

It says Failure, intent tag may have at most one action

@tomasMizera
Copy link
Collaborator

After removing these two lines

<action android:name="android.intent.action.OPEN_DOCUMENT" />
<action android:name="android.intent.action.GET_CONTENT" />

the code works as expected for me in the tc05_forms_derived

Copy link
Collaborator

@tomasMizera tomasMizera left a comment

Choose a reason for hiding this comment

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

@VitorVieiraZ Can you please remove these two lines

<action android:name="android.intent.action.OPEN_DOCUMENT" />
<action android:name="android.intent.action.GET_CONTENT" />
I believe we are ready for merge then 🥳

@jozef-budac
Copy link

jozef-budac commented May 23, 2024

PDF files are working now of both Android and iOS>
The docx and xlsx are not working on Android. But if only PDF is mandatory, we can go with this to production

@tomasMizera
Copy link
Collaborator

tomasMizera commented May 23, 2024 via email

@jozef-budac
Copy link

Here is a video from Android 14

Screen_Recording_20240523_145441.mp4

@tomasMizera
Copy link
Collaborator

@jozef-budac do you have some app to open xls installed? If yes, we can debug then. Anyways,let's merge it as pdfs are working now :)

Copy link
Collaborator

@tomasMizera tomasMizera left a comment

Choose a reason for hiding this comment

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

🚀 🔥

@tomasMizera tomasMizera merged commit 38fe87a into master May 23, 2024
9 checks passed
@tomasMizera tomasMizera deleted the feature/pdf-viewing branch May 23, 2024 14:11
@jozef-budac
Copy link

@tomasMizera Yes I have programs to open such files. In some of the previous APKs I was able to open the files. I wrote a note "Now it looks great! I didn't find any more problems." But then it doesn't work anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing Ready to be tested by testers crew - passed review by devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for opening PDF files in the form
4 participants