Skip to content

Commit 6898376

Browse files
committed
Title Support for iOS
1 parent 8149146 commit 6898376

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

-181 KB
Binary file not shown.
-194 KB
Binary file not shown.

src/Corona/main.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ local scheduleLocalNotification = widget.newButton {
334334
labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } },
335335
onRelease = function(event)
336336
local options = {
337-
alert = "Wake up!",
337+
alert = {title="Cool Title Here", body="Cool Body Here"},--alert="Title Here"
338338
sound = "notification.wav",
339339
badge = 2,
340340
custom = { foo = "bar" }

src/ios/Plugin/IPhoneNotificationEvent.mm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@
135135
}
136136
else if ( lua_istable( L, -1 ) )
137137
{
138+
lua_getfield( L, -1, "title" );
139+
body = lua_tostring( L, -1 );
140+
if ( body )
141+
{
142+
notification.alertTitle = [NSString stringWithUTF8String:body];
143+
}
144+
lua_pop( L, 1 );
145+
138146
lua_getfield( L, -1, "body" );
139147
body = lua_tostring( L, -1 );
140148
if ( body )
@@ -202,7 +210,8 @@
202210

203211
int index = lua_gettop( L );
204212

205-
SetStringField( L, index, "alert", notification, @"alertBody" );
213+
SetStringField( L, index, "title", notification, @"alertTitle" );
214+
SetStringField( L, index, "alert", notification, @"alertBody" );
206215
SetStringField( L, index, "action", notification, @"alertAction" );
207216
SetStringField( L, index, "launchImage", notification, @"alertLaunchImage" );
208217
SetStringField( L, index, "sound", notification, @"soundName" );
@@ -302,6 +311,7 @@
302311
else {
303312
SetStringField( L, index, "alert", notificationData, @"alert" );
304313
}
314+
SetStringField( L, index, "title", notificationData, @"title" );
305315
SetStringField( L, index, "action", notificationData, @"action-loc-key" );
306316
SetStringField( L, index, "launchImage", notificationData, @"launch-image" );
307317

0 commit comments

Comments
 (0)