Class CodeModifier
java.lang.Object
com.iizix.run.common.CodeModifier
Class to help with JS code modification in order to match the app settings.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]The Apple App Store category identifiers (LSApplicationCategoryType, Apple's fixed list ofpublic.app-category.*UTIs) by the index the settingapp_categorystores: ID 1 isAPP_CATEGORIES[0]; 0 or absent is "none".static final String[]The plain-English name of each entry ofAPP_CATEGORIES, by the same index (Apple's own names).static final String[]The Dojo supported locales used for "extraLocales".The hash set with Dojo locales.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptioncreateSource_Build_JSON(RuntimeBuilderSettings settings, File appDir, boolean isVerbose) Creates the "build.json" file.static StringgetAppCategory(int appCategory) Gets the Apple App Store category identifier of a storedapp_categoryindex.getClassPath(Class<?> clazz) Gets the classpath from a class.static StringgetDojoLanguageCode(String languageCode) Gets the locale that matches the Dojo locale if possible.Gets a file from the resources.getLanguageStringsMap(RuntimeBuilderSettings settings) Gets the English language strings required in "msg.js" for internal build or "msg-customized.js" for customized iiziRun's.getZipFile(String name) Gets a ZIP file from the resources.static List<com.iizix.run.common.CodeModifier.Texts> loadTextFile(File dir) Loads the localized text entries from the files.protected URLResolves the resources/dojo.zip from the URL.List<com.iizix.run.common.CodeModifier.Texts> writeTextFile(File dir, RuntimeBuilderSettings settings) Writes all the text's used in the app, for all text tables into an UTF-8 encoded file that is read later on by the pre-build processor to Android, iOS or Android.
Field Details
DOJO_LOCALES
The Dojo supported locales used for "extraLocales".APP_CATEGORIES
The Apple App Store category identifiers (LSApplicationCategoryType, Apple's fixed list ofpublic.app-category.*UTIs) by the index the settingapp_categorystores: ID 1 isAPP_CATEGORIES[0]; 0 or absent is "none". The 21 main categories come first, then Apple's 19 game subcategories (IDs 22..40, appended 2026-11-01, CC-IIZIRUN-IOS-CATEGORY). A stored index keeps its meaning: a new entry is APPENDED at the end, never inserted.APP_CATEGORY_NAMESnames each entry in plain English; the iiziRun Builder page of iiziGo builds its choice list from the two (the single source of the list), andgetAppCategory(int)maps a stored index to its identifier.APP_CATEGORY_NAMES
The plain-English name of each entry ofAPP_CATEGORIES, by the same index (Apple's own names).dojoLocales
Constructor Details
CodeModifier
Constructor with the settings.- Throws:
IOException- If the resources directory cannot be found.
Method Details
getDojoLanguageCode
getAppCategory
Gets the Apple App Store category identifier of a storedapp_categoryindex.- Parameters:
appCategory- The index as the setting stores it: 1 = the first entry ofAPP_CATEGORIES.- Returns:
- The
public.app-category.*identifier, or null when the index is 0 (none) or outside the list.
resolve
Resolves the resources/dojo.zip from the URL.- Parameters:
url- to the file "dojo.zip" in resources directory.- Returns:
- The resolved URL.
- Throws:
IOException- For I/O errors.
getClassPath
Gets the classpath from a class.- Parameters:
clazz- The class to check.- Returns:
- The File for the classpath.
- Throws:
IOException- For I/O errors.
getFile
Gets a file from the resources.- Parameters:
name- The name of the file.- Returns:
- The File.
- Throws:
IOException- For I/O errors.
getZipFile
Gets a ZIP file from the resources.- Parameters:
name- The name of the ZIP file.- Returns:
- The ZipFile.
- Throws:
IOException- For I/O errors.
getLanguageStringsMap
public Map<String,String> getLanguageStringsMap(RuntimeBuilderSettings settings) throws FileNotFoundException, IOException Gets the English language strings required in "msg.js" for internal build or "msg-customized.js" for customized iiziRun's.- Parameters:
settings- The settings, null if normal customized iiziRun's.- Returns:
- A new map of the strings, key is the text ID and the value is the text.
- Throws:
IOException- For file errors.FileNotFoundException
writeTextFile
public List<com.iizix.run.common.CodeModifier.Texts> writeTextFile(File dir, RuntimeBuilderSettings settings) throws IOException Writes all the text's used in the app, for all text tables into an UTF-8 encoded file that is read later on by the pre-build processor to Android, iOS or Android.- Parameters:
dir- The root directory where "config.xml" is located.settings- The settings.- Throws:
IOException- For file errors.
loadTextFile
public static List<com.iizix.run.common.CodeModifier.Texts> loadTextFile(File dir) throws IOException Loads the localized text entries from the files.- Parameters:
dir- The app's root directory where "config.xml" is located.- Throws:
IOException- For file errors.
createSource_Build_JSON
public String createSource_Build_JSON(RuntimeBuilderSettings settings, File appDir, boolean isVerbose) Creates the "build.json" file.- Parameters:
settings- The settings.appDir- The root of the Cordova app dir.- Returns:
- null for success, otherwise an error message that has been logged already.