mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
enable send post text when sharing files
This commit is contained in:
parent
1c492208c0
commit
24260cc6b5
2 changed files with 22 additions and 9 deletions
|
|
@ -257,6 +257,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
if (dict) {
|
||||
//file shared from photo lib
|
||||
NSString *fileName = dict[@"url"];
|
||||
[_messageField setText:dict[@"message"]];
|
||||
NSString *key = [[fileName componentsSeparatedByString:@"."] firstObject];
|
||||
NSMutableDictionary <NSString *, PHAsset *> * assetDict = [LinphoneUtils photoAssetsDictionary];
|
||||
if ([fileName hasSuffix:@"JPG"] || [fileName hasSuffix:@"PNG"]) {
|
||||
|
|
@ -271,11 +272,13 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[defaults removeObjectForKey:@"photoData"];
|
||||
} else if (dictFile) {
|
||||
NSString *fileName = dictFile[@"url"];
|
||||
[_messageField setText:dictFile[@"message"]];
|
||||
[self confirmShare:dictFile[@"nsData"] url:nil fileName:fileName assetId:nil];
|
||||
|
||||
[defaults removeObjectForKey:@"icloudData"];
|
||||
} else if (dictUrl) {
|
||||
NSString *url = dictUrl[@"url"];
|
||||
[_messageField setText:dictUrl[@"message"]];
|
||||
[self confirmShare:nil url:url fileName:nil assetId:nil];
|
||||
|
||||
[defaults removeObjectForKey:@"url"];
|
||||
|
|
@ -377,6 +380,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[sheet addButtonWithTitle:@"send to this friend"
|
||||
block:^() {
|
||||
if (![[self.messageField text] isEqualToString:@""]) {
|
||||
[self sendMessageInMessageField];
|
||||
}
|
||||
if (url)
|
||||
[self sendMessage:url withExterlBodyUrl:nil withInternalURL:nil];
|
||||
else if (fileName)
|
||||
|
|
@ -465,6 +471,15 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)sendMessageInMessageField {
|
||||
if ([self sendMessage:[_messageField text] withExterlBodyUrl:nil withInternalURL:nil]) {
|
||||
scrollOnGrowingEnabled = FALSE;
|
||||
[_messageField setText:@""];
|
||||
scrollOnGrowingEnabled = TRUE;
|
||||
[self onMessageChange:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate Functions
|
||||
|
||||
- (BOOL)growingTextViewShouldBeginEditing:(HPGrowingTextView *)growingTextView {
|
||||
|
|
@ -555,12 +570,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[self clearMessageView];
|
||||
return;
|
||||
}
|
||||
if ([self sendMessage:[_messageField text] withExterlBodyUrl:nil withInternalURL:nil]) {
|
||||
scrollOnGrowingEnabled = FALSE;
|
||||
[_messageField setText:@""];
|
||||
scrollOnGrowingEnabled = TRUE;
|
||||
[self onMessageChange:nil];
|
||||
}
|
||||
[self sendMessageInMessageField];
|
||||
}
|
||||
|
||||
- (IBAction)onListTap:(id)sender {
|
||||
|
|
|
|||
|
|
@ -75,16 +75,19 @@ static NSString* groupName = @"group.belledonne-communications.linphone";
|
|||
if([imgPath containsString:@"var/mobile/Media/PhotoData"]) {
|
||||
// We get the corresponding PHAsset identifier so we can display the image in the app without having to duplicate it.
|
||||
NSDictionary *dict = @{@"nsData" : nsData,
|
||||
@"url" : filename};
|
||||
@"url" : filename,
|
||||
@"message" : self.contentText};
|
||||
[defaults setObject:dict forKey:@"photoData"];
|
||||
} else if ([imgPath containsString:@"var/mobile/Library/Mobile Documents/com~apple~CloudDocs"] || [[url scheme] isEqualToString:@"file"]) {
|
||||
// shared files from icloud drive
|
||||
NSDictionary *dict = @{@"nsData" : nsData,
|
||||
@"url" : filename};
|
||||
@"url" : filename,
|
||||
@"message" : self.contentText};
|
||||
[defaults setObject:dict forKey:@"icloudData"];
|
||||
} else {
|
||||
//Others
|
||||
NSDictionary *dict = @{@"url" : [url absoluteString]};
|
||||
NSDictionary *dict = @{@"url" : [url absoluteString],
|
||||
@"message" : self.contentText};
|
||||
[defaults setObject:dict forKey:@"url"];
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue