Skip to content

Commit

Permalink
修复兼容性问题,增加浏览器goback能力
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolf-Tungsten committed Sep 1, 2019
1 parent 86df074 commit 83b4acc
Show file tree
Hide file tree
Showing 95 changed files with 2,843 additions and 3,997 deletions.
2 changes: 1 addition & 1 deletion HeraldApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
1998C08521A969E100D84BFB /* HeraldApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HeraldApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
1998C08821A969E100D84BFB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
1998C08921A969E100D84BFB /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
1998C09621A969E200D84BFB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1998C09621A969E200D84BFB /* Info.plist */ = {isa = PBXFileReference; explicitFileType = text.plist.info; path = Info.plist; sourceTree = "<group>"; };
1998C09721A969E200D84BFB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
19A46718221C475A00BFED72 /* GRHOAuthWebViewModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GRHOAuthWebViewModel.h; sourceTree = "<group>"; };
19A46719221C475A00BFED72 /* GRHOAuthWebViewModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GRHOAuthWebViewModel.m; sourceTree = "<group>"; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
<key>HeraldApp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>12</integer>
</dict>
<key>today-ext.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>13</integer>
</dict>
</dict>
</dict>
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions HeraldApp/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ - (void)initNotificationPush{
[[UIApplication sharedApplication] registerForRemoteNotifications];
}


- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{
NSLog(@"获取deviceToken失败,原因:%@", error);
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
Expand Down
6 changes: 5 additions & 1 deletion HeraldApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0.0</string>
<string>2.0.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -35,8 +35,12 @@
</array>
<key>CFBundleVersion</key>
<string>3</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>部分功能(如:寻物启事)需要访问相机</string>
<key>NSMainNibFile</key>
<string>LaunchScreen</string>
<key>NSPhotoLibraryUsageDescription</key>
Expand Down
2 changes: 1 addition & 1 deletion HeraldApp/Util/GRHConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#define GRH_HYBRID_BASEURL @"https://hybrid-ios.myseu.cn/"
#define GRH_HYBRID_DEBUG NO
#define GRH_HYBRID_DEBUG_URL @"http://192.168.1.101:8080/"
#define GRH_HYBRID_DEBUG_URL @"http://192.168.1.101:63053/"

///-----------
/// UserDefualts
Expand Down
5 changes: 3 additions & 2 deletions HeraldApp/View/BaseClass/GRHWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ - (void)viewDidLoad {
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
//make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
} else {
UIView *topLayoutGuide = (id)self.topLayoutGuide;
make.top.equalTo(topLayoutGuide.mas_bottom);
//UIView *topLayoutGuide = (id)self.topLayoutGuide;
make.top.equalTo(self.view.mas_top).offset(64);
//make.top.equalTo(topLayoutGuide);
//make.bottom.equalTo(self.view.mas_bottom);
}
make.left.equalTo(self.view.mas_left);
Expand Down
13 changes: 12 additions & 1 deletion HeraldApp/View/GRHHomepageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import "GRHHomepageViewController.h"
#import <UserNotifications/UserNotifications.h>
#import <AVFoundation/AVCaptureDevice.h>
#import <AVFoundation/AVMediaFormat.h>

@interface GRHHomepageViewController ()

Expand Down Expand Up @@ -67,7 +69,7 @@ - (void)checkNotification{
if ([application respondsToSelector:@selector(openURL:options:completionHandler:)]) {
[application openURL:URL options:@{} completionHandler:nil];
} else {
[application openURL:URL];
[application openURL:URL options:@{} completionHandler:nil];
}
}
}]];
Expand All @@ -80,6 +82,15 @@ - (void)checkNotification{
}
}

- (void)checkAuthorization {
// 检查权限
// 检查相机权限
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if (status == AVAuthorizationStatusRestricted || status == AVAuthorizationStatusDenied)
{
NSLog(@"无相机权限");
}
}
- (void)constructUI {
UIView *tabBarView = [[UIView alloc] init];
self.tabBarView = tabBarView;
Expand Down
2 changes: 1 addition & 1 deletion HeraldApp/View/GRHLoginViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ - (void)bindViewModel {
if(x != nil) {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"密码输入错误次数过多,本次登录需要额外验证过程;请通过统一身份认证验证后再次尝试登录。" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"前往验证" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.viewModel.verifyURL]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.viewModel.verifyURL] options:@{} completionHandler:nil];
}]];
// 弹出对话框
[self presentViewController:alert animated:true completion:nil];
Expand Down
7 changes: 5 additions & 2 deletions HeraldApp/ViewModel/BaseClass/GRHWebViewModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ - (void)userContentController:(nonnull WKUserContentController *)userContentCont
// jsBridge navigate动作
GRHContentViewModel *newVM = [[GRHContentViewModel alloc] initWithServices:self.services params:@{@"title":message.body[@"name"],@"path":message.body[@"path"]}];
[self.services pushViewModel:newVM animated:YES];
} else if ([(NSString *)message.body[@"action"] isEqualToString:@"goback"]){
// jsBridge 返回上层
[self.services popViewModelAnimated:YES];
} else if ([(NSString *)message.body[@"action"] isEqualToString:@"logout"]){
// jsBridge logout动作
[self logout];
Expand All @@ -67,7 +70,7 @@ - (void)userContentController:(nonnull WKUserContentController *)userContentCont
if([(NSNumber *)message.body[@"inApp"] boolValue]){
//TODO
} else {
[[UIApplication sharedApplication] openURL:targetURL];
[[UIApplication sharedApplication] openURL:targetURL options:@{} completionHandler:nil];
}
} else if ([(NSString *)message.body[@"action"] isEqualToString:@"setLocalNotification"]){
// jsBridge setLocalNotification动作
Expand Down Expand Up @@ -98,7 +101,7 @@ -(void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigatio
{
// 如果是在新页面中打开则直接打开浏览器?
if (navigationAction.targetFrame == nil) {
[[UIApplication sharedApplication] openURL:navigationAction.request.URL];
[[UIApplication sharedApplication] openURL:navigationAction.request.URL options:@{} completionHandler:nil];
}
decisionHandler(WKNavigationActionPolicyAllow);
}
Expand Down
Loading

0 comments on commit 83b4acc

Please sign in to comment.