usernotificationmanager - TogetherGames/Public-Corona-Lua GitHub Wiki

UserNotificationManager

together.UserNotificationManager

Overview

The UserNotificationManager class contains a collection UserNotifications. With this class, a developer will be able to Create, Delete, Retrieve All, and Process UserNotifications.


Members

table UserNotifications

Stores all the UserNotifications contained in the Manager.


Methods


Add()

Adds a UserNotification to the internally managed list without persistence.

Note
This method is deprecated

Returns void
Syntax
UserNotificationManager:Add( userNotification )
Parameters

TogetherUserNotification userNotification

Instance of a UserNotification to add internally

--------------------------------------------------------------------------------

FindByUserNotificationID()

Finds the UserNotification with the specified UserNotificationID if it exists, otherwise returns nil.

Syntax
UserNotificationManager:FindByUserNotificationID( userNotificationID )
Parameters

number userNotificationID

The ID of the UserNotification to find

--------------------------------------------------------------------------------

GetCount()

Gets the number of UserNotifications currently managed internally.

Returns number
Syntax
UserNotificationManager:GetCount(  )

Get()

Gets the UserNotification at the specified index if it exists, otherwise returns nil.

Syntax
UserNotificationManager:Get( index )
Parameters

number index

The index of the UserNotification to find

--------------------------------------------------------------------------------

IndexOf()

Returns the index of the specified UserNotification if it exists, otherwise returns nil.

Returns number
Syntax
UserNotificationManager:IndexOf( userNotification )
Parameters

TogetherUserNotification userNotification

Instance of the UserNotification to find the index of

--------------------------------------------------------------------------------

IndexOfByUserNotificationID()

Returns the index of the UserNotification with the specified UserNotificationID if it exists, otherwise returns -1.

Returns number
Syntax
UserNotificationManager:IndexOfByUserNotificationID( userNotificationID )
Parameters

number userNotificationID

The ID of the UserNotification to find the index of

--------------------------------------------------------------------------------

Remove()

Removes a UserNotification from the internally managed list. This does not delete the notification from the user's account persistently.

Note
This method is deprecated

Returns void
Syntax
UserNotificationManager:Remove( index )
Parameters

number index

The index of the UserNotification to remove internally

--------------------------------------------------------------------------------

Create()

Creates a new UserNotification. Upon success, this will automatically update the internal list.

Returns void
Syntax
UserNotificationManager:Create( destUserID, type, message, originalGameInstanceID, gameInstanceID, achievementID, chatRoomID, itemID, itemCount, socialType, socialID, callbackFunc )
Parameters

number destUserID

The ID of the User to send the UserNotification to.

[string](#) type

The type of UserNotification being created.

[string](#) message

The message of the UserNotification.

[number](#) originalGameInstanceID

The original GameInstanceID played before creating a rematch. Pass in 0 if this UserNotification does not pertain to a rematch.

[number](#) gameInstanceID

The ID of the GameInstance assigned to the UserNotification.

[number](#) achievementID

The ID of the Achievement assigned to the UserNotification.

[number](#) chatRoomID

The ID of the ChatRoom assigned to the UserNotification.

[number](#) itemID

The ID of the Item assigned to the UserNotification.

[number](#) itemCount

The number of Items assigned to the UserNotification.

[string](#) socialType

The type of social network which caused the UserNotification to be created. Pass in "FB" for Facebook. Pass in "" if not specified.

[string](#) socialID

The ID of the user on a social network. Pass in the user's FacebookID for Facebook. Pass in "0" if not specified.

[function](#) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

Delete()

Deletes a UserNotification. Upon success, this will automatically update the internal list.

Returns void
Syntax
UserNotificationManager:Delete( userNotificationID, callbackFunc )
Parameters

number userNotificationID

The ID of the UserNotification to delete

[function](#) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

GetAll()

Gets all UserNotifications for the User. Upon success, this will automatically update the internal list.

Returns void
Syntax
UserNotificationManager:GetAll( processed, callbackFunc )
Parameters

boolean processed

A boolean indicating whether processed or unprocessed UserNotifications should be retrieved

[function](#) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

Process()

Processes a UserNotification. Upon success, this will automatically update the internal list.

Returns void
Syntax
UserNotificationManager:Process( userNotificationID, accepted, callbackFunc )
Parameters

number userNotificationID

The ID of the UserNotification that is to be processed.

[boolean](#) accepted

A boolean indicated whether the UserNotfication was accepted. Users must accept UserNotifications in order to create/join a rematch GameInstance or be awarded Achievements or Items.

[function](#) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------
⚠️ **GitHub.com Fallback** ⚠️