CF.loadAsset apparently is not loading from cache

158 views
Skip to first unread message

Tulio

unread,
Jan 7, 2014, 11:37:10 AM1/7/14
to comman...@googlegroups.com
CF.loadAsset apparently is not loading an image from cache

how to test:

open in guiDesigner the demo project colorpicker
load into iPad with guiDesigner
disable options 1, 2 and 4 in iViewer settings (reload gui layout, reload gui assets, preload images)
do not disable upload service in guiDesigner
touch the colorpad and you'll see the movement of pointer 
close iViewer
disable upload service from guiDesigner
reopen iViewer and try to touch colorpad. No movement of pointer indicating that there is a problem with js

Workaround: in my case, I put a copy of colorpicker.png in my site and changed js, but it works only with internet connection
I will appreciate any hint to work around it without need of internet


Tested with:
iPad 1 - iOS 5.1.1
iPad mini - iOS 7.0.4
Motorola Moto G - Android 4.3
iViewer 4.0.288
droidViewer 4.0.178 and .179
guiDesigner 2.7.0.713

Tulio

unread,
Jan 8, 2014, 12:12:13 PM1/8/14
to comman...@googlegroups.com
Guys, any idea to solve the problem of CF.loadAsset? 

I used colopicker module in a customer but unfortunately he doesn't have internet connection, so my workaround didn't work.

CF team, Clayton, Barry, please help :-)

Clayton Vicente

unread,
Jan 8, 2014, 12:15:32 PM1/8/14
to comman...@googlegroups.com
If you want, send me the project. I can take look tonight. You are home, you can always contact me directly :) I don´t know if will be able to help...but we can try.
Regards
Clayton


Date: Wed, 8 Jan 2014 09:12:13 -0800
From: tulio....@gmail.com
To: comman...@googlegroups.com
Subject: Re: CF.loadAsset apparently is not loading from cache
--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jarrod Bell

unread,
Jan 8, 2014, 6:18:17 PM1/8/14
to comman...@googlegroups.com
In the color picker code, try editing the CF.loadAsset call to include a final parameter to force caching:

CF.loadAsset(self.imageURL, CF.BINARY, function (data) {
                        self.img.src = "data:image/png;base64," + encode64(data);
                }, CF.CACHE);

As per the docs, this caching mode was only added in newer versions of iViewer, well after the color picker script was created:
http://commandfusion.com/docs/scripting/util.html#cF.loadAsset

Please report back if this fixes the issue and I will update the script on GitHub.

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--

Tulio

unread,
Jan 8, 2014, 8:19:49 PM1/8/14
to comman...@googlegroups.com, jar...@commandfusion.com
Sorry, it didn't work. I forgot to say that I already tested this option, without success. 

Only with upload service activated in guiDesigner I can use the color picker. JS always try to get the file in server.

