Describe the bug
Yesterday a russian member of the community posted a question on telegram and I tried to figure it out.
His objective was to use an html site as a background and alert the user whenever there was no network activity.
I found that there appears to be a bug whereby using templates => body => background => html => text instead of url does not render correctly.
I was attempting to accomplish this by using $network.request and catch the network error, and render the downloaded html on success. Since this needs a template, I could no longer use background => url but was using background => text. It seems that background => text sanitises the output rendered in some way (maybe this is intentional, but then it appears to serve no purpose as the $render already specifies the type - there should be at least a background "raw" paramenter if this is indeed on purpose).
In the examples below I stripped out all the JSON code irrelevant to the actual bug for the sake of brevity.
Expected behavior
background => html => text should simply render the content of the "text" option so it looks like example 1).
Screenshots
See above.
Smartphone (please complete the following information):
Device: I tried with all simulators and my real iPhone Xr. I choose iPad Pro screenshots as example 3) is otherwise unreadable.
OS: 13.3 (latest)
Compilation:
Version: I tried with the master and with the release V2.0.0 with the same outcome.
Additional context
Please see "Describe the bug" for context.
I would appreciate any workaround or idea on how to fix. I read through the source code to attempt to find the problem and it may be in JasonViewController.m. Unfortunately I am not an Objective-C expert or I would attempt to provide a fix. I could not find where the html is lost in translation exactly but it seems like it gets lost right in the end.
Describe the bug Yesterday a russian member of the community posted a question on telegram and I tried to figure it out.
His objective was to use an html site as a background and alert the user whenever there was no network activity.
I found that there appears to be a bug whereby using templates => body => background => html => text instead of url does not render correctly.
I was attempting to accomplish this by using $network.request and catch the network error, and render the downloaded html on success. Since this needs a template, I could no longer use background => url but was using background => text. It seems that background => text sanitises the output rendered in some way (maybe this is intentional, but then it appears to serve no purpose as the $render already specifies the type - there should be at least a background "raw" paramenter if this is indeed on purpose).
In the examples below I stripped out all the JSON code irrelevant to the actual bug for the sake of brevity.
Example Jasonette Document URLs & JSON files
I created 3 apps to demonstrate this problem:
1) The first one is to show what the expected result would be: https://raw.githubusercontent.com/opsarl/jasonelle/master/bug-report-ok.json
The result is this:
2) This is what the result is when text is used instead of url: https://raw.githubusercontent.com/opsarl/jasonelle/master/but-report-error.json
The result is this:
This was also tried with any and all combinations of "data_type": using "raw" etc. with any $render types to no avail.
3) The I made a last app to dump the output of $jason during the render to ensure that the $jason was correctly populated and sent to the template.
https://raw.githubusercontent.com/opsarl/jasonelle/master/bug-report-text.json
The result is this:
To Reproduce Run each app listed above.
Expected behavior background => html => text should simply render the content of the "text" option so it looks like example 1).
Screenshots See above.
Smartphone (please complete the following information):
Compilation:
Additional context Please see "Describe the bug" for context.
I would appreciate any workaround or idea on how to fix. I read through the source code to attempt to find the problem and it may be in JasonViewController.m. Unfortunately I am not an Objective-C expert or I would attempt to provide a fix. I could not find where the html is lost in translation exactly but it seems like it gets lost right in the end.