mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-24 10:32:46 +02:00
Send sticker: Create StickerPickerVC and use it from the RoomVC
https://github.com/vector-im/riot-ios/issues/1860
This commit is contained in:
@@ -115,6 +115,7 @@
|
||||
|
||||
#import "IntegrationManagerViewController.h"
|
||||
#import "WidgetPickerViewController.h"
|
||||
#import "StickerPickerViewController.h"
|
||||
|
||||
@interface RoomViewController ()
|
||||
{
|
||||
@@ -2854,6 +2855,43 @@
|
||||
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
|
||||
}
|
||||
|
||||
#pragma mark - RoomInputToolbarViewDelegate
|
||||
|
||||
- (void)roomInputToolbarViewPresentStickerPicker:(MXKRoomInputToolbarView*)toolbarView
|
||||
{
|
||||
// Search for the sticker picker widget in the user account
|
||||
Widget *widget = [[WidgetManager sharedManager] userWidgets:self.roomDataSource.mxSession ofTypes:@[kWidgetTypeStickerPicker]].firstObject;
|
||||
|
||||
if (widget)
|
||||
{
|
||||
// Display the widget
|
||||
[widget widgetUrl:^(NSString * _Nonnull widgetUrl) {
|
||||
|
||||
StickerPickerViewController *stickerPickerVC = [[StickerPickerViewController alloc] initWithUrl:widgetUrl forWidget:widget];
|
||||
|
||||
stickerPickerVC.roomDataSource = self.roomDataSource;
|
||||
|
||||
[self.navigationController pushViewController:stickerPickerVC animated:YES];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
|
||||
NSLog(@"[RoomVC] Cannot display widget %@", widget);
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
// The Sticker picker widget is not installed yet. Propose the user to install it
|
||||
// TODO
|
||||
IntegrationManagerViewController *modularVC = [[IntegrationManagerViewController alloc]
|
||||
initForMXSession:self.roomDataSource.mxSession
|
||||
inRoom:self.roomDataSource.roomId
|
||||
screen:[IntegrationManagerViewController screenForWidget:kWidgetTypeStickerPicker]
|
||||
widgetId:kWidgetTypeStickerPicker];
|
||||
|
||||
[self presentViewController:modularVC animated:NO completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - MXKRoomInputToolbarViewDelegate
|
||||
|
||||
- (void)roomInputToolbarView:(MXKRoomInputToolbarView*)toolbarView isTyping:(BOOL)typing
|
||||
|
||||
Reference in New Issue
Block a user