Commit 7cbea0cd authored by luyueming's avatar luyueming

Merge branch 'lym/text' of git.wanmeizhensuo.com:gengmeiios/GMBase into lym/text

* 'lym/text' of git.wanmeizhensuo.com:gengmeiios/GMBase:
  update

# Conflicts:
#	GMBase.podspec
chongtu
parents f18657e1 dd7e2e33
......@@ -569,6 +569,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;
WRAPPER_EXTENSION = app;
};
name = Debug;
......@@ -590,6 +591,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;
WRAPPER_EXTENSION = app;
};
name = Release;
......
......@@ -6,7 +6,7 @@
// Copyright © 2016年 wangyang. All rights reserved.
//
@import GMBase;
//@import GMBase;
#import "GMListViewModel.h"
@interface GMListViewController : WMBaseListViewController
......
......@@ -8,8 +8,9 @@ source 'git@git.wanmeizhensuo.com:gengmeiios/GMSpecs.git'
target 'GMBase_Example' do
pod 'GMBase', :path => '../'
# pod 'SnapKit', '4.2.0'
pod 'SnapKit', '4.2.0'
pod 'GMShareSDK', '0.2.1'
pod 'GMFoundation', :path => '../../GMFoundation'
pod 'GMPhobos', :git => 'git@git.wanmeizhensuo.com:gengmeiios/GMPhobos.git', :commit => '7e58199898627699373ad6a9f87b875ab04b0927'
target 'GMBase_Tests' do
......
......@@ -27,6 +27,7 @@ PODS:
- GMShareSDK
- MBProgressHUD
- SDWebImage
- SnapKit (= 4.2.0)
- "UITableView+FDTemplateLayoutCell (= 1.4)"
- GMCache (1.0.1):
- TMCache (= 2.1.0)
......@@ -100,10 +101,10 @@ PODS:
- Masonry (1.1.0)
- MBProgressHUD (0.9.2)
- MJExtension (3.2.1)
- MJRefresh (3.4.1)
- SDWebImage (5.7.3):
- SDWebImage/Core (= 5.7.3)
- SDWebImage/Core (5.7.3)
- MJRefresh (3.4.3)
- SDWebImage (5.8.0):
- SDWebImage/Core (= 5.8.0)
- SDWebImage/Core (5.8.0)
- SnapKit (4.2.0)
- TMCache (2.1.0)
- "UITableView+FDTemplateLayoutCell (1.4)"
......@@ -115,6 +116,7 @@ DEPENDENCIES:
- GMFoundation (from `../../GMFoundation`)
- "GMPhobos (from `git@git.wanmeizhensuo.com:gengmeiios/GMPhobos.git`, commit `7e58199898627699373ad6a9f87b875ab04b0927`)"
- GMShareSDK (= 0.2.1)
- SnapKit (= 4.2.0)
SPEC REPOS:
"git@git.wanmeizhensuo.com:gengmeiios/GMSpecs.git":
......@@ -159,7 +161,7 @@ SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
BDOpenSDKKit: 3fb530ce73f85a7d6ee69e7fd3d9158444c5bd09
DouyinOpenSDK: 5ba83de22963ba7a3ba70c8ff11dfcb2885ecc2b
GMBase: 2f05a06e886f8ea355e6f8be4276b667611140b4
GMBase: f48e18a07b654b31cf288dd07b3b7681f3046f07
GMCache: b78d8e46db864405e91d226ce640cc80d966c611
GMFoundation: 59cdf19ad5bdc479162da975cc739cf5cb418ab6
GMHud: 18d41f4900a204f27be14e9504fcee2060ae3b2c
......@@ -173,14 +175,14 @@ SPEC CHECKSUMS:
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1
MJExtension: 635f2c663dcb1bf76fa4b715b2570a5710aec545
MJRefresh: 3153c59a363159092c08b2177ec3a7d09f90bfaf
SDWebImage: 97351f6582ceca541ea294ba66a1fcb342a331c2
MJRefresh: 53e3e3219f204425ee6d3e62e8733d3295944cd6
SDWebImage: 84000f962cbfa70c07f19d2234cbfcf5d779b5dc
SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
"UITableView+FDTemplateLayoutCell": 234e1582bcc4e18461af91155123bb96538ed030
WechatOpenSDK: 8b3ba4239193d1112205c139c94e21934e8f369a
Weibo_SDK: 5a4d08f7e1fedbb635435e4585c8c0439c7da089
PODFILE CHECKSUM: 78c2e567604571069245adf06b4c06623adb32cc
PODFILE CHECKSUM: 91fc775f851c4b233485f262092149bc6027c830
COCOAPODS: 1.9.1
......@@ -21,6 +21,9 @@ Pod::Spec.new do |s|
s.dependency 'SnapKit','4.2.0'
s.dependency 'GMShareSDK'
# s.dependency 'GMAlbum'
# SnapKit 4.2.0
s.dependency 'SnapKit', '4.2.0'
s.swift_version = '4.2'
s.static_framework = true
......
//
// GMBaseWebViewController.h
// ZhengXing
//
// Created by wangyang on 3/5/19.
// Copyright (c) 2019 Wanmei Creative. All rights reserved.
// 后期替代WMBaseViewController&WMBrowserViewController
#import "WMBaseViewController.h"
#import "GMClientH5Object.h"
//@import GMShareSDK;
#import <GMShareSDK/GMShareSDK.h>
#define kWebPhantom @"phantom"// 常用于H5新页面
#define kWebHybrid @"hybrid" // 常用于H5老页面
#import <GMShareSDK/GMShareView.h>
////#import "GMShareView.h"
#import <GMShareSDK/WMShareObject.h>
#import <GMShareSDK/GMDiaryShareView.h>
//#import <GMShareSDK/GMClientH5Object.h>
#import "GMWebViewModel.h"
typedef NS_ENUM(NSInteger, GMWebPageType) {
GMWebPageTypeNomal = 0,
GMWebPageTypeSign = 1, // 签到H5页面
GMWebPageTypeTopicDetail = 2,// 日记贴
GMWebPageTypeAnswer = 3,// 回答
GMWebPageTypeArticle = 4,// 话题
GMWebPageTypeSpecial = 5,// 专栏
GMWebPageTypeUserTopic = 6,// 用户贴
GMWebPageTypeQuestion = 7,// 回答 7.20 灰度用
GMWebPageTypeHospitalRank = 8,// 医院榜单
GMWebPageTypeDoctorRank = 9,// 医生榜单
};
@import GMKit;
@class GMWebViewComponent;
@interface GMBaseWebViewController : WMBaseViewController<GMClientH5BridgeDelegate> {
/**
* @brief 下面都是从js中得到的数据。其中_jsGlobalObject字典包含其它数据
*/
NSDictionary *_jsGlobalObject;
// 是否显示了分享
BOOL _isShowShare;
// 是否收藏
BOOL _isFavored;
// 是否是自己发的贴
BOOL _isPrivate;
// 是否是签到,签到导航栏透明,返回按钮、title颜色、rightIcon单独设置
BOOL _isSign;
}
@property (nonatomic, strong) GMWebViewComponent *webCompent;
/// web上数据处理
@property (nonatomic, strong) GMWebViewModel *viewModel;
/**
* @brief 要请求的 H5 url 除了 http://backend.dev.gengmei.cc/hybrid" 这部分后的path。比如一个h5是 http://backend.dev.gengmei.cc/hybrid/topic/3332214,那么path指需要赋值@"/topic/3332214"即可.
@note 在viewDidLoad前配置好。必须以"/"开头。重写moreQueryParameters可以添加额外query
*/
@property (nonatomic, strong) NSString *path;
/**
* @brief 对于从服务器那儿获取到的完整H5 url,使用该属性。
@note 在viewDidLoad前配置好。会覆盖path属性。重写moreQueryParameters可以添加额外query
*/
@property (nonatomic, strong) NSString *fullURL;
/// 通过webPageType 页面不同设置不同的差异性
@property (nonatomic, assign) GMWebPageType webPageType;
#pragma mark - 分享
@property (nonatomic, strong) GMShareView *shareView;
@property (nonatomic, strong) GMDiaryShareView *diaryShareView;
/*** @brief 收藏url**/
@property (nonatomic,strong) NSString *favUrl;
/*** @brief 从_jsGlobalObject中获取的分享Model */
@property (nonatomic, strong) WMShareObject *shareObject;
/*** @brief 日记分享Model数组 */
@property (nonatomic, strong) NSMutableArray *diaryShareArr;
/*** @brief 微信分享Model */
@property (nonatomic, strong) WMShareObject *weixinShareObject;
/*** @brief 分享的配置 */
@property (nonatomic, strong) GMShareConfigObject *shareConfigObject;
@property (nonatomic , strong) NSString *favorType;
/**
设置打开的权限类型
*/
@property (nonatomic, assign) NSInteger settingType;
@property (nonatomic, assign) BOOL backNeedRefresh;
/**
* @brief 重写该方法,为fullURL在请求前添加更多参数。必须以 & 开头
* 原方法只返回了空字符串,不需要call super
*
* @return 要额外添加的参数。如:&key1=value&key2=value
*/
- (NSString *)moreQueryParameters;
/**
调用该方法以重新构造URL并且[_webView loadRequest:request];
*/
- (void)reloadURL;
/**
处理请求URL
*/
- (void)handleURL;
// 一般情况下 页面刷新时候调用
- (void)refreshWebView;
// 本地获取通用数据
- (NSString *)nativeCommonParam;
@end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//
// GMWebEngine.swift
// GMDoctor
//
// Created by Thierry on 16/6/21.
// Copyright © 2016年 Gengmei. All rights reserved.
//
import Foundation
import WebKit
//import GMUtil
//import EVReflection
class GMWebEngine {
var cookies: [String] = []
weak var webView: WKWebView?
/// WKScriptMessageHandler
/// 添加一个名称,就可以让JS通过这个名称发送消息:valueName自定义名字
/// window.webkit.messageHandlers.valueName.postMessage({body: 'xxx'})
public var scriptMessageHandlerArray: [String] = [String]()
/// 默认最小字体字体
public var minFontSize: CGFloat = 0
/// 显示滚动条
public var isShowScrollIndicator: Bool = true
/// 开启手势交互
public var isAllowsBackForwardGestures: Bool = true
/// 是否允许加载javaScript
public var isjavaScriptEnabled: Bool = true
/// 是否允许JS自动打开窗口的,必须通过用户交互才能打开
public var isAutomaticallyJavaScript: Bool = true
/// 是否影藏进度条
public var isProgressHidden: Bool = false
/// 进度条高度
public var progressHeight: CGFloat = 1
/// 默认颜色
public var progressTrackTintColor: UIColor = UIColor.mainVisual
/// 加载颜色
public var progressTintColor: UIColor = UIColor.mainVisual
init() {
syncCookies()
}
/**
同步Cookie
WKWebView不再和NSURLSession共享Cookie,所以需要手动同步
*/
func syncCookies() {
cookies.removeAll()
for cookie in HTTPCookieStorage.shared.cookies(for: URL(string: GMServerDomains.apiHost)!)! {
let value = "\(cookie.name)=\(cookie.value)"
cookies.append(value)
}
}
/**
构造Ajax Cookie的Script
in 2.3.0
- returns script
*/
func ajaxCookie() -> String {
var source = ""
for cookie in HTTPCookieStorage.shared.cookies(for: URL(string: GMServerDomains.apiHost)!)! {
var string = "\(cookie.name)=\(cookie.value);domain=\(cookie.domain);path=\(cookie.path); expires=\(String(describing: cookie.expiresDate))"
if cookie.isSecure {
string = "\(string);secure=true"
}
source.append("document.cookie='\(string)';")
}
return source
}
func webCookie() -> String {
return cookies.joined(separator: ";")
// let cookieStr = cookies.joined(separator: ";")
// let paraStr = AppDelegate.shareInstance().urlCommonParameters()!.replacingOccurrences(of: "?", with: "")
// return "\(cookieStr);device_info=\(paraStr)"
}
/**
解析全局JS对象
*/
func parseJSPageData(_ complete: @escaping ([String: AnyObject]) -> Void) {
webView?.evaluateJavaScript("window.GLOBAL.pagedata") { (object, error) in
if let data = object as? [String: AnyObject] {
complete(data)
}
debugPrint(error ?? "")
}
}
}
This diff is collapsed.
......@@ -5,7 +5,7 @@
// Created by wangyang on 16/7/8.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
#import "WMBaseViewController.h"
/*** @brief 右按钮的 按钮类型 */
......
//
// WMTagView.swift
// test
//
// Created by wangyang on 15/12/8.
// Copyright © 2015年 Wanmiechuangyi. All rights reserved.
//
import UIKit
import SnapKit
//import GMBaseSwift
/*
高效的,可以在table及collectionView中使用的tagView。
现在用在了日记本卡片中,以保证首页流畅度。其它地方涉及需求时再改动
*/
@objcMembers
class WYTagView: GMView {
/// 在layoutsubview中使用该属性最后设置self的宽度
var maxWidth: CGFloat = Constant.screenWidth
var tapBlock: ((_ index: Int) -> Void)?
var tags: [String] = [] {
didSet {
for (index, view) in self.subviews.enumerated() {
let label = view as! GMLabel
// 如果视图的index超过数据的长度,则隐藏
if index >= tags.count {
label.isHidden = true
} else {
label.isHidden = false
label.text = tags[index]
}
}
}
}
override func layoutSubviews() {
super.layoutSubviews()
// 如果视图的right已经超过最大宽度,则隐藏
for (index, label) in self.subviews.enumerated() where label.frame.maxX > self.maxWidth {
// 经过产品王昕 确认iOS 如果超出显示...
if index > 0 {
label.isHidden = true
} else {
label.width = self.maxWidth
}
}
}
/// 在初始化方法
///
/// - Parameters:
/// - maxWidth: 最大宽度
/// - maxTagCount: 预估的tag label最大个数
/// - tagSpace: tag之间的距离
/// - customLabelUI: 自定义tag label的UI
convenience init(maxWidth: CGFloat, maxTagCount: Int, tagSpace: CGFloat, customLabelUI: ((GMLabel) -> Void)?) {
self.init()
self.maxWidth = maxWidth
// self不剪切,以显示全部的Label内容。见下面label.centerY的约束
clipsToBounds = false
var preLabel: UIView! = nil
for i in 0..<maxTagCount {
let label = GMLabel(frame: CGRect(x: 0, y: 0, width: self.bounds.size.width, height: self.bounds.size.height))
label.textColor = UIColor.mainVisual
label.font = UIFont.gmFont(13)
label.backgroundColor = UIColor.clear
label.layer.masksToBounds = true
addSubview(label)
label.snp.makeConstraints({ (make) in
if i == 0 {
make.left.equalTo(0)
} else {
make.left.equalTo(preLabel.snp.right).offset(tagSpace)
}
make.centerY.equalToSuperview()
})
preLabel = label
customLabelUI?(label)
}
// 点击手势:注意,是加在self上的,而不是每个label一个
let tap = UITapGestureRecognizer(target: self, action: #selector(WYTagView.tapAction(_:)))
addGestureRecognizer(tap)
}
@objc private func tapAction(_ tap: UITapGestureRecognizer) {
// 因为 pointInside:withEvent已经保证了是点击了tagView,那么剩下只需要判断点击的x是在哪个label范围就行了。
// 所以强制生成一个CGPoint(x: point.x, y: 0),只计算x范围
let point = tap.location(in: self)
for (i, view) in self.subviews.enumerated() {
if view.frame.minX < point.x && view.frame.maxX > point.x {
tapBlock?(i)
break
}
}
}
/// 为tag增加一点热区,主要是y方向,并且只在点击到了subview,才算作命中
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
if gm_point(inside: point, with: event) {
for view in self.subviews {
// 视图没有被隐藏,并且在视图的范围内
if !view.isHidden &&
view.frame.minX < point.x && view.frame.maxX > point.x {
return true
}
}
return false
} else {
return false
}
}
}
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