Commit 816a6dd9 authored by 乔金柱's avatar 乔金柱

Merge branch 'lym/text1' into 'master'

Lym/text1

See merge request !22
parents 3b6941d8 0270df78
......@@ -577,7 +577,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "GMBase/GMBase_Example-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$GMBase-Swift.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 4.0;
WRAPPER_EXTENSION = app;
};
name = Debug;
......@@ -599,7 +599,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "GMBase/GMBase_Example-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$GMBase-Swift.h";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 4.0;
WRAPPER_EXTENSION = app;
};
name = Release;
......
......@@ -8,10 +8,12 @@ source 'git@git.wanmeizhensuo.com:gengmeiios/GMSpecs.git'
target 'GMBase_Example' do
pod 'GMBase', :path => '../'
pod 'SnapKit', '4.2.0'
pod 'SnapKit', '4.0.0'
pod 'GMShareSDK', '0.2.1'
pod 'GMBaseSwift', :path => '../../GMBaseSwift'
# pod 'GMBaseSwift', :path => '../../GMBaseSwift'
pod 'GMBaseSwift', :git => 'git@git.wanmeizhensuo.com:gengmeiios/GMBaseSwift.git', :commit => '116868d'
pod 'GMPhobos', :git => 'git@git.wanmeizhensuo.com:gengmeiios/GMPhobos.git', :commit => '7e58199898627699373ad6a9f87b875ab04b0927'
target 'GMBase_Tests' do
inherit! :search_paths
......
......@@ -24,6 +24,7 @@ PODS:
- GM-Swift-Observable (4.0.1)
- GMBase (1.1.5):
- GMBaseSwift
- GMFoundation
- GMHud
- GMJSONModel
- GMKit
......@@ -31,7 +32,6 @@ PODS:
- GMNetworking
- GMPhobos
- GMRefresh
- GMShareSDK
- MBProgressHUD
- SDWebImage
- "UITableView+FDTemplateLayoutCell (= 1.4)"
......@@ -43,7 +43,7 @@ PODS:
- GMNetworking
- GMPhobos
- GMRefresh
- SnapKit (= 4.2.0)
- SnapKit (= 4.0.0)
- GMCache (1.0.1):
- TMCache (= 2.1.0)
- GMFoundation (1.0.8)
......@@ -122,7 +122,7 @@ PODS:
- SDWebImage (5.8.0):
- SDWebImage/Core (= 5.8.0)
- SDWebImage/Core (5.8.0)
- SnapKit (4.2.0)
- SnapKit (4.0.0)
- TMCache (2.1.0)
- "UITableView+FDTemplateLayoutCell (1.4)"
- WechatOpenSDK (1.8.6.2)
......@@ -130,10 +130,10 @@ PODS:
DEPENDENCIES:
- GMBase (from `../`)
- GMBaseSwift (from `../../GMBaseSwift`)
- "GMBaseSwift (from `git@git.wanmeizhensuo.com:gengmeiios/GMBaseSwift.git`, commit `116868d`)"
- "GMPhobos (from `git@git.wanmeizhensuo.com:gengmeiios/GMPhobos.git`, commit `7e58199898627699373ad6a9f87b875ab04b0927`)"
- GMShareSDK (= 0.2.1)
- SnapKit (= 4.2.0)
- SnapKit (= 4.0.0)
SPEC REPOS:
"git@git.wanmeizhensuo.com:gengmeiios/GMSpecs.git":
......@@ -169,12 +169,16 @@ EXTERNAL SOURCES:
GMBase:
:path: "../"
GMBaseSwift:
:path: "../../GMBaseSwift"
:commit: 116868d
:git: "git@git.wanmeizhensuo.com:gengmeiios/GMBaseSwift.git"
GMPhobos:
:commit: 7e58199898627699373ad6a9f87b875ab04b0927
:git: "git@git.wanmeizhensuo.com:gengmeiios/GMPhobos.git"
CHECKOUT OPTIONS:
GMBaseSwift:
:commit: 116868d
:git: "git@git.wanmeizhensuo.com:gengmeiios/GMBaseSwift.git"
GMPhobos:
:commit: 7e58199898627699373ad6a9f87b875ab04b0927
:git: "git@git.wanmeizhensuo.com:gengmeiios/GMPhobos.git"
......@@ -186,8 +190,8 @@ SPEC CHECKSUMS:
DouyinOpenSDK: 5ba83de22963ba7a3ba70c8ff11dfcb2885ecc2b
EVReflection: 1abc1a81927ab0d30170238cf9b79bff489e9728
GM-Swift-Observable: 756d8fc13638b9faa68cb10266b2ffb47a911595
GMBase: 358e72062cb0f64a57ff34ec181b20ad9973d79b
GMBaseSwift: 8f327883b33ac24d0dcdb648ac3f9d6c57949ad5
GMBase: 619ccdcdab926793d179662214b89f937029fee7
GMBaseSwift: fb846fbbfd7c6fb82af2909b0d730edfdc572ba6
GMCache: b78d8e46db864405e91d226ce640cc80d966c611
GMFoundation: e9f7fd9c6e5f133e09009b0ee5de4fce60ac5682
GMHud: 18d41f4900a204f27be14e9504fcee2060ae3b2c
......@@ -204,12 +208,12 @@ SPEC CHECKSUMS:
MJExtension: 635f2c663dcb1bf76fa4b715b2570a5710aec545
MJRefresh: 53e3e3219f204425ee6d3e62e8733d3295944cd6
SDWebImage: 84000f962cbfa70c07f19d2234cbfcf5d779b5dc
SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
SnapKit: a42d492c16e80209130a3379f73596c3454b7694
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
"UITableView+FDTemplateLayoutCell": 234e1582bcc4e18461af91155123bb96538ed030
WechatOpenSDK: 8b3ba4239193d1112205c139c94e21934e8f369a
Weibo_SDK: 5a4d08f7e1fedbb635435e4585c8c0439c7da089
PODFILE CHECKSUM: db60bbf458f56874386142fa246e256c5fa92944
PODFILE CHECKSUM: faf86c6bf49a2950d2c920316609ef26dc4389c2
COCOAPODS: 1.9.1
COCOAPODS: 1.9.3
......@@ -18,15 +18,11 @@ Pod::Spec.new do |s|
s.dependency 'GMHud'
s.dependency 'GMKit'
s.dependency 'SDWebImage'
# s.dependency 'SnapKit', '4.0.0'
s.dependency 'GMShareSDK'
# s.dependency 'GMShareSDK'
s.dependency 'GMFoundation'
s.dependency 'GMNetworking'
# s.dependency 'PLMediaStreamingKit'
# s.dependency 'PLPlayerKit'
# s.dependency 'GMAlbum'
# SnapKit 4.2.0
# s.dependency 'SnapKit', '4.2.0'
s.dependency 'GMBaseSwift'
s.swift_version = '4.2'
s.swift_version = '4.0'
s.static_framework = true
end
......@@ -19,36 +19,18 @@
+ (UIViewController *)getCurrentViewController{
UIViewController* currentViewController = [self getRootViewController];
BOOL runLoopFind = YES;
while (runLoopFind) {
if (currentViewController.presentedViewController) {
currentViewController = currentViewController.presentedViewController;
} else if ([currentViewController isKindOfClass:[UINavigationController class]]) {
UINavigationController* navigationController = (UINavigationController* )currentViewController;
currentViewController = [navigationController.childViewControllers lastObject];
} else if ([currentViewController isKindOfClass:[UITabBarController class]]) {
UITabBarController* tabBarController = (UITabBarController* )currentViewController;
currentViewController = tabBarController.selectedViewController;
} else {
NSUInteger childViewControllerCount = currentViewController.childViewControllers.count;
if (childViewControllerCount > 0) {
currentViewController = currentViewController.childViewControllers.lastObject;
return currentViewController;
} else {
return currentViewController;
}
}
if (currentViewController.presentedViewController) { //present
currentViewController = currentViewController.presentedViewController;
return currentViewController;
} else if ([currentViewController isKindOfClass:NSClassFromString(@"WMMainTabBarViewController")]) { //一级页面
UIViewController *vc = (UIViewController *)[currentViewController valueForKey:@"current"];
return vc;
} else {
UINavigationController* navigationController = (UINavigationController* )currentViewController;
currentViewController = navigationController.visibleViewController;
return currentViewController;
}
return currentViewController;
}
......
......@@ -115,9 +115,9 @@ public class GMCalendarEventManager: NSObject {
alert.addAction(actionA)
let actionB = UIAlertAction(title: "去设置", style: .default) { (_) in
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, options: [:], completionHandler: nil)
UIApplication.shared.open(URL(string: UIApplicationOpenSettingsURLString)!, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(URL(string: UIApplication.openSettingsURLString)!)
UIApplication.shared.openURL(URL(string: UIApplicationOpenSettingsURLString)!)
}
}
alert.addAction(actionB)
......
......@@ -11,6 +11,7 @@
#define kLastLocation @"lastLocation"
typedef void(^LocationFinishBlock)(CLLocation *location);
typedef void(^GMLocationAuthorizationBlock)(CLAuthorizationStatus status);
/**
保证新用户在有网络的情况下弹出 授权框 不然调不起地理位置弹框
......@@ -23,6 +24,8 @@ typedef void(^LocationFinishBlock)(CLLocation *location);
@property (nonatomic, readonly) CLLocation *location;
@property (nonatomic, assign, readonly) NSInteger statusWhenAppBackground;
/// 授权回调
@property (nonatomic, copy) GMLocationAuthorizationBlock authorBlock;
+ (instancetype)shareInstance;
......
......@@ -210,14 +210,24 @@
- (void)notDeterminedShowLocationAuthorize {
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
if (status == kCLAuthorizationStatusNotDetermined) {
[self.locationManager requestWhenInUseAuthorization];
[Phobos track:@"popup_view" attributes:@{@"page_name": SafeString([GMBaseTool getCurrentViewController].pageName), @"popup_name": @"location"} sendNow:YES];
[self _updatingLocation];
[self.locationManager requestWhenInUseAuthorization];
[Phobos track:@"popup_view" attributes:@{@"page_name": SafeString([GMBaseTool getCurrentViewController].pageName),
@"popup_name": @"location",
@"is_first_start":SafeString(@([self isAppFirst]))} sendNow:YES];
[self _updatingLocation];
} else {
[self _updatingLocation];
[self _updatingLocation];
}
}
//TODO: 待艾娇平验证
- (BOOL)isAppFirst {
// 获取app初始启动时间
NSString *app_initial_time = [GMCache fetchObjectAtDocumentPathWithkey:@"app_initial_launch_time"];
return [app_initial_time isNonEmpty];
}
- (void)updateLocation {
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
BOOL enable = [CLLocationManager locationServicesEnabled];
......@@ -238,7 +248,6 @@
// 注意此处可能会被多次调用,这是CoreLocation中的正常现象
self.location = locations.lastObject;
[self finishUpdatingLocation];
}
// 定位失误时触发
......@@ -247,19 +256,30 @@
// self.location = [[CLLocation alloc] initWithLatitude:0 longitude:0];
[self finishUpdatingLocation];
if (error.code == kCLErrorLocationUnknown ) {
NSLog(@"获取失败,会继续尝试获取位置信息");
// debugLog(@"获取失败,会继续尝试获取位置信息");
}
}
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
/// 获取授权状态后进行回调
if (status != kCLAuthorizationStatusNotDetermined) {
if (self.authorBlock) {
self.authorBlock(status);
}
}
// 如果不允许访问地理位置,直接完成
if (status == kCLAuthorizationStatusRestricted || status == kCLAuthorizationStatusDenied) {
[self finishUpdatingLocation];
[Phobos track:@"report_status" attributes:@{@"page_name": SafeString([GMBaseTool getCurrentViewController].pageName), @"report_name":@"close_location"} sendNow:YES];
[Phobos track:@"report_status" attributes:@{@"page_name": SafeString([GMBaseTool getCurrentViewController].pageName),
@"report_name":@"close_location",
@"is_first_start": SafeString(@([self isAppFirst]))} sendNow:YES];
}else if (status == kCLAuthorizationStatusAuthorizedAlways || status == kCLAuthorizationStatusAuthorizedWhenInUse){
[self _updatingLocation];
[Phobos track:@"report_status" attributes:@{@"page_name": SafeString([GMBaseTool getCurrentViewController].pageName), @"report_name":@"open_location"} sendNow:YES];
[Phobos track:@"report_status" attributes:@{@"page_name": SafeString([GMBaseTool getCurrentViewController].pageName),
@"report_name":@"open_location",
@"is_first_start": SafeString(@([self isAppFirst]))} sendNow:YES];
}
}
......@@ -285,7 +305,7 @@
[GMCache storeObjectAtDiskWithkey:kLastLocation object:_location];
}
#pragma mark - Block Manage
#pragma mark - Block Manage
- (void)addBlock:(LocationFinishBlock)block {
[_blocks addObject:block];
}
......
......@@ -6,7 +6,7 @@
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
@import GMKit;
#import <GMKit/WYSegmentView.h>
/**
带小红点的segmentView
*/
......
......@@ -7,6 +7,10 @@
//
#import "GMSegmentViewWithRedBadge.h"
#import <GMKit/GMFont.h>
#import <GMKit/UIColor+GMTheme.h>
#import <GMKit/UIView+Layout.h>
#import <GMKit/Constant.h>
@implementation GMSegmentViewWithRedBadge {
NSArray<UIImageView *> *_badgeViews;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment