作者 廖明明

修改android端去除压缩分享图片

正在显示 85 个修改的文件 包含 6621 行增加0 行删除
.DS_Store
node_modules
/android/build
/android/RCTWeChat.iml
# ios
ios/build
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
... ...
node_modules
/android/build
/android/RCTWeChat.iml
Example
*.jpg
... ...
language: node_js
node_js:
- "7.1"
sudo: false
cache:
directories:
- $HOME/.yarn-cache
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
env:
- NODE_ENV='test'
install:
- npm install
script:
- npm test
matrix:
include:
- language: android
os: linux
jdk: oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
node_js: false
- nvm install 7
android:
components:
- android-23
- build-tools-23.0.1
- language: objective-c
os: osx
osx_image: xcode8.2
node_js: false
xcode_project: ios/RCTWeChat.xcodeproj
xcode_scheme: ios/RCTWeChat
script:
- cd ios
- xcodebuild -scheme RCTWeChat -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty
... ...
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at yorkiefixer@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
... ...
[ignore]
# We fork some components by platform.
.*/*.web.js
.*/*.android.js
# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*
# Ignore react-tools where there are overlaps, but don't ignore anything that
# react-native relies on
.*/node_modules/react-tools/src/React.js
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
# Ignore commoner tests
.*/node_modules/commoner/test/.*
# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js
# Ignore jest
.*/node_modules/jest-cli/.*
# Ignore Website
.*/website/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
[options]
module.system=haste
munge_underscores=true
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-7]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-7]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
[version]
0.17.0
... ...
{}
\ No newline at end of file
... ...
# Example for react-native-wechat
Install the react-native at first:
```
$ npm install
```
Link the following:
- RCTWeChat
- CoreTelephony.framework
- libsqlite3.0
- libc++
- libz
Click "Run" at your Xcode.
... ...
apply plugin: "com.android.application"
/**
* The react.gradle file registers two tasks: bundleDebugJsAndAssets and bundleReleaseJsAndAssets.
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"]
* ]
*/
apply from: "react.gradle"
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false // Set this to true to enable Proguard
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.14.+"
}
... ...
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
-dontobfuscate
# React Native
# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
}
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
void set*(***);
*** get*();
}
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
# okhttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
# okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
... ...
def config = project.hasProperty("react") ? project.react : [];
def bundleAssetName = config.bundleAssetName ?: "index.android.bundle"
def entryFile = config.entryFile ?: "index.android.js"
// because elvis operator
def elvisFile(thing) {
return thing ? file(thing) : null;
}
def reactRoot = elvisFile(config.root) ?: file("../../")
def jsBundleDirDebug = elvisFile(config.jsBundleDirDebug) ?:
file("$buildDir/intermediates/assets/debug")
def jsBundleDirRelease = elvisFile(config.jsBundleDirRelease) ?:
file("$buildDir/intermediates/assets/release")
def resourcesDirDebug = elvisFile(config.resourcesDirDebug) ?:
file("$buildDir/intermediates/res/merged/debug")
def resourcesDirRelease = elvisFile(config.resourcesDirRelease) ?:
file("$buildDir/intermediates/res/merged/release")
def inputExcludes = config.inputExcludes ?: ["android/**", "ios/**"]
def jsBundleFileDebug = file("$jsBundleDirDebug/$bundleAssetName")
def jsBundleFileRelease = file("$jsBundleDirRelease/$bundleAssetName")
task bundleDebugJsAndAssets(type: Exec) {
// create dirs if they are not there (e.g. the "clean" task just ran)
doFirst {
jsBundleDirDebug.mkdirs()
resourcesDirDebug.mkdirs()
}
// set up inputs and outputs so gradle can cache the result
inputs.files fileTree(dir: reactRoot, excludes: inputExcludes)
outputs.dir jsBundleDirDebug
outputs.dir resourcesDirDebug
// set up the call to the react-native cli
workingDir reactRoot
commandLine "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file",
entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug
enabled config.bundleInDebug ?: false
}
task bundleReleaseJsAndAssets(type: Exec) {
// create dirs if they are not there (e.g. the "clean" task just ran)
doFirst {
jsBundleDirRelease.mkdirs()
resourcesDirRelease.mkdirs()
}
// set up inputs and outputs so gradle can cache the result
inputs.files fileTree(dir: reactRoot, excludes: inputExcludes)
outputs.dir jsBundleDirRelease
outputs.dir resourcesDirRelease
// set up the call to the react-native cli
workingDir reactRoot
commandLine "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file",
entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease
enabled config.bundleInRelease ?: true
}
gradle.projectsEvaluated {
// hook bundleDebugJsAndAssets into the android build process
bundleDebugJsAndAssets.dependsOn mergeDebugResources
bundleDebugJsAndAssets.dependsOn mergeDebugAssets
processDebugResources.dependsOn bundleDebugJsAndAssets
// hook bundleReleaseJsAndAssets into the android build process
bundleReleaseJsAndAssets.dependsOn mergeReleaseResources
bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets
processReleaseResources.dependsOn bundleReleaseJsAndAssets
}
... ...
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
... ...
package com.example;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import com.facebook.react.LifecycleState;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactRootView;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
private ReactInstanceManager mReactInstanceManager;
private ReactRootView mReactRootView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "Example", null);
setContentView(mReactRootView);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) {
mReactInstanceManager.showDevOptionsDialog();
return true;
}
return super.onKeyUp(keyCode, event);
}
@Override
public void onBackPressed() {
if (mReactInstanceManager != null) {
mReactInstanceManager.onBackPressed();
} else {
super.onBackPressed();
}
}
@Override
public void invokeDefaultOnBackPressed() {
super.onBackPressed();
}
@Override
protected void onPause() {
super.onPause();
if (mReactInstanceManager != null) {
mReactInstanceManager.onPause();
}
}
@Override
protected void onResume() {
super.onResume();
if (mReactInstanceManager != null) {
mReactInstanceManager.onResume(this);
}
}
}
... ...
<resources>
<string name="app_name">Example</string>
</resources>
... ...
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
... ...
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
}
}
... ...
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useDeprecatedNdk=true
... ...
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
... ...
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
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" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
... ...
@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
@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=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@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 init
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 init
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
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
: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 %CMD_LINE_ARGS%
: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
... ...
rootProject.name = 'Example'
include ':app'
... ...
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;
var Example = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Shake or press menu button for dev menu
</Text>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('Example', () => Example);
... ...
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
"use strict";
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity
} = React;
var WeChat = require('./react-native-wechat.js');
class Example extends React.Component {
constructor(props) {
super(props);
this.state = {
apiVersion: 'waiting...',
wxAppInstallUrl: 'waiting...',
isWXAppSupportApi: 'waiting...',
isWXAppInstalled: 'waiting...',
};
}
async componentDidMount() {
try {
await WeChat.registerApp('1234567');
this.setState({
apiVersion: await WeChat.getApiVersion(),
wxAppInstallUrl: await WeChat.getWXAppInstallUrl(),
isWXAppSupportApi: await WeChat.isWXAppSupportApi(),
isWXAppInstalled: await WeChat.isWXAppInstalled()
});
console.log(this.state);
} catch (e) {
console.error(e);
}
console.log(WeChat);
// console.log('getApiVersion', typeof WeChat.getApiVersion);
// console.log('getWXAppInstallUrl', typeof WeChat.getWXAppInstallUrl);
// console.log('sendRequest', typeof WeChat.sendRequest);
// console.log('registerApp', typeof WeChat.registerApp);
// console.log('sendErrorCommonResponse', typeof WeChat.sendErrorCommonResponse);
// console.log('sendErrorUserCancelResponse', typeof WeChat.sendErrorUserCancelResponse);
// console.log('sendAuthRequest', typeof WeChat.sendAuthRequest);
// console.log('getWXAppInstallUrl', typeof WeChat.getWXAppInstallUrl);
// console.log('openWXApp', typeof WeChat.openWXApp);
// console.log('registerAppWithDescription', typeof WeChat.registerAppWithDescription);
// console.log('isWXAppSupportApi', typeof WeChat.isWXAppSupportApi);
// console.log('isWXAppInstalled', typeof WeChat.isWXAppInstalled);
}
render() {
return (
<View style={styles.container}>
<Text>api版本:{this.state.apiVersion}</Text>
<Text>微信注册url{this.state.wxAppInstallUrl}</Text>
<Text>是否支持api{String(this.state.isWXAppSupportApi)}</Text>
<Text>是否安装微信:{String(this.state.isWXAppInstalled)}</Text>
<TouchableOpacity onPress={this._openWXApp}>
<Text>打开微信</Text>
</TouchableOpacity>
</View>
);
}
async _openWXApp() {
await WeChat.openWXApp();
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('Example', () => Example);
... ...
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
869DDDD71BFB274800372700 /* libRCTWeChat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 869DDDD51BFB273B00372700 /* libRCTWeChat.a */; };
869DDDD91BFB294F00372700 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 869DDDD81BFB294F00372700 /* CoreTelephony.framework */; };
869DDDDB1BFB295E00372700 /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 869DDDDA1BFB295E00372700 /* libsqlite3.0.tbd */; };
869DDDDD1BFB296700372700 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 869DDDDC1BFB296700372700 /* libc++.tbd */; };
869DDDDF1BFB296F00372700 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 869DDDDE1BFB296F00372700 /* libz.tbd */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTActionSheet;
};
00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTGeolocation;
};
00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B5115D1A9E6B3D00147676;
remoteInfo = RCTImage;
};
00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B511DB1A9E6C8500147676;
remoteInfo = RCTNetwork;
};
00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
remoteInfo = RCTVibration;
};
139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTSettings;
};
139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3C86DF461ADF2C930047B81A;
remoteInfo = RCTWebSocket;
};
146834031AC3E56700842450 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = React;
};
78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTLinking;
};
832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
869DDDD41BFB273B00372700 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 869DDDC71BFB273A00372700 /* RCTWeChat.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 86D238421BD0BB9E00C75D01;
remoteInfo = RCTWeChat;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = "<group>"; };
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = "<group>"; };
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Example/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Example/AppDelegate.m; sourceTree = "<group>"; };
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Example/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = "<group>"; };
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
869DDDC71BFB273A00372700 /* RCTWeChat.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWeChat.xcodeproj; path = ../../ios/RCTWeChat.xcodeproj; sourceTree = "<group>"; };
869DDDD81BFB294F00372700 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; };
869DDDDA1BFB295E00372700 /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; };
869DDDDC1BFB296700372700 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
869DDDDE1BFB296F00372700 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
869DDDDF1BFB296F00372700 /* libz.tbd in Frameworks */,
869DDDDD1BFB296700372700 /* libc++.tbd in Frameworks */,
869DDDDB1BFB295E00372700 /* libsqlite3.0.tbd in Frameworks */,
869DDDD91BFB294F00372700 /* CoreTelephony.framework in Frameworks */,
869DDDD71BFB274800372700 /* libRCTWeChat.a in Frameworks */,
146834051AC3E58100842450 /* libReact.a in Frameworks */,
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
00C302A81ABCB8CE00DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */,
);
name = Products;
sourceTree = "<group>";
};
00C302B61ABCB90400DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */,
);
name = Products;
sourceTree = "<group>";
};
00C302BC1ABCB91800DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302C01ABCB91800DB3ED1 /* libRCTImage.a */,
);
name = Products;
sourceTree = "<group>";
};
00C302D41ABCB9D200DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */,
);
name = Products;
sourceTree = "<group>";
};
00C302E01ABCB9EE00DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */,
);
name = Products;
sourceTree = "<group>";
};
139105B71AF99BAD00B5F7CC /* Products */ = {
isa = PBXGroup;
children = (
139105C11AF99BAD00B5F7CC /* libRCTSettings.a */,
);
name = Products;
sourceTree = "<group>";
};
139FDEE71B06529A00C62182 /* Products */ = {
isa = PBXGroup;
children = (
139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
);
name = Products;
sourceTree = "<group>";
};
13B07FAE1A68108700A75B9A /* Example */ = {
isa = PBXGroup;
children = (
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
13B07FB61A68108700A75B9A /* Info.plist */,
13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
13B07FB71A68108700A75B9A /* main.m */,
);
name = Example;
sourceTree = "<group>";
};
146834001AC3E56700842450 /* Products */ = {
isa = PBXGroup;
children = (
146834041AC3E56700842450 /* libReact.a */,
);
name = Products;
sourceTree = "<group>";
};
78C398B11ACF4ADC00677621 /* Products */ = {
isa = PBXGroup;
children = (
78C398B91ACF4ADC00677621 /* libRCTLinking.a */,
);
name = Products;
sourceTree = "<group>";
};
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
869DDDC71BFB273A00372700 /* RCTWeChat.xcodeproj */,
146833FF1AC3E56700842450 /* React.xcodeproj */,
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */,
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */,
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */,
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */,
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
};
832341B11AAA6A8300B99B32 /* Products */ = {
isa = PBXGroup;
children = (
832341B51AAA6A8300B99B32 /* libRCTText.a */,
);
name = Products;
sourceTree = "<group>";
};
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
869DDDDE1BFB296F00372700 /* libz.tbd */,
869DDDDC1BFB296700372700 /* libc++.tbd */,
869DDDDA1BFB295E00372700 /* libsqlite3.0.tbd */,
869DDDD81BFB294F00372700 /* CoreTelephony.framework */,
13B07FAE1A68108700A75B9A /* Example */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
83CBBA001A601CBA00E9B192 /* Products */,
);
indentWidth = 2;
sourceTree = "<group>";
tabWidth = 2;
};
83CBBA001A601CBA00E9B192 /* Products */ = {
isa = PBXGroup;
children = (
13B07F961A680F5B00A75B9A /* Example.app */,
);
name = Products;
sourceTree = "<group>";
};
869DDDC81BFB273A00372700 /* Products */ = {
isa = PBXGroup;
children = (
869DDDD51BFB273B00372700 /* libRCTWeChat.a */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
13B07F861A680F5B00A75B9A /* Example */ = {
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example" */;
buildPhases = (
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
);
buildRules = (
);
dependencies = (
);
name = Example;
productName = "Hello World";
productReference = 13B07F961A680F5B00A75B9A /* Example.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
83CBB9F71A601CBA00E9B192 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0710;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = JP4369ZCVM;
};
};
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 83CBB9F61A601CBA00E9B192;
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
},
{
ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
},
{
ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */;
ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
},
{
ProductGroup = 78C398B11ACF4ADC00677621 /* Products */;
ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
},
{
ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */;
ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
},
{
ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */;
ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
},
{
ProductGroup = 832341B11AAA6A8300B99B32 /* Products */;
ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
},
{
ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */;
ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
},
{
ProductGroup = 139FDEE71B06529A00C62182 /* Products */;
ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
},
{
ProductGroup = 869DDDC81BFB273A00372700 /* Products */;
ProjectRef = 869DDDC71BFB273A00372700 /* RCTWeChat.xcodeproj */;
},
{
ProductGroup = 146834001AC3E56700842450 /* Products */;
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
);
projectRoot = "";
targets = (
13B07F861A680F5B00A75B9A /* Example */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTActionSheet.a;
remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTGeolocation.a;
remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTImage.a;
remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTNetwork.a;
remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTVibration.a;
remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTSettings.a;
remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTWebSocket.a;
remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
146834041AC3E56700842450 /* libReact.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libReact.a;
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTLinking.a;
remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTText.a;
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
869DDDD51BFB273B00372700 /* libRCTWeChat.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTWeChat.a;
remoteRef = 869DDDD41BFB273B00372700 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Bundle React Native code and images";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "../node_modules/react-native/packager/react-native-xcode.sh";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
isa = PBXVariantGroup;
children = (
13B07FB21A68108700A75B9A /* Base */,
);
name = LaunchScreen.xib;
path = Example;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEAD_CODE_STRIPPING = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
);
INFOPLIST_FILE = Example/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "com.weflex.wechat-example";
PRODUCT_NAME = Example;
PROVISIONING_PROFILE = "";
};
name = Debug;
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
);
INFOPLIST_FILE = Example/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "com.weflex.wechat-example";
PRODUCT_NAME = Example;
PROVISIONING_PROFILE = "";
};
name = Release;
};
83CBBA201A601CBA00E9B192 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
83CBBA211A601CBA00E9B192 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Example" */ = {
isa = XCConfigurationList;
buildConfigurations = (
13B07F941A680F5B00A75B9A /* Debug */,
13B07F951A680F5B00A75B9A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Example" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83CBBA201A601CBA00E9B192 /* Debug */,
83CBBA211A601CBA00E9B192 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "ExampleTests.xctest"
BlueprintName = "ExampleTests"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "ExampleTests.xctest"
BlueprintName = "ExampleTests"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
... ...
<?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>SuppressBuildableAutocreation</key>
<dict>
<key>13B07F861A680F5B00A75B9A</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
... ...
<?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>SchemeUserState</key>
<dict>
<key>Example.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>00E356ED1AD99517003FC87E</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>13B07F861A680F5B00A75B9A</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
... ...
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (nonatomic, strong) UIWindow *window;
@end
... ...
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
#import "RCTRootView.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
/**
* Loading JavaScript code - uncomment the one you want.
*
* OPTION 1
* Load from development server. Start the server from the repository root:
*
* $ npm start
*
* To run on device, change `localhost` to the IP address of your computer
* (you can get this by typing `ifconfig` into the terminal and selecting the
* `inet` value under `en0:`) and make sure your computer and iOS device are
* on the same Wi-Fi network.
*/
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
/**
* OPTION 2
* Load from pre-bundled file on disk. The static bundle is automatically
* generated by "Bundle React Native code and images" build step.
*/
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Example"
initialProperties:nil
launchOptions:launchOptions];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [[UIViewController alloc] init];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
@end
... ...
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Example" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
... ...
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
... ...
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
... ...
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
... ...
{
"name": "Example",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node_modules/react-native/packager/packager.sh",
"postinstall": "ln -sf ../index.js ./react-native-wechat.js"
},
"dependencies": {
"es6-promisify": "^3.0.0",
"react-native": "^0.14.2",
"events": "1.0.2"
}
}
... ...
../index.js
\ No newline at end of file
... ...
MIT License
Copyright (c) 2017 Yazhong Liu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
... ...
<img height="200" src="./weixin.png?raw=true">
# React-Native-Wechat
[React Native] bridging library that integrates WeChat SDKs:
- [x] iOS SDK 1.8.2
- [x] Android SDK ++
[react-native-wechat] has the following tracking data in the open source world:
| NPM | Dependency | Downloads | Build |
| ------------------------------------ | ---------------------------------------------- | ---------------------------------------------- | ------------------------------------------- |
| [![NPM version][npm-image]][npm-url] | [![Dependency Status][david-image]][david-url] | [![Downloads][downloads-image]][downloads-url] | [![Build Status][travis-image]][travis-url] |
## Table of Contents
- [Getting Started](#getting-started)
- [API Documentation](#api-documentation)
- [Installation](#installation)
- [Community](#community)
- [Authors](#authors)
- [License](#license)
## Getting Started
- [Build setup on iOS](./docs/build-setup-ios.md)
- [Build setup on Android](./docs/build-setup-android.md)
## API Documentation
[react-native-wechat] uses Promises, therefore you can use `Promise`
or `async/await` to manage your dataflow.
#### registerApp(appid)
- `appid` {String} the appid you get from WeChat dashboard
- returns {Boolean} explains if your application is registered done
This method should be called once globally.
```js
import * as WeChat from 'react-native-wechat';
WeChat.registerApp('appid');
```
#### registerAppWithDescription(appid, description)
- `appid` {String} the appid you get from WeChat dashboard
- `description` {String} the description of your app
- returns {Boolean} explains if your application is registered done
This method is only available on iOS.
#### isWXAppInstalled()
- returns {Boolean} if WeChat is installed.
Check if the WeChat app is installed on the device.
#### isWXAppSupportApi() (iOS平台)
- returns {Boolean} Contains the result.
Check if wechat support open url.
#### isWXAppSupportApi(supportSdk) (Android平台)
```java
//传入对应的字符串判断是否支持,没有找到微信文档,字面意思自己理解
public static final int SDK_INT = 620824064;
public static final int MIN_SDK_INT = 553713665;
public static final int CHECK_TOKEN_SDK_INT = 620824064;
public static final int TIMELINE_SUPPORTED_SDK_INT = 553779201;
public static final int EMOJI_SUPPORTED_SDK_INT = 553844737;
public static final int MUSIC_DATA_URL_SUPPORTED_SDK_INT = 553910273;
public static final int PAY_SUPPORTED_SDK_INT = 570425345;
public static final int OPENID_SUPPORTED_SDK_INT = 570425345;
public static final int FAVORITE_SUPPPORTED_SDK_INT = 570425345;
public static final int MESSAGE_ACTION_SUPPPORTED_SDK_INT = 570490883;
public static final int SCAN_QRCODE_AUTH_SUPPORTED_SDK_INT = 587268097;
public static final int MINIPROGRAM_SUPPORTED_SDK_INT = 620756993;
public static final int VIDEO_FILE_SUPPORTED_SDK_INT = 620756996;
public static final int SUBSCRIBE_MESSAGE_SUPPORTED_SDK_INT = 620756998;
public static final int LAUNCH_MINIPROGRAM_SUPPORTED_SDK_INT = 620757000;
public static final int CHOOSE_INVOICE_TILE_SUPPORT_SDK_INT = 620822528;
public static final int INVOICE_AUTH_INSERT_SDK_INT = 620823552;
public static final int NON_TAX_PAY_SDK_INT = 620823552;
public static final int PAY_INSURANCE_SDK_INT = 620823552;
public static final int SUBSCRIBE_MINI_PROGRAM_MSG_SUPPORTED_SDK_INT = 620823808;
public static final int OFFLINE_PAY_SDK_INT = 620823808;
public static final int SEND_TO_SPECIFIED_CONTACT_SDK_INT = 620824064;
public static final int OPEN_BUSINESS_WEBVIEW_SDK_INT = 620824064;
```
- returns {Boolean} Contain the result.
Check if wechat support open url.
#### getApiVersion()
- returns {String} Contains the result.
Get the WeChat SDK api version.
#### openWXApp()
- returns {Boolean}
Open the WeChat app from your application.
#### sendAuthRequest([scope[, state]])
- `scope` {Array|String} Scopes of auth request.
- `state` {String} the state of OAuth2
- returns {Object}
Send authentication request, and it returns an object with the
following fields:
| field | type | description |
| ------- | ------ | ----------------------------------- |
| errCode | Number | Error Code |
| errStr | String | Error message if any error occurred |
| openId | String | |
| code | String | Authorization code |
| url | String | The URL string |
| lang | String | The user language |
| country | String | The user country |
#### class `ShareMetadata`
- `type` {Number} type of this message. Can be {news|text|imageUrl|imageFile|imageResource|video|audio|file}
- `thumbImage` {String} Thumb image of the message, which can be a uri or a resource id.
- `description` {String} The description about the sharing.
- `webpageUrl` {String} Required if type equals `news`. The webpage link to share.
- `imageUrl` {String} Provide a remote image if type equals `image`.
- `videoUrl` {String} Provide a remote video if type equals `video`.
- `musicUrl` {String} Provide a remote music if type equals `audio`.
- `filePath` {String} Provide a local file if type equals `file`.
- `fileExtension` {String} Provide the file type if type equals `file`.
#### shareToTimeline(message)
- `message` {ShareMetadata} This object saves the metadata for sharing
- returns {Object}
Share a `ShareMetadata` message to timeline(朋友圈) and returns:
| name | type | description |
| ------- | ------ | ----------------------------------- |
| errCode | Number | 0 if authorization successed |
| errStr | String | Error message if any error occurred |
The following examples require the 'react-native-chat' and 'react-native-fs' packages.
```js
import * as WeChat from 'react-native-wechat';
import fs from 'react-native-fs';
let resolveAssetSource = require('resolveAssetSource');
// Code example to share text message:
try {
let result = await WeChat.shareToTimeline({
type: 'text',
description: 'hello, wechat'
});
console.log('share text message to time line successful:', result);
} catch (e) {
if (e instanceof WeChat.WechatError) {
console.error(e.stack);
} else {
throw e;
}
}
// Code example to share image url:
// Share raw http(s) image from web will always fail with unknown reason, please use image file or image resource instead
try {
let result = await WeChat.shareToTimeline({
type: 'imageUrl',
title: 'web image',
description: 'share web image to time line',
mediaTagName: 'email signature',
messageAction: undefined,
messageExt: undefined,
imageUrl: 'http://www.ncloud.hk/email-signature-262x100.png'
});
console.log('share image url to time line successful:', result);
} catch (e) {
if (e instanceof WeChat.WechatError) {
console.error(e.stack);
} else {
throw e;
}
}
// Code example to share image file:
try {
let rootPath = fs.DocumentDirectoryPath;
let savePath = rootPath + '/email-signature-262x100.png';
console.log(savePath);
/*
* savePath on iOS may be:
* /var/mobile/Containers/Data/Application/B1308E13-35F1-41AB-A20D-3117BE8EE8FE/Documents/email-signature-262x100.png
*
* savePath on Android may be:
* /data/data/com.wechatsample/files/email-signature-262x100.png
**/
await fs.downloadFile('http://www.ncloud.hk/email-signature-262x100.png', savePath);
let result = await WeChat.shareToTimeline({
type: 'imageFile',
title: 'image file download from network',
description: 'share image file to time line',
mediaTagName: 'email signature',
messageAction: undefined,
messageExt: undefined,
imageUrl: "file://" + savePath // require the prefix on both iOS and Android platform
});
console.log('share image file to time line successful:', result);
} catch (e) {
if (e instanceof WeChat.WechatError) {
console.error(e.stack);
} else {
throw e;
}
}
// Code example to share image resource:
try {
let imageResource = require('./email-signature-262x100.png');
let result = await WeChat.shareToTimeline({
type: 'imageResource',
title: 'resource image',
description: 'share resource image to time line',
mediaTagName: 'email signature',
messageAction: undefined,
messageExt: undefined,
imageUrl: resolveAssetSource(imageResource).uri
});
console.log('share resource image to time line successful', result);
}
catch (e) {
if (e instanceof WeChat.WechatError) {
console.error(e.stack);
} else {
throw e;
}
}
// Code example to download an word file from web, then share it to WeChat session
// only support to share to session but time line
// iOS code use DocumentDirectoryPath
try {
let rootPath = fs.DocumentDirectoryPath;
let fileName = 'signature_method.doc';
/*
* savePath on iOS may be:
* /var/mobile/Containers/Data/Application/B1308E13-35F1-41AB-A20D-3117BE8EE8FE/Documents/signature_method.doc
**/
let savePath = rootPath + '/' + fileName;
await fs.downloadFile('https://open.weixin.qq.com/zh_CN/htmledition/res/assets/signature_method.doc', savePath);
let result = await WeChat.shareToSession({
type: 'file',
title: fileName, // WeChat app treat title as file name
description: 'share word file to chat session',
mediaTagName: 'word file',
messageAction: undefined,
messageExt: undefined,
filePath: savePath,
fileExtension: '.doc'
});
console.log('share word file to chat session successful', result);
} catch (e) {
if (e instanceof WeChat.WechatError) {
console.error(e.stack);
} else {
throw e;
}
}
//android code use ExternalDirectoryPath
try {
let rootPath = fs.ExternalDirectoryPath;
let fileName = 'signature_method.doc';
/*
* savePath on Android may be:
* /storage/emulated/0/Android/data/com.wechatsample/files/signature_method.doc
**/
let savePath = rootPath + '/' + fileName;
await fs.downloadFile('https://open.weixin.qq.com/zh_CN/htmledition/res/assets/signature_method.doc', savePath);
let result = await WeChat.shareToSession({
type: 'file',
title: fileName, // WeChat app treat title as file name
description: 'share word file to chat session',
mediaTagName: 'word file',
messageAction: undefined,
messageExt: undefined,
filePath: savePath,
fileExtension: '.doc'
});
console.log('share word file to chat session successful', result);
}
catch (e) {
if (e instanceof WeChat.WechatError) {
console.error(e.stack);
} else {
throw e;
}
}
```
#### shareToSession(message)
- `message` {ShareMetadata} This object saves the metadata for sharing
- returns {Object}
Similar to `shareToTimeline` but sends the message to a friend or chat group.
#### launchMini(params)
- `params` {Object} 打开小程序的参数
- `userName` {String} 拉起的小程序的username
- `miniProgramType` {Integer} 拉起小程序的类型. 0-正式版 1-开发版 2-体验版
- `path` {String} 拉起小程序页面的可带参路径,不填默认拉起小程序首页
#### pay(payload)
- `payload` {Object} the payment data
- `partnerId` {String} 商家向财付通申请的商家ID
- `prepayId` {String} 预支付订单ID
- `nonceStr` {String} 随机串
- `timeStamp` {String} 时间戳
- `package` {String} 商家根据财付通文档填写的数据和签名
- `sign` {String} 商家根据微信开放平台文档对数据做的签名
- returns {Object}
Sends request for proceeding payment, then returns an object:
| name | type | description |
| ------- | ------ | ----------------------------------- |
| errCode | Number | 0 if authorization successed |
| errStr | String | Error message if any error occurred |
## Installation
```sh
$ npm install react-native-wechat --save
```
## Community
#### IRC
<a href="http://qm.qq.com/cgi-bin/qm/qr?k=cg3irEFCGxjkm2YJCt5V9OeJA1pNo5Ui"><img width="200" src="./qrcode_qq.jpg"></a>
#### Tutorials
- [react-native-wechat微信组件的使用](http://www.jianshu.com/p/3f424cccb888)
- [超详细React Native实现微信好友/朋友圈分享功能-Android/iOS双平台通用](http://www.jianshu.com/p/ce5439dd1f52)
- [柳轩涤俗 - 微信登录](http://www.cnblogs.com/zhangdw/p/6194345.html)
#### Who's using it
<a href="https://github.com/attentiveness/reading"><img height="80" width="80" src="https://raw.githubusercontent.com/attentiveness/reading/master/Reading_Logo.png"></a>
<a href="https://github.com/lipeiwei-szu/ReactNativeOne"><img height="80" width="80" src="http://android-artworks.25pp.com/fs08/2017/05/22/3/110_ed42e5c8f701ae26be6b0c423cb51858_con_130x130.png"></a>
## Authors
| GitHub | Role | Email |
|---------------|------------|-----------------------|
| [@yorkie] | Author | yorkiefixer@gmail.com |
| [@xing-zheng] | Emeriti | |
| [@tdzl2003] | Emeriti | tdzl2003@gmail.com |
[@yorkie]: https://github.com/yorkie
[@xing-zheng]: https://github.com/xing-zheng
[@tdzl2003]: https://github.com/tdzl2003
## License
MIT
[react-native-wechat]: https://github.com/yorkie/react-native-wechat
[npm-image]: https://img.shields.io/npm/v/react-native-wechat.svg?style=flat-square
[npm-url]: https://npmjs.org/package/react-native-wechat
[travis-image]: https://img.shields.io/travis/yorkie/react-native-wechat.svg?style=flat-square
[travis-url]: https://travis-ci.org/yorkie/react-native-wechat
[david-image]: http://img.shields.io/david/yorkie/react-native-wechat.svg?style=flat-square
[david-url]: https://david-dm.org/yorkie/react-native-wechat
[downloads-image]: http://img.shields.io/npm/dm/react-native-wechat.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/react-native-wechat
[React Native]: https://github.com/facebook/react-native
[react-native-cn]: https://github.com/reactnativecn
[WeChat SDK]: https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=1417674108&token=&lang=zh_CN
[Linking Libraries iOS Guidance]: https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/AddingaLibrarytoaTarget.html
... ...
theme: jekyll-theme-merlot
\ No newline at end of file
... ...
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
}
allprojects {
repositories {
jcenter()
maven { url "$projectDir/../../react-native/android" }
}
}
dependencies {
compile 'com.facebook.react:react-native:+'
compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":react-native-wechat" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../../android" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":react-native-wechat" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="PROJECT_TYPE" value="1" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/attr" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged-aidl" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/public_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="com.facebook.fresco:imagepipeline-okhttp3-1.3.0" level="project" />
<orderEntry type="library" name="com.android.support:support-v4-23.0.1" level="project" />
<orderEntry type="library" name="com.facebook.fresco:imagepipeline-1.3.0" level="project" />
<orderEntry type="library" name="com.squareup.okhttp3:okhttp:3.6.0@jar" level="project" />
<orderEntry type="library" name="com.facebook.fresco:fbcore-1.3.0" level="project" />
<orderEntry type="library" name="com.facebook.fresco:drawee-1.3.0" level="project" />
<orderEntry type="library" name="com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.1.4@jar" level="project" />
<orderEntry type="library" name="com.android.support:appcompat-v7-23.0.1" level="project" />
<orderEntry type="library" name="javax.inject:javax.inject:1@jar" level="project" />
<orderEntry type="library" name="com.facebook.fbui.textlayoutbuilder:staticlayout-proxy:1.0@jar" level="project" />
<orderEntry type="library" name="com.facebook.fresco:imagepipeline-base-1.3.0" level="project" />
<orderEntry type="library" name="com.parse.bolts:bolts-tasks:1.4.0@jar" level="project" />
<orderEntry type="library" name="com.facebook.react:react-native-0.55.4" level="project" />
<orderEntry type="library" name="com.google.code.findbugs:jsr305:3.0.0@jar" level="project" />
<orderEntry type="library" name="com.squareup.okhttp3:okhttp-urlconnection:3.6.0@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-annotations:23.0.1@jar" level="project" />
<orderEntry type="library" name="com.facebook.soloader:soloader-0.1.0" level="project" />
<orderEntry type="library" name="com.squareup.okio:okio:1.13.0@jar" level="project" />
<orderEntry type="library" name="com.facebook.fbui.textlayoutbuilder:textlayoutbuilder-1.0.0" level="project" />
<orderEntry type="library" name="com.facebook.fresco:fresco-1.3.0" level="project" />
<orderEntry type="library" name="org.webkit:android-jsc-r174650" level="project" />
</component>
</module>
\ No newline at end of file
... ...
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.theweflex.react">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
... ...
package com.theweflex.react;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.support.annotation.Nullable;
import com.facebook.common.executors.UiThreadImmediateExecutorService;
import com.facebook.common.references.CloseableReference;
import com.facebook.common.util.UriUtil;
import com.facebook.datasource.DataSource;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.common.ResizeOptions;
import com.facebook.imagepipeline.core.ImagePipeline;
import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber;
import com.facebook.imagepipeline.image.CloseableImage;
import com.facebook.imagepipeline.request.ImageRequest;
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.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.tencent.mm.opensdk.constants.Build;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
import com.tencent.mm.opensdk.modelmsg.WXFileObject;
import com.tencent.mm.opensdk.modelmsg.WXImageObject;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import com.tencent.mm.opensdk.modelmsg.WXMiniProgramObject;
import com.tencent.mm.opensdk.modelmsg.WXMusicObject;
import com.tencent.mm.opensdk.modelmsg.WXTextObject;
import com.tencent.mm.opensdk.modelmsg.WXVideoObject;
import com.tencent.mm.opensdk.modelmsg.WXWebpageObject;
import com.tencent.mm.opensdk.modelpay.PayReq;
import com.tencent.mm.opensdk.modelpay.PayResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import java.util.ArrayList;
import java.util.UUID;
/**
* Created by tdzl2_000 on 2015-10-10.
*/
public class WeChatModule extends ReactContextBaseJavaModule implements IWXAPIEventHandler {
private String appId;
private IWXAPI api = null;
private final static String NOT_REGISTERED = "registerApp required.";
private final static String INVOKE_FAILED = "WeChat API invoke returns false.";
private final static String INVALID_ARGUMENT = "invalid argument.";
public WeChatModule(ReactApplicationContext context) {
super(context);
}
@Override
public String getName() {
return "RCTWeChat";
}
/**
* fix Native module WeChatModule tried to override WeChatModule for module name RCTWeChat.
* If this was your intention, return true from WeChatModule#canOverrideExistingModule() bug
*
* @return
*/
public boolean canOverrideExistingModule(){
return true;
}
private static ArrayList<WeChatModule> modules = new ArrayList<>();
@Override
public void initialize() {
super.initialize();
modules.add(this);
}
@Override
public void onCatalystInstanceDestroy() {
super.onCatalystInstanceDestroy();
if (api != null) {
api = null;
}
modules.remove(this);
}
public static void handleIntent(Intent intent) {
for (WeChatModule mod : modules) {
mod.api.handleIntent(intent, mod);
}
}
@ReactMethod
public void registerApp(String appid, Callback callback) {
this.appId = appid;
api = WXAPIFactory.createWXAPI(this.getReactApplicationContext().getBaseContext(), appid, true);
callback.invoke(null, api.registerApp(appid));
}
@ReactMethod
public void isWXAppInstalled(Callback callback) {
if (api == null) {
callback.invoke(NOT_REGISTERED);
return;
}
callback.invoke(null, api.isWXAppInstalled());
}
@ReactMethod
public void isWXAppSupportApi(String supportApi, Callback callback) {
if (api == null) {
callback.invoke(NOT_REGISTERED);
return;
}
int supportSDKINT = Build.PAY_SUPPORTED_SDK_INT;
switch (supportApi) {
case "SDK_INT":
supportSDKINT = Build.SDK_INT;
break;
case "MIN_SDK_INT":
supportSDKINT = Build.MIN_SDK_INT;
break;
case "CHECK_TOKEN_SDK_INT":
supportSDKINT = Build.CHECK_TOKEN_SDK_INT;
break;
case "TIMELINE_SUPPORTED_SDK_INT":
supportSDKINT = Build.TIMELINE_SUPPORTED_SDK_INT;
break;
case "EMOJI_SUPPORTED_SDK_INT":
supportSDKINT = Build.EMOJI_SUPPORTED_SDK_INT;
break;
case "MUSIC_DATA_URL_SUPPORTED_SDK_INT":
supportSDKINT = Build.MUSIC_DATA_URL_SUPPORTED_SDK_INT;
break;
case "PAY_SUPPORTED_SDK_INT":
supportSDKINT = Build.PAY_SUPPORTED_SDK_INT;
break;
case "OPENID_SUPPORTED_SDK_INT":
supportSDKINT = Build.OPENID_SUPPORTED_SDK_INT;
break;
case "FAVORITE_SUPPPORTED_SDK_INT":
supportSDKINT = Build.FAVORITE_SUPPPORTED_SDK_INT;
break;
case "MESSAGE_ACTION_SUPPPORTED_SDK_INT":
supportSDKINT = Build.MESSAGE_ACTION_SUPPPORTED_SDK_INT;
break;
case "SCAN_QRCODE_AUTH_SUPPORTED_SDK_INT":
supportSDKINT = Build.SCAN_QRCODE_AUTH_SUPPORTED_SDK_INT;
break;
case "MINIPROGRAM_SUPPORTED_SDK_INT":
supportSDKINT = Build.MINIPROGRAM_SUPPORTED_SDK_INT;
break;
case "VIDEO_FILE_SUPPORTED_SDK_INT":
supportSDKINT = Build.VIDEO_FILE_SUPPORTED_SDK_INT;
break;
case "SUBSCRIBE_MESSAGE_SUPPORTED_SDK_INT":
supportSDKINT = Build.SUBSCRIBE_MESSAGE_SUPPORTED_SDK_INT;
break;
case "LAUNCH_MINIPROGRAM_SUPPORTED_SDK_INT":
supportSDKINT = Build.LAUNCH_MINIPROGRAM_SUPPORTED_SDK_INT;
break;
case "CHOOSE_INVOICE_TILE_SUPPORT_SDK_INT":
supportSDKINT = Build.CHOOSE_INVOICE_TILE_SUPPORT_SDK_INT;
break;
case "INVOICE_AUTH_INSERT_SDK_INT":
supportSDKINT = Build.INVOICE_AUTH_INSERT_SDK_INT;
break;
case "NON_TAX_PAY_SDK_INT":
supportSDKINT = Build.NON_TAX_PAY_SDK_INT;
break;
case "PAY_INSURANCE_SDK_INT":
supportSDKINT = Build.PAY_INSURANCE_SDK_INT;
break;
case "SUBSCRIBE_MINI_PROGRAM_MSG_SUPPORTED_SDK_INT":
supportSDKINT = Build.SUBSCRIBE_MINI_PROGRAM_MSG_SUPPORTED_SDK_INT;
break;
case "OFFLINE_PAY_SDK_INT":
supportSDKINT = Build.OFFLINE_PAY_SDK_INT;
break;
case "SEND_TO_SPECIFIED_CONTACT_SDK_INT":
supportSDKINT = Build.SEND_TO_SPECIFIED_CONTACT_SDK_INT;
break;
case "OPEN_BUSINESS_WEBVIEW_SDK_INT":
supportSDKINT = Build.OPEN_BUSINESS_WEBVIEW_SDK_INT;
break;
}
boolean isWXAppSupportAPI = api.getWXAppSupportAPI() >= supportSDKINT;
callback.invoke(null, isWXAppSupportAPI);
}
@ReactMethod
public void getApiVersion(Callback callback) {
if (api == null) {
callback.invoke(NOT_REGISTERED);
return;
}
callback.invoke(null, api.getWXAppSupportAPI());
}
@ReactMethod
public void openWXApp(Callback callback) {
if (api == null) {
callback.invoke(NOT_REGISTERED);
return;
}
callback.invoke(null, api.openWXApp());
}
@ReactMethod
public void sendAuthRequest(String scope, String state, Callback callback) {
if (api == null) {
callback.invoke(NOT_REGISTERED);
return;
}
SendAuth.Req req = new SendAuth.Req();
req.scope = scope;
req.state = state;
callback.invoke(null, api.sendReq(req));
}
@ReactMethod
public void shareToTimeline(ReadableMap data, Callback callback) {
if (api == null) {
callback.invoke(NOT_REGISTERED);
return;
}
_share(SendMessageToWX.Req.WXSceneTimeline, data, callback);
}
@ReactMethod
public void launchMini(ReadableMap data, Callback callback) {
if (api == null) {
callback.invoke(NOT_REGISTERED);
return;
}
WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
req.userName = data.getString("userName"); // 填小程序原始id
req.path = data.getString("path"); //拉起小程序页面的可带参路径,不填默认拉起小程序首页
req.miniprogramType = data.getInt("miniProgramType");// 可选打开 开发版,体验版和正式版
// req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版,体验版和正式版
boolean success = api.sendReq(req);
if (!success) callback.invoke(INVALID_ARGUMENT);
}
@ReactMethod
public void shareToSession(ReadableMap data, Callback callback) {
if (api == null) {
callback.invoke(NOT_REGISTERED);
return;
}
_share(SendMessageToWX.Req.WXSceneSession, data, callback);
}
@ReactMethod
public void pay(ReadableMap data, Callback callback) {
PayReq payReq = new PayReq();
if (data.hasKey("partnerId")) {
payReq.partnerId = data.getString("partnerId");
}
if (data.hasKey("prepayId")) {
payReq.prepayId = data.getString("prepayId");
}
if (data.hasKey("nonceStr")) {
payReq.nonceStr = data.getString("nonceStr");
}
if (data.hasKey("timeStamp")) {
payReq.timeStamp = data.getString("timeStamp");
}
if (data.hasKey("sign")) {
payReq.sign = data.getString("sign");
}
if (data.hasKey("package")) {
payReq.packageValue = data.getString("package");
}
if (data.hasKey("extData")) {
payReq.extData = data.getString("extData");
}
payReq.appId = appId;
callback.invoke(api.sendReq(payReq) ? null : INVOKE_FAILED);
}
private void _share(final int scene, final ReadableMap data, final Callback callback) {
Uri uri = null;
if (data.hasKey("thumbImage") || data.hasKey("hdImageData")) {
String imageUrl = data.hasKey("hdImageData") ? data.getString("hdImageData") : data.getString("thumbImage");
try {
uri = Uri.parse(imageUrl);
// Verify scheme is set, so that relative uri (used by static resources) are not handled.
if (uri.getScheme() == null) {
uri = getResourceDrawableUri(getReactApplicationContext(), imageUrl);
}
} catch (Exception e) {
// ignore malformed uri, then attempt to extract resource ID.
}
}
if (uri != null) {
this._getImage(uri, new ResizeOptions(100, 100), new ImageCallback() {
@Override
public void invoke(@Nullable Bitmap bitmap) {
WeChatModule.this._share(scene, data, bitmap, callback);
}
});
} else {
this._share(scene, data, null, callback);
}
}
private void _getImage(Uri uri, ResizeOptions resizeOptions, final ImageCallback imageCallback) {
BaseBitmapDataSubscriber dataSubscriber = new BaseBitmapDataSubscriber() {
@Override
protected void onNewResultImpl(Bitmap bitmap) {
bitmap = bitmap.copy(bitmap.getConfig(), true);
imageCallback.invoke(bitmap);
}
@Override
protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
imageCallback.invoke(null);
}
};
ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
if (resizeOptions != null) {
// builder = builder.setResizeOptions(resizeOptions);
}
ImageRequest imageRequest = builder.build();
ImagePipeline imagePipeline = Fresco.getImagePipeline();
DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, null);
dataSource.subscribe(dataSubscriber, UiThreadImmediateExecutorService.getInstance());
}
private static Uri getResourceDrawableUri(Context context, String name) {
if (name == null || name.isEmpty()) {
return null;
}
name = name.toLowerCase().replace("-", "_");
int resId = context.getResources().getIdentifier(
name,
"drawable",
context.getPackageName());
if (resId == 0) {
return null;
} else {
return new Uri.Builder()
.scheme(UriUtil.LOCAL_RESOURCE_SCHEME)
.path(String.valueOf(resId))
.build();
}
}
private void _share(final int scene, final ReadableMap data, final Bitmap thumbImage, final Callback callback) {
if (!data.hasKey("type")) {
callback.invoke(INVALID_ARGUMENT);
return;
}
String type = data.getString("type");
WXMediaMessage.IMediaObject mediaObject = null;
if (type.equals("news")) {
mediaObject = _jsonToWebpageMedia(data);
} else if (type.equals("text")) {
mediaObject = _jsonToTextMedia(data);
} else if (type.equals("imageUrl") || type.equals("imageResource")) {
__jsonToImageUrlMedia(data, new MediaObjectCallback() {
@Override
public void invoke(@Nullable WXMediaMessage.IMediaObject mediaObject) {
if (mediaObject == null) {
callback.invoke(INVALID_ARGUMENT);
} else {
WeChatModule.this._share(scene, data, thumbImage, mediaObject, callback);
}
}
});
return;
} else if (type.equals("imageFile")) {
__jsonToImageFileMedia(data, new MediaObjectCallback() {
@Override
public void invoke(@Nullable WXMediaMessage.IMediaObject mediaObject) {
if (mediaObject == null) {
callback.invoke(INVALID_ARGUMENT);
} else {
WeChatModule.this._share(scene, data, thumbImage, mediaObject, callback);
}
}
});
return;
} else if (type.equals("video")) {
mediaObject = __jsonToVideoMedia(data);
} else if (type.equals("audio")) {
mediaObject = __jsonToMusicMedia(data);
} else if (type.equals("file")) {
mediaObject = __jsonToFileMedia(data);
} else if (type.equals("mini")) {
mediaObject = __jsonToMiniMedia(data);
}
if (mediaObject == null) {
callback.invoke(INVALID_ARGUMENT);
} else {
_share(scene, data, thumbImage, mediaObject, callback);
}
}
private void _share(int scene, ReadableMap data, Bitmap thumbImage, WXMediaMessage.IMediaObject mediaObject, Callback callback) {
WXMediaMessage message = new WXMediaMessage();
message.mediaObject = mediaObject;
if (thumbImage != null) {
message.setThumbImage(thumbImage);
}
if (data.hasKey("title")) {
message.title = data.getString("title");
}
if (data.hasKey("description")) {
message.description = data.getString("description");
}
if (data.hasKey("mediaTagName")) {
message.mediaTagName = data.getString("mediaTagName");
}
if (data.hasKey("messageAction")) {
message.messageAction = data.getString("messageAction");
}
if (data.hasKey("messageExt")) {
message.messageExt = data.getString("messageExt");
}
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.message = message;
req.scene = scene;
req.transaction = UUID.randomUUID().toString();
callback.invoke(null, api.sendReq(req));
}
private WXTextObject _jsonToTextMedia(ReadableMap data) {
if (!data.hasKey("description")) {
return null;
}
WXTextObject ret = new WXTextObject();
ret.text = data.getString("description");
return ret;
}
private WXWebpageObject _jsonToWebpageMedia(ReadableMap data) {
if (!data.hasKey("webpageUrl")) {
return null;
}
WXWebpageObject ret = new WXWebpageObject();
ret.webpageUrl = data.getString("webpageUrl");
if (data.hasKey("extInfo")) {
ret.extInfo = data.getString("extInfo");
}
return ret;
}
private void __jsonToImageMedia(String imageUrl, final MediaObjectCallback callback) {
Uri imageUri;
try {
imageUri = Uri.parse(imageUrl);
// Verify scheme is set, so that relative uri (used by static resources) are not handled.
if (imageUri.getScheme() == null) {
imageUri = getResourceDrawableUri(getReactApplicationContext(), imageUrl);
}
} catch (Exception e) {
imageUri = null;
}
if (imageUri == null) {
callback.invoke(null);
return;
}
this._getImage(imageUri, null, new ImageCallback() {
@Override
public void invoke(@Nullable Bitmap bitmap) {
callback.invoke(bitmap == null ? null : new WXImageObject(bitmap));
}
});
}
private void __jsonToImageUrlMedia(ReadableMap data, MediaObjectCallback callback) {
if (!data.hasKey("imageUrl")) {
callback.invoke(null);
return;
}
String imageUrl = data.getString("imageUrl");
__jsonToImageMedia(imageUrl, callback);
}
private void __jsonToImageFileMedia(ReadableMap data, MediaObjectCallback callback) {
if (!data.hasKey("imageUrl")) {
callback.invoke(null);
return;
}
String imageUrl = data.getString("imageUrl");
if (!imageUrl.toLowerCase().startsWith("file://")) {
imageUrl = "file://" + imageUrl;
}
__jsonToImageMedia(imageUrl, callback);
}
private WXMusicObject __jsonToMusicMedia(ReadableMap data) {
if (!data.hasKey("musicUrl")) {
return null;
}
WXMusicObject ret = new WXMusicObject();
ret.musicUrl = data.getString("musicUrl");
return ret;
}
private WXVideoObject __jsonToVideoMedia(ReadableMap data) {
if (!data.hasKey("videoUrl")) {
return null;
}
WXVideoObject ret = new WXVideoObject();
ret.videoUrl = data.getString("videoUrl");
return ret;
}
private WXFileObject __jsonToFileMedia(ReadableMap data) {
if (!data.hasKey("filePath")) {
return null;
}
return new WXFileObject(data.getString("filePath"));
}
private WXMiniProgramObject __jsonToMiniMedia(ReadableMap data) {
if (!data.hasKey("userName")) {
return null;
}
WXMiniProgramObject miniProgramObject = new WXMiniProgramObject();
miniProgramObject.userName = data.getString("userName");
if (data.hasKey("miniProgramType"))
miniProgramObject.miniprogramType = data.getInt("miniProgramType");
if (data.hasKey("webpageUrl")) miniProgramObject.webpageUrl = data.getString("webpageUrl");
if (data.hasKey("path")) miniProgramObject.path = data.getString("path");
if (data.hasKey("withShareTicket"))
miniProgramObject.withShareTicket = data.getBoolean("withShareTicket");
return miniProgramObject;
}
// TODO: 实现sendRequest、sendSuccessResponse、sendErrorCommonResponse、sendErrorUserCancelResponse
@Override
public void onReq(BaseReq baseReq) {
}
@Override
public void onResp(BaseResp baseResp) {
WritableMap map = Arguments.createMap();
map.putInt("errCode", baseResp.errCode);
map.putString("errStr", baseResp.errStr);
map.putString("openId", baseResp.openId);
map.putString("transaction", baseResp.transaction);
if (baseResp instanceof SendAuth.Resp) {
SendAuth.Resp resp = (SendAuth.Resp) (baseResp);
map.putString("type", "SendAuth.Resp");
map.putString("code", resp.code);
map.putString("state", resp.state);
map.putString("url", resp.url);
map.putString("lang", resp.lang);
map.putString("country", resp.country);
} else if (baseResp instanceof SendMessageToWX.Resp) {
SendMessageToWX.Resp resp = (SendMessageToWX.Resp) (baseResp);
map.putString("type", "SendMessageToWX.Resp");
} else if (baseResp instanceof PayResp) {
PayResp resp = (PayResp) (baseResp);
map.putString("type", "PayReq.Resp");
map.putString("returnKey", resp.returnKey);
} else if (baseResp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {
WXLaunchMiniProgram.Resp resp = (WXLaunchMiniProgram.Resp) baseResp;
String extraData = resp.extMsg; // 对应JsApi navigateBackApplication中的extraData字段数据
map.putString("extraData", extraData);
}
this.getReactApplicationContext()
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("WeChat_Resp", map);
}
private interface ImageCallback {
void invoke(@Nullable Bitmap bitmap);
}
private interface MediaObjectCallback {
void invoke(@Nullable WXMediaMessage.IMediaObject mediaObject);
}
}
... ...
package com.theweflex.react;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Created by tdzl2_000 on 2015-10-10.
*/
public class WeChatPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.asList(new NativeModule[]{
// Modules from third-party
new WeChatModule(reactContext),
});
}
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}
... ...
package com.theweflex.react;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
public class WeChatRegister extends BroadcastReceiver {
private static final String TAG = "WeChatRegister";
@Override
public void onReceive(Context context, Intent intent) {
Log.e(TAG, "onReceive: ");
// final IWXAPI api = WXAPIFactory.createWXAPI(context, WeChatModule.appId);
// api.registerApp(WeChatModule.appId);
}
}
... ...
# Build Setup for Android
Copy lines to `android/settings.gradle`:
```gradle
include ':RCTWeChat'
project(':RCTWeChat').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-wechat/android')
```
Copy lines to `android/app/build.gradle`
```gradle
dependencies {
compile project(':RCTWeChat')
}
```
Copy lines to `proguard-rules.pro`:
```pro
-keep class com.tencent.mm.sdk.** {
*;
}
```
Then update `MainActivity.java` or `MainApplication.java`:
```java
import com.theweflex.react.WeChatPackage;
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new WeChatPackage() // Add this line
);
}
```
**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.
```java
package your.package.wxapi;
import android.app.Activity;
import android.os.Bundle;
import com.theweflex.react.WeChatModule;
public class WXEntryActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WeChatModule.handleIntent(getIntent());
finish();
}
}
```
Then add the following node to `AndroidManifest.xml`:
```xml
<manifest>
<application>
<activity
android:name=".wxapi.WXEntryActivity"
android:label="@string/app_name"
android:exported="true"
/>
</application>
</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
`WXPayEntryActivity`, this is used to bypass the response to JS level:
```java
package your.package.wxapi;
import android.app.Activity;
import android.os.Bundle;
import com.theweflex.react.WeChatModule;
public class WXPayEntryActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WeChatModule.handleIntent(getIntent());
finish();
}
}
```
Then add the following node to `AndroidManifest.xml`:
```xml
<manifest>
<application>
<activity
android:name=".wxapi.WXPayEntryActivity"
android:label="@string/app_name"
android:exported="true"
/>
</application>
</manifest>
```
... ...
# Build Setup for iOS
Add the following libraries to your "Link Binary with Libraries":
- [x] `SystemConfiguration.framework`
- [x] `CoreTelephony.framework`
- [x] `libsqlite3.0`
- [x] `libc++`
- [x] `libz`
Add "URL Schema" as your app id for "URL type" in Targets > info, See
the following screenshot for the view on your XCode:
![Set URL Schema in XCode](https://res.wx.qq.com/open/zh_CN/htmledition/res/img/pic/app-access-guide/ios/image0042168b9.jpg)
On iOS 9+, add `wechat` and `weixin` into `LSApplicationQueriesSchemes` in
`Targets` > `info` > `Custom iOS Target Properties`. Or edit `Info.plist`
then add:
```xml
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>wechat</string>
</array>
```
Then copy the following in `AppDelegate.m`:
```objc
#import <React/RCTLinkingManager.h>
// ios 8.x or older
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation];
}
// ios 9.0+
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
options:(NSDictionary<NSString*, id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
```
... ...
'use strict';
import {DeviceEventEmitter, NativeModules, Platform} from 'react-native';
import {EventEmitter} from 'events';
let isAppRegistered = false;
const {WeChat} = NativeModules;
// Event emitter to dispatch request and response from WeChat.
const emitter = new EventEmitter();
DeviceEventEmitter.addListener('WeChat_Resp', resp => {
emitter.emit(resp.type, resp);
});
function wrapRegisterApp(nativeFunc) {
if (!nativeFunc) {
return undefined;
}
return (...args) => {
if (isAppRegistered) {
// FIXME(Yorkie): we ignore this error if AppRegistered is true.
return Promise.resolve(true);
}
isAppRegistered = true;
return new Promise((resolve, reject) => {
nativeFunc.apply(null, [
...args,
(error, result) => {
if (!error) {
return resolve(result);
}
if (typeof error === 'string') {
return reject(new Error(error));
}
reject(error);
},
]);
});
};
}
function wrapApi(nativeFunc) {
if (!nativeFunc) {
return undefined;
}
return (...args) => {
if (!isAppRegistered) {
return Promise.reject(new Error('registerApp required.'));
}
return new Promise((resolve, reject) => {
nativeFunc.apply(null, [
...args,
(error, result) => {
if (!error) {
return resolve(result);
}
if (typeof error === 'string') {
return reject(new Error(error));
}
reject(error);
},
]);
});
};
}
/**
* `addListener` inherits from `events` module
* @method addListener
* @param {String} eventName - the event name
* @param {Function} trigger - the function when event is fired
*/
export const addListener = emitter.addListener.bind(emitter);
/**
* `once` inherits from `events` module
* @method once
* @param {String} eventName - the event name
* @param {Function} trigger - the function when event is fired
*/
export const once = emitter.once.bind(emitter);
/**
* `removeAllListeners` inherits from `events` module
* @method removeAllListeners
* @param {String} eventName - the event name
*/
export const removeAllListeners = emitter.removeAllListeners.bind(emitter);
/**
* @method registerApp
* @param {String} appid - the app id
* @return {Promise}
*/
export const registerApp = wrapRegisterApp(WeChat.registerApp);
/**
* @method registerAppWithDescription
* @param {String} appid - the app id
* @param {String} appdesc - the app description
* @return {Promise}
*/
export const registerAppWithDescription = wrapRegisterApp(
WeChat.registerAppWithDescription,
);
/**
* Return if the wechat app is installed in the device.
* @method isWXAppInstalled
* @return {Promise}
*/
export const isWXAppInstalled = wrapApi(WeChat.isWXAppInstalled);
/**
* Return if the wechat application supports the api
* @method isWXAppSupportApi
* @return {Promise}
*/
export const isWXAppSupportApi = wrapApi(WeChat.isWXAppSupportApi);
/**
* Get the wechat app installed url
* @method getWXAppInstallUrl
* @return {String} the wechat app installed url
*/
export const getWXAppInstallUrl = wrapApi(WeChat.getWXAppInstallUrl);
/**
* Get the wechat api version
* @method getApiVersion
* @return {String} the api version string
*/
export const getApiVersion = wrapApi(WeChat.getApiVersion);
/**
* Open wechat app
* @method openWXApp
* @return {Promise}
*/
export const openWXApp = wrapApi(WeChat.openWXApp);
// wrap the APIs
const nativeShareToTimeline = wrapApi(WeChat.shareToTimeline);
const nativeLaunchMini = wrapApi(WeChat.launchMini);
const nativeShareToSession = wrapApi(WeChat.shareToSession);
const nativeSendAuthRequest = wrapApi(WeChat.sendAuthRequest);
/**
* @method sendAuthRequest
* @param {Array} scopes - the scopes for authentication.
* @return {Promise}
*/
export function sendAuthRequest(scopes, state) {
return new Promise((resolve, reject) => {
WeChat.sendAuthRequest(scopes, state, () => {
});
emitter.once('SendAuth.Resp', resp => {
if (resp.errCode === 0) {
resolve(resp);
} else {
reject(new WechatError(resp));
}
});
});
}
/**
* Share something to timeline/moments/朋友圈
* @method shareToTimeline
* @param {Object} data
* @param {String} data.thumbImage - Thumb image of the message, which can be a uri or a resource id.
* @param {String} data.type - Type of this message. Could be {news|text|imageUrl|imageFile|imageResource|video|audio|file|mini}
* @param {String} data.webpageUrl - Required if type equals news or mini. The webpage link to share.
* @param {String} data.userName - 小程序的原生id.
* @param {String} data.path - 小程序页面的路径.
* @param {String} data.hdImageData - 小程序节点高清大图,小于128k.
* @param {Boolean} data.withShareTicket - 是否使用带 shareTicket 的转发
* @param {Integer} data.miniProgramType - 分享小程序的版本(0-正式,1-开发,2-体验)
* @param {String} data.webpageUrl - Required if type equals news. The webpage link to share.
* @param {String} data.webpageUrl - Required if type equals news. The webpage link to share.
* @param {String} data.imageUrl - Provide a remote image if type equals image.
* @param {String} data.videoUrl - Provide a remote video if type equals video.
* @param {String} data.musicUrl - Provide a remote music if type equals audio.
* @param {String} data.filePath - Provide a local file if type equals file.
* @param {String} data.fileExtension - Provide the file type if type equals file.
*/
export function shareToTimeline(data) {
return new Promise((resolve, reject) => {
nativeShareToTimeline(data);
emitter.once('SendMessageToWX.Resp', resp => {
if (resp.errCode === 0) {
resolve(resp);
} else {
reject(new WechatError(resp));
}
});
});
}
/**
* 打开小程序
* @method launchMini
* @param
* @param {String} userName - 拉起的小程序的username
* @param {Integer} miniProgramType - 拉起小程序的类型. 0-正式版 1-开发版 2-体验版
* @param {String} path - 拉起小程序页面的可带参路径,不填默认拉起小程序首页
*/
export function launchMini({userName, miniProgramType = 0, path = ''}) {
return new Promise((resolve, reject) => {
if (miniProgramType !== 0 && miniProgramType !== 1 && miniProgramType !== 2) {
reject(new WechatError({errStr: '拉起小程序的类型不对,0-正式版 1-开发版 2-体验版', errCode: -1}))
return
}
nativeLaunchMini({userName, miniProgramType, path});
emitter.once('WXLaunchMiniProgramReq.Resp', resp => {
if (resp.errCode === 0) {
resolve(resp);
} else {
reject(new WechatError(resp));
}
});
});
}
/**
* Share something to a friend or group
* @method shareToSession
* @param {Object} data
* @param {String} data.thumbImage - Thumb image of the message, which can be a uri or a resource id.
* @param {String} data.type - Type of this message. Could be {news|text|imageUrl|imageFile|imageResource|video|audio|file}
* @param {String} data.webpageUrl - Required if type equals news. The webpage link to share.
* @param {String} data.userName - 小程序的原生id.
* @param {String} data.path - 小程序页面的路径.
* @param {String} data.hdImageData - 小程序节点高清大图,小于128k.
* @param {Boolean} data.withShareTicket - 是否使用带 shareTicket 的转发
* @param {Integer} data.miniProgramType - 分享小程序的版本(0-正式,1-开发,2-体验)
* @param {String} data.imageUrl - Provide a remote image if type equals image.
* @param {String} data.videoUrl - Provide a remote video if type equals video.
* @param {String} data.musicUrl - Provide a remote music if type equals audio.
* @param {String} data.filePath - Provide a local file if type equals file.
* @param {String} data.fileExtension - Provide the file type if type equals file.
*/
export function shareToSession(data) {
return new Promise((resolve, reject) => {
nativeShareToSession(data);
emitter.once('SendMessageToWX.Resp', resp => {
if (resp.errCode === 0) {
resolve(resp);
} else {
reject(new WechatError(resp));
}
});
});
}
/**
* wechat pay
* @param {Object} data
* @param {String} data.partnerId
* @param {String} data.prepayId
* @param {String} data.nonceStr
* @param {String} data.timeStamp
* @param {String} data.package
* @param {String} data.sign
* @returns {Promise}
*/
export function pay(data) {
// FIXME(Yorkie): see https://github.com/yorkie/react-native-wechat/issues/203
// Here the server-side returns params in lowercase, but here SDK requires timeStamp
// for compatibility, we make this correction for users.
function correct(actual, fixed) {
if (!data[fixed] && data[actual]) {
data[fixed] = data[actual];
delete data[actual];
}
}
correct('prepayid', 'prepayId');
correct('noncestr', 'nonceStr');
correct('partnerid', 'partnerId');
correct('timestamp', 'timeStamp');
return new Promise((resolve, reject) => {
WeChat.pay(data, result => {
if (result) reject(result);
});
emitter.once('PayReq.Resp', resp => {
if (resp.errCode === 0) {
resolve(resp);
} else {
reject(new WechatError(resp));
}
});
});
}
/**
* promises will reject with this error when API call finish with an errCode other than zero.
*/
export class WechatError extends Error {
constructor(resp) {
const message = resp.errStr || resp.errCode.toString();
super(message);
this.name = 'WechatError';
this.code = resp.errCode;
// avoid babel's limition about extending Error class
// https://github.com/babel/babel/issues/3083
if (typeof Object.setPrototypeOf === 'function') {
Object.setPrototypeOf(this, WechatError.prototype);
} else {
this.__proto__ = WechatError.prototype;
}
}
}
... ...
//
// RCTWeChat.h
// RCTWeChat
//
// Created by Yorkie Liu on 10/16/15.
// Copyright © 2015 WeFlex. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <React/RCTBridgeModule.h>
#import "WXApi.h"
// define share type constants
#define RCTWXShareTypeNews @"news"
#define RCTWXShareTypeThumbImageUrl @"thumbImage"
#define RCTWXShareTypeImageUrl @"imageUrl"
#define RCTWXShareTypeImageFile @"imageFile"
#define RCTWXShareTypeImageResource @"imageResource"
#define RCTWXShareTypeText @"text"
#define RCTWXShareTypeVideo @"video"
#define RCTWXShareTypeAudio @"audio"
#define RCTWXShareTypeFile @"file"
#define RCTWXShareTypeMini @"mini"
#define RCTWXShareType @"type"
#define RCTWXShareTitle @"title"
#define RCTWXShareDescription @"description"
#define RCTWXShareWebpageUrl @"webpageUrl"
#define RCTWXShareImageUrl @"imageUrl"
#define RCTWXEventName @"WeChat_Resp"
@interface RCTWeChat : NSObject <RCTBridgeModule, WXApiDelegate>
@property NSString* appId;
@end
... ...
//
// RCTWeChat.m
// RCTWeChat
//
// Created by Yorkie Liu on 10/16/15.
// Copyright © 2015 WeFlex. All rights reserved.
//
#import "RCTWeChat.h"
#import "WXApiObject.h"
#import <React/RCTEventDispatcher.h>
#import <React/RCTBridge.h>
#import <React/RCTLog.h>
#import <React/RCTImageLoader.h>
// 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
{
self = [super init];
if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:@"RCTOpenURLNotification" object:nil];
}
return self;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (BOOL)handleOpenURL:(NSNotification *)aNotification
{
NSString * aURLString = [aNotification userInfo][@"url"];
NSURL * aURL = [NSURL URLWithString:aURLString];
if ([WXApi handleOpenURL:aURL delegate:self])
{
return YES;
} else {
return NO;
}
}
- (dispatch_queue_t)methodQueue
{
return dispatch_get_main_queue();
}
+ (BOOL)requiresMainQueueSetup {
return YES;
}
RCT_EXPORT_METHOD(registerApp:(NSString *)appid
:(RCTResponseSenderBlock)callback)
{
self.appId = appid;
callback(@[[WXApi registerApp:appid] ? [NSNull null] : INVOKE_FAILED]);
}
RCT_EXPORT_METHOD(isWXAppInstalled:(RCTResponseSenderBlock)callback)
{
callback(@[[NSNull null], @([WXApi isWXAppInstalled])]);
}
RCT_EXPORT_METHOD(isWXAppSupportApi:(RCTResponseSenderBlock)callback)
{
callback(@[[NSNull null], @([WXApi isWXAppSupportApi])]);
}
RCT_EXPORT_METHOD(getWXAppInstallUrl:(RCTResponseSenderBlock)callback)
{
callback(@[[NSNull null], [WXApi getWXAppInstallUrl]]);
}
RCT_EXPORT_METHOD(getApiVersion:(RCTResponseSenderBlock)callback)
{
callback(@[[NSNull null], [WXApi getApiVersion]]);
}
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];
req.openID = openid;
callback(@[[WXApi sendReq:req] ? [NSNull null] : INVOKE_FAILED]);
}
RCT_EXPORT_METHOD(sendAuthRequest:(NSString *)scope
:(NSString *)state
:(RCTResponseSenderBlock)callback)
{
SendAuthReq* req = [[SendAuthReq alloc] init];
req.scope = scope;
req.state = state;
BOOL success = [WXApi sendReq:req];
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
}
RCT_EXPORT_METHOD(sendSuccessResponse:(RCTResponseSenderBlock)callback)
{
BaseResp* resp = [[BaseResp alloc] init];
resp.errCode = WXSuccess;
callback(@[[WXApi sendResp:resp] ? [NSNull null] : INVOKE_FAILED]);
}
RCT_EXPORT_METHOD(sendErrorCommonResponse:(NSString *)message
:(RCTResponseSenderBlock)callback)
{
BaseResp* resp = [[BaseResp alloc] init];
resp.errCode = WXErrCodeCommon;
resp.errStr = message;
callback(@[[WXApi sendResp:resp] ? [NSNull null] : INVOKE_FAILED]);
}
RCT_EXPORT_METHOD(sendErrorUserCancelResponse:(NSString *)message
:(RCTResponseSenderBlock)callback)
{
BaseResp* resp = [[BaseResp alloc] init];
resp.errCode = WXErrCodeUserCancel;
resp.errStr = message;
callback(@[[WXApi sendResp:resp] ? [NSNull null] : INVOKE_FAILED]);
}
RCT_EXPORT_METHOD(shareToTimeline:(NSDictionary *)data
:(RCTResponseSenderBlock)callback)
{
[self shareToWeixinWithData:data scene:WXSceneTimeline callback:callback];
}
RCT_EXPORT_METHOD(shareToSession:(NSDictionary *)data
:(RCTResponseSenderBlock)callback)
{
[self shareToWeixinWithData:data scene:WXSceneSession callback:callback];
}
RCT_EXPORT_METHOD(launchMini:(NSDictionary *)data
:(RCTResponseSenderBlock)callback)
{
WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object];
launchMiniProgramReq.userName = data[@"userName"]; //拉起的小程序的username
launchMiniProgramReq.path = data[@"path"]; //拉起小程序页面的可带参路径,不填默认拉起小程序首页
//拉起小程序的类型
launchMiniProgramReq.miniProgramType = [data[@"miniProgramType"] integerValue];
BOOL success = [WXApi sendReq:launchMiniProgramReq];
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"];
BOOL success = [WXApi sendReq:req];
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
}
- (void)shareToWeixinWithData:(NSDictionary *)aData
thumbImage:(UIImage *)aThumbImage
scene:(int)aScene
callBack:(RCTResponseSenderBlock)callback
{
NSString *type = aData[RCTWXShareType];
if ([type isEqualToString:RCTWXShareTypeText]) {
NSString *text = aData[RCTWXShareDescription];
[self shareToWeixinWithTextMessage:aScene Text:text callBack:callback];
} else {
NSString * title = aData[RCTWXShareTitle];
NSString * description = aData[RCTWXShareDescription];
NSString * mediaTagName = aData[@"mediaTagName"];
NSString * messageAction = aData[@"messageAction"];
NSString * messageExt = aData[@"messageExt"];
if (type.length <= 0 || [type isEqualToString:RCTWXShareTypeNews]) {
NSString * webpageUrl = aData[RCTWXShareWebpageUrl];
if (webpageUrl.length <= 0) {
callback(@[@"webpageUrl required"]);
return;
}
WXWebpageObject* webpageObject = [WXWebpageObject object];
webpageObject.webpageUrl = webpageUrl;
[self shareToWeixinWithMediaMessage:aScene
Title:title
Description:description
Object:webpageObject
MessageExt:messageExt
MessageAction:messageAction
ThumbImage:aThumbImage
MediaTag:mediaTagName
callBack:callback];
} else if ([type isEqualToString:RCTWXShareTypeAudio]) {
WXMusicObject *musicObject = [WXMusicObject new];
musicObject.musicUrl = aData[@"musicUrl"];
musicObject.musicLowBandUrl = aData[@"musicLowBandUrl"];
musicObject.musicDataUrl = aData[@"musicDataUrl"];
musicObject.musicLowBandDataUrl = aData[@"musicLowBandDataUrl"];
[self shareToWeixinWithMediaMessage:aScene
Title:title
Description:description
Object:musicObject
MessageExt:messageExt
MessageAction:messageAction
ThumbImage:aThumbImage
MediaTag:mediaTagName
callBack:callback];
} else if ([type isEqualToString:RCTWXShareTypeVideo]) {
WXVideoObject *videoObject = [WXVideoObject new];
videoObject.videoUrl = aData[@"videoUrl"];
videoObject.videoLowBandUrl = aData[@"videoLowBandUrl"];
[self shareToWeixinWithMediaMessage:aScene
Title:title
Description:description
Object:videoObject
MessageExt:messageExt
MessageAction:messageAction
ThumbImage:aThumbImage
MediaTag:mediaTagName
callBack:callback];
} else if ([type isEqualToString:RCTWXShareTypeImageUrl] ||
[type isEqualToString:RCTWXShareTypeImageFile] ||
[type isEqualToString:RCTWXShareTypeImageResource]) {
NSURL *url = [NSURL URLWithString:aData[RCTWXShareImageUrl]];
NSURLRequest *imageRequest = [NSURLRequest requestWithURL:url];
[self.bridge.imageLoader loadImageWithURLRequest:imageRequest callback:^(NSError *error, UIImage *image) {
if (image == nil){
callback(@[@"fail to load image resource"]);
} else {
WXImageObject *imageObject = [WXImageObject object];
imageObject.imageData = UIImagePNGRepresentation(image);
[self shareToWeixinWithMediaMessage:aScene
Title:title
Description:description
Object:imageObject
MessageExt:messageExt
MessageAction:messageAction
ThumbImage:aThumbImage
MediaTag:mediaTagName
callBack:callback];
}
}];
} else if ([type isEqualToString:RCTWXShareTypeFile]) {
NSString * filePath = aData[@"filePath"];
NSString * fileExtension = aData[@"fileExtension"];
WXFileObject *fileObject = [WXFileObject object];
fileObject.fileData = [NSData dataWithContentsOfFile:filePath];
fileObject.fileExtension = fileExtension;
[self shareToWeixinWithMediaMessage:aScene
Title:title
Description:description
Object:fileObject
MessageExt:messageExt
MessageAction:messageAction
ThumbImage:aThumbImage
MediaTag:mediaTagName
callBack:callback];
} else if ([type isEqualToString:RCTWXShareTypeMini]) {
WXMiniProgramObject *miniObject = [WXMiniProgramObject object];
miniObject.webpageUrl = aData[@"webpageUrl"];
miniObject.userName = aData[@"userName"];
miniObject.path = aData[@"path"];
miniObject.withShareTicket = [aData[@"withShareTicket"] boolValue];
miniObject.miniProgramType = [aData[@"miniProgramType"] integerValue];
miniObject.hdImageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:aData[@"hdImageData"]]] ;
[self shareToWeixinWithMediaMessage:aScene
Title:title
Description:description
Object:miniObject
MessageExt:messageExt
MessageAction:messageAction
ThumbImage:aThumbImage
MediaTag:mediaTagName
callBack:callback];
} else {
callback(@[@"message type unsupported"]);
}
}
}
- (void)shareToWeixinWithData:(NSDictionary *)aData scene:(int)aScene callback:(RCTResponseSenderBlock)aCallBack
{
NSString *imageUrl = aData[RCTWXShareTypeThumbImageUrl];
if (imageUrl.length && _bridge.imageLoader) {
NSURL *url = [NSURL URLWithString:imageUrl];
NSURLRequest *imageRequest = [NSURLRequest requestWithURL:url];
[_bridge.imageLoader loadImageWithURLRequest:imageRequest size:CGSizeMake(100, 100) scale:1 clipped:FALSE resizeMode:RCTResizeModeStretch progressBlock:nil partialLoadBlock:nil
completionBlock:^(NSError *error, UIImage *image) {
[self shareToWeixinWithData:aData thumbImage:image scene:aScene callBack:aCallBack];
}];
} else {
[self shareToWeixinWithData:aData thumbImage:nil scene:aScene callBack:aCallBack];
}
}
- (void)shareToWeixinWithTextMessage:(int)aScene
Text:(NSString *)text
callBack:(RCTResponseSenderBlock)callback
{
SendMessageToWXReq* req = [SendMessageToWXReq new];
req.bText = YES;
req.scene = aScene;
req.text = text;
BOOL success = [WXApi sendReq:req];
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
}
- (void)shareToWeixinWithMediaMessage:(int)aScene
Title:(NSString *)title
Description:(NSString *)description
Object:(id)mediaObject
MessageExt:(NSString *)messageExt
MessageAction:(NSString *)action
ThumbImage:(UIImage *)thumbImage
MediaTag:(NSString *)tagName
callBack:(RCTResponseSenderBlock)callback
{
WXMediaMessage *message = [WXMediaMessage message];
message.title = title;
message.description = description;
message.mediaObject = mediaObject;
message.messageExt = messageExt;
message.messageAction = action;
message.mediaTagName = tagName;
[message setThumbImage:thumbImage];
SendMessageToWXReq* req = [SendMessageToWXReq new];
req.bText = NO;
req.scene = aScene;
req.message = message;
BOOL success = [WXApi sendReq:req];
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
}
#pragma mark - wx callback
-(void) onReq:(BaseReq*)req
{
// TODO(Yorkie)
}
-(void) onResp:(BaseResp*)resp
{
if([resp isKindOfClass:[SendMessageToWXResp class]])
{
SendMessageToWXResp *r = (SendMessageToWXResp *)resp;
NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy;
body[@"errStr"] = r.errStr;
body[@"lang"] = r.lang;
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;
body[@"errStr"] = r.errStr;
body[@"state"] = r.state;
body[@"lang"] = r.lang;
body[@"country"] =r.country;
body[@"type"] = @"SendAuth.Resp";
if (resp.errCode == WXSuccess)
{
[body addEntriesFromDictionary:@{@"appid":self.appId, @"code" :r.code}];
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
}
else {
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
}
} else if ([resp isKindOfClass:[PayResp class]]) {
PayResp *r = (PayResp *)resp;
NSMutableDictionary *body = @{@"errCode":@(r.errCode)}.mutableCopy;
body[@"errStr"] = r.errStr;
body[@"type"] = @(r.type);
body[@"returnKey"] =r.returnKey;
body[@"type"] = @"PayReq.Resp";
[self.bridge.eventDispatcher sendDeviceEventWithName:RCTWXEventName body:body];
}else if ([resp isKindOfClass:[WXLaunchMiniProgramResp class]])
{
WXLaunchMiniProgramResp *r = (WXLaunchMiniProgramResp *)resp;
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];
}
}
@end
... ...
#
# Be sure to run `pod spec lint RCTPili.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#
Pod::Spec.new do |s|
s.name = "RCTWeChat"
s.version = "0.1.0"
s.summary = "React-Native(iOS/Android) functionalities include WeChat Login, Share, Favorite and Payment {QQ: 336021910}"
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
React-Native(iOS/Android) functionalities include WeChat Login, Share, Favorite and Payment {QQ: 336021910}
DESC
s.homepage = "https://github.com/weflex/react-native-wechat"
s.license = "MIT"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
s.author = { "weflex" => "336021910@qq.com" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/weflex/react-native-wechat.git", :tag => "master" }
s.source_files = "**/*.{h,m}"
s.requires_arc = true
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
s.dependency "React"
s.vendored_libraries = "libWeChatSDK.a"
s.ios.frameworks = 'SystemConfiguration','CoreTelephony','XCTest'
s.ios.library = 'sqlite3','c++','z'
end
... ...
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
10D6D7A71F160C250066F0F3 /* RCTWeChatTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D6D7A61F160C250066F0F3 /* RCTWeChatTests.m */; };
10D6D7A91F160C250066F0F3 /* libRCTWeChat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 86D238421BD0BB9E00C75D01 /* libRCTWeChat.a */; };
10D6D7AF1F160C3A0066F0F3 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 10D6D76D1F160B090066F0F3 /* libReact.a */; };
86D238561BD0BC1000C75D01 /* RCTWeChat.m in Sources */ = {isa = PBXBuildFile; fileRef = 86D238551BD0BC1000C75D01 /* RCTWeChat.m */; };
86D2385D1BD0CA3D00C75D01 /* libWeChatSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 86D238571BD0BC2200C75D01 /* libWeChatSDK.a */; settings = {ATTRIBUTES = (Required, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
10D6D76C1F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = React;
};
10D6D76E1F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2D2A28131D9B038B00D4039D;
remoteInfo = "React-tvOS";
};
10D6D7701F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3C059A1DE3340900C268FA;
remoteInfo = yoga;
};
10D6D7721F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3C06751DE3340C00C268FA;
remoteInfo = "yoga-tvOS";
};
10D6D7741F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4;
remoteInfo = cxxreact;
};
10D6D7761F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4;
remoteInfo = "cxxreact-tvOS";
};
10D6D7781F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4;
remoteInfo = jschelpers;
};
10D6D77A1F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4;
remoteInfo = "jschelpers-tvOS";
};
10D6D77C1F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
remoteInfo = "third-party";
};
10D6D77E1F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
remoteInfo = "third-party-tvOS";
};
10D6D7801F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 139D7E881E25C6D100323FB7;
remoteInfo = "double-conversion";
};
10D6D7821F160B090066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
remoteInfo = "double-conversion-tvOS";
};
10D6D7AA1F160C250066F0F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 86D2383A1BD0BB9E00C75D01 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 86D238411BD0BB9E00C75D01;
remoteInfo = RCTWeChat;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
86D238401BD0BB9E00C75D01 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
10D6D75D1F160B090066F0F3 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
10D6D7A41F160C250066F0F3 /* RCTWeChatTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RCTWeChatTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
10D6D7A61F160C250066F0F3 /* RCTWeChatTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTWeChatTests.m; sourceTree = "<group>"; };
10D6D7A81F160C250066F0F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
86D238421BD0BB9E00C75D01 /* libRCTWeChat.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWeChat.a; sourceTree = BUILT_PRODUCTS_DIR; };
86D238541BD0BC1000C75D01 /* RCTWeChat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWeChat.h; sourceTree = SOURCE_ROOT; };
86D238551BD0BC1000C75D01 /* RCTWeChat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWeChat.m; sourceTree = SOURCE_ROOT; };
86D238571BD0BC2200C75D01 /* libWeChatSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWeChatSDK.a; sourceTree = "<group>"; };
86D238581BD0BC2200C75D01 /* WXApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXApi.h; sourceTree = "<group>"; };
86D238591BD0BC2200C75D01 /* WXApiObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXApiObject.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
10D6D7A11F160C250066F0F3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
10D6D7AF1F160C3A0066F0F3 /* libReact.a in Frameworks */,
10D6D7A91F160C250066F0F3 /* libRCTWeChat.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
86D2383F1BD0BB9E00C75D01 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
86D2385D1BD0CA3D00C75D01 /* libWeChatSDK.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
10D6D75E1F160B090066F0F3 /* Products */ = {
isa = PBXGroup;
children = (
10D6D76D1F160B090066F0F3 /* libReact.a */,
10D6D76F1F160B090066F0F3 /* libReact.a */,
10D6D7711F160B090066F0F3 /* libyoga.a */,
10D6D7731F160B090066F0F3 /* libyoga.a */,
10D6D7751F160B090066F0F3 /* libcxxreact.a */,
10D6D7771F160B090066F0F3 /* libcxxreact.a */,
10D6D7791F160B090066F0F3 /* libjschelpers.a */,
10D6D77B1F160B090066F0F3 /* libjschelpers.a */,
10D6D77D1F160B090066F0F3 /* libthird-party.a */,
10D6D77F1F160B090066F0F3 /* libthird-party.a */,
10D6D7811F160B090066F0F3 /* libdouble-conversion.a */,
10D6D7831F160B090066F0F3 /* libdouble-conversion.a */,
);
name = Products;
sourceTree = "<group>";
};
10D6D7A51F160C250066F0F3 /* RCTWeChatTests */ = {
isa = PBXGroup;
children = (
10D6D7A61F160C250066F0F3 /* RCTWeChatTests.m */,
10D6D7A81F160C250066F0F3 /* Info.plist */,
);
path = RCTWeChatTests;
sourceTree = "<group>";
};
86D238391BD0BB9E00C75D01 = {
isa = PBXGroup;
children = (
86D238571BD0BC2200C75D01 /* libWeChatSDK.a */,
86D238581BD0BC2200C75D01 /* WXApi.h */,
86D238591BD0BC2200C75D01 /* WXApiObject.h */,
86D238441BD0BB9E00C75D01 /* RCTWeChat */,
10D6D7A51F160C250066F0F3 /* RCTWeChatTests */,
86D238431BD0BB9E00C75D01 /* Products */,
10D6D75D1F160B090066F0F3 /* React.xcodeproj */,
);
sourceTree = "<group>";
};
86D238431BD0BB9E00C75D01 /* Products */ = {
isa = PBXGroup;
children = (
86D238421BD0BB9E00C75D01 /* libRCTWeChat.a */,
10D6D7A41F160C250066F0F3 /* RCTWeChatTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
86D238441BD0BB9E00C75D01 /* RCTWeChat */ = {
isa = PBXGroup;
children = (
86D238541BD0BC1000C75D01 /* RCTWeChat.h */,
86D238551BD0BC1000C75D01 /* RCTWeChat.m */,
);
path = RCTWeChat;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
10D6D7A31F160C250066F0F3 /* RCTWeChatTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 10D6D7AC1F160C250066F0F3 /* Build configuration list for PBXNativeTarget "RCTWeChatTests" */;
buildPhases = (
10D6D7A01F160C250066F0F3 /* Sources */,
10D6D7A11F160C250066F0F3 /* Frameworks */,
10D6D7A21F160C250066F0F3 /* Resources */,
);
buildRules = (
);
dependencies = (
10D6D7AB1F160C250066F0F3 /* PBXTargetDependency */,
);
name = RCTWeChatTests;
productName = RCTWeChatTests;
productReference = 10D6D7A41F160C250066F0F3 /* RCTWeChatTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
86D238411BD0BB9E00C75D01 /* RCTWeChat */ = {
isa = PBXNativeTarget;
buildConfigurationList = 86D2384B1BD0BB9E00C75D01 /* Build configuration list for PBXNativeTarget "RCTWeChat" */;
buildPhases = (
86D2383E1BD0BB9E00C75D01 /* Sources */,
86D2383F1BD0BB9E00C75D01 /* Frameworks */,
86D238401BD0BB9E00C75D01 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = RCTWeChat;
productName = RCTWeChat;
productReference = 86D238421BD0BB9E00C75D01 /* libRCTWeChat.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
86D2383A1BD0BB9E00C75D01 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
ORGANIZATIONNAME = WeFlex;
TargetAttributes = {
10D6D7A31F160C250066F0F3 = {
CreatedOnToolsVersion = 8.3.2;
DevelopmentTeam = QMP96B5DPW;
ProvisioningStyle = Automatic;
};
86D238411BD0BB9E00C75D01 = {
CreatedOnToolsVersion = 7.0;
DevelopmentTeam = JP4369ZCVM;
};
};
};
buildConfigurationList = 86D2383D1BD0BB9E00C75D01 /* Build configuration list for PBXProject "RCTWeChat" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 86D238391BD0BB9E00C75D01;
productRefGroup = 86D238431BD0BB9E00C75D01 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 10D6D75E1F160B090066F0F3 /* Products */;
ProjectRef = 10D6D75D1F160B090066F0F3 /* React.xcodeproj */;
},
);
projectRoot = "";
targets = (
86D238411BD0BB9E00C75D01 /* RCTWeChat */,
10D6D7A31F160C250066F0F3 /* RCTWeChatTests */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
10D6D76D1F160B090066F0F3 /* libReact.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libReact.a;
remoteRef = 10D6D76C1F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D76F1F160B090066F0F3 /* libReact.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libReact.a;
remoteRef = 10D6D76E1F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D7711F160B090066F0F3 /* libyoga.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libyoga.a;
remoteRef = 10D6D7701F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D7731F160B090066F0F3 /* libyoga.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libyoga.a;
remoteRef = 10D6D7721F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D7751F160B090066F0F3 /* libcxxreact.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libcxxreact.a;
remoteRef = 10D6D7741F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D7771F160B090066F0F3 /* libcxxreact.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libcxxreact.a;
remoteRef = 10D6D7761F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D7791F160B090066F0F3 /* libjschelpers.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libjschelpers.a;
remoteRef = 10D6D7781F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D77B1F160B090066F0F3 /* libjschelpers.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libjschelpers.a;
remoteRef = 10D6D77A1F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D77D1F160B090066F0F3 /* libthird-party.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libthird-party.a";
remoteRef = 10D6D77C1F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D77F1F160B090066F0F3 /* libthird-party.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libthird-party.a";
remoteRef = 10D6D77E1F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D7811F160B090066F0F3 /* libdouble-conversion.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libdouble-conversion.a";
remoteRef = 10D6D7801F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
10D6D7831F160B090066F0F3 /* libdouble-conversion.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libdouble-conversion.a";
remoteRef = 10D6D7821F160B090066F0F3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
10D6D7A21F160C250066F0F3 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
10D6D7A01F160C250066F0F3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
10D6D7A71F160C250066F0F3 /* RCTWeChatTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
86D2383E1BD0BB9E00C75D01 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
86D238561BD0BC1000C75D01 /* RCTWeChat.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
10D6D7AB1F160C250066F0F3 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 86D238411BD0BB9E00C75D01 /* RCTWeChat */;
targetProxy = 10D6D7AA1F160C250066F0F3 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
10D6D7AD1F160C250066F0F3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = QMP96B5DPW;
INFOPLIST_FILE = RCTWeChatTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = yorkie.RCTWeChatTests;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
10D6D7AE1F160C250066F0F3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = QMP96B5DPW;
INFOPLIST_FILE = RCTWeChatTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = yorkie.RCTWeChatTests;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
86D238491BD0BB9E00C75D01 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
86D2384A1BD0BB9E00C75D01 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
86D2384C1BD0BB9E00C75D01 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../../React/**",
"$(SRCROOT)/../react-native/React/**",
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native/Libraries/Image/**",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
86D2384D1BD0BB9E00C75D01 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../../React/**",
"$(SRCROOT)/../react-native/React/**",
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native/Libraries/Image/**",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
10D6D7AC1F160C250066F0F3 /* Build configuration list for PBXNativeTarget "RCTWeChatTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
10D6D7AD1F160C250066F0F3 /* Debug */,
10D6D7AE1F160C250066F0F3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
86D2383D1BD0BB9E00C75D01 /* Build configuration list for PBXProject "RCTWeChat" */ = {
isa = XCConfigurationList;
buildConfigurations = (
86D238491BD0BB9E00C75D01 /* Debug */,
86D2384A1BD0BB9E00C75D01 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
86D2384B1BD0BB9E00C75D01 /* Build configuration list for PBXNativeTarget "RCTWeChat" */ = {
isa = XCConfigurationList;
buildConfigurations = (
86D2384C1BD0BB9E00C75D01 /* Debug */,
86D2384D1BD0BB9E00C75D01 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 86D2383A1BD0BB9E00C75D01 /* Project object */;
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:RCTWeChat.xcodeproj">
</FileRef>
</Workspace>
... ...
<?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>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "86D238411BD0BB9E00C75D01"
BuildableName = "libRCTWeChat.a"
BlueprintName = "RCTWeChat"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "86D238411BD0BB9E00C75D01"
BuildableName = "libRCTWeChat.a"
BlueprintName = "RCTWeChat"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "86D238411BD0BB9E00C75D01"
BuildableName = "libRCTWeChat.a"
BlueprintName = "RCTWeChat"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "86D238411BD0BB9E00C75D01"
BuildableName = "libRCTWeChat.a"
BlueprintName = "RCTWeChat"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "10D6D7A31F160C250066F0F3"
BuildableName = "RCTWeChatTests.xctest"
BlueprintName = "RCTWeChatTests"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "10D6D7A31F160C250066F0F3"
BuildableName = "RCTWeChatTests.xctest"
BlueprintName = "RCTWeChatTests"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "10D6D7A31F160C250066F0F3"
BuildableName = "RCTWeChatTests.xctest"
BlueprintName = "RCTWeChatTests"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "10D6D7A31F160C250066F0F3"
BuildableName = "RCTWeChatTests.xctest"
BlueprintName = "RCTWeChatTests"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "NODE_ENV"
value = "test"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "10D6D7A31F160C250066F0F3"
BuildableName = "RCTWeChatTests.xctest"
BlueprintName = "RCTWeChatTests"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
... ...
<?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>SchemeUserState</key>
<dict>
<key>RCTWeChat.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
<key>RCTWeChatTests.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
</dict>
</dict>
</dict>
</plist>
... ...
<?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>SchemeUserState</key>
<dict>
<key>RCTWeChat.xcscheme_^#shared#^_</key>
<dict>
<key>isShown</key>
<true/>
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>RCTWeChatTests.xcscheme_^#shared#^_</key>
<dict>
<key>isShown</key>
<true/>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>10D6D7881F160B720066F0F3</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>10D6D7951F160C0B0066F0F3</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>10D6D7A31F160C250066F0F3</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>86D238411BD0BB9E00C75D01</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "86D238411BD0BB9E00C75D01"
BuildableName = "libRCTWeChat.a"
BlueprintName = "RCTWeChat"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "86D238411BD0BB9E00C75D01"
BuildableName = "libRCTWeChat.a"
BlueprintName = "RCTWeChat"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "86D238411BD0BB9E00C75D01"
BuildableName = "libRCTWeChat.a"
BlueprintName = "RCTWeChat"
ReferencedContainer = "container:RCTWeChat.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
... ...
<?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>SchemeUserState</key>
<dict>
<key>RCTWeChat.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>86D238411BD0BB9E00C75D01</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
... ...
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
... ...
//
// RCTWeChatTests.m
// RCTWeChatTests
//
// Created by Yorkie on 12/07/2017.
// Copyright © 2017 WeFlex. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface RCTWeChatTests : XCTestCase
@end
@implementation RCTWeChatTests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end
... ...
//
// WXApi.h
// 所有Api接口
//
// Created by Wechat on 12-2-28.
// Copyright (c) 2012年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "WXApiObject.h"
#pragma mark - WXApiDelegate
/*! @brief 接收并处理来自微信终端程序的事件消息
*
* 接收并处理来自微信终端程序的事件消息,期间微信界面会切换到第三方应用程序。
* WXApiDelegate 会在handleOpenURL:delegate:中使用并触发。
*/
@protocol WXApiDelegate <NSObject>
@optional
/*! @brief 收到一个来自微信的请求,第三方应用程序处理完后调用sendResp向微信发送结果
*
* 收到一个来自微信的请求,异步处理完成后必须调用sendResp发送处理结果给微信。
* 可能收到的请求有GetMessageFromWXReq、ShowMessageFromWXReq等。
* @param req 具体请求内容,是自动释放的
*/
-(void) onReq:(BaseReq*)req;
/*! @brief 发送一个sendReq后,收到微信的回应
*
* 收到一个来自微信的处理结果。调用一次sendReq后会收到onResp。
* 可能收到的处理结果有SendMessageToWXResp、SendAuthResp等。
* @param resp具体的回应内容,是自动释放的
*/
-(void) onResp:(BaseResp*)resp;
@end
#pragma mark - WXApiLogDelegate
@protocol WXApiLogDelegate <NSObject>
-(void) onLog:(NSString*)log logLevel:(WXLogLevel)level;
@end
#pragma mark - WXApi
/*! @brief 微信Api接口函数类
*
* 该类封装了微信终端SDK的所有接口
*/
@interface WXApi : NSObject
/*! @brief WXApi的成员函数,向微信终端程序注册第三方应用。
*
* 需要在每次启动第三方应用程序时调用。第一次调用后,会在微信的可用应用列表中出现,默认开启MTA数据上报。
* iOS7及以上系统需要调起一次微信才会出现在微信的可用应用列表中。
* @attention 请保证在主线程中调用此函数
* @param appid 微信开发者ID
* @param typeFlag 应用支持打开的文件类型
* @return 成功返回YES,失败返回NO。
*/
+(BOOL) registerApp:(NSString *)appid;
/*! @brief WXApi的成员函数,向微信终端程序注册第三方应用。
*
* 需要在每次启动第三方应用程序时调用。第一次调用后,会在微信的可用应用列表中出现。
* iOS7及以上系统需要调起一次微信才会出现在微信的可用应用列表中。
* @attention 请保证在主线程中调用此函数
* @param appid 微信开发者ID
* @param isEnableMTA 是否支持MTA数据上报
* @return 成功返回YES,失败返回NO。
*/
+(BOOL) registerApp:(NSString *)appid enableMTA:(BOOL)isEnableMTA;
/*! @brief WXApi的成员函数,向微信终端程序注册应用支持打开的文件类型。
*
* 需要在每次启动第三方应用程序时调用。调用后并第一次成功分享数据到微信后,会在微信的可用应用列表中出现。
* @see registerApp
* @param typeFlag 应用支持打开的数据类型, enAppSupportContentFlag枚举类型 “|” 操作后结果
*/
+(void) registerAppSupportContentFlag:(UInt64)typeFlag;
/*! @brief 处理微信通过URL启动App时传递的数据
*
* 需要在 application:openURL:sourceApplication:annotation:或者application:handleOpenURL中调用。
* @param url 微信启动第三方应用时传递过来的URL
* @param delegate WXApiDelegate对象,用来接收微信触发的消息。
* @return 成功返回YES,失败返回NO。
*/
+(BOOL) handleOpenURL:(NSURL *) url delegate:(id<WXApiDelegate>) delegate;
/*! @brief 检查微信是否已被用户安装
*
* @return 微信已安装返回YES,未安装返回NO。
*/
+(BOOL) isWXAppInstalled;
/*! @brief 判断当前微信的版本是否支持OpenApi
*
* @return 支持返回YES,不支持返回NO。
*/
+(BOOL) isWXAppSupportApi;
/*! @brief 获取微信的itunes安装地址
*
* @return 微信的安装地址字符串。
*/
+(NSString *) getWXAppInstallUrl;
/*! @brief 获取当前微信SDK的版本号
*
* @return 返回当前微信SDK的版本号
*/
+(NSString *) getApiVersion;
/*! @brief 打开微信
*
* @return 成功返回YES,失败返回NO。
*/
+(BOOL) openWXApp;
/*! @brief 发送请求到微信,等待微信返回onResp
*
* 函数调用后,会切换到微信的界面。第三方应用程序等待微信返回onResp。微信在异步处理完成后一定会调用onResp。支持以下类型
* SendAuthReq、SendMessageToWXReq、PayReq等。
* @param req 具体的发送请求,在调用函数后,请自己释放。
* @return 成功返回YES,失败返回NO。
*/
+(BOOL) sendReq:(BaseReq*)req;
/*! @brief 发送Auth请求到微信,支持用户没安装微信,等待微信返回onResp
*
* 函数调用后,会切换到微信的界面。第三方应用程序等待微信返回onResp。微信在异步处理完成后一定会调用onResp。支持SendAuthReq类型。
* @param req 具体的发送请求,在调用函数后,请自己释放。
* @param viewController 当前界面对象。
* @param delegate WXApiDelegate对象,用来接收微信触发的消息。
* @return 成功返回YES,失败返回NO。
*/
+(BOOL) sendAuthReq:(SendAuthReq*)req viewController:(UIViewController*)viewController delegate:(id<WXApiDelegate>)delegate;
/*! @brief 收到微信onReq的请求,发送对应的应答给微信,并切换到微信界面
*
* 函数调用后,会切换到微信的界面。第三方应用程序收到微信onReq的请求,异步处理该请求,完成后必须调用该函数。可能发送的相应有
* GetMessageFromWXResp、ShowMessageFromWXResp等。
* @param resp 具体的应答内容,调用函数后,请自己释放
* @return 成功返回YES,失败返回NO。
*/
+(BOOL) sendResp:(BaseResp*)resp;
/*! @brief WXApi的成员函数,接受微信的log信息。byBlock
注意1:SDK会强引用这个block,注意不要导致内存泄漏,注意不要导致内存泄漏
注意2:调用过一次startLog by block之后,如果再调用一次任意方式的startLoad,会释放上一次logBlock,不再回调上一个logBlock
*
* @param level 打印log的级别
* @param logBlock 打印log的回调block
*/
+(void) startLogByLevel:(WXLogLevel)level logBlock:(WXLogBolock)logBlock;
/*! @brief WXApi的成员函数,接受微信的log信息。byDelegate
注意1:sdk会弱引用这个delegate,这里可加任意对象为代理,不需要与WXApiDelegate同一个对象
注意2:调用过一次startLog by delegate之后,再调用一次任意方式的startLoad,不会再回调上一个logDelegate对象
* @param level 打印log的级别
* @param logDelegate 打印log的回调代理,
*/
+ (void)startLogByLevel:(WXLogLevel)level logDelegate:(id<WXApiLogDelegate>)logDelegate;
/*! @brief 停止打印log,会清理block或者delegate为空,释放block
* @param
*/
+ (void)stopLog;
@end
... ...
//
// MMApiObject.h
// Api对象,包含所有接口和对象数据定义
//
// Created by Wechat on 12-2-28.
// Copyright (c) 2012年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/*! @brief 错误码
*
*/
enum WXErrCode {
WXSuccess = 0, /**< 成功 */
WXErrCodeCommon = -1, /**< 普通错误类型 */
WXErrCodeUserCancel = -2, /**< 用户点击取消并返回 */
WXErrCodeSentFail = -3, /**< 发送失败 */
WXErrCodeAuthDeny = -4, /**< 授权失败 */
WXErrCodeUnsupport = -5, /**< 微信不支持 */
};
/*! @brief 请求发送场景
*
*/
enum WXScene {
WXSceneSession = 0, /**< 聊天界面 */
WXSceneTimeline = 1, /**< 朋友圈 */
WXSceneFavorite = 2, /**< 收藏 */
};
enum WXAPISupport {
WXAPISupportSession = 0,
};
/*! @brief 跳转profile类型
*
*/
enum WXBizProfileType{
WXBizProfileType_Normal = 0, //**< 普通公众号 */
WXBizProfileType_Device = 1, //**< 硬件公众号 */
};
/*! @brief 分享小程序类型
*
*/
typedef NS_ENUM(NSUInteger, WXMiniProgramType){
WXMiniProgramTypeRelease = 0, //**< 正式版 */
WXMiniProgramTypeTest = 1, //**< 开发版 */
WXMiniProgramTypePreview = 2, //**< 体验版 */
};
/*! @brief 跳转mp网页类型
*
*/
enum WXMPWebviewType {
WXMPWebviewType_Ad = 0, /**< 广告网页 **/
};
/*! @brief 应用支持接收微信的文件类型
*
*/
typedef NS_ENUM(UInt64, enAppSupportContentFlag)
{
MMAPP_SUPPORT_NOCONTENT = 0x0,
MMAPP_SUPPORT_TEXT = 0x1,
MMAPP_SUPPORT_PICTURE = 0x2,
MMAPP_SUPPORT_LOCATION = 0x4,
MMAPP_SUPPORT_VIDEO = 0x8,
MMAPP_SUPPORT_AUDIO = 0x10,
MMAPP_SUPPORT_WEBPAGE = 0x20,
// Suport File Type
MMAPP_SUPPORT_DOC = 0x40, // doc
MMAPP_SUPPORT_DOCX = 0x80, // docx
MMAPP_SUPPORT_PPT = 0x100, // ppt
MMAPP_SUPPORT_PPTX = 0x200, // pptx
MMAPP_SUPPORT_XLS = 0x400, // xls
MMAPP_SUPPORT_XLSX = 0x800, // xlsx
MMAPP_SUPPORT_PDF = 0x1000, // pdf
};
/*! @brief log的级别
*
*/
typedef NS_ENUM(NSInteger,WXLogLevel){
WXLogLevelNormal = 0, // 打印日常的日志
WXLogLevelDetail = 1, // 打印详细的日志
};
/*! @brief 打印回调的block
*
*/
typedef void(^WXLogBolock)(NSString * log);
#pragma mark - BaseReq
/*! @brief 该类为微信终端SDK所有请求类的基类
*
*/
@interface BaseReq : NSObject
/** 请求类型 */
@property (nonatomic, assign) int type;
/** 由用户微信号和AppID组成的唯一标识,发送请求时第三方程序必须填写,用于校验微信用户是否换号登录*/
@property (nonatomic, retain) NSString* openID;
@end
#pragma mark - BaseResp
/*! @brief 该类为微信终端SDK所有响应类的基类
*
*/
@interface BaseResp : NSObject
/** 错误码 */
@property (nonatomic, assign) int errCode;
/** 错误提示字符串 */
@property (nonatomic, retain) NSString *errStr;
/** 响应类型 */
@property (nonatomic, assign) int type;
@end
#pragma mark - WXMediaMessage
@class WXMediaMessage;
#ifndef BUILD_WITHOUT_PAY
/*! @brief 第三方向微信终端发起支付的消息结构体
*
* 第三方向微信终端发起支付的消息结构体,微信终端处理后会向第三方返回处理结果
* @see PayResp
*/
@interface PayReq : BaseReq
/** 商家向财付通申请的商家id */
@property (nonatomic, retain) NSString *partnerId;
/** 预支付订单 */
@property (nonatomic, retain) NSString *prepayId;
/** 随机串,防重发 */
@property (nonatomic, retain) NSString *nonceStr;
/** 时间戳,防重发 */
@property (nonatomic, assign) UInt32 timeStamp;
/** 商家根据财付通文档填写的数据和签名 */
@property (nonatomic, retain) NSString *package;
/** 商家根据微信开放平台文档对数据做的签名 */
@property (nonatomic, retain) NSString *sign;
@end
#endif
#ifndef BUILD_WITHOUT_PAY
#pragma mark - PayResp
/*! @brief 微信终端返回给第三方的关于支付结果的结构体
*
* 微信终端返回给第三方的关于支付结果的结构体
*/
@interface PayResp : BaseResp
/** 财付通返回给商家的信息 */
@property (nonatomic, retain) NSString *returnKey;
@end
#endif
#pragma mark - SendAuthReq
/*! @brief 第三方程序向微信终端请求认证的消息结构
*
* 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,
* 向微信终端发送一个SendAuthReq消息结构。微信终端处理完后会向第三方程序发送一个处理结果。
* @see SendAuthResp
*/
@interface SendAuthReq : BaseReq
/** 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,向微信终端发送一个SendAuthReq消息结构。微信终端处理完后会向第三方程序发送一个处理结果。
* @see SendAuthResp
* @note scope字符串长度不能超过1K
*/
@property (nonatomic, retain) NSString* scope;
/** 第三方程序本身用来标识其请求的唯一性,最后跳转回第三方程序时,由微信终端回传。
* @note state字符串长度不能超过1K
*/
@property (nonatomic, retain) NSString* state;
@end
#pragma mark - SendAuthResp
/*! @brief 微信处理完第三方程序的认证和权限申请后向第三方程序回送的处理结果。
*
* 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,向微信终端发送一个SendAuthReq消息结构。
* 微信终端处理完后会向第三方程序发送一个SendAuthResp。
* @see onResp
*/
@interface SendAuthResp : BaseResp
@property (nonatomic, retain) NSString* code;
/** 第三方程序发送时用来标识其请求的唯一性的标志,由第三方程序调用sendReq时传入,由微信终端回传
* @note state字符串长度不能超过1K
*/
@property (nonatomic, retain) NSString* state;
@property (nonatomic, retain) NSString* lang;
@property (nonatomic, retain) NSString* country;
@end
#pragma mark - SendMessageToWXReq
/*! @brief 第三方程序发送消息至微信终端程序的消息结构体
*
* 第三方程序向微信发送信息需要传入SendMessageToWXReq结构体,信息类型包括文本消息和多媒体消息,
* 分别对应于text和message成员。调用该方法后,微信处理完信息会向第三方程序发送一个处理结果。
* @see SendMessageToWXResp
*/
@interface SendMessageToWXReq : BaseReq
/** 发送消息的文本内容
* @note 文本长度必须大于0且小于10K
*/
@property (nonatomic, retain) NSString* text;
/** 发送消息的多媒体内容
* @see WXMediaMessage
*/
@property (nonatomic, retain) WXMediaMessage* message;
/** 发送消息的类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */
@property (nonatomic, assign) BOOL bText;
/** 发送的目标场景,可以选择发送到会话(WXSceneSession)或者朋友圈(WXSceneTimeline)。 默认发送到会话。
* @see WXScene
*/
@property (nonatomic, assign) int scene;
@end
#pragma mark - SendMessageToWXResp
/*! @brief 微信终端向第三方程序返回的SendMessageToWXReq处理结果。
*
* 第三方程序向微信终端发送SendMessageToWXReq后,微信发送回来的处理结果,该结果用SendMessageToWXResp表示。
*/
@interface SendMessageToWXResp : BaseResp
@property(nonatomic, retain) NSString* lang;
@property(nonatomic, retain) NSString* country;
@end
#pragma mark - GetMessageFromWXReq
/*! @brief 微信终端向第三方程序请求提供内容的消息结构体。
*
* 微信终端向第三方程序请求提供内容,微信终端会向第三方程序发送GetMessageFromWXReq消息结构体,
* 需要第三方程序调用sendResp返回一个GetMessageFromWXResp消息结构体。
*/
@interface GetMessageFromWXReq : BaseReq
@property (nonatomic, retain) NSString* lang;
@property (nonatomic, retain) NSString* country;
@end
#pragma mark - GetMessageFromWXResp
/*! @brief 微信终端向第三方程序请求提供内容,第三方程序向微信终端返回的消息结构体。
*
* 微信终端向第三方程序请求提供内容,第三方程序调用sendResp向微信终端返回一个GetMessageFromWXResp消息结构体。
*/
@interface GetMessageFromWXResp : BaseResp
/** 向微信终端提供的文本内容
@note 文本长度必须大于0且小于10K
*/
@property (nonatomic, retain) NSString* text;
/** 向微信终端提供的多媒体内容。
* @see WXMediaMessage
*/
@property (nonatomic, retain) WXMediaMessage* message;
/** 向微信终端提供内容的消息类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */
@property (nonatomic, assign) BOOL bText;
@end
#pragma mark - ShowMessageFromWXReq
/*! @brief 微信通知第三方程序,要求第三方程序显示的消息结构体。
*
* 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。
* 第三方程序处理完内容后调用sendResp向微信终端发送ShowMessageFromWXResp。
*/
@interface ShowMessageFromWXReq : BaseReq
/** 微信终端向第三方程序发送的要求第三方程序处理的多媒体内容
* @see WXMediaMessage
*/
@property (nonatomic, retain) WXMediaMessage* message;
@property (nonatomic, retain) NSString* lang;
@property (nonatomic, retain) NSString* country;
@end
#pragma mark - ShowMessageFromWXResp
/*! @brief 微信通知第三方程序,要求第三方程序显示或处理某些消息,第三方程序处理完后向微信终端发送的处理结果。
*
* 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。
* 第三方程序处理完内容后调用sendResp向微信终端发送ShowMessageFromWXResp。
*/
@interface ShowMessageFromWXResp : BaseResp
@end
#pragma mark - LaunchFromWXReq
/*! @brief 微信终端打开第三方程序携带的消息结构体
*
* 微信向第三方发送的结构体,第三方不需要返回
*/
@interface LaunchFromWXReq : BaseReq
@property (nonatomic, retain) WXMediaMessage* message;
@property (nonatomic, retain) NSString* lang;
@property (nonatomic, retain) NSString* country;
@end
#pragma mark - OpenTempSessionReq
/* ! @brief 第三方通知微信,打开临时会话
*
* 第三方通知微信,打开临时会话
*/
@interface OpenTempSessionReq : BaseReq
/** 需要打开的用户名
* @attention 长度不能超过512字节
*/
@property (nonatomic, retain) NSString* username;
/** 开发者自定义参数,拉起临时会话后会发给开发者后台,可以用于识别场景
* @attention 长度不能超过32位
*/
@property (nonatomic, retain) NSString* sessionFrom;
@end
#pragma mark - OpenTempSessionResp
/*! @brief 微信终端向第三方程序返回的OpenTempSessionReq处理结果。
*
* 第三方程序向微信终端发送OpenTempSessionReq后,微信发送回来的处理结果,该结果用OpenTempSessionResp表示。
*/
@interface OpenTempSessionResp : BaseResp
@end
#pragma mark - OpenWebviewReq
/* ! @brief 第三方通知微信启动内部浏览器,打开指定网页
*
* 第三方通知微信启动内部浏览器,打开指定Url对应的网页
*/
@interface OpenWebviewReq : BaseReq
/** 需要打开的网页对应的Url
* @attention 长度不能超过1024
*/
@property(nonatomic,retain)NSString* url;
@end
#pragma mark - OpenWebviewResp
/*! @brief 微信终端向第三方程序返回的OpenWebviewReq处理结果
*
* 第三方程序向微信终端发送OpenWebviewReq后,微信发送回来的处理结果,该结果用OpenWebviewResp表示
*/
@interface OpenWebviewResp : BaseResp
@end
#pragma mark - OpenRankListReq
/* ! @brief 第三方通知微信,打开硬件排行榜
*
* 第三方通知微信,打开硬件排行榜
*/
@interface OpenRankListReq : BaseReq
@end
#pragma mark - OpenRanklistResp
/*! @brief 微信终端向第三方程序返回的OpenRankListReq处理结果。
*
* 第三方程序向微信终端发送OpenRankListReq后,微信发送回来的处理结果,该结果用OpenRankListResp表示。
*/
@interface OpenRankListResp : BaseResp
@end
#pragma mark - JumpToBizProfileReq
/* ! @brief 第三方通知微信,打开指定微信号profile页面
*
* 第三方通知微信,打开指定微信号profile页面
*/
@interface JumpToBizProfileReq : BaseReq
/** 跳转到该公众号的profile
* @attention 长度不能超过512字节
*/
@property (nonatomic, retain) NSString* username;
/** 如果用户加了该公众号为好友,extMsg会上传到服务器
* @attention 长度不能超过1024字节
*/
@property (nonatomic, retain) NSString* extMsg;
/**
* 跳转的公众号类型
* @see WXBizProfileType
*/
@property (nonatomic, assign) int profileType;
@end
#pragma mark - JumpToBizWebviewReq
/* ! @brief 第三方通知微信,打开指定usrname的profile网页版
*
*/
@interface JumpToBizWebviewReq : BaseReq
/** 跳转的网页类型,目前只支持广告页
* @see WXMPWebviewType
*/
@property(nonatomic, assign) int webType;
/** 跳转到该公众号的profile网页版
* @attention 长度不能超过512字节
*/
@property(nonatomic, retain) NSString* tousrname;
/** 如果用户加了该公众号为好友,extMsg会上传到服务器
* @attention 长度不能超过1024字节
*/
@property(nonatomic, retain) NSString* extMsg;
@end
#pragma mark - WXCardItem
@interface WXCardItem : NSObject
/** 卡id
* @attention 长度不能超过1024字节
*/
@property (nonatomic,retain) NSString* cardId;
/** ext信息
* @attention 长度不能超过2024字节
*/
@property (nonatomic,retain) NSString* extMsg;
/**
* @attention 卡的状态,req不需要填。resp:0为未添加,1为已添加。
*/
@property (nonatomic,assign) UInt32 cardState;
/**
* @attention req不需要填,chooseCard返回的。
*/
@property (nonatomic,retain) NSString* encryptCode;
/**
* @attention req不需要填,chooseCard返回的。
*/
@property (nonatomic,retain) NSString* appID;
@end;
#pragma mark - WXInvoiceItem
@interface WXInvoiceItem : NSObject
/** 卡id
* @attention 长度不能超过1024字节
*/
@property (nonatomic,retain) NSString* cardId;
/** ext信息
* @attention 长度不能超过2024字节
*/
@property (nonatomic,retain) NSString* extMsg;
/**
* @attention 卡的状态,req不需要填。resp:0为未添加,1为已添加。
*/
@property (nonatomic,assign) UInt32 cardState;
/**
* @attention req不需要填,chooseCard返回的。
*/
@property (nonatomic,retain) NSString* encryptCode;
/**
* @attention req不需要填,chooseCard返回的。
*/
@property (nonatomic,retain) NSString* appID;
@end
#pragma mark - AddCardToWXCardPackageReq
/* ! @brief 请求添加卡券至微信卡包
*
*/
@interface AddCardToWXCardPackageReq : BaseReq
/** 卡列表
* @attention 个数不能超过40个 类型WXCardItem
*/
@property (nonatomic,retain) NSArray* cardAry;
@end
#pragma mark - AddCardToWXCardPackageResp
/** ! @brief 微信返回第三方添加卡券结果
*
*/
@interface AddCardToWXCardPackageResp : BaseResp
/** 卡列表
* @attention 个数不能超过40个 类型WXCardItem
*/
@property (nonatomic,retain) NSArray* cardAry;
@end
#pragma mark - WXChooseCardReq
/* ! @brief 请求从微信选取卡券
*
*/
@interface WXChooseCardReq : BaseReq
@property(nonatomic, strong) NSString *appID;
@property(nonatomic, assign) UInt32 shopID;
@property(nonatomic, assign) UInt32 canMultiSelect;
@property(nonatomic, strong) NSString *cardType;
@property(nonatomic, strong) NSString *cardTpID;
@property(nonatomic, strong) NSString *signType;
@property(nonatomic, strong) NSString *cardSign;
@property(nonatomic, assign) UInt32 timeStamp;
@property(nonatomic, strong) NSString *nonceStr;
@end
#pragma mark - WXChooseCardResp
/** ! @brief 微信返回第三方请求选择卡券结果
*
*/
@interface WXChooseCardResp : BaseResp
@property (nonatomic,retain) NSArray* cardAry;
@end
#pragma mark - WXChooseInvoiceReq
/* ! @brief 请求从微信选取发票
*
*/
@interface WXChooseInvoiceReq : BaseReq
@property (nonatomic, strong) NSString *appID;
@property (nonatomic, assign) UInt32 shopID;
@property (nonatomic, strong) NSString *signType;
@property (nonatomic, strong) NSString *cardSign;
@property (nonatomic, assign) UInt32 timeStamp;
@property (nonatomic, strong) NSString *nonceStr;
@end
#pragma mark - WXChooseInvoiceResp
/** ! @brief 微信返回第三方请求选择发票结果
*
*/
@interface WXChooseInvoiceResp : BaseResp
@property (nonatomic, strong) NSArray* cardAry;
@end
#pragma mark - WXSubscriptionReq
@interface WXSubscribeMsgReq : BaseReq
@property (nonatomic, assign) UInt32 scene;
@property (nonatomic, strong) NSString * templateId;
@property (nonatomic, strong) NSString * reserved;
@end
#pragma mark - WXSubscriptionReq
@interface WXSubscribeMsgResp : BaseResp
@property (nonatomic, strong) NSString *templateId;
@property (nonatomic, assign) UInt32 scene;
@property (nonatomic, strong) NSString *action;
@property (nonatomic, strong) NSString * reserved;
@property (nonatomic, strong) NSString * openId;
@end
#pragma mark - WXinvoiceAuthInsertReq
@interface WXInvoiceAuthInsertReq : BaseReq
@property (nonatomic, strong) NSString *urlString;
@end
#pragma mark - WXinvoiceAuthInsertResp
@interface WXInvoiceAuthInsertResp : BaseResp
@property (nonatomic, strong) NSString * wxOrderId;
@end
#pragma mark - WXNontaxPayReq
@interface WXNontaxPayReq:BaseReq
@property (nonatomic, strong) NSString *urlString;
@end
#pragma mark - WXNontaxPayResp
@interface WXNontaxPayResp : BaseResp
@property (nonatomic, strong) NSString *wxOrderId;
@end
#pragma mark - WXPayInsuranceReq
@interface WXPayInsuranceReq : BaseReq
@property (nonatomic, strong) NSString *urlString;
@end
#pragma mark - WXPayInsuranceResp
@interface WXPayInsuranceResp : BaseResp
@property (nonatomic, strong) NSString *wxOrderId;
@end
#pragma mark - WXMediaMessage
#pragma mark - WXMediaMessage
/*! @brief 多媒体消息结构体
*
* 用于微信终端和第三方程序之间传递消息的多媒体消息内容
*/
@interface WXMediaMessage : NSObject
+(WXMediaMessage *) message;
/** 标题
* @note 长度不能超过512字节
*/
@property (nonatomic, retain) NSString *title;
/** 描述内容
* @note 长度不能超过1K
*/
@property (nonatomic, retain) NSString *description;
/** 缩略图数据
* @note 大小不能超过32K
*/
@property (nonatomic, retain) NSData *thumbData;
/**
* @note 长度不能超过64字节
*/
@property (nonatomic, retain) NSString *mediaTagName;
/**
*
*/
@property (nonatomic, retain) NSString *messageExt;
@property (nonatomic, retain) NSString *messageAction;
/**
* 多媒体数据对象,可以为WXImageObject,WXMusicObject,WXVideoObject,WXWebpageObject等。
*/
@property (nonatomic, retain) id mediaObject;
/*! @brief 设置消息缩略图的方法
*
* @param image 缩略图
* @note 大小不能超过32K
*/
- (void) setThumbImage:(UIImage *)image;
@end
#pragma mark - WXImageObject
/*! @brief 多媒体消息中包含的图片数据对象
*
* 微信终端和第三方程序之间传递消息中包含的图片数据对象。
* @note imageData成员不能为空
* @see WXMediaMessage
*/
@interface WXImageObject : NSObject
/*! @brief 返回一个WXImageObject对象
*
* @note 返回的WXImageObject对象是自动释放的
*/
+(WXImageObject *) object;
/** 图片真实数据内容
* @note 大小不能超过10M
*/
@property (nonatomic, retain) NSData *imageData;
@end
#pragma mark - WXMusicObject
/*! @brief 多媒体消息中包含的音乐数据对象
*
* 微信终端和第三方程序之间传递消息中包含的音乐数据对象。
* @note musicUrl和musicLowBandUrl成员不能同时为空。
* @see WXMediaMessage
*/
@interface WXMusicObject : NSObject
/*! @brief 返回一个WXMusicObject对象
*
* @note 返回的WXMusicObject对象是自动释放的
*/
+(WXMusicObject *) object;
/** 音乐网页的url地址
* @note 长度不能超过10K
*/
@property (nonatomic, retain) NSString *musicUrl;
/** 音乐lowband网页的url地址
* @note 长度不能超过10K
*/
@property (nonatomic, retain) NSString *musicLowBandUrl;
/** 音乐数据url地址
* @note 长度不能超过10K
*/
@property (nonatomic, retain) NSString *musicDataUrl;
/**音乐lowband数据url地址
* @note 长度不能超过10K
*/
@property (nonatomic, retain) NSString *musicLowBandDataUrl;
@end
#pragma mark - WXVideoObject
/*! @brief 多媒体消息中包含的视频数据对象
*
* 微信终端和第三方程序之间传递消息中包含的视频数据对象。
* @note videoUrl和videoLowBandUrl不能同时为空。
* @see WXMediaMessage
*/
@interface WXVideoObject : NSObject
/*! @brief 返回一个WXVideoObject对象
*
* @note 返回的WXVideoObject对象是自动释放的
*/
+(WXVideoObject *) object;
/** 视频网页的url地址
* @note 长度不能超过10K
*/
@property (nonatomic, retain) NSString *videoUrl;
/** 视频lowband网页的url地址
* @note 长度不能超过10K
*/
@property (nonatomic, retain) NSString *videoLowBandUrl;
@end
#pragma mark - WXWebpageObject
/*! @brief 多媒体消息中包含的网页数据对象
*
* 微信终端和第三方程序之间传递消息中包含的网页数据对象。
* @see WXMediaMessage
*/
@interface WXWebpageObject : NSObject
/*! @brief 返回一个WXWebpageObject对象
*
* @note 返回的WXWebpageObject对象是自动释放的
*/
+(WXWebpageObject *) object;
/** 网页的url地址
* @note 不能为空且长度不能超过10K
*/
@property (nonatomic, retain) NSString *webpageUrl;
@end
#pragma mark - WXAppExtendObject
/*! @brief 多媒体消息中包含的App扩展数据对象
*
* 第三方程序向微信终端发送包含WXAppExtendObject的多媒体消息,
* 微信需要处理该消息时,会调用该第三方程序来处理多媒体消息内容。
* @note url,extInfo和fileData不能同时为空
* @see WXMediaMessage
*/
@interface WXAppExtendObject : NSObject
/*! @brief 返回一个WXAppExtendObject对象
*
* @note 返回的WXAppExtendObject对象是自动释放的
*/
+(WXAppExtendObject *) object;
/** 若第三方程序不存在,微信终端会打开该url所指的App下载地址
* @note 长度不能超过10K
*/
@property (nonatomic, retain) NSString *url;
/** 第三方程序自定义简单数据,微信终端会回传给第三方程序处理
* @note 长度不能超过2K
*/
@property (nonatomic, retain) NSString *extInfo;
/** App文件数据,该数据发送给微信好友,微信好友需要点击后下载数据,微信终端会回传给第三方程序处理
* @note 大小不能超过10M
*/
@property (nonatomic, retain) NSData *fileData;
@end
#pragma mark - WXEmoticonObject
/*! @brief 多媒体消息中包含的表情数据对象
*
* 微信终端和第三方程序之间传递消息中包含的表情数据对象。
* @see WXMediaMessage
*/
@interface WXEmoticonObject : NSObject
/*! @brief 返回一个WXEmoticonObject对象
*
* @note 返回的WXEmoticonObject对象是自动释放的
*/
+(WXEmoticonObject *) object;
/** 表情真实数据内容
* @note 大小不能超过10M
*/
@property (nonatomic, retain) NSData *emoticonData;
@end
#pragma mark - WXFileObject
/*! @brief 多媒体消息中包含的文件数据对象
*
* @see WXMediaMessage
*/
@interface WXFileObject : NSObject
/*! @brief 返回一个WXFileObject对象
*
* @note 返回的WXFileObject对象是自动释放的
*/
+(WXFileObject *) object;
/** 文件后缀名
* @note 长度不超过64字节
*/
@property (nonatomic, retain) NSString *fileExtension;
/** 文件真实数据内容
* @note 大小不能超过10M
*/
@property (nonatomic, retain) NSData *fileData;
@end
#pragma mark - WXLocationObject
/*! @brief 多媒体消息中包含的地理位置数据对象
*
* 微信终端和第三方程序之间传递消息中包含的地理位置数据对象。
* @see WXMediaMessage
*/
@interface WXLocationObject : NSObject
/*! @brief 返回一个WXLocationObject对象
*
* @note 返回的WXLocationObject对象是自动释放的
*/
+(WXLocationObject *) object;
/** 地理位置信息
* @note 经纬度
*/
@property (nonatomic, assign) double lng; //经度
@property (nonatomic, assign) double lat; //纬度
@end
@interface WXMiniProgramObject : NSObject
/*! @brief WXMiniProgramObject对象
*
* @note 返回的WXMiniProgramObject对象是自动释放的
*/
+(WXMiniProgramObject *) object;
@property (nonatomic, strong) NSString *webpageUrl; //低版本网页链接
@property (nonatomic, strong) NSString *userName; //小程序username
@property (nonatomic, strong) NSString *path; //小程序页面的路径
@property (nonatomic, strong) NSData *hdImageData; // 小程序新版本的预览图 128k
@property (nonatomic, assign) BOOL withShareTicket; //是否使用带 shareTicket 的转发
@property (nonatomic, assign) WXMiniProgramType miniProgramType; // 分享小程序的版本(正式,开发,体验)
@end
#pragma mark - WXLaunchMiniProgramReq
/*! @brief WXLaunchMiniProgramReq对象, 可实现通过sdk拉起微信小程序
*
* @note 返回的WXLaunchMiniProgramReq对象是自动释放的
*/
@interface WXLaunchMiniProgramReq : BaseReq
+(WXLaunchMiniProgramReq *) object;
@property (nonatomic, strong) NSString *userName; //拉起的小程序的username
@property (nonatomic, strong) NSString *path; //拉起小程序页面的路径,不填默认拉起小程序首页
@property (nonatomic, assign) WXMiniProgramType miniProgramType; //拉起小程序的类型
@end
#pragma mark - WXLaunchMiniProgramResp
/*! @brief 微信终端向第三方程序返回的WXLaunchMiniProgramReq处理结果。
*
* 第三方程序向微信终端发送WXLaunchMiniProgramReq后,微信发送回来的处理结果,该结果用WXLaunchMiniProgramResp表示。
*/
@interface WXLaunchMiniProgramResp : BaseResp
@property (nonatomic, retain) NSString *extMsg;
@end
#pragma mark - WXTextObject
/*! @brief 多媒体消息中包含的文本数据对象
*
* 微信终端和第三方程序之间传递消息中包含的文本数据对象。
* @see WXMediaMessage
*/
@interface WXTextObject : NSObject
/*! @brief 返回一个WXTextObject对象
*
* @note 返回的WXTextObject对象是自动释放的
*/
+(WXTextObject *) object;
/** 地理位置信息
* @note 文本内容
*/
@property (nonatomic, retain) NSString *contentText;
@end
... ...
//
// WechatAuthSDK.h
// WechatAuthSDK
//
// Created by 李凯 on 13-11-29.
// Copyright (c) 2013年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
enum AuthErrCode {
WechatAuth_Err_Ok = 0, //Auth成功
WechatAuth_Err_NormalErr = -1, //普通错误
WechatAuth_Err_NetworkErr = -2, //网络错误
WechatAuth_Err_GetQrcodeFailed = -3, //获取二维码失败
WechatAuth_Err_Cancel = -4, //用户取消授权
WechatAuth_Err_Timeout = -5, //超时
};
@protocol WechatAuthAPIDelegate<NSObject>
@optional
- (void)onAuthGotQrcode:(UIImage *)image; //得到二维码
- (void)onQrcodeScanned; //二维码被扫描
- (void)onAuthFinish:(int)errCode AuthCode:(NSString *)authCode; //成功登录
@end
@interface WechatAuthSDK : NSObject{
NSString *_sdkVersion;
__weak id<WechatAuthAPIDelegate> _delegate;
}
@property(nonatomic, weak) id<WechatAuthAPIDelegate> delegate;
@property(nonatomic, readonly) NSString *sdkVersion; //authSDK版本号
/*! @brief 发送登录请求,等待WechatAuthAPIDelegate回调
*
* @param appId 微信开发者ID
* @param nonceStr 一个随机的尽量不重复的字符串,用来使得每次的signature不同
* @param timeStamp 时间戳
* @param scope 应用授权作用域,拥有多个作用域用逗号(,)分隔
* @param signature 签名
* @param schemeData 会在扫码后拼在scheme后
* @return 成功返回YES,失败返回NO
注:该实现只保证同时只有一个Auth在运行,Auth未完成或未Stop再次调用Auth接口时会返回NO。
*/
- (BOOL)Auth:(NSString *)appId
nonceStr:(NSString *)nonceStr
timeStamp:(NSString*)timeStamp
scope:(NSString *)scope
signature:(NSString *)signature
schemeData:(NSString *)schemeData;
/*! @brief 暂停登录请求
*
* @return 成功返回YES,失败返回NO。
*/
- (BOOL)StopAuth;
@end
... ...
不能预览此文件类型
此 diff 太大无法显示。
{
"name": "react-native-wechat",
"version": "1.10.0",
"description": "react-native library for wechat app",
"main": "index.js",
"scripts": {
"test": "echo 1"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/weflex/react-native-wechat.git"
},
"keywords": [
"wechat",
"react",
"react-native",
"react-component",
"ios"
],
"dependencies": {
"events": "1.0.2"
},
"peerDependencies": {
"react-native": ">=0.40"
},
"author": "Yorkie Liu <yorkiefixer@gmail.com>",
"contributors": [
{
"name": "Yorkie Liu",
"email": "yorkiefixer@gmail.com"
},
{
"name": "Deng Yun",
"email": "tdzl2003@gmail.com"
}
],
"license": "MIT",
"bugs": {
"url": "https://github.com/weflex/react-native-wechat/issues"
},
"homepage": "https://github.com/weflex/react-native-wechat#readme"
}
... ...
#
# Be sure to run `pod spec lint react-native-qq.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#
Pod::Spec.new do |s|
s.name = "react-native-wechat"
s.version = "1.9.10"
s.summary = "React-Native(iOS/Android) functionalities include WeChat Login, Share, Favorite and Payment {QQ: 336021910}"
s.description = <<-DESC
React-Native(iOS/Android) functionalities include WeChat Login, Share, Favorite and Payment {QQ: 336021910}
DESC
s.author = { "weflex" => "336021910@qq.com" }
s.homepage = "https://github.com/weflex/react-native-wechat"
s.license = "MIT"
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/weflex/react-native-wechat.git", :tag => "master" }
s.source_files = "ios/*.{h,m}"
s.dependency "React"
s.vendored_libraries = "ios/libWeChatSDK.a"
s.requires_arc = true
s.frameworks = 'SystemConfiguration','CoreTelephony'
s.library = 'sqlite3','c++','z'
end
... ...

11.7 KB

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
events@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/events/-/events-1.0.2.tgz#75849dcfe93d10fb057c30055afdbd51d06a8e24"
... ...