Skip to content

Commit 5714ff9

Browse files
committed
Made incoming call message format customizable.
1 parent e35e87b commit 5714ff9

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

WatchApp/resources/properties.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<property id="showSourceVersion" type="boolean">false</property>
1414
<property id="dummySourceVersion" type="string"></property>
1515
<property id="customGlanceTitle" type="string"></property>
16+
<property id="incomingCallMessageFormat" type="string">&lt;$1$</property>
1617
<property id="forceLargeFonts" type="boolean">false</property>
1718
<property id="eraseAppDataOnNextLaunch" type="boolean">false</property>
1819
<property id="incomingOpenAppViaCompanion" type="boolean">false</property>
@@ -30,6 +31,8 @@
3031
<string id="secondsToCheckIn">Timeout for check-in (sec)</string>
3132
<string id="showSourceVersion">Show source verison in the app</string>
3233
<string id="customGlanceTitle">Custom title for glance</string>
34+
<string id="incomingCallMessageFormat">Incoming call message format (use $1$ as the contact
35+
name/phone number placeholder)</string>
3336
<string id="forceLargeFonts">Force large fonts</string>
3437
<string id="eraseAppDataOnNextLaunch">Erase data on next launch</string>
3538
<string id="incomingOpenAppViaCompanion">Open app on incoming call</string>
@@ -47,6 +50,10 @@
4750
<setting propertyKey="@Properties.customGlanceTitle" title="@Strings.customGlanceTitle">
4851
<settingConfig type="alphaNumeric" />
4952
</setting>
53+
<setting propertyKey="@Properties.incomingCallMessageFormat"
54+
title="@Strings.incomingCallMessageFormat">
55+
<settingConfig type="alphaNumeric" />
56+
</setting>
5057
<setting propertyKey="@Properties.eraseAppDataOnNextLaunch"
5158
title="@Strings.eraseAppDataOnNextLaunch">
5259
<settingConfig type="boolean" />

WatchApp/source/BusinessLogic/OpeningAppOnIncomingCall.mc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ function openAppOnIncomingCall(phone as Phone) as Void {
3535
function messageForApplicationWake(phone as Phone) as Lang.String {
3636
var name = phone["name"] as Lang.String or Null;
3737
if (name != null) {
38-
return "< " + name;
38+
return incomingCallMessage(name);
3939
}
4040
var number = phone["number"] as Lang.String or Null;
4141
if (number != null) {
42-
return "< " + number;
42+
return incomingCallMessage(number);
4343
}
4444
return "Incoming call";
4545
}
46+
47+
(:background, :glance)
48+
function incomingCallMessage(phone as Lang.String) as Lang.String {
49+
return Lang.format(incomingCallMessageFormat(), [phone]);
50+
}

WatchApp/source/Utilities/Settings.mc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,8 @@ function isIncomingOpenAppViaCompanionEnabled() as Lang.Boolean {
6666
function isIncomingOpenAppViaWakeUpEnabled() as Lang.Boolean {
6767
return Application.Properties.getValue("incomingOpenAppViaWakeUp") as Lang.Boolean;
6868
}
69+
70+
(:background, :glance)
71+
function incomingCallMessageFormat() as Lang.String {
72+
return Application.Properties.getValue("incomingCallMessageFormat") as Lang.String;
73+
}

WatchApp/source/Views/GlanceView.mc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class GlanceView extends WatchUi.GlanceView {
6868
var number = phone["number"] as Lang.String or Null;
6969
if (isIncomingCall) {
7070
if (number != null) {
71-
subtitle = "< " + number;
71+
subtitle = incomingCallMessage(number);
7272
} else {
7373
subtitle = "Incoming call";
7474
}

0 commit comments

Comments
 (0)