Ver código fonte

v1.0.0开发:修改publish.gradle依赖的publish插件

#Suyghur 3 anos atrás
pai
commit
0a0931f0b8
28 arquivos alterados com 423 adições e 165 exclusões
  1. 3 0
      .gitignore
  2. 20 19
      build.gradle
  3. 3 1
      demo/build.gradle
  4. BIN
      demo/libs/library_core-release.aar
  5. 52 0
      demo/src/main/assets/test.html
  6. 1 1
      gradle/wrapper/gradle-wrapper.properties
  7. 0 1
      library_base/build.gradle
  8. 4 12
      library_core/build.gradle
  9. 77 51
      library_core/publish.gradle
  10. 82 0
      library_core/publish_old.gradle
  11. 9 0
      library_core/src/main/cpp/sdk_drive.cpp
  12. 0 17
      library_core/src/main/cpp/toolkit.cpp
  13. 12 18
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkBridgeImpl.kt
  14. 2 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkDrive.kt
  15. 24 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkJsImpl.kt
  16. 45 3
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/center/HybridActivity.kt
  17. 41 33
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/floatball/FloatCenterService.kt
  18. 5 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/internal/IJsCallback.kt
  19. 1 1
      library_core/src/main/java/cn/yyxx/eyuangame/core/linking/channel/LinkingFacebookImpl.kt
  20. 1 1
      library_core/src/main/java/cn/yyxx/eyuangame/core/network/VolleyRequest.kt
  21. 0 2
      library_core/src/main/java/cn/yyxx/eyuangame/core/ui/floatview/FloatingBall.kt
  22. 12 5
      library_core/src/main/java/cn/yyxx/eyuangame/core/ui/floatview/FloatingBallMenu.kt
  23. 25 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/utils/LocalCacheUtils.kt
  24. 4 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/utils/MMKVUtils.kt
  25. BIN
      libs/dolin_zap_1.0.0.jar
  26. BIN
      libs/eyuangamesdk_base_1.0.0.jar
  27. BIN
      libs/mmkv-static-1.2.8.jar
  28. BIN
      libs/yyxx_support_1.0.1.jar

+ 3 - 0
.gitignore

@@ -5,6 +5,9 @@
 /local.properties
 .DS_Store
 
+# ---> dolin zap log framework
+*.zap
+
 # ---> Android
 # Built application files
 *.apk

+ 20 - 19
build.gradle

