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
63e9013a
Commit
63e9013a
authored
Apr 26, 2020
by
汪洋
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wy/daka'
parents
87bfdd09
38424173
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
10 deletions
+73
-10
GMShareView.h
GMShareSDK/Classes/Share/GMShareView.h
+3
-1
GMShareView.m
GMShareSDK/Classes/Share/GMShareView.m
+20
-4
GMShareSDK.m
GMShareSDK/Classes/ShareSDK/GMShareSDK.m
+50
-5
No files found.
GMShareSDK/Classes/Share/GMShareView.h
View file @
63e9013a
...
...
@@ -49,6 +49,8 @@
/** 取消分享 */
-
(
void
)
cancleShareView
;
-
(
void
)
shareViewDidClose
;
@end
...
...
@@ -128,5 +130,5 @@
-
(
void
)
shareWithType
:(
GMSharePlatform
)
type
;
@property
(
nonatomic
,
strong
)
WMShareObject
*
shareObject
;
@property
(
nonatomic
,
assign
)
BOOL
onlyShareImage
;
@end
GMShareSDK/Classes/Share/GMShareView.m
View file @
63e9013a
...
...
@@ -159,7 +159,7 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
if
(
!
_showCancelFollow
)
{
[
_titleArray
removeObject
:
@"取消关注"
];
[
_imageArray
removeObject
:
@"
quxiaoguanzhu
"
];
[
_imageArray
removeObject
:
@"
cancel_follow
"
];
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformCancelFollow
)];
}
...
...
@@ -196,14 +196,13 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
[
_imageArray
removeObject
:
@"share_qq"
];
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformQQFriend
)];
}
if
(
!
_shareObject
.
qqzone
.
title
.
isNonEmpty
||
((
!
_shareObject
.
qqzone
.
content
.
isNonEmpty
)
&&
_shareObject
!=
nil
)
||
!
[
QQApiInterface
isQQInstalled
])
{
[
_titleArray
removeObject
:
@"QQ空间"
];
[
_imageArray
removeObject
:
@"share_qq_space"
];
[
_shareTypeArray
removeObject
:
@
(
GMSharePlatformQQSpace
)];
}
if
((
_shareObject
.
douyin
==
nil
&&
_shareObject
!=
nil
)
||
!
[
DouyinOpenSDKApi
isAppInstalled
])
{
[
_titleArray
removeObject
:
@"抖音"
];
[
_imageArray
removeObject
:
@"share_douyin"
];
...
...
@@ -238,6 +237,20 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
}
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
{
...
...
@@ -513,6 +526,9 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
self
.
backgroundColor
=
[
UIColor
colorWithRed
:
0
green
:
0
blue
:
0
alpha
:
0
];
}
completion
:^
(
BOOL
finished
)
{
[
self
removeFromSuperview
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
shareViewDidClose
)])
{
[
self
.
delegate
shareViewDidClose
];
}
}];
}
...
...
GMShareSDK/Classes/ShareSDK/GMShareSDK.m
View file @
63e9013a
...
...
@@ -136,22 +136,39 @@
}
switch
(
platformType
)
{
case
GMSharePlatformQQFriend
:{
[
self
QQFriendShareWithParameters
:
parameters
];
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
QQFriendShareWithParameters
:
parameters
];
}
[
self
shareWithName
:
kQQShare
onStateChanged
:
stateChangedHandler
];
}
break
;
case
GMSharePlatformQQSpace
:{
[
self
QQSpaceShareWithParameters
:
parameters
];
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
QQSpaceShareWithParameters
:
parameters
];
}
[
self
shareWithName
:
kQQShare
onStateChanged
:
stateChangedHandler
];
break
;
}
case
GMSharePlatformWechatSession
:{
[
self
wechatSessionShareWithParameters
:
parameters
scene
:
WXSceneSession
];
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
wechatSessionShareWithParameters
:
parameters
scene
:
WXSceneSession
];
}
[
self
shareWithName
:
kWechatShare
onStateChanged
:
stateChangedHandler
];
break
;
}
case
GMSharePlatformWechatTimeline
:{
[
self
wechatSessionShareWithParameters
:
parameters
scene
:
WXSceneTimeline
];
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
wechatSessionShareWithParameters
:
parameters
scene
:
WXSceneTimeline
];
}
[
self
shareWithName
:
kWechatShare
onStateChanged
:
stateChangedHandler
];
break
;
}
...
...
@@ -171,7 +188,11 @@
break
;
}
case
GMSharePlatformSinaWeibo
:{
[
self
weiboShareWithParameters
:
parameters
];
if
(
parameters
[
@"onlyImage"
])
{
[[
GMShareSDK
shareInstance
]
shareImage
:
parameters
[
@"image"
]
platform
:
platformType
];
}
else
{
[
self
weiboShareWithParameters
:
parameters
];
}
[
self
shareWithName
:
kSinaShare
onStateChanged
:
stateChangedHandler
];
break
;
}
...
...
@@ -203,6 +224,10 @@
[
self
QQFriendShareWithImage
:
image
];
}
break
;
case
GMSharePlatformQQSpace
:
{
[
self
QZoneShareWithImage
:
image
];
}
break
;
case
GMSharePlatformWechatSession
:
{
[
self
wechatImageShareWithParameters
:@{
@"images"
:
image
}
scene
:
WXSceneSession
];
...
...
@@ -242,6 +267,26 @@
[
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
{
id
image
=
parameters
[
@"images"
];
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