Skip to content

Commit 10e1243

Browse files
committed
企业版代码合并至个人版 - 已合并除 images 之外的资源
1 parent 08aa811 commit 10e1243

File tree

204 files changed

+10343
-2011
lines changed

Some content is hidden

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

204 files changed

+10343
-2011
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 182 additions & 19 deletions
Large diffs are not rendered by default.

Coding_iOS/.DS_Store

0 Bytes
Binary file not shown.

Coding_iOS/AppDelegate.m

Lines changed: 66 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#import "TweetSendViewController.h"
3131
#import "ProjectToChooseListViewController.h"
3232
#import "OTPListViewController.h"
33+
#import "WikiEditViewController.h"
3334

3435
#import "FunctionIntroManager.h"
3536
#import <evernote-cloud-sdk-ios/ENSDK/ENSDK.h>
@@ -66,11 +67,19 @@ - (void)registerUserAgent{
6667
NSString *userAgent = [NSString userAgentStr];
6768
NSDictionary *dictionary = @{@"UserAgent" : userAgent};//User-Agent
6869
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
70+
71+
72+
// @available(iOS 10.0, *);
73+
74+
// [UIColor colorNamed:@""]
6975
}
7076

7177
#pragma lifeCycle
72-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
73-
{
78+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
79+
if (kTarget_Enterprise) {//这是很早之前为测试弄的吧
80+
[NSObject preCookieHandle];//cookie 设置
81+
}
82+
7483
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
7584
// Override point for customization after application launch.
7685
self.window.backgroundColor = [UIColor whiteColor];
@@ -98,12 +107,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
98107
[self.window makeKeyAndVisible];
99108
[FunctionIntroManager showIntroPage];
100109

101-
EaseStartView *startView = [EaseStartView new];
102-
@weakify(self);
103-
[startView startAnimationWithCompletionBlock:^(EaseStartView *easeStartView) {
104-
@strongify(self);
110+
if (kTarget_Enterprise) {
105111
[self completionStartAnimationWithOptions:launchOptions];
106-
}];
112+
}else{
113+
EaseStartView *startView = [EaseStartView new];
114+
@weakify(self);
115+
[startView startAnimationWithCompletionBlock:^(EaseStartView *easeStartView) {
116+
@strongify(self);
117+
[self completionStartAnimationWithOptions:launchOptions];
118+
}];
119+
}
107120

108121
#if DEBUG
109122
// [[RRFPSBar sharedInstance] setShowsAverage:YES];
@@ -124,14 +137,16 @@ - (void)completionStartAnimationWithOptions:(NSDictionary *)launchOptions{
124137
UMConfigInstance.appKey = kUmeng_AppKey;
125138
[MobClick startWithConfigure:UMConfigInstance];
126139

127-
//UMSocialManager 第三方登录
128-
[[UMSocialManager defaultManager] openLog:YES];
129-
[UMSocialGlobal shareInstance].isUsingHttpsWhenShareContent = NO;
130-
[[UMSocialManager defaultManager] setUmSocialAppkey:kUmeng_AppKey];
131-
[[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:kSocial_WX_ID appSecret:kSocial_WX_Secret redirectURL:nil];
132-
[[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:kSocial_QQ_ID appSecret:kSocial_QQ_Secret redirectURL:nil];
133-
[[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_Sina appKey:kSocial_Sina_ID appSecret:kSocial_Sina_Secret redirectURL:kSocial_Sina_RedirectURL];
134-
[ENSession setSharedSessionConsumerKey:kSocial_EN_Key consumerSecret:kSocial_EN_Secret optionalHost:nil];
140+
if (!kTarget_Enterprise) {
141+
//UMSocialManager & 第三方登录
142+
[[UMSocialManager defaultManager] openLog:YES];
143+
[UMSocialGlobal shareInstance].isUsingHttpsWhenShareContent = NO;
144+
[[UMSocialManager defaultManager] setUmSocialAppkey:kUmeng_AppKey];
145+
[[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:kSocial_WX_ID appSecret:kSocial_WX_Secret redirectURL:nil];
146+
[[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:kSocial_QQ_ID appSecret:kSocial_QQ_Secret redirectURL:nil];
147+
[[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_Sina appKey:kSocial_Sina_ID appSecret:kSocial_Sina_Secret redirectURL:kSocial_Sina_RedirectURL];
148+
[ENSession setSharedSessionConsumerKey:kSocial_EN_Key consumerSecret:kSocial_EN_Secret optionalHost:nil];
149+
}
135150

136151
// 信鸽推送
137152
[XGPush startApp:kXGPush_Id appKey:kXGPush_Key];
@@ -157,6 +172,9 @@ - (void)applicationWillResignActive:(UIApplication *)application
157172
{
158173
// 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.
159174
// 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.
175+
if ([[BaseViewController presentingVC] isKindOfClass:[WikiEditViewController class]]) {
176+
[(WikiEditViewController *)[BaseViewController presentingVC] saveWikiDraft];
177+
}
160178
[[ImageSizeManager shareManager] save];
161179
[[Tweet tweetForSend] saveSendData];
162180
}
@@ -187,7 +205,7 @@ - (void)applicationDidBecomeActive:(UIApplication *)application
187205
#pragma clang diagnostic pop
188206
}
189207
}
190-
// Coding 报告
208+
// CODING 报告
191209
[[EADeviceToServerLog shareManager] tryToStart];
192210
}
193211

@@ -197,6 +215,9 @@ - (void)applicationWillTerminate:(UIApplication *)application
197215
[self saveContext];
198216
}
199217

218+
#ifndef Target_Enterprise
219+
220+
// Universal Links - 个人版支持的东西
200221
#pragma mark Universal Links
201222

202223
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler{
@@ -212,6 +233,7 @@ - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserAct
212233
return YES;
213234
}
214235

236+
#endif
215237

216238
#pragma mark - XGPush Message
217239
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
@@ -238,14 +260,29 @@ - (void)application:(UIApplication *)application didRegisterUserNotificationSett
238260

239261
#pragma mark - Methods Private
240262
- (void)setupLoginViewController{
263+
#ifdef Target_Enterprise
264+
265+
IntroductionViewController *introductionVC = [[IntroductionViewController alloc] init];
266+
[self.window setRootViewController:introductionVC];
267+
[introductionVC presentLoginUI];
268+
269+
#else
270+
241271
LoginViewController *loginVC = [[LoginViewController alloc] init];
242272
[self.window setRootViewController:[[UINavigationController alloc] initWithRootViewController:loginVC]];
273+
274+
#endif
243275
}
244276

245277
- (void)setupIntroductionViewController{
246-
[self setupLoginViewController];//猥琐换
247-
// IntroductionViewController *introductionVC = [[IntroductionViewController alloc] init];
248-
// [self.window setRootViewController:introductionVC];
278+
if (kTarget_Enterprise) {
279+
IntroductionViewController *introductionVC = [[IntroductionViewController alloc] init];
280+
[self.window setRootViewController:introductionVC];
281+
}else{
282+
[self setupLoginViewController];//猥琐换
283+
// IntroductionViewController *introductionVC = [[IntroductionViewController alloc] init];
284+
// [self.window setRootViewController:introductionVC];
285+
}
249286
}
250287

251288
- (void)setupTabViewController{
@@ -256,6 +293,15 @@ - (void)setupTabViewController{
256293
}
257294

258295
- (void)customizeInterface {
296+
{//UIBarButtonItem 颜色&字体
297+
NSDictionary *textAttributes = @{
298+
NSFontAttributeName: [UIFont systemFontOfSize:kBackButtonFontSize],
299+
NSForegroundColorAttributeName: kColorLightBlue,
300+
};
301+
[[UIBarButtonItem appearance] setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
302+
[[UIBarButtonItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:kBackButtonFontSize]} forState:UIControlStateDisabled];
303+
[[UIBarButtonItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:kBackButtonFontSize]} forState:UIControlStateHighlighted];
304+
}
259305
//设置Nav的背景色和title色
260306
UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
261307
[navigationBarAppearance setBackgroundImage:[UIImage imageWithColor:[NSObject baseURLStrIsProduction]? kColorNavBG: kColorActionYellow] forBarMetrics:UIBarMetricsDefault];
@@ -457,7 +503,7 @@ - (void)application:(UIApplication *)application performActionForShortcutItem:(U
457503
if (![presentingVC isKindOfClass:[LoginViewController class]]) {
458504
LoginViewController *vc = [[LoginViewController alloc] init];
459505
vc.showDismissButton = YES;
460-
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
506+
UINavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:vc];
461507
[presentingVC presentViewController:nav animated:YES completion:nil];
462508
}
463509
}else{

Coding_iOS/CodingEnterprise_iOS-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<key>UIFileSharingEnabled</key>
114114
<false/>
115115
<key>UILaunchStoryboardName</key>
116-
<string>Launch Screen</string>
116+
<string>Launch Screen_E</string>
117117
<key>UIRequiredDeviceCapabilities</key>
118118
<array>
119119
<string>armv7</string>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>aps-environment</key>
6+
<string>development</string>
7+
</dict>
8+
</plist>

Coding_iOS/Controllers/AddMDCommentViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
@property (strong, nonatomic) NSMutableDictionary *requestParams;
1616
@property (strong, nonatomic) NSString *contentStr;
1717
@property (strong, nonatomic) Project *curProject;
18+
@property (assign, nonatomic) BOOL isLineNote;//这个字段单纯是为友盟统计的,没啥特别的作用
1819

1920
@end

Coding_iOS/Controllers/AddMDCommentViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ - (void)previewLoadMDData{
174174
- (void)saveBtnClicked{
175175
_contentStr = [_contentStr aliasedString];
176176
[_requestParams setObject:_contentStr forKey:@"content"];
177-
177+
_requestParams[@"isLineNote"] = @(_isLineNote);
178+
178179
[NSObject showHUDQueryStr:@"正在保存..."];
179180
[[Coding_NetAPIManager sharedManager] request_PostCommentWithPath:_requestPath params:_requestParams andBlock:^(id data, NSError *error) {
180181
[NSObject hideHUDQuery];

Coding_iOS/Controllers/AddUserViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ typedef NS_ENUM(NSInteger, AddUserType) {
1414
AddUserTypeProjectRoot = 0,
1515
AddUserTypeProjectFollows,//我的关注
1616
AddUserTypeProjectFans,//我的粉丝
17+
AddUserTypeProjectCompany,//企业成员
1718
AddUserTypeFollow//添加好友
1819
};
1920
@interface AddUserViewController : BaseViewController<UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate>

Coding_iOS/Controllers/AddUserViewController.m

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ - (void)viewDidLoad {
3030
if (self.type < AddUserTypeFollow) {
3131
self.title = (self.type == AddUserTypeProjectRoot? @"添加成员":
3232
self.type == AddUserTypeProjectFollows? @"我的关注":
33-
@"我的粉丝");
33+
self.type == AddUserTypeProjectFans? @"我的粉丝":
34+
@"企业成员");
3435
_queryingArray = [NSMutableArray array];
3536
_searchedArray = [NSMutableArray array];
3637
}else if (self.type == AddUserTypeFollow){
@@ -62,10 +63,13 @@ - (void)viewDidLoad {
6263
searchBar;
6364
});
6465
_myTableView.tableHeaderView = _mySearchBar;
65-
if (self.type == AddUserTypeProjectFollows || self.type == AddUserTypeProjectFans) {
66+
if (self.type == AddUserTypeProjectFollows || self.type == AddUserTypeProjectFans || self.type == AddUserTypeProjectCompany) {
6667
_myRefreshControl = [[ODRefreshControl alloc] initInScrollView:self.myTableView];
6768
[_myRefreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
68-
_curUsers = [Users usersWithOwner:[Login curLoginUser] Type:self.type == AddUserTypeProjectFollows? UsersTypeFriends_Attentive: UsersTypeFollowers];
69+
UsersType userType = (self.type == AddUserTypeProjectFollows? UsersTypeFriends_Attentive:
70+
self.type == AddUserTypeProjectFans? UsersTypeFollowers:
71+
UsersType_CompanyMember);
72+
_curUsers = [Users usersWithOwner:[Login curLoginUser] Type:userType];
6973
[self refresh];
7074
}
7175
}
@@ -134,7 +138,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege
134138
}
135139

136140
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
137-
if (_type == AddUserTypeFollow) {
141+
if (_type == AddUserTypeFollow || kTarget_Enterprise) {
138142
return [UIView new];
139143
}else{
140144
NSInteger leftNum = _curProject.max_member.integerValue - _addedArray.count;
@@ -216,9 +220,15 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
216220
}
217221

218222
- (void)goToUserInfo:(User *)user{
219-
UserInfoViewController *vc = [[UserInfoViewController alloc] init];
220-
vc.curUser = user;
221-
[self.navigationController pushViewController:vc animated:YES];
223+
if (kTarget_Enterprise) {
224+
UserInfoDetailViewController *vc = [UserInfoDetailViewController new];
225+
vc.curUser = user;
226+
[self.navigationController pushViewController:vc animated:YES];
227+
}else{
228+
UserInfoViewController *vc = [[UserInfoViewController alloc] init];
229+
vc.curUser = user;
230+
[self.navigationController pushViewController:vc animated:YES];
231+
}
222232
}
223233

224234
#pragma mark ScrollView Delegate

Coding_iOS/Controllers/CodeViewController.m

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ - (void)doSomethingWithResponse:(id)data andError:(NSError *)error{
105105
- (void)refreshCodeViewData{
106106
if ([_myCodeFile.file.mode isEqualToString:@"image"]) {
107107
// NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@u/%@/p/%@/git/raw/%@", [NSObject baseURLStr], _myProject.owner_user_name, _myProject.name, [NSString handelRef:_myCodeFile.ref path:_myCodeFile.file.path]]];
108-
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@u/%@/p/%@/git/raw/%@/%@", [NSObject baseURLStr], _myProject.owner_user_name, _myProject.name, _myCodeFile.ref, _myCodeFile.file.path]];
108+
NSURL *imageUrl;
109+
if (kTarget_Enterprise) {//企业版不需要 owner_user_name
110+
imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@p/%@/git/raw/%@/%@", [NSObject baseURLStr], _myProject.name, _myCodeFile.ref, _myCodeFile.file.path]];
111+
}else{
112+
imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@u/%@/p/%@/git/raw/%@/%@", [NSObject baseURLStr], _myProject.owner_user_name, _myProject.name, _myCodeFile.ref, _myCodeFile.file.path]];
113+
}
109114
DebugLog(@"imageUrl: %@", imageUrl);
110115
[self.webContentView loadRequest:[NSURLRequest requestWithURL:imageUrl]];
111116
}else if ([@[@"file", @"sym_link", @"executable"] containsObject:_myCodeFile.file.mode]){
@@ -118,7 +123,12 @@ - (void)refreshCodeViewData{
118123
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
119124
DebugLog(@"strLink=[%@]",request.URL.absoluteString);
120125
if ([_myCodeFile.file.mode isEqualToString:@"image"]) {
121-
NSString *imageStr = [NSString stringWithFormat:@"%@u/%@/p/%@/git/raw/%@/%@", [NSObject baseURLStr], _myProject.owner_user_name, _myProject.name, _myCodeFile.ref, _myCodeFile.file.path];
126+
NSString *imageStr;
127+
if (kTarget_Enterprise) {
128+
imageStr = [NSString stringWithFormat:@"%@p/%@/git/raw/%@/%@", [NSObject baseURLStr], _myProject.name, _myCodeFile.ref, _myCodeFile.file.path];
129+
}else{
130+
imageStr = [NSString stringWithFormat:@"%@u/%@/p/%@/git/raw/%@/%@", [NSObject baseURLStr], _myProject.owner_user_name, _myProject.name, _myCodeFile.ref, _myCodeFile.file.path];
131+
}
122132
if ([imageStr isEqualToString:request.URL.absoluteString]) {
123133
return YES;
124134
}

0 commit comments

Comments
 (0)