As workaround, I replace the variable self.imageURL to "http://momenti.com.br/images/colorpicker.png" . But it works only with internet connection (PS. don't try to use this path in original color picker code, I changed the size of colopicker.png in my project)

Florent Pillet

unread,
Jan 10, 2014, 6:31:24 PM1/10/14
to comman...@googlegroups.com
Tulio, please give a go to 4.0.180. It fixes a couple issues related to CF.loadAsset (among others). May not completely fix your case yet, but would like to hear your word on this.

Thanks!
Florent

On 09 Jan 2014, at 02:19, Tulio <tulio....@gmail.com> wrote:

Sorry, it didn't work. I forgot to say that I already tested this option, without success. 

Only with upload service activated in guiDesigner I can use the color picker. JS always try to get the file in server.




--
Florent Pillet - Software Engineering Lead



Tulio

unread,
Jan 11, 2014, 8:47:45 PM1/11/14
to comman...@googlegroups.com
Hi Florent,
same behaviour. It loads the image only with upload service is activated. I tried with and without the option CF.CACHE

Tested in iViewer Next 4.0.290 and droidViewer 4.0.180 in android 2.3.4 (chinese tablet) and 4.0.4 (rikomagic clone and bluestatcks). Could not test in Motorola Moto G 4.3, because it is traveling with my wife. 

Florent Pillet

unread,
Jan 15, 2014, 6:38:47 AM1/15/14
to comman...@googlegroups.com
Ah found the issue - there's a constant mismatch between what JS uses and what we use internally in the native code, therefore CF.CACHE is being handled as CF.NO_CACHE.

Fixing this for the next release. Thanks for pointing it out - will push a new Android build in the coming day, iOS build coming up soon too.

Florent

On 12 Jan 2014, at 02:47, Tulio <tulio....@gmail.com> wrote:

Hi Florent,
same behaviour. It loads the image only with upload service is activated. I tried with and without the option CF.CACHE

Tested in iViewer Next 4.0.290 and droidViewer 4.0.180 in android 2.3.4 (chinese tablet) and 4.0.4 (rikomagic clone and bluestatcks). Could not test in Motorola Moto G 4.3, because it is traveling with my wife. 




Florent Pillet

unread,
Jan 15, 2014, 12:09:40 PM1/15/14
to comman...@googlegroups.com
Thanks for reporting, Tulio. Issue has been fixed in TF 4.0.294 for iOS, new Android version coming on the Play Store soon.

Florent

On 12 Jan 2014, at 02:47, Tulio <tulio....@gmail.com> wrote:

Hi Florent,
same behaviour. It loads the image only with upload service is activated. I tried with and without the option CF.CACHE

Tested in iViewer Next 4.0.290 and droidViewer 4.0.180 in android 2.3.4 (chinese tablet) and 4.0.4 (rikomagic clone and bluestatcks). Could not test in Motorola Moto G 4.3, because it is traveling with my wife. 

Florent Pillet

unread,
Jan 16, 2014, 5:57:06 PM1/16/14
to comman...@googlegroups.com
Hi Tulio,

We believe that iViewer for Android build 4.0.182 fixes the issue.

Florent

On 12 Jan 2014, at 02:47, Tulio <tulio....@gmail.com> wrote:

> Hi Florent,
> same behaviour. It loads the image only with upload service is activated. I tried with and without the option CF.CACHE
>
> Tested in iViewer Next 4.0.290 and droidViewer 4.0.180 in android 2.3.4 (chinese tablet) and 4.0.4 (rikomagic clone and bluestatcks). Could not test in Motorola Moto G 4.3, because it is traveling with my wife.
>



Tulio

unread,
Jan 16, 2014, 6:29:57 PM1/16/14
to
sorry, iViewer 4.0.182 still with the same issue in Android 4.0.4(bluestacks) and 2.3.4(chinese tablet).
I tested with all options of argument this time

To test it, you should stop upload service,  force stop of iviewer app in android and then open again iviewer. Touch the screen and you will not see movement or RGB updateing
colorpicker.gui.zip

Florent Pillet

unread,
Jan 17, 2014, 9:00:23 AM1/17/14
to comman...@googlegroups.com
Try the just-released 4.0.183. Should be fine now. There was an issue with passing cached binary data back to JS when you call CF.loadAsset() that went unnoticed.

Florent

On 17 Jan 2014, at 00:29, Tulio <tulio....@gmail.com> wrote:

sorry, iViewer 4.0.182 still with the same issue in Android 4.0.4(bluestacks) and 2.3.4(chinese tablet).
I tested with all options of argument this time

To test it, you should stop upload service,  force stop of iviewer app in android and then oepn again iviewer. Touch the screen and you will not see movement or RGB updateing

Tulio

unread,
Jan 17, 2014, 11:03:05 AM1/17/14
to comman...@googlegroups.com
problem solved in iViewer 4.0.183 for Android
waiting for new version of iviewer for iOS, or perhaps an access to TF :-) 
thanks

Tulio

unread,
Feb 23, 2014, 2:59:25 PM2/23/14
to comman...@googlegroups.com
problem solved also in iViewer 4.0.296 for iOS

sandor...@smarthousecontrol.eu

unread,
Oct 19, 2015, 4:54:02 AM10/19/15
to CommandFusion Software
Hi Everyone,

I experience the same issue on iPad Mini iOS 9.0.2, iViewer4 v4.0.303.

My workaround is that I created a persisting global token and when the image loads for the first time I store self.img.src value in a this token. Next time it tries to load the file and fails I just get the stored value from the persistent token. 

the modified code:
CF.loadAsset(self.imageURL, CF.BINARY, function (data) {
   if (data != null) {
      self.img.src = "data:image/png;base64," + encode64(data);
      // load ok, save to persistent global token
      CF.setToken(CF.GlobalTokensJoin, "[colourpicker]", self.img.src);
   }
   else {
      CF.log("data = null loading from persistent global token");
      CF.getJoin(CF.GlobalTokensJoin, function(j, v, tokens, tags) {
         self.img.src = tokens["[colourpicker]"];
      });
   }
}, CF.CACHE);



Cheers
Sandor
Reply all
Reply to author
Forward
0 new messages