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
0c93289e
Commit
0c93289e
authored
Feb 08, 2017
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
使用GMPhobos3.0
parent
cc5f889c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
96 additions
and
156 deletions
+96
-156
Podfile.lock
Example/Podfile.lock
+2
-2
Phobos.h
Example/Pods/GMPhobos/Pod/Classes/Phobos.h
+25
-21
Phobos.m
Example/Pods/GMPhobos/Pod/Classes/Phobos.m
+0
-0
PhobosUtil.h
Example/Pods/GMPhobos/Pod/Classes/PhobosUtil.h
+4
-0
PhobosUtil.m
Example/Pods/GMPhobos/Pod/Classes/PhobosUtil.m
+60
-0
UIViewController+Phobos.h
Example/Pods/GMPhobos/Pod/Classes/UIViewController+Phobos.h
+0
-51
UIViewController+Phobos.m
Example/Pods/GMPhobos/Pod/Classes/UIViewController+Phobos.m
+0
-78
Manifest.lock
Example/Pods/Manifest.lock
+2
-2
project.pbxproj
Example/Pods/Pods.xcodeproj/project.pbxproj
+0
-0
GMPhobos-umbrella.h
...le/Pods/Target Support Files/GMPhobos/GMPhobos-umbrella.h
+2
-1
Info.plist
Example/Pods/Target Support Files/GMPhobos/Info.plist
+1
-1
No files found.
Example/Podfile.lock
View file @
0c93289e
...
...
@@ -35,7 +35,7 @@ PODS:
- GMNetService (0.1.4):
- AFNetworking (= 3.1.0)
- GMOCConstant (0.0.3)
- GMPhobos (0.
2.24
):
- GMPhobos (0.
3.0
):
- GMCache (~> 0.1.1)
- GMKit
- GMRefresh (0.1.5):
...
...
@@ -66,7 +66,7 @@ SPEC CHECKSUMS:
GMKit: 04a30d67c6b5468f07c8d9f60d0f8b12dd90b162
GMNetService: 4f900345322a1f0f3269fc7edb1cb04dd81a5511
GMOCConstant: 39371248b4d8d54929391bfcd2c5883776436c4b
GMPhobos:
8d98e2480d078b6336340e612f5c786537ff2f70
GMPhobos:
1f5ab50a8879e014e92e2b270d40ffa6113e4044
GMRefresh: b9f0674b9b14c533ec2586147ea40a833ed5867d
JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c
Masonry: a1a931a0d08870ed8ae415a2ea5ea68ebcac77df
...
...
Example/Pods/GMPhobos/Pod/Classes/Phobos.h
View file @
0c93289e
...
...
@@ -7,12 +7,11 @@
//
#import <Foundation/Foundation.h>
#import "PhobosPVProtocol.h"
#import <CoreLocation/CLLocation.h>
@interface
Phobos
:
NSObject
@property
(
strong
,
nonatomic
)
UINavigationController
*
selectedNavigationController
;
/**
* @brief 开启Phobos统计,默认以BATCH方式发送log.
*
...
...
@@ -30,6 +29,17 @@
+
(
void
)
setSharedClient
:(
Phobos
*
)
client
;
#pragma mark - SDK配置
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
@property
(
nonatomic
,
copy
)
void
(
^
captureNullExpection
)
(
NSString
*
eventId
,
NSDictionary
*
info
);
/**
网络状态 wifi=1, mobile=0, 不连通=-1
*/
@property
(
nonatomic
,
copy
)
NSString
*
netStatus
;
/**
* @brief 设置是否打印sdk的log信息,默认不开启
*
...
...
@@ -37,7 +47,7 @@
*
* @since 0.0.1
*/
-
(
void
)
setLogEnabled
:(
BOOL
)
value
;
@property
(
assign
,
nonatomic
)
BOOL
logEnabled
;
/**
* @brief 设置当前登录用户的ID,如果没有默认为@""
...
...
@@ -46,7 +56,7 @@
*
* @since 0.0.2
*/
-
(
void
)
setUserId
:(
NSInteger
)
userId
;
@property
(
assign
,
nonatomic
)
NSInteger
userId
;
/*!
* @author zhaiguojun, 16-05-31
...
...
@@ -57,9 +67,11 @@
*
* @since 0.2.7
*/
-
(
void
)
setCurrentCityId
:(
NSString
*
)
currentCityId
;
@property
(
strong
,
nonatomic
)
NSString
*
currentCityId
;
@property
(
strong
,
nonatomic
)
CLLocation
*
gps
;
-
(
void
)
setGPS
:(
NSDictionary
*
)
gps
;
#pragma mark - 事件采集
/**
* @brief 自定义事件,数量统计.
...
...
@@ -73,6 +85,7 @@
+
(
void
)
track
:(
NSString
*
)
eventId
attributes
:(
NSDictionary
*
)
attributes
;
+
(
void
)
track
:(
NSString
*
)
eventId
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
;
+
(
void
)
track
:(
NSString
*
)
eventId
;
/**
* @author 翟国钧, 16-02-03 16:02:30
*
...
...
@@ -85,22 +98,13 @@
+
(
void
)
trackJsEvent
:(
NSString
*
)
jsonString
;
/**
* @brief 当页面加载时的PV处理
*
* @param pageName 页面唯一编码
* @param businessId 页面中的业务ID,比如美购详情页美购ID
* @param refererPageName 目标页面的上一个页面的pageName
*
* @since 0.0.8
* @brief PV事件开始。当controller viewWillAppear时调用
*/
-
(
void
)
onPageStart
:(
NSString
*
)
pageName
businessId
:(
NSString
*
)
businessId
referer
:(
NSString
*
)
refererPageName
inTime
:(
NSString
*
)
time
;
-
(
void
)
onPVStart
:(
UIResponder
<
PhobosPVProtocol
>
*
)
page
;
/**
* @brief 当页面结束时的PV处理,在此方法中记录当前页面的停留时间和记录本次埋点事件
*
* @since 0.0.8
* @brief PV事件结束。当controller viewWillDisAppear时调用
*/
-
(
void
)
onP
ageEnd
:(
NSString
*
)
pageName
businessId
:(
NSString
*
)
businessId
referer
:(
NSString
*
)
refererPageName
inTime
:(
NSString
*
)
time
referrerId
:
(
NSString
*
)
referrerId
;
-
(
void
)
onP
VEnd
:(
UIResponder
<
PhobosPVProtocol
>
*
)
page
;
/**
* @author 翟国钧, 16-03-08 11:03:45
...
...
@@ -113,6 +117,6 @@
*
* @since 5.9.1
*/
-
(
void
)
simulativeP
ageViewEventWithPageName
:(
NSString
*
)
pageName
B
usinessId
:(
NSString
*
)
bid
referer
:(
NSString
*
)
referer
;
-
(
void
)
simulativeP
V
:(
NSString
*
)
pageName
b
usinessId
:(
NSString
*
)
bid
referer
:(
NSString
*
)
referer
;
@end
Example/Pods/GMPhobos/Pod/Classes/Phobos.m
View file @
0c93289e
This diff is collapsed.
Click to expand it.
Example/Pods/GMPhobos/Pod/Classes/PhobosUtil.h
View file @
0c93289e
...
...
@@ -32,4 +32,8 @@ typedef void (^SendDataSuccessBlock)(NSInteger code);
*/
+
(
void
)
sendData
:(
NSData
*
)
data
success
:(
SendDataSuccessBlock
)
success
;
+
(
NSString
*
)
currentTime
;
+
(
NSString
*
)
getAppVersion
;
+
(
BOOL
)
isNonEmpty
:(
NSString
*
)
string
;
+
(
NSData
*
)
encodeJSON
:(
id
)
obj
;
@end
Example/Pods/GMPhobos/Pod/Classes/PhobosUtil.m
View file @
0c93289e
...
...
@@ -122,4 +122,64 @@
}
}
/**
* @brief 将对象转成JSON格式数据
*
* @param obj
*
* @return
*
* @since 0.0.1
*/
+
(
NSData
*
)
encodeJSON
:(
id
)
obj
{
NSData
*
data
=
[
NSJSONSerialization
dataWithJSONObject
:
obj
options
:
0
error
:
nil
];
return
data
;
}
/**
* @brief 获取当前时间的毫秒数
*
* @return
*
* @since 0.0.1
*/
+
(
NSString
*
)
currentTime
{
NSDate
*
date
=
[
NSDate
date
];
NSTimeInterval
interval
=
[
date
timeIntervalSince1970
];
NSString
*
timeIntervalStr
=
[
NSString
stringWithFormat
:
@"%ld"
,(
long
)
interval
];
return
timeIntervalStr
;
}
/**
* @brief 获取当前APP的版本号
*
* @return
*
* @since 0.0.1
*/
+
(
NSString
*
)
getAppVersion
{
NSString
*
buildVersion
=
[[[
NSBundle
mainBundle
]
infoDictionary
]
objectForKey
:
@"CFBundleShortVersionString"
];
if
(
buildVersion
)
{
return
buildVersion
;
}
else
{
return
@""
;
}
}
+
(
BOOL
)
isNonEmpty
:
(
NSString
*
)
string
{
if
(
!
string
)
{
return
NO
;
}
NSMutableCharacterSet
*
emptyStringSet
=
[[
NSMutableCharacterSet
alloc
]
init
];
[
emptyStringSet
formUnionWithCharacterSet
:
[
NSCharacterSet
whitespaceAndNewlineCharacterSet
]];
[
emptyStringSet
formUnionWithCharacterSet
:
[
NSCharacterSet
characterSetWithCharactersInString
:
@" "
]];
if
([
string
length
]
==
0
)
{
return
NO
;
}
NSString
*
str
=
[
string
stringByTrimmingCharactersInSet
:
emptyStringSet
];
return
[
str
length
]
>
0
;
}
@end
Example/Pods/GMPhobos/Pod/Classes/UIViewController+Phobos.h
deleted
100644 → 0
View file @
cc5f889c
//
// UIViewController+Phobos.h
// Pods
//
// Created by wangyang on 16/7/12.
//
//
#import <UIKit/UIKit.h>
@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
,
copy
,
nonnull
)
NSString
*
referer
;
/**
* @author 翟国钧 in 16-02-25 19:02:32
*
* 埋点pv事件中当前页面的别名
* @since 5.9.1
*/
@property
(
nonatomic
,
copy
,
nonnull
)
NSString
*
pageName
;
/**
当前VC.view 显示的时候的时间戳
@author zhaiguojun 16-10-12 in (null)
*/
@property
(
nonatomic
,
copy
,
nonnull
)
NSString
*
inTime
;
/**
<#Description#>
*/
@property
(
nonatomic
,
copy
,
nonnull
)
NSString
*
referrerId
;
@end
Example/Pods/GMPhobos/Pod/Classes/UIViewController+Phobos.m
deleted
100644 → 0
View file @
cc5f889c
//
// 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
*/
-
(
void
)
setReferer
:(
NSString
*
)
referer
{
NSArray
*
navigationPool
=
self
.
navigationController
.
viewControllers
;
NSInteger
refererIndex
=
navigationPool
.
count
-
2
;
if
(
refererIndex
<
0
)
{
return
;
}
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
controller
.
pageName
,
OBJC_ASSOCIATION_COPY
);
}
-
(
NSString
*
)
referer
{
NSString
*
referer
=
objc_getAssociatedObject
(
self
,
@selector
(
referer
));
return
referer
==
nil
?
@""
:
referer
;
}
-
(
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
);
}
-
(
void
)
setInTime
:
(
NSString
*
)
inTime
{
objc_setAssociatedObject
(
self
,
@selector
(
inTime
),
inTime
,
OBJC_ASSOCIATION_COPY
);
}
/**
这个地方inTime的值为nil的情况不做考虑,因为Phobos不会发送
*/
-
(
NSString
*
)
inTime
{
NSString
*
inTime
=
objc_getAssociatedObject
(
self
,
@selector
(
inTime
));
return
inTime
;
}
-
(
void
)
setReferrerId
:
(
NSString
*
)
referrerId
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
referrerId
,
OBJC_ASSOCIATION_COPY
);
}
-
(
NSString
*
)
referrerId
{
NSString
*
referrerId
=
objc_getAssociatedObject
(
self
,
@selector
(
referrerId
));
return
referrerId
==
nil
?
@""
:
referrerId
;
}
@end
Example/Pods/Manifest.lock
View file @
0c93289e
...
...
@@ -35,7 +35,7 @@ PODS:
- GMNetService (0.1.4):
- AFNetworking (= 3.1.0)
- GMOCConstant (0.0.3)
- GMPhobos (0.
2.24
):
- GMPhobos (0.
3.0
):
- GMCache (~> 0.1.1)
- GMKit
- GMRefresh (0.1.5):
...
...
@@ -66,7 +66,7 @@ SPEC CHECKSUMS:
GMKit: 04a30d67c6b5468f07c8d9f60d0f8b12dd90b162
GMNetService: 4f900345322a1f0f3269fc7edb1cb04dd81a5511
GMOCConstant: 39371248b4d8d54929391bfcd2c5883776436c4b
GMPhobos:
8d98e2480d078b6336340e612f5c786537ff2f70
GMPhobos:
1f5ab50a8879e014e92e2b270d40ffa6113e4044
GMRefresh: b9f0674b9b14c533ec2586147ea40a833ed5867d
JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c
Masonry: a1a931a0d08870ed8ae415a2ea5ea68ebcac77df
...
...
Example/Pods/Pods.xcodeproj/project.pbxproj
View file @
0c93289e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Example/Pods/Target Support Files/GMPhobos/GMPhobos-umbrella.h
View file @
0c93289e
...
...
@@ -4,8 +4,9 @@
#import "Phobos.h"
#import "PhobosConfig.h"
#import "PhobosPVProtocol.h"
#import "PhobosUtil.h"
#import "UI
ViewController+Phobos
.h"
#import "UI
Responder+PhobosPV
.h"
FOUNDATION_EXPORT
double
GMPhobosVersionNumber
;
FOUNDATION_EXPORT
const
unsigned
char
GMPhobosVersionString
[];
...
...
Example/Pods/Target Support Files/GMPhobos/Info.plist
View file @
0c93289e
...
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
FMWK
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
0.
2.24
<
/string
>
<
string
>
0.
3.0
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
...
...
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