Skip to content

Commit

Permalink
Merge branch 'master' of github.com:likeapp/like-ios
Browse files Browse the repository at this point in the history
  • Loading branch information
黄伟锋 committed Sep 15, 2015
2 parents b8efc11 + a33db17 commit 5d1f062
Show file tree
Hide file tree
Showing 13 changed files with 272 additions and 67 deletions.
6 changes: 6 additions & 0 deletions LIKE/LIKE.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@
13B5B4F61B1710AE00252A78 /* LKTagCommentCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B5B4F51B1710AE00252A78 /* LKTagCommentCell.m */; };
13B6C1961AE8E8EA008912C0 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 13B6C1951AE8E8EA008912C0 /* [email protected] */; };
13B6C1991AE8EA9F008912C0 /* LKUserDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B6C1981AE8EA9F008912C0 /* LKUserDefaults.m */; };
13BB8DB51BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BB8DB41BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m */; };
13BCA65E1B5CB28F00DC0549 /* LKPresentAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCA65D1B5CB28F00DC0549 /* LKPresentAnimation.m */; };
13BCA6611B5CCC7600DC0549 /* LKHomeHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCA6601B5CCC7600DC0549 /* LKHomeHeader.m */; };
13BCA6641B5CDCF200DC0549 /* LCBlurSearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCA6631B5CDCF200DC0549 /* LCBlurSearchBar.m */; };
Expand Down Expand Up @@ -1956,6 +1957,8 @@
13B6C1951AE8E8EA008912C0 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
13B6C1971AE8EA9F008912C0 /* LKUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LKUserDefaults.h; sourceTree = "<group>"; };
13B6C1981AE8EA9F008912C0 /* LKUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LKUserDefaults.m; sourceTree = "<group>"; };
13BB8DB31BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+UIActivityIndicatorForSDWebImage.h"; sourceTree = "<group>"; };
13BB8DB41BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+UIActivityIndicatorForSDWebImage.m"; sourceTree = "<group>"; };
13BCA65C1B5CB28F00DC0549 /* LKPresentAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LKPresentAnimation.h; sourceTree = "<group>"; };
13BCA65D1B5CB28F00DC0549 /* LKPresentAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LKPresentAnimation.m; sourceTree = "<group>"; };
13BCA65F1B5CCC7600DC0549 /* LKHomeHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LKHomeHeader.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3387,6 +3390,8 @@
138EDD381AD7B0A30020957C /* Extension */ = {
isa = PBXGroup;
children = (
13BB8DB31BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.h */,
13BB8DB41BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m */,
138EDD391AD7B0A30020957C /* NSArray+LCExtension.h */,
138EDD3A1AD7B0A30020957C /* NSArray+LCExtension.m */,
138EDD3B1AD7B0A30020957C /* NSData+LCExtension.h */,
Expand Down Expand Up @@ -5692,6 +5697,7 @@
1377F04D1B5E35D8008E21BC /* WMLArrayDiffUtility.m in Sources */,
13BCD8911ADBA92200A0CBF5 /* POPBasicAnimation.mm in Sources */,
138EDE9F1AD7B0A30020957C /* UIView+LCGestureRecognizer.m in Sources */,
13BB8DB51BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m in Sources */,
13E1A4EA1AE65FE300E24C3C /* FastttFocus.m in Sources */,
138EDE261AD7B0A30020957C /* LCProcessInfo.m in Sources */,
1390550D1B994A6D00DBF34A /* GPUImageLevelsFilter.m in Sources */,
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "LIKE/LKApplication/Application/UserCenter/LKUserCenterViewController.m"
timestampString = "463642706.366868"
filePath = "LIKE/LKApplication/Model/LKFileUploader.m"
timestampString = "463996824.769848"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "118"
endingLineNumber = "118"
landmarkName = "-initWithUser:"
startingLineNumber = "123"
endingLineNumber = "123"
landmarkName = "-realUploadAvatarImage:suffix:completeBlock:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
Expand Down
65 changes: 33 additions & 32 deletions LIKE/LIKE/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ -(void) load:(NSDictionary *)launchOptions

self.launchOptions = launchOptions;

self.home = [LKHomeViewController viewController];


// 1.设置缓存
NSURLCache *cache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
[NSURLCache setSharedURLCache:cache];
Expand Down Expand Up @@ -91,23 +94,6 @@ -(void) load:(NSDictionary *)launchOptions

// Mob短信验证
[SMS_SDK registerApp:@"81edd3d46294" withSecret:@"91a6694191e296937995cd3f66f5e9ca"];


// 会话错误通知
[self observeNotification:LKSessionError];
// 应用程序远程登录通知
// [self observeNotification:LCUIApplicationDidRegisterRemoteNotification];
[self observeNotification:kJPFNetworkDidRegisterNotification];

// 应用程序远程登录失败通知
// [self observeNotification:LCUIApplicationDidRegisterRemoteFailNotification];

// 应用程序接收到远程通知
// [self observeNotification:LCUIApplicationDidReceiveRemoteNotification];
[self observeNotification:kJPFNetworkDidReceiveMessageNotification];


self.home = [LKHomeViewController viewController];


// 极光推送
Expand All @@ -134,6 +120,21 @@ -(void) load:(NSDictionary *)launchOptions
}

[APService setupWithOption:launchOptions];


// 会话错误通知
[self observeNotification:LKSessionError];
// 应用程序远程登录通知
// [self observeNotification:LCUIApplicationDidRegisterRemoteNotification];
[self observeNotification:kJPFNetworkDidRegisterNotification];

// 应用程序远程登录失败通知
// [self observeNotification:LCUIApplicationDidRegisterRemoteFailNotification];

// 应用程序接收到远程通知
// [self observeNotification:LCUIApplicationDidReceiveRemoteNotification];
[self observeNotification:kJPFNetworkDidReceiveMessageNotification];


if (LKLocalUser.singleton.isLogin) {

Expand All @@ -144,23 +145,8 @@ -(void) load:(NSDictionary *)launchOptions
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];


// 判断是否为推送打开
if (LKLocalUser.singleton.isLogin && launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {

[self.home performSelector:@selector(notificationAction) withObject:nil afterDelay:0.5];

}


// tabbarCtrl只放了一个主页控制器
self.tabBarController = [[LKTabBarController alloc] initWithViewControllers:@[LC_UINAVIGATION(self.home)]];

self.window.rootViewController = self.tabBarController;


if (!LKLocalUser.singleton.isLogin) {


LCUIImageView * imageView = LCUIImageView.view;
imageView.image = [LKWelcome image];
imageView.viewFrameWidth = LC_DEVICE_WIDTH;
Expand Down Expand Up @@ -199,6 +185,21 @@ -(void) load:(NSDictionary *)launchOptions
[UIApplication sharedApplication].keyWindow.ADD(chooseView);
}
}


NSDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
// 判断是否为推送打开
if(userInfo && LKLocalUser.singleton.isLogin)
{
//点击推送进来后
self.window.rootViewController = self.home;
// [self.home performSelector:@selector(notificationAction) withObject:nil afterDelay:2];
return;
}

// tabbarCtrl只放了一个主页控制器
self.tabBarController = [[LKTabBarController alloc] initWithViewControllers:@[LC_UINAVIGATION(self.home)]];
self.window.rootViewController = self.tabBarController;

// // welcom...
// [LKWelcome welcome];
Expand Down
2 changes: 1 addition & 1 deletion LIKE/LIKE/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.2.8</string>
<string>1.1.2.10</string>
<key>FacebookAppID</key>
<string>368579790017819</string>
<key>FacebookDisplayName</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// UIImageView+UIActivityIndicatorForSDWebImage.h
// UIActivityIndicator for SDWebImage
//
// Created by Giacomo Saccardo.
// Copyright (c) 2014 Giacomo Saccardo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "UIImageView+WebCache.h"
#import "SDImageCache.h"

@interface UIImageView (UIActivityIndicatorForSDWebImage)

@property (nonatomic, strong) UIActivityIndicatorView *activityIndicator;

- (void)setImageWithURL:(NSURL *)url usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;
- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle;

- (void)removeActivityIndicator;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
//
// UIImageView+UIActivityIndicatorForSDWebImage.m
// UIActivityIndicator for SDWebImage
//
// Created by Giacomo Saccardo.
// Copyright (c) 2014 Giacomo Saccardo. All rights reserved.
//

#import "UIImageView+UIActivityIndicatorForSDWebImage.h"
#import <objc/runtime.h>
#import "M13ProgressViewRing.h"

static char TAG_ACTIVITY_INDICATOR;

@interface UIImageView (Private)

-(void)addActivityIndicatorWithStyle:(UIActivityIndicatorViewStyle) activityStyle;

@end

@implementation UIImageView (UIActivityIndicatorForSDWebImage)

@dynamic activityIndicator;

- (UIActivityIndicatorView *)activityIndicator {
return (UIActivityIndicatorView *)objc_getAssociatedObject(self, &TAG_ACTIVITY_INDICATOR);
}

- (void)setActivityIndicator:(UIActivityIndicatorView *)activityIndicator {
objc_setAssociatedObject(self, &TAG_ACTIVITY_INDICATOR, activityIndicator, OBJC_ASSOCIATION_RETAIN);
}

- (void)addActivityIndicatorWithStyle:(UIActivityIndicatorViewStyle)activityStyle {

if (!self.activityIndicator) {
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:activityStyle];

self.activityIndicator.autoresizingMask = UIViewAutoresizingNone;

[self updateActivityIndicatorFrame];

dispatch_async(dispatch_get_main_queue(), ^(void) {
[self addSubview:self.activityIndicator];
});
}

dispatch_async(dispatch_get_main_queue(), ^(void) {
[self.activityIndicator startAnimating];
});

}

