mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
delete text
This commit is contained in:
parent
ae0917cc83
commit
21515b5a2e
2 changed files with 11 additions and 17 deletions
|
|
@ -209,12 +209,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[self shareFile];
|
||||
}
|
||||
|
||||
- (void)sendContentText:(NSString *)text {
|
||||
if(![text isEqualToString:@""]) {
|
||||
[self sendMessage:text withExterlBodyUrl:nil withInternalURL:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)shareFile {
|
||||
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:groupName];
|
||||
|
||||
|
|
@ -227,7 +221,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
NSData *data = dict[@"nsData"];
|
||||
UIImage *image = [[UIImage alloc] initWithData:data];
|
||||
[self chooseImageQuality:image url:nil];
|
||||
[self sendContentText:dict[@"name"]];
|
||||
[defaults removeObjectForKey:@"img"];
|
||||
} else if (dictWeb) {
|
||||
//share url, if local file, then upload file
|
||||
|
|
@ -236,21 +229,19 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
if ([url hasPrefix:@"file"]) {
|
||||
//local file
|
||||
NSData *data = dictWeb[@"nsData"];
|
||||
[self confirmShare:data url:fileUrl];
|
||||
[self confirmShare:data url:fileUrl text:nil];
|
||||
} else {
|
||||
[self sendMessage:url withExterlBodyUrl:nil withInternalURL:nil];
|
||||
[self confirmShare:nil url:nil text:url];
|
||||
}
|
||||
[self sendContentText:dictWeb[@"name"]];
|
||||
[defaults removeObjectForKey:@"web"];
|
||||
}else if (dictFile) {
|
||||
//share file
|
||||
NSData *data = dictFile[@"nsData"];
|
||||
[self confirmShare:data url:[NSURL fileURLWithPath:dictFile[@"url"]]];
|
||||
[self sendContentText:dictFile[@"name"]];
|
||||
[self confirmShare:data url:[NSURL fileURLWithPath:dictFile[@"url"]] text:nil];
|
||||
[defaults removeObjectForKey:@"mov"];
|
||||
}else if (dictText) {
|
||||
//share text
|
||||
[self sendContentText:dictText[@"name"]];
|
||||
[self confirmShare:nil url:nil text:dictText[@"name"]];
|
||||
[defaults removeObjectForKey:@"text"];
|
||||
}
|
||||
}
|
||||
|
|
@ -366,13 +357,17 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
});
|
||||
}
|
||||
|
||||
- (void)confirmShare:(NSData *)data url:(NSURL *)url {
|
||||
- (void)confirmShare:(NSData *)data url:(NSURL *)url text:(NSString *)text {
|
||||
DTActionSheet *sheet = [[DTActionSheet alloc] initWithTitle:NSLocalizedString(@"", nil)];
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
|
||||
[sheet addButtonWithTitle:@"send to this friend"
|
||||
block:^() {
|
||||
if(data && url)
|
||||
[self startFileUpload:data withUrl:url];
|
||||
else
|
||||
[self sendMessage:text withExterlBodyUrl:nil withInternalURL:nil];
|
||||
|
||||
}];
|
||||
|
||||
[sheet addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil];
|
||||
|
|
|
|||
|
|
@ -56,8 +56,7 @@ static NSString* groupName = @"group.belledonne-communications.linphone";
|
|||
NSData *nsData = [NSData dataWithContentsOfURL:(NSURL*)item];
|
||||
if (nsData) {
|
||||
NSDictionary *dict = @{@"nsData" : nsData,
|
||||
@"url" : [(NSURL*)item absoluteString],
|
||||
@"name" : self.contentText};
|
||||
@"url" : [(NSURL*)item absoluteString]};
|
||||
[defaults setObject:dict forKey:key];
|
||||
} else {
|
||||
NSLog(@"NSExtensionItem Error, provider = %@", provider);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue