mirror of
https://github.com/little-snow-fox/react-native-wechat-lib.git
synced 2025-12-06 15:26:49 +08:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9231c7196f | ||
|
|
84000a32b6 | ||
|
|
629cb18cbd | ||
|
|
03f117dc08 | ||
|
|
6a54386a6f | ||
|
|
59b1e05de0 | ||
|
|
d1c5e74ea5 | ||
|
|
86bc8bd031 | ||
|
|
80739f7ab7 | ||
|
|
f356067265 | ||
|
|
a325e153c8 | ||
|
|
52275af954 | ||
|
|
7e90d9d7d2 | ||
|
|
3376243a2c | ||
|
|
41bd398214 | ||
|
|
d6ef691f95 | ||
|
|
81915e19e0 | ||
|
|
ad9b5f1ef1 | ||
|
|
efe268229f | ||
|
|
367ae4bbde | ||
|
|
48b51fd8df | ||
|
|
2c774270cb | ||
|
|
9ba05c11e5 | ||
|
|
d3292dd064 | ||
|
|
d73102a44a | ||
|
|
d65934cf8d | ||
|
|
b2a1ccd84c | ||
|
|
863797b332 | ||
|
|
b16e4e4d1b | ||
|
|
f48478fb53 | ||
|
|
0be3244535 | ||
|
|
0148c8c177 | ||
|
|
aaa4f0785e | ||
|
|
0f29aeddd9 | ||
|
|
21be889086 |
50
README.md
50
README.md
@ -1,7 +1,7 @@
|
||||
<img height="200" src="./image/weixin.png?raw=true">
|
||||
|
||||
# React-Native-Wechat-Lib
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
@ -17,10 +17,10 @@
|
||||
<br>
|
||||
|
||||
## 路线图
|
||||
- 3.0.0
|
||||
- 3.0.x
|
||||
- [X] React native 70
|
||||
- [X] Android SDK 6.8.20
|
||||
- [ ] iOS SDK 2.0
|
||||
- [X] iOS SDK 2.0
|
||||
- [ ] iOS SDK 2.0 No payment function
|
||||
- [X] Example
|
||||
- 1.1.x
|
||||
@ -34,11 +34,11 @@
|
||||
## 注意
|
||||
如果你的 IOS 应用需要使用**不带支付功能**的 WeChat SDK,请使用带有 “-notpay” 后缀的 NPM 包。
|
||||
|
||||
目前最新代码版本为 3.0.0,但 NPM Last 版本暂时只到 1.1.26,因为 **3.0.0 暂时还处于开发阶段**,很多功能**未经过测试**。
|
||||
目前最新代码版本为 3.0.x,但 NPM Last 版本暂时只到 1.1.26,因为 **3.0.x 暂时还处于开发阶段**,有小部分功能**未经过测试**。
|
||||
|
||||
如果你需要使用 3.0.0 版本,请在 package.json 中加上版本号 react-native-wechat-lib@3.0.0,切换前请你清楚了解该版本的风险,该版本为开发版。
|
||||
如果你需要使用 3.0.x 版本,请在 package.json 中加上版本号 **react-native-wechat-lib@3.0.4**,切换前请你清楚了解该版本的风险,该版本为开发版。
|
||||
|
||||
我会尽快推出 3.0.0 发行版。
|
||||
我会尽快推出 3.0.x 发行版。
|
||||
|
||||
<br>
|
||||
|
||||
@ -62,6 +62,9 @@
|
||||
NPM 安装
|
||||
```sh
|
||||
npm install react-native-wechat-lib --save
|
||||
# 3.0.x 使用3.0.4
|
||||
npm install react-native-wechat-lib@3.0.4 --save
|
||||
|
||||
# 3.0.0 开始弃用
|
||||
react-native link react-native-wechat-lib
|
||||
```
|
||||
@ -154,6 +157,36 @@ following fields:
|
||||
| lang | String | The user language |
|
||||
| country | String | The user country |
|
||||
|
||||
#### authByScan([scope, nonceStr, onQRGet]) 微信扫码授权登录
|
||||
|
||||
- `appId` {String} the appId you get from WeChat dashboard
|
||||
- `appSecret` {String} the appSecret you get from WeChat dashboard
|
||||
- `onQRGet` (String) => void
|
||||
|
||||
调用 authByScan 后,需要监听二维码的获取,展示完二维码,用户扫码登录完成后才会回调 callback,字段如下
|
||||
|
||||
| field | type | description |
|
||||
| ------- | ------ | ----------------------------------- |
|
||||
| errCode | Number | Error Code |
|
||||
| errStr | String | Error message if any error occurred |
|
||||
| nickname | String | 微信昵称 |
|
||||
| headimgurl | String | 微信头像链接 |
|
||||
| openid | String | openid |
|
||||
| unionid | String | unionid |
|
||||
|
||||
|
||||
示例如下
|
||||
|
||||
```js
|
||||
const ret = await WeChat.authByScan(WeiXinId, WeiXinSecret, (qrcode) => {
|
||||
console.log(qrcode)
|
||||
// 拿到 qrcode 用 Image 去渲染
|
||||
});
|
||||
console.log('登录信息', ret);
|
||||
```
|
||||
|
||||
如有不懂,可以查看[微信官方文档](https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/Login_via_Scan.html)
|
||||
|
||||
#### ShareText(ShareTextMetadata) 分享文本
|
||||
|
||||
ShareTextMetadata
|
||||
@ -226,7 +259,7 @@ ShareFileMetadata
|
||||
|
||||
| name | type | description |
|
||||
| ----- | ------ | -------------- |
|
||||
| url | String | 文件地址 |
|
||||
| url | String | 文件地址。如果是远程文件,则为 http 开头;如果是本地文件,则为绝对路径,如 /storage/emulated/0/Android/xxx |
|
||||
| title | String | 文件标题 |
|
||||
| scene | Number | 分享到, 0:会话 |
|
||||
|
||||
@ -237,6 +270,9 @@ Return:
|
||||
| errCode | Number | 0 if authorization succeed |
|
||||
| errStr | String | Error message if any error occurred |
|
||||
|
||||
|
||||
安卓实现分享本地文件需要对工程进行一些配置,详见 [Android 安装](./docs/build-setup-android.md#分享本地文件)
|
||||
|
||||
```js
|
||||
import * as WeChat from 'react-native-wechat-lib';
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ dependencies {
|
||||
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
||||
//noinspection GradleDynamicVersion
|
||||
implementation "com.facebook.react:react-native"
|
||||
implementation group: 'com.tencent.mm.opensdk', name: 'wechat-sdk-android', version: '6.8.20'
|
||||
api group: 'com.tencent.mm.opensdk', name: 'wechat-sdk-android', version: '6.8.20'
|
||||
}
|
||||
|
||||
if (isNewArchitectureEnabled()) {
|
||||
|
||||
BIN
android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
234
android/gradlew
vendored
Executable file
234
android/gradlew
vendored
Executable file
@ -0,0 +1,234 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
android/gradlew.bat
vendored
Normal file
89
android/gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@ -6,8 +6,10 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.util.Base64;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.facebook.common.executors.UiThreadImmediateExecutorService;
|
||||
import com.facebook.common.internal.Files;
|
||||
@ -24,14 +26,21 @@ import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||
import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
|
||||
import com.tencent.mm.opensdk.diffdev.DiffDevOAuthFactory;
|
||||
import com.tencent.mm.opensdk.diffdev.IDiffDevOAuth;
|
||||
import com.tencent.mm.opensdk.diffdev.OAuthErrCode;
|
||||
import com.tencent.mm.opensdk.diffdev.OAuthListener;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseReq;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||
import com.tencent.mm.opensdk.modelbiz.ChooseCardFromWXCardPackage;
|
||||
import com.tencent.mm.opensdk.modelbiz.WXOpenCustomerServiceChat;
|
||||
import com.tencent.mm.opensdk.modelmsg.SendAuth;
|
||||
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
|
||||
import com.tencent.mm.opensdk.modelmsg.ShowMessageFromWX;
|
||||
@ -111,7 +120,7 @@ public class WeChatLibModule extends ReactContextBaseJavaModule implements IWXAP
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RCTWeChat";
|
||||
return "WeChat";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,6 +156,42 @@ public class WeChatLibModule extends ReactContextBaseJavaModule implements IWXAP
|
||||
}
|
||||
}
|
||||
|
||||
private void sendEvent(ReactContext reactContext, String eventName, WritableMap params) {
|
||||
reactContext.getJSModule(RCTNativeAppEventEmitter.class).emit(eventName, params);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void authByScan(String appid, String nonceStr, String timeStamp, String scope, String signature, String schemeData, final Callback callback) {
|
||||
if (api == null) {
|
||||
callback.invoke(NOT_REGISTERED);
|
||||
return;
|
||||
}
|
||||
|
||||
IDiffDevOAuth oauth = DiffDevOAuthFactory.getDiffDevOAuth();
|
||||
oauth.stopAuth();
|
||||
oauth.auth(appid, scope, nonceStr, timeStamp, signature, new OAuthListener() {
|
||||
@Override
|
||||
public void onAuthGotQrcode(String var1, byte[] var2){
|
||||
WritableMap map = Arguments.createMap();
|
||||
String base64String = Base64.encodeToString(var2, Base64.DEFAULT);
|
||||
map.putString("qrcode", base64String);
|
||||
sendEvent(getReactApplicationContext(), "onAuthGotQrcode", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQrcodeScanned() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAuthFinish(OAuthErrCode var1, String var2){
|
||||
WritableMap map = Arguments.createMap();
|
||||
map.putString("authCode", var2);
|
||||
map.putInt("errCode", var1.getCode());
|
||||
callback.invoke(null, map);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void registerApp(String appid, String universalLink, Callback callback) {
|
||||
this.appId = appid;
|
||||
@ -254,6 +299,21 @@ public class WeChatLibModule extends ReactContextBaseJavaModule implements IWXAP
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getFileUri(Context context, File file) {
|
||||
if (file == null || !file.exists()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Uri contentUri = FileProvider.getUriForFile(context,
|
||||
context.getPackageName() + ".fileprovider", // 要与`AndroidManifest.xml`里配置的`authorities`一致
|
||||
file);
|
||||
|
||||
// 授权给微信访问路径
|
||||
context.grantUriPermission("com.tencent.mm", // 这里填微信包名
|
||||
contentUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
return contentUri.toString(); // contentUri.toString() 即是以"content://"开头的用于共享的路径
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享文本
|
||||
@ -264,7 +324,15 @@ public class WeChatLibModule extends ReactContextBaseJavaModule implements IWXAP
|
||||
@ReactMethod
|
||||
public void shareFile(ReadableMap data, Callback callback) throws Exception {
|
||||
WXFileObject fileObj = new WXFileObject();
|
||||
fileObj.fileData = loadRawDataFromURL(data.getString("url"));
|
||||
|
||||
String url = data.getString("url");
|
||||
if (url.startsWith("http")) {
|
||||
fileObj.fileData = loadRawDataFromURL(url);
|
||||
} else {
|
||||
File file = new File(url);
|
||||
String fileUri = getFileUri(getReactApplicationContext(), file);
|
||||
fileObj.filePath = fileUri;
|
||||
}
|
||||
|
||||
WXMediaMessage msg = new WXMediaMessage();
|
||||
msg.mediaObject = fileObj;
|
||||
@ -672,6 +740,20 @@ public class WeChatLibModule extends ReactContextBaseJavaModule implements IWXAP
|
||||
callback.invoke(api.sendReq(payReq) ? null : INVOKE_FAILED);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void openCustomerServiceChat(String corpId, String kfUrl, Callback callback) {
|
||||
if (api == null) {
|
||||
callback.invoke(NOT_REGISTERED);
|
||||
return;
|
||||
}
|
||||
// open customer service logic
|
||||
WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
|
||||
|
||||
req.corpId = corpId;
|
||||
req.url = kfUrl;
|
||||
callback.invoke(null, api.sendReq(req));
|
||||
}
|
||||
|
||||
private void _share(final int scene, final ReadableMap data, final Callback callback) {
|
||||
Uri uri = null;
|
||||
if (data.hasKey("thumbImage")) {
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
# Build Setup for Android
|
||||
|
||||
## 注意
|
||||
请根据本文档严格配置,否则会导致微信无法回调你的应用,例如授权登录后无法跳回 APP,或者小程序无法拉起 APP
|
||||
|
||||
Then update `MainActivity.java` or `MainApplication.java`:
|
||||
如果配置过程有不明白,可以查看 [样本工程](https://github.com/little-snow-fox/react-native-wechat-lib/tree/master/example)
|
||||
在样本工程里搜索 '**react-native-wechat-lib support**' 便可以找到所有需要添加配置的地方
|
||||
|
||||
## 注册模块
|
||||
添加到 `MainApplication.java` 或 `MainActivity.java`:
|
||||
```java
|
||||
import com.theweflex.react.WeChatPackage; // Add this line
|
||||
import com.wechatlib.WeChatLibPackage; // Add this line
|
||||
|
||||
@Override
|
||||
protected List<ReactPackage> getPackages() {
|
||||
@ -12,29 +17,26 @@ import com.theweflex.react.WeChatPackage; // Add this line
|
||||
List<ReactPackage> packages = new PackageList(this).getPackages();
|
||||
// Packages that cannot be autolinked yet can be added manually here, for example:
|
||||
// packages.add(new MyReactNativePackage());
|
||||
packages.add(new WeChatPackage()); // Add this line
|
||||
packages.add(new WeChatLibPackage()); // Add this line
|
||||
return packages;
|
||||
}
|
||||
```
|
||||
|
||||
**Integrating with login and share**
|
||||
|
||||
If you are going to integrate login or share functions, you need to
|
||||
create a package named 'wxapi' in your application package and a class
|
||||
named `WXEntryActivity` in it.
|
||||
|
||||
## 登录和分享回调
|
||||
如果您打算集成登录或共享功能,则需要这样做
|
||||
在应用程序包和类中创建名为 "wxapi" 的包, 命名为 WXEntryActivit
|
||||
```java
|
||||
package your.package.wxapi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import com.theweflex.react.WeChatModule;
|
||||
import com.wechatlib.WeChatLibModule;
|
||||
|
||||
public class WXEntryActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
WeChatModule.handleIntent(getIntent());
|
||||
WeChatLibModule.handleIntent(getIntent());
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@ -54,7 +56,7 @@ Then add the following node to `AndroidManifest.xml`:
|
||||
</manifest>
|
||||
```
|
||||
|
||||
**Integrating the WeChat Payment**
|
||||
## 支付回调
|
||||
|
||||
If you are going to integrate payment functionality by using this library, then
|
||||
create a package named also `wxapi` in your application package and a class named
|
||||
@ -65,7 +67,7 @@ package your.package.wxapi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import com.theweflex.react.WeChatModule;
|
||||
import com.wechatlib;
|
||||
|
||||
public class WXPayEntryActivity extends Activity {
|
||||
@Override
|
||||
@ -96,7 +98,7 @@ Then add the following node to `AndroidManifest.xml`:
|
||||
android:taskAffinity="your packagename"
|
||||
android:launchMode="singleTask"
|
||||
```
|
||||
保证跳转后回到你的app的task。
|
||||
保证跳转后回到你的app的task。
|
||||
实际上,我的代码如下:
|
||||
```xml
|
||||
<manifest>
|
||||
@ -111,3 +113,54 @@ android:launchMode="singleTask"
|
||||
</application>
|
||||
</manifest>
|
||||
```
|
||||
|
||||
## 分享本地文件
|
||||
如果你需要分享本地文件,需要在 Android 的工程里进行一些设置,否则会有权限问题
|
||||
|
||||
步骤 1:app/src/main/AndroidManifest.xml 中添加 provider 标签,其中 com.yourapp.xxx 要替换为你自己的包名,记得保留后面的 `.fileprovider`
|
||||
|
||||
```xml
|
||||
<application ...>
|
||||
...
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.yourapp.xxx.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/filepaths" />
|
||||
</provider>
|
||||
...
|
||||
</application>
|
||||
```
|
||||
|
||||
步骤 2:实现 app/src/main/res/xml/filepaths.xml
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<external-files-path name="myexternalimages" path="Download/" />
|
||||
<cache-path name="my_cache_files" path="." />
|
||||
<root-path name="root" path="" />
|
||||
<files-path name="files-path" path="." />
|
||||
</paths>
|
||||
```
|
||||
|
||||
在这个 XML 文件中,你可以定义不同的路径类型(如 cache-path、external-path 等),以及对应的路径前缀。这样,在使用 FileProvider.getUriForFile() 时,就可以根据这些定义来获取正确的 URI。
|
||||
|
||||
请注意,当组件库被集成到不同的应用中时,你可能需要根据你自己的需求调整 filepaths.xml 中的路径定义。
|
||||
|
||||
## 关于 Android11
|
||||
微信将于近期发布 targetSdkVersion 30的客户端版本,因Android11系统特性,该微信版本在Android 11及以上系统版本的设备上运行时,授权登录、分享、微信支付等功能受到影响,可能无法正常使用。为了适配 Android 系统新版本特性,保证微信功能正常使用,请第三方应用2021年11月1日之前进行更新
|
||||
|
||||
在自己 React Native 项目的 android/app/src/main/AndroidManifest.xml 中添加:
|
||||
```$xml
|
||||
<queries>
|
||||
<!--
|
||||
微信 Android 11-更新 openSDK 适配
|
||||
参见 https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/Android.html#jump2
|
||||
-->
|
||||
<package android:name="com.tencent.mm" />
|
||||
/queries>
|
||||
```
|
||||
|
||||
@ -91,4 +91,7 @@ Universal Links 配置文件, 没使用的话可以忽略。
|
||||
@end
|
||||
```
|
||||
Mainly need to add '#import "WXApi.h"' and 'wxapidelegate'.
|
||||
主要是需要加上 '#import "WXApi.h"' 和 'WXApiDelegate' 。
|
||||
主要是需要加上 '#import "WXApi.h"' 和 'WXApiDelegate' 。
|
||||
|
||||
## 4. 从版本 3.0.0 开始,需要手动导入 libWeChatSDK.a 到 XCode
|
||||
直接复制本项目的 /ios/libWeChatSDK.a 到 Xcode 项目根目录,详细可参考 example 工程
|
||||
|
||||
@ -35,12 +35,12 @@ android_library(
|
||||
|
||||
android_build_config(
|
||||
name = "build_config",
|
||||
package = "org.bigbug.member.rnapp",
|
||||
package = "pro.aili.temporary",
|
||||
)
|
||||
|
||||
android_resource(
|
||||
name = "res",
|
||||
package = "org.bigbug.member.rnapp",
|
||||
package = "pro.aili.temporary",
|
||||
res = "src/main/res",
|
||||
)
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.bigbug.member.rnapp"
|
||||
applicationId "pro.aili.temporary"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
package org.bigbug.member.rnapp;
|
||||
package pro.aili.temporary;
|
||||
|
||||
import android.content.Context;
|
||||
import com.facebook.flipper.android.AndroidFlipperClient;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.bigbug.member.rnapp">
|
||||
package="pro.aili.temporary">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
@ -22,7 +22,21 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- react-native-wechat-lib support ( -->
|
||||
<activity
|
||||
android:name=".wxapi.WXEntryActivity"
|
||||
android:label="@string/app_name"
|
||||
android:exported="true"
|
||||
android:taskAffinity="pro.aili.temporary"
|
||||
android:launchMode="singleTask"
|
||||
/>
|
||||
<!-- ) -->
|
||||
</application>
|
||||
|
||||
<!-- react-native-wechat-lib support ( -->
|
||||
<queries>
|
||||
<package android:name="com.tencent.mm" />
|
||||
</queries>
|
||||
<!-- ) -->
|
||||
|
||||
</manifest>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.bigbug.member.rnapp;
|
||||
package pro.aili.temporary;
|
||||
|
||||
import com.facebook.react.ReactActivity;
|
||||
import com.facebook.react.ReactActivityDelegate;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.bigbug.member.rnapp;
|
||||
package pro.aili.temporary;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
@ -9,9 +9,12 @@ import com.facebook.react.ReactNativeHost;
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.config.ReactFeatureFlags;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import org.bigbug.member.rnapp.newarchitecture.MainApplicationReactNativeHost;
|
||||
import pro.aili.temporary.newarchitecture.MainApplicationReactNativeHost;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
// react-native-wechat-lib support (
|
||||
import com.wechatlib.WeChatLibPackage;
|
||||
// )
|
||||
|
||||
public class MainApplication extends Application implements ReactApplication {
|
||||
|
||||
@ -26,8 +29,12 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
protected List<ReactPackage> getPackages() {
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
List<ReactPackage> packages = new PackageList(this).getPackages();
|
||||
|
||||
// react-native-wechat-lib support (
|
||||
// Packages that cannot be autolinked yet can be added manually here, for example:
|
||||
// packages.add(new MyReactNativePackage());
|
||||
packages.add(new WeChatLibPackage());
|
||||
// )
|
||||
|
||||
return packages;
|
||||
}
|
||||
|
||||
@ -73,7 +80,7 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
We use reflection here to pick up the class that initializes Flipper,
|
||||
since Flipper library is not available in release mode
|
||||
*/
|
||||
Class<?> aClass = Class.forName("org.bigbug.member.rnapp.ReactNativeFlipper");
|
||||
Class<?> aClass = Class.forName("pro.aili.temporary.ReactNativeFlipper");
|
||||
aClass
|
||||
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
|
||||
.invoke(null, context, reactInstanceManager);
|
||||
@ -1,4 +1,4 @@
|
||||
package org.bigbug.member.rnapp.newarchitecture;
|
||||
package pro.aili.temporary.newarchitecture;
|
||||
|
||||
import android.app.Application;
|
||||
import androidx.annotation.NonNull;
|
||||
@ -19,9 +19,9 @@ import com.facebook.react.fabric.CoreComponentsRegistry;
|
||||
import com.facebook.react.fabric.FabricJSIModuleProvider;
|
||||
import com.facebook.react.fabric.ReactNativeConfig;
|
||||
import com.facebook.react.uimanager.ViewManagerRegistry;
|
||||
import org.bigbug.member.rnapp.BuildConfig;
|
||||
import org.bigbug.member.rnapp.newarchitecture.components.MainComponentsRegistry;
|
||||
import org.bigbug.member.rnapp.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
|
||||
import pro.aili.temporary.BuildConfig;
|
||||
import pro.aili.temporary.newarchitecture.components.MainComponentsRegistry;
|
||||
import pro.aili.temporary.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.bigbug.member.rnapp.newarchitecture.components;
|
||||
package pro.aili.temporary.newarchitecture.components;
|
||||
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.bigbug.member.rnapp.newarchitecture.modules;
|
||||
package pro.aili.temporary.newarchitecture.modules;
|
||||
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.react.ReactPackage;
|
||||
@ -0,0 +1,16 @@
|
||||
package pro.aili.temporary.wxapi;
|
||||
|
||||
// react-native-wechat-lib support (
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import com.wechatlib.WeChatLibModule;
|
||||
|
||||
public class WXEntryActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
WeChatLibModule.handleIntent(getIntent());
|
||||
finish();
|
||||
}
|
||||
}
|
||||
// )
|
||||
@ -1,6 +0,0 @@
|
||||
//
|
||||
// File.swift
|
||||
// WechatLibExample
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@ -1,8 +1,25 @@
|
||||
require_relative '../node_modules/react-native/scripts/react_native_pods'
|
||||
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
||||
|
||||
platform :ios, '12.4'
|
||||
install! 'cocoapods', :deterministic_uuids => false
|
||||
platform :ios, min_ios_version_supported
|
||||
prepare_react_native_project!
|
||||
|
||||
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
|
||||
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
|
||||
#
|
||||
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
|
||||
# ```js
|
||||
# module.exports = {
|
||||
# dependencies: {
|
||||
# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
|
||||
# ```
|
||||
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
|
||||
|
||||
linkage = ENV['USE_FRAMEWORKS']
|
||||
if linkage != nil
|
||||
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
|
||||
use_frameworks! :linkage => linkage.to_sym
|
||||
end
|
||||
|
||||
target 'WechatLibExample' do
|
||||
config = use_native_modules!
|
||||
@ -15,13 +32,13 @@ target 'WechatLibExample' do
|
||||
# Hermes is now enabled by default. Disable by setting this flag to false.
|
||||
# Upcoming versions of React Native may rely on get_default_flags(), but
|
||||
# we make it explicit here to aid in the React Native upgrade process.
|
||||
:hermes_enabled => true,
|
||||
:hermes_enabled => flags[:hermes_enabled],
|
||||
:fabric_enabled => flags[:fabric_enabled],
|
||||
# Enables Flipper.
|
||||
#
|
||||
# Note that if you have use_frameworks! enabled, Flipper will not work and
|
||||
# you should disable the next line.
|
||||
:flipper_configuration => FlipperConfiguration.enabled,
|
||||
:flipper_configuration => flipper_config,
|
||||
# An absolute path to your application root.
|
||||
:app_path => "#{Pod::Config.instance.installation_root}/.."
|
||||
)
|
||||
|
||||
629
example/ios/Podfile.lock
Normal file
629
example/ios/Podfile.lock
Normal file
@ -0,0 +1,629 @@
|
||||
PODS:
|
||||
- boost (1.76.0)
|
||||
- CocoaAsyncSocket (7.6.5)
|
||||
- DoubleConversion (1.1.6)
|
||||
- FBLazyVector (0.71.3)
|
||||
- FBReactNativeSpec (0.71.3):
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- RCTRequired (= 0.71.3)
|
||||
- RCTTypeSafety (= 0.71.3)
|
||||
- React-Core (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (= 0.71.3)
|
||||
- Flipper (0.125.0):
|
||||
- Flipper-Folly (~> 2.6)
|
||||
- Flipper-RSocket (~> 1.4)
|
||||
- Flipper-Boost-iOSX (1.76.0.1.11)
|
||||
- Flipper-DoubleConversion (3.2.0.1)
|
||||
- Flipper-Fmt (7.1.7)
|
||||
- Flipper-Folly (2.6.10):
|
||||
- Flipper-Boost-iOSX
|
||||
- Flipper-DoubleConversion
|
||||
- Flipper-Fmt (= 7.1.7)
|
||||
- Flipper-Glog
|
||||
- libevent (~> 2.1.12)
|
||||
- OpenSSL-Universal (= 1.1.1100)
|
||||
- Flipper-Glog (0.5.0.5)
|
||||
- Flipper-PeerTalk (0.0.4)
|
||||
- Flipper-RSocket (1.4.3):
|
||||
- Flipper-Folly (~> 2.6)
|
||||
- FlipperKit (0.125.0):
|
||||
- FlipperKit/Core (= 0.125.0)
|
||||
- FlipperKit/Core (0.125.0):
|
||||
- Flipper (~> 0.125.0)
|
||||
- FlipperKit/CppBridge
|
||||
- FlipperKit/FBCxxFollyDynamicConvert
|
||||
- FlipperKit/FBDefines
|
||||
- FlipperKit/FKPortForwarding
|
||||
- SocketRocket (~> 0.6.0)
|
||||
- FlipperKit/CppBridge (0.125.0):
|
||||
- Flipper (~> 0.125.0)
|
||||
- FlipperKit/FBCxxFollyDynamicConvert (0.125.0):
|
||||
- Flipper-Folly (~> 2.6)
|
||||
- FlipperKit/FBDefines (0.125.0)
|
||||
- FlipperKit/FKPortForwarding (0.125.0):
|
||||
- CocoaAsyncSocket (~> 7.6)
|
||||
- Flipper-PeerTalk (~> 0.0.4)
|
||||
- FlipperKit/FlipperKitHighlightOverlay (0.125.0)
|
||||
- FlipperKit/FlipperKitLayoutHelpers (0.125.0):
|
||||
- FlipperKit/Core
|
||||
- FlipperKit/FlipperKitHighlightOverlay
|
||||
- FlipperKit/FlipperKitLayoutTextSearchable
|
||||
- FlipperKit/FlipperKitLayoutIOSDescriptors (0.125.0):
|
||||
- FlipperKit/Core
|
||||
- FlipperKit/FlipperKitHighlightOverlay
|
||||
- FlipperKit/FlipperKitLayoutHelpers
|
||||
- YogaKit (~> 1.18)
|
||||
- FlipperKit/FlipperKitLayoutPlugin (0.125.0):
|
||||
- FlipperKit/Core
|
||||
- FlipperKit/FlipperKitHighlightOverlay
|
||||
- FlipperKit/FlipperKitLayoutHelpers
|
||||
- FlipperKit/FlipperKitLayoutIOSDescriptors
|
||||
- FlipperKit/FlipperKitLayoutTextSearchable
|
||||
- YogaKit (~> 1.18)
|
||||
- FlipperKit/FlipperKitLayoutTextSearchable (0.125.0)
|
||||
- FlipperKit/FlipperKitNetworkPlugin (0.125.0):
|
||||
- FlipperKit/Core
|
||||
- FlipperKit/FlipperKitReactPlugin (0.125.0):
|
||||
- FlipperKit/Core
|
||||
- FlipperKit/FlipperKitUserDefaultsPlugin (0.125.0):
|
||||
- FlipperKit/Core
|
||||
- FlipperKit/SKIOSNetworkPlugin (0.125.0):
|
||||
- FlipperKit/Core
|
||||
- FlipperKit/FlipperKitNetworkPlugin
|
||||
- fmt (6.2.1)
|
||||
- glog (0.3.5)
|
||||
- hermes-engine (0.71.3):
|
||||
- hermes-engine/Pre-built (= 0.71.3)
|
||||
- hermes-engine/Pre-built (0.71.3)
|
||||
- libevent (2.1.12)
|
||||
- OpenSSL-Universal (1.1.1100)
|
||||
- RCT-Folly (2021.07.22.00):
|
||||
- boost
|
||||
- DoubleConversion
|
||||
- fmt (~> 6.2.1)
|
||||
- glog
|
||||
- RCT-Folly/Default (= 2021.07.22.00)
|
||||
- RCT-Folly/Default (2021.07.22.00):
|
||||
- boost
|
||||
- DoubleConversion
|
||||
- fmt (~> 6.2.1)
|
||||
- glog
|
||||
- RCT-Folly/Futures (2021.07.22.00):
|
||||
- boost
|
||||
- DoubleConversion
|
||||
- fmt (~> 6.2.1)
|
||||
- glog
|
||||
- libevent
|
||||
- RCTRequired (0.71.3)
|
||||
- RCTTypeSafety (0.71.3):
|
||||
- FBLazyVector (= 0.71.3)
|
||||
- RCTRequired (= 0.71.3)
|
||||
- React-Core (= 0.71.3)
|
||||
- React (0.71.3):
|
||||
- React-Core (= 0.71.3)
|
||||
- React-Core/DevSupport (= 0.71.3)
|
||||
- React-Core/RCTWebSocket (= 0.71.3)
|
||||
- React-RCTActionSheet (= 0.71.3)
|
||||
- React-RCTAnimation (= 0.71.3)
|
||||
- React-RCTBlob (= 0.71.3)
|
||||
- React-RCTImage (= 0.71.3)
|
||||
- React-RCTLinking (= 0.71.3)
|
||||
- React-RCTNetwork (= 0.71.3)
|
||||
- React-RCTSettings (= 0.71.3)
|
||||
- React-RCTText (= 0.71.3)
|
||||
- React-RCTVibration (= 0.71.3)
|
||||
- React-callinvoker (0.71.3)
|
||||
- React-Codegen (0.71.3):
|
||||
- FBReactNativeSpec
|
||||
- hermes-engine
|
||||
- RCT-Folly
|
||||
- RCTRequired
|
||||
- RCTTypeSafety
|
||||
- React-Core
|
||||
- React-jsi
|
||||
- React-jsiexecutor
|
||||
- ReactCommon/turbomodule/bridging
|
||||
- ReactCommon/turbomodule/core
|
||||
- React-Core (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default (= 0.71.3)
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/CoreModulesHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/Default (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/DevSupport (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default (= 0.71.3)
|
||||
- React-Core/RCTWebSocket (= 0.71.3)
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-jsinspector (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTActionSheetHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTAnimationHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTBlobHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTImageHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTLinkingHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTNetworkHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTSettingsHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTTextHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTVibrationHeaders (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-Core/RCTWebSocket (0.71.3):
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Core/Default (= 0.71.3)
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-hermes
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- Yoga
|
||||
- React-CoreModules (0.71.3):
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- RCTTypeSafety (= 0.71.3)
|
||||
- React-Codegen (= 0.71.3)
|
||||
- React-Core/CoreModulesHeaders (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-RCTBlob
|
||||
- React-RCTImage (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (= 0.71.3)
|
||||
- React-cxxreact (0.71.3):
|
||||
- boost (= 1.76.0)
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-callinvoker (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-jsinspector (= 0.71.3)
|
||||
- React-logger (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- React-runtimeexecutor (= 0.71.3)
|
||||
- React-hermes (0.71.3):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- RCT-Folly/Futures (= 2021.07.22.00)
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-jsi
|
||||
- React-jsiexecutor (= 0.71.3)
|
||||
- React-jsinspector (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- React-jsi (0.71.3):
|
||||
- boost (= 1.76.0)
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-jsiexecutor (0.71.3):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- React-jsinspector (0.71.3)
|
||||
- React-logger (0.71.3):
|
||||
- glog
|
||||
- react-native-wechat-lib (3.0.7):
|
||||
- React-Core
|
||||
- React-perflogger (0.71.3)
|
||||
- React-RCTActionSheet (0.71.3):
|
||||
- React-Core/RCTActionSheetHeaders (= 0.71.3)
|
||||
- React-RCTAnimation (0.71.3):
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- RCTTypeSafety (= 0.71.3)
|
||||
- React-Codegen (= 0.71.3)
|
||||
- React-Core/RCTAnimationHeaders (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (= 0.71.3)
|
||||
- React-RCTAppDelegate (0.71.3):
|
||||
- RCT-Folly
|
||||
- RCTRequired
|
||||
- RCTTypeSafety
|
||||
- React-Core
|
||||
- ReactCommon/turbomodule/core
|
||||
- React-RCTBlob (0.71.3):
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Codegen (= 0.71.3)
|
||||
- React-Core/RCTBlobHeaders (= 0.71.3)
|
||||
- React-Core/RCTWebSocket (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-RCTNetwork (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (= 0.71.3)
|
||||
- React-RCTImage (0.71.3):
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- RCTTypeSafety (= 0.71.3)
|
||||
- React-Codegen (= 0.71.3)
|
||||
- React-Core/RCTImageHeaders (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-RCTNetwork (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (= 0.71.3)
|
||||
- React-RCTLinking (0.71.3):
|
||||
- React-Codegen (= 0.71.3)
|
||||
- React-Core/RCTLinkingHeaders (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (= 0.71.3)
|
||||
- React-RCTNetwork (0.71.3):
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- RCTTypeSafety (= 0.71.3)
|
||||
- React-Codegen (= 0.71.3)
|
||||
- React-Core/RCTNetworkHeaders (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (= 0.71.3)
|
||||
- React-RCTSettings (0.71.3):
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- RCTTypeSafety (= 0.71.3)
|
||||
- React-Codegen (= 0.71.3)
|
||||
- React-Core/RCTSettingsHeaders (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (= 0.71.3)
|
||||
- React-RCTText (0.71.3):
|
||||
- React-Core/RCTTextHeaders (= 0.71.3)
|
||||
- React-RCTVibration (0.71.3):
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-Codegen (= 0.71.3)
|
||||
- React-Core/RCTVibrationHeaders (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (= 0.71.3)
|
||||
- React-runtimeexecutor (0.71.3):
|
||||
- React-jsi (= 0.71.3)
|
||||
- ReactCommon/turbomodule/bridging (0.71.3):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-callinvoker (= 0.71.3)
|
||||
- React-Core (= 0.71.3)
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-logger (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- ReactCommon/turbomodule/core (0.71.3):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
- RCT-Folly (= 2021.07.22.00)
|
||||
- React-callinvoker (= 0.71.3)
|
||||
- React-Core (= 0.71.3)
|
||||
- React-cxxreact (= 0.71.3)
|
||||
- React-jsi (= 0.71.3)
|
||||
- React-logger (= 0.71.3)
|
||||
- React-perflogger (= 0.71.3)
|
||||
- SocketRocket (0.6.0)
|
||||
- Yoga (1.14.0)
|
||||
- YogaKit (1.18.1):
|
||||
- Yoga (~> 1.14)
|
||||
|
||||
DEPENDENCIES:
|
||||
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
|
||||
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
|
||||
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
|
||||
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
|
||||
- Flipper (= 0.125.0)
|
||||
- Flipper-Boost-iOSX (= 1.76.0.1.11)
|
||||
- Flipper-DoubleConversion (= 3.2.0.1)
|
||||
- Flipper-Fmt (= 7.1.7)
|
||||
- Flipper-Folly (= 2.6.10)
|
||||
- Flipper-Glog (= 0.5.0.5)
|
||||
- Flipper-PeerTalk (= 0.0.4)
|
||||
- Flipper-RSocket (= 1.4.3)
|
||||
- FlipperKit (= 0.125.0)
|
||||
- FlipperKit/Core (= 0.125.0)
|
||||
- FlipperKit/CppBridge (= 0.125.0)
|
||||
- FlipperKit/FBCxxFollyDynamicConvert (= 0.125.0)
|
||||
- FlipperKit/FBDefines (= 0.125.0)
|
||||
- FlipperKit/FKPortForwarding (= 0.125.0)
|
||||
- FlipperKit/FlipperKitHighlightOverlay (= 0.125.0)
|
||||
- FlipperKit/FlipperKitLayoutPlugin (= 0.125.0)
|
||||
- FlipperKit/FlipperKitLayoutTextSearchable (= 0.125.0)
|
||||
- FlipperKit/FlipperKitNetworkPlugin (= 0.125.0)
|
||||
- FlipperKit/FlipperKitReactPlugin (= 0.125.0)
|
||||
- FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0)
|
||||
- FlipperKit/SKIOSNetworkPlugin (= 0.125.0)
|
||||
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
|
||||
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
|
||||
- libevent (~> 2.1.12)
|
||||
- OpenSSL-Universal (= 1.1.1100)
|
||||
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
|
||||
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
|
||||
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
|
||||
- React (from `../node_modules/react-native/`)
|
||||
- React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
|
||||
- React-Codegen (from `build/generated/ios`)
|
||||
- React-Core (from `../node_modules/react-native/`)
|
||||
- React-Core/DevSupport (from `../node_modules/react-native/`)
|
||||
- React-Core/RCTWebSocket (from `../node_modules/react-native/`)
|
||||
- React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
|
||||
- React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
|
||||
- React-hermes (from `../node_modules/react-native/ReactCommon/hermes`)
|
||||
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
|
||||
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
|
||||
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
|
||||
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
|
||||
- react-native-wechat-lib (from `../..`)
|
||||
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
|
||||
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
|
||||
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
|
||||
- React-RCTAppDelegate (from `../node_modules/react-native/Libraries/AppDelegate`)
|
||||
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
|
||||
- React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
|
||||
- React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
|
||||
- React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
|
||||
- React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
|
||||
- React-RCTText (from `../node_modules/react-native/Libraries/Text`)
|
||||
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
|
||||
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
|
||||
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
|
||||
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- CocoaAsyncSocket
|
||||
- Flipper
|
||||
- Flipper-Boost-iOSX
|
||||
- Flipper-DoubleConversion
|
||||
- Flipper-Fmt
|
||||
- Flipper-Folly
|
||||
- Flipper-Glog
|
||||
- Flipper-PeerTalk
|
||||
- Flipper-RSocket
|
||||
- FlipperKit
|
||||
- fmt
|
||||
- libevent
|
||||
- OpenSSL-Universal
|
||||
- SocketRocket
|
||||
- YogaKit
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
boost:
|
||||
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
|
||||
DoubleConversion:
|
||||
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
|
||||
FBLazyVector:
|
||||
:path: "../node_modules/react-native/Libraries/FBLazyVector"
|
||||
FBReactNativeSpec:
|
||||
:path: "../node_modules/react-native/React/FBReactNativeSpec"
|
||||
glog:
|
||||
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
|
||||
hermes-engine:
|
||||
:podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
|
||||
RCT-Folly:
|
||||
:podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
|
||||
RCTRequired:
|
||||
:path: "../node_modules/react-native/Libraries/RCTRequired"
|
||||
RCTTypeSafety:
|
||||
:path: "../node_modules/react-native/Libraries/TypeSafety"
|
||||
React:
|
||||
:path: "../node_modules/react-native/"
|
||||
React-callinvoker:
|
||||
:path: "../node_modules/react-native/ReactCommon/callinvoker"
|
||||
React-Codegen:
|
||||
:path: build/generated/ios
|
||||
React-Core:
|
||||
:path: "../node_modules/react-native/"
|
||||
React-CoreModules:
|
||||
:path: "../node_modules/react-native/React/CoreModules"
|
||||
React-cxxreact:
|
||||
:path: "../node_modules/react-native/ReactCommon/cxxreact"
|
||||
React-hermes:
|
||||
:path: "../node_modules/react-native/ReactCommon/hermes"
|
||||
React-jsi:
|
||||
:path: "../node_modules/react-native/ReactCommon/jsi"
|
||||
React-jsiexecutor:
|
||||
:path: "../node_modules/react-native/ReactCommon/jsiexecutor"
|
||||
React-jsinspector:
|
||||
:path: "../node_modules/react-native/ReactCommon/jsinspector"
|
||||
React-logger:
|
||||
:path: "../node_modules/react-native/ReactCommon/logger"
|
||||
react-native-wechat-lib:
|
||||
:path: "../.."
|
||||
React-perflogger:
|
||||
:path: "../node_modules/react-native/ReactCommon/reactperflogger"
|
||||
React-RCTActionSheet:
|
||||
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
|
||||
React-RCTAnimation:
|
||||
:path: "../node_modules/react-native/Libraries/NativeAnimation"
|
||||
React-RCTAppDelegate:
|
||||
:path: "../node_modules/react-native/Libraries/AppDelegate"
|
||||
React-RCTBlob:
|
||||
:path: "../node_modules/react-native/Libraries/Blob"
|
||||
React-RCTImage:
|
||||
:path: "../node_modules/react-native/Libraries/Image"
|
||||
React-RCTLinking:
|
||||
:path: "../node_modules/react-native/Libraries/LinkingIOS"
|
||||
React-RCTNetwork:
|
||||
:path: "../node_modules/react-native/Libraries/Network"
|
||||
React-RCTSettings:
|
||||
:path: "../node_modules/react-native/Libraries/Settings"
|
||||
React-RCTText:
|
||||
:path: "../node_modules/react-native/Libraries/Text"
|
||||
React-RCTVibration:
|
||||
:path: "../node_modules/react-native/Libraries/Vibration"
|
||||
React-runtimeexecutor:
|
||||
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
|
||||
ReactCommon:
|
||||
:path: "../node_modules/react-native/ReactCommon"
|
||||
Yoga:
|
||||
:path: "../node_modules/react-native/ReactCommon/yoga"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
boost: 57d2868c099736d80fcd648bf211b4431e51a558
|
||||
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
|
||||
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
|
||||
FBLazyVector: 60195509584153283780abdac5569feffb8f08cc
|
||||
FBReactNativeSpec: 9c191fb58d06dc05ab5559a5505fc32139e9e4a2
|
||||
Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
|
||||
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
|
||||
Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
|
||||
Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b
|
||||
Flipper-Folly: 584845625005ff068a6ebf41f857f468decd26b3
|
||||
Flipper-Glog: 70c50ce58ddaf67dc35180db05f191692570f446
|
||||
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
|
||||
Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541
|
||||
FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
|
||||
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
|
||||
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
|
||||
hermes-engine: 38bfe887e456b33b697187570a08de33969f5db7
|
||||
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
|
||||
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
|
||||
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
|
||||
RCTRequired: bec48f07daf7bcdc2655a0cde84e07d24d2a9e2a
|
||||
RCTTypeSafety: 171394eebacf71e1cfad79dbfae7ee8fc16ca80a
|
||||
React: d7433ccb6a8c36e4cbed59a73c0700fc83c3e98a
|
||||
React-callinvoker: 15f165009bd22ae829b2b600e50bcc98076ce4b8
|
||||
React-Codegen: b5910000eaf1e0c2f47d29be6f82f5f1264420d7
|
||||
React-Core: b6f2f78d580a90b83fd7b0d1c6911c799f6eac82
|
||||
React-CoreModules: e0cbc1a4f4f3f60e23c476fef7ab37be363ea8c1
|
||||
React-cxxreact: c87f3f124b2117d00d410b35f16c2257e25e50fa
|
||||
React-hermes: c64ca6bdf16a7069773103c9bedaf30ec90ab38f
|
||||
React-jsi: 39729361645568e238081b3b3180fbad803f25a4
|
||||
React-jsiexecutor: 515b703d23ffadeac7687bc2d12fb08b90f0aaa1
|
||||
React-jsinspector: 9f7c9137605e72ca0343db4cea88006cb94856dd
|
||||
React-logger: 957e5dc96d9dbffc6e0f15e0ee4d2b42829ff207
|
||||
react-native-wechat-lib: d37f3f48a00b7bb31a79ec1b23574881457788c9
|
||||
React-perflogger: af8a3d31546077f42d729b949925cc4549f14def
|
||||
React-RCTActionSheet: 57cc5adfefbaaf0aae2cf7e10bccd746f2903673
|
||||
React-RCTAnimation: 11c61e94da700c4dc915cf134513764d87fc5e2b
|
||||
React-RCTAppDelegate: c3980adeaadcfd6cb495532e928b36ac6db3c14a
|
||||
React-RCTBlob: ccc5049d742b41971141415ca86b83b201495695
|
||||
React-RCTImage: 7a9226b0944f1e76e8e01e35a9245c2477cdbabb
|
||||
React-RCTLinking: bbe8cc582046a9c04f79c235b73c93700263e8b4
|
||||
React-RCTNetwork: fc2ca322159dc54e06508d4f5c3e934da63dc013
|
||||
React-RCTSettings: f1e9db2cdf946426d3f2b210e4ff4ce0f0d842ef
|
||||
React-RCTText: 1c41dd57e5d742b1396b4eeb251851ce7ff0fca1
|
||||
React-RCTVibration: 5199a180d04873366a83855de55ac33ce60fe4d5
|
||||
React-runtimeexecutor: 7bf0dafc7b727d93c8cb94eb00a9d3753c446c3e
|
||||
ReactCommon: 6f65ea5b7d84deb9e386f670dd11ce499ded7b40
|
||||
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
|
||||
Yoga: 5ed1699acbba8863755998a4245daa200ff3817b
|
||||
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
|
||||
|
||||
PODFILE CHECKSUM: 3e0608910f8aee329702f393731ceca84ecddaf5
|
||||
|
||||
COCOAPODS: 1.11.3
|
||||
@ -1,3 +0,0 @@
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
@ -14,6 +14,7 @@
|
||||
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
||||
7699B88040F8A987B510C191 /* libPods-WechatLibExample-WechatLibExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-WechatLibExample-WechatLibExampleTests.a */; };
|
||||
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
|
||||
869359A329A52416006D40AA /* libWeChatSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 869359A229A52416006D40AA /* libWeChatSDK.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -42,6 +43,7 @@
|
||||
5B7EB9410499542E8C5724F5 /* Pods-WechatLibExample-WechatLibExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WechatLibExample-WechatLibExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-WechatLibExample-WechatLibExampleTests/Pods-WechatLibExample-WechatLibExampleTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
5DCACB8F33CDC322A6C60F78 /* libPods-WechatLibExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-WechatLibExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = WechatLibExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
869359A229A52416006D40AA /* libWeChatSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWeChatSDK.a; sourceTree = "<group>"; };
|
||||
89C6BE57DB24E9ADA2F236DE /* Pods-WechatLibExample-WechatLibExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WechatLibExample-WechatLibExampleTests.release.xcconfig"; path = "Target Support Files/Pods-WechatLibExample-WechatLibExampleTests/Pods-WechatLibExample-WechatLibExampleTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
|
||||
/* End PBXFileReference section */
|
||||
@ -59,6 +61,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
869359A329A52416006D40AA /* libWeChatSDK.a in Frameworks */,
|
||||
0C80B921A6F3F58F76C31292 /* libPods-WechatLibExample.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -86,6 +89,7 @@
|
||||
13B07FAE1A68108700A75B9A /* WechatLibExample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
869359A229A52416006D40AA /* libWeChatSDK.a */,
|
||||
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
|
||||
13B07FB01A68108700A75B9A /* AppDelegate.mm */,
|
||||
13B07FB51A68108700A75B9A /* Images.xcassets */,
|
||||
@ -486,12 +490,19 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 865ZADD3MJ;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = WechatLibExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/usr/lib/swift",
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-ObjC",
|
||||
@ -512,11 +523,18 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 865ZADD3MJ;
|
||||
INFOPLIST_FILE = WechatLibExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/usr/lib/swift",
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-ObjC",
|
||||
@ -562,7 +580,7 @@
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
@ -596,6 +614,7 @@
|
||||
"-DFOLLY_MOBILE=1",
|
||||
"-DFOLLY_USE_LIBCPP=1",
|
||||
);
|
||||
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
@ -633,7 +652,7 @@
|
||||
COPY_PHASE_STRIP = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
@ -659,6 +678,7 @@
|
||||
"-DFOLLY_MOBILE=1",
|
||||
"-DFOLLY_USE_LIBCPP=1",
|
||||
);
|
||||
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
|
||||
10
example/ios/WechatLibExample.xcworkspace/contents.xcworkspacedata
generated
Normal file
10
example/ios/WechatLibExample.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:WechatLibExample.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -1,8 +1,6 @@
|
||||
#import <React/RCTBridgeDelegate.h>
|
||||
#import <RCTAppDelegate.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
|
||||
|
||||
@property (nonatomic, strong) UIWindow *window;
|
||||
@interface AppDelegate : RCTAppDelegate
|
||||
|
||||
@end
|
||||
|
||||
@ -1,85 +1,17 @@
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
#import <React/RCTRootView.h>
|
||||
|
||||
#import <React/RCTAppSetupUtils.h>
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
#import <React/CoreModulesPlugins.h>
|
||||
#import <React/RCTCxxBridgeDelegate.h>
|
||||
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
|
||||
#import <React/RCTSurfacePresenter.h>
|
||||
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
||||
#import <ReactCommon/RCTTurboModuleManager.h>
|
||||
|
||||
#import <react/config/ReactNativeConfig.h>
|
||||
|
||||
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
|
||||
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
|
||||
RCTTurboModuleManager *_turboModuleManager;
|
||||
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
|
||||
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
|
||||
facebook::react::ContextContainer::Shared _contextContainer;
|
||||
}
|
||||
@end
|
||||
#endif
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
RCTAppSetupPrepareApp(application);
|
||||
self.moduleName = @"WechatLibExample";
|
||||
// You can add your custom initial props in the dictionary below.
|
||||
// They will be passed down to the ViewController used by React Native.
|
||||
self.initialProps = @{};
|
||||
|
||||
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
|
||||
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
|
||||
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
|
||||
_bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
|
||||
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
|
||||
#endif
|
||||
|
||||
NSDictionary *initProps = [self prepareInitialProps];
|
||||
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"WechatLibExample", initProps);
|
||||
|
||||
if (@available(iOS 13.0, *)) {
|
||||
rootView.backgroundColor = [UIColor systemBackgroundColor];
|
||||
} else {
|
||||
rootView.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
UIViewController *rootViewController = [UIViewController new];
|
||||
rootViewController.view = rootView;
|
||||
self.window.rootViewController = rootViewController;
|
||||
[self.window makeKeyAndVisible];
|
||||
return YES;
|
||||
}
|
||||
|
||||
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
|
||||
///
|
||||
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
|
||||
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
|
||||
/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
|
||||
- (BOOL)concurrentRootEnabled
|
||||
{
|
||||
// Switch this bool to turn on and off the concurrent root
|
||||
return true;
|
||||
}
|
||||
|
||||
- (NSDictionary *)prepareInitialProps
|
||||
{
|
||||
NSMutableDictionary *initProps = [NSMutableDictionary new];
|
||||
|
||||
#ifdef RCT_NEW_ARCH_ENABLED
|
||||
initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
|
||||
#endif
|
||||
|
||||
return initProps;
|
||||
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
}
|
||||
|
||||
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
||||
@ -91,43 +23,14 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
#endif
|
||||
}
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
|
||||
#pragma mark - RCTCxxBridgeDelegate
|
||||
|
||||
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
|
||||
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
|
||||
///
|
||||
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
|
||||
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
|
||||
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
|
||||
- (BOOL)concurrentRootEnabled
|
||||
{
|
||||
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
||||
delegate:self
|
||||
jsInvoker:bridge.jsCallInvoker];
|
||||
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma mark RCTTurboModuleManagerDelegate
|
||||
|
||||
- (Class)getModuleClassFromName:(const char *)name
|
||||
{
|
||||
return RCTCoreModulesClassProvider(name);
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
initParams:
|
||||
(const facebook::react::ObjCTurboModule::InitParams &)params
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
||||
{
|
||||
return RCTAppSetupDefaultModuleFromClass(moduleClass);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@ -17,11 +17,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
|
||||
BIN
example/ios/libWeChatSDK.a
Normal file
BIN
example/ios/libWeChatSDK.a
Normal file
Binary file not shown.
@ -10,12 +10,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "18.1.0",
|
||||
"react-native": "0.70.6"
|
||||
"react-native": "0.71.3",
|
||||
"react-native-wechat-lib": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.9",
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@babel/core": "7.12.9",
|
||||
"@babel/runtime": "7.12.5",
|
||||
"metro-react-native-babel-preset": "0.72.3",
|
||||
"babel-plugin-module-resolver": "^4.1.0"
|
||||
"babel-plugin-module-resolver": "4.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { StyleSheet, View, Text, Button, Alert } from 'react-native';
|
||||
import { getApiVersion, registerApp, openWXApp, sendAuthRequest } from 'react-native-wechat-lib';
|
||||
import { getApiVersion, registerApp, openWXApp, sendAuthRequest, shareText } from 'react-native-wechat-lib';
|
||||
|
||||
export default function App() {
|
||||
const [versionNumber, setVersionNumber] = React.useState<string | undefined>();
|
||||
|
||||
React.useEffect(() => {
|
||||
registerApp('wx48d112e107595c4f', 'universalLink').then((res) => {
|
||||
registerApp('wx7973caefdffba1b8', 'universalLink').then((res) => {
|
||||
console.log("registerApp: " + res)
|
||||
getApiVersion().then((num) => {
|
||||
console.log("test: " + num)
|
||||
@ -18,7 +18,7 @@ export default function App() {
|
||||
|
||||
}, []);
|
||||
|
||||
function login() {
|
||||
function onLogin() {
|
||||
sendAuthRequest('snsapi_userinfo', '')
|
||||
.then((response: any) => {
|
||||
// todo 登录 response.code
|
||||
@ -36,6 +36,13 @@ export default function App() {
|
||||
|
||||
}
|
||||
|
||||
function onShareText() {
|
||||
shareText({
|
||||
text: 'test content.',
|
||||
scene: 0
|
||||
}).then()
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>Call wechat SDK demo</Text>
|
||||
@ -47,7 +54,10 @@ export default function App() {
|
||||
<Button title={'拉起微信'} onPress={() => { openWXApp().then() }} />
|
||||
</View>
|
||||
<View style={styles.button}>
|
||||
<Button title={'授权登录'} onPress={() => { login() }} />
|
||||
<Button title={'授权登录'} onPress={() => { onLogin() }} />
|
||||
</View>
|
||||
<View style={styles.button}>
|
||||
<Button title={'分享'} onPress={() => { onShareText() }} />
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
1189
example/yarn.lock
1189
example/yarn.lock
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
//
|
||||
// test3
|
||||
// WXApi.h
|
||||
// 所有Api接口
|
||||
//
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#define RCTWXEventName @"WeChat_Resp"
|
||||
#define RCTWXEventNameWeChatReq @"WeChat_Req"
|
||||
|
||||
@interface WechatLib : NSObject <RCTBridgeModule, WXApiDelegate>
|
||||
@interface WeChat : NSObject <RCTBridgeModule, WXApiDelegate>
|
||||
|
||||
@property NSString* appId;
|
||||
|
||||
|
||||
468
ios/WechatLib.mm
468
ios/WechatLib.mm
@ -1,52 +1,54 @@
|
||||
// Created by little-snow-fox on 2019-10-9.
|
||||
#import "WechatLib.h"
|
||||
#import "WXApiObject.h"
|
||||
#import <React/RCTEventDispatcher.h>
|
||||
#import "WechatLib.h"
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <React/RCTEventDispatcher.h>
|
||||
#import <React/RCTImageLoader.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import "WechatAuthSDK.h"
|
||||
|
||||
@implementation WechatLib
|
||||
|
||||
@interface WeChat () <WechatAuthAPIDelegate>
|
||||
@property (nonatomic, strong) WechatAuthSDK *authSDK;
|
||||
@property (nonatomic, strong) RCTResponseSenderBlock scanCallback;
|
||||
@end
|
||||
|
||||
@implementation WeChat
|
||||
|
||||
// Define error messages
|
||||
#define NOT_REGISTERED (@"registerApp required.")
|
||||
#define INVOKE_FAILED (@"WeChat API invoke returns false.")
|
||||
|
||||
@implementation RCTWeChat
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:@"RCTOpenURLNotification" object:nil];
|
||||
self.authSDK = [[WechatAuthSDK alloc] init];
|
||||
self.authSDK.delegate = self;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (BOOL)handleOpenURL:(NSNotification *)aNotification
|
||||
{
|
||||
NSString * aURLString = [aNotification userInfo][@"url"];
|
||||
NSURL * aURL = [NSURL URLWithString:aURLString];
|
||||
- (BOOL)handleOpenURL:(NSNotification *)aNotification {
|
||||
NSString *aURLString = [aNotification userInfo][@"url"];
|
||||
NSURL *aURL = [NSURL URLWithString:aURLString];
|
||||
|
||||
if ([WXApi handleOpenURL:aURL delegate:self])
|
||||
{
|
||||
if ([WXApi handleOpenURL:aURL delegate:self]) {
|
||||
return YES;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (dispatch_queue_t)methodQueue
|
||||
{
|
||||
- (dispatch_queue_t)methodQueue {
|
||||
return dispatch_get_main_queue();
|
||||
}
|
||||
|
||||
@ -55,9 +57,9 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
|
||||
// 获取网络图片的公共方法
|
||||
- (UIImage *) getImageFromURL:(NSString *)fileURL {
|
||||
UIImage * result;
|
||||
NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:fileURL]];
|
||||
- (UIImage *)getImageFromURL:(NSString *)fileURL {
|
||||
UIImage *result;
|
||||
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:fileURL]];
|
||||
result = [UIImage imageWithData:data];
|
||||
return result;
|
||||
}
|
||||
@ -91,7 +93,7 @@ RCT_EXPORT_MODULE()
|
||||
lastDataLength = data.length;
|
||||
CGFloat ratio = (CGFloat)maxLength / data.length;
|
||||
CGSize size = CGSizeMake((NSUInteger)(resultImage.size.width * sqrtf(ratio)),
|
||||
(NSUInteger)(resultImage.size.height * sqrtf(ratio))); // Use NSUInteger to prevent white blank
|
||||
(NSUInteger)(resultImage.size.height * sqrtf(ratio))); // Use NSUInteger to prevent white blank
|
||||
UIGraphicsBeginImageContext(size);
|
||||
[resultImage drawInRect:CGRectMake(0, 0, size.width, size.height)];
|
||||
resultImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
@ -106,10 +108,10 @@ RCT_EXPORT_MODULE()
|
||||
return data;
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(registerApp:(NSString *)appid
|
||||
RCT_EXPORT_METHOD(registerApp
|
||||
:(NSString *)appid
|
||||
:(NSString *)universalLink
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
self.appId = appid;
|
||||
callback(@[[WXApi registerApp:appid universalLink:universalLink] ? [NSNull null] : INVOKE_FAILED]);
|
||||
}
|
||||
@ -121,56 +123,49 @@ RCT_EXPORT_METHOD(registerApp:(NSString *)appid
|
||||
// callback(@[[WXApi registerApp:appid withDescription:appdesc] ? [NSNull null] : INVOKE_FAILED]);
|
||||
// }
|
||||
|
||||
RCT_EXPORT_METHOD(isWXAppInstalled:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(isWXAppInstalled:(RCTResponseSenderBlock)callback) {
|
||||
callback(@[[NSNull null], @([WXApi isWXAppInstalled])]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(isWXAppSupportApi:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(isWXAppSupportApi:(RCTResponseSenderBlock)callback) {
|
||||
callback(@[[NSNull null], @([WXApi isWXAppSupportApi])]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(getWXAppInstallUrl:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(getWXAppInstallUrl:(RCTResponseSenderBlock)callback) {
|
||||
callback(@[[NSNull null], [WXApi getWXAppInstallUrl]]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(getApiVersion:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(getApiVersion:(RCTResponseSenderBlock)callback) {
|
||||
callback(@[[NSNull null], [WXApi getApiVersion]]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(openWXApp:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(openWXApp:(RCTResponseSenderBlock)callback) {
|
||||
callback(@[([WXApi openWXApp] ? [NSNull null] : INVOKE_FAILED)]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(sendRequest:(NSString *)openid
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
BaseReq* req = [[BaseReq alloc] init];
|
||||
RCT_EXPORT_METHOD(sendRequest
|
||||
:(NSString *)openid
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
BaseReq *req = [[BaseReq alloc] init];
|
||||
req.openID = openid;
|
||||
// callback(@[[WXApi sendReq:req] ? [NSNull null] : INVOKE_FAILED]);
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
[WXApi sendReq:req completion:completion];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(sendAuthRequest:(NSString *)scope
|
||||
RCT_EXPORT_METHOD(sendAuthRequest
|
||||
:(NSString *)scope
|
||||
:(NSString *)state
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
SendAuthReq* req = [[SendAuthReq alloc] init];
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
SendAuthReq *req = [[SendAuthReq alloc] init];
|
||||
req.scope = scope;
|
||||
req.state = state;
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -178,13 +173,12 @@ RCT_EXPORT_METHOD(sendAuthRequest:(NSString *)scope
|
||||
[WXApi sendAuthReq:req viewController:rootViewController delegate:self completion:completion];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(sendSuccessResponse:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
BaseResp* resp = [[BaseResp alloc] init];
|
||||
RCT_EXPORT_METHOD(sendSuccessResponse
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
BaseResp *resp = [[BaseResp alloc] init];
|
||||
resp.errCode = WXSuccess;
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -192,15 +186,14 @@ RCT_EXPORT_METHOD(sendSuccessResponse:(RCTResponseSenderBlock)callback)
|
||||
// callback(@[[WXApi sendResp:resp] ? [NSNull null] : INVOKE_FAILED]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(sendErrorCommonResponse:(NSString *)message
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
BaseResp* resp = [[BaseResp alloc] init];
|
||||
RCT_EXPORT_METHOD(sendErrorCommonResponse
|
||||
:(NSString *)message
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
BaseResp *resp = [[BaseResp alloc] init];
|
||||
resp.errCode = WXErrCodeCommon;
|
||||
resp.errStr = message;
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -208,15 +201,14 @@ RCT_EXPORT_METHOD(sendErrorCommonResponse:(NSString *)message
|
||||
// callback(@[[WXApi sendResp:resp] ? [NSNull null] : INVOKE_FAILED]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(sendErrorUserCancelResponse:(NSString *)message
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
BaseResp* resp = [[BaseResp alloc] init];
|
||||
RCT_EXPORT_METHOD(sendErrorUserCancelResponse
|
||||
:(NSString *)message
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
BaseResp *resp = [[BaseResp alloc] init];
|
||||
resp.errCode = WXErrCodeUserCancel;
|
||||
resp.errStr = message;
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -225,16 +217,15 @@ RCT_EXPORT_METHOD(sendErrorUserCancelResponse:(NSString *)message
|
||||
}
|
||||
|
||||
// 分享文本
|
||||
RCT_EXPORT_METHOD(shareText:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(shareText
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = YES;
|
||||
req.text = data[@"text"];
|
||||
req.scene = [data[@"scene"] integerValue];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
req.scene = [data[@"scene"] intValue];
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -242,9 +233,9 @@ RCT_EXPORT_METHOD(shareText:(NSDictionary *)data
|
||||
}
|
||||
|
||||
// 选择发票
|
||||
RCT_EXPORT_METHOD(chooseInvoice:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(chooseInvoice
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
WXChooseInvoiceReq *req = [[WXChooseInvoiceReq alloc] init];
|
||||
req.appID = self.appId;
|
||||
req.timeStamp = [data[@"timeStamp"] intValue];
|
||||
@ -252,9 +243,8 @@ RCT_EXPORT_METHOD(chooseInvoice:(NSDictionary *)data
|
||||
req.cardSign = data[@"cardSign"];
|
||||
req.signType = data[@"signType"];
|
||||
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -262,13 +252,19 @@ RCT_EXPORT_METHOD(chooseInvoice:(NSDictionary *)data
|
||||
}
|
||||
|
||||
// 分享文件
|
||||
RCT_EXPORT_METHOD(shareFile:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(shareFile
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
NSString *url = data[@"url"];
|
||||
WXFileObject *file = [[WXFileObject alloc] init];
|
||||
WXFileObject *file = [[WXFileObject alloc] init];
|
||||
file.fileExtension = data[@"ext"];
|
||||
NSData *fileData = [NSData dataWithContentsOfURL:[NSURL URLWithString: url]];
|
||||
|
||||
NSData *fileData;
|
||||
if ([url hasPrefix:@"http"]) {
|
||||
fileData = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
|
||||
} else {
|
||||
fileData = [NSData dataWithContentsOfFile:url];
|
||||
}
|
||||
file.fileData = fileData;
|
||||
|
||||
WXMediaMessage *message = [WXMediaMessage message];
|
||||
@ -278,10 +274,9 @@ RCT_EXPORT_METHOD(shareFile:(NSDictionary *)data
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = [data[@"scene"] integerValue];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
req.scene = [data[@"scene"] intValue];
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -289,17 +284,16 @@ RCT_EXPORT_METHOD(shareFile:(NSDictionary *)data
|
||||
}
|
||||
|
||||
// 分享图片
|
||||
RCT_EXPORT_METHOD(shareImage:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(shareImage
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
NSString *imageUrl = data[@"imageUrl"];
|
||||
if (imageUrl == NULL || [imageUrl isEqual:@""]) {
|
||||
if (imageUrl == NULL || [imageUrl isEqual:@""]) {
|
||||
callback([NSArray arrayWithObject:@"shareImage: The value of ImageUrl cannot be empty."]);
|
||||
return;
|
||||
}
|
||||
NSRange range = [imageUrl rangeOfString:@"."];
|
||||
if ( range.length == 0)
|
||||
{
|
||||
if (range.length == 0) {
|
||||
callback([NSArray arrayWithObject:@"shareImage: ImageUrl value, Could not find file suffix."]);
|
||||
return;
|
||||
}
|
||||
@ -313,8 +307,8 @@ RCT_EXPORT_METHOD(shareImage:(NSDictionary *)data
|
||||
imageObject.imageData = imageData;
|
||||
|
||||
WXMediaMessage *message = [WXMediaMessage message];
|
||||
// 利用原图压缩出缩略图,确保缩略图大小不大于32KB
|
||||
message.thumbData = [self compressImage: image toByte:32678];
|
||||
// 利用原图压缩出缩略图,确保缩略图大小不大于 32KB
|
||||
message.thumbData = [self compressImage:image toByte:32678];
|
||||
message.mediaObject = imageObject;
|
||||
message.title = data[@"title"];
|
||||
message.description = data[@"description"];
|
||||
@ -322,11 +316,10 @@ RCT_EXPORT_METHOD(shareImage:(NSDictionary *)data
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = [data[@"scene"] integerValue];
|
||||
req.scene = [data[@"scene"] intValue];
|
||||
// [WXApi sendReq:req];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -334,17 +327,16 @@ RCT_EXPORT_METHOD(shareImage:(NSDictionary *)data
|
||||
}
|
||||
|
||||
// 分享本地图片
|
||||
RCT_EXPORT_METHOD(shareLocalImage:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(shareLocalImage
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
NSString *imageUrl = data[@"imageUrl"];
|
||||
if (imageUrl == NULL || [imageUrl isEqual:@""]) {
|
||||
if (imageUrl == NULL || [imageUrl isEqual:@""]) {
|
||||
callback([NSArray arrayWithObject:@"shareLocalImage: The value of ImageUrl cannot be empty."]);
|
||||
return;
|
||||
}
|
||||
NSRange range = [imageUrl rangeOfString:@"."];
|
||||
if ( range.length == 0)
|
||||
{
|
||||
if (range.length == 0) {
|
||||
callback([NSArray arrayWithObject:@"shareLocalImage: ImageUrl value, Could not find file suffix."]);
|
||||
return;
|
||||
}
|
||||
@ -358,8 +350,8 @@ RCT_EXPORT_METHOD(shareLocalImage:(NSDictionary *)data
|
||||
imageObject.imageData = imageData;
|
||||
|
||||
WXMediaMessage *message = [WXMediaMessage message];
|
||||
// 利用原图压缩出缩略图,确保缩略图大小不大于32KB
|
||||
message.thumbData = [self compressImage: image toByte:32678];
|
||||
// 利用原图压缩出缩略图,确保缩略图大小不大于 32KB
|
||||
message.thumbData = [self compressImage:image toByte:32678];
|
||||
message.mediaObject = imageObject;
|
||||
message.title = data[@"title"];
|
||||
message.description = data[@"description"];
|
||||
@ -367,11 +359,10 @@ RCT_EXPORT_METHOD(shareLocalImage:(NSDictionary *)data
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = [data[@"scene"] integerValue];
|
||||
req.scene = [data[@"scene"] intValue];
|
||||
// [WXApi sendReq:req];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -379,9 +370,9 @@ RCT_EXPORT_METHOD(shareLocalImage:(NSDictionary *)data
|
||||
}
|
||||
|
||||
// 分享音乐
|
||||
RCT_EXPORT_METHOD(shareMusic:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(shareMusic
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
WXMusicObject *musicObject = [WXMusicObject object];
|
||||
musicObject.musicUrl = data[@"musicUrl"];
|
||||
musicObject.musicLowBandUrl = data[@"musicLowBandUrl"];
|
||||
@ -395,16 +386,15 @@ RCT_EXPORT_METHOD(shareMusic:(NSDictionary *)data
|
||||
if (thumbImageUrl != NULL && ![thumbImageUrl isEqual:@""]) {
|
||||
// 根据路径下载图片
|
||||
UIImage *image = [self getImageFromURL:thumbImageUrl];
|
||||
message.thumbData = [self compressImage: image toByte:32678];
|
||||
message.thumbData = [self compressImage:image toByte:32678];
|
||||
}
|
||||
message.mediaObject = musicObject;
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = [data[@"scene"] integerValue];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
req.scene = [data[@"scene"] intValue];
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -412,9 +402,9 @@ RCT_EXPORT_METHOD(shareMusic:(NSDictionary *)data
|
||||
}
|
||||
|
||||
// 分享视频
|
||||
RCT_EXPORT_METHOD(shareVideo:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(shareVideo
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
WXVideoObject *videoObject = [WXVideoObject object];
|
||||
videoObject.videoUrl = data[@"videoUrl"];
|
||||
videoObject.videoLowBandUrl = data[@"videoLowBandUrl"];
|
||||
@ -424,26 +414,24 @@ RCT_EXPORT_METHOD(shareVideo:(NSDictionary *)data
|
||||
NSString *thumbImageUrl = data[@"thumbImageUrl"];
|
||||
if (thumbImageUrl != NULL && ![thumbImageUrl isEqual:@""]) {
|
||||
UIImage *image = [self getImageFromURL:thumbImageUrl];
|
||||
message.thumbData = [self compressImage: image toByte:32678];
|
||||
message.thumbData = [self compressImage:image toByte:32678];
|
||||
}
|
||||
message.mediaObject = videoObject;
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = [data[@"scene"] integerValue];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
req.scene = [data[@"scene"] intValue];
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
[WXApi sendReq:req completion:completion];
|
||||
}
|
||||
|
||||
// 分享网页
|
||||
RCT_EXPORT_METHOD(shareWebpage:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(shareWebpage
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
WXWebpageObject *webpageObject = [WXWebpageObject object];
|
||||
webpageObject.webpageUrl = data[@"webpageUrl"];
|
||||
WXMediaMessage *message = [WXMediaMessage message];
|
||||
@ -452,16 +440,15 @@ RCT_EXPORT_METHOD(shareWebpage:(NSDictionary *)data
|
||||
NSString *thumbImageUrl = data[@"thumbImageUrl"];
|
||||
if (thumbImageUrl != NULL && ![thumbImageUrl isEqual:@""]) {
|
||||
UIImage *image = [self getImageFromURL:thumbImageUrl];
|
||||
message.thumbData = [self compressImage: image toByte:32678];
|
||||
message.thumbData = [self compressImage:image toByte:32678];
|
||||
}
|
||||
message.mediaObject = webpageObject;
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = [data[@"scene"] integerValue];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
req.scene = [data[@"scene"] intValue];
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -469,9 +456,9 @@ RCT_EXPORT_METHOD(shareWebpage:(NSDictionary *)data
|
||||
}
|
||||
|
||||
// 分享小程序
|
||||
RCT_EXPORT_METHOD(shareMiniProgram:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(shareMiniProgram
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
WXMiniProgramObject *object = [WXMiniProgramObject object];
|
||||
object.webpageUrl = data[@"webpageUrl"];
|
||||
object.userName = data[@"userName"];
|
||||
@ -479,29 +466,29 @@ RCT_EXPORT_METHOD(shareMiniProgram:(NSDictionary *)data
|
||||
NSString *hdImageUrl = data[@"hdImageUrl"];
|
||||
if (hdImageUrl != NULL && ![hdImageUrl isEqual:@""]) {
|
||||
UIImage *image = [self getImageFromURL:hdImageUrl];
|
||||
// 压缩图片到小于128KB
|
||||
object.hdImageData = [self compressImage: image toByte:131072];
|
||||
// 压缩图片到小于 128KB
|
||||
object.hdImageData = [self compressImage:image toByte:131072];
|
||||
}
|
||||
object.withShareTicket = data[@"withShareTicket"];
|
||||
object.miniProgramType = [data[@"miniProgramType"] integerValue];
|
||||
int miniProgramType = [data[@"miniProgramType"] integerValue];
|
||||
object.miniProgramType = [self integerToWXMiniProgramType:miniProgramType];
|
||||
WXMediaMessage *message = [WXMediaMessage message];
|
||||
message.title = data[@"title"];
|
||||
message.description = data[@"description"];
|
||||
//兼容旧版本节点的图片,小于32KB,新版本优先
|
||||
//使用WXMiniProgramObject的hdImageData属性
|
||||
// 兼容旧版本节点的图片,小于 32KB,新版本优先
|
||||
// 使用 WXMiniProgramObject 的 hdImageData 属性
|
||||
NSString *thumbImageUrl = data[@"thumbImageUrl"];
|
||||
if (thumbImageUrl != NULL && ![thumbImageUrl isEqual:@""]) {
|
||||
UIImage *image = [self getImageFromURL:thumbImageUrl];
|
||||
message.thumbData = [self compressImage: image toByte:32678];
|
||||
message.thumbData = [self compressImage:image toByte:32678];
|
||||
}
|
||||
message.mediaObject = object;
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = [data[@"scene"] integerValue];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -509,35 +496,35 @@ RCT_EXPORT_METHOD(shareMiniProgram:(NSDictionary *)data
|
||||
}
|
||||
|
||||
// 一次性订阅消息
|
||||
RCT_EXPORT_METHOD(subscribeMessage:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(subscribeMessage
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
WXSubscribeMsgReq *req = [[WXSubscribeMsgReq alloc] init];
|
||||
req.scene = [data[@"scene"] integerValue];
|
||||
req.templateId = data[@"templateId"];
|
||||
req.reserved = data[@"reserved"];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
[WXApi sendReq:req completion:completion];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(launchMiniProgram:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
RCT_EXPORT_METHOD(launchMiniProgram
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object];
|
||||
// 拉起的小程序的username
|
||||
// 拉起的小程序的 username
|
||||
launchMiniProgramReq.userName = data[@"userName"];
|
||||
// 拉起小程序页面的可带参路径,不填默认拉起小程序首页
|
||||
launchMiniProgramReq.path = data[@"path"];
|
||||
// 拉起小程序的类型
|
||||
launchMiniProgramReq.miniProgramType = [data[@"miniProgramType"] integerValue];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
int miniProgramType = [data[@"miniProgramType"] integerValue];
|
||||
launchMiniProgramReq.miniProgramType = [self integerToWXMiniProgramType:miniProgramType];
|
||||
// launchMiniProgramReq.miniProgramType = [data[@"miniProgramType"] integerValue];
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -546,19 +533,18 @@ RCT_EXPORT_METHOD(launchMiniProgram:(NSDictionary *)data
|
||||
// callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(pay:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
PayReq* req = [PayReq new];
|
||||
req.partnerId = data[@"partnerId"];
|
||||
req.prepayId = data[@"prepayId"];
|
||||
req.nonceStr = data[@"nonceStr"];
|
||||
req.timeStamp = [data[@"timeStamp"] unsignedIntValue];
|
||||
req.package = data[@"package"];
|
||||
req.sign = data[@"sign"];
|
||||
void ( ^ completion )( BOOL );
|
||||
completion = ^( BOOL success )
|
||||
{
|
||||
RCT_EXPORT_METHOD(pay
|
||||
:(NSDictionary *)data
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
PayReq *req = [PayReq new];
|
||||
req.partnerId = data[@"partnerId"];
|
||||
req.prepayId = data[@"prepayId"];
|
||||
req.nonceStr = data[@"nonceStr"];
|
||||
req.timeStamp = [data[@"timeStamp"] unsignedIntValue];
|
||||
req.package = data[@"package"];
|
||||
req.sign = data[@"sign"];
|
||||
void (^completion)(BOOL);
|
||||
completion = ^(BOOL success) {
|
||||
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
return;
|
||||
};
|
||||
@ -567,75 +553,82 @@ RCT_EXPORT_METHOD(pay:(NSDictionary *)data
|
||||
// callback(@[success ? [NSNull null] : INVOKE_FAILED]);
|
||||
}
|
||||
|
||||
// 跳转微信客服
|
||||
RCT_EXPORT_METHOD(openCustomerServiceChat
|
||||
:(NSString *)corpId
|
||||
:(NSString *)kfUrl
|
||||
:(RCTResponseSenderBlock)callback) {
|
||||
WXOpenCustomerServiceReq *req = [[WXOpenCustomerServiceReq alloc] init];
|
||||
req.corpid = corpId; // 企业 ID
|
||||
req.url = kfUrl; // 客服 URL
|
||||
[WXApi sendReq:req completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - wx callback
|
||||
|
||||
-(void) onReq:(BaseReq*)req
|
||||
{
|
||||
- (void)onReq:(BaseReq *)req {
|
||||
if ([req isKindOfClass:[LaunchFromWXReq class]]) {
|
||||
LaunchFromWXReq *launchReq = req;
|
||||
NSString *appParameter = launchReq.message.messageExt;
|
||||
NSMutableDictionary *body = @{@"errCode":@0}.mutableCopy;
|
||||
NSMutableDictionary *body = @{ @"errCode": @0 }.mutableCopy;
|
||||
body[@"type"] = @"LaunchFromWX.Req";
|
||||
body[@"lang"] = launchReq.lang;
|
||||
body[@"lang"] = launchReq.lang;
|
||||
body[@"country"] = launchReq.country;
|
||||
body[@"extMsg"] = appParameter;
|
||||
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventNameWeChatReq body:body];
|
||||
}
|
||||
}
|
||||
|
||||
-(void) onResp:(BaseResp*)resp
|
||||
{
|
||||
if([resp isKindOfClass:[SendMessageToWXResp class]])
|
||||
{
|
||||
- (void)onResp:(BaseResp *)resp {
|
||||
if ([resp isKindOfClass:[SendMessageToWXResp class]]) {
|
||||
SendMessageToWXResp *r = (SendMessageToWXResp *)resp;
|
||||
|
||||
NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy;
|
||||
NSMutableDictionary *body = @{ @"errCode": @(r.errCode) }.mutableCopy;
|
||||
body[@"errStr"] = r.errStr;
|
||||
body[@"lang"] = r.lang;
|
||||
body[@"country"] =r.country;
|
||||
body[@"country"] = r.country;
|
||||
body[@"type"] = @"SendMessageToWX.Resp";
|
||||
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
|
||||
} else if ([resp isKindOfClass:[SendAuthResp class]]) {
|
||||
SendAuthResp *r = (SendAuthResp *)resp;
|
||||
NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy;
|
||||
NSMutableDictionary *body = @{ @"errCode": @(r.errCode) }.mutableCopy;
|
||||
body[@"errStr"] = r.errStr;
|
||||
body[@"state"] = r.state;
|
||||
body[@"lang"] = r.lang;
|
||||
body[@"country"] =r.country;
|
||||
body[@"country"] = r.country;
|
||||
body[@"type"] = @"SendAuth.Resp";
|
||||
|
||||
if (resp.errCode == WXSuccess) {
|
||||
if (self.appId && r) {
|
||||
// ios第一次获取不到appid会卡死,加个判断OK
|
||||
[body addEntriesFromDictionary:@{@"appid":self.appId, @"code":r.code}];
|
||||
// ios 第一次获取不到 appid 会卡死,加个判断 OK
|
||||
[body addEntriesFromDictionary:@{ @"appid": self.appId, @"code": r.code }];
|
||||
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
|
||||
}
|
||||
} else if ([resp isKindOfClass:[PayResp class]]) {
|
||||
PayResp *r = (PayResp *)resp;
|
||||
NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy;
|
||||
NSMutableDictionary *body = @{ @"errCode": @(r.errCode) }.mutableCopy;
|
||||
body[@"errStr"] = r.errStr;
|
||||
body[@"type"] = @(r.type);
|
||||
body[@"returnKey"] =r.returnKey;
|
||||
body[@"returnKey"] = r.returnKey;
|
||||
body[@"type"] = @"PayReq.Resp";
|
||||
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
|
||||
} else if ([resp isKindOfClass:[WXLaunchMiniProgramResp class]]){
|
||||
} else if ([resp isKindOfClass:[WXLaunchMiniProgramResp class]]) {
|
||||
WXLaunchMiniProgramResp *r = (WXLaunchMiniProgramResp *)resp;
|
||||
NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy;
|
||||
NSMutableDictionary *body = @{ @"errCode": @(r.errCode) }.mutableCopy;
|
||||
body[@"errStr"] = r.errStr;
|
||||
body[@"extMsg"] = r.extMsg;
|
||||
body[@"type"] = @"WXLaunchMiniProgramReq.Resp";
|
||||
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
|
||||
} else if ([resp isKindOfClass:[WXChooseInvoiceResp class]]){
|
||||
} else if ([resp isKindOfClass:[WXChooseInvoiceResp class]]) {
|
||||
WXChooseInvoiceResp *r = (WXChooseInvoiceResp *)resp;
|
||||
NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy;
|
||||
NSMutableDictionary *body = @{ @"errCode": @(r.errCode) }.mutableCopy;
|
||||
body[@"errStr"] = r.errStr;
|
||||
NSMutableArray *arr = [[NSMutableArray alloc] init];
|
||||
for (WXCardItem* cardItem in r.cardAry) {
|
||||
NSMutableDictionary *item = @{@"cardId":cardItem.cardId,@"encryptCode":cardItem.encryptCode,@"appId":cardItem.appID}.mutableCopy;
|
||||
for (WXCardItem *cardItem in r.cardAry) {
|
||||
NSMutableDictionary *item = @{ @"cardId": cardItem.cardId, @"encryptCode": cardItem.encryptCode, @"appId": cardItem.appID }.mutableCopy;
|
||||
[arr addObject:item];
|
||||
}
|
||||
body[@"cards"] = arr;
|
||||
@ -644,5 +637,72 @@ RCT_EXPORT_METHOD(pay:(NSDictionary *)data
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
- (WXMiniProgramType)integerToWXMiniProgramType:(int)value {
|
||||
WXMiniProgramType type = WXMiniProgramTypeRelease;
|
||||
switch (value) {
|
||||
case 0:
|
||||
type = WXMiniProgramTypeRelease;
|
||||
break;
|
||||
case 1:
|
||||
type = WXMiniProgramTypeTest;
|
||||
break;
|
||||
case 2:
|
||||
type = WXMiniProgramTypePreview;
|
||||
break;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
#pragma mark - WechatAuthAPIDelegate
|
||||
|
||||
RCT_EXPORT_METHOD(addListener:(NSString *)eventName) {
|
||||
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(removeListeners:(double)count) {
|
||||
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(authByScan:(NSString *)appid
|
||||
nonceStr:(NSString *)nonceStr
|
||||
timeStamp:(NSString *)timeStamp
|
||||
scope:(NSString *)scope
|
||||
signature:(NSString *)signature
|
||||
schemeData:(nullable NSString *)schemeData
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
self.scanCallback = callback;
|
||||
[self.authSDK StopAuth];
|
||||
[self.authSDK Auth:appid nonceStr:nonceStr timeStamp:timeStamp scope:scope signature:signature schemeData:schemeData];
|
||||
}
|
||||
|
||||
//得到二维码
|
||||
- (void)onAuthGotQrcode:(UIImage *)image {
|
||||
NSLog(@"onAuthGotQrcode");
|
||||
NSData *imageData = UIImagePNGRepresentation(image);
|
||||
if (!imageData) {
|
||||
imageData = UIImageJPEGRepresentation(image, 1);
|
||||
}
|
||||
NSString *base64String = [imageData base64EncodedStringWithOptions:0];
|
||||
[self.bridge.eventDispatcher sendDeviceEventWithName:@"onAuthGotQrcode" body:@{@"qrcode": base64String}];
|
||||
}
|
||||
|
||||
//二维码被扫描
|
||||
- (void)onQrcodeScanned {
|
||||
NSLog(@"onQrcodeScanned");
|
||||
}
|
||||
|
||||
//成功登录
|
||||
- (void)onAuthFinish:(int)errCode AuthCode:(nullable NSString *)authCode {
|
||||
NSLog(@"onAuthFinish");
|
||||
if (self.scanCallback) {
|
||||
self.scanCallback(@[[NSNull null], @{@"authCode": authCode?:@"", @"errCode": @(errCode)}]);
|
||||
self.scanCallback = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)supportedEvents
|
||||
{
|
||||
return @[@"onAuthGotQrcode", @"onQrcodeScanned", @"onAuthFinish"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
5E555C0D2413F4C50049A1A2 /* WechatLib.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* WechatLib.m */; };
|
||||
86D0366429A4BF3E00A01343 /* libWeChatSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 86D0365E29A4BF2600A01343 /* libWeChatSDK.a */; };
|
||||
86D0366529A4BF5900A01343 /* WechatLib.mm in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* WechatLib.mm */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -24,8 +25,13 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
134814201AA4EA6300B7C361 /* libWechatLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libWechatLib.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
86D0365D29A4BF2600A01343 /* WXApiObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXApiObject.h; sourceTree = "<group>"; };
|
||||
86D0365E29A4BF2600A01343 /* libWeChatSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWeChatSDK.a; sourceTree = "<group>"; };
|
||||
86D0365F29A4BF2700A01343 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; };
|
||||
86D0366029A4BF2700A01343 /* WechatAuthSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WechatAuthSDK.h; sourceTree = "<group>"; };
|
||||
86D0366129A4BF2700A01343 /* WXApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXApi.h; sourceTree = "<group>"; };
|
||||
B3E7B5881CC2AC0600A0062D /* WechatLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WechatLib.h; sourceTree = "<group>"; };
|
||||
B3E7B5891CC2AC0600A0062D /* WechatLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WechatLib.m; sourceTree = "<group>"; };
|
||||
B3E7B5891CC2AC0600A0062D /* WechatLib.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WechatLib.mm; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -33,6 +39,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
86D0366429A4BF3E00A01343 /* libWeChatSDK.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -50,12 +57,25 @@
|
||||
58B511D21A9E6C8500147676 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
86D0365E29A4BF2600A01343 /* libWeChatSDK.a */,
|
||||
86D0365F29A4BF2700A01343 /* README.txt */,
|
||||
86D0366029A4BF2700A01343 /* WechatAuthSDK.h */,
|
||||
86D0366129A4BF2700A01343 /* WXApi.h */,
|
||||
86D0365D29A4BF2600A01343 /* WXApiObject.h */,
|
||||
B3E7B5881CC2AC0600A0062D /* WechatLib.h */,
|
||||
B3E7B5891CC2AC0600A0062D /* WechatLib.m */,
|
||||
B3E7B5891CC2AC0600A0062D /* WechatLib.mm */,
|
||||
134814211AA4EA7D00B7C361 /* Products */,
|
||||
86D0366329A4BF3E00A01343 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
86D0366329A4BF3E00A01343 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -113,7 +133,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B3E7B58A1CC2AC0600A0062D /* WechatLib.m in Sources */,
|
||||
86D0366529A4BF5900A01343 /* WechatLib.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -224,7 +244,10 @@
|
||||
"$(SRCROOT)/../../../React/**",
|
||||
"$(SRCROOT)/../../react-native/React/**",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = WechatLib;
|
||||
SKIP_INSTALL = YES;
|
||||
@ -240,7 +263,10 @@
|
||||
"$(SRCROOT)/../../../React/**",
|
||||
"$(SRCROOT)/../../react-native/React/**",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = WechatLib;
|
||||
SKIP_INSTALL = YES;
|
||||
|
||||
12
package.json
12
package.json
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "react-native-wechat-lib",
|
||||
"version": "3.0.0",
|
||||
"description": "test",
|
||||
"version": "3.0.4",
|
||||
"description": "React-Native(iOS/Android) functionalities include WeChat Login, Share, Favorite and Payment.",
|
||||
"main": "lib/commonjs/index",
|
||||
"module": "lib/module/index",
|
||||
"types": "lib/typescript/index.d.ts",
|
||||
@ -71,14 +71,16 @@
|
||||
"react-native": "0.70.6",
|
||||
"react-native-builder-bob": "^0.20.0",
|
||||
"release-it": "^15.0.0",
|
||||
"typescript": "^4.5.2"
|
||||
"typescript": "^4.5.2",
|
||||
"js-sha1": "^0.7.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/react": "17.0.21"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
"react-native": "*"
|
||||
"react-native": "*",
|
||||
"js-sha1": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 16.0.0"
|
||||
@ -160,4 +162,4 @@
|
||||
"dependencies": {
|
||||
"events": "^3.3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
60
src/index.d.ts
vendored
60
src/index.d.ts
vendored
@ -9,7 +9,14 @@ enum WXScene {
|
||||
}
|
||||
|
||||
declare module 'react-native-wechat-lib' {
|
||||
export function registerApp(appId: string, universalLink?: string): Promise<boolean>;
|
||||
export function registerApp(
|
||||
appId: string,
|
||||
universalLink?: string
|
||||
): Promise<boolean>;
|
||||
export function openCustomerServiceChat(
|
||||
corpId: string,
|
||||
kfUrl: string
|
||||
): Promise<string>;
|
||||
export function isWXAppInstalled(): Promise<boolean>;
|
||||
export function isWXAppSupportApi(): Promise<boolean>;
|
||||
export function getApiVersion(): Promise<string>;
|
||||
@ -39,9 +46,30 @@ declare module 'react-native-wechat-lib' {
|
||||
state?: string;
|
||||
returnKey?: string;
|
||||
}
|
||||
export function sendAuthRequest(scope: string | string[], state?: string): Promise<AuthResponse>;
|
||||
export interface ScanLoginResp {
|
||||
nickname?: string;
|
||||
headimgurl?: string;
|
||||
openid?: string;
|
||||
unionid?: string;
|
||||
errCode?: number;
|
||||
errStr?: string;
|
||||
}
|
||||
export function sendAuthRequest(
|
||||
scope: string | string[],
|
||||
state?: string
|
||||
): Promise<AuthResponse>;
|
||||
export function authByScan(appId: string, appSecret: string, onQRGet: (qrcode: string)=>void): Promise<ScanLoginResp>;
|
||||
|
||||
export interface ShareMetadata {
|
||||
type: 'news' | 'text' | 'imageUrl' | 'imageFile' | 'imageResource' | 'video' | 'audio' | 'file';
|
||||
type:
|
||||
| 'news'
|
||||
| 'text'
|
||||
| 'imageUrl'
|
||||
| 'imageFile'
|
||||
| 'imageResource'
|
||||
| 'video'
|
||||
| 'audio'
|
||||
| 'file';
|
||||
thumbImage?: string;
|
||||
description?: string;
|
||||
webpageUrl?: string;
|
||||
@ -109,31 +137,31 @@ declare module 'react-native-wechat-lib' {
|
||||
}
|
||||
|
||||
export function shareText(
|
||||
message: ShareTextMetadata,
|
||||
message: ShareTextMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export function shareImage(
|
||||
message: ShareImageMetadata,
|
||||
message: ShareImageMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export function shareLocalImage(
|
||||
message: ShareImageMetadata,
|
||||
message: ShareImageMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export function shareMusic(
|
||||
message: ShareMusicMetadata,
|
||||
message: ShareMusicMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export function shareVideo(
|
||||
message: ShareVideoMetadata,
|
||||
message: ShareVideoMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export function shareWebpage(
|
||||
message: ShareWebpageMetadata,
|
||||
message: ShareWebpageMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export function shareMiniProgram(
|
||||
message: ShareMiniProgramMetadata,
|
||||
message: ShareMiniProgramMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export function launchMiniProgram(
|
||||
message: LaunchMiniProgramMetadata,
|
||||
message: LaunchMiniProgramMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export function subscribeMessage(
|
||||
message: SubscribeMessageMetadata,
|
||||
message: SubscribeMessageMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export interface PaymentLoad {
|
||||
partnerId: string;
|
||||
@ -143,7 +171,9 @@ declare module 'react-native-wechat-lib' {
|
||||
package: string;
|
||||
sign: string;
|
||||
}
|
||||
export function pay(payload: PaymentLoad): Promise<{ errCode?: number; errStr?: string }>;
|
||||
export function pay(
|
||||
payload: PaymentLoad
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
|
||||
export interface ChooseInvoice {
|
||||
signType?: string;
|
||||
@ -159,7 +189,7 @@ declare module 'react-native-wechat-lib' {
|
||||
}
|
||||
|
||||
export function chooseInvoice(
|
||||
data: ChooseInvoice,
|
||||
data: ChooseInvoice
|
||||
): Promise<{ errCode?: number; errStr?: string; cards: Invoice[] }>;
|
||||
|
||||
export interface ShareFileMetadata {
|
||||
@ -169,6 +199,6 @@ declare module 'react-native-wechat-lib' {
|
||||
scene?: WXScene;
|
||||
}
|
||||
export function shareFile(
|
||||
data: ShareFileMetadata,
|
||||
data: ShareFileMetadata
|
||||
): Promise<{ errCode?: number; errStr?: string }>;
|
||||
}
|
||||
|
||||
181
src/index.js
181
src/index.js
@ -1,10 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
import { DeviceEventEmitter, NativeModules, Platform } from 'react-native';
|
||||
import { EventEmitter } from 'events';
|
||||
import { sha1 } from 'js-sha1';
|
||||
import { DeviceEventEmitter, NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
||||
|
||||
let isAppRegistered = false;
|
||||
const { WeChat } = NativeModules;
|
||||
let { WeChat } = NativeModules;
|
||||
|
||||
// Event emitter to dispatch request and response from WeChat.
|
||||
const emitter = new EventEmitter();
|
||||
@ -142,13 +143,19 @@ export const getApiVersion = wrapApi(WeChat.getApiVersion);
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const openWXApp = wrapApi(WeChat.openWXApp);
|
||||
/**
|
||||
* Open wechat app
|
||||
* @method openCustomerServiceChat
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const openCustomerServiceChat = wrapApi(WeChat.openCustomerServiceChat);
|
||||
|
||||
// wrap the APIs
|
||||
const nativeShareToTimeline = wrapApi(WeChat.shareToTimeline);
|
||||
// const nativeShareToTimeline = wrapApi(WeChat.shareToTimeline);
|
||||
const nativeLaunchMiniProgram = wrapApi(WeChat.launchMiniProgram);
|
||||
const nativeShareToSession = wrapApi(WeChat.shareToSession);
|
||||
// const nativeShareToSession = wrapApi(WeChat.shareToSession);
|
||||
const nativeShareToFavorite = wrapApi(WeChat.shareToFavorite);
|
||||
const nativeSendAuthRequest = wrapApi(WeChat.sendAuthRequest);
|
||||
// const nativeSendAuthRequest = wrapApi(WeChat.sendAuthRequest);
|
||||
const nativeShareText = wrapApi(WeChat.shareText);
|
||||
const nativeShareImage = wrapApi(WeChat.shareImage);
|
||||
const nativeShareLocalImage = wrapApi(WeChat.shareLocalImage);
|
||||
@ -160,6 +167,152 @@ const nativeSubscribeMessage = wrapApi(WeChat.subscribeMessage);
|
||||
|
||||
const nativeChooseInvoice = wrapApi(WeChat.chooseInvoice);
|
||||
const nativeShareFile = wrapApi(WeChat.shareFile);
|
||||
const nativeScan = wrapApi(WeChat.authByScan);
|
||||
|
||||
// https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html
|
||||
const getAccessToken = async (WeiXinId, WeiXinSecret) => {
|
||||
let url =
|
||||
'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' +
|
||||
WeiXinId +
|
||||
'&secret=' +
|
||||
WeiXinSecret;
|
||||
const response = await fetch(url);
|
||||
const res = await response.json();
|
||||
return res.access_token;
|
||||
};
|
||||
|
||||
const getSDKTicket = async (accessToken) => {
|
||||
let url =
|
||||
'https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=2&access_token=' +
|
||||
accessToken;
|
||||
const response = await fetch(url);
|
||||
const res = await response.json();
|
||||
return res.ticket;
|
||||
};
|
||||
|
||||
const createSignature = (
|
||||
WeiXinId,
|
||||
nonceStr,
|
||||
sdkTicket,
|
||||
timestamp
|
||||
) => {
|
||||
const origin =
|
||||
'appid=' +
|
||||
WeiXinId +
|
||||
'&noncestr=' +
|
||||
nonceStr +
|
||||
'&sdk_ticket=' +
|
||||
sdkTicket +
|
||||
'×tamp=' +
|
||||
timestamp;
|
||||
const ret = sha1(origin);
|
||||
// console.log('wx scan signature', origin, ret);
|
||||
return ret;
|
||||
};
|
||||
|
||||
const getUserInfo = (
|
||||
WeiXinId,
|
||||
WeiXinSecret,
|
||||
code,
|
||||
callback
|
||||
) => {
|
||||
let accessTokenUrl =
|
||||
'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' +
|
||||
WeiXinId +
|
||||
'&secret=' +
|
||||
WeiXinSecret +
|
||||
'&code=' +
|
||||
code +
|
||||
'&grant_type=authorization_code';
|
||||
fetch(accessTokenUrl)
|
||||
.then((res) => {
|
||||
return res.json();
|
||||
})
|
||||
.then((res) => {
|
||||
// console.log('wechat get access code success: ', res.access_token);
|
||||
let userInfoUrl =
|
||||
'https://api.weixin.qq.com/sns/userinfo?access_token=' +
|
||||
res.access_token +
|
||||
'&openid=' +
|
||||
res.openid;
|
||||
fetch(userInfoUrl)
|
||||
.then((res2) => {
|
||||
return res2.json();
|
||||
})
|
||||
.then((json) => {
|
||||
// console.log('wechat get user info success: ', json);
|
||||
callback({
|
||||
nickname: json.nickname,
|
||||
headimgurl: json.headimgurl,
|
||||
openid: json.openid,
|
||||
unionid: json.unionid,
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
console.warn('wechat get user info fail ', e);
|
||||
callback({ error: e });
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
console.warn('wechat get access code fail ', e);
|
||||
callback({ error: e });
|
||||
});
|
||||
};
|
||||
|
||||
const generateObjectId = () => {
|
||||
var timestamp = ((new Date().getTime() / 1000) | 0).toString(16); // eslint-disable-line no-bitwise
|
||||
return (
|
||||
timestamp +
|
||||
'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function () {
|
||||
return ((Math.random() * 16) | 0).toString(16).toLowerCase(); // eslint-disable-line no-bitwise
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @method authByScan
|
||||
* @param {String} appId - the app id
|
||||
* @param {String} appSecret - the app secret
|
||||
* @param {Function} onQRGet - (qrcode: string) => void
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function authByScan(appId, appSecret, onQRGet) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const accessToken = await getAccessToken(appId, appSecret);
|
||||
const ticket = await getSDKTicket(accessToken);
|
||||
const nonceStr = generateObjectId();
|
||||
const timestamp = String(Math.round(Date.now() / 1000));
|
||||
const signature = createSignature(appId, nonceStr, ticket, timestamp);
|
||||
|
||||
const qrcodeEmitter = new NativeEventEmitter(NativeModules.WeChat);
|
||||
|
||||
const subscription = qrcodeEmitter.addListener('onAuthGotQrcode', (res) =>
|
||||
onQRGet && onQRGet(res.qrcode)
|
||||
);
|
||||
|
||||
const ret = await nativeScan(appId, nonceStr, timestamp, 'snsapi_userinfo', signature, '');
|
||||
// console.log('扫码结果', ret)
|
||||
subscription.remove();
|
||||
if (!ret?.authCode) {
|
||||
reject(new WechatError({
|
||||
errStr: 'Auth code 获取失败',
|
||||
errCode: -1
|
||||
}))
|
||||
return;
|
||||
}
|
||||
getUserInfo(appId, appSecret, ret?.authCode, (result) => {
|
||||
// console.log('扫码登录结果', result)
|
||||
if (!result.error) {
|
||||
resolve(result)
|
||||
} else {
|
||||
reject(new WechatError({
|
||||
errStr: '扫码登录失败' + JSON.stringify(e),
|
||||
errCode: -2
|
||||
}))
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @method sendAuthRequest
|
||||
@ -214,8 +367,8 @@ export function chooseInvoice(data = {}) {
|
||||
const cardItemList = JSON.parse(resp.cardItemList);
|
||||
resp.cards = cardItemList
|
||||
? cardItemList.map((item) => ({
|
||||
cardId: item.card_id,
|
||||
encryptCode: item.encrypt_code,
|
||||
cardId: item.card_id,
|
||||
encryptCode: item.encrypt_code,
|
||||
}))
|
||||
: [];
|
||||
}
|
||||
@ -381,14 +534,22 @@ export function shareMiniProgram(data) {
|
||||
* @param {Integer} miniProgramType - 拉起小程序的类型. 0-正式版 1-开发版 2-体验版
|
||||
* @param {String} path - 拉起小程序页面的可带参路径,不填默认拉起小程序首页
|
||||
*/
|
||||
export function launchMiniProgram({ userName, miniProgramType = 0, path = '' }) {
|
||||
export function launchMiniProgram({
|
||||
userName,
|
||||
miniProgramType = 0,
|
||||
path = '',
|
||||
}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (miniProgramType !== 0 && miniProgramType !== 1 && miniProgramType !== 2) {
|
||||
if (
|
||||
miniProgramType !== 0 &&
|
||||
miniProgramType !== 1 &&
|
||||
miniProgramType !== 2
|
||||
) {
|
||||
reject(
|
||||
new WechatError({
|
||||
errStr: '拉起小程序的类型不对,0-正式版 1-开发版 2-体验版',
|
||||
errCode: -1,
|
||||
}),
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user