1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

chore: Update Example.

This commit is contained in:
jaywcjlove 2020-07-08 22:05:37 +08:00
parent b6a11caf86
commit 07cc6c69ff
5 changed files with 49 additions and 8 deletions

View File

@ -1,15 +1,32 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Button, StyleSheet, Text, View } from 'react-native'; import { Button, StyleSheet, Text, View, Linking, AppState } from 'react-native';
import Alipay from 'react-native-uiwjs-alipay'; import Alipay from 'react-native-uiwjs-alipay';
export default class App extends Component { export default class App extends Component {
componentDidMount() { componentDidMount() {
Alipay.setAlipayScheme('ap2021001172656340'); Alipay.setAlipayScheme('ap2021001172656340');
AppState.addEventListener('change', this._handleAppStateChange);
}
componentWillUnmount(){
AppState.removeEventListener('change', this._handleAppStateChange)
}
// 2020-07-08 20:56:14.081 [info][tid:com.facebook.react.JavaScript] 'nextAppState:', 'inactive'
// 2020-07-08 20:56:14.947 [info][tid:com.facebook.react.JavaScript] 'nextAppState:', 'background'
// 2020-07-08 20:56:42.580 [info][tid:com.facebook.react.JavaScript] 'nextAppState:', 'active'
// 2020-07-08 20:56:42.633 [info][tid:com.facebook.react.JavaScript] 'nextAppState:res:', null
_handleAppStateChange = (nextAppState) => {
console.log('nextAppState:', nextAppState)
if(nextAppState==='active'){
Linking.getInitialURL().then(res => {
console.log('nextAppState:res:', res)
})
}
} }
aliPay = () => { aliPay = () => {
const payInfo = 'app_id=2021001172656340&biz_content=%7B%22timeout_express%22%3A%2230m%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22total_amount%22%3A%220.01%22%2C%22subject%22%3A%221%22%2C%22body%22%3A%22%E6%88%91%E6%98%AF%E6%B5%8B%E8%AF%95%E6%95%B0%E6%8D%AE%22%2C%22out_trade_no%22%3A%22IQJZSRC1YMQB5HU%22%7D&charset=utf-8&format=json&method=alipay.trade.app.pay&notify_url=http%3A%2F%2Fdomain.merchant.com%2Fpayment_notify&sign_type=RSA2&timestamp=2016-08-25%2020%3A26%3A31&version=1.0&sign=cYmuUnKi5QdBsoZEAbMXVMmRWjsuUj%2By48A2DvWAVVBuYkiBj13CFDHu2vZQvmOfkjE0YqCUQE04kqm9Xg3tIX8tPeIGIFtsIyp%2FM45w1ZsDOiduBbduGfRo1XRsvAyVAv2hCrBLLrDI5Vi7uZZ77Lo5J0PpUUWwyQGt0M4cj8g%3D'; // return_url=
const payInfo = `alipay_sdk=alipay-sdk-java-dynamicVersionNo&app_id=2021001172656340&biz_content=%7B+%22out_trade_no%22%3A%22123123213123217%22%2C+%22total_amount%22%3A%220.01%22%2C+%22subject%22%3A%221234%22%2C+%22product_code%22%3A%22QUICK_MSECURITY_PAY%22+%7D&charset=UTF-8&format=json&method=alipay.trade.app.pay&notify_url=http%3A%2F%2Fane.boshu.ltd%2Fowner%2Fpay%2Fapi%2FownerPay%2Fcallback&return_url=ap2021001172656340%3A%2F%2F&sign=NVSGkwXj%2BA2FATt%2BHXrzt%2B6WdalIt8JhBpTIXQRRvtkdzP0ZC85si2jK27rM5DWzrWfF9KOuA1Mk0%2BkT3P6NRKEYL4%2FDS5VlZf6BSta8CTcZIgGAnQr8H8dKCWxkzQtvUbLBCimQpJyesidmxh3tXNZNHZHcjonJeqmu%2FdSv%2BubruAfo3etNUwGJQscPGbLtCy%2BU%2BEihSmNPVTIjh56MJunF%2Fu1I%2Fbte85XCzfJVrgGnWtvpT%2BRcbdDrDkRDc3JuRHbNsRgY%2FY413ovI5xSnGZ1oWLAd%2ByXuqoT0zDL8O%2FDu38nSJU%2Bkm1SF0u6Gpkvajef4%2F6WglfCMrqZCet%2B7GA%3D%3D&sign_type=RSA2&timestamp=2020-07-08+21%3A45%3A27&version=1.0`;
Alipay.alipay(payInfo, (resule) => { Alipay.alipay(payInfo, (resule) => {
console.log(resule) console.log('resule-->>>', resule)
}); });
} }
render() { render() {

View File

@ -681,7 +681,7 @@
"-ObjC", "-ObjC",
"-lc++", "-lc++",
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = com.uiwjs;
PRODUCT_NAME = example; PRODUCT_NAME = example;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@ -704,7 +704,7 @@
"-ObjC", "-ObjC",
"-lc++", "-lc++",
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = com.uiwjs;
PRODUCT_NAME = example; PRODUCT_NAME = example;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";

View File

@ -60,6 +60,13 @@
ReferencedContainer = "container:example.xcodeproj"> ReferencedContainer = "container:example.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "disable"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Release" buildConfiguration = "Release"

View File

@ -3,6 +3,7 @@
#import <React/RCTBridge.h> #import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h> #import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h> #import <React/RCTRootView.h>
#import <React/RCTLinkingManager.h>
#if DEBUG #if DEBUG
#import <FlipperKit/FlipperClient.h> #import <FlipperKit/FlipperClient.h>
@ -55,4 +56,16 @@ static void InitializeFlipper(UIApplication *application) {
#endif #endif
} }
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
@end @end

View File

@ -26,17 +26,21 @@
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Editor</string> <string>Editor</string>
<key>CFBundleURLName</key> <key>CFBundleURLName</key>
<string>I</string> <string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>ap2021001172656340</string>
</array>
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSApplicationQueriesSchemes</key> <key>LSApplicationQueriesSchemes</key>
<array> <array>
<string>alipay</string> <string>alipay</string>
</array> </array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
<dict> <dict>
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>