Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
GMShareSDK
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMShareSDK
Commits
40120c0f
Commit
40120c0f
authored
Apr 23, 2020
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
针对打卡添加相关逻辑
parent
18b8bdd4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
4 deletions
+62
-4
GMShareView.h
GMShareSDK/Classes/Share/GMShareView.h
+1
-1
GMShareView.m
GMShareSDK/Classes/Share/GMShareView.m
+16
-3
GMShareSDK.m
GMShareSDK/Classes/ShareSDK/GMShareSDK.m
+45
-0
No files found.
GMShareSDK/Classes/Share/GMShareView.h
View file @
40120c0f
...
@@ -128,5 +128,5 @@
...
@@ -128,5 +128,5 @@
-
(
void
)
shareWithType
:(
GMSharePlatform
)
type
;
-
(
void
)
shareWithType
:(
GMSharePlatform
)
type
;
@property
(
nonatomic
,
strong
)
WMShareObject
*
shareObject
;
@property
(
nonatomic
,
strong
)
WMShareObject
*
shareObject
;
@property
(
nonatomic
,
assign
)
BOOL
onlyShareImage
;
@end
@end
GMShareSDK/Classes/Share/GMShareView.m
View file @
40120c0f
...
@@ -159,7 +159,7 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
...
@@ -159,7 +159,7 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
if
(
!
_showCancelFollow
)
{
if
(
!
_showCancelFollow
)
{
[
_titleArray
removeObject
:
@"取消关注"
];
[
_titleArray
removeObject
:
@"取消关注"
];
[
_imageArray
removeObject
:
@"
quxiaoguanzhu
"
];
[
_imageArray
removeObject
:
@"
cancel_follow
"
];
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformCancelFollow
)];
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformCancelFollow
)];
}
}
...
@@ -197,13 +197,12 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
...
@@ -197,13 +197,12 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformQQFriend
)];
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformQQFriend
)];
}
}
if
(
!
_shareObject
.
qqzone
.
title
.
isNonEmpty
||
((
!
_shareObject
.
qqzone
.
content
.
isNonEmpty
)
&&
_shareObject
!=
nil
)
||
!
[
QQApiInterface
isQQInstalled
])
{
if
(
!
_shareObject
.
qqzone
.
title
.
isNonEmpty
||
((
!
_shareObject
.
qqzone
.
content
.
isNonEmpty
)
&&
_shareObject
!=
nil
)
||
!
[
QQApiInterface
isQQInstalled
])
{
[
_titleArray
removeObject
:
@"QQ空间"
];
[
_titleArray
removeObject
:
@"QQ空间"
];
[
_imageArray
removeObject
:
@"share_qq_space"
];
[
_imageArray
removeObject
:
@"share_qq_space"
];
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformQQSpace
)];
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformQQSpace
)];
}
}
if
((
_shareObject
.
douyin
==
nil
&&
_shareObject
!=
nil
)
||
!
[
DouyinOpenSDKApi
isAppInstalled
])
{
if
((
_shareObject
.
douyin
==
nil
&&
_shareObject
!=
nil
)
||
!
[
DouyinOpenSDKApi
isAppInstalled
])
{
[
_titleArray
removeObject
:
@"抖音"
];
[
_titleArray
removeObject
:
@"抖音"
];
[
_imageArray
removeObject
:
@"share_douyin"
];
[
_imageArray
removeObject
:
@"share_douyin"
];
...
@@ -238,6 +237,20 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
...
@@ -238,6 +237,20 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
}
}
make
.
top
.
mas_equalTo
(
_shareCollectionView
).
offset
(
217
/
2
.
0
);
make
.
top
.
mas_equalTo
(
_shareCollectionView
).
offset
(
217
/
2
.
0
);
}];
}];
if
(
self
.
onlyShareImage
)
{
[
_titleArray
addObject
:
@"QQ"
];
[
_imageArray
addObject
:
@"share_qq"
];
[
_shareTypeArray
addObject
:
@
(
GMSharePlatformQQFriend
)];
[
_titleArray
addObject
:
@"QQ空间"
];
[
_imageArray
addObject
:
@"share_qq_space"
];
[
_shareTypeArray
addObject
:
@
(
GMSharePlatformQQSpace
)];
[
_titleArray
removeObject
:
@"抖音"
];
[
_imageArray
removeObject
:
@"share_douyin"
];
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformDouyin
)];
}
}
}
-
(
void
)
updateConstraints
{
-
(
void
)
updateConstraints
{
...
...
GMShareSDK/Classes/ShareSDK/GMShareSDK.m
View file @
40120c0f
...
@@ -136,22 +136,39 @@
...
@@ -136,22 +136,39 @@
}
}
switch
(
platformType
)
{
switch
(
platformType
)
{
case
GMSharePlatformQQFriend
:{
case
GMSharePlatformQQFriend
:{
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
QQFriendShareWithParameters
:
parameters
];
[
self
QQFriendShareWithParameters
:
parameters
];
}
[
self
shareWithName
:
kQQShare
onStateChanged
:
stateChangedHandler
];
[
self
shareWithName
:
kQQShare
onStateChanged
:
stateChangedHandler
];
}
}
break
;
break
;
case
GMSharePlatformQQSpace
:{
case
GMSharePlatformQQSpace
:{
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
QQSpaceShareWithParameters
:
parameters
];
[
self
QQSpaceShareWithParameters
:
parameters
];
}
[
self
shareWithName
:
kQQShare
onStateChanged
:
stateChangedHandler
];
[
self
shareWithName
:
kQQShare
onStateChanged
:
stateChangedHandler
];
break
;
break
;
}
}
case
GMSharePlatformWechatSession
:{
case
GMSharePlatformWechatSession
:{
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
wechatSessionShareWithParameters
:
parameters
scene
:
WXSceneSession
];
[
self
wechatSessionShareWithParameters
:
parameters
scene
:
WXSceneSession
];
}
[
self
shareWithName
:
kWechatShare
onStateChanged
:
stateChangedHandler
];
[
self
shareWithName
:
kWechatShare
onStateChanged
:
stateChangedHandler
];
break
;
break
;
}
}
case
GMSharePlatformWechatTimeline
:{
case
GMSharePlatformWechatTimeline
:{
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
wechatSessionShareWithParameters
:
parameters
scene
:
WXSceneTimeline
];
[
self
wechatSessionShareWithParameters
:
parameters
scene
:
WXSceneTimeline
];
}
[
self
shareWithName
:
kWechatShare
onStateChanged
:
stateChangedHandler
];
[
self
shareWithName
:
kWechatShare
onStateChanged
:
stateChangedHandler
];
break
;
break
;
}
}
...
@@ -171,7 +188,11 @@
...
@@ -171,7 +188,11 @@
break
;
break
;
}
}
case
GMSharePlatformSinaWeibo
:{
case
GMSharePlatformSinaWeibo
:{
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
weiboShareWithParameters
:
parameters
];
[
self
weiboShareWithParameters
:
parameters
];
}
[
self
shareWithName
:
kSinaShare
onStateChanged
:
stateChangedHandler
];
[
self
shareWithName
:
kSinaShare
onStateChanged
:
stateChangedHandler
];
break
;
break
;
}
}
...
@@ -203,6 +224,10 @@
...
@@ -203,6 +224,10 @@
[
self
QQFriendShareWithImage
:
image
];
[
self
QQFriendShareWithImage
:
image
];
}
}
break
;
break
;
case
GMSharePlatformQQSpace
:
{
[
self
QZoneShareWithImage
:
image
];
}
break
;
case
GMSharePlatformWechatSession
:
{
case
GMSharePlatformWechatSession
:
{
[
self
wechatImageShareWithParameters
:@{
@"images"
:
image
}
scene
:
WXSceneSession
];
[
self
wechatImageShareWithParameters
:@{
@"images"
:
image
}
scene
:
WXSceneSession
];
...
@@ -242,6 +267,26 @@
...
@@ -242,6 +267,26 @@
[
self
handleSendResult
:
sent
];
[
self
handleSendResult
:
sent
];
}
}
/// QQ 空间分享图片
-
(
void
)
QZoneShareWithImage
:
(
UIImage
*
)
image
{
NSData
*
imageData
=
UIImagePNGRepresentation
(
image
);
//如果图片大于10M 需要对图片压缩 不然分享不出去 微信qq 要求图片在10m 以内
if
(
imageData
.
length
>
(
10
*
1024
*
1024
))
{
imageData
=
UIImageJPEGRepresentation
(
image
,
0
.
1
);
}
else
if
(
imageData
.
length
>
(
1024
*
1024
))
{
imageData
=
UIImageJPEGRepresentation
(
image
,
0
.
6
);
}
QQApiImageArrayForQZoneObject
*
imgObj
=
[[
QQApiImageArrayForQZoneObject
alloc
]
initWithImageArrayData
:@[
imageData
]
title
:
nil
extMap
:
nil
];
// QQApiImageObject *imgObj = [QQApiImageObject objectWithData:imageData previewImageData:nil title:@"更美app" description:@"我是图片"];
SendMessageToQQReq
*
req
=
[
SendMessageToQQReq
reqWithContent
:
imgObj
];
imgObj
.
shareDestType
=
ShareDestTypeQQ
;
QQApiSendResultCode
sent
=
[
QQApiInterface
sendReq
:
req
];
[
self
handleSendResult
:
sent
];
}
-
(
void
)
QQFriendShareWithParameters
:
(
NSDictionary
*
)
parameters
{
-
(
void
)
QQFriendShareWithParameters
:
(
NSDictionary
*
)
parameters
{
id
image
=
parameters
[
@"images"
];
id
image
=
parameters
[
@"images"
];
UIImage
*
thumbImage
=
image
;
UIImage
*
thumbImage
=
image
;
...
...
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