mirror of
https://github.com/leanote/leanote-ios.git
synced 2025-10-14 15:11:00 +00:00
fix LeaWebViewController crash & share options crash & pick image crash
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 16 KiB |
Binary file not shown.
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 16 KiB |
@@ -24,6 +24,7 @@
|
||||
#import "UIImage+Util.h"
|
||||
#import "WPFontManager.h"
|
||||
#import "WPStyleGuide.h"
|
||||
|
||||
#import <WPMediaPicker/WPMediaPicker.h>
|
||||
#import <QBImagePickerController/QBImagePickerController.h>
|
||||
|
||||
@@ -447,8 +448,8 @@ BOOL hiddenBar = NO;
|
||||
|
||||
- (void)editorDidPressMedia:(WPEditorViewController *)editorController
|
||||
{
|
||||
// [self showPhotoPickerForBetterDevice];
|
||||
// return;
|
||||
[self showPhotoPickerForBetterDevice];
|
||||
return;
|
||||
// iphone
|
||||
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
|
||||
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:NSLocalizedString(@"Add Photo", nil) message:nil delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Photo Library", nil),NSLocalizedString(@"Take Photo", nil), nil];
|
||||
@@ -702,7 +703,7 @@ BOOL hiddenBar = NO;
|
||||
QBImagePickerController *imagePickerController = [QBImagePickerController new];
|
||||
imagePickerController.delegate = self;
|
||||
imagePickerController.allowsMultipleSelection = YES;
|
||||
imagePickerController.maximumNumberOfSelection = 6;
|
||||
imagePickerController.maximumNumberOfSelection = 1;
|
||||
imagePickerController.showsNumberOfSelectedAssets = YES;
|
||||
imagePickerController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
|
||||
[self presentViewController:imagePickerController animated:YES completion:NULL];
|
||||
@@ -806,15 +807,20 @@ BOOL hiddenBar = NO;
|
||||
}
|
||||
- (void)addMediaAssets:(NSArray *)assets
|
||||
{
|
||||
NSString *urls = @"[";
|
||||
NSMutableArray * array = [[ NSMutableArray alloc]init];
|
||||
// NSString *urls = @"[";
|
||||
for (ALAsset *asset in assets) {
|
||||
NSString *fileId = [self addImageAssetToContent:asset];
|
||||
urls = [NSString stringWithFormat:@"%@'%@',", urls, [self getImageUrl:fileId]];
|
||||
// urls = [NSString stringWithFormat:@"%@'%@',", urls, [self getImageUrl:fileId]];
|
||||
[array addObject:[self getImageUrl:fileId]];
|
||||
}
|
||||
urls = [NSString stringWithFormat:@"%@]", urls];
|
||||
// urls = [NSString stringWithFormat:@"%@]", urls];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.editorView insertImage:urls alt:@""];
|
||||
// [self.editorView insertImage:urls alt:@""];
|
||||
for (NSString *object in array) {
|
||||
[self.editorView insertImage:object alt:@""];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
@interface LeaWebViewController : UIViewController<WKNavigationDelegate>
|
||||
|
||||
// Interface
|
||||
@property (nonatomic, weak) IBOutlet WKWebView *webView;
|
||||
@property (nonatomic, strong) IBOutlet WKWebView *webView;
|
||||
//@property (nonatomic, weak) IBOutlet WKWebView *wkView;
|
||||
@property (nonatomic, strong) IBOutlet UIToolbar *toolbar;
|
||||
@property (nonatomic, strong) IBOutlet UIView *loadingView;
|
||||
|
@@ -373,6 +373,7 @@
|
||||
return (content || '').trim().substr(0, 50);\
|
||||
})();\
|
||||
";
|
||||
// js = @"document.body.outerHTML";
|
||||
//执行JS
|
||||
[self.webView evaluateJavaScript:js completionHandler:^(id _Nullable result, NSError * _Nullable error) {
|
||||
NSLog(@"get desc ret %@ %@", error, result);
|
||||
@@ -599,17 +600,18 @@
|
||||
NSString* permaLink = [self getDocumentPermalink];
|
||||
|
||||
NSString *title = [self getDocumentTitle];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self getDocumentDesc:^(NSString *desc){
|
||||
|
||||
NSLog(@"showLinkOptions desc: %@", desc);
|
||||
NSLog(@"showLinkOptions link: %@, title: %@, desc: %@", permaLink, title, desc);
|
||||
|
||||
NSMutableArray *activityItems = [NSMutableArray array];
|
||||
if (title) {
|
||||
[activityItems addObject:title];
|
||||
}
|
||||
if (desc) {
|
||||
[activityItems addObject:desc];
|
||||
}
|
||||
// if (desc) {
|
||||
// [activityItems addObject:desc];
|
||||
// }
|
||||
|
||||
// weixin
|
||||
NSArray *activities = @[[[WeixinSessionActivity alloc] init], [[WeixinTimelineActivity alloc] init]];
|
||||
@@ -624,7 +626,7 @@
|
||||
if (!completed) {
|
||||
return;
|
||||
}
|
||||
// [WPActivityDefaults trackActivityType:activityType];
|
||||
// [WPActivityDefaults trackActivityType:activityType];
|
||||
};
|
||||
|
||||
if (IS_IPAD) {
|
||||
@@ -639,6 +641,7 @@
|
||||
[self presentViewController:activityViewController animated:YES completion:nil];
|
||||
}
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)reload
|
||||
|
Reference in New Issue
Block a user