diff --git a/.gitignore b/.gitignore
index 60f9d69..765dbc6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+.idea
+publish.sh
.DS_Store
.dart_tool/
diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml
deleted file mode 100644
index 6b36ee2..0000000
--- a/.idea/libraries/Dart_SDK.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Flutter_for_Android.xml b/.idea/libraries/Flutter_for_Android.xml
deleted file mode 100644
index 3ff4bef..0000000
--- a/.idea/libraries/Flutter_for_Android.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 5a71f78..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/.idea/runConfigurations/example_lib_main_dart.xml b/.idea/runConfigurations/example_lib_main_dart.xml
deleted file mode 100644
index 5fd9159..0000000
--- a/.idea/runConfigurations/example_lib_main_dart.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 36c8ba0..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android/build.gradle b/android/build.gradle
index 7f04a8a..4140b5d 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,3 +1,10 @@
+
+apply plugin: 'com.android.library'
+
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-kapt'
+apply plugin: 'kotlin-android-extensions'
+
group 'com.finogeeks.mop'
version '1.0'
@@ -5,10 +12,21 @@ buildscript {
repositories {
google()
jcenter()
+ maven {
+ url "https://gradle.finogeeks.club/repository/finogeeks/"
+ credentials {
+ username "xiaoyu"
+ password "xy123456"
+ }
+ }
+ maven { url "https://jitpack.io" }
+
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.2.1'
+ classpath 'com.android.tools.build:gradle:3.4.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60"
+
}
}
@@ -16,19 +34,50 @@ rootProject.allprojects {
repositories {
google()
jcenter()
+ maven {
+ url "https://gradle.finogeeks.club/repository/finogeeks/"
+ credentials {
+ username "xiaoyu"
+ password "xy123456"
+ }
+ }
+ maven { url "https://jitpack.io" }
+
}
}
-apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
- minSdkVersion 16
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ minSdkVersion 21
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
disable 'InvalidPackage'
}
}
+
+kapt {
+ arguments {
+ arg("moduleName", project.getName())
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'com.finogeeks.lib:finapplet:2.0.51'
+ implementation 'org.greenrobot:greendao:3.2.2'
+
+}
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 019065d..d757f3d 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
diff --git a/android/proguard-android.txt b/android/proguard-android.txt
new file mode 100644
index 0000000..e69de29
diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro
new file mode 100644
index 0000000..4194f7b
--- /dev/null
+++ b/android/proguard-rules.pro
@@ -0,0 +1,5 @@
+-keep class com.finogeeks.** {*;}
+
+# tbs
+-keep class com.tencent.smtt.** {*;}
+-keep class com.tencent.tbs.** {*;}
\ No newline at end of file
diff --git a/android/src/main/java/com/finogeeks/mop/MopEventStream.java b/android/src/main/java/com/finogeeks/mop/MopEventStream.java
new file mode 100644
index 0000000..baed58d
--- /dev/null
+++ b/android/src/main/java/com/finogeeks/mop/MopEventStream.java
@@ -0,0 +1,29 @@
+package com.finogeeks.mop;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import io.flutter.plugin.common.EventChannel;
+
+
+public class MopEventStream implements EventChannel.StreamHandler {
+ EventChannel.EventSink mEventSlink;
+ @Override
+ public void onListen(Object o, EventChannel.EventSink eventSink) {
+ mEventSlink = eventSink;
+ }
+
+ @Override
+ public void onCancel(Object o) {
+ mEventSlink = null;
+ }
+ public void send(String channel,String event,Object body) {
+ if (mEventSlink != null) {
+ Map map = new HashMap<>();
+ map.put("channel",channel);
+ map.put("event",event);
+ map.put("body",body);
+ mEventSlink.success(map);
+ }
+ }
+}
diff --git a/android/src/main/java/com/finogeeks/mop/MopPlugin.java b/android/src/main/java/com/finogeeks/mop/MopPlugin.java
index a2c623f..9ec335d 100644
--- a/android/src/main/java/com/finogeeks/mop/MopPlugin.java
+++ b/android/src/main/java/com/finogeeks/mop/MopPlugin.java
@@ -1,25 +1,99 @@
package com.finogeeks.mop;
+import android.content.Intent;
+import android.util.Log;
+
+import com.finogeeks.mop.interfaces.Event;
+import com.finogeeks.mop.interfaces.FlutterInterface;
+import com.finogeeks.mop.interfaces.ICallback;
+import com.finogeeks.mop.service.MopPluginService;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import io.flutter.plugin.common.EventChannel;
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;
import io.flutter.plugin.common.PluginRegistry.Registrar;
/** MopPlugin */
public class MopPlugin implements MethodCallHandler {
- /** Plugin registration. */
+ private static final String LOG_TAG = MopPlugin.class.getSimpleName();
+
+ private static final String CHANNEL = "mop";
+ private PluginRegistry.Registrar registrar;
+ private FlutterInterface flutterInterface;
+ private MopPluginDelegate delegate;
+
+
+
+
+ /**
+ * Plugin registration.
+ */
public static void registerWith(Registrar registrar) {
- final MethodChannel channel = new MethodChannel(registrar.messenger(), "mop");
- channel.setMethodCallHandler(new MopPlugin());
+ final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL);
+ final MopPluginDelegate delegate = new MopPluginDelegate(registrar.activity());
+ final MopPlugin instance = new MopPlugin(registrar,delegate);
+ channel.setMethodCallHandler(instance);
+ final EventChannel eventChannel=new EventChannel(registrar.messenger(),"plugins.mop.finogeeks.com/mop_event");
+ MopEventStream mopEventStream = new MopEventStream();
+ eventChannel.setStreamHandler(mopEventStream);
+ MopPluginService.getInstance().initialize(registrar.activity(),mopEventStream);
+
+ }
+
+ MopPlugin(PluginRegistry.Registrar registrar,MopPluginDelegate delegate) {
+ this.registrar = registrar;
+ this.flutterInterface = new FlutterInterface();
+ this.delegate = delegate;
}
@Override
- public void onMethodCall(MethodCall call, Result result) {
- if (call.method.equals("getPlatformVersion")) {
- result.success("Android " + android.os.Build.VERSION.RELEASE);
- } else {
- result.notImplemented();
- }
+ public void onMethodCall(MethodCall call, final Result result) {
+ registrar.addActivityResultListener(delegate);
+ ICallback callback = new ICallback