{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","results":{"codes":[]},"params":[]},"next":{"description":"","pages":[]},"title":"Custom Pulsate Inbox","type":"basic","slug":"custom-pulsate-inbox","excerpt":"","body":"[block:api-header]\n{\n  \"title\": \"Showing the Feed Manually\"\n}\n[/block]\nThe PuslateSDK also allows Developers to directly access the Pulsate Feed API to get the Pulsate Feed Models and build them in a custom way.\n\nTo get the Feed Models just call this method \"*-(void)getFeed:(nonnull NSString*)page withListener:(nonnull FeedListener)listener*\". This method takes two arguments - \"*page*\" which specifies which page of the Feed do you want to get and \"*listener*\" which is the listener to which we send the Feed Models and any errors if they occur. The models that are returned are - PULCard, PULTalk. Having all these models you can build a custom Feed.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\\n[manager getFeed::::at:::\\\"1\\\" withListener:^(NSArray *feed, NSError * _Nullable error) {\\n    if (feed.count > 0)\\n    {\\n       // Show Feed\\n    }\\n}];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nShowing the Feed in a custom way also means that item clicks also need to be handled in a custom way. When handling on click events you must pass those clicks also to the PulsateSDK for it to be able to open the proper destination (deeplink, url, back of card, feed, reply) and also to send open event and custom events. To pass the clicks use the \"*-(void)handleFeedClick:(nonnull id)pulsateInboxItem*\" method.\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\\n[manager handleFeedClick:itemClicked];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nExample:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#import <UIKit/UIKit.h>\\n\\nNS_ASSUME_NONNULL_BEGIN\\n\\[email protected] CustomFeedViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>\\[email protected] (strong,nonatomic) UITableView *table;\\[email protected] (strong,nonatomic) NSArray     *content;\\n\\[email protected]\\n\\nNS_ASSUME_NONNULL_END\",\n      \"language\": \"objectivec\",\n      \"name\": \"CustomFeedViewController.h\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#import \\\"CustomFeedViewController.h\\\"\\n#import <PULPulsate/PULPulsate.h>\\n#import <PULPulsate/PULCard.h>\\n#import <PULPulsate/PULTalk.h>\\n#import <PULPulsate/PULAdminHeaderBlock.h>\\n#import <PULPulsate/PULTextBlock.h>\\n#import <PULPulsate/PULImageBlock.h>\\n#import <PULPulsate/PULCallToActionBlock.h>\\n#include <math.h>\\n\\[email protected] CustomFeedViewController ()\\n\\[email protected]\\n\\[email protected] CustomFeedViewController\\n\\n- (void)viewDidLoad {\\n    [super viewDidLoad];\\n    [self cofigureTable];\\n    [self getTableContent];\\n}\\n\\n-(void)cofigureTable\\n{\\n    self.table = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];\\n    self.table.delegate = self;\\n    self.table.dataSource = self;\\n    [self.view addSubview:self.table];\\n}\\n\\n-(void)getTableContent\\n{\\n    PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\\n    [manager getFeed:@\\\"1\\\" withListener:^(NSArray *feed, NSError * _Nullable error) {\\n        if (feed.count > 0)\\n        {\\n            self.content = feed;\\n            [self.table reloadData];\\n        }\\n    }];\\n}\\n\\n- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{\\n    return _content.count;\\n}\\n\\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\\n{\\n    static NSString *cellIdentifier = @\\\"cellIdentifier\\\";\\n    UITableViewCell *cell = [self.table dequeueReusableCellWithIdentifier:cellIdentifier];\\n    if(cell == nil) {\\n        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];\\n        \\n    }\\n    \\n    id card = [_content objectAtIndex:indexPath.row];\\n    if ([card class] == [PULCard class]) {\\n        PULCard* pulCard = (PULCard*)card;\\n        cell.textLabel.text = @\\\"Card\\\";\\n\\n        NSString* detail = @\\\"Details: \\\";\\n        for (id viewBlock in [pulCard viewBlocks])\\n        {\\n            if ([viewBlock class] == [PULTextBlock class]) {\\n                PULTextBlock* textBlock = (PULTextBlock*)viewBlock;\\n                detail = [detail stringByAppendingString:textBlock.contentText];\\n            }\\n        }\\n        cell.detailTextLabel.text = detail;\\n    }\\n    else if ([card class] == [PULTalk class]) {\\n        PULTalk* pulTalk = (PULTalk*)card;\\n        cell.textLabel.text = @\\\"Talk\\\";\\n\\n        NSString* detail = @\\\"Details: \\\";\\n        detail = [detail stringByAppendingString:pulTalk.talkGUID];\\n        detail = [detail stringByAppendingString:pulTalk.adminName];\\n        detail = [detail stringByAppendingString:pulTalk.adminTitle];\\n        detail = [detail stringByAppendingString:pulTalk.adminAvatarURL];\\n        detail = [detail stringByAppendingString:pulTalk.userName];\\n        detail = [detail stringByAppendingString:pulTalk.userAvatarURL];\\n        cell.detailTextLabel.text = detail;\\n    }\\n    return cell;\\n}\\n\\n- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView\\n{\\n    return 1;\\n}\\n\\n\\n- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;\\n{\\n    id card = [_content objectAtIndex:indexPath.row];\\n       if ([card isKindOfClass:[PULCard class]])\\n       {\\n           PULCard* cardData = card;\\n           PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\\n           [manager handleFeedClick:cardData];\\n       }\\n       else if ([card class] == [PULTalk class]) {\\n           PULTalk* pulTalk = (PULTalk*)card;\\n           PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\\n           [manager handleFeedClick:pulTalk];\\n       }\\n}\\[email protected]\",\n      \"language\": \"objectivec\",\n      \"name\": \"CustomFeedViewController.m\"\n    }\n  ]\n}\n[/block]","updates":[],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5f465719127ba40f24dc6875","createdAt":"2020-08-26T12:35:37.173Z","user":"57bc3654b9c7f0220009c77b","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"SDK Advanced","slug":"sdk-advanced","order":3,"from_sync":false,"reference":false,"_id":"5f44d209703f05006a2a4fa9","createdAt":"2020-08-25T08:55:37.604Z","version":"5e5013741b3b20006532951d","project":"54aa7f773b56130b0056c86e","__v":0},"version":{"version":"2.7","version_clean":"2.7.0","codename":"iOS SDK","is_stable":false,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5e5013741b3b200065329486","55781fe35129590d003ff4f9","55781fe35129590d003ff4fa","5e5013741b3b200065329487","5e5013741b3b200065329488","5e5013741b3b200065329489","5e5013741b3b20006532948a","5e5013741b3b20006532948b","565b66c446118c0d00dcb0bb","56898269f8dc340d00308c13","5e5013741b3b20006532948c","5e5013741b3b20006532948d","5c73dd27e8fdc000572a206a","5e5013741b3b20006532948e","5e53d9a2f75c0b0020de8935","5f44d1fbd1c58d040fdf03ba","5f44d202a2e3eb02b1c4c806","5f44d209703f05006a2a4fa9","5f44d210b1ba9f004200b689"],"_id":"5e5013741b3b20006532951d","project":"54aa7f773b56130b0056c86e","forked_from":"5e4fbbbda8fb41028f1861fe","__v":5,"createdAt":"2015-06-10T11:30:42.700Z","releaseDate":"2015-06-10T11:30:42.700Z"},"project":"54aa7f773b56130b0056c86e","__v":0,"parentDoc":null}

Custom Pulsate Inbox


[block:api-header] { "title": "Showing the Feed Manually" } [/block] The PuslateSDK also allows Developers to directly access the Pulsate Feed API to get the Pulsate Feed Models and build them in a custom way. To get the Feed Models just call this method "*-(void)getFeed:(nonnull NSString*)page withListener:(nonnull FeedListener)listener*". This method takes two arguments - "*page*" which specifies which page of the Feed do you want to get and "*listener*" which is the listener to which we send the Feed Models and any errors if they occur. The models that are returned are - PULCard, PULTalk. Having all these models you can build a custom Feed. [block:code] { "codes": [ { "code": "PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\n[manager getFeed:@\"1\" withListener:^(NSArray *feed, NSError * _Nullable error) {\n if (feed.count > 0)\n {\n // Show Feed\n }\n}];", "language": "objectivec" } ] } [/block] Showing the Feed in a custom way also means that item clicks also need to be handled in a custom way. When handling on click events you must pass those clicks also to the PulsateSDK for it to be able to open the proper destination (deeplink, url, back of card, feed, reply) and also to send open event and custom events. To pass the clicks use the "*-(void)handleFeedClick:(nonnull id)pulsateInboxItem*" method. [block:code] { "codes": [ { "code": "PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\n[manager handleFeedClick:itemClicked];", "language": "objectivec" } ] } [/block] Example: [block:code] { "codes": [ { "code": "#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\[email protected] CustomFeedViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>\[email protected] (strong,nonatomic) UITableView *table;\[email protected] (strong,nonatomic) NSArray *content;\n\[email protected]\n\nNS_ASSUME_NONNULL_END", "language": "objectivec", "name": "CustomFeedViewController.h" } ] } [/block] [block:code] { "codes": [ { "code": "#import \"CustomFeedViewController.h\"\n#import <PULPulsate/PULPulsate.h>\n#import <PULPulsate/PULCard.h>\n#import <PULPulsate/PULTalk.h>\n#import <PULPulsate/PULAdminHeaderBlock.h>\n#import <PULPulsate/PULTextBlock.h>\n#import <PULPulsate/PULImageBlock.h>\n#import <PULPulsate/PULCallToActionBlock.h>\n#include <math.h>\n\[email protected] CustomFeedViewController ()\n\[email protected]\n\[email protected] CustomFeedViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n [self cofigureTable];\n [self getTableContent];\n}\n\n-(void)cofigureTable\n{\n self.table = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];\n self.table.delegate = self;\n self.table.dataSource = self;\n [self.view addSubview:self.table];\n}\n\n-(void)getTableContent\n{\n PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\n [manager getFeed:@\"1\" withListener:^(NSArray *feed, NSError * _Nullable error) {\n if (feed.count > 0)\n {\n self.content = feed;\n [self.table reloadData];\n }\n }];\n}\n\n- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{\n return _content.count;\n}\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\n{\n static NSString *cellIdentifier = @\"cellIdentifier\";\n UITableViewCell *cell = [self.table dequeueReusableCellWithIdentifier:cellIdentifier];\n if(cell == nil) {\n cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];\n \n }\n \n id card = [_content objectAtIndex:indexPath.row];\n if ([card class] == [PULCard class]) {\n PULCard* pulCard = (PULCard*)card;\n cell.textLabel.text = @\"Card\";\n\n NSString* detail = @\"Details: \";\n for (id viewBlock in [pulCard viewBlocks])\n {\n if ([viewBlock class] == [PULTextBlock class]) {\n PULTextBlock* textBlock = (PULTextBlock*)viewBlock;\n detail = [detail stringByAppendingString:textBlock.contentText];\n }\n }\n cell.detailTextLabel.text = detail;\n }\n else if ([card class] == [PULTalk class]) {\n PULTalk* pulTalk = (PULTalk*)card;\n cell.textLabel.text = @\"Talk\";\n\n NSString* detail = @\"Details: \";\n detail = [detail stringByAppendingString:pulTalk.talkGUID];\n detail = [detail stringByAppendingString:pulTalk.adminName];\n detail = [detail stringByAppendingString:pulTalk.adminTitle];\n detail = [detail stringByAppendingString:pulTalk.adminAvatarURL];\n detail = [detail stringByAppendingString:pulTalk.userName];\n detail = [detail stringByAppendingString:pulTalk.userAvatarURL];\n cell.detailTextLabel.text = detail;\n }\n return cell;\n}\n\n- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView\n{\n return 1;\n}\n\n\n- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;\n{\n id card = [_content objectAtIndex:indexPath.row];\n if ([card isKindOfClass:[PULCard class]])\n {\n PULCard* cardData = card;\n PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\n [manager handleFeedClick:cardData];\n }\n else if ([card class] == [PULTalk class]) {\n PULTalk* pulTalk = (PULTalk*)card;\n PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];\n [manager handleFeedClick:pulTalk];\n }\n}\[email protected]", "language": "objectivec", "name": "CustomFeedViewController.m" } ] } [/block]