Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
f09621e6
提交
f09621e6
authored
8月 16, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ios share
上级
bde9d52e
显示空白字符变更
内嵌
并排
正在显示
34 个修改的文件
包含
345 行增加
和
59 行删除
+345
-59
WeChatPluginHandler.kt
...in/kotlin/com/jarvan/fluwx/handler/WeChatPluginHandler.kt
+10
-3
ShareImageUtil.java
...rc/main/kotlin/com/jarvan/fluwx/utils/ShareImageUtil.java
+5
-1
ic_launcher.png
android/src/main/res/mipmap-hdpi/ic_launcher.png
+0
-0
project.pbxproj
example/ios/Runner.xcodeproj/project.pbxproj
+4
-2
Info.plist
example/ios/Runner/Info.plist
+26
-0
main.dart
example/lib/main.dart
+3
-8
FluwxPlugin.h
ios/Classes/FluwxPlugin.h
+12
-1
FluwxPlugin.m
ios/Classes/FluwxPlugin.m
+24
-41
CallResults.h
ios/Classes/constants/CallResults.h
+0
-0
CallResults.m
ios/Classes/constants/CallResults.m
+0
-0
FluwxKeys.h
ios/Classes/constants/FluwxKeys.h
+6
-0
FluwxKeys.m
ios/Classes/constants/FluwxKeys.m
+4
-0
FluwxMethods.h
ios/Classes/constants/FluwxMethods.h
+0
-0
FluwxMethods.m
ios/Classes/constants/FluwxMethods.m
+0
-0
ImageSchema.h
ios/Classes/constants/ImageSchema.h
+15
-0
ImageSchema.m
ios/Classes/constants/ImageSchema.m
+14
-0
FluwxShareHandler.h
ios/Classes/handler/FluwxShareHandler.h
+20
-0
FluwxShareHandler.m
ios/Classes/handler/FluwxShareHandler.m
+146
-0
FlutterAssetHelper.h
ios/Classes/helper/FlutterAssetHelper.h
+10
-0
FlutterAssetHelper.m
ios/Classes/helper/FlutterAssetHelper.m
+40
-0
StringToWeChatScene.h
ios/Classes/helper/StringToWeChatScene.h
+0
-0
StringToWeChatScene.m
ios/Classes/helper/StringToWeChatScene.m
+0
-0
StringUtil.h
ios/Classes/helper/StringUtil.h
+0
-0
StringUtil.m
ios/Classes/helper/StringUtil.m
+0
-0
SendMessageToWXReq+requestWithTextOrMediaMessage.h
...wechat/SendMessageToWXReq+requestWithTextOrMediaMessage.h
+0
-0
SendMessageToWXReq+requestWithTextOrMediaMessage.m
...wechat/SendMessageToWXReq+requestWithTextOrMediaMessage.m
+0
-0
WXApiManager.h
ios/Classes/wechat/WXApiManager.h
+0
-0
WXApiManager.m
ios/Classes/wechat/WXApiManager.m
+0
-0
WXApiRequestHandler.h
ios/Classes/wechat/WXApiRequestHandler.h
+0
-0
WXApiRequestHandler.m
ios/Classes/wechat/WXApiRequestHandler.m
+6
-3
WXMediaMessage+messageConstruct.h
ios/Classes/wechat/WXMediaMessage+messageConstruct.h
+0
-0
WXMediaMessage+messageConstruct.m
ios/Classes/wechat/WXMediaMessage+messageConstruct.m
+0
-0
WeChatResponseHandler.h
ios/Classes/wechat/WeChatResponseHandler.h
+0
-0
WeChatResponseHandler.m
ios/Classes/wechat/WeChatResponseHandler.m
+0
-0
没有找到文件。
android/src/main/kotlin/com/jarvan/fluwx/handler/WeChatPluginHandler.kt
浏览文件 @
f09621e6
package
com.jarvan.fluwx.handler
import
android.graphics.Bitmap
import
android.graphics.BitmapFactory
import
android.util.Log
import
com.jarvan.fluwx.R
import
com.jarvan.fluwx.constant.CallResult
import
com.jarvan.fluwx.constant.WeChatPluginMethods
import
com.jarvan.fluwx.constant.WechatPluginKeys
import
com.jarvan.fluwx.utils.ShareImageUtil
import
com.jarvan.fluwx.utils.Util
import
com.jarvan.fluwx.utils.WeChatThumbnailUtil
import
com.tencent.mm.opensdk.modelbase.BaseResp
import
com.tencent.mm.opensdk.modelmsg.*
...
...
@@ -138,7 +142,8 @@ object WeChatPluginHandler {
launch
(
UI
){
val
byteArray
:
ByteArray
?
=
getImageByteArrayCommon
(
registrar
,
imagePath
)
val
imgObj
=
if
(
byteArray
!=
null
)
{
val
imgObj
=
if
(
byteArray
!=
null
&&
byteArray
.
isNotEmpty
())
{
WXImageObject
(
byteArray
)
}
else
{
null
...
...
@@ -153,8 +158,10 @@ object WeChatPluginHandler {
if
(
thumbnail
.
isNullOrBlank
()){
thumbnail
=
imagePath
}
// val thumbnailData = getThumbnailByteArrayCommon(registrar,thumbnail!!)
handleShareImage
(
imgObj
,
call
,
null
,
result
)
val
bitmap
=
BitmapFactory
.
decodeResource
(
registrar
!!
.
context
().
resources
,
R
.
mipmap
.
ic_launcher
)
val
thumbnailData
=
Util
.
bmpToByteArray
(
bitmap
,
true
)
handleShareImage
(
imgObj
,
call
,
thumbnailData
,
result
)
}
}
...
...
android/src/main/kotlin/com/jarvan/fluwx/utils/ShareImageUtil.java
浏览文件 @
f09621e6
...
...
@@ -44,7 +44,8 @@ public class ShareImageUtil {
bmp
=
BitmapFactory
.
decodeFile
(
path
);
result
=
Util
.
bmpToByteArray
(
bmp
,
true
);
}
else
{
result
=
handleNetworkImage
(
registrar
,
path
);
// result = handleNetworkImage(registrar, path);
result
=
Util
.
inputStreamToByte
(
openStream
(
path
));
}
return
result
;
...
...
@@ -53,10 +54,13 @@ public class ShareImageUtil {
private
static
byte
[]
handleNetworkImage
(
PluginRegistry
.
Registrar
registrar
,
String
path
)
{
byte
[]
result
=
null
;
InputStream
inputStream
=
openStream
(
path
);
if
(
inputStream
==
null
)
{
return
null
;
}
String
suffix
=
".jpg"
;
int
index
=
path
.
lastIndexOf
(
"."
);
if
(
index
>
0
)
{
...
...
android/src/main/res/mipmap-hdpi/ic_launcher.png
0 → 100644
浏览文件 @
f09621e6
544 Bytes
example/ios/Runner.xcodeproj/project.pbxproj
浏览文件 @
f09621e6
...
...
@@ -441,8 +441,9 @@
"$(inherited)"
,
"$(PROJECT_DIR)/Flutter"
,
);
PRODUCT_BUNDLE_IDENTIFIER
=
com.jarvan.fluwxExample
;
PRODUCT_BUNDLE_IDENTIFIER
=
"com.jarvanmo.fluwx-example"
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
USER_HEADER_SEARCH_PATHS
=
"\"${PROJECT_DIR}/../..\"/** \"${PROJECT_DIR}/../..\"/**"
;
VERSIONING_SYSTEM
=
"apple-generic"
;
};
name
=
Debug
;
...
...
@@ -465,8 +466,9 @@
"$(inherited)"
,
"$(PROJECT_DIR)/Flutter"
,
);
PRODUCT_BUNDLE_IDENTIFIER
=
com.jarvan.fluwxExample
;
PRODUCT_BUNDLE_IDENTIFIER
=
"com.jarvanmo.fluwx-example"
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
USER_HEADER_SEARCH_PATHS
=
"\"${PROJECT_DIR}/../..\"/** \"${PROJECT_DIR}/../..\"/**"
;
VERSIONING_SYSTEM
=
"apple-generic"
;
};
name
=
Release
;
...
...
example/ios/Runner/Info.plist
浏览文件 @
f09621e6
...
...
@@ -4,6 +4,8 @@
<
d
i
c
t
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
en
<
/string
>
<
k
e
y
>
CFBundleDisplayName
<
/k
e
y
>
<
string
>
$
{
PROJECT_NAME
}<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
string
>
$
(
EXECUTABLE_NAME
)<
/string
>
<
k
e
y
>
CFBundleIdentifier
<
/k
e
y
>
...
...
@@ -18,6 +20,19 @@
<
string
>
1.0
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleURLTypes
<
/k
e
y
>
<
a
rr
a
y
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleTypeRole
<
/k
e
y
>
<
string
>
Editor
<
/string
>
<
k
e
y
>
CFBundleURLName
<
/k
e
y
>
<
string
>
weixin
<
/string
>
<
k
e
y
>
CFBundleURLSchemes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
wxd930ea5d5a258f4f
<
/string
>
<
/
a
rr
a
y
>
<
/
d
i
c
t
>
<
/
a
rr
a
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1
<
/string
>
<
k
e
y
>
LSRequiresIPhoneOS
<
/k
e
y
>
...
...
@@ -41,5 +56,16 @@
<
/
a
rr
a
y
>
<
k
e
y
>
UIViewControllerBasedStatusBarAppearance
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
LSApplicationQueriesSchemes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
weixin
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
NSAppTransportSecurity
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
NSAllowsArbitraryLoads
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/plist
>
example/lib/main.dart
浏览文件 @
f09621e6
...
...
@@ -17,8 +17,8 @@ class _MyAppState extends State<MyApp> {
void
initState
()
{
super
.
initState
();
// initPlatformState();
Fluwx
.
init
(
"wxd930ea5d5a258f4f"
).
then
((
_
)
{
print
(
"succes"
);
Fluwx
.
init
(
"wxd930ea5d5a258f4f"
).
then
((
result
)
{
print
(
"succes
-->
$result
"
);
},
onError:
(
value
)
{
print
(
"--->
$value
"
);
});
...
...
@@ -55,12 +55,7 @@ class _MyAppState extends State<MyApp> {
child:
new
FlatButton
(
onPressed:
()
{
var
fluwx
=
Fluwx
();
fluwx
.
share
(
WeChatShareImageModel
(
image:
"https://timgsa.baidu.com/timg?image&quality=80&size=b10000_10000&sec=1534342262&di=ae1078c9080282ec8bbd4909e6669ee2&src=http://img4q.duitang.com/uploads/item/201402/19/20140219123329_QkdNy.jpeg"
,
transaction:
"hehe"
,
title:
"from dart"
,
scene:
WeChatScene
.
SESSION
));
fluwx
.
share
(
WeChatShareTextModel
(
text:
"hehe"
));
},
child:
new
Text
(
"share text to wechat"
)),
),
...
...
ios/Classes/FluwxPlugin.h
浏览文件 @
f09621e6
#import <Flutter/Flutter.h>
@class
FluwxShareHandler
;
extern
BOOL
isWeChatRegistered
;
@interface
FluwxPlugin
:
NSObject
<
FlutterPlugin
>
@interface
FluwxPlugin
:
NSObject
<
FlutterPlugin
>
{
@private
FluwxShareHandler
*
_fluwxShareHandler
;
}
@end
ios/Classes/FluwxPlugin.m
浏览文件 @
f09621e6
...
...
@@ -2,10 +2,9 @@
#import "FluwxMethods.h"
#import "WXApi.h"
#import "StringUtil.h"
#import "CallResults.h"
#import "WXApiRequestHandler.h"
#import "FluwxKeys.h"
#import "StringToWeChatScene.h"
#import "../../../../../../ios/Classes/handler/FluwxShareHandler.h"
#import "FluwxShareHandler.h"
#import "FluwxShareHandler.h"
@implementation
FluwxPlugin
...
...
@@ -17,70 +16,54 @@ BOOL isWeChatRegistered = NO;
FlutterMethodChannel
*
channel
=
[
FlutterMethodChannel
methodChannelWithName
:
@"fluwx"
binaryMessenger
:[
registrar
messenger
]];
FluwxPlugin
*
instance
=
[[
FluwxPlugin
alloc
]
init
];
FluwxPlugin
*
instance
=
[[
FluwxPlugin
alloc
]
init
WithRegistrar
:
registrar
];
[
registrar
addMethodCallDelegate
:
instance
channel
:
channel
];
}
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
self
=
[
super
init
];
if
(
self
)
{
_fluwxShareHandler
=
[[
FluwxShareHandler
alloc
]
initWithRegistrar
:
registrar
];
}
return
self
;
}
-
(
void
)
handleMethodCall
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
if
([
initWeChat
isEqualToString
:
call
.
method
])
{
[
self
initWeChatIfNeeded
:
call
result
:
result
];
}
else
if
([
call
.
method
hasPrefix
:
@"share"
])
{
[
self
handleShare
:
call
result
:
result
];
}
if
([
call
.
method
hasPrefix
:
@"share"
])
{
[
_fluwxShareHandler
handleShare
:
call
result
:
result
];
}
else
{
result
(
FlutterMethodNotImplemented
);
}
}
-
(
void
)
initWeChatIfNeeded
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
if
(
isWeChatRegistered
)
{
result
(
resultDone
);
result
(
@YES
);
return
;
}
NSString
*
appId
=
call
.
arguments
;
NSLog
(
appId
);
if
([
StringUtil
isBlank
:
appId
])
{
result
([
FlutterError
errorWithCode
:
@"invalid app id"
message
:
@"are you sure your app id is correct ? "
details
:
appId
]);
return
;
}
[
WXApi
registerApp
:
appId
];
result
(
resultDone
);
}
-
(
void
)
handleShare
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
if
(
!
isWeChatRegistered
)
{
result
([
FlutterError
errorWithCode
:
resultErrorNeedWeChat
message
:
resultMessageNeedWeChat
details
:
nil
]);
return
;
}
if
([
shareText
isEqualToString
:
call
.
method
])
{
[
self
shareText
:
call
result
:
result
];
}
else
if
([
shareImage
isEqualToString
:
call
.
method
]){
[
self
shareImage
:
call
result
:
result
];
result
(
FlutterMethodNotImplemented
);
}
}
-
(
void
)
shareText
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
NSString
*
text
=
call
.
arguments
[
fluwxKeyText
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendText
:
text
InScene
:[
StringToWeChatScene
toScene
:
scene
]];
result
(
@
(
done
));
}
-
(
void
)
shareImage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
NSString
*
text
=
call
.
arguments
[
fluwxKeyText
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendText
:
text
InScene
:[
StringToWeChatScene
toScene
:
scene
]];
result
(
@
(
done
));
isWeChatRegistered
=
[
WXApi
registerApp
:
appId
];
result
(
@YES
);
}
...
...
ios/Classes/CallResults.h
→
ios/Classes/
constants/
CallResults.h
浏览文件 @
f09621e6
File moved
ios/Classes/CallResults.m
→
ios/Classes/
constants/
CallResults.m
浏览文件 @
f09621e6
File moved
ios/Classes/FluwxKeys.h
→
ios/Classes/
constants/
FluwxKeys.h
浏览文件 @
f09621e6
...
...
@@ -18,5 +18,10 @@ extern NSString *const fluwxKeyDescription;
extern
NSString
*
const
fluwxKeyPackage
;
extern
NSString
*
const
fluwxKeyMessageExt
;
extern
NSString
*
const
fluwxKeyMediaTagName
;
extern
NSString
*
const
fluwxKeyMessageAction
;
@interface
FluwxKeys
:
NSObject
@end
\ No newline at end of file
ios/Classes/FluwxKeys.m
→
ios/Classes/
constants/
FluwxKeys.m
浏览文件 @
f09621e6
...
...
@@ -18,6 +18,10 @@ NSString *const fluwxKeyDescription = @"description";
NSString
*
const
fluwxKeyPackage
=
@"?package="
;
NSString
*
const
fluwxKeyMessageExt
=
@"messageExt"
;
NSString
*
const
fluwxKeyMediaTagName
=
@"mediaTagName "
;
NSString
*
const
fluwxKeyMessageAction
=
@"messageAction"
;
@implementation
FluwxKeys
{
}
...
...
ios/Classes/FluwxMethods.h
→
ios/Classes/
constants/
FluwxMethods.h
浏览文件 @
f09621e6
File moved
ios/Classes/FluwxMethods.m
→
ios/Classes/
constants/
FluwxMethods.m
浏览文件 @
f09621e6
File moved
ios/Classes/constants/ImageSchema.h
0 → 100644
浏览文件 @
f09621e6
//
// Created by mo on 2018/8/16.
//
#import <Foundation/Foundation.h>
extern
NSString
*
const
SCHEMA_ASSETS
;
extern
NSString
*
const
SCHMEA_HTTP
;
extern
NSString
*
const
SCHMEA_HTTPS
;
extern
NSString
*
const
SCHEMA_FILE
;
@interface
ImageSchema
:
NSObject
@end
\ No newline at end of file
ios/Classes/constants/ImageSchema.m
0 → 100644
浏览文件 @
f09621e6
//
// Created by mo on 2018/8/16.
//
#import "ImageSchema.h"
NSString
*
const
SCHEMA_ASSETS
=
@
"assets://"
;
NSString
*
const
SCHMEA_HTTP
=
@"http://"
;
NSString
*
const
SCHMEA_HTTPS
=
@"https://"
;
NSString
*
const
SCHEMA_FILE
=
@"file://"
;
@implementation
ImageSchema
@end
\ No newline at end of file
ios/Classes/handler/FluwxShareHandler.h
0 → 100644
浏览文件 @
f09621e6
//
// Created by mo on 2018/8/16.
//
#import <Foundation/Foundation.h>
#import "CallResults.h"
#import "WXApiRequestHandler.h"
#import "FluwxKeys.h"
#import "StringToWeChatScene.h"
#import "WXApi.h"
#import "FluwxMethods.h"
#import <Flutter/Flutter.h>
#import "FluwxPlugin.h"
@class
StringUtil
;
@interface
FluwxShareHandler
:
NSObject
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
;
-
(
void
)
handleShare
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
;
@end
\ No newline at end of file
ios/Classes/handler/FluwxShareHandler.m
0 → 100644
浏览文件 @
f09621e6
//
// Created by mo on 2018/8/16.
//
#import "FluwxShareHandler.h"
#import "ImageSchema.h"
#import "StringUtil.h"
@implementation
FluwxShareHandler
NSObject
<
FlutterPluginRegistrar
>
*
_registrar
;
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
self
=
[
super
init
];
if
(
self
)
{
_registrar
=
registrar
;
}
return
self
;
}
-
(
void
)
handleShare
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
if
(
!
isWeChatRegistered
)
{
result
([
FlutterError
errorWithCode
:
resultErrorNeedWeChat
message
:
resultMessageNeedWeChat
details
:
nil
]);
return
;
}
if
(
!
[
WXApi
isWXAppInstalled
])
{
result
([
FlutterError
errorWithCode
:
@"wechat not installed"
message
:
@"wechat not installed"
details
:
nil
]);
return
;
}
if
([
shareText
isEqualToString
:
call
.
method
])
{
[
self
shareText
:
call
result
:
result
];
}
else
if
([
shareImage
isEqualToString
:
call
.
method
])
{
[
self
shareImage
:
call
result
:
result
];
}
else
if
([
shareWebPage
isEqualToString
:
call
.
method
])
{
[
self
shareWebPage
:
call
result
:
result
];
}
}
-
(
void
)
shareText
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
NSString
*
text
=
call
.
arguments
[
fluwxKeyText
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendText
:
text
InScene
:[
StringToWeChatScene
toScene
:
scene
]];
result
(
@
(
done
));
}
-
(
void
)
shareImage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
NSString
*
imagePath
=
call
.
arguments
[
fluwxKeyImage
];
if
([
imagePath
hasPrefix
:
SCHEMA_ASSETS
])
{
}
else
if
([
imagePath
hasPrefix
:
SCHEMA_FILE
])
{
}
else
{
[
self
shareNetworkImage
:
call
result
:
result
imagePath
:
imagePath
];
}
NSString
*
text
=
call
.
arguments
[
fluwxKeyText
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendText
:
text
InScene
:[
StringToWeChatScene
toScene
:
scene
]];
result
(
@
(
done
));
}
-
(
void
)
shareNetworkImage
:(
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
];
//下载图片
NSData
*
imageData
=
[
NSData
dataWithContentsOfURL
:
imageURL
];
NSData
*
thumbnailData
;
UIImage
*
thumbnailImage
;
if
([
thumbnail
hasPrefix
:
SCHEMA_ASSETS
])
{
}
else
if
([
thumbnail
hasPrefix
:
SCHEMA_FILE
])
{
}
else
{
NSURL
*
thumbnailURL
=
[
NSURL
URLWithString
:
thumbnail
];
thumbnailData
=
[
NSData
dataWithContentsOfURL
:
thumbnailURL
];
if
([
thumbnailData
length
]
>
(
32
*
1024
))
{
}
else
{
thumbnailImage
=
[
UIImage
imageWithData
:
thumbnailData
];
}
}
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendImageData
:
imageData
TagName
:
call
.
arguments
[
fluwxKeyMediaTagName
]
MessageExt:
fluwxKeyMessageExt
Action:
fluwxKeyMessageAction
ThumbImage:
thumbnailImage
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
result
(
@
(
done
));
});
});
}
-
(
void
)
shareWebPage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
NSString
*
webPageUrl
=
call
.
arguments
[
@"webPage"
];
NSString
*
imagePath
=
call
.
arguments
[
fluwxKeyImage
];
if
([
imagePath
hasPrefix
:
SCHEMA_ASSETS
])
{
}
else
if
([
imagePath
hasPrefix
:
SCHEMA_FILE
])
{
}
else
{
[
self
shareNetworkImage
:
call
result
:
result
imagePath
:
imagePath
];
}
NSString
*
text
=
call
.
arguments
[
fluwxKeyText
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendText
:
text
InScene
:[
StringToWeChatScene
toScene
:
scene
]];
result
(
@
(
done
));
}
@end
\ No newline at end of file
ios/Classes/helper/FlutterAssetHelper.h
0 → 100644
浏览文件 @
f09621e6
//
// Created by mo on 2018/8/16.
//
#import <Foundation/Foundation.h>
#import "ImageSchema.h"
#import "FluwxKeys.h"
@interface
FlutterAssetHelper
:
NSObject
@end
\ No newline at end of file
ios/Classes/helper/FlutterAssetHelper.m
0 → 100644
浏览文件 @
f09621e6
//
// Created by mo on 2018/8/16.
//
#import "FlutterAssetHelper.h"
@implementation
FlutterAssetHelper
+
(
NSString
*
)
getPackageName
:(
NSString
*
)
assetPath
{
NSUInteger
length
=
SCHEMA_ASSETS
.
length
;
return
@""
;
}
+
(
NSString
*
)
getPath
:(
NSString
*
)
assetPath
{
NSUInteger
schemaLength
=
SCHEMA_ASSETS
.
length
;
NSUInteger
totalLength
=
assetPath
.
length
;
NSRange
range
=
NSMakeRange
(
schemaLength
,
totalLength
-
schemaLength
);
NSString
*
result
=
[
assetPath
substringWithRange
:
range
];
if
([
result
rangeOfString
:
fluwxKeyPackage
].
location
!=
NSNotFound
)
{
result
=
[
result
stringByReplacingCharactersInRange
:
<
#
(
NSRange
)
range
#
>
withString
:
<
#
(
NSString
*
)
replacement
#
>
]
}
return
result
;
}
@end
\ No newline at end of file
ios/Classes/StringToWeChatScene.h
→
ios/Classes/
helper/
StringToWeChatScene.h
浏览文件 @
f09621e6
File moved
ios/Classes/StringToWeChatScene.m
→
ios/Classes/
helper/
StringToWeChatScene.m
浏览文件 @
f09621e6
File moved
ios/Classes/StringUtil.h
→
ios/Classes/
helper/
StringUtil.h
浏览文件 @
f09621e6
File moved
ios/Classes/StringUtil.m
→
ios/Classes/
helper/
StringUtil.m
浏览文件 @
f09621e6
File moved
ios/Classes/SendMessageToWXReq+requestWithTextOrMediaMessage.h
→
ios/Classes/
wechat/
SendMessageToWXReq+requestWithTextOrMediaMessage.h
浏览文件 @
f09621e6
File moved
ios/Classes/SendMessageToWXReq+requestWithTextOrMediaMessage.m
→
ios/Classes/
wechat/
SendMessageToWXReq+requestWithTextOrMediaMessage.m
浏览文件 @
f09621e6
File moved
ios/Classes/WXApiManager.h
→
ios/Classes/
wechat/
WXApiManager.h
浏览文件 @
f09621e6
File moved
ios/Classes/WXApiManager.m
→
ios/Classes/
wechat/
WXApiManager.m
浏览文件 @
f09621e6
File moved
ios/Classes/WXApiRequestHandler.h
→
ios/Classes/
wechat/
WXApiRequestHandler.h
浏览文件 @
f09621e6
File moved
ios/Classes/WXApiRequestHandler.m
→
ios/Classes/
wechat/
WXApiRequestHandler.m
浏览文件 @
f09621e6
...
...
@@ -29,12 +29,15 @@
MessageExt
:(
NSString
*
)
messageExt
Action
:(
NSString
*
)
action
ThumbImage
:(
UIImage
*
)
thumbImage
InScene
:(
enum
WXScene
)
scene
{
InScene
:(
enum
WXScene
)
scene
title
:(
NSString
*
)
title
description
:
(
NSString
*
)
description
{
WXImageObject
*
ext
=
[
WXImageObject
object
];
ext
.
imageData
=
imageData
;
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
nil
Description
:
nil
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
title
Description
:
description
Object
:
ext
MessageExt
:
messageExt
MessageAction
:
action
...
...
ios/Classes/WXMediaMessage+messageConstruct.h
→
ios/Classes/
wechat/
WXMediaMessage+messageConstruct.h
浏览文件 @
f09621e6
File moved
ios/Classes/WXMediaMessage+messageConstruct.m
→
ios/Classes/
wechat/
WXMediaMessage+messageConstruct.m
浏览文件 @
f09621e6
File moved
ios/Classes/WeChatResponseHandler.h
→
ios/Classes/
wechat/
WeChatResponseHandler.h
浏览文件 @
f09621e6
File moved
ios/Classes/WeChatResponseHandler.m
→
ios/Classes/
wechat/
WeChatResponseHandler.m
浏览文件 @
f09621e6
File moved
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论