Explorar el Código

1.修改iOS Apex Drivers定位权限请求。

Pen Li hace 7 años
padre
commit
d6a17ea129

+ 2 - 0
Redant Drivers/Apex And Drivers/AppDelegate.m

@@ -147,6 +147,8 @@
     }];
     [application registerForRemoteNotifications];
     
+    
+    
     // 程序被强杀之后收到通知,点击 通知 启动应用
     if (launchOptions && application.applicationState == UIApplicationStateInactive) {
         

+ 5 - 5
Redant Drivers/Apex And Drivers/Home/HomeHeader.xib

@@ -296,16 +296,16 @@
                             </constraints>
                         </view>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ni3-TR-BVf">
-                            <rect key="frame" x="214" y="20.5" width="1" height="20"/>
-                            <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <rect key="frame" x="214" y="25.5" width="1" height="10"/>
+                            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                             <constraints>
-                                <constraint firstAttribute="height" constant="20" id="6bX-Wf-tBG"/>
+                                <constraint firstAttribute="height" constant="10" id="6bX-Wf-tBG"/>
                                 <constraint firstAttribute="width" constant="1" id="vC6-FF-UYG"/>
                             </constraints>
                         </view>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tqP-9g-fiy">
-                            <rect key="frame" x="433" y="20.5" width="1" height="20"/>
-                            <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <rect key="frame" x="433" y="25.5" width="1" height="10"/>
+                            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         </view>
                     </subviews>
                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>

+ 17 - 0
Redant Drivers/Apex And Drivers/Login/LoginViewController.m

@@ -8,9 +8,11 @@
 
 #import "LoginViewController.h"
 #import "RetrievePasswordViewController.h"
+#import <CoreLocation/CoreLocation.h>
 
 @interface LoginViewController ()
 @property (strong, nonatomic) IBOutlet UILabel *verLabel;
+@property (nonatomic,strong) CLLocationManager *locationManager;
 
 @end
 
@@ -50,6 +52,9 @@
     versionNum = [NSString stringWithFormat:@"ver:%@.A%@",shortNum,versionNum];
     
     self.verLabel.text = versionNum;
+    
+    // 请求定位授权
+    [self requestLocationAuthorization];
 }
 
 - (void)viewWillAppear:(BOOL)animated {
@@ -104,6 +109,18 @@
     // Dispose of any resources that can be recreated.
 }
 
+#pragma mark - Location
+
+- (void)requestLocationAuthorization {
+    
+    if (self.locationManager) {
+        return;
+    }
+    self.locationManager = [[CLLocationManager alloc] init];
+    self.locationManager.allowsBackgroundLocationUpdates = YES;
+    [self.locationManager requestAlwaysAuthorization];
+}
+
 #pragma mark - Config
 
 - (void)clearNavigationbar {

+ 6 - 0
Redant Drivers/Apex And Drivers/Setting/Option/RAOptionViewController.m

@@ -49,6 +49,12 @@
 
 - (void)configTable {
     
+    if (@available(iOS 11,*)) {
+        self.optionTable.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
+    } else {
+        self.automaticallyAdjustsScrollViewInsets = NO;
+    }
+    
     self.optionTable.tableFooterView = [UIView new];
     self.optionTable.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1];
 }

+ 20 - 14
Redant Drivers/Apex And Drivers/Setting/RASettingViewController.m

@@ -67,22 +67,28 @@
 
 - (void)loadData {
     
-    NSDictionary *json = [RADataProvider loadDataFromBundleFile:@"setting.json"];
-    NSMutableArray *tmpArr = [NSMutableArray array];
-    NSArray *sectionArr = [json objectForKey:@"sections"];
-    
-    for (NSDictionary *section in sectionArr) {
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+       
+        NSDictionary *json = [RADataProvider loadDataFromBundleFile:@"setting.json"];
+        NSMutableArray *tmpArr = [NSMutableArray array];
+        NSArray *sectionArr = [json objectForKey:@"sections"];
         
-        RASettingSectionModel *model = [RASettingSectionModel new];
-        [model setValuesForKeysWithDictionary:section];
-        [tmpArr addObject:model];
-    }
-    
-    NSMutableArray *sections = (NSMutableArray *)self.sections;
-    [sections removeAllObjects];
-    [sections addObjectsFromArray:tmpArr];
+        for (NSDictionary *section in sectionArr) {
+            
+            RASettingSectionModel *model = [RASettingSectionModel new];
+            [model setValuesForKeysWithDictionary:section];
+            [tmpArr addObject:model];
+        }
+        
+        NSMutableArray *sections = (NSMutableArray *)self.sections;
+        [sections removeAllObjects];
+        [sections addObjectsFromArray:tmpArr];
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [self.tableView reloadData];
+        });
+    });
     
-    [self.tableView reloadData];
 }
 
 @end

+ 4 - 2
Redant Drivers/Apex And Drivers/Update/Edit.storyboard

@@ -306,9 +306,9 @@
                                 </constraints>
                             </view>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Rra-Ip-4wb">
-                                <rect key="frame" x="135" y="59.5" width="30" height="44"/>
+                                <rect key="frame" x="5" y="59.5" width="290" height="50"/>
                                 <constraints>
-                                    <constraint firstAttribute="height" constant="44" id="JbV-gE-wzg"/>
+                                    <constraint firstAttribute="height" constant="50" id="JbV-gE-wzg"/>
                                 </constraints>
                                 <state key="normal" title="Ok"/>
                                 <connections>
@@ -324,6 +324,8 @@
                             <constraint firstItem="9KF-7X-fM9" firstAttribute="top" secondItem="wal-J9-Hg6" secondAttribute="bottom" constant="5" id="Fb3-mK-tOs"/>
                             <constraint firstItem="wal-J9-Hg6" firstAttribute="top" secondItem="r5t-37-G4F" secondAttribute="top" constant="5" id="Ie5-6m-cVN"/>
                             <constraint firstItem="oEg-jq-oWF" firstAttribute="leading" secondItem="r5t-37-G4F" secondAttribute="leading" id="MzX-t3-y5K"/>
+                            <constraint firstItem="Rra-Ip-4wb" firstAttribute="leading" secondItem="r5t-37-G4F" secondAttribute="leading" constant="5" id="Nrs-OC-pv2"/>
+                            <constraint firstItem="r5t-37-G4F" firstAttribute="trailing" secondItem="Rra-Ip-4wb" secondAttribute="trailing" constant="5" id="Wyx-3q-wMd"/>
                             <constraint firstItem="r5t-37-G4F" firstAttribute="trailing" secondItem="9KF-7X-fM9" secondAttribute="trailing" constant="5" id="bp0-Qi-Buq"/>
                             <constraint firstItem="Rra-Ip-4wb" firstAttribute="top" secondItem="oEg-jq-oWF" secondAttribute="bottom" constant="1" id="j6g-LD-A7G"/>
                             <constraint firstItem="9KF-7X-fM9" firstAttribute="leading" secondItem="r5t-37-G4F" secondAttribute="leading" constant="5" id="joY-Je-Y1H"/>