Skip to content

Commit 4cebcc3

Browse files
committed
保存冒泡草稿
1 parent d2c09be commit 4cebcc3

10 files changed

Lines changed: 362 additions & 262 deletions

File tree

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
4EC5AD921A258DF8006FA97C /* icon_file_cell_delete@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC5AD8F1A258DF8006FA97C /* icon_file_cell_delete@2x.png */; };
174174
4EC5AD931A258DF8006FA97C /* icon_file_cell_move@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC5AD901A258DF8006FA97C /* icon_file_cell_move@2x.png */; };
175175
4EC5AD941A258DF8006FA97C /* icon_file_cell_rename@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC5AD911A258DF8006FA97C /* icon_file_cell_rename@2x.png */; };
176+
4ECD72EF1AAD7EC300D69AE1 /* Tweet.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ECD72EE1AAD7EC300D69AE1 /* Tweet.m */; };
176177
4ECE8AD71A3943E80021E29C /* DownMenuCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ECE8AB21A3943E80021E29C /* DownMenuCell.m */; };
177178
4ECE8AD81A3943E80021E29C /* UIDownMenuButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ECE8AB41A3943E80021E29C /* UIDownMenuButton.m */; };
178179
4ECE8AD91A3943E80021E29C /* UIViewController+DownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ECE8AB61A3943E80021E29C /* UIViewController+DownMenu.m */; };
@@ -806,6 +807,8 @@
806807
4EC5AD8F1A258DF8006FA97C /* icon_file_cell_delete@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_file_cell_delete@2x.png"; sourceTree = "<group>"; };
807808
4EC5AD901A258DF8006FA97C /* icon_file_cell_move@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_file_cell_move@2x.png"; sourceTree = "<group>"; };
808809
4EC5AD911A258DF8006FA97C /* icon_file_cell_rename@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_file_cell_rename@2x.png"; sourceTree = "<group>"; };
810+
4ECD72ED1AAD7EC300D69AE1 /* Tweet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tweet.h; sourceTree = "<group>"; };
811+
4ECD72EE1AAD7EC300D69AE1 /* Tweet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tweet.m; sourceTree = "<group>"; };
809812
4ECE8AB11A3943E80021E29C /* DownMenuCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownMenuCell.h; sourceTree = "<group>"; };
810813
4ECE8AB21A3943E80021E29C /* DownMenuCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DownMenuCell.m; sourceTree = "<group>"; };
811814
4ECE8AB31A3943E80021E29C /* UIDownMenuButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDownMenuButton.h; sourceTree = "<group>"; };
@@ -2518,6 +2521,8 @@
25182521
8EA6CFF119E240C40076D59C /* Tasks.m */,
25192522
8EA6CFF219E240C40076D59C /* Tweets.h */,
25202523
8EA6CFF319E240C40076D59C /* Tweets.m */,
2524+
4ECD72ED1AAD7EC300D69AE1 /* Tweet.h */,
2525+
4ECD72EE1AAD7EC300D69AE1 /* Tweet.m */,
25212526
8EA6CFF619E240C40076D59C /* User.h */,
25222527
8EA6CFF719E240C40076D59C /* User.m */,
25232528
8EA6CFF819E240C40076D59C /* Users.h */,
@@ -3213,6 +3218,7 @@
32133218
4ED673221A8E0ECC00DF2D1A /* SVWebViewControllerActivityReport.m in Sources */,
32143219
4E6BA2E41A1EE6AF005FD721 /* UIButton+AFNetworking.m in Sources */,
32153220
8EF643C919FF7E2900F7EEB0 /* TopicCommentCell.m in Sources */,
3221+
4ECD72EF1AAD7EC300D69AE1 /* Tweet.m in Sources */,
32163222
8EF643CD19FF7E2900F7EEB0 /* TweetCommentMoreCell.m in Sources */,
32173223
8E59F1001A01133C009A905F /* CodeTree.m in Sources */,
32183224
8EF643BA19FF7E2900F7EEB0 /* MemberCell.m in Sources */,

Coding_iOS/AppDelegate.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#import "EaseStartView.h"
2525
#import "BaseNavigationController.h"
2626

27+
#import "Tweet.h"
28+
2729
@implementation AppDelegate
2830

2931
@synthesize managedObjectContext = _managedObjectContext;
@@ -121,13 +123,14 @@ - (void)applicationWillResignActive:(UIApplication *)application
121123
{
122124
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
123125
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
126+
[[ImageSizeManager shareManager] save];
127+
[[Tweet tweetForSend] saveSendData];
124128
}
125129

126130
- (void)applicationDidEnterBackground:(UIApplication *)application
127131
{
128132
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
129133
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
130-
[[ImageSizeManager shareManager] save];
131134
}
132135

133136
- (void)applicationWillEnterForeground:(UIApplication *)application
@@ -145,7 +148,6 @@ - (void)applicationWillTerminate:(UIApplication *)application
145148
{
146149
// Saves changes in the application's managed object context before the application terminates.
147150
[self saveContext];
148-
[[ImageSizeManager shareManager] save];
149151
}
150152
#pragma mark - Umeng Message
151153
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

