@maccesar/titools 2.0.6 → 2.2.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 (132) hide show
  1. package/{AGENTS-TEMPLATE.md → AGENTS-VERCEL-RESEARCH.md} +16 -18
  2. package/README.md +250 -168
  3. package/agents/{ti-researcher.md → ti-pro.md} +10 -10
  4. package/bin/titools.js +16 -12
  5. package/lib/cleanup.js +95 -0
  6. package/lib/commands/agents.js +146 -70
  7. package/lib/commands/skills.js +349 -0
  8. package/lib/commands/uninstall.js +189 -154
  9. package/lib/commands/update.js +104 -21
  10. package/lib/config.js +26 -20
  11. package/lib/downloader.js +1 -1
  12. package/lib/installer.js +37 -97
  13. package/lib/platform.js +9 -5
  14. package/lib/prompts/checkboxCancel.js +264 -0
  15. package/lib/prompts/selectCancel.js +204 -0
  16. package/lib/symlink.js +19 -7
  17. package/lib/utils.js +21 -31
  18. package/package.json +10 -10
  19. package/skills/alloy-guides/SKILL.md +8 -30
  20. package/skills/alloy-guides/references/CLI_TASKS.md +14 -24
  21. package/skills/alloy-guides/references/CONCEPTS.md +5 -25
  22. package/skills/alloy-guides/references/CONTROLLERS.md +2 -19
  23. package/skills/alloy-guides/references/MODELS.md +40 -10
  24. package/skills/alloy-guides/references/PURGETSS.md +1 -11
  25. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +8 -14
  26. package/skills/alloy-guides/references/VIEWS_STYLES.md +14 -25
  27. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +2 -8
  28. package/skills/alloy-guides/references/VIEWS_XML.md +29 -40
  29. package/skills/alloy-guides/references/WIDGETS.md +1 -17
  30. package/skills/alloy-howtos/SKILL.md +1 -22
  31. package/skills/alloy-howtos/references/best_practices.md +0 -17
  32. package/skills/alloy-howtos/references/cli_reference.md +1 -23
  33. package/skills/alloy-howtos/references/config_files.md +86 -15
  34. package/skills/alloy-howtos/references/custom_tags.md +14 -13
  35. package/skills/alloy-howtos/references/debugging_troubleshooting.md +3 -22
  36. package/skills/alloy-howtos/references/samples.md +4 -14
  37. package/skills/purgetss/SKILL.md +11 -37
  38. package/skills/purgetss/references/EXAMPLES.md +106 -17
  39. package/skills/purgetss/references/animation-system.md +0 -67
  40. package/skills/purgetss/references/apply-directive.md +0 -18
  41. package/skills/purgetss/references/arbitrary-values.md +0 -25
  42. package/skills/purgetss/references/class-index.md +0 -46
  43. package/skills/purgetss/references/cli-commands.md +0 -41
  44. package/skills/purgetss/references/configurable-properties.md +0 -55
  45. package/skills/purgetss/references/custom-rules.md +0 -14
  46. package/skills/purgetss/references/customization-deep-dive.md +0 -49
  47. package/skills/purgetss/references/dynamic-component-creation.md +56 -37
  48. package/skills/purgetss/references/grid-layout.md +0 -32
  49. package/skills/purgetss/references/icon-fonts.md +0 -50
  50. package/skills/purgetss/references/installation-setup.md +61 -32
  51. package/skills/purgetss/references/migration-guide.md +127 -0
  52. package/skills/purgetss/references/opacity-modifier.md +0 -34
  53. package/skills/purgetss/references/performance-tips.md +261 -0
  54. package/skills/purgetss/references/platform-modifiers.md +0 -46
  55. package/skills/purgetss/references/smart-mappings.md +0 -12
  56. package/skills/purgetss/references/tikit-components.md +393 -0
  57. package/skills/purgetss/references/titanium-resets.md +1 -27
  58. package/skills/purgetss/references/ui-ux-design.md +467 -117
  59. package/skills/{alloy-expert → ti-expert}/SKILL.md +45 -54
  60. package/skills/ti-expert/references/alloy-builtins.md +387 -0
  61. package/skills/{alloy-expert → ti-expert}/references/alloy-structure.md +147 -40
  62. package/skills/ti-expert/references/anti-patterns.md +90 -0
  63. package/skills/ti-expert/references/cli-expert.md +109 -0
  64. package/skills/{alloy-expert → ti-expert}/references/code-conventions.md +182 -49
  65. package/skills/{alloy-expert → ti-expert}/references/controller-patterns.md +103 -93
  66. package/skills/{alloy-expert → ti-expert}/references/error-handling.md +12 -12
  67. package/skills/{alloy-expert → ti-expert}/references/examples.md +144 -85
  68. package/skills/{alloy-expert → ti-expert}/references/migration-patterns.md +38 -36
  69. package/skills/{alloy-expert → ti-expert}/references/patterns.md +8 -8
  70. package/skills/ti-expert/references/performance-listview.md +251 -0
  71. package/skills/{alloy-expert/references/performance-patterns.md → ti-expert/references/performance-optimization.md} +67 -283
  72. package/skills/{alloy-expert/references/security-patterns.md → ti-expert/references/security-device.md} +12 -295
  73. package/skills/ti-expert/references/security-fundamentals.md +284 -0
  74. package/skills/{alloy-expert → ti-expert}/references/state-management.md +10 -10
  75. package/skills/ti-expert/references/testing-e2e-ci.md +432 -0
  76. package/skills/ti-expert/references/testing-unit.md +433 -0
  77. package/skills/ti-expert/references/theming.md +394 -0
  78. package/skills/ti-guides/SKILL.md +1 -14
  79. package/skills/ti-guides/references/advanced-data-and-images.md +126 -10
  80. package/skills/ti-guides/references/app-distribution.md +48 -10
  81. package/skills/ti-guides/references/application-frameworks.md +9 -2
  82. package/skills/ti-guides/references/cli-reference.md +338 -82
  83. package/skills/ti-guides/references/coding-best-practices.md +14 -4
  84. package/skills/ti-guides/references/commonjs-advanced.md +103 -6
  85. package/skills/ti-guides/references/hello-world.md +5 -2
  86. package/skills/ti-guides/references/hyperloop-native-access.md +439 -46
  87. package/skills/ti-guides/references/javascript-primer.md +4 -3
  88. package/skills/ti-guides/references/resources.md +0 -1
  89. package/skills/ti-guides/references/style-and-conventions.md +57 -9
  90. package/skills/ti-guides/references/tiapp-config.md +48 -6
  91. package/skills/ti-howtos/SKILL.md +2 -27
  92. package/skills/ti-howtos/references/android-platform-deep-dives.md +41 -90
  93. package/skills/ti-howtos/references/automation-fastlane-appium.md +15 -14
  94. package/skills/ti-howtos/references/buffer-codec-streams.md +22 -22
  95. package/skills/ti-howtos/references/cross-platform-development.md +68 -37
  96. package/skills/ti-howtos/references/debugging-profiling.md +8 -53
  97. package/skills/ti-howtos/references/extending-titanium.md +12 -51
  98. package/skills/ti-howtos/references/google-maps-v2.md +30 -29
  99. package/skills/ti-howtos/references/ios-map-kit.md +19 -25
  100. package/skills/ti-howtos/references/ios-platform-deep-dives.md +95 -283
  101. package/skills/ti-howtos/references/local-data-sources.md +45 -37
  102. package/skills/ti-howtos/references/location-and-maps.md +47 -28
  103. package/skills/ti-howtos/references/media-apis.md +84 -27
  104. package/skills/ti-howtos/references/notification-services.md +40 -89
  105. package/skills/ti-howtos/references/remote-data-sources.md +21 -36
  106. package/skills/ti-howtos/references/tutorials.md +79 -39
  107. package/skills/ti-howtos/references/using-modules.md +4 -30
  108. package/skills/ti-howtos/references/web-content-integration.md +28 -45
  109. package/skills/ti-howtos/references/webpack-build-pipeline.md +54 -18
  110. package/skills/ti-ui/SKILL.md +1 -21
  111. package/skills/ti-ui/references/accessibility-deep-dive.md +71 -25
  112. package/skills/ti-ui/references/animation-and-matrices.md +0 -47
  113. package/skills/ti-ui/references/application-structures.md +0 -46
  114. package/skills/ti-ui/references/custom-fonts-styling.md +9 -57
  115. package/skills/ti-ui/references/event-handling.md +32 -40
  116. package/skills/ti-ui/references/gestures.md +0 -40
  117. package/skills/ti-ui/references/icons-and-splash-screens.md +21 -44
  118. package/skills/ti-ui/references/layouts-and-positioning.md +47 -39
  119. package/skills/ti-ui/references/listviews-and-performance.md +187 -73
  120. package/skills/ti-ui/references/orientation.md +57 -71
  121. package/skills/ti-ui/references/platform-ui-android.md +114 -48
  122. package/skills/ti-ui/references/platform-ui-ios.md +63 -38
  123. package/skills/ti-ui/references/scrolling-views.md +14 -23
  124. package/skills/ti-ui/references/tableviews.md +6 -56
  125. package/lib/commands/install.js +0 -188
  126. package/skills/alloy-expert/references/anti-patterns.md +0 -133
  127. package/skills/alloy-expert/references/testing.md +0 -872
  128. package/skills/ti-guides/references/alloy-cli-advanced.md +0 -84
  129. package/skills/ti-guides/references/alloy-data-mastery.md +0 -29
  130. package/skills/ti-guides/references/alloy-widgets-and-themes.md +0 -19
  131. /package/skills/{alloy-expert → ti-expert}/assets/ControllerAutoCleanup.js +0 -0
  132. /package/skills/{alloy-expert → ti-expert}/references/contracts.md +0 -0
