Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMBase
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMBase
Commits
06ac613e
Commit
06ac613e
authored
Jul 12, 2016
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将埋点属性拆出扩展
parent
b01766cd
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
101 additions
and
83 deletions
+101
-83
GMListViewController.m
Example/GMBase/GMListViewController.m
+1
-0
GMViewController.m
Example/GMBase/GMViewController.m
+0
-1
Podfile.lock
Example/Podfile.lock
+2
-2
GMBase.podspec.json
Example/Pods/Local Podspecs/GMBase.podspec.json
+2
-2
Manifest.lock
Example/Pods/Manifest.lock
+2
-2
project.pbxproj
Example/Pods/Pods.xcodeproj/project.pbxproj
+0
-0
GMBase-umbrella.h
Example/Pods/Target Support Files/GMBase/GMBase-umbrella.h
+1
-0
Info.plist
Example/Pods/Target Support Files/GMBase/Info.plist
+1
-1
UIViewController+Phobos.h
GMBase/Classes/UIViewController+Phobos.h
+40
-0
UIViewController+Phobos.m
GMBase/Classes/UIViewController+Phobos.m
+51
-0
WMBaseViewController.h
GMBase/Classes/WMBaseViewController.h
+1
-30
WMBaseViewController.m
GMBase/Classes/WMBaseViewController.m
+0
-45
No files found.
Example/GMBase/GMListViewController.m
View file @
06ac613e
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
}
}
-
(
void
)
viewDidLoad
{
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
super
viewDidLoad
];
NSLog
(
@"%@"
,
self
.
referer
);
self
.
navigationBar
.
title
=
@"列表"
;
self
.
navigationBar
.
title
=
@"列表"
;
self
.
navigationBar
.
rightTitle
=
@"没什么用"
;
self
.
navigationBar
.
rightTitle
=
@"没什么用"
;
_table
.
separatorStyle
=
UITableViewCellSeparatorStyleSingleLine
;
_table
.
separatorStyle
=
UITableViewCellSeparatorStyleSingleLine
;
...
...
Example/GMBase/GMViewController.m
View file @
06ac613e
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
[
super
viewDidLoad
];
[
super
viewDidLoad
];
self
.
pageName
=
@"yw"
;
self
.
pageName
=
@"yw"
;
self
.
title
=
@"你好"
;
self
.
title
=
@"你好"
;
NSLog
(
@"%@"
,
self
.
referer
);
}
}
-
(
void
)
didReceiveMemoryWarning
-
(
void
)
didReceiveMemoryWarning
...
...
Example/Podfile.lock
View file @
06ac613e
...
@@ -14,7 +14,7 @@ PODS:
...
@@ -14,7 +14,7 @@ PODS:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/Serialization (3.1.0)
- AFNetworking/UIKit (3.1.0):
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- AFNetworking/NSURLSession
- GMBase (0.0.
1
):
- GMBase (0.0.
2
):
- GMNetService (= 0.1.3)
- GMNetService (= 0.1.3)
- GMPhobos (= 0.2.8)
- GMPhobos (= 0.2.8)
- GMRefresh (= 0.1.3)
- GMRefresh (= 0.1.3)
...
@@ -46,7 +46,7 @@ EXTERNAL SOURCES:
...
@@ -46,7 +46,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
GMBase:
831023e2846dde63903f80bffbed12d1607b16d4
GMBase:
241736988ce4b6f5677c917d973aedd3d6403daf
GMCache: a7b06a2d8a5a1c7cf023055c631ba9a0cd7c39fc
GMCache: a7b06a2d8a5a1c7cf023055c631ba9a0cd7c39fc
GMNetService: 2eb74ed62512078e9f00bc7006227a93c2acdf32
GMNetService: 2eb74ed62512078e9f00bc7006227a93c2acdf32
GMPhobos: 9f046f82fa806bc21cde83732fb411edac0b3d20
GMPhobos: 9f046f82fa806bc21cde83732fb411edac0b3d20
...
...
Example/Pods/Local Podspecs/GMBase.podspec.json
View file @
06ac613e
{
{
"name"
:
"GMBase"
,
"name"
:
"GMBase"
,
"version"
:
"0.0.
1
"
,
"version"
:
"0.0.
2
"
,
"summary"
:
"更美iOS APP 的 Objective-C 基础Pod库"
,
"summary"
:
"更美iOS APP 的 Objective-C 基础Pod库"
,
"homepage"
:
"http://git.gengmei.cc/gengmeiios/GMBase"
,
"homepage"
:
"http://git.gengmei.cc/gengmeiios/GMBase"
,
"license"
:
"仅限北京更美互动信息科技有限公司内部使用"
,
"license"
:
"仅限北京更美互动信息科技有限公司内部使用"
,
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
},
},
"source"
:
{
"source"
:
{
"git"
:
"http://git.gengmei.cc/gengmeiios/GMBase.git"
,
"git"
:
"http://git.gengmei.cc/gengmeiios/GMBase.git"
,
"tag"
:
"0.0.
1
"
"tag"
:
"0.0.
2
"
},
},
"platforms"
:
{
"platforms"
:
{
"ios"
:
"8.0"
"ios"
:
"8.0"
...
...
Example/Pods/Manifest.lock
View file @
06ac613e
...
@@ -14,7 +14,7 @@ PODS:
...
@@ -14,7 +14,7 @@ PODS:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/Serialization (3.1.0)
- AFNetworking/UIKit (3.1.0):
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- AFNetworking/NSURLSession
- GMBase (0.0.
1
):
- GMBase (0.0.
2
):
- GMNetService (= 0.1.3)
- GMNetService (= 0.1.3)
- GMPhobos (= 0.2.8)
- GMPhobos (= 0.2.8)
- GMRefresh (= 0.1.3)
- GMRefresh (= 0.1.3)
...
@@ -46,7 +46,7 @@ EXTERNAL SOURCES:
...
@@ -46,7 +46,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
GMBase:
831023e2846dde63903f80bffbed12d1607b16d4
GMBase:
241736988ce4b6f5677c917d973aedd3d6403daf
GMCache: a7b06a2d8a5a1c7cf023055c631ba9a0cd7c39fc
GMCache: a7b06a2d8a5a1c7cf023055c631ba9a0cd7c39fc
GMNetService: 2eb74ed62512078e9f00bc7006227a93c2acdf32
GMNetService: 2eb74ed62512078e9f00bc7006227a93c2acdf32
GMPhobos: 9f046f82fa806bc21cde83732fb411edac0b3d20
GMPhobos: 9f046f82fa806bc21cde83732fb411edac0b3d20
...
...
Example/Pods/Pods.xcodeproj/project.pbxproj
View file @
06ac613e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Example/Pods/Target Support Files/GMBase/GMBase-umbrella.h
View file @
06ac613e
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#import "OCEmptyView.h"
#import "OCEmptyView.h"
#import "OCNavigatioinBar.h"
#import "OCNavigatioinBar.h"
#import "UIViewController+HUD.h"
#import "UIViewController+HUD.h"
#import "UIViewController+Phobos.h"
#import "WMBaseListViewController.h"
#import "WMBaseListViewController.h"
#import "WMBaseViewController.h"
#import "WMBaseViewController.h"
#import "WMFetchDataViewModel.h"
#import "WMFetchDataViewModel.h"
...
...
Example/Pods/Target Support Files/GMBase/Info.plist
View file @
06ac613e
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
FMWK
<
/string
>
<
string
>
FMWK
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
0.0.
1
<
/string
>
<
string
>
0.0.
2
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
...
...
GMBase/Classes/UIViewController+Phobos.h
0 → 100644
View file @
06ac613e
//
// UIViewController+Phobos.h
// Pods
//
// Created by wangyang on 16/7/12.
//
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface
UIViewController
(
Phobos
)
/**
* @author 翟国钧, 16-02-24 17:02:22
*
* @brief 埋点的时候,有些埋点都需要业务id,比如DoctorId,针对那些只能在父类中埋点的业务,要在子类中设置当前id,然后在父类中取到
* 在一些详情页的分享和收藏的时候,由于分享、收藏的方法在basewebview里,所以,统一在里面做处理,但是需要在子类中把想要的参数传过去。包括:type(类型)、from(来自哪)、businessId(对应业务id)
* @since 5.9.1
*/
@property
(
nonatomic
,
copy
,
nonnull
)
NSString
*
businessId
;
/**
* @author 翟国钧 in 16-02-25 19:02:32
*
* @brief 获取前一个页面的pageName
*
* @since 5.9.1
*/
@property
(
nonatomic
,
strong
,
readonly
,
nonnull
)
NSString
*
referer
;
/**
* @author 翟国钧 in 16-02-25 19:02:32
*
* 埋点pv事件中当前页面的别名
* @since 5.9.1
*/
@property
(
nonatomic
,
copy
,
nonnull
)
NSString
*
pageName
;
@end
NS_ASSUME_NONNULL_END
\ No newline at end of file
GMBase/Classes/UIViewController+Phobos.m
0 → 100644
View file @
06ac613e
//
// UIViewController+Phobos.m
// Pods
//
// Created by wangyang on 16/7/12.
//
//
#import "UIViewController+Phobos.h"
#import <objc/runtime.h>
@implementation
UIViewController
(
Phobos
)
/**
* @author 翟国钧, 16-03-01 15:03:24
*
* @brief 取当前导航栈中当前VC的上级VC,如果该VC存在,就获取他的pageName
*
* @return 前一页的pageName
*
* @since 5.9.1
*/
-
(
NSString
*
)
referer
{
NSArray
*
navigationPool
=
self
.
navigationController
.
viewControllers
;
NSInteger
refererIndex
=
navigationPool
.
count
-
2
;
if
(
refererIndex
<
0
)
{
return
@""
;
}
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
return
controller
.
pageName
==
nil
?
@""
:
controller
.
pageName
;
}
-
(
NSString
*
)
pageName
{
NSString
*
name
=
objc_getAssociatedObject
(
self
,
@selector
(
pageName
));
return
name
==
nil
?
@""
:
name
;
}
-
(
void
)
setPageName
:
(
NSString
*
)
pageName
{
objc_setAssociatedObject
(
self
,
@selector
(
pageName
),
pageName
,
OBJC_ASSOCIATION_COPY
);
}
-
(
NSString
*
)
businessId
{
NSString
*
businessId
=
objc_getAssociatedObject
(
self
,
@selector
(
businessId
));
return
businessId
==
nil
?
@""
:
businessId
;
}
-
(
void
)
setBusinessId
:
(
NSString
*
)
businessId
{
objc_setAssociatedObject
(
self
,
@selector
(
businessId
),
businessId
,
OBJC_ASSOCIATION_COPY
);
}
@end
GMBase/Classes/WMBaseViewController.h
View file @
06ac613e
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import "OCNavigatioinBar.h"
#import "OCNavigatioinBar.h"
#import "UIViewController+HUD.h"
#import "UIViewController+HUD.h"
#import "UIViewController+Phobos.h"
@interface
WMBaseViewController
:
UIViewController
<
OCNavigatioinBarDelegate
>
@interface
WMBaseViewController
:
UIViewController
<
OCNavigatioinBarDelegate
>
@property
(
nonatomic
,
strong
)
OCNavigatioinBar
*
navigationBar
;
@property
(
nonatomic
,
strong
)
OCNavigatioinBar
*
navigationBar
;
...
@@ -18,33 +19,3 @@
...
@@ -18,33 +19,3 @@
-
(
void
)
initController
__attribute__
((
objc_requires_super
));
-
(
void
)
initController
__attribute__
((
objc_requires_super
));
-
(
void
)
pushViewController
:(
UIViewController
*
)
controller
;
-
(
void
)
pushViewController
:(
UIViewController
*
)
controller
;
@end
@end
#pragma mark - 埋点
@interface
UIViewController
(
Phobos
)
/**
* @author 翟国钧, 16-02-24 17:02:22
*
* @brief 埋点的时候,有些埋点都需要业务id,比如DoctorId,针对那些只能在父类中埋点的业务,要在子类中设置当前id,然后在父类中取到
* 在一些详情页的分享和收藏的时候,由于分享、收藏的方法在basewebview里,所以,统一在里面做处理,但是需要在子类中把想要的参数传过去。包括:type(类型)、from(来自哪)、businessId(对应业务id)
* @since 5.9.1
*/
@property
(
nonatomic
,
copy
)
NSString
*
businessId
;
/**
* @author 翟国钧 in 16-02-25 19:02:32
*
* @brief 获取前一个页面的pageName
*
* @since 5.9.1
*/
@property
(
nonatomic
,
strong
,
readonly
)
NSString
*
referer
;
/**
* @author 翟国钧 in 16-02-25 19:02:32
*
* 埋点pv事件中当前页面的别名
* @since 5.9.1
*/
@property
(
nonatomic
,
copy
)
NSString
*
pageName
;
@end
GMBase/Classes/WMBaseViewController.m
View file @
06ac613e
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
#import "WMBaseViewController.h"
#import "WMBaseViewController.h"
#import "GMBaseUtil.h"
#import "GMBaseUtil.h"
#import <GMPhobos/Phobos.h>
#import <GMPhobos/Phobos.h>
#import <objc/runtime.h>
@interface
WMBaseViewController
()
{
@interface
WMBaseViewController
()
{
}
}
...
@@ -45,9 +44,6 @@
...
@@ -45,9 +44,6 @@
}
}
-
(
void
)
initController
{
-
(
void
)
initController
{
self
.
pageName
=
@""
;
self
.
businessId
=
@""
;
// 在 initController 中初始化自定义导航栏有很大好处。至少可以保证视图被push之前就可以访问navigationBar,以配置title等属性
// 在 initController 中初始化自定义导航栏有很大好处。至少可以保证视图被push之前就可以访问navigationBar,以配置title等属性
[
self
customNavigationBar
];
[
self
customNavigationBar
];
}
}
...
@@ -159,44 +155,3 @@
...
@@ -159,44 +155,3 @@
}
}
}
}
@end
@end
#pragma mark - 埋点
@implementation
UIViewController
(
Phobos
)
/**
* @author 翟国钧, 16-03-01 15:03:24
*
* @brief 取当前导航栈中当前VC的上级VC,如果该VC存在,就获取他的pageName
*
* @return 前一页的pageName
*
* @since 5.9.1
*/
-
(
NSString
*
)
referer
{
NSArray
*
navigationPool
=
self
.
navigationController
.
viewControllers
;
NSInteger
refererIndex
=
navigationPool
.
count
-
2
;
if
(
refererIndex
<
0
)
{
return
@""
;
}
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
return
controller
.
pageName
==
nil
?
@""
:
controller
.
pageName
;
}
-
(
NSString
*
)
pageName
{
NSString
*
name
=
objc_getAssociatedObject
(
self
,
@selector
(
pageName
));
return
name
==
nil
?
@""
:
name
;
}
-
(
void
)
setPageName
:
(
NSString
*
)
pageName
{
objc_setAssociatedObject
(
self
,
@selector
(
pageName
),
pageName
,
OBJC_ASSOCIATION_COPY
);
}
-
(
NSString
*
)
businessId
{
return
objc_getAssociatedObject
(
self
,
@selector
(
businessId
));
}
-
(
void
)
setBusinessId
:
(
NSString
*
)
businessId
{
objc_setAssociatedObject
(
self
,
@selector
(
businessId
),
businessId
,
OBJC_ASSOCIATION_COPY
);
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment