BulletinBoard.framework

From iPhone Development Wiki
Jump to: navigation, search
BulletinBoard.framework
Private Framework
com.apple.bulletinboard
Availabile 5.0 – present
Class Prefix BB

BulletinBoard is a private framework which handles Local and Push notifications.

BulletinBoard Findings:

By Amro Thabet aka Brave Heart

The default action of a BBBulletin, use:

@interface BBBulletin : NSObject
@property (nonatomic, copy) BBAction *defaultAction;
@end

BBBulletin *bulletin;
bulletin.defaultAction;

Sub-actions (those that are displayed when the notification is swiped down), use:

BBBulletin *bulletin;
[bulletin supplementaryActions];

To observe new notifications as they arrive:

%hook BBServer
-(void)publishBulletin:(BBBulletin *)bulletin destinations:(unsigned int)arg2 alwaysToLockScreen:(BOOL)arg3
{
	/* code */
}
%end

To get a response to a BBAction:

BBBulletin *bulletin;
BBResponse *bbresponse = [bulletin responseForAction:action];

To set a reply text in the response to the BBAction:

(Edit REPLY_TEXT to your liking)

NSMutableDictionary *context = [bbresponse.context mutableCopy];
if(context == nil)
	context = [[NSMutableDictionary alloc] init];

context[@"userResponseInfo"] = @{@"UIUserNotificationActionResponseTypedTextKey": REPLY_TEXT };
bbresponse.context = context;

To handle a BBResponse (respond to a BBAction):

BBServer *bulletinServer;
NSMutableSet *observers = [bulletinServer valueForKey:@"_observers"];
BBObserverClientProxy *observer = [observers anyObject];
[observer handleResponse:bbresponse];

To remove a notification (has to be done after handling a BBResponse):

If __BBServerQueue isn't used, an error would be fired (as of iOS 9). This is placed at the beginning of the header/source file

extern dispatch_queue_t __BBServerQueue;

This is placed where removing the notification is required

dispatch_sync(__BBServerQueue, ^{
	BBServer *bulletinServer;
	[bulletinServer _clearBulletinIDs:@[bulletin.bulletinID] forSectionID:bulletin.sectionID shouldSync:YES];
});

To find out if a BBAction is for a reply-able action (like the SMS reply action):

BBAction *action;
if(action.behavior == UIUserNotificationActionBehaviorTextInput)
{
	/* code */
}

To find a BBAction’s title:

BBAction *action;
NSString *title = action.appearance.title;

To find the contents of a notification BBBulletin:

BBContent *content = bulletin.content;