Commit aedadf30 authored by luyueming's avatar luyueming

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

# Conflicts:
#	GMBase.podspec
冲突
parents 75e54603 dd9033c9
......@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
04393781246AA49D00EAE014 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04393780246AA49D00EAE014 /* File.swift */; };
0AB11836BD16E7A177F2CBDF /* Pods_GMBase_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6E1B1FCE1B7696F7DE8B8E9 /* Pods_GMBase_Example.framework */; };
29C10D9EC61CDA2F6F466BD4 /* Pods_GMBase_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E15FCB251AFC31B335265AF /* Pods_GMBase_Tests.framework */; };
6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
......@@ -40,6 +41,7 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
04393780246AA49D00EAE014 /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
6003F58A195388D20070C39A /* GMBase_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GMBase_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
......@@ -150,6 +152,7 @@
D32ECC461D33946600AEF0D0 /* GMListViewController.h */,
D32ECC471D33946600AEF0D0 /* GMListViewController.m */,
D3EB0CC21D33968300EEDD8B /* GMListViewModel.h */,
04393780246AA49D00EAE014 /* File.swift */,
D3EB0CC31D33968300EEDD8B /* GMListViewModel.m */,
D32ECC411D33840600AEF0D0 /* GMDetailController.h */,
D32ECC421D33840600AEF0D0 /* GMDetailController.m */,
......@@ -225,6 +228,7 @@
6003F587195388D20070C39A /* Frameworks */,
6003F588195388D20070C39A /* Resources */,
20C43A9AD7543F1CB63A4FB9 /* [CP] Embed Pods Frameworks */,
9EF5C8615510ED2B25E84552 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -275,6 +279,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
......@@ -320,8 +325,8 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-GMBase_Example/Pods-GMBase_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
"${BUILT_PRODUCTS_DIR}/GMBase/GMBase.framework",
"${BUILT_PRODUCTS_DIR}/GMCache/GMCache.framework",
"${BUILT_PRODUCTS_DIR}/GMFoundation/GMFoundation.framework",
"${BUILT_PRODUCTS_DIR}/GMHud/GMHud.framework",
"${BUILT_PRODUCTS_DIR}/GMJSONModel/GMJSONModel.framework",
"${BUILT_PRODUCTS_DIR}/GMKit/GMKit.framework",
......@@ -329,16 +334,20 @@
"${BUILT_PRODUCTS_DIR}/GMPhobos/GMPhobos.framework",
"${BUILT_PRODUCTS_DIR}/GMRefresh/GMRefresh.framework",
"${BUILT_PRODUCTS_DIR}/MBProgressHUD/MBProgressHUD.framework",
"${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework",
"${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework",
"${BUILT_PRODUCTS_DIR}/MagicalRecord/MagicalRecord.framework",
"${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework",
"${BUILT_PRODUCTS_DIR}/TMCache/TMCache.framework",
"${BUILT_PRODUCTS_DIR}/UITableView+FDTemplateLayoutCell/UITableView_FDTemplateLayoutCell.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMBase.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMCache.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMFoundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMHud.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMJSONModel.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMKit.framework",
......@@ -346,8 +355,12 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMPhobos.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMRefresh.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MBProgressHUD.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MagicalRecord.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TMCache.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UITableView_FDTemplateLayoutCell.framework",
);
......@@ -374,6 +387,24 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9EF5C8615510ED2B25E84552 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-GMBase_Example/Pods-GMBase_Example-resources.sh",
"${PODS_ROOT}/Weibo_SDK/libWeiboSDK/WeiboSDK.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/WeiboSDK.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-GMBase_Example/Pods-GMBase_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
E11DAE1A31A4A404D5D11E70 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......@@ -401,6 +432,7 @@
files = (
D32ECC481D33946600AEF0D0 /* GMListViewController.m in Sources */,
6003F59E195388D20070C39A /* GMAppDelegate.m in Sources */,
04393781246AA49D00EAE014 /* File.swift in Sources */,
6003F5A7195388D20070C39A /* GMViewController.m in Sources */,
D32ECC431D33840600AEF0D0 /* GMDetailController.m in Sources */,
D3EB0CC41D33968300EEDD8B /* GMListViewModel.m in Sources */,
......@@ -535,6 +567,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "GMBase/GMBase_Example-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$GMBase-Swift.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
WRAPPER_EXTENSION = app;
};
......@@ -556,6 +589,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "GMBase/GMBase_Example-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$GMBase-Swift.h";
WRAPPER_EXTENSION = app;
};
name = Release;
......@@ -564,6 +598,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = E10ABE29C983D16788B32755 /* Pods-GMBase_Tests.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
......@@ -588,6 +623,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 78552CB3DCC72D38AB9DD053 /* Pods-GMBase_Tests.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
......
//
// File.swift
// GMBase_Example
//
// Created by Q14 on 2020/5/12.
// Copyright © 2020 wangyang. All rights reserved.
//
import Foundation
use_frameworks!
inhibit_all_warnings!
platform :ios, '8.0'
platform :ios, '9.0'
#open source
source 'https://github.com/CocoaPods/Specs.git'
#our company
......@@ -8,7 +8,10 @@ source 'git@git.wanmeizhensuo.com:gengmeiios/GMSpecs.git'
target 'GMBase_Example' do
pod 'GMBase', :path => '../'
# 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
inherit! :search_paths
......
......@@ -14,6 +14,9 @@ PODS:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- BDOpenSDKKit (1.0.0)
- DouyinOpenSDK (1.4.1):
- BDOpenSDKKit (~> 1.0.0)
- GMBase (1.1.5):
- GMHud
- GMJSONModel
......@@ -21,65 +24,97 @@ PODS:
- GMNetService
- GMPhobos
- GMRefresh
- GMShareSDK
- MBProgressHUD
- SDWebImage
- "UITableView+FDTemplateLayoutCell (= 1.4)"
- GMCache (1.0.1):
- TMCache (= 2.1.0)
- GMHud (1.0.2):
- GMFoundation (1.0.7)
- GMHud (1.0.3):
- MBProgressHUD (= 0.9.2)
- GMJSONModel (1.7.4)
- GMKit (1.1.4):
- GMKit/Category (= 1.1.4)
- GMKit/Color (= 1.1.4)
- GMKit/Constant (= 1.1.4)
- GMKit/FDFullscreenPopGesture (= 1.1.4)
- GMKit/Kit (= 1.1.4)
- GMKit/Protocol (= 1.1.4)
- GMKit (1.2.6):
- GMKit/Category (= 1.2.6)
- GMKit/Color (= 1.2.6)
- GMKit/Constant (= 1.2.6)
- GMKit/FDFullscreenPopGesture (= 1.2.6)
- GMKit/Kit (= 1.2.6)
- GMKit/Protocol (= 1.2.6)
- Masonry
- SDWebImage
- GMKit/Category (1.1.4):
- GMKit/Color (= 1.1.4)
- GMKit/Constant (= 1.1.4)
- GMKit/Protocol (= 1.1.4)
- SnapKit
- GMKit/Category (1.2.6):
- GMKit/Color (= 1.2.6)
- GMKit/Constant (= 1.2.6)
- GMKit/Protocol (= 1.2.6)
- Masonry
- SDWebImage
- GMKit/Color (1.1.4):
- SnapKit
- GMKit/Color (1.2.6):
- Masonry
- SDWebImage
- GMKit/Constant (1.1.4):
- SnapKit
- GMKit/Constant (1.2.6):
- Masonry
- SDWebImage
- GMKit/FDFullscreenPopGesture (1.1.4):
- SnapKit
- GMKit/FDFullscreenPopGesture (1.2.6):
- Masonry
- SDWebImage
- GMKit/Kit (1.1.4):
- GMKit/Category (= 1.1.4)
- GMKit/Color (= 1.1.4)
- GMKit/Constant (= 1.1.4)
- GMKit/Protocol (= 1.1.4)
- SnapKit
- GMKit/Kit (1.2.6):
- GMKit/Category (= 1.2.6)
- GMKit/Color (= 1.2.6)
- GMKit/Constant (= 1.2.6)
- GMKit/Protocol (= 1.2.6)
- Masonry
- SDWebImage
- GMKit/Protocol (1.1.4):
- SnapKit
- GMKit/Protocol (1.2.6):
- Masonry
- SDWebImage
- SnapKit
- GMNetService (1.0.2):
- AFNetworking (= 3.1.0)
- GMPhobos (1.3.5):
- GMPhobos (2.0.4):
- GMCache
- MagicalRecord
- MJExtension
- GMRefresh (1.0.4):
- GMPhobos
- MJRefresh
- GMShareSDK (0.2.1):
- DouyinOpenSDK (= 1.4.1)
- GMFoundation
- GMJSONModel
- GMKit
- GMRefresh (1.0.2):
- GMPhobos
- Masonry
- MBProgressHUD (= 0.9.2)
- WechatOpenSDK (= 1.8.6.2)
- Weibo_SDK (= 3.2.7)
- MagicalRecord (2.3.2):
- MagicalRecord/Core (= 2.3.2)
- MagicalRecord/Core (2.3.2)
- Masonry (1.1.0)
- MBProgressHUD (0.9.2)
- SDWebImage (5.1.1):
- SDWebImage/Core (= 5.1.1)
- SDWebImage/Core (5.1.1)
- MJExtension (3.2.1)
- MJRefresh (3.4.1)
- SDWebImage (5.7.3):
- SDWebImage/Core (= 5.7.3)
- SDWebImage/Core (5.7.3)
- SnapKit (4.2.0)
- TMCache (2.1.0)
- "UITableView+FDTemplateLayoutCell (1.4)"
- WechatOpenSDK (1.8.6.2)
- Weibo_SDK (3.2.7)
DEPENDENCIES:
- GMBase (from `../`)
- GMFoundation (from `../../GMFoundation`)
- "GMPhobos (from `git@git.wanmeizhensuo.com:gengmeiios/GMPhobos.git`, commit `7e58199898627699373ad6a9f87b875ab04b0927`)"
- GMShareSDK (= 0.2.1)
SPEC REPOS:
"git@git.wanmeizhensuo.com:gengmeiios/GMSpecs.git":
......@@ -88,36 +123,64 @@ SPEC REPOS:
- GMJSONModel
- GMKit
- GMNetService
- GMPhobos
- GMRefresh
- GMShareSDK
https://github.com/CocoaPods/Specs.git:
- AFNetworking
- BDOpenSDKKit
- DouyinOpenSDK
- MagicalRecord
- Masonry
- MBProgressHUD
- MJExtension
- MJRefresh
- SDWebImage
- SnapKit
- TMCache
- "UITableView+FDTemplateLayoutCell"
- WechatOpenSDK
- Weibo_SDK
EXTERNAL SOURCES:
GMBase:
:path: "../"
GMFoundation:
:path: "../../GMFoundation"
GMPhobos:
:commit: 7e58199898627699373ad6a9f87b875ab04b0927
:git: "git@git.wanmeizhensuo.com:gengmeiios/GMPhobos.git"
CHECKOUT OPTIONS:
GMPhobos:
:commit: 7e58199898627699373ad6a9f87b875ab04b0927
:git: "git@git.wanmeizhensuo.com:gengmeiios/GMPhobos.git"
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
GMBase: b747cd3ecd7a5109469113cf48ce04ae6d16cdbe
BDOpenSDKKit: 3fb530ce73f85a7d6ee69e7fd3d9158444c5bd09
DouyinOpenSDK: 5ba83de22963ba7a3ba70c8ff11dfcb2885ecc2b
GMBase: 2f05a06e886f8ea355e6f8be4276b667611140b4
GMCache: b78d8e46db864405e91d226ce640cc80d966c611
GMHud: 45aa755b72a65f89d810430336803086359c0fb1
GMFoundation: 59cdf19ad5bdc479162da975cc739cf5cb418ab6
GMHud: 18d41f4900a204f27be14e9504fcee2060ae3b2c
GMJSONModel: 5e81a98de668e9f93cf6ff77869f77b0d1a806be
GMKit: 11c9ab9a317f381a05b0e1e577dd95a495625edf
GMKit: ff2a77a9b85e13b4de333ec5eeb10b1ffef09756
GMNetService: 7c69e7981b4fac29657fad5fc86a0c453196b862
GMPhobos: 1e2d68c456b69bf156276d7242877498107474db
GMRefresh: 9d2c521e3d49b68d3c736fb138a87fae4adb05f9
GMPhobos: c09920b4a726363b902c2f14ba64e1ee1620d0e2
GMRefresh: c01ff8de5ada92e1362602fb6991f99124b7dbe3
GMShareSDK: a0725e2848d043aec84e787f6d233ac1546c1661
MagicalRecord: 53bed74b4323b930992a725be713e53b37d19755
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1
SDWebImage: 96d7f03415ccb28d299d765f93557ff8a617abd8
MJExtension: 635f2c663dcb1bf76fa4b715b2570a5710aec545
MJRefresh: 3153c59a363159092c08b2177ec3a7d09f90bfaf
SDWebImage: 97351f6582ceca541ea294ba66a1fcb342a331c2
SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
"UITableView+FDTemplateLayoutCell": 234e1582bcc4e18461af91155123bb96538ed030
WechatOpenSDK: 8b3ba4239193d1112205c139c94e21934e8f369a
Weibo_SDK: 5a4d08f7e1fedbb635435e4585c8c0439c7da089
PODFILE CHECKSUM: b9c24bb8fb1ea50b58c59e079b456b4ca1d9b998
PODFILE CHECKSUM: 78c2e567604571069245adf06b4c06623adb32cc
COCOAPODS: 1.9.1
......@@ -19,4 +19,9 @@ Pod::Spec.new do |s|
s.dependency 'GMKit'
s.dependency 'SDWebImage'
s.dependency 'SnapKit','4.2.0'
s.dependency 'GMShareSDK'
s.swift_version = '4.2'
s.static_framework = true
end
//
// 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.
//
// GMCommonAlertView.swift
// Gengmei
//
// Created by Terminator on 2017/7/5.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
import UIKit
import GMKit
//TODO: 待考虑 SNAPKIT
@objc protocol GMCommonAlertViewDelegate: class {
func didClickCommonAlert(buttonIndex: Int, alertView: GMCommonAlertView)
}
class GMCommonAlertView: GMView {
let alertView = GMView()
let titleLabel = GMLabel(textColor: UIColor.headlineText, fontSize: 16)
let subLabel = GMLabel(textColor: UIColor.auxiliaryTextLight, fontSize: 14)
var button1 = GMGradualButton()
var button2: GMButton!
var button3: GMButton!
weak var delegate: GMCommonAlertViewDelegate?
override func setup() {
super.setup()
setupSubviews()
}
private func setupSubviews() {
backgroundColor = UIColor.black.withAlphaComponent(0.6)
addSubview(alertView)
alertView.backgroundColor = UIColor.white
alertView.layer.cornerRadius = 10
alertView.layer.masksToBounds = true
// alertView.snp.makeConstraints { (make) in
// make.centerY.equalToSuperview()
// make.centerX.equalToSuperview()
// make.size.equalTo(CGSize(width: 270, height: 280))
// }
let headerImage = GMImageView(image: UIImage(named: "notify_bell"))
addSubview(headerImage)
// headerImage.snp.makeConstraints { (make) in
// make.centerX.equalToSuperview()
// make.top.equalTo(alertView.snp.top).offset(-38)
// }
titleLabel.text = "打开推送通知"
alertView.addSubview(titleLabel)
// titleLabel.snp.makeConstraints { (make) in
// make.centerX.equalToSuperview()
// make.top.equalTo(70)
// }
subLabel.text = "第一时间接受TA的日记更新?"
alertView.addSubview(subLabel)
// subLabel.snp.makeConstraints { (make) in
// make.centerX.equalToSuperview()
// make.top.equalTo(titleLabel.snp.bottom).offset(5)
// }
button1.setTitleColor(UIColor.white, for: UIControl.State.normal)
button1.setTitle("确定打开", for: UIControl.State.normal)
button1.gradualColor = [UIColor(hex: 0x51D3E7), UIColor(hex: 0x3BE7DA)]
button1.layer.cornerRadius = 20
button1.layer.masksToBounds = true
button1.titleLabel?.font = UIFont.gmFont(16)
button1.tag = 1001
button1.addTarget(self, action: #selector(GMCommonAlertView.buttonTapAction(_:)), for: UIControl.Event.touchUpInside)
alertView.addSubview(button1)
// button1.snp.makeConstraints { (make) in
// make.centerX.equalToSuperview()
// make.top.equalTo(subLabel.snp.bottom).offset(15)
// make.size.equalTo(CGSize(width: 200, height: 40))
// }
// button1.setGradualChangeColor(colors: [UIColor(hex: 0x23E3E1), UIColor(hex: 0x2CD7E6)])
button2 = addButtonWith("不用打开", backgroundColor: UIColor.clear, titleColor: UIColor.mainVisual, borderColor: UIColor.mainVisual)
button2.addTarget(self, action: #selector(GMCommonAlertView.buttonTapAction(_:)), for: UIControl.Event.touchUpInside)
button2.tag = 1002
button2.titleLabel?.font = UIFont.gmFont(16)
alertView.addSubview(button2)
// button2.snp.makeConstraints { (make) in
// make.centerX.equalToSuperview()
// make.top.equalTo(button1.snp.bottom).offset(15)
// make.size.equalTo(CGSize(width: 200, height: 40))
// }
button3 = addButtonWith("不再提醒", backgroundColor: UIColor.clear, titleColor: UIColor.auxiliaryTextLight, borderColor: UIColor.clear)
button3.addTarget(self, action: #selector(GMCommonAlertView.buttonTapAction(_:)), for: UIControl.Event.touchUpInside)
button3.tag = 1003
alertView.addSubview(button3)
button3.titleLabel?.font = UIFont.gmFont(14)
// button3.snp.makeConstraints { (make) in
// make.centerX.equalToSuperview()
// make.top.equalTo(button2.snp.bottom).offset(10)
// make.size.equalTo(CGSize(width: 200, height: 30))
// }
}
// MARK: - 添加button
private func addButtonWith(_ title: String, backgroundColor: UIColor, titleColor: UIColor, borderColor: UIColor) -> GMButton {
let button = GMButton(title: title, backgroundColor: backgroundColor, titleFontSize: 14, titleColor: titleColor)
button.layer.cornerRadius = 20
button.layer.borderWidth = 0.5
button.layer.borderColor = borderColor.cgColor
button.layer.masksToBounds = true
return button
}
@objc func buttonTapAction(_ sender: GMButton) {
let index = sender.tag - 1000
delegate?.didClickCommonAlert(buttonIndex: index, alertView: self)
}
@objc func show() {
UIApplication.shared.keyWindow?.addSubview(self)
// self.snp.makeConstraints { (make) in
// make.edges.equalTo(UIEdgeInsets.zero)
// }
}
@objc func dismiss() {
self.perform(#selector(removeFromSuperview))
}
}
//
// GMGradualButton.swift
// Gengmei
//
// Created by Terminator on 2017/7/12.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
import UIKit
@objcMembers
open class GMGradualButton: GMButton {
// 如果gradualColor 和 disableColor同时有值,他们的count要是一样的
var gradualColor = [UIColor]()
var disableColor = [UIColor]()
var intriSize = CGSize.zero
override open var intrinsicContentSize: CGSize {
intriSize = super.intrinsicContentSize
if gradualColor.count > 0 {
setBackgroundImage(setGradualChangeColor(colors: gradualColor), for: .normal)
}
if disableColor.count > 0 {
setBackgroundImage(setGradualChangeColor(colors: disableColor), for: .disabled)
}
return intriSize
}
private func setGradualChangeColor(colors: [UIColor]) -> UIImage? {
let cfColors = colors.map { $0.cgColor }
UIGraphicsBeginImageContextWithOptions(super.intrinsicContentSize, true, 0)
let context = UIGraphicsGetCurrentContext()
let colorSpace = CGColorSpaceCreateDeviceRGB()
let gradient = CGGradient(colorsSpace: colorSpace, colors: cfColors as CFArray, locations: nil)
let start = CGPoint(x: self.intriSize.width, y: 0)
let end = CGPoint(x: 0, y: self.intriSize.height)
context?.drawLinearGradient(gradient!, start: start, end: end, options: [.drawsBeforeStartLocation, .drawsAfterEndLocation])
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
}
//
// 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.
//
// GMWebViewModel.h
// Gengmei
//
// Created by MoMo on 2019/12/12.
// Copyright © 2019 更美互动信息科技有限公司. All rights reserved.
//
#import "WMFetchDataViewModel.h"
/** webView 相关数据 */
NS_ASSUME_NONNULL_BEGIN
@interface GMWebViewModel : WMFetchDataViewModel
/// 问题页,置顶回答id
@property (nonatomic, copy) NSString *top_answer_id;
/** 回复问题id */
@property (nonatomic, copy) NSString *questionId;
/** 视频Token */
@property (nonatomic, copy) NSString *videoToken;
@end
NS_ASSUME_NONNULL_END
//
// GMWebViewModel.m
// Gengmei
//
// Created by MoMo on 2019/12/12.
// Copyright © 2019 更美互动信息科技有限公司. All rights reserved.
//
#import "GMWebViewModel.h"
@implementation GMWebViewModel
@end
//
// UIViewController+UrlScheme.h
// Gengmei
//
// Created by Thierry on 4/21/15.
// Copyright (c) 2015 Wanmeichuangyi. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIViewController (UrlScheme)
/**
区域埋点字段
*/
@property (nonatomic, strong) NSDictionary *referDict;
@end
NS_ASSUME_NONNULL_END
//
// UIViewController+UrlScheme.m
// Gengmei
//
// Created by Thierry on 4/21/15.
// Copyright (c) 2015 Wanmeichuangyi. All rights reserved.
//
#import <objc/runtime.h>
#import "UIViewController+UrlScheme.h"
@implementation UIViewController (UrlScheme)
#pragma mark -------------------
- (void)setReferDict:(NSDictionary *)referDict {
objc_setAssociatedObject(self, @selector(referDict), referDict, OBJC_ASSOCIATION_RETAIN);
}
- (NSDictionary *)referDict {
return objc_getAssociatedObject(self, @selector(referDict));
}
@end
//
// WMBaseViewController+OCNavigationBar.h
// Gengmei
//
// Created by wangyang on 16/7/8.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
/*** @brief 右按钮的 按钮类型 */
typedef NS_ENUM(NSUInteger, OCBarButtonImageType){
/*** @brief 默认没有右按钮*/
OCBarButtonImageTypeDefault = 0,
/*** @brief 图片分享按钮 */
OCBarButtonImageTypeShare = 1,
/*** @brief 写新日记 */
OCBarButtonImageTypeDiary,
/*** @brief 搜索按钮。如果是继承于WMBaseViewController,这个option的action不需要单独实现,在base中已经实现了 */
OCBarButtonImageTypeSearch,
/*** @brief 分享返现,具体方法没有实现,请在子类中实现*/
OCBarButtonImageTypeShareCashback,
/*** @brief 客服,请在子类中实现*/
OCBarButtonImageTypeCustomerServices,
};
@interface WMBaseViewController (OCNavigationBar)
/**
* @brief 设置导航栏 左边默认是返回按钮
*
* @param title 导航tilte
* @param rightTitle 右边文字型的按钮
*/
- (void)setNavigateTitle:(NSString *)title rightButtonTitle:(NSString *)rightButtonTitle;
/**
* @brief 设置导航栏 左边默认是返回按钮
*
* @param title 导航tilte
* @param rightButton 右边是图片型的按钮
*/
- (void)setNavigateTitle:(NSString *)title rightButtonOption:(OCBarButtonImageType)rightButtonOption;
/**
* @brief 当右侧是标题按钮时,设置右侧标题按钮不同状态下的色值
* @param normalColor 常态下色值
* @param highlightColor 高亮下色值
* @param disableColor 失效下色值
*/
- (void)setRightTitleNormalColor:(UIColor *)normalColor highlightColor:(UIColor *)highlightColor disableColor:(UIColor *)disableColor;
/**
* @author wangyang
*
* 通过此方法可以返回一个rightButton图片名,用于navigationBar.rightIcon
*/
- (NSString *)navigationBarIconFromType:(OCBarButtonImageType)type;
@end
//
// WMBaseViewController+OCNavigationBar.m
// Gengmei
//
// Created by wangyang on 16/7/8.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
#import "WMBaseViewController.h"
#import "WMBaseViewController+OCNavigationBar.h"
@implementation WMBaseViewController (OCNavigationBar)
- (void)setNavigateTitle:(NSString *)title rightButtonTitle:(NSString *)rightButtonTitle{
self.navigationBar.title = title;
self.navigationBar.rightTitle = rightButtonTitle;
}
- (void)setNavigateTitle:(NSString *)title rightButtonOption:(OCBarButtonImageType)rightButtonOption{
self.navigationBar.title = title;
self.navigationBar.rightIcon = [self navigationBarIconFromType:rightButtonOption];
}
- (NSString *)navigationBarIconFromType:(OCBarButtonImageType)type {
switch (type) {
case OCBarButtonImageTypeShare:
return @"share";
case OCBarButtonImageTypeDiary:
return @"write";
case OCBarButtonImageTypeSearch:
return @"search_green";
case OCBarButtonImageTypeShareCashback:
return @"share_cashback";
case OCBarButtonImageTypeCustomerServices:
return @"customer_service";
default:
return @"";
}
}
- (void)setRightTitleNormalColor:(UIColor *)normalColor highlightColor:(UIColor *)highlightColor disableColor:(UIColor *)disableColor{
if (normalColor) {
[self.navigationBar.rightButton setTitleColor:normalColor forState:UIControlStateNormal];
}
if (highlightColor) {
[self.navigationBar.rightButton setTitleColor:normalColor forState:UIControlStateHighlighted];
}
if (disableColor) {
[self.navigationBar.rightButton setTitleColor:normalColor forState:UIControlStateDisabled];
}
}
@end
//
// WMBaseViewController+OCNavigationBar.h
// Gengmei
//
// Created by wangyang on 16/7/8.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
/*** @brief 右按钮的 按钮类型 */
typedef NS_ENUM(NSUInteger, OCBarButtonImageType){
/*** @brief 默认没有右按钮*/
OCBarButtonImageTypeDefault = 0,
/*** @brief 图片分享按钮 */
OCBarButtonImageTypeShare = 1,
/*** @brief 写新日记 */
OCBarButtonImageTypeDiary,
/*** @brief 搜索按钮。如果是继承于WMBaseViewController,这个option的action不需要单独实现,在base中已经实现了 */
OCBarButtonImageTypeSearch,
/*** @brief 分享返现,具体方法没有实现,请在子类中实现*/
OCBarButtonImageTypeShareCashback,
/*** @brief 客服,请在子类中实现*/
OCBarButtonImageTypeCustomerServices,
};
@interface WMBaseViewController (OCNavigationBar)
/**
* @brief 设置导航栏 左边默认是返回按钮
*
* @param title 导航tilte
* @param rightTitle 右边文字型的按钮
*/
- (void)setNavigateTitle:(NSString *)title rightButtonTitle:(NSString *)rightButtonTitle;
/**
* @brief 设置导航栏 左边默认是返回按钮
*
* @param title 导航tilte
* @param rightButton 右边是图片型的按钮
*/
- (void)setNavigateTitle:(NSString *)title rightButtonOption:(OCBarButtonImageType)rightButtonOption;
/**
* @brief 当右侧是标题按钮时,设置右侧标题按钮不同状态下的色值
* @param normalColor 常态下色值
* @param highlightColor 高亮下色值
* @param disableColor 失效下色值
*/
- (void)setRightTitleNormalColor:(UIColor *)normalColor highlightColor:(UIColor *)highlightColor disableColor:(UIColor *)disableColor;
/**
* @author wangyang
*
* 通过此方法可以返回一个rightButton图片名,用于navigationBar.rightIcon
*/
- (NSString *)navigationBarIconFromType:(OCBarButtonImageType)type;
@end
//
// WMBaseViewController+OCNavigationBar.m
// Gengmei
//
// Created by wangyang on 16/7/8.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
#import "WMBaseViewController+OCNavigationBar.h"
@implementation WMBaseViewController (OCNavigationBar)
- (void)setNavigateTitle:(NSString *)title rightButtonTitle:(NSString *)rightButtonTitle{
self.navigationBar.title = title;
self.navigationBar.rightTitle = rightButtonTitle;
}
- (void)setNavigateTitle:(NSString *)title rightButtonOption:(OCBarButtonImageType)rightButtonOption{
self.navigationBar.title = title;
self.navigationBar.rightIcon = [self navigationBarIconFromType:rightButtonOption];
}
- (NSString *)navigationBarIconFromType:(OCBarButtonImageType)type {
switch (type) {
case OCBarButtonImageTypeShare:
return @"share";
case OCBarButtonImageTypeDiary:
return @"write";
case OCBarButtonImageTypeSearch:
return @"search_green";
case OCBarButtonImageTypeShareCashback:
return @"share_cashback";
case OCBarButtonImageTypeCustomerServices:
return @"customer_service";
default:
return @"";
}
}
- (void)setRightTitleNormalColor:(UIColor *)normalColor highlightColor:(UIColor *)highlightColor disableColor:(UIColor *)disableColor{
if (normalColor) {
[self.navigationBar.rightButton setTitleColor:normalColor forState:UIControlStateNormal];
}
if (highlightColor) {
[self.navigationBar.rightButton setTitleColor:normalColor forState:UIControlStateHighlighted];
}
if (disableColor) {
[self.navigationBar.rightButton setTitleColor:normalColor forState:UIControlStateDisabled];
}
}
@end
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