Skip to content

Commit 9e4d12a

Browse files
张达棣张达棣
authored andcommitted
# Conflicts: # Coding_iOS.xcodeproj/project.pbxproj # Coding_iOS/.DS_Store
2 parents 489ad3c + e6989ab commit 9e4d12a

69 files changed

Lines changed: 1559 additions & 1083 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 263 additions & 107 deletions
Large diffs are not rendered by default.

Coding_iOS/.DS_Store

0 Bytes
Binary file not shown.

Coding_iOS/AppDelegate.m

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@
2828
#import "PasswordViewController.h"
2929
#import "IntroductionViewController.h"
3030
#import "TweetSendViewController.h"
31+
#import "ProjectToChooseListViewController.h"
32+
#import "OTPListViewController.h"
3133

3234
#import "FunctionIntroManager.h"
3335
#import <UMengSocial/UMSocial.h>
3436
#import <UMengSocial/UMSocialWechatHandler.h>
3537
#import <UMengSocial/UMSocialQQHandler.h>
3638
#import <evernote-cloud-sdk-ios/ENSDK/ENSDK.h>
3739
#import "UMSocialSinaSSOHandler.h"
40+
#import "Coding_NetAPIManager.h"
41+
#import <EANetworkDiagno/EANetworkDiagno.h>
3842

3943
#import "Tweet.h"
4044
#import "sys/utsname.h"
@@ -63,15 +67,11 @@ - (void)registerPush{
6367

6468
#pragma mark UserAgent
6569
- (void)registerUserAgent{
66-
struct utsname systemInfo;
67-
uname(&systemInfo);
68-
NSString *deviceString = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
69-
NSString *userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey], (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey], deviceString, [[UIDevice currentDevice] systemVersion], ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)];
70+
NSString *userAgent = [NSString userAgentStr];
7071
NSDictionary *dictionary = @{@"UserAgent" : userAgent};//User-Agent
7172
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
7273
}
7374

74-
7575
#pragma lifeCycle
7676
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
7777
{
@@ -113,7 +113,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
113113
// [[RRFPSBar sharedInstance] setShowsAverage:YES];
114114
// [[RRFPSBar sharedInstance] setHidden:NO];
115115
#endif
116-
117116
return YES;
118117
}
119118

@@ -205,6 +204,10 @@ - (void)applicationDidBecomeActive:(UIApplication *)application
205204
#pragma clang diagnostic pop
206205
}
207206
}
207+
EADeviceToServerLog *eaM = [EADeviceToServerLog shareManager];
208+
eaM.globalKey = [Login curLoginUser].global_key;
209+
eaM.userAgentStr = [NSString userAgentStr];
210+
[eaM tryToStart];
208211
}
209212

210213
- (void)applicationWillTerminate:(UIApplication *)application
@@ -423,4 +426,34 @@ - (NSURL *)applicationDocumentsDirectory
423426
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
424427
}
425428

429+
#pragma mark 3D Touch
430+
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler{
431+
if ([shortcutItem.type isEqualToString:@"shortcut_2FA"]){
432+
OTPListViewController *vc = [OTPListViewController new];
433+
[BaseViewController presentVC:vc];
434+
}else if (![Login isLogin]) {
435+
UIViewController *presentingVC = [BaseViewController presentingVC];
436+
if (![presentingVC isKindOfClass:[LoginViewController class]]) {
437+
LoginViewController *vc = [[LoginViewController alloc] init];
438+
vc.showDismissButton = YES;
439+
UINavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:vc];
440+
[presentingVC presentViewController:nav animated:YES completion:nil];
441+
}
442+
}else if ([shortcutItem.type isEqualToString:@"shortcut_task"]) {
443+
ProjectToChooseListViewController *chooseVC = [[ProjectToChooseListViewController alloc] init];
444+
[BaseViewController goToVC:chooseVC];
445+
}else if ([shortcutItem.type isEqualToString:@"shortcut_tweet"]){
446+
TweetSendViewController *vc = [[TweetSendViewController alloc] init];
447+
vc.sendNextTweet = ^(Tweet *nextTweet){
448+
[nextTweet saveSendData];//发送前保存草稿
449+
[[Coding_NetAPIManager sharedManager] request_Tweet_DoTweet_WithObj:nextTweet andBlock:^(id data, NSError *error) {
450+
if (data) {
451+
[Tweet deleteSendData];//发送成功后删除草稿
452+
}
453+
}];
454+
};
455+
[BaseViewController presentVC:vc];
456+
}
457+
completionHandler(YES);
458+
}
426459
@end

Coding_iOS/Coding_iOS-Info.plist

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,38 @@
113113
</array>
114114
<key>UIViewControllerBasedStatusBarAppearance</key>
115115
<false/>
116+
<key>UIApplicationShortcutItems</key>
117+
<array>
118+
<dict>
119+
<key>UIApplicationShortcutItemIconFile</key>
120+
<string>shortcut_task</string>
121+
<key>UIApplicationShortcutItemTitle</key>
122+
<string>新任务</string>
123+
<key>UIApplicationShortcutItemType</key>
124+
<string>shortcut_task</string>
125+
<key>UIApplicationShortcutItemUserInfo</key>
126+
<dict/>
127+
</dict>
128+
<dict>
129+
<key>UIApplicationShortcutItemIconFile</key>
130+
<string>shortcut_tweet</string>
131+
<key>UIApplicationShortcutItemTitle</key>
132+
<string>发冒泡</string>
133+
<key>UIApplicationShortcutItemType</key>
134+
<string>shortcut_tweet</string>
135+
<key>UIApplicationShortcutItemUserInfo</key>
136+
<dict/>
137+
</dict>
138+
<dict>
139+
<key>UIApplicationShortcutItemIconFile</key>
140+
<string>shortcut_2FA</string>
141+
<key>UIApplicationShortcutItemTitle</key>
142+
<string>两步验证</string>
143+
<key>UIApplicationShortcutItemType</key>
144+
<string>shortcut_2FA</string>
145+
<key>UIApplicationShortcutItemUserInfo</key>
146+
<dict/>
147+
</dict>
148+
</array>
116149
</dict>
117150
</plist>

Coding_iOS/Controllers/AllSearchDisplayVC.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,10 @@
66
// Copyright © 2015年 Coding. All rights reserved.
77
//
88

9-
typedef NS_ENUM(NSUInteger, eSearchType) {
10-
eSearchType_Project=0,
11-
eSearchType_Task,
12-
eSearchType_Topic,
13-
eSearchType_Tweet,
14-
eSearchType_Document,
15-
eSearchType_User,
16-
eSearchType_Merge,
17-
eSearchType_Pull,
18-
eSearchType_All
19-
};
20-
219
#import <UIKit/UIKit.h>
10+
#import "CodingSearchDisplayView.h"
2211

2312
@interface AllSearchDisplayVC : UISearchDisplayController
2413
@property (nonatomic,weak)UIViewController *parentVC;
25-
@property (nonatomic,assign)eSearchType curSearchType;
2614
-(void)reloadDisplayData;
2715
@end

0 commit comments

Comments
 (0)