替换imagePicker库

1.原先为WPMediaPicker 替换为QBImagePickerController
2.以解决添加图片崩溃 内存泄漏 问题.
This commit is contained in:
Pikachuode
2015-12-22 13:21:33 +08:00
parent 81ae6a4752
commit e4bb7d3d94
27 changed files with 779 additions and 741 deletions

View File

@@ -3,10 +3,10 @@
#import "NoteController.h" #import "NoteController.h"
#import "Common.h" #import "Common.h"
#import <WordPress-iOS-Shared/UIImage+Util.h> #import <WordPress-iOS-Shared/WordPressShared/UIImage+Util.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/UIColor+Helpers.h> #import <WordPress-iOS-Shared/WordPressShared/UIColor+Helpers.h>
#import "SVProgressHUD.h" #import "SVProgressHUD.h"
#import "WXApi.h" #import "WXApi.h"

View File

@@ -1,80 +1,85 @@
{ {
"images" : [ "images" : [
{ {
"idiom" : "iphone",
"size" : "29x29", "size" : "29x29",
"scale" : "2x", "idiom" : "iphone",
"filename" : "Icon-Small@2x.png" "filename" : "Icon-Small@2x.png",
"scale" : "2x"
}, },
{ {
"idiom" : "iphone",
"size" : "29x29", "size" : "29x29",
"scale" : "3x", "idiom" : "iphone",
"filename" : "Icon-Small@3x.png" "filename" : "Icon-Small@3x.png",
"scale" : "3x"
}, },
{ {
"idiom" : "iphone",
"size" : "40x40", "size" : "40x40",
"scale" : "2x", "idiom" : "iphone",
"filename" : "Icon-40@2x.png" "filename" : "Icon-40@2x.png",
"scale" : "2x"
}, },
{ {
"idiom" : "iphone",
"size" : "40x40", "size" : "40x40",
"scale" : "3x", "idiom" : "iphone",
"filename" : "Icon-40@3x.png" "filename" : "Icon-40@3x.png",
"scale" : "3x"
}, },
{ {
"idiom" : "iphone",
"size" : "60x60", "size" : "60x60",
"scale" : "2x",
"filename" : "Icon-60@2x.png"
},
{
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60", "size" : "60x60",
"scale" : "3x", "idiom" : "iphone",
"filename" : "Icon-60@3x.png" "filename" : "Icon-60@3x.png",
"scale" : "3x"
}, },
{ {
"idiom" : "ipad",
"size" : "29x29", "size" : "29x29",
"scale" : "1x", "idiom" : "ipad",
"filename" : "Icon-Small.png" "filename" : "Icon-Small.png",
"scale" : "1x"
}, },
{ {
"idiom" : "ipad",
"size" : "29x29", "size" : "29x29",
"scale" : "2x", "idiom" : "ipad",
"filename" : "Icon-Small@2x.png" "filename" : "Icon-Small@2x.png",
"scale" : "2x"
}, },
{ {
"idiom" : "ipad",
"size" : "40x40", "size" : "40x40",
"scale" : "1x", "idiom" : "ipad",
"filename" : "Icon-40.png" "filename" : "Icon-40.png",
"scale" : "1x"
}, },
{ {
"idiom" : "ipad",
"size" : "40x40", "size" : "40x40",
"scale" : "2x", "idiom" : "ipad",
"filename" : "Icon-40@2x.png" "filename" : "Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76@2x.png",
"scale" : "2x"
}, },
{ {
"idiom" : "ipad", "idiom" : "ipad",
"size" : "76x76", "size" : "83.5x83.5",
"scale" : "1x", "scale" : "2x"
"filename" : "Icon-76.png"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x",
"filename" : "Icon-76@2x.png"
} }
], ],
"info" : { "info" : {
"version" : 1, "version" : 1,
"author" : "makeappicon" "author" : "xcode"
} }
} }

View File

@@ -38,7 +38,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1323</string> <string>1371</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>

View File

@@ -18,7 +18,7 @@
<key>AutocorrectionType</key> <key>AutocorrectionType</key>
<string>No</string> <string>No</string>
<key>DefaultValue</key> <key>DefaultValue</key>
<string>1.3 (1323)</string> <string>1.3 (1371)</string>
<key>IsSecure</key> <key>IsSecure</key>
<false/> <false/>
<key>Key</key> <key>Key</key>

View File

@@ -11,8 +11,7 @@
#import "ApiMsg.h" #import "ApiMsg.h"
#import "Common.h" #import "Common.h"
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <objc/runtime.h> #import <objc/runtime.h>
NSString const *key = @"isSelectOnSearchKey"; NSString const *key = @"isSelectOnSearchKey";

View File

@@ -13,10 +13,10 @@
#import "RegisterController.h" #import "RegisterController.h"
#import "WPWalkthroughOverlayView.h" #import "WPWalkthroughOverlayView.h"
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/UIColor+Helpers.h> #import <WordPress-iOS-Shared/WordPressShared/UIColor+Helpers.h>
#import <WordPress-iOS-Shared/WPNUXUtility.h> #import <WordPress-iOS-Shared/WordPressShared/WPNUXUtility.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import "ReachabilityUtils.h" #import "ReachabilityUtils.h"
#import "LeaAlert.h" #import "LeaAlert.h"

