@maccesar/titools 3.3.0 → 4.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.
- package/README.md +27 -61
- package/lib/cleanup.js +29 -0
- package/lib/commands/agents.js +8 -7
- package/lib/commands/skills.js +118 -23
- package/lib/config.js +13 -15
- package/lib/installer.js +5 -3
- package/lib/utils.js +36 -0
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +188 -0
- package/skills/alloy-guides/references/CLI_TASKS.md +233 -0
- package/skills/alloy-guides/references/CONCEPTS.md +171 -0
- package/skills/alloy-guides/references/CONTROLLERS.md +279 -0
- package/skills/alloy-guides/references/MODELS.md +742 -0
- package/skills/alloy-guides/references/MODELS_ADVANCED.md +482 -0
- package/skills/alloy-guides/references/PURGETSS.md +57 -0
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +235 -0
- package/skills/alloy-guides/references/VIEWS_STYLES.md +375 -0
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +102 -0
- package/skills/alloy-guides/references/VIEWS_XML.md +581 -0
- package/skills/alloy-guides/references/WIDGETS.md +160 -0
- package/skills/alloy-howtos/SKILL.md +179 -0
- package/skills/alloy-howtos/references/best_practices.md +121 -0
- package/skills/alloy-howtos/references/cli_reference.md +230 -0
- package/skills/alloy-howtos/references/config_files.md +158 -0
- package/skills/alloy-howtos/references/custom_tags.md +148 -0
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +78 -0
- package/skills/alloy-howtos/references/samples.md +156 -0
- package/skills/purgetss/SKILL.md +6 -3
- package/skills/purgetss/references/EXAMPLES.md +8 -6
- package/skills/purgetss/references/app-branding.md +5 -0
- package/skills/purgetss/references/apply-directive.md +1 -1
- package/skills/purgetss/references/class-categories.md +1 -1
- package/skills/purgetss/references/class-index-properties.md +618 -0
- package/skills/purgetss/references/class-index.md +4 -610
- package/skills/purgetss/references/cli-commands.md +15 -0
- package/skills/purgetss/references/custom-fonts.md +39 -36
- package/skills/purgetss/references/custom-rules.md +1 -1
- package/skills/purgetss/references/customization-deep-dive.md +64 -1
- package/skills/purgetss/references/icon-fonts.md +2 -0
- package/skills/purgetss/references/migration-guide.md +53 -1
- package/skills/purgetss/references/multi-density-images.md +53 -2
- package/skills/purgetss/references/svg-pipeline.md +249 -0
- package/skills/purgetss/references/tikit-components.md +2 -2
- package/skills/purgetss/references/titanium-resets.md +2 -2
- package/skills/purgetss/references/ui-ux-design.md +7 -5
- package/skills/purgetss/references/version-history.md +12 -0
- package/skills/ti-api/SKILL.md +128 -0
- package/skills/ti-api/references/api-android.md +675 -0
- package/skills/ti-api/references/api-app-platform.md +636 -0
- package/skills/ti-api/references/api-core.md +764 -0
- package/skills/ti-api/references/api-data-network.md +641 -0
- package/skills/ti-api/references/api-media.md +655 -0
- package/skills/ti-api/references/api-modules-ble-bluetooth.md +657 -0
- package/skills/ti-api/references/api-modules-coremotion-urlsession.md +411 -0
- package/skills/ti-api/references/api-modules-map.md +632 -0
- package/skills/ti-api/references/api-modules-nfc.md +725 -0
- package/skills/ti-api/references/api-modules-social-misc.md +526 -0
- package/skills/ti-api/references/api-services.md +700 -0
- package/skills/ti-api/references/api-ui-android.md +499 -0
- package/skills/ti-api/references/api-ui-extras.md +702 -0
- package/skills/ti-api/references/api-ui-ios-animator.md +378 -0
- package/skills/ti-api/references/api-ui-ios.md +756 -0
- package/skills/ti-api/references/api-ui-lists.md +581 -0
- package/skills/ti-api/references/api-ui-text-input.md +607 -0
- package/skills/ti-api/references/api-ui-views.md +572 -0
- package/skills/ti-api/references/api-ui-windows-navigation.md +676 -0
- package/skills/ti-api/references/api-xml-global.md +743 -0
- package/skills/ti-guides/SKILL.md +82 -0
- package/skills/ti-guides/references/advanced-data-and-images.md +155 -0
- package/skills/ti-guides/references/android-manifest.md +97 -0
- package/skills/ti-guides/references/app-distribution.md +373 -0
- package/skills/ti-guides/references/application-frameworks.md +366 -0
- package/skills/ti-guides/references/cli-reference.md +700 -0
- package/skills/ti-guides/references/coding-best-practices.md +150 -0
- package/skills/ti-guides/references/commonjs-advanced.md +279 -0
- package/skills/ti-guides/references/hello-world.md +99 -0
- package/skills/ti-guides/references/hyperloop-native-access.md +458 -0
- package/skills/ti-guides/references/javascript-primer.md +402 -0
- package/skills/ti-guides/references/reserved-words.md +36 -0
- package/skills/ti-guides/references/resources.md +172 -0
- package/skills/ti-guides/references/style-and-conventions.md +104 -0
- package/skills/ti-guides/references/tiapp-config.md +655 -0
- package/skills/ti-howtos/SKILL.md +131 -0
- package/skills/ti-howtos/references/android-platform-deep-dives.md +609 -0
- package/skills/ti-howtos/references/automation-fastlane-appium.md +96 -0
- package/skills/ti-howtos/references/buffer-codec-streams.md +162 -0
- package/skills/ti-howtos/references/cross-platform-development.md +358 -0
- package/skills/ti-howtos/references/debugging-profiling.md +473 -0
- package/skills/ti-howtos/references/extending-titanium.md +684 -0
- package/skills/ti-howtos/references/google-maps-v2.md +172 -0
- package/skills/ti-howtos/references/ios-map-kit.md +149 -0
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +595 -0
- package/skills/ti-howtos/references/local-data-sources.md +310 -0
- package/skills/ti-howtos/references/location-and-maps.md +267 -0
- package/skills/ti-howtos/references/media-apis.md +268 -0
- package/skills/ti-howtos/references/notification-services.md +539 -0
- package/skills/ti-howtos/references/remote-data-sources.md +339 -0
- package/skills/ti-howtos/references/tutorials.md +552 -0
- package/skills/ti-howtos/references/using-modules.md +182 -0
- package/skills/ti-howtos/references/web-content-integration.md +288 -0
- package/skills/ti-howtos/references/webpack-build-pipeline.md +125 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Google Maps v2 for Android
|
|
2
|
+
|
|
3
|
+
Guide to implementing native maps on Android using the `ti.map` module (v2).
|
|
4
|
+
|
|
5
|
+
## 1. Initial configuration
|
|
6
|
+
|
|
7
|
+
### Module installation
|
|
8
|
+
Add the module to `tiapp.xml`:
|
|
9
|
+
|
|
10
|
+
```xml
|
|
11
|
+
<modules>
|
|
12
|
+
<module platform="android">ti.map</module>
|
|
13
|
+
</modules>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Obtaining an API key (Google Cloud Console)
|
|
17
|
+
1. Create a project in the Google Cloud Console.
|
|
18
|
+
2. Enable "Maps SDK for Android".
|
|
19
|
+
3. Generate an API key. You will need the application ID from your `tiapp.xml` and the SHA-1 fingerprint from your keystore.
|
|
20
|
+
|
|
21
|
+
#### Get SHA-1 (debug)
|
|
22
|
+
```bash
|
|
23
|
+
keytool -list -v -keystore ~/Library/Application\ Support/titanium/mobilesdk/osx/<VERSION>/android/dev_keystore
|
|
24
|
+
```
|
|
25
|
+
Default password: empty (press Enter).
|
|
26
|
+
|
|
27
|
+
### Configure tiapp.xml
|
|
28
|
+
Add the API key in the Android section:
|
|
29
|
+
|
|
30
|
+
```xml
|
|
31
|
+
<android xmlns:android="http://schemas.android.com/apk/res/android">
|
|
32
|
+
<manifest>
|
|
33
|
+
<application>
|
|
34
|
+
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="YOUR_API_KEY_HERE"/>
|
|
35
|
+
</application>
|
|
36
|
+
</manifest>
|
|
37
|
+
</android>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 2. Google Play Services verification
|
|
41
|
+
|
|
42
|
+
Verify availability before rendering the map:
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
const MapModule = require('ti.map');
|
|
46
|
+
const rc = MapModule.isGooglePlayServicesAvailable();
|
|
47
|
+
|
|
48
|
+
switch (rc) {
|
|
49
|
+
case MapModule.SUCCESS:
|
|
50
|
+
Ti.API.info('Google Play Services available');
|
|
51
|
+
break;
|
|
52
|
+
case MapModule.SERVICE_MISSING:
|
|
53
|
+
Ti.API.error('Google Play Services is missing');
|
|
54
|
+
break;
|
|
55
|
+
case MapModule.SERVICE_VERSION_UPDATE_REQUIRED:
|
|
56
|
+
Ti.API.error('Google Play Services needs update');
|
|
57
|
+
break;
|
|
58
|
+
case MapModule.SERVICE_DISABLED:
|
|
59
|
+
Ti.API.error('Google Play Services is disabled');
|
|
60
|
+
break;
|
|
61
|
+
case MapModule.SERVICE_INVALID:
|
|
62
|
+
Ti.API.error('Google Play Services is invalid');
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 3. Using the map view
|
|
68
|
+
|
|
69
|
+
### Basic creation
|
|
70
|
+
```javascript
|
|
71
|
+
const MapModule = require('ti.map');
|
|
72
|
+
const mapView = MapModule.createView({
|
|
73
|
+
mapType: MapModule.NORMAL_TYPE,
|
|
74
|
+
userLocation: true,
|
|
75
|
+
traffic: true, // Show real-time traffic
|
|
76
|
+
animate: true,
|
|
77
|
+
region: {
|
|
78
|
+
latitude: -33.87365,
|
|
79
|
+
longitude: 151.20689,
|
|
80
|
+
latitudeDelta: 0.1,
|
|
81
|
+
longitudeDelta: 0.1
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Map types
|
|
87
|
+
- `MapModule.NORMAL_TYPE`: standard map
|
|
88
|
+
- `MapModule.SATELLITE_TYPE`: satellite imagery
|
|
89
|
+
- `MapModule.TERRAIN_TYPE`: terrain map
|
|
90
|
+
- `MapModule.HYBRID_TYPE`: satellite with labels
|
|
91
|
+
|
|
92
|
+
## 4. Advanced annotations (pins)
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
const opera = MapModule.createAnnotation({
|
|
96
|
+
latitude: -33.8569,
|
|
97
|
+
longitude: 151.2153,
|
|
98
|
+
title: 'Sydney Opera House',
|
|
99
|
+
subtitle: 'NSW, Australia',
|
|
100
|
+
pincolor: MapModule.ANNOTATION_VIOLET,
|
|
101
|
+
image: 'custom_pin.png', // Custom image
|
|
102
|
+
draggable: true, // Allow pin dragging
|
|
103
|
+
// Complete custom view (replaces the pin)
|
|
104
|
+
customView: Ti.UI.createLabel({ text: 'Pin', backgroundColor: 'white' })
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
mapView.addAnnotation(opera);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Additional annotation properties
|
|
111
|
+
- `customView`: a `Ti.UI.View` that replaces the entire annotation (takes precedence over `image`)
|
|
112
|
+
- `centerOffset`: `{x, y}` offset for the annotation relative to the coordinate
|
|
113
|
+
- `canShowCallout`: whether tapping shows the info bubble (default: `true`)
|
|
114
|
+
|
|
115
|
+
Precedence: `customView` > `image` > default pin. For buttons: `leftView`/`rightView` take precedence over `leftButton`/`rightButton`.
|
|
116
|
+
|
|
117
|
+
### Available pin colors
|
|
118
|
+
`ANNOTATION_AZURE`, `BLUE`, `CYAN`, `GREEN`, `MAGENTA`, `ORANGE`, `RED`, `ROSE`, `VIOLET`, `YELLOW`.
|
|
119
|
+
|
|
120
|
+
## 5. Routes (polylines)
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
const route = MapModule.createRoute({
|
|
124
|
+
width: 5,
|
|
125
|
+
color: '#f00',
|
|
126
|
+
points: [
|
|
127
|
+
{ latitude: -33.8569, longitude: 151.2153 },
|
|
128
|
+
{ latitude: -33.8522, longitude: 151.2105 }
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
mapView.addRoute(route);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 6. Critical events
|
|
136
|
+
|
|
137
|
+
```javascript
|
|
138
|
+
// Detect click on annotation or its buttons
|
|
139
|
+
mapView.addEventListener('click', (e) => {
|
|
140
|
+
if (e.clicksource === 'pin') {
|
|
141
|
+
Ti.API.info(`Pin clicked: ${e.title}`);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Detect drag state changes
|
|
146
|
+
// e.newState holds the drag state constant; e.annotation holds the annotation object
|
|
147
|
+
mapView.addEventListener('pinchangedragstate', (e) => {
|
|
148
|
+
if (e.newState === MapModule.ANNOTATION_DRAG_STATE_END) {
|
|
149
|
+
Ti.API.info(`Dropped at: ${e.annotation.latitude}, ${e.annotation.longitude}`);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
// Drag states: ANNOTATION_DRAG_STATE_START, ANNOTATION_DRAG_STATE_END
|
|
153
|
+
|
|
154
|
+
// Detect region changes
|
|
155
|
+
mapView.addEventListener('regionchanged', (e) => {
|
|
156
|
+
Ti.API.info(`New region: ${e.latitude}, ${e.longitude} (delta: ${e.latitudeDelta}, ${e.longitudeDelta})`);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Detect complete rendering
|
|
160
|
+
mapView.addEventListener('complete', (e) => {
|
|
161
|
+
Ti.API.info('Map loaded');
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## 7. Migration from legacy Titanium.Map
|
|
166
|
+
|
|
167
|
+
The `ti.map` module replaced the legacy `Titanium.Map` API. Key differences: use `NORMAL_TYPE` instead of `STANDARD_TYPE`, `ANNOTATION_VIOLET` instead of `ANNOTATION_PURPLE`, and routes are created with `Map.createRoute()` instead of abstract data types. Multiple MapView instances are supported.
|
|
168
|
+
|
|
169
|
+
## 8. Limitations and troubleshooting
|
|
170
|
+
- Single map: Android (legacy) only allows one MapView instance per application. v2 allows multiple views.
|
|
171
|
+
- Blank map: verify the API key and make sure `android:anyDensity` is not set to true in the manifest if you use old resolutions.
|
|
172
|
+
- Simulator: Google Maps v2 is not compatible with the standard emulator without x86 Google Play Services. Test on a real device.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# iOS Map Kit
|
|
2
|
+
|
|
3
|
+
Guide to implementing native maps on iOS with the `ti.map` module.
|
|
4
|
+
|
|
5
|
+
## 1. Initial configuration
|
|
6
|
+
|
|
7
|
+
### Module installation
|
|
8
|
+
Add the module to `tiapp.xml`:
|
|
9
|
+
|
|
10
|
+
```xml
|
|
11
|
+
<modules>
|
|
12
|
+
<module platform="iphone">ti.map</module>
|
|
13
|
+
</modules>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Location permissions (Info.plist)
|
|
17
|
+
Add the required usage descriptions in `tiapp.xml`:
|
|
18
|
+
|
|
19
|
+
```xml
|
|
20
|
+
<ios>
|
|
21
|
+
<plist>
|
|
22
|
+
<dict>
|
|
23
|
+
<key>NSLocationWhenInUseUsageDescription</key>
|
|
24
|
+
<string>We need your location to show it on the map.</string>
|
|
25
|
+
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
|
26
|
+
<string>We need continuous location access for navigation.</string>
|
|
27
|
+
</dict>
|
|
28
|
+
</plist>
|
|
29
|
+
</ios>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
iOS 11+: include both `NSLocationWhenInUseUsageDescription` and `NSLocationAlwaysAndWhenInUseUsageDescription`. Users can still choose "When in Use" even if you request "Always".
|
|
33
|
+
|
|
34
|
+
## 2. Using the map view
|
|
35
|
+
|
|
36
|
+
### Basic creation
|
|
37
|
+
```javascript
|
|
38
|
+
const MapModule = require('ti.map');
|
|
39
|
+
const mapView = MapModule.createView({
|
|
40
|
+
mapType: MapModule.NORMAL_TYPE, // Also: SATELLITE_TYPE, HYBRID_TYPE, STANDARD_TYPE (alias for NORMAL_TYPE with labels)
|
|
41
|
+
userLocation: true,
|
|
42
|
+
rotatesEnabled: true, // Allow two-finger rotation
|
|
43
|
+
region: {
|
|
44
|
+
latitude: 48.8582,
|
|
45
|
+
longitude: 2.2945,
|
|
46
|
+
latitudeDelta: 0.02,
|
|
47
|
+
longitudeDelta: 0.02
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 3. 3D camera (perspective)
|
|
53
|
+
|
|
54
|
+
iOS lets you tilt and rotate the map for 3D views.
|
|
55
|
+
|
|
56
|
+
Important: the map must be visible on screen before using camera APIs. Wait for the `complete` event before calling `animateCamera()` or setting camera properties.
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
const myCam = MapModule.createCamera({
|
|
60
|
+
altitude: 300, // meters above ground
|
|
61
|
+
centerCoordinate: { latitude: 48.8582, longitude: 2.2945 },
|
|
62
|
+
heading: -45, // angle relative to North
|
|
63
|
+
pitch: 60 // tilt angle downward
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Apply camera with animation
|
|
67
|
+
mapView.animateCamera({
|
|
68
|
+
camera: myCam,
|
|
69
|
+
curve: Ti.UI.ANIMATION_CURVE_EASE_IN,
|
|
70
|
+
duration: 1000
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Additional 3D view properties
|
|
74
|
+
mapView.pitchEnabled = true;
|
|
75
|
+
mapView.showsBuildings = true; // 3D buildings
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 4. iOS annotations
|
|
79
|
+
|
|
80
|
+
### iOS pin colors
|
|
81
|
+
iOS supports only three pin color constants (unlike Android's ten):
|
|
82
|
+
- `MapModule.ANNOTATION_GREEN`
|
|
83
|
+
- `MapModule.ANNOTATION_PURPLE`
|
|
84
|
+
- `MapModule.ANNOTATION_RED`
|
|
85
|
+
|
|
86
|
+
### System buttons and callouts
|
|
87
|
+
iOS allows native buttons in the pin callout (popup window).
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
const bridge = MapModule.createAnnotation({
|
|
91
|
+
latitude: -33.8522,
|
|
92
|
+
longitude: 151.2105,
|
|
93
|
+
title: 'Harbour Bridge',
|
|
94
|
+
subtitle: 'Port Jackson',
|
|
95
|
+
pincolor: MapModule.ANNOTATION_PURPLE,
|
|
96
|
+
// iOS system buttons in the callout
|
|
97
|
+
leftButton: Ti.UI.iOS.SystemButton.INFO_DARK,
|
|
98
|
+
rightButton: Ti.UI.iOS.SystemButton.CONTACT_ADD,
|
|
99
|
+
canShowCallout: true // Controls whether tapping the annotation shows the callout bubble (default: true)
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
mapView.addAnnotation(bridge);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Center offset
|
|
106
|
+
If you use a custom pin image that is not centered:
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
const customPin = MapModule.createAnnotation({
|
|
110
|
+
image: 'flag.png',
|
|
111
|
+
centerOffset: { x: 10, y: -20 } // Visually moves the pin
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 5. Advanced routes
|
|
116
|
+
|
|
117
|
+
### Overlay levels
|
|
118
|
+
Control whether the route appears above labels or above roads.
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
const route = MapModule.createRoute({
|
|
122
|
+
points: routePoints,
|
|
123
|
+
color: '#00f',
|
|
124
|
+
width: 4,
|
|
125
|
+
level: MapModule.OVERLAY_LEVEL_ABOVE_LABELS // default
|
|
126
|
+
// or MapModule.OVERLAY_LEVEL_ABOVE_ROADS (below labels)
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 6. Events
|
|
131
|
+
|
|
132
|
+
Key map events: `click`, `complete` (map loaded), `regionchanged`, `pinchangedragstate`.
|
|
133
|
+
|
|
134
|
+
Same as Android, but with specialized `clicksource` values for system buttons:
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
mapView.addEventListener('click', (e) => {
|
|
138
|
+
if (e.clicksource === 'leftButton' || e.clicksource === 'rightButton') {
|
|
139
|
+
Ti.API.info('Callout button clicked');
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// e.newState holds the drag state constant; e.annotation holds the annotation object
|
|
144
|
+
mapView.addEventListener('pinchangedragstate', (e) => {
|
|
145
|
+
if (e.newState === MapModule.ANNOTATION_DRAG_STATE_END) {
|
|
146
|
+
Ti.API.info(`Dropped at: ${e.annotation.latitude}, ${e.annotation.longitude}`);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
```
|