| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- //
- // RANavigationController.m
- // Apex And Drivers
- //
- // Created by Jack on 2018/8/31.
- // Copyright © 2018年 USAI. All rights reserved.
- //
- #import "RANavigationController.h"
- #import "RAOrderDetailViewController.h"
- @interface RANavigationController ()
- @end
- @implementation RANavigationController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self _configAppearance];
- [self registNotification];
- }
- - (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (UIStatusBarStyle)preferredStatusBarStyle {
- return UIStatusBarStyleLightContent;
- }
- - (void)_configAppearance {
-
- [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:ApexDriverWhiteColor}]; // Title Color
- [self.navigationBar setTintColor:ApexDriverWhiteColor]; // BarItem颜色
- self.navigationBar.barTintColor = ApexDriverOrangeColor; // 背景色
- self.navigationBar.translucent = NO;
- self.navigationBar.shadowImage = [UIImage new]; // 去除Bar黑色分割线
- }
- - (void)registNotification {
- // [RASingleton.sharedInstance writeLog:[NSString stringWithFormat:@"%s",__func__]];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveHandleOrderNotification:) name:RANotificationHandleOrder object:nil];
- }
- - (void)receiveHandleOrderNotification:(NSNotification *)notification {
-
- NSDictionary *userInfo = notification.userInfo;
- NSDictionary *aps = [userInfo objectForKey:@"aps"];
- NSString *orderID = [aps objectForKey:@"order-id"];
- NSInteger orderType = [[aps objectForKey:@"order-type"] integerValue];
- NSString *orderType2 = [aps objectForKey:@"order-type2"];
- NSString *statusNo = [aps objectForKey:@"status-no"];
- if (!orderType2) {
- orderType2 = @"";
- }
- // [RASingleton.sharedInstance writeLog:[NSString stringWithFormat:@"%s",__func__]];
- if (orderID) {
-
-
- NSString *msg = [aps objectForKey:@"message"];
- if (msg.length == 0) {
- msg = [NSString stringWithFormat:@"%@ status changed,view detail?",orderID];
- }
-
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
-
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
-
- __weak typeof(self) weakSelf = self;
- UIAlertAction *detailAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf pushDetailViewControllerForOrderID:orderID type:orderType type2:orderType2 statusNo:statusNo];
- }];
-
- [alertVC addAction:cancelAction];
- [alertVC addAction:detailAction];
-
- [self presentViewController:alertVC animated:YES completion:nil];
- }
- }
- - (void)pushDetailViewControllerForOrderID:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 statusNo:(NSString *)statusNo {
-
- if (!orderID) {
- return;
- }
- RAOrderDetailViewController *detailVC = [RAOrderDetailViewController viewControllerFromStoryboard];
- detailVC.orderID = orderID;
- detailVC.orderType = type;
- detailVC.orderType2 = type2;
- [self pushViewController:detailVC animated:YES];
- }
- @end
|