Skip to content

Commit

Permalink
DONATE
Browse files Browse the repository at this point in the history
  • Loading branch information
tbl00c committed Sep 29, 2016
1 parent 2b7936a commit 0bb3250
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
1. 聊天界面:视频消息
2. 聊天界面:地理位置消息
3. 好友圈:CoreText实现好友点赞、回复功能
4. 聊天界面:表情键盘优化,以支持表情列数随机性动态配置、表情包滑动切换
4. 聊天模块抽离

## 项目主要使用的第三方库
* [Masonry](https://github.com/SnapKit/Masonry):自动布局框架,简洁高效
Expand Down
14 changes: 14 additions & 0 deletions TLChat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
C2028D391C8D354E0060E271 /* TLSearchController.m in Sources */ = {isa = PBXBuildFile; fileRef = C2028D381C8D354E0060E271 /* TLSearchController.m */; };
C2028D3C1C8D3ACE0060E271 /* TLPublicServerSearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C2028D3B1C8D3ACE0060E271 /* TLPublicServerSearchViewController.m */; };
C2045D011D9BB49600806BAB /* TLEmojiGroupDisplayView+Gesture.m in Sources */ = {isa = PBXBuildFile; fileRef = C2045D001D9BB49600806BAB /* TLEmojiGroupDisplayView+Gesture.m */; };
C2045D051D9BF63000806BAB /* TLWalletViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C2045D041D9BF63000806BAB /* TLWalletViewController.m */; };
C20829171C88113600034998 /* TLImagePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = C20829161C88113600034998 /* TLImagePickerController.m */; };
C20907451C97ED0700AB87A5 /* JSPatch.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C20907441C97ED0700AB87A5 /* JSPatch.framework */; };
C209074B1C97ED7300AB87A5 /* FaceEmoji.json in Resources */ = {isa = PBXBuildFile; fileRef = C20907471C97ED7300AB87A5 /* FaceEmoji.json */; };
Expand Down Expand Up @@ -335,6 +336,8 @@
C2028D3B1C8D3ACE0060E271 /* TLPublicServerSearchViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLPublicServerSearchViewController.m; sourceTree = "<group>"; };
C2045CFF1D9BB49600806BAB /* TLEmojiGroupDisplayView+Gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TLEmojiGroupDisplayView+Gesture.h"; sourceTree = "<group>"; };
C2045D001D9BB49600806BAB /* TLEmojiGroupDisplayView+Gesture.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TLEmojiGroupDisplayView+Gesture.m"; sourceTree = "<group>"; };
C2045D031D9BF63000806BAB /* TLWalletViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLWalletViewController.h; sourceTree = "<group>"; };
C2045D041D9BF63000806BAB /* TLWalletViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLWalletViewController.m; sourceTree = "<group>"; };
C20829151C88113600034998 /* TLImagePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLImagePickerController.h; sourceTree = "<group>"; };
C20829161C88113600034998 /* TLImagePickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLImagePickerController.m; sourceTree = "<group>"; };
C20907441C97ED0700AB87A5 /* JSPatch.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JSPatch.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1022,6 +1025,15 @@
path = TLSearchController;
sourceTree = "<group>";
};
C2045D021D9BF61900806BAB /* WalletViewController */ = {
isa = PBXGroup;
children = (
C2045D031D9BF63000806BAB /* TLWalletViewController.h */,
C2045D041D9BF63000806BAB /* TLWalletViewController.m */,
);
path = WalletViewController;
sourceTree = "<group>";
};
C20829141C88111100034998 /* TLImagePicker */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1489,6 +1501,7 @@
children = (
C2D500D11C55C9350088997C /* MineViewController */,
C2AF1F901C6B209500617D98 /* MineInfoViewController */,
C2045D021D9BF61900806BAB /* WalletViewController */,
C2F0EBF91C7A11230090843C /* ExpressionViewController */,
);
path = Mine;
Expand Down Expand Up @@ -3379,6 +3392,7 @@
C2B9730F1C6A52F0004B9B71 /* TLPrivacySettingHelper.m in Sources */,
C2CF4C851C804BF90054637A /* TLSettingItem.m in Sources */,
C2CF4C8B1C804BFE0054637A /* TLSettingFooterTitleView.m in Sources */,
C2045D051D9BF63000806BAB /* TLWalletViewController.m in Sources */,
C209F4381C7D5AAA001B9825 /* TLScannerViewController.m in Sources */,
C2BD59DA1C9DB8E600401524 /* TLDBConversationStore.m in Sources */,
C28CA6231C9D905600CD6A73 /* UIImage+Size.m in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion TLChat/Business/Other/TLAddMenuHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ - (TLAddMenuItem *)p_getMenuItemByType:(TLAddMneuType)type
return [TLAddMenuItem createWithType:TLAddMneuTypeAddFriend title:@"添加朋友" iconPath:@"nav_menu_addfriend" className:@"TLAddFriendViewController"];
break;
case TLAddMneuTypeWallet: // 收付款
return [TLAddMenuItem createWithType:TLAddMneuTypeWallet title:@"收付款" iconPath:@"nav_menu_wallet" className:@""];
return [TLAddMenuItem createWithType:TLAddMneuTypeWallet title:@"收付款" iconPath:@"nav_menu_wallet" className:@"TLWalletViewController"];
break;
case TLAddMneuTypeScan: // 扫一扫
return [TLAddMenuItem createWithType:TLAddMneuTypeScan title:@"扫一扫" iconPath:@"nav_menu_scan" className:@"TLScanningViewController"];
Expand Down
12 changes: 6 additions & 6 deletions TLChat/Common/TLSettingViewController/TLSettingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}

//MARK: UITableViewDelegate
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
TLSettingGroup *group = self.data[section];
if (group.headerTitle == nil) {
Expand All @@ -95,7 +95,7 @@ - (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSIntege
return view;
}

- (UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
TLSettingGroup *group = self.data[section];
if (group.footerTitle == nil) {
Expand All @@ -106,23 +106,23 @@ - (UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSIntege
return view;
}

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return HEIGHT_SETTING_CELL;
}

- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
TLSettingGroup *group = self.data[section];
return 0.5 + (group.headerTitle == nil ? 0 : 5.0f + group.headerHeight);
}

- (CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
TLSettingGroup *group = self.data[section];
return 20.0f + (group.footerTitle == nil ? 0 : 5.0f + group.footerHeight);
Expand Down
2 changes: 2 additions & 0 deletions TLChat/Config/TLEventStatistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@

#define EVENT_GET_CONTACTS @"e_get_contacts"
#define EVENT_DELETE_MESSAGE @"e_delete_message"
#define EVENT_WALLET_DONATE @"e_wallet_donate"
#define EVENT_WALLET_QR_SAVE @"e_wallet_qr_save"

#endif /* TLStatistics_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "wallet_9_9.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion TLChat/SRC/Mine/MineViewController/TLMineViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#import "TLMineHelper.h"

#import "TLMineInfoViewController.h"
#import "TLWalletViewController.h"
#import "TLExpressionViewController.h"
#import "TLMineSettingViewController.h"

Expand Down Expand Up @@ -68,7 +69,13 @@ - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
return;
}
TLMenuItem *item = [self.data[indexPath.section] objectAtIndex:indexPath.row];
if ([item.title isEqualToString:@"表情"]) {
if ([item.title isEqualToString:@"钱包"]) {
TLWalletViewController *walletVC = [[TLWalletViewController alloc] init];
[self setHidesBottomBarWhenPushed:YES];
[self.navigationController pushViewController:walletVC animated:YES];
[self setHidesBottomBarWhenPushed:NO];
}
else if ([item.title isEqualToString:@"表情"]) {
TLExpressionViewController *expressionVC = [[TLExpressionViewController alloc] init];
[self setHidesBottomBarWhenPushed:YES];
[self.navigationController pushViewController:expressionVC animated:YES];
Expand Down
13 changes: 13 additions & 0 deletions TLChat/SRC/Mine/WalletViewController/TLWalletViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// TLWalletViewController.h
// TLChat
//
// Created by 李伯坤 on 16/9/28.
// Copyright © 2016年 李伯坤. All rights reserved.
//

#import "TLViewController.h"

@interface TLWalletViewController : TLViewController

@end
115 changes: 115 additions & 0 deletions TLChat/SRC/Mine/WalletViewController/TLWalletViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
//
// TLWalletViewController.m
// TLChat
//
// Created by 李伯坤 on 16/9/28.
// Copyright © 2016年 李伯坤. All rights reserved.
//

#import "TLWalletViewController.h"

@interface TLWalletViewController () <TLActionSheetDelegate>

@property (nonatomic, strong) UILabel *label;

@property (nonatomic, strong) UIImageView *imageView;

@end

@implementation TLWalletViewController

- (void)loadView
{
[super loadView];
[self setTitle:@"钱包"];

UIScrollView *scrollView = [[UIScrollView alloc] init];
[scrollView setContentSize:CGSizeMake(WIDTH_SCREEN, HEIGHT_SCREEN - HEIGHT_NAVBAR - HEIGHT_STATUSBAR + 0.5)];
[self.view addSubview:scrollView];
[scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];

self.label = ({
UILabel *label = [[UILabel alloc] init];
[label setTextColor:[UIColor grayColor]];
[label setFont:[UIFont systemFontOfSize:15]];
[label setNumberOfLines:0];
label;
});
[scrollView addSubview:self.label];
[self.label mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(20);
make.centerX.mas_equalTo(0);
make.width.mas_lessThanOrEqualTo(self.view).mas_offset(-30);
}];

self.imageView = ({
UIImageView *imageView = [[UIImageView alloc] init];
[imageView setUserInteractionEnabled:YES];
UILongPressGestureRecognizer *longPressGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressQRCodeImage:)];
[imageView addGestureRecognizer:longPressGR];
imageView;
});
[scrollView addSubview:self.imageView];
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.label.mas_bottom).mas_offset(30);
make.centerX.mas_equalTo(0);
make.size.mas_equalTo(CGSizeMake(375 * 0.7, 422 * 0.7));
}];

UILabel *infoLabel = ({
UILabel *label = [[UILabel alloc] init];
[label setTextColor:[UIColor grayColor]];
[label setFont:[UIFont systemFontOfSize:14]];
[label setText:@"(长按保存)"];
label;
});
[scrollView addSubview:infoLabel];
[infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.imageView.mas_bottom).mas_offset(10);
make.centerX.mas_equalTo(0);
}];
}

- (void)viewDidLoad
{
[super viewDidLoad];
[MobClick event:EVENT_WALLET_DONATE];
[self.label setText:@"如果此份源码对您有足够大帮助,您可以小额赞助我,已激励我继续维护,做得更好。"];
[self.imageView setImage:[UIImage imageNamed:@"wallet_9_9"]];
}

#pragma mark - # Delegate
//MARK: TLActionSheetDelegate
- (void)actionSheet:(TLActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0) {
UIImage *image = self.imageView.image;
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
}
}

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
if (error) {
[UIAlertView bk_alertViewWithTitle:@"保存失败" message:[NSString stringWithFormat:@"%@", [error description]]];
}
else {
[UIAlertView bk_showAlertViewWithTitle:@"保存成功" message:@"谢谢" cancelButtonTitle:@"确定" otherButtonTitles:nil handler:^(UIAlertView *alertView, NSInteger buttonIndex) {
[MobClick event:EVENT_WALLET_QR_SAVE];
}];
}
}


#pragma mark - # Event Response
- (void)longPressQRCodeImage:(UILongPressGestureRecognizer *)sender
{
if (sender.state == UIGestureRecognizerStateBegan) {
TLActionSheet *actionSheet = [[TLActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"保存二维码到相册" otherButtonTitles:nil];
[actionSheet show];
}
}

@end

0 comments on commit 0bb3250

Please sign in to comment.