theme.res file in iphone

25 views
Skip to first unread message

Fuad Nassar

unread,
Dec 2, 2018, 11:55:19 AM12/2/18
to CodenameOne Discussions
Hi ,
 If I reverse engineer on the ios app, can I find the theme.res file?
or it will convert to another file!!
thanks in advance ..

Shai Almog

unread,
Dec 3, 2018, 12:15:32 AM12/3/18
to CodenameOne Discussions
Hi,
yes. You can unzip the IPA and the theme.res file will be there. When we used to have GUI builder files there that was a problem and we added some rudimentary password protection functionality to the file. However, since the file only packages images/localization and theme in newer projects we didn't bother with it as much and the password protection functionality is something we haven't used in ages.

Fuad Nassar

unread,
Dec 4, 2018, 8:16:54 AM12/4/18
to CodenameOne Discussions
 i have a simple idea that will build any project including size theme.res more 50mb  with a free account ^^ 
This would increase the powering of codename one and it will bring more developers for it

Shai Almog

unread,
Dec 5, 2018, 12:40:46 AM12/5/18
to CodenameOne Discussions
Do you mean downloading the theme.res file dynamically on first load of the app?
You can do that.

If you mean to unzip the IPA/APK and replace theme.res within it that won't work. These bundles are signed.
Message has been deleted

Fuad Nassar

unread,
Dec 5, 2018, 5:01:28 PM12/5/18
to CodenameOne Discussions
 yes by using these functions 
// 1)
    /**
     *
     * @param Url :  direct link that can be downloading theme.res file 
     * @param name : name theme file  to saving that in FileSystemStorage  e.g theme.res
     * @return path in FileSystemStorage for theme downloaded
     */
    public static String downloadTheme(String Url,String name,boolean progress){
    String pathTheme =FileSystemStorage.getInstance().getAppHomePath()+name;
       Util.downloadUrlToFile(Url, pathTheme, progress);
         return pathTheme;
    }


// 2)
 public static Resources initFirstTheme(String pathTheme) {
        try {
            Resources theme =  getTheme(pathTheme);
            UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
            Resources.setGlobalResources(theme);
            return theme;
        } catch(Exception e){
            Log.e(e);
        }
        return null;
    }


// 3)
    /**
     *
     * @param pathTheme in FileSystemStorage
     * @return theme
     */
    public static Resources getTheme(String pathTheme){
       InputStream resource = null;
        Resources theme = null;
           
        try {
            resource = FileSystemStorage.getInstance().openInputStream(pathTheme);      
        } catch (IOException ex) {
             ///...
        }
        
        
        try {
            if (resource != null) {
                 theme = Resources.open(resource);
            } else {
                 ///...
            }
        } catch (IOException ex) {
           ///...
        }
        

     return theme; 
}

Shai Almog

unread,
Dec 6, 2018, 1:15:00 AM12/6/18
to CodenameOne Discussions
This shouldn't be a problem. Notice we recommend having a very simple theme as the base so you can show a progress/download UI then add the second theme as an addThemeProps.
Reply all
Reply to author
Forward
0 new messages