mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-29 04:36:58 +02:00
Prepare chat screen.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2015 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <MatrixKit/MatrixKit.h>
|
||||
|
||||
#import "MediaPickerViewController.h"
|
||||
|
||||
/**
|
||||
`RoomInputToolbarView` instance is a view used to handle all kinds of available inputs
|
||||
for a room (message composer, attachments selection...).
|
||||
*/
|
||||
@interface RoomInputToolbarView : MXKRoomInputToolbarViewWithHPGrowingText <MediaPickerViewControllerDelegate>
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,511 @@
|
||||
/*
|
||||
Copyright 2015 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import "RoomInputToolbarView.h"
|
||||
|
||||
//#import <MediaPlayer/MediaPlayer.h>
|
||||
//#import <MobileCoreServices/MobileCoreServices.h>
|
||||
//
|
||||
//#import <AssetsLibrary/ALAsset.h>
|
||||
//#import <AssetsLibrary/ALAssetRepresentation.h>
|
||||
|
||||
#define MXKROOM_INPUT_TOOLBAR_VIEW_LARGE_IMAGE_SIZE 1024
|
||||
#define MXKROOM_INPUT_TOOLBAR_VIEW_MEDIUM_IMAGE_SIZE 768
|
||||
#define MXKROOM_INPUT_TOOLBAR_VIEW_SMALL_IMAGE_SIZE 512
|
||||
|
||||
@interface RoomInputToolbarView()
|
||||
{
|
||||
MediaPickerViewController *mediaPicker;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomInputToolbarView
|
||||
|
||||
+ (UINib *)nib
|
||||
{
|
||||
return [UINib nibWithNibName:NSStringFromClass([RoomInputToolbarView class])
|
||||
bundle:[NSBundle bundleForClass:[RoomInputToolbarView class]]];
|
||||
}
|
||||
|
||||
+ (instancetype)roomInputToolbarView
|
||||
{
|
||||
if ([[self class] nib])
|
||||
{
|
||||
return [[[self class] nib] instantiateWithOwner:nil options:nil].firstObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
return [[self alloc] init];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
|
||||
self.leftInputToolbarButton.backgroundColor = [UIColor clearColor];
|
||||
[self.leftInputToolbarButton setImage:[UIImage imageNamed:@"attach_media"] forState:UIControlStateNormal];
|
||||
[self.leftInputToolbarButton setImage:[UIImage imageNamed:@"attach_media"] forState:UIControlStateHighlighted];
|
||||
|
||||
self.rightInputToolbarButton.backgroundColor = [UIColor clearColor];
|
||||
[self.rightInputToolbarButton setImage:[UIImage imageNamed:@"send"] forState:UIControlStateNormal];
|
||||
[self.rightInputToolbarButton setImage:[UIImage imageNamed:@"send"] forState:UIControlStateHighlighted];
|
||||
[self.rightInputToolbarButton setTitle:nil forState:UIControlStateNormal];
|
||||
[self.rightInputToolbarButton setTitle:nil forState:UIControlStateHighlighted];
|
||||
self.rightInputToolbarButton.enabled = YES;
|
||||
}
|
||||
|
||||
- (void)setTextMessage:(NSString *)textMessage
|
||||
{
|
||||
[super setTextMessage:textMessage];
|
||||
|
||||
// Force right button to be enabled (even if the text input is empty)
|
||||
self.rightInputToolbarButton.enabled = YES;
|
||||
}
|
||||
|
||||
#pragma mark - HPGrowingTextView delegate
|
||||
|
||||
- (void)growingTextViewDidChange:(HPGrowingTextView *)sender
|
||||
{
|
||||
[super growingTextViewDidChange:sender];
|
||||
|
||||
// Force right button to be enabled (even if the text input is empty)
|
||||
self.rightInputToolbarButton.enabled = YES;
|
||||
}
|
||||
|
||||
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView
|
||||
{
|
||||
NSString *message = self.textMessage;
|
||||
|
||||
// Reset message
|
||||
self.textMessage = nil;
|
||||
|
||||
// Send button has been pressed
|
||||
if (message.length && [self.delegate respondsToSelector:@selector(roomInputToolbarView:sendTextMessage:)])
|
||||
{
|
||||
[self.delegate roomInputToolbarView:self sendTextMessage:message];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Override MXKRoomInputToolbarView
|
||||
|
||||
- (IBAction)onTouchUpInside:(UIButton*)button
|
||||
{
|
||||
if (button == self.leftInputToolbarButton)
|
||||
{
|
||||
// Check whether media attachment is supported
|
||||
if ([self.delegate respondsToSelector:@selector(roomInputToolbarView:presentViewController:)])
|
||||
{
|
||||
mediaPicker = [MediaPickerViewController mediaPickerViewController];
|
||||
mediaPicker.delegate = self;
|
||||
UINavigationController *navigationController = [UINavigationController new];
|
||||
[navigationController pushViewController:mediaPicker animated:NO];
|
||||
|
||||
[self.delegate roomInputToolbarView:self presentViewController:mediaPicker];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"[RoomInputToolbarView] Attach media is not supported");
|
||||
}
|
||||
}
|
||||
else if (button == self.rightInputToolbarButton)
|
||||
{
|
||||
// Check whether media attachment is supported
|
||||
if ([self.delegate respondsToSelector:@selector(roomInputToolbarView:presentViewController:)])
|
||||
{
|
||||
mediaPicker = [MediaPickerViewController mediaPickerViewController];
|
||||
mediaPicker.delegate = self;
|
||||
UINavigationController *navigationController = [UINavigationController new];
|
||||
[navigationController pushViewController:mediaPicker animated:NO];
|
||||
|
||||
[self.delegate roomInputToolbarView:self presentViewController:mediaPicker];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"[RoomInputToolbarView] Attach media is not supported");
|
||||
}
|
||||
}
|
||||
// else if (button == self.rightInputToolbarButton)
|
||||
// {
|
||||
//
|
||||
// NSString *message = self.textMessage;
|
||||
//
|
||||
// // Reset message
|
||||
// self.textMessage = nil;
|
||||
//
|
||||
// // Send button has been pressed
|
||||
// if (message.length && [self.delegate respondsToSelector:@selector(roomInputToolbarView:sendTextMessage:)])
|
||||
// {
|
||||
// [self.delegate roomInputToolbarView:self sendTextMessage:message];
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
- (void)destroy
|
||||
{
|
||||
[super destroy];
|
||||
}
|
||||
|
||||
//#pragma mark - UIImagePickerControllerDelegate
|
||||
//
|
||||
//- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
|
||||
//{
|
||||
// NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
|
||||
// if ([mediaType isEqualToString:(NSString *)kUTTypeImage])
|
||||
// {
|
||||
//
|
||||
// /*
|
||||
// NSData *dataOfGif = [NSData dataWithContentsOfFile: [info objectForKey:UIImagePickerControllerReferenceURL]];
|
||||
//
|
||||
// NSLog(@"%d", dataOfGif.length);
|
||||
//
|
||||
// ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
|
||||
// [library assetForURL:[info objectForKey:UIImagePickerControllerReferenceURL] resultBlock:^(ALAsset *asset)
|
||||
// {
|
||||
//
|
||||
// NSLog(@"%@", asset.defaultRepresentation.metadata);
|
||||
//
|
||||
//
|
||||
// NSLog(@"%@", asset.defaultRepresentation.url);
|
||||
//
|
||||
// NSData *dataOfGif = [NSData dataWithContentsOfURL: asset.defaultRepresentation.url];
|
||||
//
|
||||
// NSLog(@"%d", dataOfGif.length);
|
||||
// ;
|
||||
//
|
||||
// } failureBlock:^(NSError *error)
|
||||
// {
|
||||
//
|
||||
// }];
|
||||
//
|
||||
// */
|
||||
//
|
||||
// if (![self.delegate respondsToSelector:@selector(roomInputToolbarView:sendImage:)])
|
||||
// {
|
||||
// NSLog(@"[RoomInputToolbarView] Attach image is not supported");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// UIImage *selectedImage = [info objectForKey:UIImagePickerControllerOriginalImage];
|
||||
// if (selectedImage)
|
||||
// {
|
||||
// // media picker does not offer a preview
|
||||
// // so add a preview to let the user validates his selection
|
||||
// if (picker.sourceType == UIImagePickerControllerSourceTypePhotoLibrary)
|
||||
// {
|
||||
// __weak typeof(self) weakSelf = self;
|
||||
//
|
||||
// imageValidationView = [[MXKImageView alloc] initWithFrame:CGRectZero];
|
||||
// imageValidationView.stretchable = YES;
|
||||
//
|
||||
// // the user validates the image
|
||||
// [imageValidationView setRightButtonTitle:[NSBundle mxk_localizedStringForKey:@"ok"] handler:^(MXKImageView* imageView, NSString* buttonTitle)
|
||||
// {
|
||||
// __strong __typeof(weakSelf)strongSelf = weakSelf;
|
||||
//
|
||||
// // Dismiss the image view
|
||||
// [strongSelf dismissImageValidationView];
|
||||
//
|
||||
// // prompt user about image compression
|
||||
// [strongSelf promptCompressionForSelectedImage:info];
|
||||
// }];
|
||||
//
|
||||
// // the user wants to use an other image
|
||||
// [imageValidationView setLeftButtonTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] handler:^(MXKImageView* imageView, NSString* buttonTitle)
|
||||
// {
|
||||
// __strong __typeof(weakSelf)strongSelf = weakSelf;
|
||||
//
|
||||
// // dismiss the image view
|
||||
// [strongSelf dismissImageValidationView];
|
||||
//
|
||||
// // Open again media gallery
|
||||
// strongSelf->mediaPicker = [[UIImagePickerController alloc] init];
|
||||
// strongSelf->mediaPicker.delegate = strongSelf;
|
||||
// strongSelf->mediaPicker.sourceType = picker.sourceType;
|
||||
// strongSelf->mediaPicker.allowsEditing = NO;
|
||||
// strongSelf->mediaPicker.mediaTypes = picker.mediaTypes;
|
||||
// [strongSelf.delegate roomInputToolbarView:strongSelf presentMediaPicker:strongSelf->mediaPicker];
|
||||
// }];
|
||||
//
|
||||
// imageValidationView.image = selectedImage;
|
||||
// [imageValidationView showFullScreen];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Save the original image in user's photos library and suggest compression before sending image
|
||||
// [MXKMediaManager saveImageToPhotosLibrary:selectedImage success:nil failure:nil];
|
||||
// [self promptCompressionForSelectedImage:info];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie])
|
||||
// {
|
||||
// NSURL* selectedVideo = [info objectForKey:UIImagePickerControllerMediaURL];
|
||||
//
|
||||
// // Check the selected video, and ignore multiple calls (observed when user pressed several time Choose button)
|
||||
// if (selectedVideo && !tmpVideoPlayer)
|
||||
// {
|
||||
// if (picker.sourceType == UIImagePickerControllerSourceTypePhotoLibrary)
|
||||
// {
|
||||
// [MXKMediaManager saveMediaToPhotosLibrary:selectedVideo isImage:NO success:nil failure:nil];
|
||||
// }
|
||||
//
|
||||
// // Create video thumbnail
|
||||
// tmpVideoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:selectedVideo];
|
||||
// if (tmpVideoPlayer)
|
||||
// {
|
||||
// [tmpVideoPlayer setShouldAutoplay:NO];
|
||||
// [[NSNotificationCenter defaultCenter] addObserver:self
|
||||
// selector:@selector(moviePlayerThumbnailImageRequestDidFinishNotification:)
|
||||
// name:MPMoviePlayerThumbnailImageRequestDidFinishNotification
|
||||
// object:nil];
|
||||
// [tmpVideoPlayer requestThumbnailImagesAtTimes:@[@1.0f] timeOption:MPMovieTimeOptionNearestKeyFrame];
|
||||
// // We will finalize video attachment when thumbnail will be available (see movie player callback)
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// [self dismissMediaPicker];
|
||||
//}
|
||||
//
|
||||
//- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
|
||||
//{
|
||||
// [self dismissMediaPicker];
|
||||
//}
|
||||
//
|
||||
//- (void)dismissImageValidationView
|
||||
//{
|
||||
// if (imageValidationView)
|
||||
// {
|
||||
// [imageValidationView dismissSelection];
|
||||
// [imageValidationView removeFromSuperview];
|
||||
// imageValidationView = nil;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//- (void)promptCompressionForSelectedImage:(NSDictionary*)selectedImageInfo
|
||||
//{
|
||||
// if (currentAlert)
|
||||
// {
|
||||
// [currentAlert dismiss:NO];
|
||||
// currentAlert = nil;
|
||||
// }
|
||||
//
|
||||
// UIImage *selectedImage = [selectedImageInfo objectForKey:UIImagePickerControllerOriginalImage];
|
||||
// CGSize originalSize = selectedImage.size;
|
||||
// NSLog(@"Selected image size : %f %f", originalSize.width, originalSize.height);
|
||||
//
|
||||
// [self getSelectedImageFileData:selectedImageInfo success:^(NSData *selectedImageFileData) {
|
||||
//
|
||||
// long long smallFilesize = 0;
|
||||
// long long mediumFilesize = 0;
|
||||
// long long largeFilesize = 0;
|
||||
//
|
||||
// // succeed to get the file size (provided by the photo library)
|
||||
// long long originalFileSize = selectedImageFileData.length;
|
||||
// NSLog(@"- use the photo library file size: %tu", originalFileSize);
|
||||
//
|
||||
// CGFloat maxSize = MAX(originalSize.width, originalSize.height);
|
||||
// if (maxSize >= MXKROOM_INPUT_TOOLBAR_VIEW_SMALL_IMAGE_SIZE)
|
||||
// {
|
||||
// CGFloat factor = MXKROOM_INPUT_TOOLBAR_VIEW_SMALL_IMAGE_SIZE / maxSize;
|
||||
// smallFilesize = factor * factor * originalFileSize;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NSLog(@"- too small to fit in %d", MXKROOM_INPUT_TOOLBAR_VIEW_SMALL_IMAGE_SIZE);
|
||||
// }
|
||||
//
|
||||
// if (maxSize >= MXKROOM_INPUT_TOOLBAR_VIEW_MEDIUM_IMAGE_SIZE)
|
||||
// {
|
||||
// CGFloat factor = MXKROOM_INPUT_TOOLBAR_VIEW_MEDIUM_IMAGE_SIZE / maxSize;
|
||||
// mediumFilesize = factor * factor * originalFileSize;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NSLog(@"- too small to fit in %d", MXKROOM_INPUT_TOOLBAR_VIEW_MEDIUM_IMAGE_SIZE);
|
||||
// }
|
||||
//
|
||||
// if (maxSize >= MXKROOM_INPUT_TOOLBAR_VIEW_LARGE_IMAGE_SIZE)
|
||||
// {
|
||||
// CGFloat factor = MXKROOM_INPUT_TOOLBAR_VIEW_LARGE_IMAGE_SIZE / maxSize;
|
||||
// largeFilesize = factor * factor * originalFileSize;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NSLog(@"- too small to fit in %d", MXKROOM_INPUT_TOOLBAR_VIEW_LARGE_IMAGE_SIZE);
|
||||
// }
|
||||
//
|
||||
// if (smallFilesize || mediumFilesize || largeFilesize)
|
||||
// {
|
||||
// currentAlert = [[MXKAlert alloc] initWithTitle:[NSBundle mxk_localizedStringForKey:@"attachment_size_prompt"] message:nil style:MXKAlertStyleActionSheet];
|
||||
// __weak typeof(self) weakSelf = self;
|
||||
//
|
||||
// if (smallFilesize)
|
||||
// {
|
||||
// NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_small"], [MXKTools fileSizeToString: (int)smallFilesize]];
|
||||
// [currentAlert addActionWithTitle:title style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
|
||||
// __strong __typeof(weakSelf)strongSelf = weakSelf;
|
||||
// strongSelf->currentAlert = nil;
|
||||
//
|
||||
// // Send the small image
|
||||
// UIImage *smallImage = [MXKTools resize:selectedImage toFitInSize:CGSizeMake(MXKROOM_INPUT_TOOLBAR_VIEW_SMALL_IMAGE_SIZE, MXKROOM_INPUT_TOOLBAR_VIEW_SMALL_IMAGE_SIZE)];
|
||||
// [strongSelf.delegate roomInputToolbarView:weakSelf sendImage:smallImage];
|
||||
// }];
|
||||
// }
|
||||
//
|
||||
// if (mediumFilesize)
|
||||
// {
|
||||
// NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_medium"], [MXKTools fileSizeToString: (int)mediumFilesize]];
|
||||
// [currentAlert addActionWithTitle:title style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
|
||||
// __strong __typeof(weakSelf)strongSelf = weakSelf;
|
||||
// strongSelf->currentAlert = nil;
|
||||
//
|
||||
// // Send the medium image
|
||||
// UIImage *mediumImage = [MXKTools resize:selectedImage toFitInSize:CGSizeMake(MXKROOM_INPUT_TOOLBAR_VIEW_MEDIUM_IMAGE_SIZE, MXKROOM_INPUT_TOOLBAR_VIEW_MEDIUM_IMAGE_SIZE)];
|
||||
// [strongSelf.delegate roomInputToolbarView:weakSelf sendImage:mediumImage];
|
||||
// }];
|
||||
// }
|
||||
//
|
||||
// if (largeFilesize)
|
||||
// {
|
||||
// NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_large"], [MXKTools fileSizeToString: (int)largeFilesize]];
|
||||
// [currentAlert addActionWithTitle:title style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
|
||||
// __strong __typeof(weakSelf)strongSelf = weakSelf;
|
||||
// strongSelf->currentAlert = nil;
|
||||
//
|
||||
// // Send the large image
|
||||
// UIImage *largeImage = [MXKTools resize:selectedImage toFitInSize:CGSizeMake(MXKROOM_INPUT_TOOLBAR_VIEW_LARGE_IMAGE_SIZE, MXKROOM_INPUT_TOOLBAR_VIEW_LARGE_IMAGE_SIZE)];
|
||||
// [strongSelf.delegate roomInputToolbarView:weakSelf sendImage:largeImage];
|
||||
// }];
|
||||
// }
|
||||
//
|
||||
// NSString *title = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"attachment_original"], [MXKTools fileSizeToString: (int)originalFileSize]];
|
||||
// [currentAlert addActionWithTitle:title style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
|
||||
// __strong __typeof(weakSelf)strongSelf = weakSelf;
|
||||
// strongSelf->currentAlert = nil;
|
||||
//
|
||||
// // Send the original image
|
||||
// [strongSelf.delegate roomInputToolbarView:weakSelf sendImage:selectedImage];
|
||||
// }];
|
||||
//
|
||||
// currentAlert.cancelButtonIndex = [currentAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) {
|
||||
// __strong __typeof(weakSelf)strongSelf = weakSelf;
|
||||
// strongSelf->currentAlert = nil;
|
||||
// }];
|
||||
//
|
||||
// currentAlert.sourceView = self;
|
||||
//
|
||||
// [self.delegate roomInputToolbarView:self presentMXKAlert:currentAlert];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Send the original image
|
||||
// [self.delegate roomInputToolbarView:self sendImage:selectedImage];
|
||||
// }
|
||||
// } failure:^(NSError *error) {
|
||||
//
|
||||
// // Send the original image
|
||||
// [self.delegate roomInputToolbarView:self sendImage:selectedImage];
|
||||
// }];
|
||||
//}
|
||||
|
||||
//- (void)getSelectedImageFileData:(NSDictionary*)selectedImageInfo success:(void (^)(NSData *selectedImageFileData))success failure:(void (^)(NSError *error))failure
|
||||
//{
|
||||
// ALAssetsLibrary *assetLibrary=[[ALAssetsLibrary alloc] init];
|
||||
// [assetLibrary assetForURL:[selectedImageInfo valueForKey:UIImagePickerControllerReferenceURL] resultBlock:^(ALAsset *asset) {
|
||||
//
|
||||
// NSData *selectedImageFileData;
|
||||
//
|
||||
// // asset may be nil if the image is not saved in photos library
|
||||
// if (asset)
|
||||
// {
|
||||
// ALAssetRepresentation* assetRepresentation = [asset defaultRepresentation];
|
||||
//
|
||||
// // Check whether the user select an image with a cropping
|
||||
// if ([[assetRepresentation metadata] objectForKey:@"AdjustmentXMP"])
|
||||
// {
|
||||
// // In case of crop we have to consider the original image
|
||||
// selectedImageFileData = UIImageJPEGRepresentation([selectedImageInfo objectForKey:UIImagePickerControllerOriginalImage], 0.9);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // cannot use assetRepresentation size to get the image size
|
||||
// // it gives wrong result with panorama picture
|
||||
// unsigned long imageDataSize = (unsigned long)[assetRepresentation size];
|
||||
// uint8_t* imageDataBytes = malloc(imageDataSize);
|
||||
// [assetRepresentation getBytes:imageDataBytes fromOffset:0 length:imageDataSize error:nil];
|
||||
//
|
||||
// selectedImageFileData = [NSData dataWithBytesNoCopy:imageDataBytes length:imageDataSize freeWhenDone:YES];
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// selectedImageFileData = UIImageJPEGRepresentation([selectedImageInfo objectForKey:UIImagePickerControllerOriginalImage], 0.9);
|
||||
// }
|
||||
//
|
||||
// if (success)
|
||||
// {
|
||||
// success (selectedImageFileData);
|
||||
// }
|
||||
// } failureBlock:^(NSError *err) {
|
||||
//
|
||||
// if (failure)
|
||||
// {
|
||||
// failure (err);
|
||||
// }
|
||||
// }];
|
||||
//}
|
||||
|
||||
#pragma mark - Media Picker handling
|
||||
|
||||
//- (void)dismissMediaPicker
|
||||
//{
|
||||
// mediaPicker.delegate = nil;
|
||||
//
|
||||
// if ([self.delegate respondsToSelector:@selector(roomInputToolbarView:dismissMediaPicker:)])
|
||||
// {
|
||||
// [self.delegate roomInputToolbarView:self dismissMediaPicker:mediaPicker];
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//- (void)moviePlayerThumbnailImageRequestDidFinishNotification:(NSNotification *)notification
|
||||
//{
|
||||
// // Finalize video attachment
|
||||
// UIImage* videoThumbnail = [[notification userInfo] objectForKey:MPMoviePlayerThumbnailImageKey];
|
||||
// NSURL* selectedVideo = [tmpVideoPlayer contentURL];
|
||||
// [tmpVideoPlayer stop];
|
||||
// tmpVideoPlayer = nil;
|
||||
//
|
||||
// if ([self.delegate respondsToSelector:@selector(roomInputToolbarView:sendVideo:withThumbnail:)])
|
||||
// {
|
||||
// [self.delegate roomInputToolbarView:self sendVideo:selectedVideo withThumbnail:videoThumbnail];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NSLog(@"[RoomInputToolbarView] Attach video is not supported");
|
||||
// }
|
||||
//
|
||||
// [self dismissMediaPicker];
|
||||
//}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="RoomInputToolbarView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="41"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QWp-NV-uh5" userLabel="Message Composer Container">
|
||||
<rect key="frame" x="8" y="4" width="497" height="33"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wgb-ON-N29" customClass="HPGrowingTextView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="497" height="33"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="wgb-ON-N29" firstAttribute="top" secondItem="QWp-NV-uh5" secondAttribute="top" id="0jt-Ye-2DW"/>
|
||||
<constraint firstAttribute="trailing" secondItem="wgb-ON-N29" secondAttribute="trailing" id="30f-rE-CKj"/>
|
||||
<constraint firstItem="wgb-ON-N29" firstAttribute="leading" secondItem="QWp-NV-uh5" secondAttribute="leading" id="N7q-ch-iRz"/>
|
||||
<constraint firstAttribute="bottom" secondItem="wgb-ON-N29" secondAttribute="bottom" id="fFG-SH-Hjh"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Hga-l8-Wua" userLabel="left Button">
|
||||
<rect key="frame" x="513" y="0.0" width="41" height="41"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="Hga-l8-Wua" secondAttribute="height" multiplier="1:1" id="f0T-3f-BJu"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<action selector="onTouchUpInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="WbU-WH-gwL"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Owf-M8-qJi" userLabel="right Button">
|
||||
<rect key="frame" x="555" y="0.0" width="41" height="41"/>
|
||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="Owf-M8-qJi" secondAttribute="height" multiplier="1:1" id="1Ni-y7-Nsa"/>
|
||||
<constraint firstAttribute="width" constant="41" id="9FZ-CI-diT"/>
|
||||
</constraints>
|
||||
<state key="normal">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="onTouchUpInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="Cxg-BO-TfK"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="Owf-M8-qJi" secondAttribute="trailing" constant="4" id="Gjp-VM-BFw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="QWp-NV-uh5" secondAttribute="bottom" constant="4" id="Gsc-LN-yec"/>
|
||||
<constraint firstItem="Hga-l8-Wua" firstAttribute="leading" secondItem="QWp-NV-uh5" secondAttribute="trailing" constant="8" id="QiS-Qt-q6t"/>
|
||||
<constraint firstAttribute="centerY" secondItem="Owf-M8-qJi" secondAttribute="centerY" id="Tnh-rh-LJx"/>
|
||||
<constraint firstAttribute="centerY" secondItem="Hga-l8-Wua" secondAttribute="centerY" id="U29-yX-mV5"/>
|
||||
<constraint firstItem="Owf-M8-qJi" firstAttribute="leading" secondItem="Hga-l8-Wua" secondAttribute="trailing" constant="1" id="VBF-Cx-fhG"/>
|
||||
<constraint firstItem="QWp-NV-uh5" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="4" id="W1p-U9-VVV"/>
|
||||
<constraint firstItem="Owf-M8-qJi" firstAttribute="width" secondItem="Hga-l8-Wua" secondAttribute="width" id="sWE-Of-hto"/>
|
||||
<constraint firstItem="QWp-NV-uh5" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="v1f-6D-q3u"/>
|
||||
</constraints>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<nil key="simulatedTopBarMetrics"/>
|
||||
<nil key="simulatedBottomBarMetrics"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<connections>
|
||||
<outlet property="growingTextView" destination="wgb-ON-N29" id="nwF-uV-Ng9"/>
|
||||
<outlet property="leftInputToolbarButton" destination="Hga-l8-Wua" id="jaa-D6-e6X"/>
|
||||
<outlet property="messageComposerContainer" destination="QWp-NV-uh5" id="APR-B5-ogC"/>
|
||||
<outlet property="messageComposerContainerBottomConstraint" destination="Gsc-LN-yec" id="tnh-uf-g5s"/>
|
||||
<outlet property="messageComposerContainerTopConstraint" destination="W1p-U9-VVV" id="ETg-Iu-GEf"/>
|
||||
<outlet property="rightInputToolbarButton" destination="Owf-M8-qJi" id="UQH-fw-chf"/>
|
||||
</connections>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user