-(void)updateActivityIndicatorFrame {
if (self.activityIndicator) {
CGRect activityIndicatorBounds = self.activityIndicator.bounds;
float x = (self.frame.size.width - activityIndicatorBounds.size.width) / 2.0;
float y = (self.frame.size.height - activityIndicatorBounds.size.height) / 2.0;
self.activityIndicator.frame = CGRectMake(x, y, activityIndicatorBounds.size.width, activityIndicatorBounds.size.height);
}
}

- (void)removeActivityIndicator {
if (self.activityIndicator) {
[self.activityIndicator removeFromSuperview];
self.activityIndicator = nil;
}
}

-(void)layoutSubviews {
[super layoutSubviews];

[self updateActivityIndicatorFrame];
}

#pragma mark - Methods

- (void)setImageWithURL:(NSURL *)url usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle {
[self setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil usingActivityIndicatorStyle:activityStyle];
}

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStye {
[self setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil usingActivityIndicatorStyle:activityStye];
}

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle{
[self setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil usingActivityIndicatorStyle:activityStyle];
}

- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle {
[self setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock usingActivityIndicatorStyle:activityStyle];
}

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle {
[self setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock usingActivityIndicatorStyle:activityStyle];
}

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle {
[self setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock usingActivityIndicatorStyle:activityStyle];
}

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle {

// [self addActivityIndicatorWithStyle:activityStyle];
M13ProgressViewRing *ring = [[M13ProgressViewRing alloc] init];
ring.showPercentage = NO;
ring.primaryColor = LKColor.color;
ring.secondaryColor = LKColor.color;

ring.viewFrameWidth = 50;
ring.viewFrameHeight = 50;
ring.viewFrameX = (self.viewFrameWidth - ring.viewFrameWidth) * 0.5;
ring.viewFrameY = (self.viewFrameHeight - ring.viewFrameHeight) * 0.5;

__weak typeof(self) weakSelf = self;
[self sd_setImageWithURL:url
placeholderImage:placeholder
options:options
progress:^(NSInteger receivedSize, NSInteger expectedSize) {

if (progressBlock) {

[ring setProgress:receivedSize * 1.0 / expectedSize animated:YES];
if (ring) {
[ring removeFromSuperview];
}
[weakSelf addSubview:ring];
}
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageUrl) {
if (completedBlock) {
completedBlock(image, error, cacheType, imageUrl);
}
[weakSelf removeActivityIndicator];
[ring removeFromSuperview];
}
];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,14 @@ -(void) photos
// 从相册中选择图片的完成回调
picker.finalizationBlock = ^(id _picker, NSDictionary * imageInfo){

UIImage *sourceImage = imageInfo[@"UIImagePickerControllerOriginalImage"];

if (sourceImage == nil || sourceImage.size.width == CGSizeZero.width || sourceImage.size.height == CGSizeZero.height) {
return;
}

// 滤镜控制器
LKImageCropperViewController * cropper = [[LKImageCropperViewController alloc] initWithImage:imageInfo[@"UIImagePickerControllerOriginalImage"]];
LKImageCropperViewController * cropper = [[LKImageCropperViewController alloc] initWithImage:sourceImage];

[cropper showBackButton];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,18 @@ -(void) buildUI



NSArray * filterNames = LKFilterManager.singleton.allFilterNames;
NSArray *filterImages = LKFilterManager.singleton.allFilterImage;
NSArray *filterNames = LKFilterManager.singleton.allFilterNames;

// filters...
LKFilterScrollView * filterScrollView = LKFilterScrollView.view;
filterScrollView.viewFrameWidth = self.view.viewFrameWidth;

[filterScrollView addFilterName:LC_LO(@"默认") filterImage:[UIImage imageNamed:@"FilterPreview.jpg" useCache:YES]];

for (NSInteger i = 1; i< filterNames.count ; i++) {
for (NSInteger i = 1; i<= filterImages.count ; i++) {

FastttFilter * fastFilter = [FastttFilter filterWithLookupImage:LKFilterManager.singleton.allFilterImage[i - 1]];
FastttFilter *fastFilter = [FastttFilter filterWithLookupImage:LKFilterManager.singleton.allFilterImage[i - 1]];

UIImage * image = [fastFilter.filter imageByFilteringImage:[UIImage imageNamed:@"FilterPreview.jpg" useCache:YES]];

Expand Down Expand Up @@ -476,23 +477,26 @@ - (void)switchFilterAtIndex:(NSInteger)index
return;
}

if (self.filterIndex == index - 2) {
NSArray *filterNames = LKFilterManager.singleton.allFilterNames;

if (self.filterIndex == filterNames.count - 2) {

self.wastedView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Wasted2" useCache:YES]];
self.wastedView.viewFrameX = 0;
self.wastedView.viewFrameWidth = self.fastCamera.view.viewFrameWidth;
self.wastedView.viewFrameY = (self.fastCamera.view.viewFrameHeight - self.wastedView.viewFrameHeight) * 0.5;
self.fastCamera.view.ADD(self.wastedView);
}

if (self.filterIndex == index - 1) {
if (self.filterIndex == filterNames.count - 1) {

self.gtaView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Gta-driving.png" useCache:YES]];
self.gtaView1.viewFrameX = 10;
self.gtaView1.viewFrameY = self.fastCamera.view.viewFrameHeight - self.gtaView1.viewFrameHeight - 10;
self.fastCamera.view.ADD(self.gtaView1);
}

if (self.filterIndex == index) {
if (self.filterIndex == filterNames.count) {

self.gtaView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Gta-walking.png" useCache:YES]];
self.gtaView2.viewFrameX = 10;
Expand Down
Loading

0 comments on commit 5d1f062

Please sign in to comment.