Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
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
mobile-group
galaxy-iOS
Commits
a01c6733
Commit
a01c6733
authored
May 09, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分享逻辑添加
parent
2fc86ec0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
18 deletions
+44
-18
YHShareManager.swift
galaxy/galaxy/Classes/Tools/Analytics/YHShareManager.swift
+44
-18
No files found.
galaxy/galaxy/Classes/Tools/Analytics/YHShareManager.swift
View file @
a01c6733
...
@@ -16,68 +16,94 @@ class YHShareManager: NSObject {
...
@@ -16,68 +16,94 @@ class YHShareManager: NSObject {
extension
YHShareManager
{
extension
YHShareManager
{
func
sendTextContect
(
_
text
:
String
)
{
func
sendTextContect
(
_
text
:
String
)
{
var
req
=
SendMessageToWXReq
()
let
req
=
SendMessageToWXReq
()
req
.
bText
=
true
req
.
bText
=
true
req
.
text
=
text
req
.
text
=
text
req
.
scene
=
Int32
(
scene
.
rawValue
)
req
.
scene
=
Int32
(
scene
.
rawValue
)
WXApi
.
send
(
req
)
WXApi
.
send
(
req
)
{
flag
in
if
!
flag
{
YHHUD
.
flash
(
message
:
"分享失败"
)
}
}
}
}
func
sendLinkContent
(
_
title
:
String
=
""
,
_
description
:
String
=
""
,
_
image
:
UIImage
=
UIImage
(),
link
:
String
)
{
func
sendLinkContent
(
_
title
:
String
=
""
,
_
description
:
String
=
""
,
_
image
:
UIImage
=
UIImage
(),
link
:
String
)
{
var
message
=
WXMediaMessage
()
let
message
=
WXMediaMessage
()
message
.
title
=
title
message
.
title
=
title
message
.
description
=
description
message
.
description
=
description
message
.
setThumbImage
(
image
)
let
width
=
240.0
as
CGFloat
let
height
=
width
*
image
.
size
.
height
/
image
.
size
.
width
UIGraphicsBeginImageContext
(
CGSizeMake
(
width
,
height
))
image
.
draw
(
in
:
CGRectMake
(
0
,
0
,
width
,
height
))
message
.
setThumbImage
(
UIGraphicsGetImageFromCurrentImageContext
()
??
UIImage
())
UIGraphicsEndImageContext
()
var
ext
=
WXWebpageObject
()
let
ext
=
WXWebpageObject
()
ext
.
webpageUrl
=
link
ext
.
webpageUrl
=
link
message
.
mediaObject
=
ext
message
.
mediaObject
=
ext
var
req
=
SendMessageToWXReq
()
let
req
=
SendMessageToWXReq
()
req
.
bText
=
false
req
.
bText
=
false
req
.
message
=
message
req
.
message
=
message
req
.
scene
=
Int32
(
scene
.
rawValue
)
req
.
scene
=
Int32
(
scene
.
rawValue
)
WXApi
.
send
(
req
)
WXApi
.
send
(
req
)
{
flag
in
if
!
flag
{
YHHUD
.
flash
(
message
:
"分享失败"
)
}
}
}
}
func
sendVideoContent
(
_
title
:
String
=
""
,
_
description
:
String
=
""
,
_
image
:
UIImage
=
UIImage
(),
link
:
String
)
{
func
sendVideoContent
(
_
title
:
String
=
""
,
_
description
:
String
=
""
,
_
image
:
UIImage
=
UIImage
(),
link
:
String
)
{
var
message
=
WXMediaMessage
()
let
message
=
WXMediaMessage
()
message
.
title
=
title
message
.
title
=
title
message
.
description
=
description
message
.
description
=
description
message
.
setThumbImage
(
image
)
let
width
=
240.0
as
CGFloat
let
height
=
width
*
image
.
size
.
height
/
image
.
size
.
width
UIGraphicsBeginImageContext
(
CGSizeMake
(
width
,
height
))
image
.
draw
(
in
:
CGRectMake
(
0
,
0
,
width
,
height
))
message
.
setThumbImage
(
UIGraphicsGetImageFromCurrentImageContext
()
??
UIImage
())
UIGraphicsEndImageContext
()
var
ext
=
WXVideoObject
()
let
ext
=
WXVideoObject
()
ext
.
videoUrl
=
link
ext
.
videoUrl
=
link
message
.
mediaObject
=
ext
message
.
mediaObject
=
ext
var
req
=
SendMessageToWXReq
()
let
req
=
SendMessageToWXReq
()
req
.
bText
=
false
req
.
bText
=
false
req
.
message
=
message
req
.
message
=
message
req
.
scene
=
Int32
(
scene
.
rawValue
)
req
.
scene
=
Int32
(
scene
.
rawValue
)
WXApi
.
send
(
req
)
WXApi
.
send
(
req
)
{
flag
in
if
!
flag
{
YHHUD
.
flash
(
message
:
"分享失败"
)
}
}
}
}
func
sendImageContent
(
_
image
:
UIImage
)
{
func
sendImageContent
(
_
image
:
UIImage
)
{
var
message
=
WXMediaMessage
()
let
message
=
WXMediaMessage
()
//发送的图片
//发送的图片
var
imageObject
=
WXImageObject
()
let
imageObject
=
WXImageObject
()
imageObject
.
imageData
=
image
.
pngData
()
??
Data
()
imageObject
.
imageData
=
image
.
pngData
()
??
Data
()
message
.
mediaObject
=
imageObject
message
.
mediaObject
=
imageObject
//图片缩略图
//图片缩略图
var
width
=
240.0
as
CGFloat
let
width
=
240.0
as
CGFloat
var
height
=
width
*
image
.
size
.
height
/
image
.
size
.
width
let
height
=
width
*
image
.
size
.
height
/
image
.
size
.
width
UIGraphicsBeginImageContext
(
CGSizeMake
(
width
,
height
))
UIGraphicsBeginImageContext
(
CGSizeMake
(
width
,
height
))
image
.
draw
(
in
:
CGRectMake
(
0
,
0
,
width
,
height
))
image
.
draw
(
in
:
CGRectMake
(
0
,
0
,
width
,
height
))
message
.
setThumbImage
(
UIGraphicsGetImageFromCurrentImageContext
()
??
UIImage
())
message
.
setThumbImage
(
UIGraphicsGetImageFromCurrentImageContext
()
??
UIImage
())
UIGraphicsEndImageContext
()
UIGraphicsEndImageContext
()
var
req
=
SendMessageToWXReq
()
let
req
=
SendMessageToWXReq
()
req
.
bText
=
false
req
.
bText
=
false
req
.
message
=
message
req
.
message
=
message
req
.
scene
=
Int32
(
scene
.
rawValue
)
req
.
scene
=
Int32
(
scene
.
rawValue
)
WXApi
.
send
(
req
)
WXApi
.
send
(
req
)
{
flag
in
if
!
flag
{
YHHUD
.
flash
(
message
:
"分享失败"
)
}
}
}
}
}
}
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