@maccesar/titools 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/AGENTS-TEMPLATE.md +173 -0
  2. package/README.md +867 -0
  3. package/agents/ti-researcher.md +108 -0
  4. package/bin/titools.js +53 -0
  5. package/lib/commands/agents.js +126 -0
  6. package/lib/commands/install.js +188 -0
  7. package/lib/commands/uninstall.js +215 -0
  8. package/lib/commands/update.js +159 -0
  9. package/lib/config.js +119 -0
  10. package/lib/downloader.js +153 -0
  11. package/lib/installer.js +253 -0
  12. package/lib/platform.js +108 -0
  13. package/lib/symlink.js +142 -0
  14. package/lib/utils.js +270 -0
  15. package/package.json +67 -0
  16. package/skills/alloy-expert/SKILL.md +247 -0
  17. package/skills/alloy-expert/assets/ControllerAutoCleanup.js +182 -0
  18. package/skills/alloy-expert/references/alloy-structure.md +381 -0
  19. package/skills/alloy-expert/references/anti-patterns.md +133 -0
  20. package/skills/alloy-expert/references/code-conventions.md +469 -0
  21. package/skills/alloy-expert/references/contracts.md +280 -0
  22. package/skills/alloy-expert/references/controller-patterns.md +520 -0
  23. package/skills/alloy-expert/references/error-handling.md +484 -0
  24. package/skills/alloy-expert/references/examples.md +735 -0
  25. package/skills/alloy-expert/references/migration-patterns.md +298 -0
  26. package/skills/alloy-expert/references/patterns.md +448 -0
  27. package/skills/alloy-expert/references/performance-patterns.md +855 -0
  28. package/skills/alloy-expert/references/security-patterns.md +847 -0
  29. package/skills/alloy-expert/references/state-management.md +779 -0
  30. package/skills/alloy-expert/references/testing.md +872 -0
  31. package/skills/alloy-guides/SKILL.md +214 -0
  32. package/skills/alloy-guides/references/CLI_TASKS.md +243 -0
  33. package/skills/alloy-guides/references/CONCEPTS.md +191 -0
  34. package/skills/alloy-guides/references/CONTROLLERS.md +298 -0
  35. package/skills/alloy-guides/references/MODELS.md +1028 -0
  36. package/skills/alloy-guides/references/PURGETSS.md +56 -0
  37. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +242 -0
  38. package/skills/alloy-guides/references/VIEWS_STYLES.md +388 -0
  39. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +109 -0
  40. package/skills/alloy-guides/references/VIEWS_XML.md +558 -0
  41. package/skills/alloy-guides/references/WIDGETS.md +176 -0
  42. package/skills/alloy-howtos/SKILL.md +203 -0
  43. package/skills/alloy-howtos/references/best_practices.md +138 -0
  44. package/skills/alloy-howtos/references/cli_reference.md +253 -0
  45. package/skills/alloy-howtos/references/config_files.md +87 -0
  46. package/skills/alloy-howtos/references/custom_tags.md +147 -0
  47. package/skills/alloy-howtos/references/debugging_troubleshooting.md +101 -0
  48. package/skills/alloy-howtos/references/samples.md +167 -0
  49. package/skills/purgetss/SKILL.md +442 -0
  50. package/skills/purgetss/assets/purgetss.config.cjs +17 -0
  51. package/skills/purgetss/references/EXAMPLES.md +247 -0
  52. package/skills/purgetss/references/animation-system.md +1294 -0
  53. package/skills/purgetss/references/apply-directive.md +375 -0
  54. package/skills/purgetss/references/arbitrary-values.md +612 -0
  55. package/skills/purgetss/references/class-index.md +1350 -0
  56. package/skills/purgetss/references/cli-commands.md +948 -0
  57. package/skills/purgetss/references/configurable-properties.md +654 -0
  58. package/skills/purgetss/references/custom-rules.md +161 -0
  59. package/skills/purgetss/references/customization-deep-dive.md +722 -0
  60. package/skills/purgetss/references/dynamic-component-creation.md +489 -0
  61. package/skills/purgetss/references/grid-layout.md +455 -0
  62. package/skills/purgetss/references/icon-fonts.md +609 -0
  63. package/skills/purgetss/references/installation-setup.md +366 -0
  64. package/skills/purgetss/references/opacity-modifier.md +291 -0
  65. package/skills/purgetss/references/platform-modifiers.md +479 -0
  66. package/skills/purgetss/references/smart-mappings.md +42 -0
  67. package/skills/purgetss/references/titanium-resets.md +359 -0
  68. package/skills/purgetss/references/ui-ux-design.md +1526 -0
  69. package/skills/ti-guides/SKILL.md +94 -0
  70. package/skills/ti-guides/references/advanced-data-and-images.md +19 -0
  71. package/skills/ti-guides/references/alloy-cli-advanced.md +84 -0
  72. package/skills/ti-guides/references/alloy-data-mastery.md +29 -0
  73. package/skills/ti-guides/references/alloy-widgets-and-themes.md +19 -0
  74. package/skills/ti-guides/references/android-manifest.md +97 -0
  75. package/skills/ti-guides/references/app-distribution.md +258 -0
  76. package/skills/ti-guides/references/application-frameworks.md +377 -0
  77. package/skills/ti-guides/references/cli-reference.md +402 -0
  78. package/skills/ti-guides/references/coding-best-practices.md +102 -0
  79. package/skills/ti-guides/references/commonjs-advanced.md +134 -0
  80. package/skills/ti-guides/references/hello-world.md +100 -0
  81. package/skills/ti-guides/references/hyperloop-native-access.md +62 -0
  82. package/skills/ti-guides/references/javascript-primer.md +411 -0
  83. package/skills/ti-guides/references/reserved-words.md +36 -0
  84. package/skills/ti-guides/references/resources.md +183 -0
  85. package/skills/ti-guides/references/style-and-conventions.md +48 -0
  86. package/skills/ti-guides/references/tiapp-config.md +609 -0
  87. package/skills/ti-howtos/SKILL.md +174 -0
  88. package/skills/ti-howtos/references/android-platform-deep-dives.md +658 -0
  89. package/skills/ti-howtos/references/automation-fastlane-appium.md +95 -0
  90. package/skills/ti-howtos/references/buffer-codec-streams.md +140 -0
  91. package/skills/ti-howtos/references/cross-platform-development.md +348 -0
  92. package/skills/ti-howtos/references/debugging-profiling.md +543 -0
  93. package/skills/ti-howtos/references/extending-titanium.md +723 -0
  94. package/skills/ti-howtos/references/google-maps-v2.md +169 -0
  95. package/skills/ti-howtos/references/ios-map-kit.md +143 -0
  96. package/skills/ti-howtos/references/ios-platform-deep-dives.md +783 -0
  97. package/skills/ti-howtos/references/local-data-sources.md +301 -0
  98. package/skills/ti-howtos/references/location-and-maps.md +252 -0
  99. package/skills/ti-howtos/references/media-apis.md +210 -0
  100. package/skills/ti-howtos/references/notification-services.md +599 -0
  101. package/skills/ti-howtos/references/remote-data-sources.md +349 -0
  102. package/skills/ti-howtos/references/tutorials.md +502 -0
  103. package/skills/ti-howtos/references/using-modules.md +237 -0
  104. package/skills/ti-howtos/references/web-content-integration.md +307 -0
  105. package/skills/ti-howtos/references/webpack-build-pipeline.md +78 -0
  106. package/skills/ti-ui/SKILL.md +179 -0
  107. package/skills/ti-ui/references/accessibility-deep-dive.md +242 -0
  108. package/skills/ti-ui/references/animation-and-matrices.md +599 -0
  109. package/skills/ti-ui/references/application-structures.md +655 -0
  110. package/skills/ti-ui/references/custom-fonts-styling.md +579 -0
  111. package/skills/ti-ui/references/event-handling.md +393 -0
  112. package/skills/ti-ui/references/gestures.md +473 -0
  113. package/skills/ti-ui/references/icons-and-splash-screens.md +409 -0
  114. package/skills/ti-ui/references/layouts-and-positioning.md +462 -0
  115. package/skills/ti-ui/references/listviews-and-performance.md +619 -0
  116. package/skills/ti-ui/references/orientation.md +362 -0
  117. package/skills/ti-ui/references/platform-ui-android.md +635 -0
  118. package/skills/ti-ui/references/platform-ui-ios.md +469 -0
  119. package/skills/ti-ui/references/scrolling-views.md +252 -0
  120. package/skills/ti-ui/references/tableviews.md +568 -0
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: ti-guides
3
+ description: "Titanium SDK official fundamentals and configuration guide. Use when working with, reviewing, analyzing, or examining Titanium projects, Hyperloop native access, app distribution (App Store/Google Play), tiapp.xml configuration, CLI commands, memory management, bridge optimization, CommonJS modules, SQLite transactions, or coding standards. Applies to both Alloy and Classic projects."
4
+ argument-hint: "[topic]"
5
+ allowed-tools: Read, Grep, Glob, Edit, Write, Bash(node *)
6
+ ---
7
+
8
+ # Titanium SDK Guide Expert
9
+
10
+ This skill ensures Titanium projects follow TiDev standards for stability, performance, and cross-platform reliability.
11
+
12
+ ## Project Detection
13
+
14
+ :::info AUTO-DETECTS TITANIUM PROJECTS
15
+ This skill automatically detects Titanium projects when invoked and provides SDK-specific guidance.
16
+
17
+ **Detection occurs automatically** - no manual command needed.
18
+
19
+ **Titanium project indicator:**
20
+ - `tiapp.xml` file (definitive indicator)
21
+
22
+ **Applicable to BOTH:**
23
+ - **Alloy projects** (app/ folder)
24
+ - **Classic projects** (Resources/ folder)
25
+
26
+ **Behavior based on detection:**
27
+ - **Titanium detected** → Provides official Titanium SDK guidance, memory management best practices, app distribution help
28
+ - **Not detected** → Indicates this is for Titanium projects only
29
+ :::
30
+
31
+ ## Table of Contents
32
+
33
+ - [Titanium SDK Guide Expert](#titanium-sdk-guide-expert)
34
+ - [Project Detection](#project-detection)
35
+ - [Table of Contents](#table-of-contents)
36
+ - [Core Workflow](#core-workflow)
37
+ - [Procedural Rules (Low Freedom)](#procedural-rules-low-freedom)
38
+ - [Reference Guides (Progressive Disclosure)](#reference-guides-progressive-disclosure)
39
+ - [Related Skills](#related-skills)
40
+ - [Response Format](#response-format)
41
+
42
+ ---
43
+
44
+ ## Core Workflow
45
+
46
+ 1. **Architecture Check**: Validate that the project follows a modular pattern (CommonJS or Alloy).
47
+ 2. **Memory Review**: Ensure all global listeners are removed and heavy objects are nulled during cleanup.
48
+ 3. **Bridge Optimization**: Identify and cache frequently accessed native properties to minimize bridge crossings.
49
+ 4. **Native Integration**: Use Hyperloop for specialized native functionality, ensuring proper casting and thread management.
50
+ 5. **Asset Management**: Optimize database operations with transactions and manage image memory footprints.
51
+
52
+ ## Procedural Rules (Low Freedom)
53
+
54
+ - **Memory Hygiene**: Always remove `Ti.App` and `Ti.Geolocation` listeners in the controller cleanup phase.
55
+ - **No Bridge Calls in Loops**: Never access `Ti.Platform` or `Ti.DisplayCaps` inside loops; store values in local variables.
56
+ - **Hyperloop Naming**: Concatenate selectors accurately (e.g., `addAttribute:value:range:` -> `addAttributeValueRange`).
57
+ - **DB Persistence**: Always close resultsets and database handles after every transaction block.
58
+
59
+ ## Reference Guides (Progressive Disclosure)
60
+
61
+ - **[Hello World](references/hello-world.md)**: Project creation, structure, and getting started with Alloy or Classic Titanium.
62
+ - **[JavaScript Primer](references/javascript-primer.md)**: JavaScript fundamentals, learning resources, best practices, and ES6+ features.
63
+ - **[Application Frameworks](references/application-frameworks.md)**: Alloy vs Classic Titanium, architectural patterns, and framework selection.
64
+ - **[Coding Best Practices](references/coding-best-practices.md)**: Memory leaks, bridge efficiency, event naming, security, and lazy loading.
65
+ - **[CommonJS Advanced](references/commonjs-advanced.md)**: Stateful modules, caching, ES6+ support, and antipatterns.
66
+ - **[Advanced Data & Images](references/advanced-data-and-images.md)**: SQLite transactions and image memory optimization.
67
+ - **[Hyperloop Native Access](references/hyperloop-native-access.md)**: Objective-C/Swift/Java syntax, casting, debugging, XIB/Storyboards.
68
+ - **[Style & Conventions](references/style-and-conventions.md)**: Naming standards and formatting rules.
69
+ - **[Reserved Words](references/reserved-words.md)**: ECMAScript, iOS, and Alloy reserved keywords to avoid.
70
+ - **[Alloy CLI Reference](references/alloy-cli-advanced.md)**: extract-i18n, code generation, and build hooks.
71
+ - **[Alloy Data Mastery](references/alloy-data-mastery.md)**: Sync adapters, data binding, and Backbone collections.
72
+ - **[Alloy Widgets & Themes](references/alloy-widgets-and-themes.md)**: Widget structure, styling priorities, and theming.
73
+ - **[Android Manifest](references/android-manifest.md)**: Custom AndroidManifest.xml, permissions, and manifest merge.
74
+ - **[App Distribution](references/app-distribution.md)**: Google Play (APK/AAB), App Store (IPA), certificates, provisioning, and deployment.
75
+ - **[tiapp.xml Configuration](references/tiapp-config.md)**: Complete reference for tiapp.xml and timodule.xml, including all elements, properties, and platform-specific settings.
76
+ - **[CLI Reference](references/cli-reference.md)**: Titanium CLI commands, options, tasks, configuration, and build processes.
77
+ - **[Resources](references/resources.md)**: Community support, modules, sample code, Slack, and learning materials.
78
+
79
+ ## Related Skills
80
+
81
+ For tasks beyond SDK fundamentals, use these complementary skills:
82
+
83
+ | Task | Use This Skill |
84
+ | ---------------------------------------- | -------------- |
85
+ | Project architecture, services, patterns | `alloy-expert` |
86
+ | Native features (location, push, media) | `ti-howtos` |
87
+ | Alloy CLI, configuration, debugging | `alloy-howtos` |
88
+ | UI layouts, ListViews, gestures | `ti-ui` |
89
+
90
+ ## Response Format
91
+
92
+ 1. **Technical Recommendation**: Cite the specific TiDev best practice.
93
+ 2. **Optimized Implementation**: Provide modern ES6+ code without semicolons.
94
+ 3. **Rationale**: Briefly explain the performance or memory impact.
@@ -0,0 +1,19 @@
1
+ # Advanced Database and Image Best Practices
2
+
3
+ ## 1. SQLite Optimization
4
+ - **Close Everything**: Always `resultSet.close()` and `db.close()` after each operation to avoid locks and memory bloat.
5
+ - **Transactions**: Use `BEGIN` and `COMMIT` for batch inserts. It is significantly faster.
6
+ ```javascript
7
+ db.execute('BEGIN');
8
+ // loop inserts
9
+ db.execute('COMMIT');
10
+ ```
11
+ - **Database Skeleton**: Do not ship large pre-populated databases. Ship a "skeleton" and download data on first boot to reduce IPA/APK size.
12
+
13
+ ## 2. Image Memory Management
14
+ - **Memory Footprint**: A JPG is tiny on disk but consumes `width * height * 3 bytes` in RAM.
15
+ - **Unloading**:
16
+ - `view.remove(imageView)` to help the OS free memory.
17
+ - Set `imageView = null` to release the native proxy.
18
+ - **Resizing**: Always resize images to their display dimensions via `imageAsResized` before setting the `image` property.
19
+ - **Caching**: iOS caches remote images automatically, but you should manually cache critical assets in `applicationDataDirectory` for predictability.
@@ -0,0 +1,84 @@
1
+ # Alloy CLI Reference
2
+
3
+ The `alloy` command is the primary interface for managing Alloy metadata and automation.
4
+
5
+ ## 1. Internationalization (i18n) Extraction
6
+
7
+ Instead of manually managing `strings.xml`, use the `extract-i18n` command to automatically scan your XML, JS, and TSS files for `L()` or `Ti.Locale.getString()` calls.
8
+
9
+ ### Syntax
10
+ ```bash
11
+ # Preview the strings found in the project
12
+ alloy extract-i18n [language]
13
+
14
+ # Create or update the strings.xml file
15
+ alloy extract-i18n [language] --apply
16
+ ```
17
+
18
+ ### Key Benefits
19
+ - **Accuracy**: Ensures all strings used in code are present in the translation files
20
+ - **Safety**: The `--apply` flag only adds new entries and never deletes or overwrites existing ones
21
+ - **Efficiency**: Faster than manual entry and prevents human error
22
+
23
+ ## 2. Code Generation
24
+
25
+ Generate components from templates to speed up development:
26
+
27
+ ```bash
28
+ # Create a new controller
29
+ alloy generate controller <name>
30
+
31
+ # Generate other component types
32
+ alloy generate view <name>
33
+ alloy generate model <name>
34
+ alloy generate widget <name>
35
+ alloy generate migration <name>
36
+ ```
37
+
38
+ ## 3. Installation Commands
39
+
40
+ Install specialized components or themes:
41
+
42
+ ```bash
43
+ # Install a widget or theme
44
+ alloy install widget <path>
45
+ alloy install theme <path>
46
+ ```
47
+
48
+ ## 4. Project Conversion
49
+
50
+ Convert a Classic Titanium project to Alloy:
51
+
52
+ ```bash
53
+ alloy new
54
+ ```
55
+
56
+ ## 5. Configuration Files
57
+
58
+ ### `config.json`
59
+ Global app configuration file. Can store:
60
+ - Theme settings (`theme: "theme_name"`)
61
+ - Environment variables
62
+ - Per-platform themes
63
+ - App-specific metadata
64
+
65
+ ### `alloy.js`
66
+ Global initializer executed before any controllers. Perfect for:
67
+ - Creating `Alloy.Collections`
68
+ - Setting up `Alloy.Globals`
69
+ - Initializing singletons
70
+ - Configuring global event listeners
71
+
72
+ ### `alloy.jmk`
73
+ Build configuration file for pre-compile and post-compile hooks:
74
+ ```javascript
75
+ task('pre:compile', (event, logger) => {
76
+ // Run before compilation
77
+ // Example: Auto-run PurgeTSS
78
+ });
79
+ ```
80
+
81
+ Common use cases:
82
+ - Auto-running PurgeTSS
83
+ - Custom asset processing
84
+ - Environment-specific configurations
@@ -0,0 +1,29 @@
1
+ # Alloy Data Mastery: Sync Adapters and Binding
2
+
3
+ ## 1. Sync Adapters
4
+ Sync adapters connect Backbone Models to persistent storage.
5
+ - **Ready-Made Adapters**:
6
+ - `sql`: SQLite (Android/iOS). Supports `query` in `fetch()` and `idAttribute`.
7
+ - `properties`: `Ti.App.Properties` storage.
8
+ - **Custom Adapters**: Created in `app/lib/alloy/sync`. Requires `sync` function implementation.
9
+ - **Migrations**: Incremental database changes. Named `YYYYMMDDHHmmss_model.js`.
10
+ - **CRITICAL**: Do not close the `db` handle or open a second instance within a migration.
11
+
12
+ ## 2. Data Binding Principles
13
+ - **Collection Binding**: Bind a collection to a container (ListView, TableView, ScrollableView).
14
+ - Mandatory: `dataCollection` attribute.
15
+ - Optional: `dataTransform` (JSON mapping), `dataFilter` (filtering models), `dataFunction` (manual update trigger).
16
+ - **Model Binding**: Bind a single model to a view (e.g., `<Label text="{model.name}" />`).
17
+ - **Memory Management**: **CRITICAL**: You MUST call `$.destroy()` on the controller's `close` event to unbind Backbone listeners and prevent leaks.
18
+
19
+ ## 3. High-Performance Transformations
20
+ - **Lazy Transformation**: Use `Object.defineProperty` in `extendModel` to compute transformations only when accessed.
21
+ ```javascript
22
+ transform() {
23
+ const t = this.toJSON();
24
+ Object.defineProperty(t, 'friendlyDate', {
25
+ get: () => moment(t.date).fromNow()
26
+ });
27
+ return t;
28
+ }
29
+ ```
@@ -0,0 +1,19 @@
1
+ # Alloy Widgets and Themes
2
+
3
+ ## 1. Widgets (Self-contained components)
4
+ - **Structure**: Mirror the `app` directory. Main controller is `widget.js`.
5
+ - **Public API**: Methods prefixed with `$` are public (e.g., `$.init = (args) => {}`).
6
+ - **Resource Access**: Use `WPATH()` for widget assets and libs (e.g., `require(WPATH('helper'))`).
7
+ - **Nesting**: Widgets can contain other widgets via `<Widget src="widgetName" name="subController" />`.
8
+
9
+ ## 2. Styling Priorities (Low to High)
10
+ 1. `app.tss` (Global)
11
+ 2. `themes/<name>/styles/app.tss` (Theme Global)
12
+ 3. `styles/<controller>.tss` (Controller Style)
13
+ 4. `themes/<name>/styles/<controller>.tss` (Theme Controller Style)
14
+ 5. XML attributes (Inline Style)
15
+
16
+ ## 3. Themes
17
+ - Located in `app/themes/<theme_name>`.
18
+ - Merges `config.json`, `i18n`, and `styles`. Overwrites `assets` and `lib`.
19
+ - Configured in `config.json` via the `theme` key. Supports per-platform themes.
@@ -0,0 +1,97 @@
1
+ # Custom AndroidManifest.xml
2
+
3
+ For most Android manifest settings, use `tiapp.xml`. Only create a custom manifest when absolutely necessary.
4
+
5
+ ## Preferred Method: tiapp.xml
6
+
7
+ Add manifest entries in `tiapp.xml` inside the `<android>` section:
8
+
9
+ ```xml
10
+ <android xmlns:android="http://schemas.android.com/apk/res/android">
11
+ <manifest>
12
+ <!-- SDK version -->
13
+ <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34" />
14
+
15
+ <!-- Screen support -->
16
+ <supports-screens
17
+ android:smallScreens="false"
18
+ android:normalScreens="true"
19
+ android:largeScreens="true"
20
+ android:xlargeScreens="true"
21
+ />
22
+
23
+ <!-- Permissions -->
24
+ <uses-permission android:name="android.permission.CAMERA" />
25
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
26
+
27
+ <!-- Application attributes (merged, not replaced) -->
28
+ <application android:debuggable="true" />
29
+ </manifest>
30
+ </android>
31
+ ```
32
+
33
+ ## How Merging Works
34
+
35
+ - **Most elements**: Replaced by your entry
36
+ - **`<application>` element**: Attributes are merged additively
37
+ - **Activities/Services**: Added to existing ones
38
+
39
+ ## Custom Manifest (Rare Cases)
40
+
41
+ If you need full control, create `platform/android/AndroidManifest.xml`:
42
+
43
+ ```
44
+ MyApp/
45
+ ├── app/
46
+ ├── platform/
47
+ │ └── android/
48
+ │ └── AndroidManifest.xml # Custom manifest
49
+ └── tiapp.xml
50
+ ```
51
+
52
+ **Warning**: You must maintain this file manually through SDK updates.
53
+
54
+ ## Common Use Cases
55
+
56
+ ### Camera Permission
57
+ ```xml
58
+ <uses-permission android:name="android.permission.CAMERA" />
59
+ ```
60
+
61
+ ### Hardware Requirements
62
+ ```xml
63
+ <uses-feature android:name="android.hardware.camera" android:required="false" />
64
+ ```
65
+
66
+ ### Launch Mode
67
+ ```xml
68
+ <application android:launchMode="singleTask" />
69
+ ```
70
+
71
+ ### Deep Links
72
+ ```xml
73
+ <intent-filter>
74
+ <action android:name="android.intent.action.VIEW" />
75
+ <category android:name="android.intent.category.DEFAULT" />
76
+ <category android:name="android.intent.category.BROWSABLE" />
77
+ <data android:scheme="myapp" android:host="path" />
78
+ </intent-filter>
79
+ ```
80
+
81
+ ## Debugging
82
+
83
+ To see the generated manifest:
84
+ ```bash
85
+ ti build -p android
86
+ # Check: build/android/AndroidManifest.xml.gen
87
+ ```
88
+
89
+ ## Enable Manifest Merge (CLI 7.0+)
90
+
91
+ If using custom manifest, enable merge in `tiapp.xml`:
92
+
93
+ ```bash
94
+ ti config android.mergeCustomAndroidManifest true
95
+ ```
96
+
97
+ This merges your custom manifest with the generated one instead of replacing it.
@@ -0,0 +1,258 @@
1
+ # App Distribution Guide
2
+
3
+ Complete guide for distributing Titanium apps to Google Play (Android) and App Store (iOS).
4
+
5
+ ## Android Distribution
6
+
7
+ ### 1. Generate Keystore and Certificate
8
+
9
+ Create a keystore for signing your app:
10
+
11
+ ```bash
12
+ keytool -genkeypair -v -keystore android.keystore -alias helloworld -keyalg RSA -sigalg SHA1withRSA -validity 10000
13
+ ```
14
+
15
+ **Requirements:**
16
+ - `keyalg`: RSA (required by Google Play)
17
+ - `sigalg`: SHA1withRSA (Android 4.3-) or SHA256withRSA (Android 4.4+)
18
+ - `validity`: 10000 days minimum (~25 years)
19
+
20
+ **CRITICAL**: Save your keystore password securely. If lost, you cannot release updates.
21
+
22
+ ### 2. Verify Keystore
23
+
24
+ ```bash
25
+ keytool -list -v -keystore android.keystore
26
+ ```
27
+
28
+ ### 3. Build for Google Play
29
+
30
+ **CLI command:**
31
+ ```bash
32
+ ti build -p android -T dist-playstore [-K <KEYSTORE_FILE> -P <KEYSTORE_PASSWORD> -L <KEYSTORE_ALIAS> -O <OUTPUT_DIRECTORY>]
33
+ ```
34
+
35
+ **Example:**
36
+ ```bash
37
+ ti build -p android -T dist-playstore -K ~/android.keystore -P secret -L foo -O ./dist/
38
+ ```
39
+
40
+ **Output files:**
41
+ - `.apk` - Legacy format (still supported)
42
+ - `.aab` - Android App Bundle (preferred, smaller downloads)
43
+
44
+ ### 4. Verify APK Signing
45
+
46
+ ```bash
47
+ jarsigner -verify -verbose path/yourapp.apk
48
+ ```
49
+
50
+ ### 5. Deploy to Device for Testing
51
+
52
+ **Using CLI:**
53
+ ```bash
54
+ ti build -p android -T device --device-id "<DEVICE_ID>"
55
+ ```
56
+
57
+ **Using adb:**
58
+ ```bash
59
+ adb install -r your_project/build/android/bin/app.apk
60
+ adb uninstall com.your.appid
61
+ ```
62
+
63
+ **Remote testing:**
64
+ - Host APK on web/Dropbox and email link
65
+ - Use HockeyKit/HockeyApp for beta distribution
66
+
67
+ ### 6. Google Play Submission Requirements
68
+
69
+ **Required assets:**
70
+ - Minimum 2 screenshots (320x480, 480x800, or 480x854)
71
+ - High-res icon (512x512)
72
+ - Title, description (4000 chars max)
73
+ - Promo text (80 chars max)
74
+ - Category and content rating
75
+ - Contact information
76
+
77
+ **Versioning in tiapp.xml:**
78
+ ```xml
79
+ <android xmlns:android="http://schemas.android.com/apk/res/android">
80
+ <manifest android:versionCode="2" android:versionName="1.0.1"/>
81
+ </android>
82
+ ```
83
+
84
+ - `versionCode`: Integer, must increment for each update
85
+ - `versionName`: String, any format you prefer
86
+
87
+ ### 7. SD Card Installation
88
+
89
+ ```xml
90
+ <android xmlns:android="http://schemas.android.com/apk/res/android">
91
+ <manifest android:installLocation="preferExternal"/>
92
+ </android>
93
+ ```
94
+
95
+ Values: `preferExternal`, `auto`, `internalOnly`
96
+
97
+ ---
98
+
99
+ ## iOS Distribution
100
+
101
+ ### 1. Distribution Types
102
+
103
+ - **App Store**: Public distribution via iTunes Store
104
+ - **Ad Hoc**: Limited testing (max 100 devices)
105
+ - **In House**: Enterprise distribution for employees (Enterprise program only)
106
+
107
+ ### 2. Create Distribution Certificate
108
+
109
+ 1. Log in to [Apple Developer Member Center](https://developer.apple.com/membercenter/)
110
+ 2. Go to **Certificates, Identifiers & Profiles** > **Certificates**
111
+ 3. Click **+** > **App Store and Ad Hoc**
112
+ 4. Create a CSR (Certificate Signing Request) in Keychain Access
113
+ 5. Upload CSR and generate certificate
114
+ 6. Download and install the `.cer` file
115
+ 7. **CRITICAL**: Export private key as `.p12` file (File > Export Items)
116
+
117
+ ### 3. Create Distribution Provisioning Profile
118
+
119
+ 1. In [Member Center](https://developer.apple.com/membercenter/), go to **Provisioning Profiles**
120
+ 2. Click **+** > select distribution type
121
+ 3. Select App ID
122
+ 4. Select distribution certificate
123
+ 5. For Ad Hoc: select test devices
124
+ 6. Name profile (include "distribution" or "ad hoc")
125
+ 7. Download `.mobileprovision` and install (drag to Xcode icon)
126
+
127
+ ### 4. Create App ID on iTunes Connect
128
+
129
+ 1. Log in to [iTunes Connect](https://itunesconnect.apple.com)
130
+ 2. **Manage Your Apps** > **Add New App**
131
+ 3. Provide:
132
+ - App name
133
+ - SKU number (unique ID)
134
+ - Bundle ID (must match App ID from Developer Portal)
135
+ 4. Configure:
136
+ - Availability date
137
+ - Price tier
138
+ - Version number
139
+ - Description (4000 chars max)
140
+ - Category, keywords (100 chars max)
141
+ - Copyright
142
+ - Support URL
143
+ - Rating info
144
+ - High-res icon: 1024x1024, 72 DPI, RGB, flat artwork
145
+ - Screenshots:
146
+ - iPhone (3.5"): 960x640, 960x600, 640x960, or 640x920
147
+ - iPhone (4"): 1136x640, 1136x600, 640x1136, or 640x1096
148
+ - iPad: 1024x768, 1024x748, 768x1024, 768x1004, 2048x1536, 2048x1496, 1536x2048, or 1536x2008
149
+ 5. Click **Ready to Upload Binary**
150
+
151
+ ### 5. Build and Package
152
+
153
+ **CLI command - Ad Hoc:**
154
+ ```bash
155
+ ti build -p ios -T dist-adhoc [-R <DISTRIBUTION_CERTIFICATE_NAME> -P <PROVISIONING_PROFILE_UUID> -O <OUTPUT_DIRECTORY>]
156
+ ```
157
+
158
+ **Example:**
159
+ ```bash
160
+ ti build -p ios -T dist-adhoc -R "Pseudo, Inc." -P "FFFFFFFF-EEEE-DDDD-CCCC-BBBBBBBBBBBB" -O ./dist/
161
+ ```
162
+
163
+ **CLI command - App Store:**
164
+ ```bash
165
+ ti build -p ios -T dist-appstore [-R <DISTRIBUTION_CERTIFICATE_NAME> -P <PROVISIONING_PROFILE_UUID>]
166
+ ```
167
+
168
+ **Example:**
169
+ ```bash
170
+ ti build -p ios -T dist-appstore -R "Pseudo, Inc." -P "AAAAAAAA-0000-9999-8888-777777777777"
171
+ ```
172
+
173
+ The CLI installs the package to Xcode's Organizer.
174
+
175
+ ### 6. Upload to iTunes Connect
176
+
177
+ 1. Open Xcode > **Window** > **Organizer**
178
+ 2. Select your app archive
179
+ 3. Click **Verify** (validates against iTunes Connect app definition)
180
+ 4. Click **Submit** (uploads app)
181
+ 5. Status changes to **Waiting for Review**
182
+
183
+ ### 7. Ad Hoc Distribution
184
+
185
+ Testers need:
186
+ - The `.mobileprovision` file installed on their device
187
+ - The `.ipa` package file
188
+
189
+ **Installation method:**
190
+ 1. Connect device to Mac
191
+ 2. Open Xcode > **Window** > **Devices**
192
+ 3. Select device > **Installed Apps** > **+**
193
+ 4. Select IPA file
194
+
195
+ ### 8. App Store Requirements
196
+
197
+ Apple's guidelines include:
198
+ - Apps must be useful, well-designed, and error-free
199
+ - No downloading/executing code
200
+ - You must own all copyrights and trademarks
201
+ - No hidden features or non-public APIs
202
+ - [Full guidelines](http://developer.apple.com/appstore/resources/approval/guidelines.html)
203
+
204
+ ---
205
+
206
+ ## Device Deployment Testing
207
+
208
+ ### Android Device Setup
209
+
210
+ 1. Enable **Developer options** (tap **Build number** 7 times in **About**)
211
+ 2. Enable **USB debugging** in **Developer options**
212
+ 3. Enable **Unknown sources** in **Security**
213
+ 4. Connect via USB (use data cable, not power-only)
214
+ 5. Allow USB debugging when prompted
215
+
216
+ **Windows only**: Install [OEM USB drivers](http://developer.android.com/sdk/oem-usb.html)
217
+
218
+ ### iOS Device Setup
219
+
220
+ Requires development certificate and provisioning profile. See [Deploying to iOS devices](#ios-distribution).
221
+
222
+ ---
223
+
224
+ ## Troubleshooting
225
+
226
+ ### Android: Device Not Recognized
227
+
228
+ ```bash
229
+ adb devices # Check connected devices
230
+ adb kill-server # Restart adb
231
+ adb start-server
232
+ adb devices # Verify
233
+ ```
234
+
235
+ ### Android: Check Platform Compatibility
236
+
237
+ ```bash
238
+ ti info -p android
239
+ ```
240
+
241
+ ### iOS: Mavericks Permission Issues
242
+
243
+ Grant CLI access in **System Preferences** > **Security & Privacy** > **Privacy**
244
+
245
+ ### General: Clean Build Folder
246
+
247
+ ```bash
248
+ ti clean [-p <PLATFORM>]
249
+ ```
250
+
251
+ ---
252
+
253
+ ## References
254
+
255
+ - [Google Play Developer Policies](http://play.google.com/about/developer-content-policy.html)
256
+ - [Google Play Graphic Assets](http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=1078870)
257
+ - [iTunes Connect Developer Guide](http://developer.apple.com/library/mac/#documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/)
258
+ - [iOS App Store Review Guidelines](http://developer.apple.com/appstore/resources/approval/guidelines.html)