Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMPhobos
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
GMPhobos
Commits
03a1111c
Commit
03a1111c
authored
Oct 15, 2020
by
乔金柱
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jz/master' into 'master'
Jz/master See merge request
!73
parents
59b4d94d
89d6e917
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
GMPhobos.podspec
GMPhobos.podspec
+1
-1
PhobosDevice.h
GMPhobos/Classes/PhobosDevice.h
+6
-0
PhobosDevice.m
GMPhobos/Classes/PhobosDevice.m
+18
-0
No files found.
GMPhobos.podspec
View file @
03a1111c
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
Pod
::
Spec
.
new
do
|
s
|
Pod
::
Spec
.
new
do
|
s
|
s
.
name
=
"
GMPhobos
"
s
.
name
=
"
GMPhobos
"
s
.
version
=
"3.0.
1
"
s
.
version
=
"3.0.
2
"
s
.
summary
=
"GM statistic data sdk"
s
.
summary
=
"GM statistic data sdk"
s
.
description
=
<<-
DESC
s
.
description
=
<<-
DESC
...
...
GMPhobos/Classes/PhobosDevice.h
View file @
03a1111c
...
@@ -7,7 +7,11 @@
...
@@ -7,7 +7,11 @@
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
extern
NSString
*
const
KprivatePolicyNotification
;
typedef
void
(
^
PhobosGetIDFACompleteBlock
)(
NSDictionary
*
dict
);
typedef
void
(
^
PhobosGetIDFACompleteBlock
)(
NSDictionary
*
dict
);
...
@@ -29,6 +33,8 @@ typedef void (^PhobosGetIDFACompleteBlock)(NSDictionary *dict);
...
@@ -29,6 +33,8 @@ typedef void (^PhobosGetIDFACompleteBlock)(NSDictionary *dict);
/// 获取UQID,同步获取取出的是默认第一次的idfv 如果没有用idfv 生成
/// 获取UQID,同步获取取出的是默认第一次的idfv 如果没有用idfv 生成
+
(
NSString
*
)
getUQID
;
+
(
NSString
*
)
getUQID
;
/// 用户是否点击了隐私协议 点击同意之后才会获取 device_id
+
(
BOOL
)
showPrivatePolicy
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
GMPhobos/Classes/PhobosDevice.m
View file @
03a1111c
...
@@ -8,8 +8,10 @@
...
@@ -8,8 +8,10 @@
#import "PhobosDevice.h"
#import "PhobosDevice.h"
#import <AdSupport/ASIdentifierManager.h>
#import <AdSupport/ASIdentifierManager.h>
#import <SAMKeychain/SAMKeychain.h>
#import <SAMKeychain/SAMKeychain.h>
#import <GMCache/GMCache.h>
//#import <AppTrackingTransparency/AppTrackingTransparency.h>
//#import <AppTrackingTransparency/AppTrackingTransparency.h>
NSString
*
const
KprivatePolicyNotification
=
@"gm_popup_private_policy_notification"
;
//钥匙串账户
//钥匙串账户
NSString
*
const
keyChainAccount
=
@"com.wanmeizhensuo.ZhengXing.phobos.keychain"
;
NSString
*
const
keyChainAccount
=
@"com.wanmeizhensuo.ZhengXing.phobos.keychain"
;
//钥匙串账户 表示device_id
//钥匙串账户 表示device_id
...
@@ -25,6 +27,9 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
...
@@ -25,6 +27,9 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
//同步获取IDFA 直接从钥匙串中获取 适配ATTrackingManagerAuthorization可使用下面方法
//同步获取IDFA 直接从钥匙串中获取 适配ATTrackingManagerAuthorization可使用下面方法
+
(
NSString
*
)
getIDFA
{
+
(
NSString
*
)
getIDFA
{
if
(
!
[
PhobosDevice
showPrivatePolicy
])
{
return
defaultIDFA
;
}
//直接从钥匙串中获取
//直接从钥匙串中获取
NSString
*
keyChainIDFA
=
[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
].
UUIDString
;
NSString
*
keyChainIDFA
=
[[
ASIdentifierManager
sharedManager
]
advertisingIdentifier
].
UUIDString
;
if
([
self
checkIdfaIsNull
:
keyChainIDFA
])
{
if
([
self
checkIdfaIsNull
:
keyChainIDFA
])
{
...
@@ -100,12 +105,18 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
...
@@ -100,12 +105,18 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
#pragma mark - getIDFV
#pragma mark - getIDFV
+
(
NSString
*
)
getIDFV
{
+
(
NSString
*
)
getIDFV
{
if
(
!
[
PhobosDevice
showPrivatePolicy
])
{
return
defaultIDFA
;
}
return
[[[
UIDevice
currentDevice
]
identifierForVendor
]
UUIDString
];
return
[[[
UIDevice
currentDevice
]
identifierForVendor
]
UUIDString
];
}
}
#pragma mark - getDEVICEID
#pragma mark - getDEVICEID
+
(
NSString
*
)
getDEVICEID
{
+
(
NSString
*
)
getDEVICEID
{
if
(
!
[
PhobosDevice
showPrivatePolicy
])
{
return
defaultIDFA
;
}
NSString
*
idfa
=
[
self
getIDFA
];
NSString
*
idfa
=
[
self
getIDFA
];
if
([
self
checkIdfaIsNull
:
idfa
])
{
if
([
self
checkIdfaIsNull
:
idfa
])
{
idfa
=
[
self
getUQID
];
idfa
=
[
self
getUQID
];
...
@@ -114,6 +125,9 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
...
@@ -114,6 +125,9 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
}
}
+
(
NSString
*
)
getUQID
{
+
(
NSString
*
)
getUQID
{
if
(
!
[
PhobosDevice
showPrivatePolicy
])
{
return
defaultIDFA
;
}
NSString
*
deviceId
=
[
self
getKeyChainService
:
DEVICEID
account
:
keyChainAccount
];
NSString
*
deviceId
=
[
self
getKeyChainService
:
DEVICEID
account
:
keyChainAccount
];
if
([
self
checkIdfaIsNull
:
deviceId
])
{
if
([
self
checkIdfaIsNull
:
deviceId
])
{
deviceId
=
[
self
getIDFV
];
deviceId
=
[
self
getIDFV
];
...
@@ -133,4 +147,8 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
...
@@ -133,4 +147,8 @@ NSString *defaultIDFA = @"00000000-0000-0000-0000-000000000000";
+
(
NSString
*
)
getKeyChainService
:
(
NSString
*
)
service
account
:
(
NSString
*
)
account
{
+
(
NSString
*
)
getKeyChainService
:
(
NSString
*
)
service
account
:
(
NSString
*
)
account
{
return
[
SAMKeychain
passwordForService
:
service
account
:
account
];
return
[
SAMKeychain
passwordForService
:
service
account
:
account
];
}
}
+
(
BOOL
)
showPrivatePolicy
{
return
[
GMCache
fetchObjectAtDocumentPathWithkey
:
KprivatePolicyNotification
];
}
@end
@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