View File

@@ -14,11 +14,11 @@
#import "RegisterController.h" #import "RegisterController.h"
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/UIColor+Helpers.h> #import <WordPress-iOS-Shared/WordPressShared/UIColor+Helpers.h>
#import <WordPress-iOS-Shared/WPNUXUtility.h> #import <WordPress-iOS-Shared/WordPressShared/WPNUXUtility.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WordPress-iOS-Shared/NSString+Util.h> #import <WordPress-iOS-Shared/WordPressShared/NSString+Util.h>
#import "UILabel+SuggestSize.h" #import "UILabel+SuggestSize.h"

View File

@@ -1,5 +1,5 @@
#import "WPNUXBackButton.h" #import "WPNUXBackButton.h"
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
@implementation WPNUXBackButton @implementation WPNUXBackButton

View File

@@ -1,5 +1,5 @@
#import "WPNUXMainButton.h" #import "WPNUXMainButton.h"
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
@implementation WPNUXMainButton { @implementation WPNUXMainButton {
UIActivityIndicatorView *activityIndicator; UIActivityIndicatorView *activityIndicator;

View File

@@ -1,5 +1,5 @@
#import "WPNUXPrimaryButton.h" #import "WPNUXPrimaryButton.h"
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
@implementation WPNUXPrimaryButton @implementation WPNUXPrimaryButton

View File

@@ -1,5 +1,5 @@
#import "WPNUXSecondaryButton.h" #import "WPNUXSecondaryButton.h"
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
@implementation WPNUXSecondaryButton @implementation WPNUXSecondaryButton

View File

@@ -1,9 +1,15 @@
#import "WPWalkthroughOverlayView.h" #import "WPWalkthroughOverlayView.h"
#import "WPNUXPrimaryButton.h" #import "WPNUXPrimaryButton.h"
#import "WPNUXSecondaryButton.h" #import "WPNUXSecondaryButton.h"
#import "WPNUXUtility.h"
#import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import "UILabel+SuggestSize.h" #import "UILabel+SuggestSize.h"
#import <WordPress-iOS-Shared/WPFontManager.h>
//#import <WordPress-iOS-Shared/WPFontManager.h>
#import <WordPress-iOS-Shared/WordPressShared/WPNUXUtility.h>
@interface WPWalkthroughOverlayView() { @interface WPWalkthroughOverlayView() {
UIImageView *_logo; UIImageView *_logo;

View File

@@ -8,13 +8,13 @@
#import "MeController.h" #import "MeController.h"
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WordPress-iOS-Shared/UIImage+Util.h> #import <WordPress-iOS-Shared/WordPressShared/UIImage+Util.h>
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WordPress-iOS-Shared/WPTableViewCell.h> #import <WordPress-iOS-Shared/WordPressShared/WPTableViewCell.h>
#import <WordPress-iOS-Shared/UITableViewTextFieldCell.h> #import <WordPress-iOS-Shared/WordPressShared/WPTextFieldTableViewCell.h>
#import <WordPress-iOS-Shared/WPTableViewSectionHeaderView.h> #import <WordPress-iOS-Shared/WordPressShared/WPTableViewSectionHeaderFooterView.h>
#import "LoginViewController.h" #import "LoginViewController.h"
#import "UserService.h" #import "UserService.h"
@@ -362,7 +362,7 @@ NSArray *users;
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{ {
WPTableViewSectionHeaderView *header = [[WPTableViewSectionHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.view.bounds), 0.0f)]; WPTableViewSectionHeaderFooterView *header = [[WPTableViewSectionHeaderFooterView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.view.bounds), 0.0f)];
header.title = [self titleForHeaderInSection:section]; header.title = [self titleForHeaderInSection:section];
header.backgroundColor = self.tableView.backgroundColor; header.backgroundColor = self.tableView.backgroundColor;
return header; return header;

View File

@@ -13,11 +13,11 @@
#import "Leas.h" #import "Leas.h"
#import "LeaButtonForNavigationBar.h" #import "LeaButtonForNavigationBar.h"
#import <WordPress-iOS-Shared/UIImage+Util.h> #import <WordPress-iOS-Shared/WordPressShared/UIImage+Util.h>
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WordPress-iOS-Shared/WPTableViewCell.h> #import <WordPress-iOS-Shared/WordPressShared/WPTableViewCell.h>
#import <WordPress-iOS-Shared/UITableViewTextFieldCell.h> #import <WordPress-iOS-Shared/WordPressShared/WPTextFieldTableViewCell.h>
typedef enum { typedef enum {
PostSettingsSectionTaxonomy = 0, PostSettingsSectionTaxonomy = 0,
@@ -191,7 +191,7 @@ typedef enum {
} else if (indexPath.row == PostSettingsRowTags) { } else if (indexPath.row == PostSettingsRowTags) {
// Tags, , // Tags, ,
UITableViewTextFieldCell *textCell = [self getTextFieldCell]; WPTextFieldTableViewCell *textCell = [self getTextFieldCell];
textCell.textLabel.text = NSLocalizedString(@"Tags", nil); textCell.textLabel.text = NSLocalizedString(@"Tags", nil);
textCell.textField.text = self.note.tags; textCell.textField.text = self.note.tags;
textCell.textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:(NSLocalizedString(@"Comma separated", nil)) attributes:(@{NSForegroundColorAttributeName: [WPStyleGuide textFieldPlaceholderGrey]})]; textCell.textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:(NSLocalizedString(@"Comma separated", nil)) attributes:(@{NSForegroundColorAttributeName: [WPStyleGuide textFieldPlaceholderGrey]})];
@@ -258,12 +258,12 @@ typedef enum {
} }
// cell // cell
- (UITableViewTextFieldCell *)getTextFieldCell - (WPTextFieldTableViewCell *)getTextFieldCell
{ {
static NSString *textFieldCellIdentifier = @"textFieldCellIdentifier"; static NSString *textFieldCellIdentifier = @"textFieldCellIdentifier";
UITableViewTextFieldCell *cell = [self.tableView dequeueReusableCellWithIdentifier:textFieldCellIdentifier]; WPTextFieldTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:textFieldCellIdentifier];
if (!cell) { if (!cell) {
cell = [[UITableViewTextFieldCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:textFieldCellIdentifier]; cell = [[WPTextFieldTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:textFieldCellIdentifier];
cell.textField.returnKeyType = UIReturnKeyDone; cell.textField.returnKeyType = UIReturnKeyDone;
cell.textField.delegate = self; cell.textField.delegate = self;
[WPStyleGuide configureTableViewTextCell:cell]; [WPStyleGuide configureTableViewTextCell:cell];

View File

@@ -21,10 +21,10 @@
#import "LeaAlert.h" #import "LeaAlert.h"
#import "LeaButtonForNavigationBar.h" #import "LeaButtonForNavigationBar.h"
#import <WordPress-iOS-Shared/UIImage+Util.h> #import <WordPress-iOS-Shared/WordPressShared/UIImage+Util.h>
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WPMediaPicker/WPMediaPicker.h> #import <QBImagePickerController/QBImagePickerController.h>
#import "NoteSettingsTableViewController.h" #import "NoteSettingsTableViewController.h"
#import "LeaWebViewController.h" #import "LeaWebViewController.h"
@@ -43,6 +43,9 @@
#import "LeaImagePagerViewController.h" #import "LeaImagePagerViewController.h"
#import "LeaImageSliderViewController.h" #import "LeaImageSliderViewController.h"
#import <MobileCoreServices/MobileCoreServices.h>
typedef NS_ENUM(NSUInteger, WPViewControllerActionSheet) { typedef NS_ENUM(NSUInteger, WPViewControllerActionSheet) {
WPViewControllerActionSheetImageUploadStop = 200, WPViewControllerActionSheetImageUploadStop = 200,
WPViewControllerActionSheetImageUploadRetry = 201, WPViewControllerActionSheetImageUploadRetry = 201,
@@ -64,7 +67,7 @@ static NSDictionary *EnabledButtonBarStyle;
static NSInteger const MaximumNumberOfPictures = 10; static NSInteger const MaximumNumberOfPictures = 10;
@interface NoteViewController () <CTAssetsPickerControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIActionSheetDelegate, WPMediaPickerViewControllerDelegate> @interface NoteViewController () <CTAssetsPickerControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIActionSheetDelegate, QBImagePickerControllerDelegate, UIAlertViewDelegate>
@property(nonatomic, strong) NSMutableDictionary *mediaAdded; @property(nonatomic, strong) NSMutableDictionary *mediaAdded;
@property(nonatomic, strong) NSString *selectedMediaID; @property(nonatomic, strong) NSString *selectedMediaID;
@@ -344,8 +347,8 @@ BOOL hiddenBar = NO;
hiddenBar = YES; hiddenBar = YES;
} }
// [self prefersStatusBarHidden]; // [self prefersStatusBarHidden];
// [self setNeedsStatusBarAppearanceUpdate]; // [self setNeedsStatusBarAppearanceUpdate];
[[UIApplication sharedApplication] setStatusBarHidden:hiddenBar withAnimation:UIStatusBarAnimationSlide]; [[UIApplication sharedApplication] setStatusBarHidden:hiddenBar withAnimation:UIStatusBarAnimationSlide];
@@ -381,14 +384,14 @@ BOOL hiddenBar = NO;
- (void)editorDidBeginEditing:(WPEditorViewController *)editorController - (void)editorDidBeginEditing:(WPEditorViewController *)editorController
{ {
// DDLogInfo(@"Editor did begin editing."); // DDLogInfo(@"Editor did begin editing.");
[self refreshNavigationBarRightButtons:YES]; [self refreshNavigationBarRightButtons:YES];
} }
- (void)editorDidEndEditing:(WPEditorViewController *)editorController - (void)editorDidEndEditing:(WPEditorViewController *)editorController
{ {
// DDLogInfo(@"Editor did end editing."); // DDLogInfo(@"Editor did end editing.");
// DDLogInfo(self.bodyText); // DDLogInfo(self.bodyText);
[self saveNote:NO]; [self saveNote:NO];
} }
@@ -397,8 +400,8 @@ BOOL hiddenBar = NO;
{ {
// NSString *path = [[NSBundle mainBundle] pathForResource:@"content" ofType:@"html"]; // NSString *path = [[NSBundle mainBundle] pathForResource:@"content" ofType:@"html"];
// NSString *htmlParam = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; // NSString *htmlParam = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
// self.titleText = self.note.title; // self.titleText = self.note.title;
// self.bodyText = self.note.content; // self.bodyText = self.note.content;
if(self.note) { if(self.note) {
[self setTitleText:self.note.title]; [self setTitleText:self.note.title];
@@ -440,23 +443,42 @@ BOOL hiddenBar = NO;
- (void)editorDidPressMedia:(WPEditorViewController *)editorController - (void)editorDidPressMedia:(WPEditorViewController *)editorController
{ {
// DDLogInfo(@"Pressed Media!"); UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"添加照片" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"从相册选择",@"拍照", nil];
[self showPhotoPicker]; [alert show];
} }
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
switch (buttonIndex) {
case 0:
//
break;
case 1:
//
[self showPhotoPicker];
break;
case 2:
//
[self takePhoto];
break;
default:
break;
}
}
- (void)editorTitleDidChange:(WPEditorViewController *)editorController - (void)editorTitleDidChange:(WPEditorViewController *)editorController
{ {
// DDLogInfo(@"Editor title did change: %@", self.titleText); // DDLogInfo(@"Editor title did change: %@", self.titleText);
} }
- (void)editorTextDidChange:(WPEditorViewController *)editorController - (void)editorTextDidChange:(WPEditorViewController *)editorController
{ {
// DDLogInfo(@"Editor body text changed: %@", self.bodyText); // DDLogInfo(@"Editor body text changed: %@", self.bodyText);
} }
- (void)editorViewController:(WPEditorViewController *)editorViewController fieldCreated:(WPEditorField*)field - (void)editorViewController:(WPEditorViewController *)editorViewController fieldCreated:(WPEditorField*)field
{ {
// DDLogInfo(@"Editor field created: %@", field.nodeId); // DDLogInfo(@"Editor field created: %@", field.nodeId);
} }
// //
@@ -480,7 +502,7 @@ BOOL hiddenBar = NO;
{ {
LeaWebViewController *webViewController = [[LeaWebViewController alloc] init]; LeaWebViewController *webViewController = [[LeaWebViewController alloc] init];
webViewController.url = [NSURL URLWithString:url]; webViewController.url = [NSURL URLWithString:url];
// [self.navigationController pushViewController:webViewController animated:YES]; // [self.navigationController pushViewController:webViewController animated:YES];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:webViewController]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:webViewController];
[self.navigationController presentViewController:navController animated:YES completion:nil]; [self.navigationController presentViewController:navController animated:YES completion:nil];
@@ -523,8 +545,8 @@ BOOL hiddenBar = NO;
// //
/* /*
- (void)showImageDetailsForImageMeta:(WPImageMeta *)imageMeta - (void)showImageDetailsForImageMeta:(WPImageMeta *)imageMeta
{ {
return; return;
WPImageMetaViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"WPImageMetaViewController"]; WPImageMetaViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"WPImageMetaViewController"];
@@ -532,8 +554,8 @@ BOOL hiddenBar = NO;
controller.delegate = self; controller.delegate = self;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
[self.navigationController presentViewController:navController animated:YES completion:nil]; [self.navigationController presentViewController:navController animated:YES completion:nil];
} }
*/ */
// image gallery // image gallery
- (void)showActionTapImage:(NSString *)url - (void)showActionTapImage:(NSString *)url
@@ -550,10 +572,10 @@ BOOL hiddenBar = NO;
NSString *each = urlArr[i]; NSString *each = urlArr[i];
// , , .png // , , .png
// NSString *fileId = [Common getFileIdFromUrl:each]; // NSString *fileId = [Common getFileIdFromUrl:each];
// if(fileId || [LeaImageViewController isUrlSupported:[NSURL URLWithString:each]]) { // if(fileId || [LeaImageViewController isUrlSupported:[NSURL URLWithString:each]]) {
[realUrls addObject:each]; [realUrls addObject:each];
// } // }
} }
// url // url
@@ -591,9 +613,9 @@ BOOL hiddenBar = NO;
NSString *fileId = [Common getFileIdFromUrl:url]; NSString *fileId = [Common getFileIdFromUrl:url];
if (!fileId) { if (!fileId) {
// return; // return;
} }
// self.selectedMediaID = fileId; // self.selectedMediaID = fileId;
/* /*
// //
if(self.actionSheet) { if(self.actionSheet) {
@@ -631,7 +653,7 @@ BOOL hiddenBar = NO;
controller.modalPresentationStyle = UIModalPresentationFullScreen; controller.modalPresentationStyle = UIModalPresentationFullScreen;
} }
// LeaImagePagerViewController *vc = [[LeaImagePagerViewController alloc] init]; // LeaImagePagerViewController *vc = [[LeaImagePagerViewController alloc] init];
LeaImageSliderViewController *vc = [[LeaImageSliderViewController alloc] init]; LeaImageSliderViewController *vc = [[LeaImageSliderViewController alloc] init];
[self presentViewController:vc animated:YES completion:nil]; [self presentViewController:vc animated:YES completion:nil];
} }
@@ -658,11 +680,13 @@ BOOL hiddenBar = NO;
- (void)showPhotoPicker - (void)showPhotoPicker
{ {
[self.editorView saveSelection]; [self.editorView saveSelection];
QBImagePickerController *imagePickerController = [QBImagePickerController new];
WPMediaPickerViewController * mediaPicker = [[WPMediaPickerViewController alloc] init]; imagePickerController.delegate = self;
mediaPicker.showMostRecentFirst = YES; // imagePickerController.allowsMultipleSelection = YES;
mediaPicker.delegate = self; imagePickerController.maximumNumberOfSelection = 6;
[self presentViewController:mediaPicker animated:YES completion:nil]; imagePickerController.showsNumberOfSelectedAssets = YES;
imagePickerController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:imagePickerController animated:YES completion:NULL];
/* /*
@@ -695,32 +719,32 @@ BOOL hiddenBar = NO;
} }
#pragma mark - WPMediaPickerViewControllerDelegate #pragma mark - WPMediaPickerViewControllerDelegate
-(void)qb_imagePickerController:(QBImagePickerController *)imagePickerController didSelectAsset:(ALAsset *)asset{
- (void)mediaPickerController:(WPMediaPickerViewController *)picker didFinishPickingAssets:(NSArray *)assets [self dismissViewControllerAnimated:YES completion:nil];
{ [self addMediaAssets:@[asset]];
}
-(void)qb_imagePickerController:(QBImagePickerController *)imagePickerController didSelectAssets:(NSArray *)assets{
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
// assets contains WPMediaAsset objects.
[self addMediaAssets:assets]; [self addMediaAssets:assets];
} }
-(void)qb_imagePickerControllerDidCancel:(QBImagePickerController *)imagePickerController{
//
- (void)mediaPickerControllerDidCancel:(id)picker
{
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} }
/*
#pragma mark - CTAssetsPickerControllerDelegate
- (void)assetsPickerController:(CTAssetsPickerController *)picker didFinishPickingAssets:(NSArray *)assets /*
{ #pragma mark - CTAssetsPickerControllerDelegate
- (void)assetsPickerController:(CTAssetsPickerController *)picker didFinishPickingAssets:(NSArray *)assets
{
[self dismissViewControllerAnimated:YES completion:^{ [self dismissViewControllerAnimated:YES completion:^{
[self addMediaAssets:assets]; [self addMediaAssets:assets];
}]; }];
} }
- (BOOL)assetsPickerController:(CTAssetsPickerController *)picker shouldSelectAsset:(ALAsset *)asset - (BOOL)assetsPickerController:(CTAssetsPickerController *)picker shouldSelectAsset:(ALAsset *)asset
{ {
if ([asset valueForProperty:ALAssetPropertyType] == ALAssetTypePhoto) { if ([asset valueForProperty:ALAssetPropertyType] == ALAssetTypePhoto) {
// If the image is from a shared photo stream it may not be available locally to be used // If the image is from a shared photo stream it may not be available locally to be used
if (!asset.defaultRepresentation) { if (!asset.defaultRepresentation) {
@@ -737,8 +761,8 @@ BOOL hiddenBar = NO;
} else { } else {
return NO; return NO;
} }
} }
*/ */
- (NSString *) getImageUrl:(NSString *) fileId - (NSString *) getImageUrl:(NSString *) fileId
{ {
@@ -816,24 +840,6 @@ BOOL hiddenBar = NO;
} }
*/ */
//
- (void)addAssetToContent:(NSURL *)assetURL
{
ALAssetsLibrary *assetsLibrary = [[ALAssetsLibrary alloc] init];
[assetsLibrary assetForURL:assetURL resultBlock:^(ALAsset *asset) {
if ([asset valueForProperty:ALAssetPropertyType] == ALAssetTypeVideo) {
NSLog(@"视频不允许添加");
// [self addVideoAssetToContent:asset];
} if ([asset valueForProperty:ALAssetPropertyType] == ALAssetTypePhoto) {
NSLog(@"图片插入成功!");
[self addImageAssetToContent:asset];
}
} failureBlock:^(NSError *error) {
NSLog(@"图片插入失败!");
DDLogInfo(@"Failed to insert media: %@", [error localizedDescription]);
}];
}
- (void)timerFireMethod:(NSTimer *)timer - (void)timerFireMethod:(NSTimer *)timer
{ {
@@ -887,13 +893,21 @@ BOOL hiddenBar = NO;
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{ {
[self.navigationController dismissViewControllerAnimated:YES completion:^{ [self.navigationController dismissViewControllerAnimated:YES completion:^{
NSURL *assetURL = info[UIImagePickerControllerReferenceURL]; if ([info[UIImagePickerControllerMediaType] isEqualToString:(NSString*)kUTTypeImage]) {
[self addAssetToContent:assetURL]; UIImage *theImage = info[UIImagePickerControllerOriginalImage];
//
ALAssetsLibrary *library = [[ALAssetsLibrary alloc]init];
[library writeImageToSavedPhotosAlbum:theImage.CGImage metadata:info[UIImagePickerControllerMediaMetadata] completionBlock:^(NSURL *assetURL, NSError *error) {
//
[library assetForURL:assetURL resultBlock:^(ALAsset *asset) {
[self addMediaAssets:@[asset]];
} failureBlock:nil];
}];
}
}]; }];
} }
// //
#pragma mark - UIActionSheetDelegate #pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
@@ -908,7 +922,7 @@ BOOL hiddenBar = NO;
// //
} else if (actionSheet.tag == WPViewControllerActionSheetImageUploadRetry){ } else if (actionSheet.tag == WPViewControllerActionSheetImageUploadRetry){
if (buttonIndex == actionSheet.destructiveButtonIndex) { if (buttonIndex == actionSheet.destructiveButtonIndex) {
// [self.editorView removeImage:self.selectedMediaID]; // [self.editorView removeImage:self.selectedMediaID];
} }
else if (buttonIndex == actionSheet.firstOtherButtonIndex) { else if (buttonIndex == actionSheet.firstOtherButtonIndex) {
NSString *absPath = [FileService getFileAbsPathByFileIdOrServerFileId:self.selectedMediaID]; NSString *absPath = [FileService getFileAbsPathByFileIdOrServerFileId:self.selectedMediaID];
@@ -942,6 +956,21 @@ BOOL hiddenBar = NO;
[self.editorView unmarkVideoFailedUpload:self.selectedMediaID]; [self.editorView unmarkVideoFailedUpload:self.selectedMediaID];
} }
} }
}
-(void)takePhoto{
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;
if (![UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self showPhotoPicker];
}else{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];//
picker.delegate = self;
picker.allowsEditing = NO;//
[picker setSourceType:sourceType];
[self presentViewController:picker animated:YES completion:nil];//
}
} }

View File

@@ -13,12 +13,12 @@
#import "Leas.h" #import "Leas.h"
#import "LeaButtonForNavigationBar.h" #import "LeaButtonForNavigationBar.h"
#import <WordPress-iOS-Shared/UIImage+Util.h> #import <WordPress-iOS-Shared/WordPressShared/UIImage+Util.h>
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WordPress-iOS-Shared/WPTableViewCell.h> #import <WordPress-iOS-Shared/WordPressShared/WPTableViewCell.h>
#import <WordPress-iOS-Shared/UITableViewTextFieldCell.h> #import <WordPress-iOS-Shared/WordPressShared/WPTextFieldTableViewCell.h>
#import <WordPress-iOS-Shared/WPTableViewSectionHeaderView.h> #import <WordPress-iOS-Shared/WordPressShared/WPTableViewSectionHeaderFooterView.h>
typedef enum { typedef enum {
PostSettingsSectionTaxonomy = 0, PostSettingsSectionTaxonomy = 0,
@@ -225,7 +225,7 @@ typedef enum {
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{ {
WPTableViewSectionHeaderView *header = [[WPTableViewSectionHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.view.bounds), 0.0f)]; WPTableViewSectionHeaderFooterView *header = [[WPTableViewSectionHeaderFooterView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.view.bounds), 0.0f)];
header.title = [self titleForHeaderInSection:section]; header.title = [self titleForHeaderInSection:section];
header.backgroundColor = self.tableView.backgroundColor; header.backgroundColor = self.tableView.backgroundColor;
return header; return header;

View File

@@ -1,8 +1,7 @@
#import "WPEditorToolbarView.h" #import "WPEditorToolbarView.h"
#import "WPDeviceIdentification.h"
#import "WPEditorToolbarButton.h" #import "WPEditorToolbarButton.h"
#import "ZSSBarButtonItem.h" #import "ZSSBarButtonItem.h"
#import <WordPress-iOS-Shared/WordPressShared/WPDeviceIdentification.h>
// life // life
#ifdef __OBJC__ #ifdef __OBJC__

View File

@@ -5,9 +5,9 @@
#import "WPEditorField.h" #import "WPEditorField.h"
#import "WPImageMeta.h" #import "WPImageMeta.h"
#import "ZSSTextView.h" #import "ZSSTextView.h"
#import "WPDeviceIdentification.h" #import <WordPress-iOS-Shared/WordPressShared/WPDeviceIdentification.h>
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
// life // life
#import "NSURLProtocolCustom.h" #import "NSURLProtocolCustom.h"

View File

@@ -3,11 +3,11 @@
#import <UIAlertView+Blocks/UIAlertView+Blocks.h> #import <UIAlertView+Blocks/UIAlertView+Blocks.h>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <WordPressCom-Analytics-iOS/WPAnalytics.h> #import <WordPressCom-Analytics-iOS/WPAnalytics.h>
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WordPress-iOS-Shared/WPTableViewCell.h> #import <WordPress-iOS-Shared/WordPressShared/WPTableViewCell.h>
#import <WordPress-iOS-Shared/UIImage+Util.h> #import <WordPress-iOS-Shared/WordPressShared/UIImage+Util.h>
#import <WordPress-iOS-Shared/UIColor+Helpers.h> #import <WordPress-iOS-Shared/WordPressShared/UIColor+Helpers.h>
#import "WPEditorField.h" #import "WPEditorField.h"
#import "WPEditorToolbarButton.h" #import "WPEditorToolbarButton.h"
@@ -19,7 +19,7 @@
#import "DRColorPicker.h" #import "DRColorPicker.h"
#import "DRColorPickerHomeViewController.h" #import "DRColorPickerHomeViewController.h"
#import "WPDeviceIdentification.h" #import <WordPress-iOS-Shared/WordPressShared/WPDeviceIdentification.h>
CGFloat const EPVCStandardOffset = 10.0; CGFloat const EPVCStandardOffset = 10.0;
NSInteger const WPImageAlertViewTag = 91; NSInteger const WPImageAlertViewTag = 91;

View File

@@ -2,9 +2,9 @@
#import "WPLegacyKeyboardToolbarBase.h" #import "WPLegacyKeyboardToolbarBase.h"
#import "WPLegacyKeyboardToolbarDone.h" #import "WPLegacyKeyboardToolbarDone.h"
#import <WordPressCom-Analytics-iOS/WPAnalytics.h> #import <WordPressCom-Analytics-iOS/WPAnalytics.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WordPress-iOS-Shared/WPTableViewCell.h> #import <WordPress-iOS-Shared/WordPressShared/WPTableViewCell.h>
#import <WordPress-iOS-Shared/UIImage+Util.h> #import <WordPress-iOS-Shared/WordPressShared/UIImage+Util.h>
#import <UIAlertView+Blocks/UIAlertView+Blocks.h> #import <UIAlertView+Blocks/UIAlertView+Blocks.h>
CGFloat const WPLegacyEPVCTextfieldHeight = 44.0f; CGFloat const WPLegacyEPVCTextfieldHeight = 44.0f;

View File

@@ -1,6 +1,6 @@
#import "WPLegacyKeyboardToolbarButtonItem.h" #import "WPLegacyKeyboardToolbarButtonItem.h"
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
@implementation WPLegacyKeyboardToolbarButtonItem @implementation WPLegacyKeyboardToolbarButtonItem
@synthesize actionTag, actionName; @synthesize actionTag, actionName;

View File

@@ -10,7 +10,7 @@
#import "MongoID.h" #import "MongoID.h"
#import "SVProgressHUD.h" #import "SVProgressHUD.h"
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
@implementation Common @implementation Common

View File

@@ -15,8 +15,8 @@
// https://github.com/iDay/WeixinActivity // https://github.com/iDay/WeixinActivity
#import "WeixinActivity.h" #import "WeixinActivity.h"
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import <WordPress-iOS-Shared/NSString+Util.h> #import <WordPress-iOS-Shared/WordPressShared/NSString+Util.h>
@class WPReaderDetailViewController; @class WPReaderDetailViewController;

View File

@@ -7,8 +7,8 @@
// //
#import "NoteCell.h" #import "NoteCell.h"
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
//#import "NotebookService.h" //#import "NotebookService.h"
#import "Leas.h" #import "Leas.h"

View File

@@ -7,8 +7,8 @@
// //
#import "NotebookTagCell.h" #import "NotebookTagCell.h"
#import <WordPress-iOS-Shared/WPFontManager.h> #import <WordPress-iOS-Shared/WordPressShared/WPFontManager.h>
#import <WordPress-iOS-Shared/WPStyleGuide.h> #import <WordPress-iOS-Shared/WordPressShared/WPStyleGuide.h>
#import "NotebookService.h" #import "NotebookService.h"
@interface NotebookTagCell() @interface NotebookTagCell()

View File

@@ -13,4 +13,4 @@ pod 'SWTableViewCell', '~> 0.3.7'
pod 'SGNavigationProgress' pod 'SGNavigationProgress'
pod "WPMediaPicker" pod 'QBImagePickerController', '< 3.0.0'

View File

@@ -1,66 +1,66 @@
PODS: PODS:
- AFNetworking (2.5.4): - AFNetworking (2.6.3):
- AFNetworking/NSURLConnection (= 2.5.4) - AFNetworking/NSURLConnection (= 2.6.3)
- AFNetworking/NSURLSession (= 2.5.4) - AFNetworking/NSURLSession (= 2.6.3)
- AFNetworking/Reachability (= 2.5.4) - AFNetworking/Reachability (= 2.6.3)
- AFNetworking/Security (= 2.5.4) - AFNetworking/Security (= 2.6.3)
- AFNetworking/Serialization (= 2.5.4) - AFNetworking/Serialization (= 2.6.3)
- AFNetworking/UIKit (= 2.5.4) - AFNetworking/UIKit (= 2.6.3)
- AFNetworking/NSURLConnection (2.5.4): - AFNetworking/NSURLConnection (2.6.3):
- AFNetworking/Reachability - AFNetworking/Reachability
- AFNetworking/Security - AFNetworking/Security
- AFNetworking/Serialization - AFNetworking/Serialization
- AFNetworking/NSURLSession (2.5.4): - AFNetworking/NSURLSession (2.6.3):
- AFNetworking/Reachability - AFNetworking/Reachability
- AFNetworking/Security - AFNetworking/Security
- AFNetworking/Serialization - AFNetworking/Serialization
- AFNetworking/Reachability (2.5.4) - AFNetworking/Reachability (2.6.3)
- AFNetworking/Security (2.5.4) - AFNetworking/Security (2.6.3)
- AFNetworking/Serialization (2.5.4) - AFNetworking/Serialization (2.6.3)
- AFNetworking/UIKit (2.5.4): - AFNetworking/UIKit (2.6.3):
- AFNetworking/NSURLConnection - AFNetworking/NSURLConnection
- AFNetworking/NSURLSession - AFNetworking/NSURLSession
- CocoaLumberjack (2.0.0): - CocoaLumberjack (2.2.0):
- CocoaLumberjack/Default (= 2.0.0) - CocoaLumberjack/Default (= 2.2.0)
- CocoaLumberjack/Extensions (= 2.0.0) - CocoaLumberjack/Extensions (= 2.2.0)
- CocoaLumberjack/Core (2.0.0) - CocoaLumberjack/Core (2.2.0)
- CocoaLumberjack/Default (2.0.0): - CocoaLumberjack/Default (2.2.0):
- CocoaLumberjack/Core - CocoaLumberjack/Core
- CocoaLumberjack/Extensions (2.0.0): - CocoaLumberjack/Extensions (2.2.0):
- CocoaLumberjack/Default - CocoaLumberjack/Default
- CTAssetsPickerController (2.9.4) - CTAssetsPickerController (2.9.5)
- NSObject-SafeExpectations (0.0.2) - NSObject-SafeExpectations (0.0.2)
- QBImagePickerController (2.6.0)
- SGNavigationProgress (1.2) - SGNavigationProgress (1.2)
- SWTableViewCell (0.3.7) - SWTableViewCell (0.3.7)
- UIAlertView+Blocks (0.8.1) - UIAlertView+Blocks (0.8.1)
- WordPress-iOS-Shared (0.3.2): - WordPress-iOS-Shared (0.5.2):
- AFNetworking (~> 2.5) - AFNetworking (~> 2.5)
- CocoaLumberjack (~> 2.0) - CocoaLumberjack (~> 2.2.0)
- WordPressCom-Analytics-iOS (0.0.32) - WordPressCom-Analytics-iOS (0.0.41)
- WPMediaPicker (0.5.0)
DEPENDENCIES: DEPENDENCIES:
- AFNetworking - AFNetworking
- CocoaLumberjack (~> 2.0) - CocoaLumberjack (~> 2.0)
- CTAssetsPickerController (~> 2.9.0) - CTAssetsPickerController (~> 2.9.0)
- NSObject-SafeExpectations - NSObject-SafeExpectations
- QBImagePickerController (< 3.0.0)
- SGNavigationProgress - SGNavigationProgress
- SWTableViewCell (~> 0.3.7) - SWTableViewCell (~> 0.3.7)
- UIAlertView+Blocks (~> 0.8.1) - UIAlertView+Blocks (~> 0.8.1)
- WordPress-iOS-Shared (~> 0.3) - WordPress-iOS-Shared (~> 0.3)
- WordPressCom-Analytics-iOS (~> 0.0.4) - WordPressCom-Analytics-iOS (~> 0.0.4)
- WPMediaPicker
SPEC CHECKSUMS: SPEC CHECKSUMS:
AFNetworking: 05edc0ac4c4c8cf57bcf4b84be5b0744b6d8e71e AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60
CocoaLumberjack: a6f77d987d65dc7ba86b0f84db7d0b9084f77bcb CocoaLumberjack: 17fe8581f84914d5d7e6360f7c70022b173c3ae0
CTAssetsPickerController: 3030dc60f5d1a3c4e5b1c0aa9f069220d5bf7008 CTAssetsPickerController: b413fece2194ae3dbf22fbc544cf6f2a6d516a4d
NSObject-SafeExpectations: 7d7f48df90df4e11da7cfe86b64f45eff7a7f521 NSObject-SafeExpectations: 7d7f48df90df4e11da7cfe86b64f45eff7a7f521
QBImagePickerController: 095c2b2973de4da267334d2cfcac989c2eb5cdc2
SGNavigationProgress: f04e3bd0058c53e1172ee020b5239f22aa9e4a0f SGNavigationProgress: f04e3bd0058c53e1172ee020b5239f22aa9e4a0f
SWTableViewCell: 2a94aadc9d47b2b611fa064566bf57948b95b579 SWTableViewCell: 2a94aadc9d47b2b611fa064566bf57948b95b579
UIAlertView+Blocks: 45c3d3b7194906702d3e9a14c7ece5581505646d UIAlertView+Blocks: 45c3d3b7194906702d3e9a14c7ece5581505646d
WordPress-iOS-Shared: bd0506db9b824611246f35e774832ecbc18fc45e WordPress-iOS-Shared: af84c229bd1cb0206f6015fd8fec9e262a88c780
WordPressCom-Analytics-iOS: cfa514e1c2ded6256bf2864d871e0866e38cc668 WordPressCom-Analytics-iOS: 73de8c9a0f1a43bac03fd2fcd881389be73ee820
WPMediaPicker: 0757988f1519c20b92c91f470c41633ac42e3a0e
COCOAPODS: 0.35.0 COCOAPODS: 0.39.0