Deprecated: Return type of I::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 62

Deprecated: Return type of I::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 91

Deprecated: Return type of I::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 71

Deprecated: Return type of I::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 101

Deprecated: Return type of I::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 53

Deprecated: Return type of Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/collection.php on line 80

Deprecated: parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in /home/public/kirby/toolkit/lib/url.php on line 135
One Tap Less | Call and message with a single Launch Center Pro action

Call and message with a single Launch Center Pro action

I maintain a group in Launch Center Pro to quickly reach my important contacts, aka, my girlfriend and my mom. Each one have 2 actions, one for calling and another to write a SMS. Maybe you keep more contacts in your short list, but considering this is a group, you can hold up to 7 contacts there. What if you want to store more contacts? What if you don't want to use a group anymore? We'll squeeze your important contacts into a single action and give you the option to call or send a message.

As usual, we're using a [list] action combined with Launch Center Pro calling itself with launchpro://?url, however, the way you handle tasks are quite different:

tel:<phone number>
launchpro-messaging://?body=[prompt:Type your message]&to=<phone number>

Notice how Launch Center Pro uses the Phone's app own scheme, tel, meanwhile, for SMS, it uses its own shorthand, launchpro-messaging://. I also aimed high and proposed a [prompt] exclusive to the SMS action. So how can we do everything with a single action?

We gonna use 2 lists, one to select what you wanna do (call or sms) and another to pick your contact. Copy everything until the <phone number> from the previous example and url encode it with TextTool or any other app you got in hand. The outcome will be something like this:

tel%3A
launchpro-messaging%3A%2F%2F%3Fbody%3D%5Bprompt%3AType%20your%20message%5D%26to%3D

Yes, you can also copy the example, this part of the action is the same regardless of your contacts. Next, let's create a list with the encoded parameters:

[[list:Call or Message?|Call=tel%3A|Message=launchpro-messaging%3A%2F%2F%3Fbody%3D%5Bprompt%3AType%20your%20message%5D%26to%3D]]

You may ponder about the double brackets. Each item value is already url encoded in a list, however, when you include a [prompt], as I did, it will close the list at the last bracket from the [prompt] parameter. If you used a regular [list] and non-encoded content, you'd be prompted with an error. Why? Because the bracket that was supposed to close the [prompt] parameter actually closes the [list] parameter. Yep, Launch Center Pro is not a big fan of hierarchy. That's why we encode everything and use double brackets, which means LCP should skip encoding the contents of this list.

Now that it is all behind us, let's move on. We'll make Launch Center Pro trigger itself into launching the url scheme chosen in the first list, to achieve that, we must prefix our list with launchpro://?url=. Next, we'll build our second list, the one holding our contacts and their numbers. It is just a straightforward list:

[list:Select your Contact|Name=5555555|Name=4444444]

Now append this list to the whole block and you'll get something like this:

launchpro://?url=[[list:Call or Message?|Call=tel%3A|Message=launchpro-messaging%3A%2F%2F%3Fbody%3D%5Bprompt%3AType%20your%20message%5D%26to%3D]][list:Select your Contact|Name=5555555|Name=4444444]

It works because Launch Center Pro fills every parameter before triggering the action, so first you'll be prompted to pick a method, then a contact. Since the url is now filled, LCP triggers it, launching itself. If you chose the Call method, you won't spot a difference, however, you'll be prompted to type your message if you went for the Message method. You're not prompted previously because we masked our [prompt] with url encoding, so when Launch Center Pro scans the list for the first time it doesn't see it, however, when Launch Center Pro triggers itself, the action is scanned again and the [prompt] parameter is recognized.