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 {
0 commit comments