-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
林恒龙
committed
Oct 25, 2018
0 parents
commit 8456e50
Showing
79 changed files
with
2,550 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.DS_Store | ||
.dart_tool/ | ||
|
||
.packages | ||
.pub/ | ||
pubspec.lock | ||
|
||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.1 | ||
|
||
* TODO: Describe initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO: Add your license here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# fake_alipay | ||
|
||
A new Flutter plugin. | ||
|
||
## android | ||
|
||
```` | ||
# 支付宝混淆 | ||
-keep class com.alipay.android.app.IAlixPay{*;} | ||
-keep class com.alipay.android.app.IAlixPay$Stub{*;} | ||
-keep class com.alipay.android.app.IRemoteServiceCallback{*;} | ||
-keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;} | ||
-keep class com.alipay.sdk.app.PayTask{ public *;} | ||
-keep class com.alipay.sdk.app.AuthTask{ public *;} | ||
-keep class com.alipay.sdk.app.H5PayCallback { | ||
<fields>; | ||
<methods>; | ||
} | ||
-keep class com.alipay.android.phone.mrpc.core.** { *; } | ||
-keep class com.alipay.apmobilesecuritysdk.** { *; } | ||
-keep class com.alipay.mobile.framework.service.annotation.** { *; } | ||
-keep class com.alipay.mobilesecuritysdk.face.** { *; } | ||
-keep class com.alipay.tscenter.biz.rpc.** { *; } | ||
-keep class org.json.alipay.** { *; } | ||
-keep class com.alipay.tscenter.** { *; } | ||
-keep class com.ta.utdid2.** { *;} | ||
-keep class com.ut.device.** { *;} | ||
```` | ||
|
||
## ios | ||
|
||
```` | ||
在Xcode中,选择你的工程设置项,选中“TARGETS”一栏,在“info”标签栏的“URL type“添加“URL scheme”为你所注册的应用程序id | ||
URL Types | ||
alipay: identifier=alipay schemes=${your app scheme name} | ||
```` | ||
|
||
```` | ||
iOS 9系统策略更新,限制了http协议的访问,此外应用需要在“Info.plist”中将要使用的URL Schemes列为白名单,才可正常检查其他应用是否安装。 | ||
<key>LSApplicationQueriesSchemes</key> | ||
<array> | ||
<string>alipay</string> | ||
</array> | ||
<key>NSAppTransportSecurity</key> | ||
<dict> | ||
<key>NSAllowsArbitraryLoads</key> | ||
<true/> | ||
</dict> | ||
```` | ||
|
||
## flutter | ||
|
||
```` | ||
# pubspec.yml | ||
dependencies: | ||
fake_alipay: | ||
git: | ||
url: http://git.xrjiot.cn/flutter/packages/fake_alipay.git | ||
```` | ||
|
||
[示例](./example/lib/main.dart) | ||
|
||
## Getting Started | ||
|
||
For help getting started with Flutter, view our online | ||
[documentation](https://flutter.io/). | ||
|
||
For help on editing plugin code, view the [documentation](https://flutter.io/developing-packages/#edit-plugin-package). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
group 'io.flutter.plugins.fakealipay' | ||
version '1.0-SNAPSHOT' | ||
|
||
buildscript { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.1.2' | ||
} | ||
} | ||
|
||
rootProject.allprojects { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdkVersion 27 | ||
|
||
defaultConfig { | ||
minSdkVersion 16 | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
lintOptions { | ||
disable 'InvalidPackage' | ||
} | ||
} | ||
|
||
dependencies { | ||
api fileTree(include: ['*.jar'], dir: 'libs') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.gradle.jvmargs=-Xmx1536M |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'fake_alipay' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="io.flutter.plugins.fakealipay"> | ||
|
||
<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" /> | ||
|
||
<application> | ||
<activity | ||
android:name="com.alipay.sdk.app.H5PayActivity" | ||
android:configChanges="orientation|keyboardHidden|navigation|screenSize" | ||
android:exported="false" | ||
android:screenOrientation="behind" | ||
android:windowSoftInputMode="adjustResize|stateHidden" > | ||
</activity> | ||
<activity | ||
android:name="com.alipay.sdk.app.H5AuthActivity" | ||
android:configChanges="orientation|keyboardHidden|navigation" | ||
android:exported="false" | ||
android:screenOrientation="behind" | ||
android:windowSoftInputMode="adjustResize|stateHidden" > | ||
</activity> | ||
</application> | ||
</manifest> |
69 changes: 69 additions & 0 deletions
69
android/src/main/java/io/flutter/plugins/fakealipay/FakeAlipayPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package io.flutter.plugins.fakealipay; | ||
|
||
import android.content.pm.PackageInfo; | ||
import android.content.pm.PackageManager; | ||
|
||
import com.alipay.sdk.app.PayTask; | ||
|
||
import java.util.Map; | ||
|
||
import io.flutter.plugin.common.MethodCall; | ||
import io.flutter.plugin.common.MethodChannel; | ||
import io.flutter.plugin.common.MethodChannel.MethodCallHandler; | ||
import io.flutter.plugin.common.MethodChannel.Result; | ||
import io.flutter.plugin.common.PluginRegistry.Registrar; | ||
|
||
/** FakeAlipayPlugin */ | ||
public class FakeAlipayPlugin implements MethodCallHandler { | ||
/** Plugin registration. */ | ||
public static void registerWith(Registrar registrar) { | ||
final MethodChannel channel = new MethodChannel(registrar.messenger(), "plugins.flutter.io/fake_alipay"); | ||
FakeAlipayPlugin plugin = new FakeAlipayPlugin(registrar, channel); | ||
channel.setMethodCallHandler(plugin); | ||
} | ||
|
||
private static final String METHOD_ISALIPAYINSTALLED = "isAlipayInstalled"; | ||
private static final String METHOD_PAY = "pay"; | ||
|
||
private static final String METHOD_ONPAYRESP = "onPayResp"; | ||
|
||
private static final String ARGUMENT_KEY_ORDERINFO = "orderInfo"; | ||
private static final String ARGUMENT_KEY_ISSHOWPAYLOADING = "isShowPayLoading"; | ||
|
||
private final Registrar registrar; | ||
private final MethodChannel channel; | ||
|
||
private FakeAlipayPlugin(Registrar registrar, MethodChannel channel) { | ||
this.registrar = registrar; | ||
this.channel = channel; | ||
} | ||
|
||
@Override | ||
public void onMethodCall(MethodCall call, Result result) { | ||
if (METHOD_ISALIPAYINSTALLED.equals(call.method)) { | ||
boolean isAlipayInstalled = false; | ||
try { | ||
final PackageManager packageManager = registrar.context().getPackageManager(); | ||
PackageInfo info = packageManager.getPackageInfo("com.eg.android.AlipayGphone", PackageManager.GET_SIGNATURES); | ||
isAlipayInstalled = info != null; | ||
} catch (PackageManager.NameNotFoundException e) { | ||
} | ||
result.success(isAlipayInstalled); | ||
} else if (METHOD_PAY.equals(call.method)) { | ||
final String orderInfo = call.argument(ARGUMENT_KEY_ORDERINFO); | ||
final boolean isShowPayLoading = call.argument(ARGUMENT_KEY_ISSHOWPAYLOADING); | ||
Runnable pay = new Runnable() { | ||
@Override | ||
public void run() { | ||
PayTask task = new PayTask(registrar.activity()); | ||
Map<String, String> result = task.payV2(orderInfo, isShowPayLoading); | ||
channel.invokeMethod(METHOD_ONPAYRESP, result); | ||
} | ||
}; | ||
new Thread(pay).start(); | ||
result.success(null); | ||
} else { | ||
result.notImplemented(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Miscellaneous | ||
*.class | ||
*.lock | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# Visual Studio Code related | ||
.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
.dart_tool/ | ||
.flutter-plugins | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
build/ | ||
|
||
# Android related | ||
**/android/**/gradle-wrapper.jar | ||
**/android/.gradle | ||
**/android/captures/ | ||
**/android/gradlew | ||
**/android/gradlew.bat | ||
**/android/local.properties | ||
**/android/**/GeneratedPluginRegistrant.java | ||
|
||
# iOS/XCode related | ||
**/ios/**/*.mode1v3 | ||
**/ios/**/*.mode2v3 | ||
**/ios/**/*.moved-aside | ||
**/ios/**/*.pbxuser | ||
**/ios/**/*.perspectivev3 | ||
**/ios/**/*sync/ | ||
**/ios/**/.sconsign.dblite | ||
**/ios/**/.tags* | ||
**/ios/**/.vagrant/ | ||
**/ios/**/DerivedData/ | ||
**/ios/**/Icon? | ||
**/ios/**/Pods/ | ||
**/ios/**/.symlinks/ | ||
**/ios/**/profile | ||
**/ios/**/xcuserdata | ||
**/ios/.generated/ | ||
**/ios/Flutter/App.framework | ||
**/ios/Flutter/Flutter.framework | ||
**/ios/Flutter/Generated.xcconfig | ||
**/ios/Flutter/app.flx | ||
**/ios/Flutter/app.zip | ||
**/ios/Flutter/flutter_assets/ | ||
**/ios/ServiceDefinitions.json | ||
**/ios/Runner/GeneratedPluginRegistrant.* | ||
|
||
# Exceptions to above rules. | ||
!**/ios/**/default.mode1v3 | ||
!**/ios/**/default.mode2v3 | ||
!**/ios/**/default.pbxuser | ||
!**/ios/**/default.perspectivev3 | ||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: f37c235c32fc15babe6dc7b7bc2ee4387e5ecf92 | ||
channel: beta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# fake_alipay_example | ||
|
||
Demonstrates how to use the fake_alipay plugin. | ||
|
||
## Getting Started | ||
|
||
For help getting started with Flutter, view our online | ||
[documentation](https://flutter.io/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
def localProperties = new Properties() | ||
def localPropertiesFile = rootProject.file('local.properties') | ||
if (localPropertiesFile.exists()) { | ||
localPropertiesFile.withReader('UTF-8') { reader -> | ||
localProperties.load(reader) | ||
} | ||
} | ||
|
||
def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
if (flutterRoot == null) { | ||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | ||
} | ||
|
||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||
if (flutterVersionCode == null) { | ||
flutterVersionCode = '1' | ||
} | ||
|
||
def flutterVersionName = localProperties.getProperty('flutter.versionName') | ||
if (flutterVersionName == null) { | ||
flutterVersionName = '1.0' | ||
} | ||
|
||
apply plugin: 'com.android.application' | ||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
|
||
android { | ||
compileSdkVersion 27 | ||
|
||
lintOptions { | ||
disable 'InvalidPackage' | ||
} | ||
|
||
defaultConfig { | ||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||
applicationId "io.flutter.plugins.fakealipayexample" | ||
minSdkVersion 16 | ||
targetSdkVersion 27 | ||
versionCode flutterVersionCode.toInteger() | ||
versionName flutterVersionName | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
// TODO: Add your own signing config for the release build. | ||
// Signing with the debug keys for now, so `flutter run --release` works. | ||
signingConfig signingConfigs.debug | ||
} | ||
} | ||
} | ||
|
||
flutter { | ||
source '../..' | ||
} | ||
|
||
dependencies { | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
} |
Oops, something went wrong.