@@ -1,24 +1,26 @@
 // Top-level build file where you can add configuration options common to all sub-projects/modules.
 buildscript {
 
-    // demo远程依赖
-    ext.REMOTE_LIBRARY = false
-    // 发布开关
-    ext.PUBLISH_ENABLE = false
-    // 混淆开关
-    ext.MINIFY_ENABLE = true
-    // ndk版本
-    ext.NDK_VERSION = '21.4.7075529'
-    // kotlin版本
-    ext.KOTLIN_VERSION = '1.4.20'
-    // compileSdkVersion
-    ext.COMPILE_SDK_VERSION = 30
-    // buildToolsVersion
-    ext.BUILD_TOOLS_VERSION = '30.0.3'
-    // minSdkVersion
-    ext.MIN_SDK_VERSION = 16
-    // targetSdkVersion
-    ext.TARGET_SDK_VERSION = 30
+    ext {
+        // demo远程依赖
+        REMOTE_LIBRARY = false
+        // 发布开关
+        PUBLISH_ENABLE = false
+        // 混淆开关
+        MINIFY_ENABLE = true
+        // ndk版本
+        NDK_VERSION = '21.4.7075529'
+        // kotlin版本
+        KOTLIN_VERSION = '1.5.21'
+        // compileSdkVersion
+        COMPILE_SDK_VERSION = 30
+        // buildToolsVersion
+        BUILD_TOOLS_VERSION = '30.0.3'
+        // minSdkVersion
+        MIN_SDK_VERSION = 16
+        // targetSdkVersion
+        TARGET_SDK_VERSION = 30
+    }
 
     repositories {
         google()
@@ -28,7 +30,6 @@ buildscript {
     dependencies {
         classpath 'com.android.tools.build:gradle:4.1.3'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
-
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
 

+ 3 - 1
demo/build.gradle

@@ -28,6 +28,8 @@ android {
             keyPassword keystoreProperties['keyPassword']
             storeFile file(keystoreProperties['storeFile'])
             storePassword keystoreProperties['storePassword']
+            v1SigningEnabled true
+            v2SigningEnabled true
         }
     }
 
@@ -73,7 +75,7 @@ dependencies {
 
     if (PUBLISH_ENABLE) {
         if (REMOTE_LIBRARY) {
-            implementation 'io.github.yyxxgame.sdk:eyuangame-sdk-ktx:0.0.1'
+            implementation 'io.github.yyxxgame.sdk:eyuangame-sdk-ktx:1.0.0-alpha3'
         } else {
             api(name: 'library_core-release', ext: 'aar')
 

BIN
demo/libs/library_core-release.aar


+ 52 - 0
demo/src/main/assets/test.html

@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+
+    <!-- Compiled and minified CSS -->
+    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/css/materialize.min.css">
+    <!-- Compiled and minified JavaScript -->
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/js/materialize.min.js"></script>
+    <title>Test</title>
+</head>
+
+<body>
+
+    <div class="container">
+        <!-- 页面内容放在这里 -->
+        <div class="input-field col s6">
+            <input placeholder="输入方法名" id="text1" type="text" class="validate">
+            <input placeholder="输入数据(json字符串)" id="text2" type="text" class="validate">
+        </div>
+        <div class="section">
+            <a class="waves-effect waves-light btn" onclick="callAndroid(false);">js调用Android方法(无返回值)</a>
+        </div>
+        <div class="section">
+            <a class="waves-effect waves-light btn" onclick="callAndroid(true);">js调用Android方法(有返回值)</a>
+        </div>
+
+    </div>
+
+</body>
+<script>
+
+    //js调用Android方法
+    function callAndroid(hasCallback) {
+        var method = document.getElementById("text1").value;
+        var data = document.getElementById("text2").value;
+        if (hasCallback) {
+            //有返回值调用jsCallback()
+            var callback = eyuangame.jsCallback(method, data)
+            alert(callback)
+        } else {
+            //无返回值调用jsInvoke()
+            eyuangame.jsInvoke(method, data)
+        }
+    }
+
+</script>
+
+</html>

+ 1 - 1
gradle/wrapper/gradle-wrapper.properties

@@ -1,4 +1,4 @@
-#Wed Jul 14 18:03:14 CST 2021
+#Thu Jul 29 17:27:52 CST 2021
 distributionBase=GRADLE_USER_HOME
 distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
 distributionPath=wrapper/dists

+ 0 - 1
library_base/build.gradle

@@ -50,7 +50,6 @@ android {
 }
 
 dependencies {
-//    api files('../libs/dolin_zap_1.0.0.jar')
     api files('../libs/yyxx_support_1.0.1.jar')
     implementation 'androidx.core:core-ktx:1.6.0'
     implementation 'io.github.suyghur.dolin:zap:1.0.0'

+ 4 - 12
library_core/build.gradle

@@ -51,13 +51,6 @@ android {
         preDexLibraries = false
     }
 
-
-//    sourceSets {
-//        main {
-//            // let gradle pack the shared library into apk
-//            jniLibs.srcDirs = ['../soLibs']
-//        }
-//    }
     compileOptions {
         kotlinOptions.freeCompilerArgs += ['-module-name', "cn.yyxx.eyuangame.core"]
     }
@@ -82,19 +75,19 @@ dependencies {
     implementation 'io.github.suyghur.dolin:zap:1.0.0'
 
     implementation 'androidx.core:core-ktx:1.6.0'
-    implementation 'androidx.fragment:fragment-ktx:1.3.5'
+    implementation 'androidx.fragment:fragment-ktx:1.3.6'
     implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
     implementation 'com.google.android.material:material:1.4.0'
     implementation 'com.android.installreferrer:installreferrer:2.2'
 
     //google
     implementation 'com.google.android.play:core:1.10.0'
-    implementation 'com.google.android.gms:play-services-auth:19.0.0'
+    implementation 'com.google.android.gms:play-services-auth:19.2.0'
     //4.0.0的billing库消耗商品会回调两次,后续在排查,先用3.0.3
     implementation "com.android.billingclient:billing-ktx:3.0.3"
     implementation 'com.google.firebase:firebase-analytics-ktx:19.0.0'
-    implementation 'com.google.firebase:firebase-crashlytics-ktx:18.1.0'
-    implementation 'com.google.firebase:firebase-crashlytics-ndk:18.1.0'
+    implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.0'
+//    implementation 'com.google.firebase:firebase-crashlytics-ndk:18.2.0'
 
     //facebook
     implementation 'com.facebook.android:facebook-login:9.0.0'
@@ -108,7 +101,6 @@ dependencies {
     } else {
         api project(':library_base')
     }
-
 }
 
 apply from: 'publish.gradle'

+ 77 - 51
library_core/publish.gradle

@@ -1,9 +1,11 @@
-apply plugin: 'maven'
+apply plugin: 'maven-publish'
 apply plugin: 'signing'
 
-def PUBLISH_GROUP_ID = "io.github.yyxxgame.sdk"
-def PUBLISH_ARTIFACT_ID = "eyuangame-sdk-ktx"
-def PUBLISH_VERSION = "1.0.0-alpha2"
+ext {
+    PUBLISH_GROUP_ID = 'io.github.yyxxgame.sdk'
+    PUBLISH_ARTIFACT_ID = 'eyuangame-sdk-ktx'
+    PUBLISH_VERSION = '1.0.0-alpha4'
+}
 
 Properties properties = new Properties()
 properties.load(project.rootProject.file('local.properties').newDataInputStream())
@@ -18,65 +20,89 @@ task androidSourcesJar(type: Jar) {
     } else {
         form sourceSets.main.java.srcDirs
     }
+    exclude "**/R.class"
+    exclude "**/BuildConfig.class"
 }
 
-artifacts {
-    archives androidSourcesJar
-}
-
-signing {
-    required {
-        gradle.taskGraph.hasTask("uploadArchives")
-    }
-    sign configurations.archives
-}
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            beforeDeployment {
-                MavenDeployment deployment -> signing.signPom(deployment)
-            }
+publishing {
+    publications {
+        release(MavenPublication) {
+            // The coordinates of the library, being set from variables that
+            // we'll set up in a moment
+            groupId PUBLISH_GROUP_ID
+            artifactId PUBLISH_ARTIFACT_ID
+            version PUBLISH_VERSION
 
-            repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
-                authentication(userName: ossrhUsername, password: ossrhPassword)
-            }
-
-            snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
-                authentication(userName: ossrhUsername, password: ossrhPassword)
-            }
-
-            pom.groupId = PUBLISH_GROUP_ID
-            pom.artifactId = PUBLISH_ARTIFACT_ID
-            pom.version = PUBLISH_VERSION
-
-            pom.project {
-                name "${PUBLISH_GROUP_ID}:${PUBLISH_ARTIFACT_ID}"
-                packaging 'aar'
-                description 'game sdk of EYuan'
-                url 'https://github.com/yyxxgame'
-
-                scm {
-                    connection 'scm:git:ogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
-                    developerConnection 'scm:git:ssh://gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
-                    url 'http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX'
-                }
+            // Two artifacts, the `aar` and the sources
+            artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
+            artifact androidSourcesJar
 
+            // Self-explanatory metadata for the most part
+            pom {
+                name = "${PUBLISH_GROUP_ID}:${PUBLISH_ARTIFACT_ID}"
+                description = 'game sdk of eyuan'
+                // If your project has a dedicated site, use its URL here
+                url = 'https://github.com/yyxxgame'
                 licenses {
                     license {
-                        name 'The Apache License, Version 2.0'
-                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+                        //协议类型,一般默认Apache License2.0的话不用改:
+                        name = 'The Apache License, Version 2.0'
+                        url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                     }
                 }
-
                 developers {
                     developer {
-                        id 'yyxxgame'
-                        name 'yyxxgame'
-                        email 'developcentre@yyxxgame.com'
+                        id = 'yyxxgame'
+                        name = 'yyxxgame'
+                        email = 'developcentre@yyxxgame.com'
+                    }
+                }
+                // Version control info, if you're using GitHub, follow the format as seen here
+                scm {
+                    //修改成你的Git地址:
+                    connection = 'scm:git:gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
+                    developerConnection = 'scm:git:ssh://gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
+                    //分支地址:
+                    url = 'http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX'
+                }
+                // A slightly hacky fix so that your POM will include any transitive dependencies
+                // that your library builds upon
+                withXml {
+                    def dependenciesNode = asNode().appendNode('dependencies')
+
+                    project.configurations.implementation.allDependencies.each {
+                        def dependencyNode = dependenciesNode.appendNode('dependency')
+                        dependencyNode.appendNode('groupId', it.group)
+                        dependencyNode.appendNode('artifactId', it.name)
+                        dependencyNode.appendNode('version', it.version)
                     }
                 }
             }
         }
     }
-}
+    repositories {
+        // The repository to publish to, Sonatype/MavenCentral
+        maven {
+            // This is an arbitrary name, you may also use "mavencentral" or
+            // any other name that's descriptive for you
+            name = "mavencentral"
+
+            def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
+            def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
+            // You only need this if you want to publish snapshots, otherwise just set the URL
+            // to the release repo directly
+            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
+
+            // The username and password we've fetched earlier
+            credentials {
+                username ossrhUsername
+                password ossrhPassword
+            }
+        }
+    }
+}
+signing {
+    sign publishing.publications
+}
+
+publishReleasePublicationToMavencentralRepository.dependsOn(assemble)

+ 82 - 0
library_core/publish_old.gradle

@@ -0,0 +1,82 @@
+apply plugin: 'maven'
+apply plugin: 'signing'
+
+def PUBLISH_GROUP_ID = "io.github.yyxxgame.sdk"
+def PUBLISH_ARTIFACT_ID = "eyuangame-sdk-ktx"
+def PUBLISH_VERSION = "1.0.0-alpha4"
+
+Properties properties = new Properties()
+properties.load(project.rootProject.file('local.properties').newDataInputStream())
+
+def ossrhUsername = properties.getProperty("SonaType.user")
+def ossrhPassword = properties.getProperty("SonaType.pwd")
+
+task androidSourcesJar(type: Jar) {
+    archiveClassifier.set('source')
+    if (project.plugins.findPlugin('com.android.library')) {
+        from android.sourceSets.main.java.srcDirs
+    } else {
+        form sourceSets.main.java.srcDirs
+    }
+}
+
+artifacts {
+    archives androidSourcesJar
+}
+
+signing {
+    required {
+        gradle.taskGraph.hasTask("uploadArchives")
+    }
+    sign configurations.archives
+}
+
+uploadArchives {
+    repositories {
+        mavenDeployer {
+            beforeDeployment {
+                MavenDeployment deployment -> signing.signPom(deployment)
+            }
+
+            repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
+                authentication(userName: ossrhUsername, password: ossrhPassword)
+            }
+
+            snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
+                authentication(userName: ossrhUsername, password: ossrhPassword)
+            }
+
+            pom.groupId = PUBLISH_GROUP_ID
+            pom.artifactId = PUBLISH_ARTIFACT_ID
+            pom.version = PUBLISH_VERSION
+
+            pom.project {
+                name "${PUBLISH_GROUP_ID}:${PUBLISH_ARTIFACT_ID}"
+                packaging 'aar'
+                description 'game sdk of EYuan'
+                url 'https://github.com/yyxxgame'
+
+                scm {
+                    connection 'scm:git:ogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
+                    developerConnection 'scm:git:ssh://gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
+                    url 'http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX'
+                }
+
+                licenses {
+                    license {
+                        name 'The Apache License, Version 2.0'
+                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+                    }
+                }
+
+                developers {
+                    developer {
+                        id 'yyxxgame'
+                        name 'yyxxgame'
+                        email 'developcentre@yyxxgame.com'
+                    }
+                }
+            }
+        }
+    }
+}

+ 9 - 0
library_core/src/main/cpp/sdk_drive.cpp

@@ -66,6 +66,13 @@ static jstring ParseJob(JNIEnv *env, jobject thiz, jobject context, jstring key,
     return result;
 }
 
+static jstring GetComm(JNIEnv *env, jobject thiz, jobject context) {
+    Json::Value root;
+    root["common"] = CommMap::GetInstance()->comm_params;
+    jstring data = ToolKit::GetJString(env, ToolKit::ToJsonString(root).c_str());
+    return data;
+}
+
 
 static JNINativeMethod gMethod[] = {
         {"initSdkDrive", "(Landroid/content/Context;)V",                                                      (void *) InitSdkDrive},
@@ -73,6 +80,8 @@ static JNINativeMethod gMethod[] = {
         {"getParam",     "(Ljava/lang/String;)Ljava/lang/String;",                                            (void *) GetParam},
         {"invokeJob",    "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) InvokeJob},
         {"parseJob",     "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) ParseJob},
+        {"getComm",      "(Landroid/content/Context;)Ljava/lang/String;",                                     (void *) GetComm},
+
 };
 
 extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {

+ 0 - 17
library_core/src/main/cpp/toolkit.cpp

@@ -75,8 +75,6 @@ std::string ToolKit::GetPackageName(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallObjectMethod(context, mid);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -91,8 +89,6 @@ std::string ToolKit::GetServerVersion(JNIEnv *env) {
     jfieldID fid = env->GetStaticFieldID(clz, field_name, sig);
     auto result = (jstring) env->GetStaticObjectField(clz, fid);
     env->DeleteLocalRef(clz);
-//    free((void *) field_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -107,8 +103,6 @@ std::string ToolKit::GetClientVersion(JNIEnv *env) {
     jfieldID fid = env->GetStaticFieldID(clz, field_name, sig);
     auto result = (jstring) env->GetStaticObjectField(clz, fid);
     env->DeleteLocalRef(clz);
-//    free((void *) field_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -123,8 +117,6 @@ std::string ToolKit::GetVersionName(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallStaticObjectMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -139,8 +131,6 @@ std::string ToolKit::GetVersionCode(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallStaticObjectMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -155,8 +145,6 @@ std::string ToolKit::GetAndroidDeviceId(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallStaticObjectMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -171,8 +159,6 @@ int ToolKit::GetNetworkType(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallStaticObjectMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return String2Int(JString2String(env, result));
 }
 
@@ -219,8 +205,6 @@ bool ToolKit::IsEmulator(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jboolean) env->CallStaticBooleanMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return result == JNI_TRUE;
 }
 
@@ -254,7 +238,6 @@ char *ToolKit::StrReverse(const char *src) {
         *tmp++ = *p;
         *p-- = t;
     }
-//    free(p);
     return ret;
 }
 

+ 12 - 18
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkBridgeImpl.kt

@@ -188,29 +188,22 @@ class SdkBridgeImpl(context: Context) {
 
 
     private fun cacheImageResource(activity: Activity) {
-        //浮标icon
-        initBean.floatCfg.floatIconUrl =
-            "http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX/raw/eb71e59d47ea88a5200cfe691e550334b38fff48/library_core/src/main/res/drawable-xhdpi/yyxx_float_logo_img.png"
-        initBean.floatCfg.floatIconLeftUrl =
-            "http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX/raw/eb71e59d47ea88a5200cfe691e550334b38fff48/library_core/src/main/res/drawable-xhdpi/yyxx_float_logo_left_img.png"
-        initBean.floatCfg.floatIconRightUrl =
-            "http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX/raw/eb71e59d47ea88a5200cfe691e550334b38fff48/library_core/src/main/res/drawable-xhdpi/yyxx_float_logo_right_img.png"
-
+        //全图标
         SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
         //左边
         SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconLeftUrl)
         //右边
         SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconRightUrl)
-//        //会员中心
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
-//        //礼包
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
-//        //客服
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
-//        //储值
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
-//        //邀请
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //会员中心
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //礼包
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //客服
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //储值
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //邀请
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
     }
 
     private fun showInitDialog(activity: Activity, callback: ICallback, initCallback: IInitialize) {
@@ -420,6 +413,7 @@ class SdkBridgeImpl(context: Context) {
         Logger.i("EYuanGameSdk onDestroy ...")
         FloatCenterServiceManager.instance.release()
         Linking.instance.release()
+        MMKVUtils.instance.release()
     }
 
     fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, intent: Intent) {

+ 2 - 0
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkDrive.kt

@@ -22,6 +22,8 @@ class SdkDrive {
 
     external fun parseJob(context: Context, key: String, data: String): String
 
+    external fun getComm(context: Context): String
+
     companion object {
         val instance: SdkDrive by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
             SdkDrive()

+ 24 - 0
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkJsImpl.kt

@@ -0,0 +1,24 @@
+package cn.yyxx.eyuangame.core.impl
+
+import android.webkit.JavascriptInterface
+import cn.yyxx.eyuangame.base.utils.Logger
+import cn.yyxx.eyuangame.core.internal.IJsCallback
+
+/**
+ * @author #Suyghur.
+ * Created on 2021/07/28
+ */
+class SdkJsImpl(val callback: IJsCallback) {
+
+    @JavascriptInterface
+    fun jsInvoke(method: String, data: String) {
+        Logger.d("jsInvoke method : $method , data : $data")
+        callback.onInvoke(method, data)
+    }
+
+    @JavascriptInterface
+    fun jsCallback(method: String, data: String): String {
+        Logger.d("jsCallback method : $method , data : $data")
+        return callback.onCallback(method, data)
+    }
+}

+ 45 - 3
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/center/HybridActivity.kt

@@ -12,21 +12,41 @@ import android.webkit.*
 import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.TextView
+import cn.yyxx.eyuangame.core.entity.ClickType
 import cn.yyxx.eyuangame.core.impl.SdkBridgeImpl
+import cn.yyxx.eyuangame.core.impl.SdkDrive
+import cn.yyxx.eyuangame.core.impl.SdkJsImpl
+import cn.yyxx.eyuangame.core.internal.IJsCallback
 import cn.yyxx.support.AndroidBug5497Workaround
 import cn.yyxx.support.ResUtils
 import cn.yyxx.support.device.DeviceInfoUtils
+import cn.yyxx.support.hawkeye.ToastUtils
 
 /**
  * @author #Suyghur.
  * Created on 2021/07/02
  */
-class HybridActivity : Activity() {
+class HybridActivity : Activity(), View.OnClickListener {
 
     private lateinit var ivReturn: ImageView
     private lateinit var tvTitle: TextView
     private lateinit var webView: WebView
 
+    private val callback = object : IJsCallback {
+
+        override fun onInvoke(method: String, data: String) {
+            ToastUtils.toastInfo(this@HybridActivity, "调用Android原生方法$method")
+        }
+
+        override fun onCallback(method: String, data: String): String {
+            return when (method) {
+                "getComm" -> SdkDrive.instance.getComm(this@HybridActivity)
+                else -> ""
+            }
+        }
+
+    }
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
 
@@ -46,6 +66,10 @@ class HybridActivity : Activity() {
 
         tvTitle = findViewById(ResUtils.getResId(this, "yyxx_tv_title", "id"))
         ivReturn = findViewById(ResUtils.getResId(this, "yyxx_iv_return", "id"))
+        ivReturn.apply {
+            tag = ClickType.ACTION_RETURN
+            setOnClickListener(this@HybridActivity)
+        }
     }
 
 
@@ -53,7 +77,7 @@ class HybridActivity : Activity() {
         webView = WebView(this)
         webView.isVerticalScrollBarEnabled = true
         webView.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY
-//        webView.addJavascriptInterface(SdkJsImpl(this, callback), "FlyFunSdk")
+        webView.addJavascriptInterface(SdkJsImpl(callback), "eyuangame")
         val container = findViewById<FrameLayout>(ResUtils.getResId(this, "yyxx_webview_container", "id"))
         container.addView(webView)
 
@@ -88,7 +112,7 @@ class HybridActivity : Activity() {
 
         if (DeviceInfoUtils.isNetworkConnected(this)) {
             webView.loadUrl(url)
-            //webView.loadUrl("file:///android_asset/test.html");
+//            webView.loadUrl("file:///android_asset/test.html");
         } else {
             //这种写法可以正确解码
             webView.loadData("网络异常,请检查重试", "text/html; charset=UTF-8", null)
@@ -162,6 +186,23 @@ class HybridActivity : Activity() {
         }
     }
 
+    override fun onResume() {
+        super.onResume()
+    }
+
+    override fun onDestroy() {
+        super.onDestroy()
+    }
+
+
+    override fun onClick(v: View?) {
+        v?.apply {
+            when (tag as Int) {
+                ClickType.ACTION_RETURN -> this@HybridActivity.finish()
+            }
+        }
+    }
+
     companion object {
 
         private var url = ""
@@ -173,4 +214,5 @@ class HybridActivity : Activity() {
 
 
     }
+
 }

+ 41 - 33
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/floatball/FloatCenterService.kt

@@ -2,10 +2,7 @@ package cn.yyxx.eyuangame.core.impl.floatball
 
 import android.app.Activity
 import android.app.Service
-import android.content.Context
 import android.content.Intent
-import android.graphics.Bitmap
-import android.graphics.BitmapFactory
 import android.os.Binder
 import android.os.IBinder
 import android.text.TextUtils
@@ -16,10 +13,9 @@ import cn.yyxx.eyuangame.core.impl.center.HybridActivity
 import cn.yyxx.eyuangame.core.impl.center.MemberActivity
 import cn.yyxx.eyuangame.core.ui.floatview.FloatingBall
 import cn.yyxx.eyuangame.core.ui.floatview.FloatingBallMenu
+import cn.yyxx.eyuangame.core.utils.LocalCacheUtils
 import cn.yyxx.support.ResUtils
 import cn.yyxx.support.encryption.Md5Utils
-import java.io.FileInputStream
-import java.io.FileNotFoundException
 
 /**
  * @author #Suyghur.
@@ -40,7 +36,7 @@ class FloatCenterService : Service() {
                         ballView.setBackgroundResource(resId)
                     } else {
                         val name = Md5Utils.encodeByMD5(SdkBridgeImpl.initBean.floatCfg.floatIconLeftUrl)
-                        ballView.setImageBitmap(getLocalBitmap(mActivity!!, name))
+                        ballView.setImageBitmap(LocalCacheUtils.getLocalBitmap(mActivity!!, name))
                     }
                 } else {
                     if (TextUtils.isEmpty(SdkBridgeImpl.initBean.floatCfg.floatIconRightUrl)) {
@@ -48,7 +44,7 @@ class FloatCenterService : Service() {
                         ballView.setBackgroundResource(resId)
                     } else {
                         val name = Md5Utils.encodeByMD5(SdkBridgeImpl.initBean.floatCfg.floatIconRightUrl)
-                        ballView.setImageBitmap(getLocalBitmap(mActivity!!, name))
+                        ballView.setImageBitmap(LocalCacheUtils.getLocalBitmap(mActivity!!, name))
                     }
                 }
             } else {
@@ -58,7 +54,7 @@ class FloatCenterService : Service() {
                     ballView.setBackgroundResource(resId)
                 } else {
                     val name = Md5Utils.encodeByMD5(SdkBridgeImpl.initBean.floatCfg.floatIconUrl)
-                    ballView.setImageBitmap(getLocalBitmap(mActivity!!, name))
+                    ballView.setImageBitmap(LocalCacheUtils.getLocalBitmap(mActivity!!, name))
                 }
             }
         }
@@ -66,19 +62,43 @@ class FloatCenterService : Service() {
         override fun onInitMenuData(): MutableList<FloatingBallMenu.FloatingBallMenuItem> {
             val items = mutableListOf<FloatingBallMenu.FloatingBallMenuItem>()
             if (SdkBridgeImpl.initBean.floatCfg.memberCfg.switch == 1) {
-                items.add(FloatingBallMenu.FloatingBallMenuItem(FloatFeature.FEATURE_MEMBER, "", ""))
+                items.add(FloatingBallMenu.FloatingBallMenuItem(FloatFeature.FEATURE_MEMBER, SdkBridgeImpl.initBean.floatCfg.memberCfg.iconUrl, ""))
             }
-            if (SdkBridgeImpl.initBean.floatCfg.gifCfg.switch == 1) {
-                items.add(FloatingBallMenu.FloatingBallMenuItem(FloatFeature.FEATURE_GIF, "", ""))
+            if (SdkBridgeImpl.initBean.floatCfg.gifCfg.switch == 1 && !TextUtils.isEmpty(SdkBridgeImpl.initBean.floatCfg.gifCfg.url)) {
+                items.add(
+                    FloatingBallMenu.FloatingBallMenuItem(
+                        FloatFeature.FEATURE_GIF,
+                        SdkBridgeImpl.initBean.floatCfg.gifCfg.iconUrl,
+                        SdkBridgeImpl.initBean.floatCfg.gifCfg.url
+                    )
+                )
             }
-            if (SdkBridgeImpl.initBean.floatCfg.gmCfg.switch == 1) {
-                items.add(FloatingBallMenu.FloatingBallMenuItem(FloatFeature.FEATURE_GM, "", ""))
+            if (SdkBridgeImpl.initBean.floatCfg.gmCfg.switch == 1 && !TextUtils.isEmpty(SdkBridgeImpl.initBean.floatCfg.gmCfg.url)) {
+                items.add(
+                    FloatingBallMenu.FloatingBallMenuItem(
+                        FloatFeature.FEATURE_GM,
+                        SdkBridgeImpl.initBean.floatCfg.gmCfg.iconUrl,
+                        SdkBridgeImpl.initBean.floatCfg.gmCfg.url
+                    )
+                )
             }
-            if (SdkBridgeImpl.initBean.floatCfg.chargeCfg.switch == 1) {
-                items.add(FloatingBallMenu.FloatingBallMenuItem(FloatFeature.FEATURE_CHARGE, "", ""))
+            if (SdkBridgeImpl.initBean.floatCfg.chargeCfg.switch == 1 && !TextUtils.isEmpty(SdkBridgeImpl.initBean.floatCfg.chargeCfg.url)) {
+                items.add(
+                    FloatingBallMenu.FloatingBallMenuItem(
+                        FloatFeature.FEATURE_CHARGE,
+                        SdkBridgeImpl.initBean.floatCfg.chargeCfg.iconUrl,
+                        SdkBridgeImpl.initBean.floatCfg.chargeCfg.url
+                    )
+                )
             }
-            if (SdkBridgeImpl.initBean.floatCfg.inviteCfg.switch == 1) {
-                items.add(FloatingBallMenu.FloatingBallMenuItem(FloatFeature.FEATURE_INVITE, "", ""))
+            if (SdkBridgeImpl.initBean.floatCfg.inviteCfg.switch == 1 && !TextUtils.isEmpty(SdkBridgeImpl.initBean.floatCfg.inviteCfg.url)) {
+                items.add(
+                    FloatingBallMenu.FloatingBallMenuItem(
+                        FloatFeature.FEATURE_INVITE,
+                        SdkBridgeImpl.initBean.floatCfg.inviteCfg.iconUrl,
+                        SdkBridgeImpl.initBean.floatCfg.inviteCfg.url
+                    )
+                )
             }
             return items
         }
@@ -86,10 +106,10 @@ class FloatCenterService : Service() {
         override fun onMenuItemClick(item: FloatingBallMenu.FloatingBallMenuItem, pos: Int) {
             when (item.type) {
                 FloatFeature.FEATURE_MEMBER -> MemberActivity.start(mActivity!!)
-                FloatFeature.FEATURE_GIF -> HybridActivity.start(mActivity!!, SdkBridgeImpl.initBean.floatCfg.gifCfg.url)
-                FloatFeature.FEATURE_GM -> HybridActivity.start(mActivity!!, SdkBridgeImpl.initBean.floatCfg.gmCfg.url)
-                FloatFeature.FEATURE_CHARGE -> HybridActivity.start(mActivity!!, SdkBridgeImpl.initBean.floatCfg.chargeCfg.url)
-                FloatFeature.FEATURE_INVITE -> HybridActivity.start(mActivity!!, SdkBridgeImpl.initBean.floatCfg.inviteCfg.url)
+                FloatFeature.FEATURE_GIF -> HybridActivity.start(mActivity!!, item.url)
+                FloatFeature.FEATURE_GM -> HybridActivity.start(mActivity!!, item.url)
+                FloatFeature.FEATURE_CHARGE -> HybridActivity.start(mActivity!!, item.url)
+                FloatFeature.FEATURE_INVITE -> HybridActivity.start(mActivity!!, item.url)
             }
         }
 
@@ -128,18 +148,6 @@ class FloatCenterService : Service() {
         floatingBall?.release()
     }
 
-
-    private fun getLocalBitmap(context: Context, name: String): Bitmap? {
-        try {
-            val path = "${context.getExternalFilesDir("cache")!!.absolutePath}/$name"
-            val fis = FileInputStream(path)
-            return BitmapFactory.decodeStream(fis)
-        } catch (e: FileNotFoundException) {
-            e.printStackTrace()
-        }
-        return null
-    }
-
     override fun onBind(intent: Intent?): IBinder {
         return FloatCenterServiceBinder()
     }

+ 5 - 0
library_core/src/main/java/cn/yyxx/eyuangame/core/internal/IJsCallback.kt

@@ -5,4 +5,9 @@ package cn.yyxx.eyuangame.core.internal
  * Created on 2021/07/09
  */
 interface IJsCallback {
+
+    fun onInvoke(method: String, data: String)
+
+    fun onCallback(method: String, data: String): String
+
 }

+ 1 - 1
library_core/src/main/java/cn/yyxx/eyuangame/core/linking/channel/LinkingFacebookImpl.kt

@@ -135,7 +135,7 @@ class LinkingFacebookImpl : IEventObserver {
             return
         }
         fbLogger.logEvent("enter_game")
-        Logger.d("facebook log create player success")
+        Logger.d("facebook log enter player success")
     }
 
     override fun onCreate(activity: Activity) {

+ 1 - 1
library_core/src/main/java/cn/yyxx/eyuangame/core/network/VolleyRequest.kt

@@ -80,7 +80,7 @@ object VolleyRequest {
 //                            SdkDrive.parseJob(context, responseObj.toString())
                             parseResponse(context, it.getJSONObject("data"))
                         } else {
-                            ""
+                            "{}"
                         }
                     } catch (e: JSONException) {
                         e.printStackTrace()

+ 0 - 2
library_core/src/main/java/cn/yyxx/eyuangame/core/ui/floatview/FloatingBall.kt

@@ -59,8 +59,6 @@ class FloatingBall(val activity: Activity, private val isLandscape: Boolean, pri
     private var hasStatusBar = false
 
     private var displayWorker: ScheduledWorker? = null
-//    private var displayWorker: ScheduledWorker? = null
-
 
     private val timerHandler = object : Handler(Looper.getMainLooper()) {
         override fun handleMessage(msg: Message) {

+ 12 - 5
library_core/src/main/java/cn/yyxx/eyuangame/core/ui/floatview/FloatingBallMenu.kt

@@ -8,8 +8,10 @@ import android.view.View
 import android.view.ViewGroup
 import android.widget.*
 import cn.yyxx.eyuangame.core.entity.FloatFeature
+import cn.yyxx.eyuangame.core.utils.LocalCacheUtils
 import cn.yyxx.support.DensityUtils
 import cn.yyxx.support.ResUtils
+import cn.yyxx.support.encryption.Md5Utils
 
 /**
  * @author #Suyghur.
@@ -92,7 +94,8 @@ class FloatingBallMenu(val context: Context, private val callback: FloatingBallM
                     if (TextUtils.isEmpty(item.iconUrl)) {
                         ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_member_img", "drawable"))
                     } else {
-                        ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_member_img", "drawable"))
+                        val name = Md5Utils.encodeByMD5(item.iconUrl)
+                        ivIcon.setImageBitmap(LocalCacheUtils.getLocalBitmap(context, name))
                     }
                     tvDesc.text = ResUtils.getResString(context, "yyxx_tv_float_member_desc")
                 }
@@ -101,7 +104,8 @@ class FloatingBallMenu(val context: Context, private val callback: FloatingBallM
                     if (TextUtils.isEmpty(item.iconUrl)) {
                         ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_gif_img", "drawable"))
                     } else {
-                        ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_gif_img", "drawable"))
+                        val name = Md5Utils.encodeByMD5(item.iconUrl)
+                        ivIcon.setImageBitmap(LocalCacheUtils.getLocalBitmap(context, name))
                     }
                     tvDesc.text = ResUtils.getResString(context, "yyxx_tv_float_gif_desc")
                 }
@@ -110,7 +114,8 @@ class FloatingBallMenu(val context: Context, private val callback: FloatingBallM
                     if (TextUtils.isEmpty(item.iconUrl)) {
                         ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_gm_img", "drawable"))
                     } else {
-                        ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_gm_img", "drawable"))
+                        val name = Md5Utils.encodeByMD5(item.iconUrl)
+                        ivIcon.setImageBitmap(LocalCacheUtils.getLocalBitmap(context, name))
                     }
                     tvDesc.text = ResUtils.getResString(context, "yyxx_tv_float_gm_desc")
                 }
@@ -119,7 +124,8 @@ class FloatingBallMenu(val context: Context, private val callback: FloatingBallM
                     if (TextUtils.isEmpty(item.iconUrl)) {
                         ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_charge_img", "drawable"))
                     } else {
-                        ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_charge_img", "drawable"))
+                        val name = Md5Utils.encodeByMD5(item.iconUrl)
+                        ivIcon.setImageBitmap(LocalCacheUtils.getLocalBitmap(context, name))
                     }
                     tvDesc.text = ResUtils.getResString(context, "yyxx_tv_float_charge_desc")
                 }
@@ -128,7 +134,8 @@ class FloatingBallMenu(val context: Context, private val callback: FloatingBallM
                     if (TextUtils.isEmpty(item.iconUrl)) {
                         ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_invite_img", "drawable"))
                     } else {
-                        ivIcon.setBackgroundResource(ResUtils.getResId(context, "yyxx_float_invite_img", "drawable"))
+                        val name = Md5Utils.encodeByMD5(item.iconUrl)
+                        ivIcon.setImageBitmap(LocalCacheUtils.getLocalBitmap(context, name))
                     }
                     tvDesc.text = ResUtils.getResString(context, "yyxx_tv_float_invite_desc")
                 }

+ 25 - 0
library_core/src/main/java/cn/yyxx/eyuangame/core/utils/LocalCacheUtils.kt

@@ -0,0 +1,25 @@
+package cn.yyxx.eyuangame.core.utils
+
+import android.content.Context
+import android.graphics.Bitmap
+import android.graphics.BitmapFactory
+import java.io.FileInputStream
+import java.io.FileNotFoundException
+
+/**
+ * @author #Suyghur.
+ * Created on 2021/07/28
+ */
+object LocalCacheUtils {
+
+    fun getLocalBitmap(context: Context, name: String): Bitmap? {
+        try {
+            val path = "${context.getExternalFilesDir("cache")!!.absolutePath}/$name"
+            val fis = FileInputStream(path)
+            return BitmapFactory.decodeStream(fis)
+        } catch (e: FileNotFoundException) {
+            e.printStackTrace()
+        }
+        return null
+    }
+}

+ 4 - 0
library_core/src/main/java/cn/yyxx/eyuangame/core/utils/MMKVUtils.kt

@@ -28,6 +28,10 @@ class MMKVUtils private constructor() : MMKVHandler {
         eventKV = MMKV.mmkvWithID("event_info")
     }
 
+    fun release() {
+        MMKV.unregisterHandler()
+    }
+
     override fun onMMKVCRCCheckFail(mmapID: String?): MMKVRecoverStrategic {
         return MMKVRecoverStrategic.OnErrorDiscard
     }

BIN
libs/dolin_zap_1.0.0.jar


BIN
libs/eyuangamesdk_base_1.0.0.jar


BIN
libs/mmkv-static-1.2.8.jar


BIN
libs/yyxx_support_1.0.1.jar