Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)onStickerImageTap:(UITapGestureRecognizer*)gesture {
- UIImageView *stickerImage = (UIImageView *)gesture.view;
- PTChatStreamModel *model = [chatStream objectAtIndex:stickerImage.tag];
- if ([model isKindOfClass:[PTChatMessageModel class]]) {
- PTChatMessageModel *messageModel = (PTChatMessageModel *)model;
- tappedStickerId = messageModel.stickerId;
- if (messageModel.messageType==PTChatMessageTypeSticker) {
- PTVGiftManager *giftManager = [PTVGiftManager sharedInstance];
- PTStickerManager *stickerManager = [PTStickerManager sharedInstance];
- __weak __typeof(self)weakSelf = self;
- [stickerManager getMyStickerPacksWithCompletion:^(NSArray<PTStickerPack *> * _Nullable packs) {
- if (packs && packs.count > 0) {
- __block int count = 0;
- [stickerManager getAndCacheStickersWithStickerPackId:tappedStickerId completion:^(PTStickerPack *selectedStickerPack ) {
- __strong typeof(self)strongSelf = weakSelf;
- if (count == 0) {
- if([packs containsObject:selectedStickerPack]) {
- [stickerAlert addAction:[UIAlertAction actionWithTitle:kLocalizedString_OK style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- [strongSelf showStickerPickerPopup];
- }]];
- [strongSelf presentViewController:stickerAlert animated:YES completion:nil];
- } else {
- //navigate to detailed gift view
- [giftManager fetchAllGiftsWithBlock:^(PTVGiftCategoryModel *model, NSError *error) {
- __strong typeof(self)strongSelf = weakSelf;
- if ((arrCategory && arrCategory.count > 0) && (model.gifts && model.gifts.count > 0)) {
- giftWebVC.delegate = strongSelf;
- giftWebVC.giftUrl = vgiftData.sponsorUrl;
- giftWebVC.giftName = vgiftData.description;
- _vgiftData = vgiftData;
- [strongSelf presentViewController:giftWebVC animated:YES completion:nil];
- } else {
- [strongSelf showGiftDetailsController:vgiftData];
- }
- } else {
- [strongSelf showStickerPickerPopup];
- }
- } else {
- //gift not available navigate to market place screen
- [strongSelf showStickerPickerPopup];
- }
- }
- }];
- }
- }
- }];
- }
- return;
- }];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement