Skip to content

Commit

Permalink
update 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
chensiming committed Nov 11, 2019
1 parent 141d4fa commit fea6a1e
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 94 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.3

* fix android result

## 1.0.1

* Stable version
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![pub package](https://img.shields.io/badge/pub-1.0.2-brightgreen.svg)](https://pub.dartlang.org/packages/geetest_plugin) [![Build Status](https://travis-ci.com/cikichen/flutter_geetest_plugin.svg?branch=master)](https://travis-ci.com/cikichen/flutter_geetest_plugin)
[![pub package](https://img.shields.io/badge/pub-1.0.3-brightgreen.svg)](https://pub.dartlang.org/packages/geetest_plugin) [![Build Status](https://travis-ci.com/cikichen/flutter_geetest_plugin.svg?branch=master)](https://travis-ci.com/cikichen/flutter_geetest_plugin)

# flutter_geetest_plugin

Expand All @@ -20,7 +20,7 @@ Add this to your package's pubspec.yaml file:

```
dependencies:
flutter_geetest_plugin: ^1.0.2
flutter_geetest_plugin: ^1.0.3
```

### 2. Install it
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package me.ithome.flutter_geetest_plugin;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log;
Expand All @@ -10,6 +13,7 @@
import com.geetest.sdk.GT3Listener;
import com.tencent.smtt.sdk.QbSdk;

import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;

import io.flutter.plugin.common.MethodCall;
Expand All @@ -25,11 +29,12 @@ public class FlutterGeetestPlugin implements MethodCallHandler {
private static String validateURL = "https://www.geetest.com/demo/gt/validate-slide";
private GT3GeetestUtils gt3GeetestUtils;
private GT3ConfigBean gt3ConfigBean;
private final Registrar mRegistrar;
// private final Registrar mRegistrar;
private static final String TAG = "flutter_geetest";
private Result flutterResult;

private FlutterGeetestPlugin(Registrar registrar) {
this.mRegistrar = registrar;
// this.mRegistrar = registrar;

QbSdk.PreInitCallback cb =
new QbSdk.PreInitCallback() {
Expand Down Expand Up @@ -89,6 +94,7 @@ public void onDialogReady(String duration) {
@Override
public void onDialogResult(String result) {
Log.e(TAG, "GT3BaseListener-->onDialogResult-->" + result);
flutterResult.success(result);
// 开启api2逻辑
new RequestAPI2().execute(result);
}
Expand Down Expand Up @@ -133,12 +139,13 @@ public static void registerWith(Registrar registrar) {
}

@Override
public void onMethodCall(MethodCall call, final Result result) {
public void onMethodCall(MethodCall call, @NotNull final Result result) {
switch (call.method) {
case "getPlatformVersion":
result.success("Android " + android.os.Build.VERSION.RELEASE);
break;
case "getGeetest":
flutterResult = result;
captchaURL = call.argument("api1");
validateURL = call.argument("api2");
// 开启验证
Expand Down Expand Up @@ -187,6 +194,7 @@ public void onMethodCall(MethodCall call, final Result result) {
}

/** 请求api1 */
@SuppressLint("StaticFieldLeak")
class RequestAPI1 extends AsyncTask<Void, Void, JSONObject> {

@Override
Expand Down Expand Up @@ -215,6 +223,7 @@ protected void onPostExecute(JSONObject parmas) {
}

/** 请求api2 */
@SuppressLint("StaticFieldLeak")
class RequestAPI2 extends AsyncTask<String, Void, String> {

@Override
Expand All @@ -233,6 +242,7 @@ protected void onPostExecute(String result) {
try {
JSONObject jsonObject = new JSONObject(result);
String status = jsonObject.getString("status");

if ("success".equals(status)) {
gt3GeetestUtils.showSuccessDialog();
} else {
Expand Down
Binary file modified example/android/.idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file modified example/android/.idea/caches/gradle_models.ser
Binary file not shown.
86 changes: 0 additions & 86 deletions example/android/.idea/markdown-navigator.xml

This file was deleted.

83 changes: 83 additions & 0 deletions example/android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class _MyAppState extends State<MyApp> {
// Platform messages may fail, so we use a try/catch PlatformException.
try {
result = await FlutterGeetestPlugin.getGeetest('https://www.geetest.com/demo/gt/register-slide', 'https://www.geetest.com/demo/gt/validate-slide');
} on PlatformException {
} on Exception {
// platformVersion = 'Failed to get platform version.';
}

Expand All @@ -69,7 +69,7 @@ class _MyAppState extends State<MyApp> {
body: new Center(
child: Column(
children: <Widget>[
new Text('Running on: $_platformVersion\n'),
new Text('$_platformVersion\n'),
RaisedButton(
onPressed: getGeetest,
child: Text("geetest"),
Expand Down
1 change: 1 addition & 0 deletions lib/flutter_geetest_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class FlutterGeetestPlugin {
return version;
}

///一键验证
static Future<String> getGeetest(String api1, String api2) async {
final Map<String, dynamic> params = <String, dynamic>{
'api1': api1,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_geetest_plugin
description: Geetest(GT3Captcha) Flutter plugin(极验 - a user-friendly CAPTCHA powered by AI. Protect your website and mobile apps against bot traffic. Start your free trial now!).
version: 1.0.2
version: 1.0.3
author: SimonChen <admin@ithome.me>
homepage: https://github.com/cikichen/flutter_geetest_plugin

Expand Down

0 comments on commit fea6a1e

Please sign in to comment.