@maccesar/titools 2.2.3 → 2.2.8
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.
- package/README.md +28 -27
- package/lib/commands/update.js +80 -101
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +31 -31
- package/skills/alloy-guides/references/CONCEPTS.md +3 -3
- package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/MODELS.md +6 -6
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +27 -27
- package/skills/alloy-howtos/references/best_practices.md +9 -9
- package/skills/alloy-howtos/references/cli_reference.md +14 -14
- package/skills/alloy-howtos/references/config_files.md +16 -16
- package/skills/alloy-howtos/references/custom_tags.md +16 -16
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
- package/skills/alloy-howtos/references/samples.md +19 -19
- package/skills/purgetss/SKILL.md +11 -1
- package/skills/purgetss/references/animation-system.md +1 -1
- package/skills/purgetss/references/cli-commands.md +3 -3
- package/skills/purgetss/references/customization-deep-dive.md +1 -1
- package/skills/purgetss/references/dynamic-component-creation.md +1 -1
- package/skills/purgetss/references/icon-fonts.md +4 -0
- package/skills/purgetss/references/installation-setup.md +8 -1
- package/skills/purgetss/references/migration-guide.md +4 -0
- package/skills/purgetss/references/tikit-components.md +193 -204
- package/skills/purgetss/references/ui-ux-design.md +1 -1
- package/skills/ti-expert/SKILL.md +78 -118
- package/skills/ti-expert/references/alloy-builtins.md +18 -18
- package/skills/ti-expert/references/alloy-structure.md +21 -21
- package/skills/ti-expert/references/anti-patterns.md +15 -15
- package/skills/ti-expert/references/cli-expert.md +15 -15
- package/skills/ti-expert/references/code-conventions.md +38 -38
- package/skills/ti-expert/references/contracts.md +8 -8
- package/skills/ti-expert/references/controller-patterns.md +14 -14
- package/skills/ti-expert/references/error-handling.md +11 -11
- package/skills/ti-expert/references/examples.md +12 -12
- package/skills/ti-expert/references/migration-patterns.md +24 -24
- package/skills/ti-expert/references/patterns.md +10 -10
- package/skills/ti-expert/references/performance-listview.md +16 -16
- package/skills/ti-expert/references/performance-optimization.md +41 -41
- package/skills/ti-expert/references/security-device.md +22 -22
- package/skills/ti-expert/references/security-fundamentals.md +19 -19
- package/skills/ti-expert/references/state-management.md +33 -33
- package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
- package/skills/ti-expert/references/testing-unit.md +24 -24
- package/skills/ti-expert/references/theming.md +15 -15
- package/skills/ti-guides/SKILL.md +58 -60
- package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
- package/skills/ti-guides/references/android-manifest.md +15 -15
- package/skills/ti-guides/references/app-distribution.md +70 -166
- package/skills/ti-guides/references/application-frameworks.md +96 -114
- package/skills/ti-guides/references/cli-reference.md +294 -294
- package/skills/ti-guides/references/coding-best-practices.md +42 -33
- package/skills/ti-guides/references/commonjs-advanced.md +57 -51
- package/skills/ti-guides/references/hello-world.md +36 -36
- package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
- package/skills/ti-guides/references/javascript-primer.md +83 -101
- package/skills/ti-guides/references/reserved-words.md +9 -9
- package/skills/ti-guides/references/resources.md +75 -83
- package/skills/ti-guides/references/style-and-conventions.md +35 -28
- package/skills/ti-guides/references/tiapp-config.md +110 -74
- package/skills/ti-howtos/SKILL.md +88 -92
- package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
- package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
- package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
- package/skills/ti-howtos/references/cross-platform-development.md +115 -136
- package/skills/ti-howtos/references/debugging-profiling.md +167 -181
- package/skills/ti-howtos/references/extending-titanium.md +121 -121
- package/skills/ti-howtos/references/google-maps-v2.md +84 -82
- package/skills/ti-howtos/references/ios-map-kit.md +65 -60
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
- package/skills/ti-howtos/references/local-data-sources.md +79 -78
- package/skills/ti-howtos/references/location-and-maps.md +116 -120
- package/skills/ti-howtos/references/media-apis.md +87 -86
- package/skills/ti-howtos/references/notification-services.md +250 -260
- package/skills/ti-howtos/references/remote-data-sources.md +98 -93
- package/skills/ti-howtos/references/tutorials.md +226 -216
- package/skills/ti-howtos/references/using-modules.md +73 -102
- package/skills/ti-howtos/references/web-content-integration.md +101 -103
- package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
- package/skills/ti-ui/SKILL.md +85 -85
- package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
- package/skills/ti-ui/references/animation-and-matrices.md +79 -79
- package/skills/ti-ui/references/application-structures.md +96 -99
- package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
- package/skills/ti-ui/references/event-handling.md +58 -58
- package/skills/ti-ui/references/gestures.md +62 -64
- package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
- package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
- package/skills/ti-ui/references/listviews-and-performance.md +107 -107
- package/skills/ti-ui/references/orientation.md +87 -88
- package/skills/ti-ui/references/platform-ui-android.md +87 -81
- package/skills/ti-ui/references/platform-ui-ios.md +63 -61
- package/skills/ti-ui/references/scrolling-views.md +29 -29
- package/skills/ti-ui/references/tableviews.md +56 -56
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## 1. Audio APIs
|
|
4
4
|
|
|
5
|
-
### Playing
|
|
6
|
-
- Use for short
|
|
7
|
-
-
|
|
5
|
+
### Playing basic sounds (Ti.Media.Sound)
|
|
6
|
+
- Use for short effects, beeps, ambient audio
|
|
7
|
+
- The entire file loads into memory. Use `preload=true` to reduce delay.
|
|
8
8
|
- Methods: `play()`, `pause()`, `stop()`, `setVolume()`
|
|
9
|
-
-
|
|
9
|
+
- `allowBackground=true` keeps playback going when the app closes
|
|
10
10
|
|
|
11
11
|
```javascript
|
|
12
12
|
const sound = Ti.Media.createSound({
|
|
@@ -16,12 +16,12 @@ const sound = Ti.Media.createSound({
|
|
|
16
16
|
sound.play();
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
### Streaming
|
|
20
|
-
- Use for streaming
|
|
19
|
+
### Streaming audio (Ti.Media.AudioPlayer)
|
|
20
|
+
- Use for streaming web URLs (MP3, HLS)
|
|
21
21
|
- Supports pseudo-streaming and HLS
|
|
22
22
|
- Handle interruptions (phone calls) with app-level events:
|
|
23
|
-
- `pause
|
|
24
|
-
- `resume
|
|
23
|
+
- `pause`: call `setPaused(true)` or `pause()`
|
|
24
|
+
- `resume`: call `setPaused(false)` or `start()`
|
|
25
25
|
|
|
26
26
|
```javascript
|
|
27
27
|
const streamer = Ti.Media.createAudioPlayer({ url: 'https://example.com/stream.mp3' });
|
|
@@ -31,7 +31,7 @@ Ti.App.addEventListener('pause', () => { streamer.setPaused(true); });
|
|
|
31
31
|
Ti.App.addEventListener('resume', () => { streamer.setPaused(false); });
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
### Recording
|
|
34
|
+
### Recording audio (Ti.Media.AudioRecorder)
|
|
35
35
|
- Requires microphone permission
|
|
36
36
|
- Properties:
|
|
37
37
|
- `compression`: `Ti.Media.AUDIO_FORMAT_ULAW` (low-fi) or `AUDIO_FORMAT_LINEAR_PCM` (hi-fi)
|
|
@@ -40,20 +40,20 @@ Ti.App.addEventListener('resume', () => { streamer.setPaused(false); });
|
|
|
40
40
|
|
|
41
41
|
## 2. Video APIs (Ti.Media.VideoPlayer)
|
|
42
42
|
|
|
43
|
-
### Cross-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
43
|
+
### Cross-platform considerations
|
|
44
|
+
- Android: must be fullscreen (Intent-based, not a view proxy)
|
|
45
|
+
- iOS: can be embedded or fullscreen; set `height` and `width` for embedded
|
|
46
46
|
|
|
47
|
-
### Basic
|
|
48
|
-
- `url
|
|
49
|
-
- `autoplay=true`:
|
|
47
|
+
### Basic usage
|
|
48
|
+
- `url`: local file path or remote URL
|
|
49
|
+
- `autoplay=true`: auto-start when rendered
|
|
50
50
|
- `movieControlStyle`: `Ti.Media.VIDEO_CONTROL_EMBEDDED` for embedded controls
|
|
51
|
-
- `scalingMode`:
|
|
51
|
+
- `scalingMode`: control fill/fit behavior
|
|
52
52
|
|
|
53
53
|
```javascript
|
|
54
54
|
const videoPlayer = Ti.Media.createVideoPlayer({
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
url: 'movie.mp4',
|
|
56
|
+
scalingMode: Ti.Media.VIDEO_SCALING_ASPECT_FIT // or ASPECT_FILL, MODE_FILL, NONE
|
|
57
57
|
});
|
|
58
58
|
```
|
|
59
59
|
|
|
@@ -73,37 +73,37 @@ if (Ti.Platform.osname === 'iphone' || Ti.Platform.osname === 'ipad') {
|
|
|
73
73
|
win.addEventListener('close', () => { player.stop(); });
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
### Key
|
|
77
|
-
- `complete`:
|
|
78
|
-
- `load`:
|
|
79
|
-
- `fullscreen`:
|
|
80
|
-
|
|
81
|
-
## 3. Camera and Photo Gallery APIs
|
|
76
|
+
### Key events
|
|
77
|
+
- `complete`: playback ended (check `e.reason` vs `Ti.Media.VIDEO_FINISH_REASON_PLAYBACK_ENDED`)
|
|
78
|
+
- `load`: movie finished loading
|
|
79
|
+
- `fullscreen`: entered/exited fullscreen (check `e.entering`)
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
## 3. Camera and photo gallery APIs
|
|
84
82
|
|
|
83
|
+
### Camera availability and permissions
|
|
85
84
|
Always check device support and permissions before opening the camera:
|
|
86
85
|
|
|
87
86
|
```javascript
|
|
88
87
|
if (!Ti.Media.isCameraSupported) {
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
Ti.API.warn('No camera available on this device');
|
|
89
|
+
return;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
if (Ti.Media.hasCameraPermissions()) {
|
|
94
|
-
|
|
93
|
+
openCamera();
|
|
95
94
|
} else {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
Ti.Media.requestCameraPermissions((e) => {
|
|
96
|
+
if (e.success) {
|
|
97
|
+
openCamera();
|
|
98
|
+
} else {
|
|
99
|
+
Ti.API.error('Camera permission denied');
|
|
100
|
+
}
|
|
101
|
+
});
|
|
103
102
|
}
|
|
104
103
|
```
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
Required `tiapp.xml` keys (iOS):
|
|
106
|
+
|
|
107
107
|
```xml
|
|
108
108
|
<key>NSCameraUsageDescription</key>
|
|
109
109
|
<string>We need camera access to take photos</string>
|
|
@@ -113,57 +113,57 @@ if (Ti.Media.hasCameraPermissions()) {
|
|
|
113
113
|
|
|
114
114
|
### Camera (Ti.Media.showCamera)
|
|
115
115
|
- Requires camera permission and usage descriptions
|
|
116
|
-
- Success callback provides `event.media` (
|
|
117
|
-
- Use `saveToPhotoGallery: true` to
|
|
116
|
+
- Success callback provides `event.media` (Blob)
|
|
117
|
+
- Use `saveToPhotoGallery: true` to auto-save
|
|
118
118
|
- Handle `cancel` and `error` callbacks
|
|
119
119
|
|
|
120
|
-
### Front and
|
|
120
|
+
### Front and rear camera
|
|
121
121
|
```javascript
|
|
122
122
|
const cameras = Ti.Media.availableCameras;
|
|
123
123
|
|
|
124
124
|
// Check if front camera exists
|
|
125
125
|
if (cameras.indexOf(Ti.Media.CAMERA_FRONT) !== -1) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
Ti.Media.showCamera({
|
|
127
|
+
whichCamera: Ti.Media.CAMERA_FRONT,
|
|
128
|
+
// ... other options
|
|
129
|
+
});
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// Switch camera programmatically
|
|
133
133
|
Ti.Media.switchCamera(Ti.Media.CAMERA_REAR);
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
### Advanced
|
|
137
|
-
| Property
|
|
138
|
-
|
|
139
|
-
| `autohide`
|
|
140
|
-
| `animated`
|
|
141
|
-
| `allowEditing`
|
|
142
|
-
| `mediaTypes`
|
|
143
|
-
| `videoMaximumDuration` | Max video duration in milliseconds
|
|
144
|
-
| `videoQuality`
|
|
145
|
-
| `overlay`
|
|
146
|
-
| `showControls`
|
|
136
|
+
### Advanced camera options (iOS)
|
|
137
|
+
| Property | Description |
|
|
138
|
+
| ---------------------- | ----------------------------------------------- |
|
|
139
|
+
| `autohide` | Auto-hide camera after capture (default: true) |
|
|
140
|
+
| `animated` | Animate camera appearance |
|
|
141
|
+
| `allowEditing` | Allow user to crop/edit after capture |
|
|
142
|
+
| `mediaTypes` | Array: `MEDIA_TYPE_PHOTO`, `MEDIA_TYPE_VIDEO` |
|
|
143
|
+
| `videoMaximumDuration` | Max video duration in milliseconds |
|
|
144
|
+
| `videoQuality` | `QUALITY_HIGH`, `QUALITY_MEDIUM`, `QUALITY_LOW` |
|
|
145
|
+
| `overlay` | Custom `Ti.UI.View` overlay on camera |
|
|
146
|
+
| `showControls` | Show/hide default camera controls |
|
|
147
147
|
|
|
148
148
|
When using a custom overlay, call `Ti.Media.takePicture()` to capture and `Ti.Media.hideCamera()` to dismiss.
|
|
149
149
|
|
|
150
150
|
### Gallery (Ti.Media.openPhotoGallery)
|
|
151
|
-
- Success callback provides `event.media` (
|
|
152
|
-
- Note: `event.media` may contain
|
|
151
|
+
- Success callback provides `event.media` (Blob)
|
|
152
|
+
- Note: `event.media` may only contain file info. Use `Ti.Filesystem.getFile(event.media.nativePath)` to access the actual file.
|
|
153
153
|
|
|
154
|
-
### iPad-
|
|
154
|
+
### iPad-specific gallery options
|
|
155
155
|
On iPad, the photo gallery opens as a popover. Configure its position:
|
|
156
|
+
|
|
156
157
|
```javascript
|
|
157
158
|
Ti.Media.openPhotoGallery({
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
popoverView: myButton, // Anchor popover to this view
|
|
160
|
+
arrowDirection: Ti.UI.iPad.POPOVER_ARROW_DIRECTION_UP,
|
|
161
|
+
success: (e) => { /* ... */ }
|
|
161
162
|
});
|
|
162
163
|
```
|
|
163
164
|
|
|
164
|
-
### Memory
|
|
165
|
-
|
|
166
|
-
- For display: Resize to target dimensions before assigning to ImageView
|
|
165
|
+
### Memory management
|
|
166
|
+
Use `imageAsResized()` on blobs to avoid memory exhaustion. Resize to target dimensions before assigning to an ImageView.
|
|
167
167
|
|
|
168
168
|
```javascript
|
|
169
169
|
Ti.Media.showCamera({
|
|
@@ -178,49 +178,50 @@ Ti.Media.showCamera({
|
|
|
178
178
|
|
|
179
179
|
## 4. Images and ImageView APIs
|
|
180
180
|
|
|
181
|
-
### Background
|
|
181
|
+
### Background images
|
|
182
182
|
- Scaled to fit component dimensions by default
|
|
183
|
-
-
|
|
184
|
-
-
|
|
183
|
+
- iOS: use `backgroundLeftCap` and `backgroundTopCap` to control stretch regions
|
|
184
|
+
- Android: supports remote URLs as background images; iOS does not
|
|
185
185
|
|
|
186
|
-
### Image
|
|
186
|
+
### Image stretching (background images)
|
|
187
187
|
When using small images as backgrounds, iOS and Android stretch differently:
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
188
|
+
- `backgroundLeftCap` (iOS): pixels from the left that are not stretched. The middle section stretches.
|
|
189
|
+
- `backgroundTopCap` (iOS): pixels from the top that are not stretched.
|
|
190
|
+
- Android: supports remote URLs for background images; iOS does not.
|
|
191
191
|
|
|
192
|
-
### ImageView
|
|
193
|
-
- `image`
|
|
192
|
+
### ImageView component
|
|
193
|
+
- `image` accepts: URL, local path, or `Ti.Filesystem.File`
|
|
194
194
|
- Scaling behavior:
|
|
195
|
-
- Both `height`
|
|
196
|
-
- Only
|
|
197
|
-
- `defaultImage`:
|
|
195
|
+
- Both `height` and `width` specified: unproportional scale (aspect ratio not maintained)
|
|
196
|
+
- Only one dimension specified: proportional scale (aspect ratio maintained)
|
|
197
|
+
- `defaultImage`: local image to show while remote image loads
|
|
198
198
|
|
|
199
|
-
### Density-
|
|
199
|
+
### Density-specific images
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
Android: place in resolution-specific directories:
|
|
202
202
|
- `res-ldpi`, `res-mdpi`, `res-hdpi`, `res-xhdpi`, `res-xxhdpi`, `res-xxxhdpi`
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
- `foo.png` -
|
|
206
|
-
- `foo@2x.png` -
|
|
204
|
+
iOS: use naming convention:
|
|
205
|
+
- `foo.png` - non-retina
|
|
206
|
+
- `foo@2x.png` - retina
|
|
207
207
|
- `foo@3x.png` - iPhone 6 Plus
|
|
208
208
|
- `foo~iphone.png` - iPhone-specific
|
|
209
209
|
- `foo~ipad.png` - iPad-specific
|
|
210
210
|
|
|
211
211
|
For remote density-specific images on iOS:
|
|
212
|
+
|
|
212
213
|
```javascript
|
|
213
214
|
const density = Ti.Platform.displayCaps.logicalDensityFactor;
|
|
214
215
|
const url = `https://example.com/image@${density}x.png`;
|
|
215
216
|
const imageView = Ti.UI.createImageView({
|
|
216
217
|
image: url,
|
|
217
|
-
hires: true
|
|
218
|
+
hires: true // Indicates high-resolution remote image
|
|
218
219
|
});
|
|
219
220
|
```
|
|
220
221
|
|
|
221
|
-
### Flipbook
|
|
222
|
-
- Assign array of images to `images`
|
|
223
|
-
- `duration`:
|
|
222
|
+
### Flipbook animations
|
|
223
|
+
- Assign an array of images to `images`
|
|
224
|
+
- `duration`: milliseconds between frames
|
|
224
225
|
- `repeatCount`: 0 = infinite, >1 = specific count
|
|
225
226
|
|
|
226
227
|
```javascript
|
|
@@ -233,10 +234,10 @@ const animationView = Ti.UI.createImageView({
|
|
|
233
234
|
duration: 100,
|
|
234
235
|
repeatCount: 0
|
|
235
236
|
});
|
|
236
|
-
// animationView.stop() / animationView.start()
|
|
237
|
+
// animationView.stop() / animationView.start() to control
|
|
237
238
|
```
|
|
238
239
|
|
|
239
|
-
## Permissions
|
|
240
|
+
## Permissions checklist
|
|
240
241
|
|
|
241
242
|
### iOS (tiapp.xml)
|
|
242
243
|
```xml
|