Coding_iOS/Coding_iOS-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</dict>
3333
</array>
3434
<key>CFBundleVersion</key>
35-
<string>2.4.2015030517</string>
35+
<string>2.4.2015030918</string>
3636
<key>LSRequiresIPhoneOS</key>
3737
<true/>
3838
<key>UIFileSharingEnabled</key>

Coding_iOS/Controllers/TweetSendViewController.m

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,16 @@ - (void)cancelBtnClicked:(id)sender{
197197
[self dismissSelf];
198198
}else{
199199
__weak typeof(self) weakSelf = self;
200-
UIAlertView *alertView = [UIAlertView bk_alertViewWithTitle:@"提示" message:@"确定放弃此次冒泡?"];
201-
[alertView bk_setCancelButtonWithTitle:@"取消" handler:nil];
202-
[alertView bk_addButtonWithTitle:@"确定" handler:nil];
203-
[alertView bk_setDidDismissBlock:^(UIAlertView *alert, NSInteger index) {
204-
switch (index) {
205-
case 1:
206-
[weakSelf dismissSelf];
207-
break;
208-
default:
209-
break;
200+
[[UIActionSheet bk_actionSheetCustomWithTitle:@"是否保存草稿" buttonTitles:@[@"保存"] destructiveTitle:@"不保存" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
201+
if (index == 0) {
202+
[weakSelf.curTweet saveSendData];
203+
}else if (index == 1){
204+
[Tweet removeSendData];
205+
}else{
206+
return ;
210207
}
211-
}];
212-
[alertView show];
208+
[weakSelf dismissSelf];
209+
}] showInView:nil];
213210
}
214211
}
215212

Coding_iOS/Models/Tweet.h

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
//
2+
// Tweet.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/3/9.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import "Comment.h"
11+
#import "User.h"
12+
#import "HtmlMedia.h"
13+
14+
@interface Tweet : NSObject
15+
@property (readwrite, nonatomic, strong) NSString *content, *device;
16+
@property (readwrite, nonatomic, strong) NSNumber *liked, *activity_id, *id, *comments, *likes;
17+
@property (readwrite, nonatomic, strong) NSDate *created_at;
18+
@property (readwrite, nonatomic, strong) User *owner;
19+
@property (readwrite, nonatomic, strong) NSMutableArray *comment_list, *like_users;
20+
@property (readwrite, nonatomic, strong) NSDictionary *propertyArrayMap;
21+
@property (assign, nonatomic) BOOL canLoadMore, willLoadMore, isLoading;
22+
@property (readwrite, nonatomic, strong) HtmlMedia *htmlMedia;
23+
24+
@property (readwrite, nonatomic, strong) NSMutableArray *tweetImages;
25+
@property (readwrite, nonatomic, strong) NSString *tweetContent;
26+
@property (readwrite, nonatomic, strong) NSString *nextCommentStr;
27+
@property (assign, nonatomic) CGFloat contentHeight;
28+
29+
@property (strong, nonatomic) NSString *user_global_key, *pp_id;
30+
31+
- (NSInteger)numOfComments;
32+
- (BOOL)hasMoreComments;
33+
34+
- (NSInteger)numOfLikers;
35+
- (BOOL)hasMoreLikers;
36+
37+
38+
39+
- (NSString *)toDoLikePath;
40+
- (void)changeToLiked:(NSNumber *)liked;
41+
42+
- (NSString *)toDoCommentPath;
43+
- (NSDictionary *)toDoCommentParams;
44+
45+
- (NSString *)toLikersPath;
46+
- (NSDictionary *)toLikersParams;
47+
48+
- (NSString *)toCommentsPath;
49+
- (NSDictionary *)toCommentsParams;
50+
51+
- (NSString *)toDeletePath;
52+
- (NSString *)toDetailPath;
53+
54+
+(Tweet *)tweetForSend;
55+
56+
- (void)saveSendData;
57+
- (void)loadSendData;
58+
+ (void)removeSendData;
59+
60+
+(Tweet *)tweetWithGlobalKey:(NSString *)user_global_key andPPID:(NSString *)pp_id;
61+
- (NSDictionary *)toDoTweetParams;
62+
- (BOOL)isAllImagesHaveDone;
63+
- (void)addNewComment:(Comment *)comment;
64+
- (void)deleteComment:(Comment *)comment;
65+
@end
66+
67+
68+
typedef NS_ENUM(NSInteger, TweetImageUploadState)
69+
{
70+
TweetImageUploadStateInit = 0,
71+
TweetImageUploadStateIng,
72+
TweetImageUploadStateSuccess,
73+
TweetImageUploadStateFail
74+
};
75+
76+
@interface TweetImage : NSObject
77+
@property (readwrite, nonatomic, strong) UIImage *image;
78+
@property (assign, nonatomic) TweetImageUploadState uploadState;
79+
@property (readwrite, nonatomic, strong) NSString *imageStr;
80+
+ (instancetype)tweetImageWithImage:(UIImage *)image;
81+
@end

0 commit comments

Comments
 (0)