Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
d40e5d15
提交
d40e5d15
authored
9月 18, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
local image supported when sharing on iOS
上级
3e7159a1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
57 行增加
和
1 行删除
+57
-1
FluwxShareHandler.m
ios/Classes/handler/FluwxShareHandler.m
+57
-1
没有找到文件。
ios/Classes/handler/FluwxShareHandler.m
浏览文件 @
d40e5d15
...
@@ -67,7 +67,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -67,7 +67,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
if
([
imagePath
hasPrefix
:
SCHEMA_ASSETS
])
{
if
([
imagePath
hasPrefix
:
SCHEMA_ASSETS
])
{
[
self
shareAssetImage
:
call
result
:
result
imagePath
:
imagePath
];
[
self
shareAssetImage
:
call
result
:
result
imagePath
:
imagePath
];
}
else
if
([
imagePath
hasPrefix
:
SCHEMA_FILE
])
{
}
else
if
([
imagePath
hasPrefix
:
SCHEMA_FILE
])
{
[
self
shareLocalImage
:
call
result
:
result
imagePath
:
imagePath
];
}
else
{
}
else
{
[
self
shareNetworkImage
:
call
result
:
result
imagePath
:
imagePath
];
[
self
shareNetworkImage
:
call
result
:
result
imagePath
:
imagePath
];
}
}
...
@@ -117,6 +117,52 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -117,6 +117,52 @@ NSObject <FlutterPluginRegistrar> *_registrar;
}
}
-
(
void
)
shareLocalImage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
imagePath
:(
NSString
*
)
imagePath
{
NSString
*
thumbnail
=
call
.
arguments
[
fluwxKeyThumbnail
];
if
([
StringUtil
isBlank
:
thumbnail
])
{
thumbnail
=
imagePath
;
}
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
0
,
0
);
dispatch_async
(
globalQueue
,
^
{
// NSURL *imageURL = [NSURL URLWithString:imagePath];
NSUInteger
startIndex
=
SCHEMA_FILE
.
length
;
// int startIndex = SCHEMA_FILE.e
NSString
*
imagePathWithoutUri
=
[
imagePath
substringFromIndex
:
startIndex
];
//下载图片
NSData
*
imageData
=
[
NSData
dataWithContentsOfFile
:
imagePathWithoutUri
];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendImageData
:
imageData
TagName
:
call
.
arguments
[
fluwxKeyMediaTagName
]
MessageExt:
call
.
arguments
[
fluwxKeyMessageExt
]
Action:
call
.
arguments
[
fluwxKeyMessageAction
]
ThumbImage:
thumbnailImage
InScene:
[
StringToWeChatScene
toScene
:
scene
]
title:
call
.
arguments
[
fluwxKeyTitle
]
description:
call
.
arguments
[
fluwxKeyDescription
]
];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
});
});
}
-
(
void
)
shareAssetImage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
imagePath
:(
NSString
*
)
imagePath
{
-
(
void
)
shareAssetImage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
imagePath
:(
NSString
*
)
imagePath
{
...
@@ -270,7 +316,11 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -270,7 +316,11 @@ NSObject <FlutterPluginRegistrar> *_registrar;
hdImageData
=
[
NSData
dataWithContentsOfFile
:[
self
readImageFromAssets
:
hdImagePath
]];
hdImageData
=
[
NSData
dataWithContentsOfFile
:[
self
readImageFromAssets
:
hdImagePath
]];
}
else
if
([
hdImagePath
hasPrefix
:
SCHEMA_FILE
])
{
}
else
if
([
hdImagePath
hasPrefix
:
SCHEMA_FILE
])
{
NSUInteger
startIndex
=
SCHEMA_FILE
.
length
;
// int startIndex = SCHEMA_FILE.e
NSString
*
imagePathWithoutUri
=
[
hdImagePath
substringFromIndex
:
startIndex
];
hdImageData
=
[
NSData
dataWithContentsOfFile
:
imagePathWithoutUri
];
}
else
{
}
else
{
NSURL
*
hdImageURL
=
[
NSURL
URLWithString
:
hdImagePath
];
NSURL
*
hdImageURL
=
[
NSURL
URLWithString
:
hdImagePath
];
hdImageData
=
[
NSData
dataWithContentsOfURL
:
hdImageURL
];
hdImageData
=
[
NSData
dataWithContentsOfURL
:
hdImageURL
];
...
@@ -320,7 +370,13 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -320,7 +370,13 @@ NSObject <FlutterPluginRegistrar> *_registrar;
thumbnailImage
=
[
ThumbnailHelper
compressImage
:
tmp
toByte
:
size
isPNG
:
FALSE
];
thumbnailImage
=
[
ThumbnailHelper
compressImage
:
tmp
toByte
:
size
isPNG
:
FALSE
];
}
else
if
([
thumbnail
hasPrefix
:
SCHEMA_FILE
])
{
}
else
if
([
thumbnail
hasPrefix
:
SCHEMA_FILE
])
{
NSUInteger
startIndex
=
SCHEMA_FILE
.
length
;
// int startIndex = SCHEMA_FILE.e
NSString
*
thumbnailPathWithoutUri
=
[
thumbnail
substringFromIndex
:
startIndex
];
NSData
*
thumbnailData
=
[
NSData
dataWithContentsOfFile
:
thumbnailPathWithoutUri
];
UIImage
*
tmp
=
[
UIImage
imageWithData
:
thumbnailData
];
thumbnailImage
=
[
ThumbnailHelper
compressImage
:
tmp
toByte
:
size
isPNG
:
FALSE
];
}
else
{
}
else
{
NSURL
*
thumbnailURL
=
[
NSURL
URLWithString
:
thumbnail
];
NSURL
*
thumbnailURL
=
[
NSURL
URLWithString
:
thumbnail
];
NSData
*
thumbnailData
=
[
NSData
dataWithContentsOfURL
:
thumbnailURL
];
NSData
*
thumbnailData
=
[
NSData
dataWithContentsOfURL
:
thumbnailURL
];
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论