Titanium News #17
Tags: titaniumsdk, mobile, javascript, news
Published: 2023-10-10 18:25:50

<small>Older posts can be found [here](https://dev.to/miga).</small>

# Intro

It's been a long time since the last news update. Been busy with other projects :smile: Many Titanium related of course.

Titanium 12.2.1.GA, whats new in main branch and many modules updates.

# Titanium 12.2.1.GA

Happy to announce that Titanium 12.2.x is available! The latest 12.2.1 bugfix release fixed some issues that where found after 12.2.0. Titanium 12.2.1 is packed with fixes and updates again. You can check all in the [12.2.0.GA release notes](https://titaniumsdk.com/guide/Titanium_SDK/Titanium_SDK_Release_Notes/Titanium_SDK_Release_Notes_12.x/Titanium_SDK_12.2.0.GA_Release_Note.html) and the [12.2.1.GA release notes](https://titaniumsdk.com/guide/Titanium_SDK/Titanium_SDK_Release_Notes/Titanium_SDK_Release_Notes_12.x/Titanium_SDK_12.2.1.GA_Release_Note.html).

Some highlights are:

### Reduced TableView updates on Android - [PR](https://github.com/tidev/titanium-sdk/pull/13526)
The amount of row updates was reduced a lot when you set the `data` property of a TableView. In a simple test with just 20 lines the internal update function was called only 23 times instead of 43 times. 

### New ListView scrolling event property `forceUpdates` - [PR](https://github.com/tidev/titanium-sdk/pull/13830)

[Video](https://user-images.githubusercontent.com/4334997/237404559-061d6435-d3bf-4b66-9cf7-d009728c508c.mp4)

`forceUpdates` is a new property that you can use in combination with `continuousUpdate`. If you enable both you'll get scroll updates for almost every pixel (as fast as it can) and you receive the scrolled `top` position of your ListView. With this you can hide/show elements based on the scroll position. Full example can be found in the PR.

### Different TabGroup tabModes on Android - [PR](https://github.com/tidev/titanium-sdk/pull/13877)

![tabmodes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dj7jdqtbg57elewntqjx.png)

When opening a TabGroup you can set it to be either fixed (`Ti.UI.Android.TAB_MODE_FIXED`) or scrollable (`Ti.UI.Android.TAB_MODE_SCROLLABLE`).

### Android: new property `badgeTextColor` [PR](https://github.com/tidev/titanium-sdk/pull/13874)

![badge](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o87rnptqp50bkm6e98c3.png)

`badgeTextColor` can be used in combination with ` badgeBackgroundColor` to style the BottomNavigation badge on Android.

### Android: Secure Ti.Network.Socket [PR](https://github.com/tidev/titanium-sdk/pull/13774)
If you use a TCP socket in Titanium you can enable `secure:true` on Android now to use a SSLSocket connection.

### Android: make rotationX, rotationY animatable - [PR](https://github.com/tidev/titanium-sdk/pull/13824)
Android has two properties `rotationX` and `rotationY` that allow you to quickly set the rotation of an element. Those properties can now be used in the `animate` method. A full example + video is available in the PR.

### Android: CameraX - [PR](https://github.com/tidev/titanium-sdk/pull/12395)

![camerax](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/611ab55bz1gkw684270x.jpg)
One of the bigger changes is that CameraX is included now! If you want to use it you can enable it with `useCameraX:true` inside the `showCamera` properties. It only works in combination with an overlay (otherwise the normal camera was used) but it has many new properties like `aspectRatio`, `scalingMode`, `verticalAlign`, `targetImageWidth/Height`. 
Check the PR for more examples and images. Feel free to opt-in to CameraX and start using it. 

### modernize Apple Script to open Xcode - [PR](https://github.com/tidev/titanium-sdk/pull/13898)

After quite some time the Apple script to open Xcode was modernized including support of the macOS system settings app, clean up and better wording in the dialog.

### iOS: support for DRM-encrypted video assets - [PR](https://github.com/tidev/titanium-sdk/pull/13844)
Use `fairPlayConfiguration` inside the VideoPlayer in order to play DRM-encrypted videos.

### iOS: `keyboardDismissMode` for TableViews - [PR](https://github.com/tidev/titanium-sdk/pull/13860)
After adding `keyboardDismissMode` in ListViews it is now available for TableViews, too.

### macOS: Build fixes for macOS (Catalyst) builds - [PR](https://github.com/tidev/titanium-sdk/pull/13903)
Build fixes for macOS builds.

### iOS: fix orientation of the thumbnail image created from a video - [PR](https://github.com/tidev/titanium-sdk/pull/13859)
If you create thumbnails from videos they will be in the correct orientation now.

And there are only a few of the pull request that were merged into 12.2.0. Big :clap: to the community and all contributors :rocket:

# Preview

The next release with new features will be 12.3.0. Some possible pull request that could make it in to that version are:

* [iOS 17+ spring animations](https://github.com/tidev/titanium-sdk/pull/13891)
* [iOS: expose Ti.UI.Window.largeTitleAttributes](https://github.com/tidev/titanium-sdk/pull/13896)
* [Android: hyphenation modes for labels](label breakStrategy & hyphenationFrequency) - <b>already merged</b>
* [rotate event for views](https://github.com/tidev/titanium-sdk/pull/13882)
* [Andorid: EncryptedSharedPreferences](https://github.com/tidev/titanium-sdk/pull/13848)

and more. Currently we have [63 open PR](https://github.com/tidev/titanium-sdk/pulls) but feel free to add more or test them.

### Titanium CLI v7 (alpha)
Behind the scenes one of the core developers [@cb1kenobi](https://github.com/cb1kenobi) is working on a new, modernized Titanium CLI. You can follow his progress in the [alpha PR](https://github.com/tidev/titanium-cli/pull/618) post. 

# Modules

* Firebase modules: almost all firebase modules have been updated. A quick way to see the latest version was merged into the main repo: https://github.com/hansemannn/titanium-firebase#features
* [ti.mmkv](https://github.com/m1ga/ti.mmkv) - MMKV is an efficient, small, easy-to-use mobile key-value storage. The module is available for Android now
* [ti.ffmpeg](https://github.com/m1ga/ti.ffmpeg) - Thanks for [@narbs](https://github.com/narbs) the ti.ffmpeg module is now available for iOS
* [titanium-thumbnail-generator](https://github.com/hansemannn/titanium-thumbnail-generator) - Generate high performance thumbnails for common file types natively using the Titanium SDK.
* [ti.map](https://github.com/tidev/ti.map) - new [search completion API for iOS](https://github.com/tidev/ti.map/pull/638) and you can get the [bounding box of a polygon](https://github.com/tidev/ti.map/pull/572)
* [ti.facebook](https://github.com/tidev/ti.facebook) - updated Facebook libraries
* [ti.imagefactory](https://github.com/tidev/ti.imagefactory/) - not merged yet but there is a version that has async compression and resizing methods: https://github.com/tidev/ti.imagefactory/pull/336

# Tips & Tricks

### Access database/collections of your Android app

If you use Collections inside your app (or a local database) you can use the following command to grab the Alloy database and dump it to a local file:
```
adb -d shell "run-as com.yourId cat /data/data/com.yourId/databases/_alloy_" > test.db
```
Now you can use e.g. SQLiteBrowser to view it and access it as a normal database. If you make changes in your app can run the command again and press F5 to update the data in SQLiteBrowser. This makes it much quicker to verify the data inside your database and check the collections.

### Optimize GeoJSON data

![geojson](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5m5tnwp981e53o1xk1tj.png)

Some apps require you to use a GeoJSON file to display polygons on your map. Those files can be very big if they are really detailed. 
Luckily there are some tools like https://turfjs.org/docs/#simplify and https://mapshaper.org/ to optimize your files and reduce the content. If you don't need every small border point you can go down from a 1.7MB file to 128KB and still have good enough shape to show it in your app. Smaller files are parsed faster so you can test how low you can go without losing details.


# That's it

If you have feedback or some interesting Titanium SDK apps, modules or widgets you would like to share: get in contact with me or leave a comment and I'll add it to the next `Titanium news`.