mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Fix image sharing from gallery, and fix view navigation
This commit is contained in:
parent
78c21a5c2b
commit
4b5eaa3bc5
7 changed files with 70 additions and 13 deletions
|
|
@ -112,6 +112,7 @@
|
|||
@property LinphonePlayer *sharedVoicePlayer;
|
||||
@property BOOL showVoiceRecorderView;
|
||||
@property BOOL preservePendingActions;
|
||||
@property BOOL *sharingMedia;
|
||||
|
||||
// Reply
|
||||
@property (weak, nonatomic) IBOutlet UIView *replyView;
|
||||
|
|
|
|||
|
|
@ -622,9 +622,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)confirmShare:(NSData *)data url:(NSString *)url fileName:(NSString *)fileName {
|
||||
DTActionSheet *sheet = [[DTActionSheet alloc] initWithTitle:@""];
|
||||
DTActionSheet *sheet = [[DTActionSheet alloc] initWithTitle:NSLocalizedString(@"Select or create a conversation to share the file(s)", nil)];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[sheet addButtonWithTitle:NSLocalizedString(@"send to this conversation", nil)
|
||||
[sheet addButtonWithTitle:NSLocalizedString(@"Send to this conversation", nil)
|
||||
block:^() {
|
||||
if (![[self.messageField text] isEqualToString:@""]) {
|
||||
[self sendMessageInMessageField:linphone_chat_room_create_empty_message(_chatRoom)];
|
||||
|
|
@ -812,9 +812,11 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
- (IBAction)onBackClick:(id)event {
|
||||
NSString *previousViewName = [PhoneMainView.instance getPreviousViewName];
|
||||
if ([previousViewName isEqualToString:@"ContactDetailsView"]) {
|
||||
VIEW(ChatConversationView).sharingMedia = nil;
|
||||
ContactDetailsView *view = VIEW(ContactDetailsView);
|
||||
[PhoneMainView.instance popToView:view.compositeViewDescription];
|
||||
} else {
|
||||
VIEW(ChatConversationView).sharingMedia = nil;
|
||||
ChatsListView *view = VIEW(ChatsListView);
|
||||
[PhoneMainView.instance popToView:view.compositeViewDescription];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,4 +43,6 @@
|
|||
- (IBAction)onEditionChangeClick:(id)sender;
|
||||
- (IBAction)onDeleteClick:(id)sender;
|
||||
|
||||
-(void) mediaSharing;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -58,20 +58,40 @@
|
|||
forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.view addSubview:button];*/
|
||||
|
||||
BOOL forwardMode = VIEW(ChatConversationView).pendingForwardMessage != nil;
|
||||
[self mediaSharing];
|
||||
|
||||
}
|
||||
|
||||
- (void)mediaSharing{
|
||||
BOOL forwardMode;
|
||||
|
||||
NSString* groupName = [NSString stringWithFormat:@"group.%@.linphoneExtension",[[NSBundle mainBundle] bundleIdentifier]];
|
||||
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:groupName];
|
||||
NSDictionary *dict = [defaults valueForKey:@"photoData"];
|
||||
NSDictionary *dictFile = [defaults valueForKey:@"icloudData"];
|
||||
NSDictionary *dictUrl = [defaults valueForKey:@"url"];
|
||||
if(dict||dictFile||dictUrl) VIEW(ChatConversationView).sharingMedia = TRUE;
|
||||
|
||||
if(VIEW(ChatConversationView).sharingMedia == nil){
|
||||
forwardMode = VIEW(ChatConversationView).pendingForwardMessage != nil;
|
||||
}else{
|
||||
forwardMode = VIEW(ChatConversationView).sharingMedia != nil;
|
||||
}
|
||||
_tableController.editButton.hidden = forwardMode;
|
||||
_forwardTitle.text = NSLocalizedString(@"Select a discussion or create a new one",nil);
|
||||
if(VIEW(ChatConversationView).sharingMedia == nil){
|
||||
_forwardTitle.text = NSLocalizedString(@"Select a discussion or create a new one",nil);
|
||||
}
|
||||
else{
|
||||
_forwardTitle.text = NSLocalizedString(@"Select or create a conversation to share the file(s)",nil);
|
||||
}
|
||||
_forwardTitle.hidden = !forwardMode;
|
||||
_cancelForwardButton.hidden = !forwardMode;
|
||||
|
||||
_tableController.tableView.frame = CGRectMake(0, 66 + (forwardMode ? _forwardTitle.frame.size.height : 0), _tableController.tableView.frame.size.width, self.view.frame.size.height - 66 - ( forwardMode ? _forwardTitle.frame.size.height : 0 ));
|
||||
_addButton.frame = CGRectMake(forwardMode ? 82 : 0 , _addButton.frame.origin.y, _addButton.frame.size.width, _addButton.frame.size.height);
|
||||
_addGroupChatButton.frame = CGRectMake(forwardMode ? 164 : 82 , _addGroupChatButton.frame.origin.y, _addGroupChatButton.frame.size.width, _addGroupChatButton.frame.size.height);
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)displayModeChanged{
|
||||
[self.tableController.tableView reloadData];
|
||||
}
|
||||
|
|
@ -180,8 +200,16 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (IBAction)onCancelForwardClicked:(id)sender {
|
||||
VIEW(ChatConversationView).sharingMedia = nil;
|
||||
VIEW(ChatConversationView).pendingForwardMessage = nil;
|
||||
NSString* groupName = [NSString stringWithFormat:@"group.%@.linphoneExtension",[[NSBundle mainBundle] bundleIdentifier]];
|
||||
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:groupName];
|
||||
[defaults removeObjectForKey:@"photoData"];
|
||||
[defaults removeObjectForKey:@"icloudData"];
|
||||
[defaults removeObjectForKey:@"url"];
|
||||
[PhoneMainView.instance popCurrentView];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@
|
|||
#import <IntentsUI/IntentsUI.h>
|
||||
#import "linphoneapp-Swift.h"
|
||||
|
||||
#import "SVProgressHUD.h"
|
||||
|
||||
|
||||
#ifdef USE_CRASHLYTICS
|
||||
#include "FIRApp.h"
|
||||
|
|
@ -402,7 +404,15 @@
|
|||
|
||||
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
|
||||
} else if([[url scheme] isEqualToString:@"message-linphone"]) {
|
||||
[PhoneMainView.instance popToView:ChatsListView.compositeViewDescription];
|
||||
if ([[PhoneMainView.instance currentView] equal:ChatsListView.compositeViewDescription]) {
|
||||
VIEW(ChatConversationView).sharingMedia = TRUE;
|
||||
ChatsListView *view = VIEW(ChatsListView);
|
||||
[view mediaSharing];
|
||||
}else{
|
||||
[SVProgressHUD dismiss];
|
||||
VIEW(ChatConversationView).sharingMedia = TRUE;
|
||||
[PhoneMainView.instance popToView:ChatsListView.compositeViewDescription];
|
||||
}
|
||||
} else if ([scheme isEqualToString:@"sip"]||[scheme isEqualToString:@"sips"]) {
|
||||
// remove "sip://" from the URI, and do it correctly by taking resourceSpecifier and removing leading and
|
||||
// trailing "/"
|
||||
|
|
|
|||
|
|
@ -453,9 +453,19 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
LinphoneManager *lm = LinphoneManager.instance;
|
||||
LOGI(@"%s", linphone_global_state_to_string(linphone_core_get_global_state(LC)));
|
||||
|
||||
NSString* groupName = [NSString stringWithFormat:@"group.%@.linphoneExtension",[[NSBundle mainBundle] bundleIdentifier]];
|
||||
|
||||
|
||||
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:groupName];
|
||||
NSDictionary *dict = [defaults valueForKey:@"photoData"];
|
||||
NSDictionary *dictFile = [defaults valueForKey:@"icloudData"];
|
||||
NSDictionary *dictUrl = [defaults valueForKey:@"url"];
|
||||
|
||||
// If we've been started by a remote push notification,
|
||||
// we'll already be on the corresponding chat conversation view, no need to go anywhere else
|
||||
if (![[self currentView].name isEqualToString:@"ChatConversationView"]) {
|
||||
if (dict||dictFile||dictUrl){
|
||||
[self changeCurrentView:ChatsListView.compositeViewDescription];
|
||||
}else if (![[self currentView].name isEqualToString:@"ChatConversationView"]) {
|
||||
|
||||
if (linphone_core_get_global_state(LC) != LinphoneGlobalOn) {
|
||||
[self changeCurrentView:DialerView.compositeViewDescription];
|
||||
|
|
@ -607,7 +617,8 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
}
|
||||
[self _changeCurrentView:viewStack.lastObject ?: DialerView.compositeViewDescription
|
||||
transition:[PhoneMainView getBackwardTransition]
|
||||
animated:ANIMATED];
|
||||
animated:ANIMATED
|
||||
addViewToStack:FALSE];
|
||||
return [mainViewController getCurrentViewController];
|
||||
}
|
||||
|
||||
|
|
@ -621,24 +632,27 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
|
||||
|
||||
- (void)changeCurrentView:(UICompositeViewDescription *)view {
|
||||
[self _changeCurrentView:view transition:nil animated:ANIMATED];
|
||||
[self _changeCurrentView:view transition:nil animated:ANIMATED addViewToStack:TRUE];
|
||||
}
|
||||
|
||||
- (UIViewController *)_changeCurrentView:(UICompositeViewDescription *)view
|
||||
transition:(CATransition *)transition
|
||||
animated:(BOOL)animated {
|
||||
animated:(BOOL)animated
|
||||
addViewToStack:(BOOL)addViewToStack {
|
||||
PhoneMainView *vc = [[RootViewManager instance] setViewControllerForDescription:view];
|
||||
LOGI(@"_changeCurrentView : stack size before = %d", [RootViewManager instance].viewDescriptionStack.count);
|
||||
if (![view equal:vc.currentView] || vc != self) {
|
||||
LOGI(@"Change current view to %@", view.name);
|
||||
[self setPreviousViewName:vc.currentView.name];
|
||||
NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack;
|
||||
[viewStack addObject:view];
|
||||
if (addViewToStack) [viewStack addObject:view];
|
||||
if (animated && transition == nil)
|
||||
transition = [PhoneMainView getTransition:vc.currentView new:view];
|
||||
[vc.mainViewController setViewTransition:(animated ? transition : nil)];
|
||||
[vc.mainViewController changeView:view];
|
||||
vc->currentView = view;
|
||||
}
|
||||
LOGI(@"_changeCurrentView : stack size after = %d", [RootViewManager instance].viewDescriptionStack.count);
|
||||
|
||||
//[[RootViewManager instance] setViewControllerForDescription:view];
|
||||
|
||||
|
|
@ -653,7 +667,7 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
while (viewStack.count > 0 && ![[viewStack lastObject] equal:view]) {
|
||||
[viewStack removeLastObject];
|
||||
}
|
||||
return [self _changeCurrentView:view transition:[PhoneMainView getBackwardTransition] animated:ANIMATED];
|
||||
return [self _changeCurrentView:view transition:[PhoneMainView getBackwardTransition] animated:ANIMATED addViewToStack:FALSE];
|
||||
}
|
||||
|
||||
- (void) setPreviousViewName:(NSString*)previous{
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Reference in a new issue