@@ -2,7 +2,6 @@
2
2
 
3
3
  Essential JavaScript concepts, resources, and best practices for Titanium development.
4
4
 
5
- ## Table of Contents
6
5
  1. [JavaScript Overview](#javascript-overview)
7
6
  2. [Learning Resources](#learning-resources)
8
7
  3. [Best Practices](#best-practices)
@@ -45,7 +44,7 @@ JavaScript is the language of Titanium. It's a powerful, lightweight, dynamic ob
45
44
  - **[MDN JavaScript Guide](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide)** - Comprehensive JavaScript documentation
46
45
  - **[Douglas Crockford's Resources](http://javascript.crockford.com/)** - From the creator of JSON and JSLint
47
46
  - **[JavaScript in 10 Minutes](https://github.com/spencertipping/js-in-ten-minutes)** - Dense advanced guide
48
- - **[Google JavaScript Style Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml)** - Code style guidelines
47
+ - **[Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html)** - Code style guidelines
49
48
  - **[Learning Advanced JavaScript](http://ejohn.org/apps/learn/)** - By John Resig (jQuery creator)
50
49
 
51
50
  ### Print Books (Recommended)
@@ -137,6 +136,8 @@ for (let i = 0, j = names.length; i < j; i++) {
137
136
  }
138
137
  ```
139
138
 
139
+ This is especially important when working with Titanium proxy objects (representing native OS structures), where checking length on each iteration has additional overhead.
140
+
140
141
  **Even better:** ES6 `for...of`
141
142
  ```javascript
142
143
  for (const name of names) {
@@ -161,7 +162,7 @@ const z = 30; // Cannot be reassigned
161
162
 
162
163
  ### Ternary Operator
163
164
 
164
- Compact conditional assignment:
165
+ Compact conditional assignment. Value after `?` is assigned if the condition is true; value after `:` if false.
165
166
 
166
167
  ```javascript
167
168
  // Instead of this:
@@ -2,7 +2,6 @@
2
2
 
3
3
  Community resources, support channels, tools, and learning materials for Titanium developers.
4
4
 
5
- ## Table of Contents
6
5
  1. [Developer Support](#developer-support)
7
6
  2. [Example Code](#example-code)
8
7
  3. [Community Modules](#community-modules)
@@ -6,10 +6,38 @@
6
6
  - **Classes/Constructors**: `PascalCase` (e.g., `User`, `NetClient`).
7
7
  - **Factories**: Prefix with `create` (e.g., `createWidget`).
8
8
  - **Namespaces**: Use capitalized words (e.g., `App.UI.Widget`, `App.Network.Request`). Avoid lowercase for major namespaces (e.g., use `App.UI` instead of `app.ui`).
9
+ - **Hungarian Notation**: Titanium SDK does not support the use of Hungarian Notation.
9
10
 
10
- ## 2. Formatting
11
- - **Semicolons**: Mandatory in official SDK guides, but **omitted** in the `alloy-expert` standard (let ASI handle it).
12
- - **Indentation**: Consistency is most important (K&R/1TBS style).
11
+ ## 2. Language Rules
12
+ - **Semicolons**: Always use semicolons to terminate statements. This is mandatory in official SDK guides, but **omitted** in the `ti-expert` standard (let ASI handle it).
13
+ - **`this` keyword**: Use `this` with extreme care, as it sometimes doesn't refer to the object you expect.
14
+
15
+ ## 3. Formatting
16
+ - **Indentation**: Both K&R/1TBS and Allman styles are acceptable. Consistency is most important — never mix styles in the same project.
17
+ ```javascript
18
+ // K&R/1TBS Style
19
+ if (x < 10) {
20
+ if (y > 10) {
21
+ // do this
22
+ }
23
+ } else {
24
+ // do this
25
+ }
26
+ ```
27
+ ```javascript
28
+ // Allman Style
29
+ if (x < 10)
30
+ {
31
+ if (y > 10)
32
+ {
33
+ // do this
34
+ }
35
+ }
36
+ else
37
+ {
38
+ // do this
39
+ }
40
+ ```
13
41
  - **Operators**: Add a single space around operators.
14
42
  ```javascript
15
43
  const fullName = firstName + ' ' + lastName
@@ -30,19 +58,39 @@ return {
30
58
  }
31
59
  ```
32
60
 
33
- ## 3. Primitive Types
61
+ ## 4. Control Statements
62
+ - Switch statements should have a single space before the opening parenthesis and a single space after the closing parenthesis. Switch content is indented with one tab; content in each case is indented one tab as well.
63
+ ```javascript
64
+ switch (someTest) {
65
+ case 1:
66
+ break;
67
+
68
+ case 2:
69
+ break;
70
+
71
+ default:
72
+ break;
73
+ }
74
+ ```
75
+
76
+ ## 5. Primitive Types
34
77
  - Avoid using primitive type object constructors (e.g., `new String()`).
35
78
  - Use template literals or single space concatenation.
36
79
 
37
- ## 4. Control Statements
38
- - Switch statements should have a single space around parentheses and proper indentation for cases.
39
-
40
- ## 5. Comments and Documentation
41
- - **Single-line comments**: Preferred for short explanations.
80
+ ## 6. Comments and Documentation
81
+ - **Single-line comments**: Required to reduce programmer error. Inline statement comments should be used at a minimum or not at all.
42
82
  - **JSDoc/Block comments**: Required for documenting functions and classes.
43
83
  ```javascript
84
+ // Calculate position using initial
85
+ // and offset x coordinates.
86
+ const finalPos = initPosX + offsetPosX;
87
+
44
88
  /**
45
89
  * @param {String} customerName Customer's full name.
46
90
  */
47
91
  function getCustomer(customerName) {}
48
92
  ```
93
+
94
+ ## 7. References
95
+ - Douglas Crockford's JavaScript Code Conventions
96
+ - Google's JavaScript Style Guide (https://google.github.io/styleguide/jsguide.html)
@@ -19,14 +19,14 @@ Complete reference for Titanium app configuration files. `tiapp.xml` is the main
19
19
  <dict>
20
20
  <key>UISupportedInterfaceOrientations~iphone</key>
21
21
  <array>
22
- <string>Ti.UI.PORTRAIT</string>
22
+ <string>UIInterfaceOrientationPortrait</string>
23
23
  </array>
24
24
  <key>UISupportedInterfaceOrientations~ipad</key>
25
25
  <array>
26
- <string>Ti.UI.PORTRAIT</string>
27
- <string>Ti.UI.UPSIDE_PORTRAIT</string>
28
- <string>Ti.UI.LANDSCAPE_LEFT</string>
29
- <string>Ti.UI.LANDSCAPE_RIGHT</string>
26
+ <string>UIInterfaceOrientationPortrait</string>
27
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
28
+ <string>UIInterfaceOrientationLandscapeLeft</string>
29
+ <string>UIInterfaceOrientationLandscapeRight</string>
30
30
  </array>
31
31
  </dict>
32
32
  </plist>
@@ -71,6 +71,13 @@ Complete reference for Titanium app configuration files. `tiapp.xml` is the main
71
71
 
72
72
  ### Optional Elements
73
73
 
74
+ #### `<defaultLang>`
75
+ Sets the default language for Android i18n `strings.xml`. Android defaults to `en`. If you only use a single non-English i18n file, set this to that language.
76
+
77
+ ```xml
78
+ <defaultLang>de</defaultLang>
79
+ ```
80
+
74
81
  #### `<copyright>`
75
82
  Application copyright.
76
83
 
@@ -202,6 +209,20 @@ Default unit for sizes/positions.
202
209
 
203
210
  **Values:** `system`, `cm`, `dip`/`dp`, `in`, `mm`, `px`
204
211
 
212
+ #### `run-on-main-thread`
213
+ **Since 5.1.0.** Run all JavaScript on the main thread instead of a secondary thread. Disabled by default in existing projects, enabled in new projects. Enabled automatically in SDK 7.0.0+.
214
+
215
+ ```xml
216
+ <property name="run-on-main-thread" type="bool">true</property>
217
+ ```
218
+
219
+ #### `allow-custom-keyboards`
220
+ **Since 6.1.0.** Allow or disallow custom iOS 8+ keyboard extensions. Custom keyboards are allowed by default. Set to `false` to disallow them.
221
+
222
+ ```xml
223
+ <property name="allow-custom-keyboards" type="bool">false</property>
224
+ ```
225
+
205
226
  #### `appc-sourcecode-encryption-policy`
206
227
  Encryption policy for app assets.
207
228
 
@@ -467,6 +488,10 @@ Settings for generated `Info.plist`. Uses key/value pairs.
467
488
  <string>audio</string>
468
489
  <string>location</string>
469
490
  <string>voip</string>
491
+ <string>newsstand-content</string>
492
+ <string>external-accessory</string>
493
+ <string>bluetooth-central</string>
494
+ <string>bluetooth-peripheral</string>
470
495
  </array>
471
496
  </dict>
472
497
  </plist>
@@ -480,8 +505,25 @@ Settings for generated `Info.plist`. Uses key/value pairs.
480
505
  <array>
481
506
  <string>telephony</string>
482
507
  <string>wifi</string>
483
- <string>gps</string>
508
+ <string>sms</string>
509
+ <string>still-camera</string>
510
+ <string>auto-focus-camera</string>
511
+ <string>front-facing-camera</string>
512
+ <string>camera-flash</string>
513
+ <string>video-camera</string>
484
514
  <string>accelerometer</string>
515
+ <string>gyroscope</string>
516
+ <string>location-services</string>
517
+ <string>gps</string>
518
+ <string>magnetometer</string>
519
+ <string>gamekit</string>
520
+ <string>microphone</string>
521
+ <string>opengles-1</string>
522
+ <string>opengles-2</string>
523
+ <string>armv6</string>
524
+ <string>armv7</string>
525
+ <string>peer-peer</string>
526
+ <string>bluetooth-le</string>
485
527
  </array>
486
528
  </dict>
487
529
  </plist>
@@ -28,31 +28,6 @@ This skill automatically detects Titanium projects when invoked and provides nat
28
28
  - **Not detected** → Indicates this is for Titanium projects only
29
29
  :::
30
30
 
31
- ## Table of Contents
32
-
33
- - [Titanium SDK How-tos Expert](#titanium-sdk-how-tos-expert)
34
- - [Project Detection](#project-detection)
35
- - [Table of Contents](#table-of-contents)
36
- - [Integration Workflow](#integration-workflow)
37
- - [Native Integration Rules (Low Freedom)](#native-integration-rules-low-freedom)
38
- - [iOS Permissions](#ios-permissions)
39
- - [Android Resource Management](#android-resource-management)
40
- - [Data \& Networking](#data--networking)
41
- - [Media \& Memory](#media--memory)
42
- - [Platform-Specific Properties](#platform-specific-properties)
43
- - [Reference Guides (Progressive Disclosure)](#reference-guides-progressive-disclosure)
44
- - [Core Features](#core-features)
45
- - [Data Handling](#data-handling)
46
- - [Media \& Content](#media--content)
47
- - [Web Integration](#web-integration)
48
- - [Platform-Specific (Android)](#platform-specific-android)
49
- - [Platform-Specific (iOS)](#platform-specific-ios)
50
- - [Advanced \& DevOps](#advanced--devops)
51
- - [Related Skills](#related-skills)
52
- - [Response Format](#response-format)
53
-
54
- ---
55
-
56
31
  ## Integration Workflow
57
32
 
58
33
  1. **Requirement Check**: Identify needed permissions, `tiapp.xml` configurations, and module dependencies.
@@ -121,7 +96,7 @@ if (OS_IOS) {
121
96
  - iOS: `statusBarStyle`, `modalStyle`, `modalTransitionStyle`, any `Ti.UI.iOS.*`
122
97
  - Android: `actionBar` config, any `Ti.UI.Android.*` constant
123
98
 
124
- **For platform-specific modifier syntax, see** [Platform Modifiers (purgetss)](skills/purgetss/references/platform-modifiers.md) or [Platform UI guides](references/ios-platform-deep-dives.md).
99
+ **For platform-specific modifier syntax in TSS, see** [Code Conventions (ti-expert)](skills/ti-expert/references/code-conventions.md#platform--device-modifiers) or [Platform UI guides](references/ios-platform-deep-dives.md).
125
100
  :::
126
101
 
127
102
  ## Reference Guides (Progressive Disclosure)
@@ -161,7 +136,7 @@ For tasks beyond native feature integration, use these complementary skills:
161
136
 
162
137
  | Task | Use This Skill |
163
138
  | ---------------------------------------------- | -------------- |
164
- | Project architecture, services, memory cleanup | `alloy-expert` |
139
+ | Project architecture, services, memory cleanup | `ti-expert` |
165
140
  | UI layouts, ListViews, gestures, animations | `ti-ui` |
166
141
  | Hyperloop, app distribution, tiapp.xml config | `ti-guides` |
167
142
  | Alloy MVC, models, data binding | `alloy-guides` |
@@ -1,63 +1,5 @@
1
1
  # Android Platform Deep Dives
2
2
 
3
- ## Table of Contents
4
-
5
- - [Android Platform Deep Dives](#android-platform-deep-dives)
6
- - [Table of Contents](#table-of-contents)
7
- - [1. Android Intent Filters (Advanced)](#1-android-intent-filters-advanced)
8
- - [Critical Step: Copy Root Activity](#critical-step-copy-root-activity)
9
- - [Retrieving Intent Data](#retrieving-intent-data)
10
- - [2. Broadcast Intents with Permissions](#2-broadcast-intents-with-permissions)
11
- - [Sending with Permission](#sending-with-permission)
12
- - [Declaring Permission in tiapp.xml](#declaring-permission-in-tiappxml)
13
- - [3. FusedLocationProvider (TiSDK 7.1.0+)](#3-fusedlocationprovider-tisdk-710)
14
- - [4. Android Intents](#4-android-intents)
15
- - [Overview](#overview)
16
- - [Intent Structure](#intent-structure)
17
- - [Creating Intents](#creating-intents)
18
- - [Simple Intent (Action only)](#simple-intent-action-only)
19
- - [Intent with Action and Data](#intent-with-action-and-data)
20
- - [Intent with Extras](#intent-with-extras)
21
- - [Common Use Cases](#common-use-cases)
22
- - [Open URL in Browser](#open-url-in-browser)
23
- - [Dial Phone Number](#dial-phone-number)
24
- - [Send Email](#send-email)
25
- - [Share Content](#share-content)
26
- - [Open PDF File](#open-pdf-file)
27
- - [Starting Other Apps](#starting-other-apps)
28
- - [2. Intent Filters](#2-intent-filters)
29
- - [Overview](#overview-1)
30
- - [Configuring in tiapp.xml](#configuring-in-tiappxml)
31
- - [Handling Incoming Intents](#handling-incoming-intents)
32
- - [Get Intent Data on Startup](#get-intent-data-on-startup)
33
- - [Listen for New Intents (Activity Restart)](#listen-for-new-intents-activity-restart)
34
- - [Deep Linking Example](#deep-linking-example)
35
- - [3. Broadcast Intents and Receivers](#3-broadcast-intents-and-receivers)
36
- - [Overview](#overview-2)
37
- - [System Broadcasts](#system-broadcasts)
38
- - [Registering Broadcast Receivers](#registering-broadcast-receivers)
39
- - [Dynamic Registration (in code)](#dynamic-registration-in-code)
40
- - [Network Change Listener](#network-change-listener)
41
- - [Sending Custom Broadcasts](#sending-custom-broadcasts)
42
- - [Receiver for Custom Broadcast](#receiver-for-custom-broadcast)
43
- - [Boot Receiver](#boot-receiver)
44
- - [4. Android Services](#4-android-services)
45
- - [Overview](#overview-3)
46
- - [Service Types](#service-types)
47
- - [Creating a Service](#creating-a-service)
48
- - [IntentService](#intentservice)
49
- - [Foreground Service](#foreground-service)
50
- - [Service Lifecycle Management](#service-lifecycle-management)
51
- - [Inter-Service Communication](#inter-service-communication)
52
- - [5. Android Permissions](#5-android-permissions)
53
- - [Runtime Permissions (Android 6.0+)](#runtime-permissions-android-60)
54
- - [Common Dangerous Permissions](#common-dangerous-permissions)
55
- - [Best Practices](#best-practices)
56
- - [Common Dangerous Permissions](#common-dangerous-permissions-1)
57
- - [Best Practices](#best-practices-1)
58
-
59
- ---
60
-
61
3
  ## 1. Android Intent Filters (Advanced)
62
4
 
63
5
  To allow your app to receive implicit intents (e.g., opening a PDF file or a web link), you must register the filter in the manifest.
@@ -165,8 +107,8 @@ const intent = Ti.Android.createIntent({
165
107
  action: 'com.example.MY_ACTION',
166
108
  type: 'text/plain'
167
109
  });
168
- intent.addExtra('message', 'Hello from Titanium');
169
- intent.addExtra('count', 42);
110
+ intent.putExtra('message', 'Hello from Titanium');
111
+ intent.putExtra('count', 42);
170
112
  ```
171
113
 
172
114
  ### Common Use Cases
@@ -195,8 +137,8 @@ const intent = Ti.Android.createIntent({
195
137
  action: Ti.Android.ACTION_SENDTO,
196
138
  data: 'mailto:user@example.com'
197
139
  });
198
- intent.addExtra(Ti.Android.EXTRA_SUBJECT, 'Hello');
199
- intent.addExtra(Ti.Android.EXTRA_TEXT, 'Email body');
140
+ intent.putExtra(Ti.Android.EXTRA_SUBJECT, 'Hello');
141
+ intent.putExtra(Ti.Android.EXTRA_TEXT, 'Email body');
200
142
  Ti.Android.currentActivity.startActivity(intent);
201
143
  ```
202
144
 
@@ -206,7 +148,7 @@ const intent = Ti.Android.createIntent({
206
148
  action: Ti.Android.ACTION_SEND,
207
149
  type: 'text/plain'
208
150
  });
209
- intent.addExtra(Ti.Android.EXTRA_TEXT, 'Check this out!');
151
+ intent.putExtra(Ti.Android.EXTRA_TEXT, 'Check this out!');
210
152
  Ti.Android.currentActivity.startActivity(intent);
211
153
  ```
212
154
 
@@ -236,7 +178,37 @@ try {
236
178
  }
237
179
  ```
238
180
 
239
- ## 2. Intent Filters
181
+ ### Intent Chooser
182
+ Force the system to show an app chooser dialog (even if a default is set):
183
+ ```javascript
184
+ const intent = Ti.Android.createIntent({
185
+ action: Ti.Android.ACTION_SEND,
186
+ type: 'text/plain'
187
+ });
188
+ intent.putExtra(Ti.Android.EXTRA_TEXT, 'Share this text');
189
+
190
+ Ti.Android.currentActivity.startActivity(
191
+ Ti.Android.createIntentChooser(intent, 'Share via...')
192
+ );
193
+ ```
194
+
195
+ ### Getting Results from Activities
196
+ ```javascript
197
+ const intent = Ti.Android.createIntent({
198
+ action: 'android.media.action.IMAGE_CAPTURE'
199
+ });
200
+
201
+ Ti.Android.currentActivity.startActivityForResult(intent, (e) => {
202
+ if (e.resultCode === Ti.Android.RESULT_OK) {
203
+ const imageUri = e.intent.data;
204
+ Ti.API.info(`Captured image: ${imageUri}`);
205
+ } else if (e.resultCode === Ti.Android.RESULT_CANCELED) {
206
+ Ti.API.info('User canceled');
207
+ }
208
+ });
209
+ ```
210
+
211
+ ## 5. Intent Filters
240
212
 
241
213
  ### Overview
242
214
  Intent Filters advertise your app's capability to handle certain actions and data types. Enable deep linking, file handling, and inter-app communication.
@@ -338,7 +310,7 @@ if (intent && intent.getData()) {
338
310
  }
339
311
  ```
340
312
 
341
- ## 3. Broadcast Intents and Receivers
313
+ ## 6. Broadcast Intents and Receivers
342
314
 
343
315
  ### Overview
344
316
  Broadcast Intents allow system-wide or app-wide messaging. Apps can send broadcasts and register receivers to listen for them.
@@ -413,7 +385,7 @@ Ti.Android.registerBroadcastReceiver(networkReceiver, [
413
385
  const intent = Ti.Android.createIntent({
414
386
  action: 'com.myapp.CUSTOM_EVENT'
415
387
  });
416
- intent.addExtra('data', 'Custom data here');
388
+ intent.putExtra('data', 'Custom data here');
417
389
  Ti.Android.currentActivity.sendBroadcast(intent);
418
390
  ```
419
391
 
@@ -452,7 +424,7 @@ Ti.Android.registerBroadcastReceiver(customReceiver, [
452
424
  </android>
453
425
  ```
454
426
 
455
- ## 4. Android Services
427
+ ## 7. Android Services
456
428
 
457
429
  ### Overview
458
430
  Services are background components that run independently of the UI. Useful for long-running operations like music playback, location tracking, or network polling.
@@ -573,7 +545,7 @@ Ti.Android.currentActivity.addEventListener('destroy', () => {
573
545
  const intent = Ti.Android.createServiceIntent({
574
546
  url: 'myservice.js'
575
547
  });
576
- intent.addExtra('command', 'pause');
548
+ intent.putExtra('command', 'pause');
577
549
  Ti.Android.startService(intent);
578
550
 
579
551
  // In service
@@ -583,7 +555,7 @@ if (command === 'pause') {
583
555
  }
584
556
  ```
585
557
 
586
- ## 5. Android Permissions
558
+ ## 8. Android Permissions
587
559
 
588
560
  ### Runtime Permissions (Android 6.0+)
589
561
 
@@ -635,24 +607,3 @@ checkPermission();
635
607
  6. **Validate intent data** before processing
636
608
  7. **Use proper Intent Flags** for navigation behavior
637
609
  8. **Test intent filters** with ADB: `adb shell am start -W -a android.intent.action.VIEW -d "myapp://path"`
638
-
639
- ### Common Dangerous Permissions
640
- - `ACCESS_FINE_LOCATION` - GPS location
641
- - `ACCESS_COARSE_LOCATION` - Network location
642
- - `CAMERA` - Camera access
643
- - `READ_EXTERNAL_STORAGE` - Read files
644
- - `WRITE_EXTERNAL_STORAGE` - Write files
645
- - `RECORD_AUDIO` - Microphone
646
- - `CALL_PHONE` - Make phone calls
647
- - `SEND_SMS` / `READ_SMS` - SMS access
648
-
649
- ## Best Practices
650
-
651
- 1. **Always unregister** broadcast receivers when no longer needed
652
- 2. **Stop services** explicitly to conserve battery
653
- 3. **Use IntentService** for one-off background tasks
654
- 4. **Use foreground services** for user-visible long operations
655
- 5. **Handle runtime permissions** gracefully on Android 6.0+
656
- 6. **Validate intent data** before processing
657
- 7. **Use proper Intent Flags** for navigation behavior
658
- 8. **Test intent filters** with ADB: `adb shell am start -W -a android.intent.action.VIEW -d "myapp://path"`
@@ -2,20 +2,6 @@
2
2
 
3
3
  Guide for setting up continuous integration pipelines, automatic testing, and deployment in Titanium.
4
4
 
5
- ## Table of Contents
6
-
7
- - [Automation with Fastlane and Appium](#automation-with-fastlane-and-appium)
8
- - [Table of Contents](#table-of-contents)
9
- - [1. UI Testing with Appium](#1-ui-testing-with-appium)
10
- - [Prerequisites](#prerequisites)
11
- - [Test Example (Mocha + WebdriverIO)](#test-example-mocha--webdriverio)
12
- - [2. Automation with Fastlane](#2-automation-with-fastlane)
13
- - [Titanium Plugins](#titanium-plugins)
14
- - [Fastfile Configuration](#fastfile-configuration)
15
- - [3. CI/CD Best Practices](#3-cicd-best-practices)
16
-
17
- ---
18
-
19
5
  ## 1. UI Testing with Appium
20
6
 
21
7
  Appium allows for automated functional testing on real devices and simulators.
@@ -93,3 +79,18 @@ end
93
79
  2. **Environment Lanes**: Define separate lanes for `beta`, `production`, and `test`.
94
80
  3. **Profile Management**: Use Fastlane Match to sync certificates and provisioning profiles across the team.
95
81
  4. **Snapshots**: Use Fastlane's `snapshot` action to automate App Store screenshot generation.
82
+
83
+ ## 4. Unit Testing with TiUnit
84
+
85
+ For unit tests (non-UI), consider **TiUnit**, a Jasmine-based testing framework for Titanium:
86
+ - Runs tests inside the app context
87
+ - Supports standard Jasmine `describe`/`it`/`expect` syntax
88
+ - Can be integrated into CI pipelines
89
+
90
+ ## 5. Broader CI/CD Options
91
+
92
+ Beyond Fastlane and Appium, Titanium apps can integrate with:
93
+ - **Jenkins** — for build orchestration and pipeline management
94
+ - **SonarQube** — for code quality analysis
95
+ - **AWS Device Farm** — for testing on real devices in the cloud
96
+ - **Nexus/Artifactory** — for build artifact archiving and versioning
@@ -2,25 +2,6 @@
2
2
 
3
3
  Guide for advanced binary data manipulation and data flows in Titanium SDK.
4
4
 
5
- ## Table of Contents
6
-
7
- - [Buffer, Codec, and Streams](#buffer-codec-and-streams)
8
- - [Table of Contents](#table-of-contents)
9
- - [1. Titanium.Buffer](#1-titaniumbuffer)
10
- - [Creating Buffers](#creating-buffers)
11
- - [Common Operations](#common-operations)
12
- - [2. Titanium.Codec](#2-titaniumcodec)
13
- - [Encoding Numbers](#encoding-numbers)
14
- - [Decoding Strings](#decoding-strings)
15
- - [3. Streams](#3-streams)
16
- - [Stream Types](#stream-types)
17
- - [Example: BufferStream](#example-bufferstream)
18
- - [Example: FileStream (Chunk-based reading)](#example-filestream-chunk-based-reading)
19
- - [Example: BlobStream (Camera to File)](#example-blobstream-camera-to-file)
20
- - [4. Best Practices](#4-best-practices)
21
-
22
- ---
23
-
24
5
  ## 1. Titanium.Buffer
25
6
 
26
7
  Buffers are mutable and resizable containers for bytes (byte arrays).
@@ -75,6 +56,23 @@ const text = Ti.Codec.decodeString({
75
56
  });
76
57
  ```
77
58
 
59
+ ### Supported Types and Charsets
60
+
61
+ **Numeric types**: `TYPE_BYTE`, `TYPE_SHORT`, `TYPE_INT`, `TYPE_LONG`, `TYPE_FLOAT`, `TYPE_DOUBLE`
62
+
63
+ **String charsets**: `CHARSET_UTF8`, `CHARSET_UTF16`, `CHARSET_UTF16BE`, `CHARSET_UTF16LE`, `CHARSET_ISO_LATIN1`
64
+
65
+ ### Position Parameter
66
+ The `position` parameter controls where encoding/decoding starts in the buffer:
67
+ ```javascript
68
+ Ti.Codec.encodeNumber({
69
+ source: 42,
70
+ dest: buffer,
71
+ position: 4, // start writing at byte 4
72
+ type: Ti.Codec.TYPE_INT
73
+ });
74
+ ```
75
+
78
76
  ## 3. Streams
79
77
 
80
78
  Streams allow reading and writing data in a serialized and memory-efficient way.
@@ -84,6 +82,8 @@ Streams allow reading and writing data in a serialized and memory-efficient way.
84
82
  2. **FileStream**: For file operations (more efficient than `file.read()`).
85
83
  3. **BlobStream**: Read-only for Blob objects (images, camera).
86
84
 
85
+ **Stream modes**: `Ti.Filesystem.MODE_READ`, `Ti.Filesystem.MODE_WRITE`, `Ti.Filesystem.MODE_APPEND`
86
+
87
87
  ### Example: BufferStream
88
88
  ```javascript
89
89
  const buffer = Ti.createBuffer({ length: 1024 });
@@ -118,16 +118,16 @@ Ti.Media.showCamera({
118
118
  source: e.media,
119
119
  mode: Ti.Stream.MODE_READ
120
120
  });
121
-
121
+
122
122
  const outfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'photo.jpg');
123
123
  const outstream = outfile.open(Ti.Filesystem.MODE_WRITE);
124
-
124
+
125
125
  const buffer = Ti.createBuffer({ length: 4096 });
126
126
  let readBytes = 0;
127
127
  while ((readBytes = instream.read(buffer)) > 0) {
128
128
  outstream.write(buffer, 0, readBytes);
129
129
  }
130
-
130
+
131
131
  instream.close();
132
132
  outstream.close();
133
133
  }