diff --git a/Classes/ChatRoomTableViewController.h b/Classes/ChatRoomTableViewController.h index aa91671ad..d3c0a17ac 100644 --- a/Classes/ChatRoomTableViewController.h +++ b/Classes/ChatRoomTableViewController.h @@ -37,6 +37,8 @@ @property (nonatomic, retain) id chatRoomDelegate; - (void)addChatEntry:(ChatModel*)chat; +- (void)scrollToBottom:(BOOL)animated; +- (void)scrollToLastUnread:(BOOL)animated; - (void)updateChatEntry:(ChatModel*)chat; @end diff --git a/Classes/ChatRoomTableViewController.m b/Classes/ChatRoomTableViewController.m index 349b80f8f..e8c119018 100644 --- a/Classes/ChatRoomTableViewController.m +++ b/Classes/ChatRoomTableViewController.m @@ -76,7 +76,6 @@ [data insertObject:chat atIndex:pos]; [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:pos inSection:0]] withRowAnimation:UITableViewRowAnimationFade]; [self.tableView endUpdates]; - [self scrollToLastUnread:true]; } - (void)updateChatEntry:(ChatModel*)chat { @@ -93,6 +92,13 @@ return; } +- (void)scrollToBottom:(BOOL)animated { + CGSize size = [self.tableView contentSize]; + CGRect bounds = [self.tableView bounds]; + bounds.origin.y = size.height - bounds.size.height; + [self.tableView scrollRectToVisible:bounds animated:animated]; +} + - (void)scrollToLastUnread:(BOOL)animated { if(data == nil) { [LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot add entry: null data"]; @@ -116,7 +122,7 @@ // Scroll to unread if(index >= 0) { [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] - atScrollPosition:UITableViewScrollPositionMiddle + atScrollPosition:UITableViewScrollPositionTop animated:animated]; } } diff --git a/Classes/ChatRoomViewController.h b/Classes/ChatRoomViewController.h index 8765da496..ceec945ee 100644 --- a/Classes/ChatRoomViewController.h +++ b/Classes/ChatRoomViewController.h @@ -34,6 +34,7 @@ LinphoneChatRoom *chatRoom; ImageSharing *imageSharing; OrderedDictionary *imageQualities; + BOOL scrollOnGrowingEnabled; } @property (nonatomic, retain) IBOutlet ChatRoomTableViewController* tableController; diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index 4ff616865..713c8fc07 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -52,6 +52,7 @@ - (id)init { self = [super initWithNibName:@"ChatRoomViewController" bundle:[NSBundle mainBundle]]; if (self != nil) { + self->scrollOnGrowingEnabled = TRUE; self->chatRoom = NULL; self->imageSharing = NULL; self->listTapGestureRecognizer = [[UITapGestureRecognizer alloc] init]; @@ -314,6 +315,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [chat setState:[NSNumber numberWithInt:1]]; //INPROGRESS [chat create]; [tableController addChatEntry:chat]; + [tableController scrollToBottom:TRUE]; [chat release]; LinphoneChatMessage* msg = linphone_chat_room_create_message(chatRoom, [message UTF8String]); @@ -362,6 +364,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [chat update]; [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneTextReceived object:self]; [tableController addChatEntry:chat]; + [tableController scrollToLastUnread:TRUE]; } ms_free(fromStr); } @@ -390,22 +393,29 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta - (void)growingTextView:(HPGrowingTextView *)growingTextView willChangeHeight:(float)height { int diff = height - growingTextView.bounds.size.height; - CGRect messageRect = [messageView frame]; - messageRect.origin.y -= diff; - messageRect.size.height += diff; - [messageView setFrame:messageRect]; - - // Always stay at bottom - CGPoint contentPt = [tableController.tableView contentOffset]; - contentPt.y += diff; - [tableController.tableView setContentOffset:contentPt animated:FALSE]; - - CGRect tableRect = [tableController.view frame]; - tableRect.size.height -= diff; - [tableController.view setFrame:tableRect]; - - [messageBackgroundImage setImage:[TUNinePatchCache imageOfSize:[messageBackgroundImage bounds].size - forNinePatchNamed:@"chat_message_background"]]; + if(diff != 0) { + CGRect messageRect = [messageView frame]; + messageRect.origin.y -= diff; + messageRect.size.height += diff; + [messageView setFrame:messageRect]; + + // Always stay at bottom + if(scrollOnGrowingEnabled) { + CGRect tableFrame = [tableController.view frame]; + CGPoint contentPt = [tableController.tableView contentOffset]; + contentPt.y += diff; + if(contentPt.y + tableFrame.size.height > tableController.tableView.contentSize.height) + contentPt.y += diff; + [tableController.tableView setContentOffset:contentPt animated:FALSE]; + } + + CGRect tableRect = [tableController.view frame]; + tableRect.size.height -= diff; + [tableController.view setFrame:tableRect]; + + [messageBackgroundImage setImage:[TUNinePatchCache imageOfSize:[messageBackgroundImage bounds].size + forNinePatchNamed:@"chat_message_background"]]; + } } @@ -422,7 +432,9 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta - (IBAction)onSendClick:(id)event { if([self sendMessage:[messageField text] withExterlBodyUrl:nil withInternalUrl:nil]) { + scrollOnGrowingEnabled = FALSE; [messageField setText:@""]; + scrollOnGrowingEnabled = TRUE; [self onMessageChange:nil]; } } @@ -496,7 +508,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta #pragma mark ImageSharingDelegate - (void)imageSharingProgress:(ImageSharing*)aimageSharing progress:(float)progress { - [imageTransferProgressBar setProgress:progress animated:FALSE]; + [imageTransferProgressBar setProgress:progress]; } - (void)imageSharingAborted:(ImageSharing*)aimageSharing { diff --git a/Classes/ImagePickerViewController.m b/Classes/ImagePickerViewController.m index dcf16330b..1e364c3e0 100644 --- a/Classes/ImagePickerViewController.m +++ b/Classes/ImagePickerViewController.m @@ -60,10 +60,10 @@ static UICompositeViewDescription *compositeDescription = nil; content:@"ImagePickerViewController" stateBar:nil stateBarEnabled:false - tabBar:@"UIMainBar" - tabBarEnabled:true + tabBar:nil + tabBarEnabled:false fullscreen:false - landscapeMode:false + landscapeMode:[LinphoneManager runningOnIpad] portraitMode:true]; } return compositeDescription; @@ -85,10 +85,26 @@ static UICompositeViewDescription *compositeDescription = nil; [pickerController setDelegate:self]; } +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) { + [pickerController viewWillAppear:animated]; + } +} + - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if(popoverController != nil) { [popoverController presentPopoverFromRect:CGRectZero inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:FALSE]; + } else if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) { + [pickerController viewDidAppear:animated]; + } +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) { + [pickerController viewDidDisappear:animated]; } } @@ -96,6 +112,8 @@ static UICompositeViewDescription *compositeDescription = nil; [super viewWillDisappear:animated]; if(popoverController != nil) { [popoverController dismissPopoverAnimated: NO]; + } else if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) { + [pickerController viewWillDisappear:animated]; } } @@ -174,4 +192,13 @@ static UICompositeViewDescription *compositeDescription = nil; return TRUE; } +- (void)navigationController:(UINavigationController *)navigationController + willShowViewController:(UIViewController *)viewController + animated:(BOOL)animated { + + if ([navigationController isKindOfClass:[UIImagePickerController class]]) { + [[UIApplication sharedApplication] setStatusBarHidden:NO]; + } +} + @end diff --git a/Classes/LinphoneUI/UIChatRoomCell.m b/Classes/LinphoneUI/UIChatRoomCell.m index 856c43e64..cf99cd061 100644 --- a/Classes/LinphoneUI/UIChatRoomCell.m +++ b/Classes/LinphoneUI/UIChatRoomCell.m @@ -42,7 +42,7 @@ @synthesize chatRoomDelegate; @synthesize imageTapGestureRecognizer; -static const CGFloat CELL_MIN_HEIGHT = 40.0f; +static const CGFloat CELL_MIN_HEIGHT = 50.0f; static const CGFloat CELL_MIN_WIDTH = 150.0f; static const CGFloat CELL_MAX_WIDTH = 320.0f; static const CGFloat CELL_MESSAGE_X_MARGIN = 26.0f; diff --git a/Classes/LinphoneUI/UIContactDetailsHeader.m b/Classes/LinphoneUI/UIContactDetailsHeader.m index 2d5c3c076..5d5c027b5 100644 --- a/Classes/LinphoneUI/UIContactDetailsHeader.m +++ b/Classes/LinphoneUI/UIContactDetailsHeader.m @@ -24,6 +24,8 @@ #import "UILinphone.h" #import "PhoneMainView.h" +#import + @implementation UIContactDetailsHeader @synthesize avatarImage; @@ -251,7 +253,7 @@ // Displays a control that allows the user to choose picture or // movie capture, if both are available: - controller.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:type]; + controller.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage]; // Hides the controls for moving & scaling pictures, or for // trimming movies. To instead show the controls, use YES. @@ -268,9 +270,9 @@ - (void)imagePickerDelegateImage:(UIImage*)image info:(NSDictionary *)info{ NSError* error = NULL; if(!ABPersonRemoveImageData(contact, (CFErrorRef*)error)) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Can't add entry: %@", [error localizedDescription]]; + [LinphoneLogger log:LinphoneLoggerLog format:@"Can't remove entry: %@", [error localizedDescription]]; } - NSData *dataRef = UIImagePNGRepresentation(image); + NSData *dataRef = UIImagePNGRepresentation([image normalizedImage]); CFDataRef cfdata = CFDataCreate(NULL,[dataRef bytes], [dataRef length]); if(!ABPersonSetImageData(contact, cfdata, (CFErrorRef*)error)) { diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 7bd3c2bc7..7aeb28c8b 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -190,7 +190,8 @@ static PhoneMainView* phoneMainViewInstance=nil; + (void)setOrientation:(UIInterfaceOrientation)orientation animated:(BOOL)animated { UIView *firstResponder = nil; for(UIWindow *window in [[UIApplication sharedApplication] windows]) { - if([NSStringFromClass(window.class) isEqualToString:@"UITextEffectsWindow"]) { + if([NSStringFromClass(window.class) isEqualToString:@"UITextEffectsWindow"] || + [NSStringFromClass(window.class) isEqualToString:@"_UIAlertOverlayWindow"] ) { continue; } UIView *view = window; diff --git a/Classes/Utils/GrowingTextView/HPGrowingTextView.m b/Classes/Utils/GrowingTextView/HPGrowingTextView.m index 177c0e346..625a17f62 100755 --- a/Classes/Utils/GrowingTextView/HPGrowingTextView.m +++ b/Classes/Utils/GrowingTextView/HPGrowingTextView.m @@ -194,7 +194,7 @@ //size of content, so we can set the frame of self NSInteger newSizeH = internalTextView.contentSize.height; if(newSizeH < minHeight || !internalTextView.hasText) newSizeH = minHeight; //not smalles than minHeight - if (internalTextView.frame.size.height > maxHeight) newSizeH = maxHeight; // not taller than maxHeight + if(newSizeH > maxHeight) newSizeH = maxHeight; // not taller than maxHeight if (internalTextView.frame.size.height != newSizeH) { diff --git a/Classes/en.lproj/ChatRoomViewController.xib b/Classes/en.lproj/ChatRoomViewController.xib index a11bc6f83..7aa878b4c 100644 --- a/Classes/en.lproj/ChatRoomViewController.xib +++ b/Classes/en.lproj/ChatRoomViewController.xib @@ -267,7 +267,6 @@ {{262, 0}, {58, 57}} - _NS:9 NO @@ -290,7 +289,7 @@ 2 - MC43MjU0OTAyMTI0IDAuNzY4NjI3NDY0OCAwLjc5NjA3ODQ0MzUAA + MC44MDc4NDMxMzczIDAuODE1Njg2Mjc0NSAwLjgyMzUyOTQxMTgAA 2 diff --git a/Classes/fr.lproj/ChatRoomViewController.xib b/Classes/fr.lproj/ChatRoomViewController.xib index 79555b8b6..736ff8d10 100644 --- a/Classes/fr.lproj/ChatRoomViewController.xib +++ b/Classes/fr.lproj/ChatRoomViewController.xib @@ -278,7 +278,7 @@ 2 - MC43MjU0OTAyMTI0IDAuNzY4NjI3NDY0OCAwLjc5NjA3ODQ0MzUAA + MC44MDc4NDMxMzczIDAuODE1Njg2Mjc0NSAwLjgyMzUyOTQxMTgAA 2 diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index 03fb0ee4b..a962fb583 100644 Binary files a/Resources/en.lproj/Localizable.strings and b/Resources/en.lproj/Localizable.strings differ diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings index 4e02e99ae..e719c7c7b 100644 Binary files a/Resources/fr.lproj/Localizable.strings and b/Resources/fr.lproj/Localizable.strings differ diff --git a/linphone.ldb/Contents.plist b/linphone.ldb/Contents.plist index eb6f6667c..f41aa5b96 100644 --- a/linphone.ldb/Contents.plist +++ b/linphone.ldb/Contents.plist @@ -337,17 +337,17 @@ backup - 33 + 34 class BLWrapperHandle name - Classes/ChatRoomViewController/33/ChatRoomViewController.xib + Classes/ChatRoomViewController/34/ChatRoomViewController.xib change date - 2012-09-24T07:54:14Z + 2012-09-24T12:35:35Z changed values class @@ -357,7 +357,7 @@ flags 0 hash - 9cea2c5bb3cda145b0c819b0f48baf7c + 721bad8bcdaf6bd6dabf3d41eaf915d4 name ChatRoomViewController.xib @@ -793,9 +793,9 @@ versions en - 33 + 34 fr - 33 + 34 @@ -10870,7 +10870,7 @@ change date - 2012-09-24T08:35:08Z + 2012-09-24T09:53:58Z changed values class @@ -10880,7 +10880,7 @@ flags 0 hash - aaac1683c5a04165fb53e6ece2921dbe + 660159e85a578aec4e5cdc047a29f686 name Localizable.strings @@ -12312,6 +12312,31 @@ La cause était: %2$@ snapshots + + change date + 2001-01-01T00:00:00Z + changed values + + class + BLStringKeyObject + comment + No comment provided by engineer. + errors + + flags + 0 + key + Photo library + localizations + + en + Photo library + fr + Album photos + + snapshots + + change date 2001-01-01T00:00:00Z diff --git a/linphone.ldb/Resources/Classes/ChatRoomViewController/33/ChatRoomViewController.xib b/linphone.ldb/Resources/Classes/ChatRoomViewController/34/ChatRoomViewController.xib similarity index 99% rename from linphone.ldb/Resources/Classes/ChatRoomViewController/33/ChatRoomViewController.xib rename to linphone.ldb/Resources/Classes/ChatRoomViewController/34/ChatRoomViewController.xib index a11bc6f83..7aa878b4c 100644 --- a/linphone.ldb/Resources/Classes/ChatRoomViewController/33/ChatRoomViewController.xib +++ b/linphone.ldb/Resources/Classes/ChatRoomViewController/34/ChatRoomViewController.xib @@ -267,7 +267,6 @@ {{262, 0}, {58, 57}} - _NS:9 NO @@ -290,7 +289,7 @@ 2 - MC43MjU0OTAyMTI0IDAuNzY4NjI3NDY0OCAwLjc5NjA3ODQ0MzUAA + MC44MDc4NDMxMzczIDAuODE1Njg2Mjc0NSAwLjgyMzUyOTQxMTgAA 2 diff --git a/linphone.ldb/Resources/Resources/Localizable/1/Localizable.strings b/linphone.ldb/Resources/Resources/Localizable/1/Localizable.strings index 03fb0ee4b..a962fb583 100644 Binary files a/linphone.ldb/Resources/Resources/Localizable/1/Localizable.strings and b/linphone.ldb/Resources/Resources/Localizable/1/Localizable.strings differ