浏览代码

v1.0.0开发:整合eyuangame的代码

#Suyghur 2 年之前
父节点
当前提交
0d224765a6
共有 78 个文件被更改,包括 999 次插入1567 次删除
  1. 7 3
      demo/src/main/assets/yyxx_game/yyxx_comm.properties
  2. 0 1
      library_base/.gitignore
  3. 0 61
      library_base/build.gradle
  4. 0 21
      library_base/proguard-rules.pro
  5. 0 110
      library_base/publish.gradle
  6. 0 8
      library_base/src/main/AndroidManifest.xml
  7. 2 2
      library_comm/proguard-rules.pro
  8. 2 2
      library_comm/src/main/cpp/comm_map.cpp
  9. 1 1
      library_comm/src/main/cpp/eyuancomm.cpp
  10. 0 2
      library_comm/src/main/cpp/include/aes/aes_utils.h
  11. 4 4
      library_comm/src/main/cpp/include/params_kit.h
  12. 4 4
      library_comm/src/main/cpp/params_kit.cpp
  13. 1 1
      library_comm/src/main/cpp/toolkit.cpp
  14. 2 2
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/EYuanCommInstaller.kt
  15. 3 3
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/ChannelId.kt
  16. 1 0
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/Function.kt
  17. 1 0
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/SdkChargeInfo.kt
  18. 8 6
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/impl/CommSdkDrive.kt
  19. 82 67
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/impl/CommSdkImpl.kt
  20. 4 5
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/impl/SdkProxyManager.kt
  21. 1 1
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/internal/ITrace.kt
  22. 11 0
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/internal/feature/IConfig.kt
  23. 6 5
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/internal/feature/IFeature.kt
  24. 2 1
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/internal/feature/IFloatBall.kt
  25. 20 2
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/network/Host.kt
  26. 4 4
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/network/SdkRequest.kt
  27. 5 5
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/network/VolleyRequest.kt
  28. 0 8
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/trace/channel/AdjustEventTrace.kt
  29. 7 7
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/utils/MMKVHandler.kt
  30. 48 6
      library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/utils/ParamsUtils.kt
  31. 14 22
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/ImplSdkProxy.kt
  32. 3 3
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/SdkGenerator.kt
  33. 0 104
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/eyuan/ChannelSdkEYuan.kt
  34. 107 0
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/eyuangame/ChannelSdkEYuanGame.kt
  35. 16 15
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/ChannelSdkHuawei.kt
  36. 1 1
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/HuaweiInAppPay.kt
  37. 1 1
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/HuaweiLinkDialog.kt
  38. 1 1
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/HuaweiLoginDialog.kt
  39. 4 4
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/floatview/FloatCenterService.kt
  40. 10 9
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/floatview/FloatCenterServiceManager.kt
  41. 19 19
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/oppo/ChannelSdkOppo.kt
  42. 12 11
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/vivo/ChannelSdkVivo.kt
  43. 5 5
      module_eyuan/library_eyuan/CMakeLists.txt
  44. 11 11
      module_eyuan/library_eyuan/build.gradle
  45. 23 114
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/EYuanGameSdk.kt
  46. 0 22
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/entity/ResultInfo.kt
  47. 0 29
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/entity/SdkChargeInfo.kt
  48. 0 23
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/entity/SdkRoleInfo.kt
  49. 21 21
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/GameSdkDrive.kt
  50. 27 162
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/GameSdkImpl.kt
  51. 1 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/BindAccountContainer.kt
  52. 1 2
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/BindEmailContainer.kt
  53. 1 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/BindPhoneContainer.kt
  54. 4 6
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/HybridFeatureContainer.kt
  55. 1 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/MemberCenterContainer.kt
  56. 1 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/ModifyPwdContainer.kt
  57. 1 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/floatball/FloatCenterService.kt
  58. 44 80
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/iab/ChargeImpl.kt
  59. 2 2
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/login/LoginActivity.kt
  60. 1 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/login/UserSignInImpl.kt
  61. 2 3
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/login/fragment/LauncherFragment.kt
  62. 1 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/login/fragment/RegisterFragment.kt
  63. 0 10
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/internal/ICallback.kt
  64. 1 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/internal/ITrace.kt
  65. 85 89
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/network/Host.kt
  66. 65 64
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/network/SdkRequest.kt
  67. 244 245
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/network/VolleyRequest.kt
  68. 1 1
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/trace/TraceEventManager.kt
  69. 7 7
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/trace/channel/TraceAdjustImpl.kt
  70. 6 6
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/trace/channel/TraceFacebookImpl.kt
  71. 6 6
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/trace/channel/TraceFirebaseImpl.kt
  72. 0 98
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/utils/ParamsUtils.kt
  73. 5 5
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/utils/SessionUtils.kt
  74. 12 11
      module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/widget/dialog/ChooseLoginDialog.kt
  75. 2 2
      module_eyuan/library_eyuan/src/main/res/layout/yyxx_login_launcher.xml
  76. 2 1
      module_eyuan/library_eyuan/src/main/res/layout/yyxx_login_register.xml
  77. 1 1
      module_eyuan/library_hk_language/src/main/AndroidManifest.xml
  78. 1 1
      module_eyuan/library_vn_language/src/main/AndroidManifest.xml

+ 7 - 3
demo/src/main/assets/yyxx_game/yyxx_comm.properties

@@ -1,7 +1,11 @@
 # 融合应用编号
-YYXX_COMM_GCP_CODE=Y010401
-YYXX_COMM_GAME_CODE=100001
+YYXX_GCP_CODE=Y010402
+YYXX_GAME_CODE=100001
 # 渠道Id
-YYXX_CHANNEL_ID=2
+YYXX_CHANNEL_ID=4
+# Google Server Client Id
+YYXX_GOOGLE_CLIENT_ID=70429070957-7clr9u565jrjgbgg474ksg8q2esq2okj.apps.googleusercontent.com
+# 事件打点应用ID
+YYXX_ADJUST_APP_ID=q1lh43zvrv9c
 # debug模式(cp出正式包请关闭)
 YYXX_OWN_DEBUG=true

+ 0 - 1
library_base/.gitignore

@@ -1 +0,0 @@
-/build

+ 0 - 61
library_base/build.gradle

@@ -1,61 +0,0 @@
-plugins {
-    id 'com.android.library'
-    id 'kotlin-android'
-}
-
-android {
-    compileSdk rootProject.ext.android.compileSdk
-    buildToolsVersion rootProject.ext.android.buildToolsVersion
-
-    defaultConfig {
-        minSdk rootProject.ext.android.minSdk
-        targetSdk rootProject.ext.android.targetSdk
-    }
-
-    buildTypes {
-        release {
-            minifyEnabled false
-            proguardFiles 'proguard-rules.pro'
-        }
-    }
-
-    buildFeatures {
-        buildConfig false
-    }
-
-    lintOptions {
-        abortOnError false
-    }
-
-    compileOptions {
-        kotlinOptions.freeCompilerArgs += ['-module-name', "cn.yyxx.eyuancomm.base"]
-    }
-
-    compileOptions {
-        sourceCompatibility JavaVersion.VERSION_1_8
-        targetCompatibility JavaVersion.VERSION_1_8
-    }
-
-    kotlinOptions {
-        jvmTarget = "1.8"
-    }
-}
-
-dependencies {
-
-    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
-    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
-
-
-    //mmkv
-    api 'com.tencent:mmkv-static:1.2.10'
-
-    //日志采集框架
-    api 'io.github.suyghur.dolin:zap:1.0.0'
-
-    api files("../libs/yyxx_support_1.0.2.jar")
-    api files("../libs/oaid_sdk_1.0.25.jar")
-
-}
-
-apply from: 'publish.gradle'

+ 0 - 21
library_base/proguard-rules.pro

@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-#   http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile

+ 0 - 110
library_base/publish.gradle

@@ -1,110 +0,0 @@
-apply plugin: 'maven-publish'
-apply plugin: 'signing'
-
-ext {
-    PUBLISH_GROUP_ID = 'io.github.yyxxgame.sdk'
-    PUBLISH_ARTIFACT_ID = 'eyuancomm-channel-lib-oppo'
-    PUBLISH_VERSION = '1.0.0-rc3'
-}
-
-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
-    }
-    exclude "**/R.class"
-    exclude "**/BuildConfig.class"
-}
-
-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
-
-            // 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 comm sdk of eyuan'
-                // If your project has a dedicated site, use its URL here
-                url = 'https://github.com/yyxxgame'
-                licenses {
-                    license {
-                        // 协议类型,一般默认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'
-                    }
-                }
-                // 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')
-                    for (def node : project.configurations.implementation.allDependencies) {
-                        if (node.group == "null" || node.name == "unspecified" || node.version == "null") {
-                            break
-                        }
-                        def dependencyNode = dependenciesNode.appendNode('dependency')
-                        dependencyNode.appendNode('groupId', node.group)
-                        dependencyNode.appendNode('artifactId', node.name)
-                        dependencyNode.appendNode('version', node.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)

+ 0 - 8
library_base/src/main/AndroidManifest.xml

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="cn.yyxx.eyuancomm.base">
-
-    <application android:allowBackup="true">
-
-    </application>
-</manifest>

+ 2 - 2
library_comm/proguard-rules.pro

@@ -151,10 +151,10 @@
 -keep class cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo{public <fields>; public <methods>;}
 -keep class cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo{public <fields>; public <methods>;}
 -keep class cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.comm.ext.**{public <fields>; public <methods>;}
+-keep class cn.yyxx.eyuancomm.comm.base.ext.**{public <fields>; public <methods>;}
 -keep class cn.yyxx.eyuancomm.comm.internal.**{public <fields>; public <methods>;}
 -keep class cn.yyxx.eyuancomm.comm.impl.CommSdkDrive{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.comm.utils.**{public <fields>; public <methods>;}
+-keep class cn.yyxx.eyuancomm.comm.base.utils.**{public <fields>; public <methods>;}
 -keep class cn.yyxx.eyuancomm.comm.widget.**{public <fields>; public <methods>;}
 -keep class cn.yyxx.eyuancomm.comm.EYuanCommSdk{public <fields>; public <methods>;}
 -keep class cn.yyxx.eyuancomm.comm.EYuanCommSdkApplication{public <fields>; public <methods>;}

+ 2 - 2
library_comm/src/main/cpp/comm_map.cpp

@@ -17,8 +17,8 @@ CommMap *CommMap::GetInstance() {
 
 void CommMap::Init(JNIEnv *env, jobject context) {
     //biz
-    comm_params["gcp_code"] = ParamsKit::GetCommGcpCode(env, context);
-    comm_params["game_code"] = ParamsKit::GetCommGameCode(env, context);
+    comm_params["gcp_code"] = ParamsKit::GetGcpCode(env, context);
+    comm_params["game_code"] = ParamsKit::GetGameCode(env, context);
     std::string channel_id = ParamsKit::GetChannelId(env, context);
     comm_params["channel_id"] = channel_id;
     comm_params["channel_name"] = ParamsKit::GetChannelName(env, channel_id);

+ 1 - 1
library_comm/src/main/cpp/eyuancomm.cpp

@@ -78,7 +78,7 @@ static JNINativeMethod gMethod[] = {
         {"initSdkDrive",  "(Landroid/content/Context;)V",                             (void *) InitSdkDrive},
         {"setCommParam",  "(Ljava/lang/String;Ljava/lang/String;)V",                  (void *) SetCommParam},
         {"getCommParam",  "(Ljava/lang/String;)Ljava/lang/String;",                   (void *) GetCommParam},
-        {"invokeCommJob", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) InvokeCommJob},
+        {"invokeJob", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) InvokeCommJob},
         {"parseJob",      "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) ParseJob},
         {"getCommMap",    "()Ljava/lang/String;",                                     (void *) GetCommMap},
 };

+ 0 - 2
library_comm/src/main/cpp/include/aes/aes_utils.h

@@ -19,7 +19,6 @@ public:
 
     static char *GetRawKey();
 
-
     static uint8_t *GetIv(const uint8_t *key);
 
     static char *GetIv32(const char *key);
@@ -49,5 +48,4 @@ private:
 }
 #endif
 
-
 #endif //EYUANCOMMSDK_KTX_AES_UTILS_H

+ 4 - 4
library_comm/src/main/cpp/include/params_kit.h

@@ -15,17 +15,17 @@ extern "C" {
 #endif
 
 #define CONFIG_FILE "yyxx_comm.properties"
-#define YYXX_COMM_GCP_CODE "YYXX_COMM_GCP_CODE"
-#define YYXX_COMM_GAME_CODE "YYXX_COMM_GAME_CODE"
+#define YYXX_GCP_CODE "YYXX_GCP_CODE"
+#define YYXX_GAME_CODE "YYXX_GAME_CODE"
 #define YYXX_CHANNEL_ID "YYXX_CHANNEL_ID"
 #define YYXX_OWN_DEBUG "YYXX_OWN_DEBUG"
 
 
 class ParamsKit {
 public:
-    static std::string GetCommGcpCode(JNIEnv *env, jobject context);
+    static std::string GetGcpCode(JNIEnv *env, jobject context);
 
-    static std::string GetCommGameCode(JNIEnv *env, jobject context);
+    static std::string GetGameCode(JNIEnv *env, jobject context);
 
     static std::string GetChannelId(JNIEnv *env, jobject context);
 

+ 4 - 4
library_comm/src/main/cpp/params_kit.cpp

@@ -6,12 +6,12 @@
 #include <logger.h>
 #include "include/params_kit.h"
 
-std::string ParamsKit::GetCommGcpCode(JNIEnv *env, jobject context) {
-    return GetValue4Properties(env, context, YYXX_COMM_GCP_CODE);
+std::string ParamsKit::GetGcpCode(JNIEnv *env, jobject context) {
+    return GetValue4Properties(env, context, YYXX_GCP_CODE);
 }
 
-std::string ParamsKit::GetCommGameCode(JNIEnv *env, jobject context) {
-    return GetValue4Properties(env, context, YYXX_COMM_GAME_CODE);
+std::string ParamsKit::GetGameCode(JNIEnv *env, jobject context) {
+    return GetValue4Properties(env, context, YYXX_GAME_CODE);
 }
 
 std::string ParamsKit::GetChannelId(JNIEnv *env, jobject context) {

+ 1 - 1
library_comm/src/main/cpp/toolkit.cpp

@@ -244,7 +244,7 @@ Json::Value ToolKit::ToJsonObject(const std::string &json) {
 char *ToolKit::StrReverse(const char *src) {
     char *tmp = new char[strlen(src)];
     strcpy(tmp, src);
-    //用来最后返回数组指针
+    // 用来最后返回数组指针
     char *ret = tmp;
     char *p = tmp + strlen(src) - 1;
     while (p > tmp) {

+ 2 - 2
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/EYuanCommInstaller.kt

@@ -8,7 +8,7 @@ import android.net.Uri
 import cn.yyxx.eyuancomm.comm.impl.CommSdkDrive
 import cn.yyxx.eyuancomm.comm.network.Host
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVUtils
+import cn.yyxx.eyuancomm.comm.utils.MMKVHandler
 import cn.yyxx.support.device.DeviceInfoUtils
 import cn.yyxx.support.gaid.GAIDUtils
 import cn.yyxx.support.msa.MsaDeviceIdsHandler
@@ -27,7 +27,7 @@ internal class EYuanCommInstaller : ContentProvider() {
         val application = context!!.applicationContext as Application
         initGaid(application)
         Logger.initZap(application)
-        MMKVUtils.instance.init(application)
+        MMKVHandler.instance.init(application)
         CommSdkDrive.instance.initSdkDrive(application)
         Host.initHostModel(application)
         return true

+ 3 - 3
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/ChannelId.kt

@@ -6,7 +6,7 @@ package cn.yyxx.eyuancomm.comm.entity
  */
 object ChannelId {
     const val OPPO = "1"
-    const val YYXX = "2"
-    const val HUAWEI = "3"
-    const val VIVO = "4"
+    const val HUAWEI = "2"
+    const val VIVO = "3"
+    const val EYUANGAME = "4"
 }

+ 1 - 0
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/Function.kt

@@ -8,6 +8,7 @@ object Function {
     const val ATTACH_BASE_CONTEXT = "attachBaseContext"
     const val INIT_APPLICATION = "initApplication"
     const val INITIALIZE = "initialize"
+    const val INSTALL_CONFIG = "installConfig"
     const val LOGIN = "login"
     const val LOGOUT = "logout"
     const val CHARGE = "charge"

+ 1 - 0
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/entity/SdkChargeInfo.kt

@@ -26,6 +26,7 @@ class SdkChargeInfo : Serializable {
     var cpExt: String = ""
     var cpPayTime: Long = 0
     var cpPaySign: String = ""
+    var payment: Int = 1
 
     override fun toString(): String {
         return "SdkChargeInfo(userId='$userId', roleId='$roleId', roleName='$roleName', roleLevel='$roleLevel', roleCTime=$roleCTime, serverId='$serverId', serverName='$serverName', amount=$amount, productId='$productId', productName='$productName', productDesc='$productDesc', cpOrderId='$cpOrderId', orderId='$orderId', channelNotifyUrl='$channelNotifyUrl', channelExt='$channelExt', cpExt='$cpExt', cpPayTime=$cpPayTime, cpPaySign='$cpPaySign')"

+ 8 - 6
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/impl/CommSdkDrive.kt

@@ -8,6 +8,12 @@ import android.content.Context
  */
 class CommSdkDrive {
 
+    companion object {
+        val instance: CommSdkDrive by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+            CommSdkDrive()
+        }
+    }
+
     init {
         System.loadLibrary("eyuancomm")
     }
@@ -18,15 +24,11 @@ class CommSdkDrive {
 
     external fun getCommParam(key: String): String
 
-    external fun invokeCommJob(key: String, data: String): String
+    external fun invokeJob(key: String, data: String): String
 
     external fun parseJob(key: String, data: String): String
 
     external fun getCommMap(): String
 
-    companion object {
-        val instance: CommSdkDrive by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
-            CommSdkDrive()
-        }
-    }
+
 }

+ 82 - 67
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/impl/CommSdkImpl.kt

@@ -6,28 +6,32 @@ import android.content.Context
 import android.content.Intent
 import android.text.TextUtils
 import cn.yyxx.eyuancomm.comm.EYuanCommInstaller
-import cn.yyxx.eyuancomm.comm.entity.*
 import cn.yyxx.eyuancomm.comm.entity.Function
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
 import cn.yyxx.eyuancomm.comm.internal.ICallback
-import cn.yyxx.eyuancomm.comm.network.Host
 import cn.yyxx.eyuancomm.comm.network.SdkRequest
 import cn.yyxx.eyuancomm.comm.utils.Logger
+import cn.yyxx.eyuancomm.comm.utils.MMKVHandler
 import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
 import cn.yyxx.eyuancomm.comm.widget.ScaleLoadingDialog
+import cn.yyxx.support.DensityUtils
 import cn.yyxx.support.JsonUtils
 import org.json.JSONObject
 import java.util.concurrent.atomic.AtomicInteger
+import kotlin.Boolean
+import kotlin.Int
 
 /**
  * @author #Suyghur.
  * Created on 2022/01/17
  */
-class CommSdkImpl(context: Context) {
+internal class CommSdkImpl(context: Context) {
 
     private var mSdkProxy: Any? = null
     private var hasSdkInit = false
 
-    //    private var hasReadDeviceId = false
     private var channelId: String = ""
 
     private var initLoadingDialog: ScaleLoadingDialog? = null
@@ -42,12 +46,12 @@ class CommSdkImpl(context: Context) {
 
     init {
         channelId = ParamsUtils.getChannelId(context)
-        getSdkProxyManager(context)
+        getSdkProxyManager()
     }
 
-    private fun getSdkProxyManager(context: Context): Any? {
+    private fun getSdkProxyManager(): Any? {
         if (mSdkProxy == null) {
-            mSdkProxy = SdkProxyManager.initSdkProxyManager(context, channelId)
+            mSdkProxy = SdkProxyManager.initSdkProxyManager(channelId)
         }
         return mSdkProxy
     }
@@ -56,54 +60,18 @@ class CommSdkImpl(context: Context) {
      * 同步Application中的attachBaseContext
      */
     fun attachBaseContext(application: Application, context: Context) {
-//        Logger.i("EYuanCommSdk attachBaseContext ...")
-//        CommSdkDrive.instance.initSdkDrive(application)
-//        initGaid(application)
         if (mSdkProxy == null) {
-            mSdkProxy = getSdkProxyManager(application)
+            mSdkProxy = getSdkProxyManager()
         }
         SdkProxyManager.call(Function.ATTACH_BASE_CONTEXT, arrayOf(Application::class.java, Context::class.java), arrayOf(application, context))
     }
 
-
-//    private fun initGaid(application: Application) {
-//        GAIDUtils.initGoogleAdid(application) { code, _ ->
-//            if (code == 0) {
-//                if (GAIDUtils.getGoogleAdid() == "00000000-0000-0000-0000-000000000000") {
-//                    Logger.i("谷歌框架可以访问,gaid被限制跟踪,尝试使用oaid")
-//                    initOaid(application)
-//                } else {
-//                    Logger.i("谷歌框架可以访问,请求gaid")
-//                    CommSdkDrive.instance.setCommParam("device_id", GAIDUtils.getGoogleAdid())
-//                    hasReadDeviceId = true
-//                }
-//            } else {
-//                Logger.e("谷歌框架不可访问,尝试使用oaid")
-//                initOaid(application)
-//            }
-//        }
-//    }
-//
-//    private fun initOaid(application: Application) {
-//        MsaDeviceIdsHandler.initMsaDeviceIds(application) { code, msg, _ ->
-//            if (code == 0) {
-//                Logger.e("获取oaid成功,使用oaid替代")
-//                CommSdkDrive.instance.setCommParam("device_id", MsaDeviceIdsHandler.oaid)
-//            } else {
-//                Logger.d("获取oaid失败,msg: $msg,使用android id替代")
-//                CommSdkDrive.instance.setCommParam("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
-//            }
-//            hasReadDeviceId = true
-//        }
-//    }
-
     /**
      * 同步Application中的onCreate
      */
     fun initApplication(application: Application) {
-//        Host.initHostModel(application)
         if (mSdkProxy == null) {
-            mSdkProxy = getSdkProxyManager(application)
+            mSdkProxy = getSdkProxyManager()
         }
         SdkProxyManager.call(Function.INIT_APPLICATION, arrayOf(Application::class.java), arrayOf(application))
     }
@@ -122,6 +90,29 @@ class CommSdkImpl(context: Context) {
             return
         }
 
+        if (TextUtils.isEmpty(ParamsUtils.getGcpCode(activity))) {
+            Logger.e("初始化失败,参数异常,请检查yyxx_comm.properties中YYXX_GCP_CODE的值")
+            callback.onResult(-1, "初始化失败,参数异常,请检查yyxx_comm.properties中YYXX_GCP_CODE的值")
+            return
+        }
+
+        if (TextUtils.isEmpty(ParamsUtils.getGameCode(activity))) {
+            Logger.e("初始化失败,参数异常,请检查yyxx_comm.properties中YYXX_GAME_CODE的值")
+            callback.onResult(-1, "初始化失败,参数异常,请检查yyxx_comm.properties中YYXX_GAME_CODE的值")
+            return
+        }
+
+        //获取当前屏幕尺寸
+        CommSdkDrive.instance.setCommParam("screen", DensityUtils.getResolutionByFullScreen(activity))
+
+        val adjustId = MMKVHandler.instance.eventKV.decodeString("adjust_id")
+        if (TextUtils.isEmpty(adjustId)) {
+            CommSdkDrive.instance.setCommParam("aid", "")
+        } else {
+            CommSdkDrive.instance.setCommParam("aid", adjustId!!)
+        }
+
+
         // 有些CP在资源再加时候回重复调用初始化,这里拦截一下
         if (hasSdkInit) {
             Logger.e("Sdk初始化已经执行,拦截此次调用")
@@ -175,11 +166,29 @@ class CommSdkImpl(context: Context) {
 
     private fun startInitCommSdk(activity: Activity, callback: ICallback) {
         SdkRequest.instance.initSdk(activity, "") { resultInfo ->
-            hasSdkInit = resultInfo.code == 1
+
             initLoadingDialog?.apply {
                 dismiss()
                 initLoadingDialog = null
             }
+
+            if (TextUtils.isEmpty(resultInfo.data)) {
+                callback.onResult(-1, "Sdk初始化失败")
+                return@initSdk
+            }
+
+            hasSdkInit = resultInfo.code == 1
+
+            with(JSONObject(resultInfo.data)) {
+                if (JsonUtils.hasJsonKey(this, "self_config")) {
+                    SdkProxyManager.call(
+                        Function.INSTALL_CONFIG,
+                        arrayOf(Activity::class.java, String::class.java),
+                        arrayOf(activity, getString("self_config"))
+                    )
+                }
+            }
+
             if (hasSdkInit) {
                 callback.onResult(0, "Sdk初始化成功")
             } else {
@@ -270,27 +279,28 @@ class CommSdkImpl(context: Context) {
 
         showPayLoadingDialog(activity)
         // 判断渠道
-        if (channelId == ChannelId.YYXX) {
-            // 特殊渠道,先调用渠道sdk生成支付扩展参数,在请求生成订单
-            // 获取拿到channel_ext
-            SdkProxyManager.call(
-                Function.GET_ORDER_EXT,
-                arrayOf(Activity::class.java, SdkChargeInfo::class.java, ICallback::class.java),
-                arrayOf(activity, chargeInfo, object : ICallback {
-                    override fun onResult(code: Int, result: String) {
-                        if (code == 0 && !TextUtils.isEmpty(result)) {
-                            chargeInfo.channelExt = result
-                            doCharge(activity, chargeInfo, callback)
-                        } else {
-                            dismissPayLoadingDsmiialog(activity)
-                            callback.onResult(-1, result)
-                        }
-                    }
-                })
-            )
-        } else {
-            doCharge(activity, chargeInfo, callback)
-        }
+//        if (channelId == ChannelId.EYUANGAME) {
+//            // 特殊渠道,先调用渠道sdk生成支付扩展参数,在请求生成订单
+//            // 获取拿到channel_ext
+//            SdkProxyManager.call(
+//                Function.GET_ORDER_EXT,
+//                arrayOf(Activity::class.java, SdkChargeInfo::class.java, ICallback::class.java),
+//                arrayOf(activity, chargeInfo, object : ICallback {
+//                    override fun onResult(code: Int, result: String) {
+//                        if (code == 0 && !TextUtils.isEmpty(result)) {
+//                            chargeInfo.channelExt = result
+//                            doCharge(activity, chargeInfo, callback)
+//                        } else {
+//                            dismissPayLoadingDsmiialog(activity)
+//                            callback.onResult(-1, result)
+//                        }
+//                    }
+//                })
+//            )
+//        } else {
+//            doCharge(activity, chargeInfo, callback)
+//        }
+        doCharge(activity, chargeInfo, callback)
     }
 
     private fun doCharge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
@@ -308,6 +318,11 @@ class CommSdkImpl(context: Context) {
                 } else {
                     ""
                 }
+                chargeInfo.payment = if (JsonUtils.hasJsonKey(jsonObject, "payment")) {
+                    jsonObject.getInt("payment")
+                } else {
+                    1
+                }
                 // 调用渠道sdk支付
                 SdkProxyManager.call(
                     Function.CHARGE,

+ 4 - 5
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/impl/SdkProxyManager.kt

@@ -1,18 +1,17 @@
 package cn.yyxx.eyuancomm.comm.impl
 
-import android.content.Context
 import java.lang.reflect.Method
 
 /**
  * @author #Suyghur.
  * Created on 2021/06/12
  */
-object SdkProxyManager {
+internal object SdkProxyManager {
 
     var sdkProxy: Any? = null
     var clzProxy: Class<*>? = null
 
-    fun initSdkProxyManager(context: Context, channelId: String): Any? {
+    fun initSdkProxyManager(channelId: String): Any? {
         if (sdkProxy != null) {
             return sdkProxy
         }
@@ -20,8 +19,8 @@ object SdkProxyManager {
         try {
             clzProxy = Class.forName("cn.yyxx.eyuancomm.impl.ImplSdkProxy")
             //获取构造函数的构造器
-            val constructor = clzProxy!!.getDeclaredConstructor(Context::class.java, String::class.java)
-            sdkProxy = constructor.newInstance(context, channelId)
+            val constructor = clzProxy!!.getDeclaredConstructor(String::class.java)
+            sdkProxy = constructor.newInstance(channelId)
         } catch (e: Exception) {
             e.printStackTrace()
         }

+ 1 - 1
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/internal/ITrace.kt

@@ -10,7 +10,7 @@ import cn.yyxx.eyuancomm.comm.entity.SdkEvent
  * @author #Suyghur.
  * Created on 2022/03/08
  */
-interface ITrace {
+internal interface ITrace {
 
     fun onInitialize(application: Application)
 

+ 11 - 0
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/internal/feature/IConfig.kt

@@ -0,0 +1,11 @@
+package cn.yyxx.eyuancomm.comm.internal.feature
+
+import android.app.Activity
+
+/**
+ * @author #Suyghur.
+ * Created on 2022/03/09
+ */
+interface IConfig {
+    fun installConfig(activity: Activity, config: String)
+}

+ 6 - 5
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/internal/feature/IFeature.kt

@@ -2,6 +2,7 @@ package cn.yyxx.eyuancomm.comm.internal.feature
 
 import android.app.Activity
 import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.internal.ICallback
 
 /**
  * @author #Suyghur.
@@ -9,17 +10,17 @@ import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
  */
 interface IFeature {
 
-    fun initialize(activity: Activity, isLandscape: Boolean, callback: (Int, String) -> Unit)
+    fun initialize(activity: Activity, isLandscape: Boolean, callback: ICallback)
 
-    fun login(activity: Activity, callback: (Int, String) -> Unit)
+    fun login(activity: Activity, callback: ICallback)
 
-    fun logout(activity: Activity, callback: (Int, String) -> Unit)
+    fun logout(activity: Activity, callback: ICallback)
 
-    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit)
+    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback)
 
     fun hasExitView(activity: Activity): Boolean
 
-    fun openExitView(activity: Activity, callback: (Int, String) -> Unit)
+    fun openExitView(activity: Activity, callback: ICallback)
 
     fun onDestroy(activity: Activity)
 

+ 2 - 1
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/internal/feature/IFloatBall.kt

@@ -1,6 +1,7 @@
 package cn.yyxx.eyuancomm.comm.internal.feature
 
 import android.app.Activity
+import cn.yyxx.eyuancomm.comm.internal.ICallback
 
 /**
  * @author #Suyghur.
@@ -11,5 +12,5 @@ interface IFloatBall {
 
     fun hideFloatBall(activity: Activity)
 
-    fun onFloatBallLogout(callback: (Int, String) -> Unit)
+    fun onFloatBallLogout(callback: ICallback)
 }

+ 20 - 2
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/network/Host.kt

@@ -19,11 +19,29 @@ object Host {
      */
     var IP_MODEL = 3
 
-    const val BASIC_ROUTE_INIT_SDK = "activate"
+    const val BASIC_ROUTE_INIT_SDK = "initialize"
     const val BASIC_ROUTE_USER_VERIFY = "login_verify"
     const val BASIC_ROUTE_CREATE_ORDER = "order_init"
     const val BASIC_ROUTE_NOTIFY_ORDER = "order_notify"
-//    const val BASIC_ROUTE_ORDER_STATUS = "order_status"
+
+
+    const val BASIC_ROUTE_LOGIN = "member_login"
+    const val BASIC_ROUTE_THIRD_PART_LOGIN = "third_plat_login"
+    const val BASIC_ROUTE_REGISTER = "member_register"
+    const val BASIC_ROUTE_BIND_ACCOUNT = "bind_member_user"
+    const val BASIC_ROUTE_BIND_PHONE = "bind_phone"
+    const val BASIC_ROUTE_BIND_EMAIL = "bind_email"
+    const val BASIC_ROUTE_GET_PHONE_CAPTCHA = "phone_captcha"
+    const val BASIC_ROUTE_GET_EMAIL_CAPTCHA = "email_captcha"
+    const val BASIC_ROUTE_FORGET_PWD_BY_PHONE = "forgot_pwd_auto"
+    const val BASIC_ROUTE_FORGET_PWD_BY_EMAIL = "forgot_pwd_email_auto"
+    const val BASIC_ROUTE_MODIFY_PWD = "modify_pwd"
+    const val BASIC_ROUTE_SUBMIT_ROLE_INFO = "game_role_report"
+    const val BASIC_ROUTE_UPLOAD_SDK_LOG = "upload_log"
+
+    fun originHost(url: String): Boolean {
+        return (url.startsWith(DEFAULT_ONLINE_HOST) || url.startsWith(DEFAULT_TEST_HOST))
+    }
 
     fun initHostModel(context: Context) {
         IP_MODEL = HostModelUtils.getHostModel(context)

+ 4 - 4
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/network/SdkRequest.kt

@@ -22,14 +22,14 @@ class SdkRequest {
         val jsonObject = JSONObject()
         jsonObject.put("route_path", Host.BASIC_ROUTE_INIT_SDK)
         jsonObject.put("channel_init_ext", extObject)
-        VolleyRequest.post(context, Host.HOST, jsonObject, onResponse)
+        VolleyRequest.post(context,  jsonObject, onResponse)
     }
 
     fun userVerify(context: Context, extObject: String, onResponse: (ResultInfo) -> Unit) {
         val jsonObject = JSONObject()
         jsonObject.put("route_path", Host.BASIC_ROUTE_USER_VERIFY)
         jsonObject.put("channel_ext", extObject)
-        VolleyRequest.post(context, Host.HOST, jsonObject, onResponse)
+        VolleyRequest.post(context,  jsonObject, onResponse)
     }
 
     fun createOrder(context: Context, extObject: String, chargeInfo: SdkChargeInfo, onResponse: (ResultInfo) -> Unit) {
@@ -53,7 +53,7 @@ class SdkRequest {
         } catch (e: JSONException) {
             e.printStackTrace()
         }
-        VolleyRequest.post(context, Host.HOST, jsonObject, onResponse)
+        VolleyRequest.post(context,  jsonObject, onResponse)
     }
 
     fun notifyOrder(context: Context, jsonObject: JSONObject, onResponse: (ResultInfo) -> Unit) {
@@ -62,6 +62,6 @@ class SdkRequest {
         } catch (e: JSONException) {
             e.printStackTrace()
         }
-        VolleyRequest.post(context, Host.HOST, jsonObject, onResponse)
+        VolleyRequest.post(context, jsonObject, onResponse)
     }
 }

+ 5 - 5
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/network/VolleyRequest.kt

@@ -33,13 +33,13 @@ object VolleyRequest {
 
     private const val MAX_TIMEOUT = 10 * 1000
 
-    fun post(context: Context, host: String, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
+    fun post(context: Context,  jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
         try {
             val time = System.currentTimeMillis().toString()
             val randomKey = time + StrUtils.getRandomString(16)
             val rawKey = Md5Utils.encodeByMD5(randomKey)
             val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
-            val hexP = CommSdkDrive.instance.invokeCommJob(aesKey.substring(8, 24), jsonObject.toString())
+            val hexP = CommSdkDrive.instance.invokeJob(aesKey.substring(8, 24), jsonObject.toString())
 
             val tmp = HexUtils.hexString2Bytes(hexP)
             val p = Base64Utils.encode(tmp)
@@ -52,9 +52,9 @@ object VolleyRequest {
             obj.put("p", p)
             obj.put("ts", rawKey)
             Logger.d("$obj")
-            Logger.d("host: $host")
+            Logger.d("host: ${Host.HOST}")
 
-            val request = object : JsonObjectRequest(Method.POST, host, obj, Response.Listener {
+            val request = object : JsonObjectRequest(Method.POST, Host.HOST, obj, Response.Listener {
                 val resultInfo = ResultInfo()
                 resultInfo.code = -1
                 resultInfo.msg = "接口请求异常"
@@ -156,7 +156,7 @@ object VolleyRequest {
         val rawKey = Md5Utils.encodeByMD5(randomKey)
         val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
 
-        val hexP = CommSdkDrive.instance.invokeCommJob(aesKey.substring(8, 24), jsonObject.toString())
+        val hexP = CommSdkDrive.instance.invokeJob(aesKey.substring(8, 24), jsonObject.toString())
 
         val tmp = HexUtils.hexString2Bytes(hexP)
         val p = Base64Utils.encode(tmp)

+ 0 - 8
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/trace/channel/AdjustEventTrace.kt

@@ -7,14 +7,6 @@ import android.text.TextUtils
 import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import cn.yyxx.eyuancomm.comm.entity.SdkEvent
 import cn.yyxx.eyuancomm.comm.internal.ITrace
-import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
-import cn.yyxx.support.JsonUtils
-import cn.yyxx.support.hawkeye.LogUtils
-import com.adjust.sdk.Adjust
-import com.adjust.sdk.AdjustConfig
-import com.adjust.sdk.AdjustEvent
-import com.adjust.sdk.LogLevel
 import org.json.JSONObject
 import java.io.BufferedReader
 import java.io.InputStreamReader

+ 7 - 7
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/utils/MMKVUtils.kt → library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/utils/MMKVHandler.kt

@@ -12,7 +12,13 @@ import java.io.File
  * @author #Suyghur.
  * Created on 2021/06/25
  */
-class MMKVUtils private constructor() : MMKVHandler {
+class MMKVHandler private constructor() : MMKVHandler {
+
+    companion object {
+        val instance: cn.yyxx.eyuancomm.comm.utils.MMKVHandler by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+            MMKVHandler()
+        }
+    }
 
     lateinit var userKV: MMKV
     lateinit var orderKV: MMKV
@@ -48,10 +54,4 @@ class MMKVUtils private constructor() : MMKVHandler {
         val log = "<${file.toString()}:${line}::${function}>${message}"
         Logger.d(log)
     }
-
-    companion object {
-        val instance: MMKVUtils by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
-            MMKVUtils()
-        }
-    }
 }

+ 48 - 6
library_comm/src/main/kotlin/cn/yyxx/eyuancomm/comm/utils/ParamsUtils.kt

@@ -12,14 +12,17 @@ object ParamsUtils {
 
     private const val CONFIG_FILE = "yyxx_comm.properties"
 
-    private const val YYXX_COMM_GCP_CODE = "YYXX_COMM_GCP_CODE"
-    private const val YYXX_COMM_GAME_CODE = "YYXX_COMM_GAME_CODE"
+    private const val YYXX_GCP_CODE = "YYXX_GCP_CODE"
+    private const val YYXX_GAME_CODE = "YYXX_GAME_CODE"
     private const val YYXX_CHANNEL_ID = "YYXX_CHANNEL_ID"
+    private const val YYXX_ADJSUT_APP_ID = "YYXX_ADJUST_APP_ID"
+    private const val YYXX_GOOGLE_CLIENT_ID = "YYXX_GOOGLE_CLIENT_ID"
+    private const val YYXX_DO_MAIN_ENV = "YYXX_DO_MAIN_ENV"
 
     @JvmStatic
-    fun getCommGcpCode(context: Context): String {
+    fun getGcpCode(context: Context): String {
         try {
-            val code = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_COMM_GCP_CODE)
+            val code = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_GCP_CODE)
             if (!TextUtils.isEmpty(code)) {
                 return code
             }
@@ -30,9 +33,9 @@ object ParamsUtils {
     }
 
     @JvmStatic
-    fun getCommGameCode(context: Context): String {
+    fun getGameCode(context: Context): String {
         try {
-            val code = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_COMM_GAME_CODE)
+            val code = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_GAME_CODE)
             if (!TextUtils.isEmpty(code)) {
                 return code
             }
@@ -54,4 +57,43 @@ object ParamsUtils {
         }
         return ""
     }
+
+    @JvmStatic
+    fun getAdjustAppId(context: Context): String {
+        try {
+            val appId = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_ADJSUT_APP_ID)
+            if (!TextUtils.isEmpty(appId)) {
+                return appId
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+        }
+        return ""
+    }
+
+    @JvmStatic
+    fun getGoogleClientId(context: Context): String {
+        try {
+            val clientId = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_GOOGLE_CLIENT_ID)
+            if (!TextUtils.isEmpty(clientId)) {
+                return clientId
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+        }
+        return ""
+    }
+
+    @JvmStatic
+    fun getDoMainEnv(context: Context): Int {
+        try {
+            val env = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_DO_MAIN_ENV)
+            if (!TextUtils.isEmpty(env)) {
+                return env.toInt()
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+        }
+        return 1
+    }
 }

+ 14 - 22
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/ImplSdkProxy.kt

@@ -13,12 +13,10 @@ import cn.yyxx.eyuancomm.comm.internal.feature.*
  * @author #Suyghur.
  * Created on 2022/01/17
  */
-class ImplSdkProxy(context: Context, channelId: String) {
+class ImplSdkProxy(channelId: String) {
 
-    private var mImpl: IFeature? = null
-
-    init {
-        mImpl = SdkGenerator.getSdkInstance(channelId)
+    private val mImpl: IFeature? by lazy {
+        SdkGenerator.getSdkInstance(channelId)
     }
 
     fun attachBaseContext(application: Application, context: Context) {
@@ -34,27 +32,25 @@ class ImplSdkProxy(context: Context, channelId: String) {
     }
 
     fun initialize(activity: Activity, isLandscape: Boolean, callback: ICallback) {
-        mImpl?.initialize(activity, isLandscape) { code, result ->
-            callback.onResult(code, result)
+        mImpl?.initialize(activity, isLandscape, callback)
+    }
+
+    fun installConfig(activity: Activity, config: String) {
+        if (mImpl is IConfig) {
+            (mImpl as IConfig).installConfig(activity, config)
         }
     }
 
     fun login(activity: Activity, callback: ICallback) {
-        mImpl?.login(activity) { code, result ->
-            callback.onResult(code, result)
-        }
+        mImpl?.login(activity, callback)
     }
 
     fun logout(activity: Activity, callback: ICallback) {
-        mImpl?.logout(activity) { code, result ->
-            callback.onResult(code, result)
-        }
+        mImpl?.logout(activity, callback)
     }
 
     fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
-        mImpl?.charge(activity, chargeInfo) { code, result ->
-            callback.onResult(code, result)
-        }
+        mImpl?.charge(activity, chargeInfo, callback)
     }
 
     fun getOrderExt(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
@@ -92,9 +88,7 @@ class ImplSdkProxy(context: Context, channelId: String) {
     }
 
     fun openExitView(activity: Activity, callback: ICallback) {
-        mImpl?.openExitView(activity) { code, result ->
-            callback.onResult(code, result)
-        }
+        mImpl?.openExitView(activity, callback)
     }
 
     fun getChannelVersion(): String = if (mImpl == null) {
@@ -169,9 +163,7 @@ class ImplSdkProxy(context: Context, channelId: String) {
 
     fun setOnFloatBallLogout(callback: ICallback) {
         if (mImpl is IFloatBall) {
-            (mImpl as IFloatBall).onFloatBallLogout { code, result ->
-                callback.onResult(code, result)
-            }
+            (mImpl as IFloatBall).onFloatBallLogout(callback)
         }
     }
 }

+ 3 - 3
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/SdkGenerator.kt

@@ -2,7 +2,7 @@ package cn.yyxx.eyuancomm.impl
 
 import cn.yyxx.eyuancomm.comm.entity.ChannelId
 import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
-import cn.yyxx.eyuancomm.impl.channel.eyuan.ChannelSdkEYuan
+import cn.yyxx.eyuancomm.impl.channel.eyuangame.ChannelSdkEYuanGame
 import cn.yyxx.eyuancomm.impl.channel.huawei.ChannelSdkHuawei
 import cn.yyxx.eyuancomm.impl.channel.oppo.ChannelSdkOppo
 import cn.yyxx.eyuancomm.impl.channel.vivo.ChannelSdkVivo
@@ -16,7 +16,7 @@ object SdkGenerator {
     fun getSdkInstance(channelId: String): IFeature? {
         return when (channelId) {
             ChannelId.OPPO -> ChannelSdkOppo()
-            ChannelId.YYXX -> ChannelSdkEYuan()
+            ChannelId.EYUANGAME -> ChannelSdkEYuanGame()
             ChannelId.HUAWEI -> ChannelSdkHuawei()
             ChannelId.VIVO -> ChannelSdkVivo()
             else -> null
@@ -26,8 +26,8 @@ object SdkGenerator {
     @JvmStatic
     fun getSdkName(channelId: String): String {
         return when (channelId) {
+            ChannelId.EYUANGAME -> "eyuangame"
             ChannelId.OPPO -> "oppo"
-            ChannelId.YYXX -> "yyxx"
             ChannelId.HUAWEI -> "huawei"
             ChannelId.VIVO -> "vivo"
             else -> ""

+ 0 - 104
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/eyuan/ChannelSdkEYuan.kt

@@ -1,104 +0,0 @@
-package cn.yyxx.eyuancomm.impl.channel.eyuan
-
-import android.app.Activity
-import android.app.Application
-import android.content.Context
-import android.content.Intent
-import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.comm.internal.feature.IApplication
-import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
-import cn.yyxx.eyuancomm.comm.internal.feature.ILifeCycle
-import cn.yyxx.eyuangame.EYuanGameSdk
-import cn.yyxx.eyuangame.internal.ICallback
-
-/**
- * @author #Suyghur.
- * Created on 2022/01/17
- */
-class ChannelSdkEYuan : IFeature, IApplication, ILifeCycle {
-
-    override fun attachBaseContext(application: Application, context: Context) {
-        EYuanGameSdk.getInstance().attachBaseContext(application, context)
-    }
-
-    override fun initApplication(application: Application) {
-        EYuanGameSdk.getInstance().initApplication(application)
-    }
-
-    override fun initialize(activity: Activity, isLandscape: Boolean, callback: (Int, String) -> Unit) {
-        EYuanGameSdk.getInstance().initialize(activity, isLandscape, object : ICallback {
-            override fun onResult(code: Int, result: String) {
-                callback(code, result)
-            }
-        })
-    }
-
-    override fun login(activity: Activity, callback: (Int, String) -> Unit) {
-        EYuanGameSdk.getInstance().login(activity, true, object : ICallback {
-            override fun onResult(code: Int, result: String) {
-                callback(code, result)
-            }
-        })
-    }
-
-    override fun logout(activity: Activity, callback: (Int, String) -> Unit) {
-        EYuanGameSdk.getInstance().logout(activity, object : ICallback {
-            override fun onResult(code: Int, result: String) {
-                callback(code, result)
-            }
-        })
-    }
-
-    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
-    }
-
-    override fun hasExitView(activity: Activity): Boolean = true
-
-    override fun openExitView(activity: Activity, callback: (Int, String) -> Unit) {
-        EYuanGameSdk.getInstance().openExitView(activity, object : ICallback {
-            override fun onResult(code: Int, result: String) {
-                callback(code, result)
-            }
-        })
-    }
-
-    override fun onDestroy(activity: Activity) {
-        EYuanGameSdk.getInstance().onDestroy(activity)
-    }
-
-    override fun getChannelVersion(): String {
-        return EYuanGameSdk.getInstance().getSdkVersion()
-    }
-
-    override fun getChannelName(): String {
-        return "eyuan"
-    }
-
-    override fun onStart(activity: Activity) {
-        EYuanGameSdk.getInstance().onStart(activity)
-    }
-
-    override fun onResume(activity: Activity) {
-        EYuanGameSdk.getInstance().onResume(activity)
-    }
-
-    override fun onRestart(activity: Activity) {
-        EYuanGameSdk.getInstance().onRestart(activity)
-    }
-
-    override fun onPause(activity: Activity) {
-        EYuanGameSdk.getInstance().onPause(activity)
-    }
-
-    override fun onStop(activity: Activity) {
-        EYuanGameSdk.getInstance().onStop(activity)
-    }
-
-    override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
-        EYuanGameSdk.getInstance().onActivityResult(activity, requestCode, resultCode, data)
-    }
-
-    override fun onNewIntent(activity: Activity, intent: Intent?) {
-        EYuanGameSdk.getInstance().onNewIntent(activity, intent)
-    }
-}

+ 107 - 0
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/eyuangame/ChannelSdkEYuanGame.kt

@@ -0,0 +1,107 @@
+package cn.yyxx.eyuancomm.impl.channel.eyuangame
+
+import android.app.Activity
+import android.content.Intent
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
+import cn.yyxx.eyuancomm.comm.internal.ICallback
+import cn.yyxx.eyuancomm.comm.internal.feature.IConfig
+import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
+import cn.yyxx.eyuancomm.comm.internal.feature.ILifeCycle
+import cn.yyxx.eyuancomm.comm.internal.feature.IRoleData
+import cn.yyxx.eyuangame.EYuanGameSdk
+
+/**
+ * @author #Suyghur.
+ * Created on 2022/01/17
+ */
+internal class ChannelSdkEYuanGame : IFeature, ILifeCycle, IConfig, IRoleData {
+
+    override fun initialize(activity: Activity, isLandscape: Boolean, callback: ICallback) {
+        EYuanGameSdk.getInstance().initialize(activity, isLandscape) { code, result ->
+            callback.onResult(code, result)
+        }
+    }
+
+    override fun installConfig(activity: Activity, config: String) {
+        EYuanGameSdk.getInstance().installConfig(activity, config)
+    }
+
+    override fun login(activity: Activity, callback: ICallback) {
+        EYuanGameSdk.getInstance().login(activity, true) { code, result ->
+            callback.onResult(code, result)
+        }
+    }
+
+    override fun logout(activity: Activity, callback: ICallback) {
+        EYuanGameSdk.getInstance().logout(activity) { code, result ->
+            callback.onResult(code, result)
+        }
+    }
+
+    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
+        EYuanGameSdk.getInstance().charge(activity, chargeInfo) { code, result ->
+            callback.onResult(code, result)
+        }
+    }
+
+    override fun hasExitView(activity: Activity): Boolean = true
+
+    override fun openExitView(activity: Activity, callback: ICallback) {
+        EYuanGameSdk.getInstance().openExitView(activity) { code, result ->
+            callback.onResult(code, result)
+        }
+    }
+
+    override fun onDestroy(activity: Activity) {
+        EYuanGameSdk.getInstance().onDestroy(activity)
+    }
+
+    override fun getChannelVersion(): String {
+        return EYuanGameSdk.getInstance().getSdkVersion()
+    }
+
+    override fun getChannelName(): String {
+        return "eyuangame"
+    }
+
+    override fun onStart(activity: Activity) {
+        EYuanGameSdk.getInstance().onStart(activity)
+    }
+
+    override fun onResume(activity: Activity) {
+        EYuanGameSdk.getInstance().onResume(activity)
+    }
+
+    override fun onRestart(activity: Activity) {
+        EYuanGameSdk.getInstance().onRestart(activity)
+    }
+
+    override fun onPause(activity: Activity) {
+        EYuanGameSdk.getInstance().onPause(activity)
+    }
+
+    override fun onStop(activity: Activity) {
+        EYuanGameSdk.getInstance().onStop(activity)
+    }
+
+    override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
+        EYuanGameSdk.getInstance().onActivityResult(activity, requestCode, resultCode, data)
+    }
+
+    override fun onNewIntent(activity: Activity, intent: Intent?) {
+        EYuanGameSdk.getInstance().onNewIntent(activity, intent)
+    }
+
+    override fun roleCreate(activity: Activity, roleInfo: SdkRoleInfo) {
+        EYuanGameSdk.getInstance().roleCreate(activity, roleInfo)
+    }
+
+    override fun roleLauncher(activity: Activity, roleInfo: SdkRoleInfo) {
+        EYuanGameSdk.getInstance().roleLauncher(activity, roleInfo)
+    }
+
+    override fun roleUpgrade(activity: Activity, roleInfo: SdkRoleInfo) {
+        EYuanGameSdk.getInstance().roleLevelUp(activity, roleInfo)
+    }
+}

+ 16 - 15
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/ChannelSdkHuawei.kt

@@ -10,6 +10,7 @@ import android.view.View
 import android.widget.ImageView
 import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import cn.yyxx.eyuancomm.comm.ext.setThrottleListener
+import cn.yyxx.eyuancomm.comm.internal.ICallback
 import cn.yyxx.eyuancomm.comm.internal.feature.IApplication
 import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
 import cn.yyxx.eyuancomm.comm.internal.feature.IFloatBall
@@ -55,8 +56,8 @@ import org.json.JSONObject
 class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle, IFloatBall {
 
     private lateinit var activity: Activity
-    private lateinit var loginCallback: (Int, String) -> Unit
-    private lateinit var floatBallLogout: (Int, String) -> Unit
+    private lateinit var loginCallback: ICallback
+    private lateinit var floatBallLogout: ICallback
     private lateinit var analytics: HiAnalyticsInstance
     private lateinit var initTask: Task<Void>
 
@@ -95,7 +96,7 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle, IFloatBall {
         override fun onMenuItemClick(ball: FloatBall, item: FloatBallMenu.FloatBallMenuItem, pos: Int) {
             when (item.type) {
                 FloatFeature.FEATURE_SWITCH -> {
-                    floatBallLogout(0, "浮标切换账号")
+                    floatBallLogout.onResult(0, "浮标切换账号")
                     FloatCenterServiceManager.instance.detach()
                 }
                 FloatFeature.FEATURE_LINK -> {
@@ -167,7 +168,7 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle, IFloatBall {
         analytics = HiAnalytics.getInstance(application)
     }
 
-    override fun initialize(activity: Activity, isLandscape: Boolean, callback: (Int, String) -> Unit) {
+    override fun initialize(activity: Activity, isLandscape: Boolean, callback: ICallback) {
         this.activity = activity
         this.isLandscape = isLandscape
         ResourceLoaderUtil.setmContext(activity)
@@ -194,11 +195,11 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle, IFloatBall {
                 }
                 val jsonObject = JSONObject()
                 jsonObject.put("access_token", it.token)
-                loginCallback(0, jsonObject.toString())
+                loginCallback.onResult(0, jsonObject.toString())
             }
-            FloatCenterServiceManager.instance.init(activity, floatBallCallback)
+            FloatCenterServiceManager.instance.init(activity, isLandscape, floatBallCallback)
 
-            callback(0, "Sdk初始化成功")
+            callback.onResult(0, "Sdk初始化成功")
         }.addOnFailureListener { e ->
             Logger.d("Sdk init on failure")
             if (e is ApiException) {
@@ -226,7 +227,7 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle, IFloatBall {
         }
     }
 
-    override fun login(activity: Activity, callback: (Int, String) -> Unit) {
+    override fun login(activity: Activity, callback: ICallback) {
         this.activity = activity
         this.loginCallback = callback
         AGConnectAuth.getInstance().signOut()
@@ -249,19 +250,19 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle, IFloatBall {
         }
     }
 
-    override fun logout(activity: Activity, callback: (Int, String) -> Unit) {
+    override fun logout(activity: Activity, callback: ICallback) {
         this.activity = activity
         AGConnectAuth.getInstance().signOut()
         analytics.onEvent(HAEventType.SIGNOUT, null)
         FloatCenterServiceManager.instance.detach()
-        callback(0, "用户登出成功")
+        callback.onResult(0, "用户登出成功")
     }
 
-    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
+    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
         this.activity = activity
         HuaweiInAppPay.instance.charge(activity, chargeInfo, object : HuaweiInAppPay.InAppPayCallback {
             override fun onResult(code: Int, result: String) {
-                callback(code, result)
+                callback.onResult(code, result)
             }
         })
     }
@@ -271,7 +272,7 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle, IFloatBall {
         return false
     }
 
-    override fun openExitView(activity: Activity, callback: (Int, String) -> Unit) {
+    override fun openExitView(activity: Activity, callback: ICallback) {
         this.activity = activity
     }
 
@@ -352,7 +353,7 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle, IFloatBall {
                 doSignIn(activity, channel)
             } else {
                 dismissLoadingDialog()
-                loginCallback(-1, "登录失败")
+                loginCallback.onResult(-1, "登录失败")
             }
         }
     }
@@ -397,7 +398,7 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle, IFloatBall {
         FloatCenterServiceManager.instance.detach()
     }
 
-    override fun onFloatBallLogout(callback: (Int, String) -> Unit) {
+    override fun onFloatBallLogout(callback: ICallback) {
         floatBallLogout = callback
     }
 }

+ 1 - 1
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/HuaweiInAppPay.kt

@@ -23,7 +23,7 @@ import org.json.JSONObject
  * @author #Suyghur.
  * Created on 2022/02/16
  */
-class HuaweiInAppPay {
+internal class HuaweiInAppPay {
 
     private var loadingDialog: ScaleLoadingDialog? = null
     private var callback: InAppPayCallback? = null

+ 1 - 1
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/HuaweiLinkDialog.kt

@@ -13,7 +13,7 @@ import cn.yyxx.support.ResUtils
  * @author #Suyghur.
  * Created on 2022/01/27
  */
-class HuaweiLinkDialog(context: Context, private val isLandscape: Boolean) : Dialog(context) {
+internal class HuaweiLinkDialog(context: Context, private val isLandscape: Boolean) : Dialog(context) {
 
      lateinit var ivClose: ImageView
     lateinit var ivHw: ImageView

+ 1 - 1
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/HuaweiLoginDialog.kt

@@ -13,7 +13,7 @@ import cn.yyxx.support.ResUtils
  * @author #Suyghur.
  * Created on 2022/01/27
  */
-class HuaweiLoginDialog(context: Context, private val isLandscape: Boolean) : Dialog(context) {
+internal class HuaweiLoginDialog(context: Context, private val isLandscape: Boolean) : Dialog(context) {
 
     lateinit var ivHw: ImageView
     lateinit var ivGoogle: ImageView

+ 4 - 4
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/floatview/FloatCenterService.kt

@@ -5,7 +5,6 @@ import android.app.Service
 import android.content.Intent
 import android.os.Binder
 import android.os.IBinder
-import cn.yyxx.eyuancomm.comm.impl.CommSdkImpl
 
 /**
  * @author #Suyghur.
@@ -15,12 +14,13 @@ class FloatCenterService : Service() {
 
     private var activity: Activity? = null
     private var floatBall: FloatBall? = null
+    private var isLandscape = false
 
     private lateinit var callback: FloatBall.FloatBallCallback
 
-
-    fun initService(activity: Activity, callback: FloatBall.FloatBallCallback) {
+    fun initService(activity: Activity, isLandscape: Boolean, callback: FloatBall.FloatBallCallback) {
         this.activity = activity
+        this.isLandscape = isLandscape
         this.callback = callback
     }
 
@@ -29,7 +29,7 @@ class FloatCenterService : Service() {
             return
         }
         if (floatBall==null){
-            floatBall = FloatBall(activity!!, CommSdkImpl.isLandscape, callback)
+            floatBall = FloatBall(activity!!, isLandscape, callback)
         }
         floatBall?.attach()
     }

+ 10 - 9
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/floatview/FloatCenterServiceManager.kt

@@ -16,16 +16,23 @@ import cn.yyxx.eyuancomm.comm.utils.Logger
  */
 class FloatCenterServiceManager private constructor() {
 
+    companion object {
+        val instance: FloatCenterServiceManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+            FloatCenterServiceManager()
+        }
+    }
+
     private var service: FloatCenterService? = null
     private var activity: Activity? = null
     private var intent: Intent? = null
     private var callback: FloatBall.FloatBallCallback? = null
     private var isBindService = false
+    private var isLandscape = false
 
     private val serviceConnection = object : ServiceConnection {
         override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
             this@FloatCenterServiceManager.service = (service as FloatCenterService.FloatCenterServiceBinder).service
-            this@FloatCenterServiceManager.service?.initService(activity!!, callback!!)
+            this@FloatCenterServiceManager.service?.initService(activity!!, isLandscape, callback!!)
         }
 
         override fun onServiceDisconnected(name: ComponentName?) {
@@ -33,8 +40,9 @@ class FloatCenterServiceManager private constructor() {
 
     }
 
-    fun init(activity: Activity, callback: FloatBall.FloatBallCallback) {
+    fun init(activity: Activity, isLandscape: Boolean, callback: FloatBall.FloatBallCallback) {
         this.activity = activity
+        this.isLandscape = isLandscape
         this.callback = callback
         if (service == null) {
             intent = Intent(activity.applicationContext, FloatCenterService::class.java)
@@ -73,11 +81,4 @@ class FloatCenterServiceManager private constructor() {
         activity = null
         callback = null
     }
-
-
-    companion object {
-        val instance: FloatCenterServiceManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
-            FloatCenterServiceManager()
-        }
-    }
 }

+ 19 - 19
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/oppo/ChannelSdkOppo.kt

@@ -6,6 +6,7 @@ import android.content.Context
 import android.text.TextUtils
 import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import cn.yyxx.eyuancomm.comm.ext.getMetaDataValue
+import cn.yyxx.eyuancomm.comm.internal.ICallback
 import cn.yyxx.eyuancomm.comm.internal.feature.IApplication
 import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
 import cn.yyxx.eyuancomm.comm.utils.Logger
@@ -19,7 +20,7 @@ import org.json.JSONObject
  * @author #Suyghur.
  * Created on 2022/01/24
  */
-class ChannelSdkOppo : IFeature, IApplication {
+internal class ChannelSdkOppo : IFeature, IApplication {
 
     override fun attachBaseContext(application: Application, context: Context) {
     }
@@ -29,11 +30,11 @@ class ChannelSdkOppo : IFeature, IApplication {
         GameCenterSDK.init(appSecret, application)
     }
 
-    override fun initialize(activity: Activity, isLandscape: Boolean, callback: (Int, String) -> Unit) {
-        callback(0, "Sdk初始化成功")
+    override fun initialize(activity: Activity, isLandscape: Boolean, callback: ICallback) {
+        callback.onResult(0, "Sdk初始化成功")
     }
 
-    override fun login(activity: Activity, callback: (Int, String) -> Unit) {
+    override fun login(activity: Activity, callback: ICallback) {
         GameCenterSDK.getInstance().doLogin(activity, object : ApiCallback {
             override fun onSuccess(result: String) {
                 // 登录成功
@@ -42,7 +43,7 @@ class ChannelSdkOppo : IFeature, IApplication {
                         Logger.d("doGetTokenAndSsoid: $result")
                         if (TextUtils.isEmpty(result)) {
                             Logger.e("解析渠道Sdk登录信息失败")
-                            callback(-1, "解析渠道Sdk登录信息失败")
+                            callback.onResult(-1, "解析渠道Sdk登录信息失败")
                             return
                         }
                         try {
@@ -55,13 +56,13 @@ class ChannelSdkOppo : IFeature, IApplication {
                         } catch (e: Exception) {
                             e.printStackTrace()
                             Logger.e("渠道Sdk登录失败")
-                            callback(-1, "渠道Sdk登录失败")
+                            callback.onResult(-1, "渠道Sdk登录失败")
                         }
                     }
 
                     override fun onFailure(result: String?, code: Int) {
                         Logger.e("解析渠道Sdk登录信息失败,code: $code, msg: $result")
-                        callback(-1, "解析渠道Sdk登录信息失败,code: $code, msg: $result")
+                        callback.onResult(-1, "解析渠道Sdk登录信息失败,code: $code, msg: $result")
                     }
                 })
             }
@@ -69,13 +70,13 @@ class ChannelSdkOppo : IFeature, IApplication {
             override fun onFailure(result: String, code: Int) {
                 // 登录失败
                 Logger.e("渠道Sdk登录失败,code: $code, msg: $result")
-                callback(-1, "渠道Sdk登录失败,code: $code, msg: $result")
+                callback.onResult(-1, "渠道Sdk登录失败,code: $code, msg: $result")
             }
 
         })
     }
 
-    private fun getOppoUserInfo(token: String, ssoid: String, callback: (Int, String) -> Unit) {
+    private fun getOppoUserInfo(token: String, ssoid: String, callback: ICallback) {
         GameCenterSDK.getInstance().doGetUserInfo(ReqUserInfoParam(token, ssoid), object : ApiCallback {
             override fun onSuccess(result: String) {
                 // 获取oppo用户信息成功
@@ -83,23 +84,23 @@ class ChannelSdkOppo : IFeature, IApplication {
                 with(JSONObject()) {
                     put("token", token)
                     put("ssoid", ssoid)
-                    callback(0, this.toString())
+                    callback.onResult(0, this.toString())
                 }
             }
 
             override fun onFailure(result: String, code: Int) {
                 // 获取oppo用户信息失败
                 Logger.e("获取oppo用户信息失败, code: $code, msg: $result")
-                callback(-1, "获取oppo用户信息失败,code: $code, msg: $result")
+                callback.onResult(-1, "获取oppo用户信息失败,code: $code, msg: $result")
             }
         })
     }
 
-    override fun logout(activity: Activity, callback: (Int, String) -> Unit) {
-        callback(0, "用户登出成功")
+    override fun logout(activity: Activity, callback: ICallback) {
+        callback.onResult(0, "用户登出成功")
     }
 
-    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
+    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
         with(PayInfo(chargeInfo.orderId, "callback_info_${chargeInfo.orderId}", chargeInfo.amount)) {
             productDesc = chargeInfo.productDesc
             productName = chargeInfo.productName
@@ -109,14 +110,13 @@ class ChannelSdkOppo : IFeature, IApplication {
             GameCenterSDK.getInstance().doPay(activity, this, object : ApiCallback {
                 override fun onSuccess(result: String) {
                     // 客户端Sdk支付成功
-                    Logger.d(result)
-                    callback(0, "oppo支付成功,msg:$result")
+                    callback.onResult(0, "oppo支付成功,msg:$result")
                 }
 
                 override fun onFailure(result: String, code: Int) {
                     // 客户端Sdk支付失败
                     Logger.d("oppo支付失败,code: $code, msg: $result")
-                    callback(-1, "oppo支付失败,code: $code, msg: $result")
+                    callback.onResult(-1, "oppo支付失败,code: $code, msg: $result")
                 }
             })
         }
@@ -124,9 +124,9 @@ class ChannelSdkOppo : IFeature, IApplication {
 
     override fun hasExitView(activity: Activity): Boolean = true
 
-    override fun openExitView(activity: Activity, callback: (Int, String) -> Unit) {
+    override fun openExitView(activity: Activity, callback: ICallback) {
         GameCenterSDK.getInstance().onExit(activity) {
-            callback(0, "Sdk退出成功")
+            callback.onResult(0, "Sdk退出成功")
         }
     }
 

+ 12 - 11
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/vivo/ChannelSdkVivo.kt

@@ -4,6 +4,7 @@ import android.app.Activity
 import android.app.Application
 import android.content.Context
 import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.internal.ICallback
 import cn.yyxx.eyuancomm.comm.internal.feature.IApplication
 import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
 import com.vivo.unionpay.sdk.open.VivoConstants
@@ -15,7 +16,7 @@ import com.vivo.unionpay.sdk.open.VivoUnionSDK
  * @author #Suyghur.
  * Created on 2022/01/24
  */
-class ChannelSdkVivo : IFeature, IApplication {
+internal class ChannelSdkVivo : IFeature, IApplication {
 
     private var appId = ""
     private var uid = ""
@@ -28,27 +29,27 @@ class ChannelSdkVivo : IFeature, IApplication {
         VivoUnionSDK.initSdk(application, appId)
     }
 
-    override fun initialize(activity: Activity, isLandscape: Boolean, callback: (Int, String) -> Unit) {
-        callback(0, "")
+    override fun initialize(activity: Activity, isLandscape: Boolean, callback: ICallback) {
+        callback.onResult(0, "")
     }
 
-    override fun login(activity: Activity, callback: (Int, String) -> Unit) {
+    override fun login(activity: Activity, callback: ICallback) {
         VivoUnionSDK.login(activity) { code, token, uid ->
             this.uid = uid
             if (code == VivoConstants.VIVO_LOGIN_SUCCESS) {
                 // 用户登录成功
-                callback(code, "")
+                callback.onResult(code, "")
             } else {
                 // 用户取消或登录失败
-                callback(code, "Vivo用户取消或登录失败")
+                callback.onResult(code, "Vivo用户取消或登录失败")
             }
         }
     }
 
-    override fun logout(activity: Activity, callback: (Int, String) -> Unit) {
+    override fun logout(activity: Activity, callback: ICallback) {
     }
 
-    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
+    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
         val params = HashMap<String, String>()
         val roleInfo = VivoRoleInfo()
         val payInfo = VivoPayInfo.Builder()
@@ -65,16 +66,16 @@ class ChannelSdkVivo : IFeature, IApplication {
             .build()
         VivoUnionSDK.pay(activity, payInfo) { code ->
             if (code == VivoConstants.VIVO_PAY_SUCCESS) {
-                callback(0, "")
+                callback.onResult(0, "")
             } else {
-                callback(-1, "")
+                callback.onResult(-1, "")
             }
         }
     }
 
     override fun hasExitView(activity: Activity): Boolean = false
 
-    override fun openExitView(activity: Activity, callback: (Int, String) -> Unit) {
+    override fun openExitView(activity: Activity, callback: ICallback) {
     }
 
     override fun onDestroy(activity: Activity) {

+ 5 - 5
module_eyuan/library_eyuan/CMakeLists.txt

@@ -11,16 +11,16 @@ cmake_minimum_required(VERSION 3.4.1)
 # Gradle automatically packages shared libraries with your APK.
 
 
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/include)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/include/third_part)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/include/aes)
+include_directories(src/main/cpp/include)
+include_directories(src/main/cpp/include/third_part)
+include_directories(src/main/cpp/include/aes)
 #include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/include/rsa)
 
 
 #include_directories(src/main/cpp/json)
 #include_directories(src/main/cpp/encrypt)
-aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/ DIR_SOURCE)
-aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/include/third_part/json JSON_SOURCE)
+aux_source_directory(src/main/cpp DIR_SOURCE)
+aux_source_directory(src/main/cpp/include/third_part/json JSON_SOURCE)
 #aux_source_directory(src/main/cpp/json JSON_SOURCE)
 #aux_source_directory(src/main/cpp/encrypt ENCRYPT_SOURCE)
 

+ 11 - 11
module_eyuan/library_eyuan/build.gradle

@@ -12,12 +12,12 @@ android {
         minSdk rootProject.ext.android.minSdk
         targetSdk rootProject.ext.android.targetSdk
 
-        externalNativeBuild {
-            cmake {
-                cppFlags '-std=c++11 -frtti -fexceptions -lz'
-                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
-            }
-        }
+//        externalNativeBuild {
+//            cmake {
+//                cppFlags '-std=c++11 -frtti -fexceptions -lz'
+//                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
+//            }
+//        }
     }
 
 
@@ -49,11 +49,11 @@ android {
         jvmTarget = "1.8"
     }
 
-    externalNativeBuild {
-        cmake {
-            path "CMakeLists.txt"
-        }
-    }
+//    externalNativeBuild {
+//        cmake {
+//            path "CMakeLists.txt"
+//        }
+//    }
 
 }
 

+ 23 - 114
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/EYuanGameSdk.kt

@@ -1,19 +1,11 @@
 package cn.yyxx.eyuangame
 
 import android.app.Activity
-import android.app.Application
-import android.content.Context
 import android.content.Intent
-import android.os.Build
-import android.text.TextUtils
-import android.webkit.WebView
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuangame.entity.SdkChargeInfo
-import cn.yyxx.eyuangame.entity.SdkEvent
-import cn.yyxx.eyuangame.entity.SdkRoleInfo
 import cn.yyxx.eyuangame.impl.GameSdkImpl
-import cn.yyxx.eyuangame.internal.ICallback
-import cn.yyxx.support.AppUtils
 
 /**
  * @author #Suyghur.
@@ -24,10 +16,6 @@ class EYuanGameSdk private constructor() {
     private val impl: GameSdkImpl by lazy {
         GameSdkImpl()
     }
-    private var processName: String = ""
-    private var clickLoginTime = 0L
-    private var clickLogoutTime = 0L
-    private var clickChargeTime = 0L
 
     private var doSdkInit = false
 
@@ -51,43 +39,6 @@ class EYuanGameSdk private constructor() {
         }
     }
 
-    /**
-     * 同步Application中的attachBaseContext
-     */
-    fun attachBaseContext(application: Application, context: Context) {
-        if (TextUtils.isEmpty(processName)) {
-            this.processName = AppUtils.getProcessName(application)
-        }
-        if (TextUtils.isEmpty(processName) || processName != context.packageName) {
-            return
-        }
-        impl.attachBaseContext(application, context)
-    }
-
-
-    /**
-     * 同步Application中的onCreate
-     */
-    fun initApplication(application: Application) {
-        if (TextUtils.isEmpty(processName)) {
-            this.processName = AppUtils.getProcessName(application)
-        }
-        //处理Android P webView的坑
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
-            try {
-                if (application.packageName != processName) {
-                    WebView.setDataDirectorySuffix(processName)
-                }
-            } catch (e: Exception) {
-                e.printStackTrace()
-            }
-        }
-        if (TextUtils.isEmpty(processName) || processName != application.packageName) {
-            return
-        }
-        impl.initApplication(application)
-    }
-
     /**
      * SDK初始化
      *
@@ -95,7 +46,7 @@ class EYuanGameSdk private constructor() {
      * @param isLandscape 是否横屏
      * @param callback    SDK初始化回调
      */
-    fun initialize(activity: Activity, isLandscape: Boolean, callback: ICallback) {
+    fun initialize(activity: Activity, isLandscape: Boolean, callback: (Int, String) -> Unit) {
         //有些CP在资源再加时候回重复调用初始化,这里拦截一下
         if (doSdkInit) {
             Logger.e("EYuanGameSdk initialize 已经执行,拦截此次调用")
@@ -104,8 +55,15 @@ class EYuanGameSdk private constructor() {
 
         impl.initialize(activity, isLandscape) { code, result ->
             doSdkInit = code == 0
-            callback.onResult(code, result)
+            callback(code, result)
+        }
+    }
+
+    fun installConfig(activity: Activity, config: String) {
+        if (checkSdkNonInit("installConfig", null)) {
+            return
         }
+        impl.installConfig(activity, config)
     }
 
     /**
@@ -115,22 +73,12 @@ class EYuanGameSdk private constructor() {
      * @param isAutoLogin 是否自动登录
      * @param callback 登录回调对象
      */
-    fun login(activity: Activity, isAutoLogin: Boolean, callback: ICallback) {
+    fun login(activity: Activity, isAutoLogin: Boolean, callback: (Int, String) -> Unit) {
         if (checkSdkNonInit("login", callback)) {
             return
         }
 
-        if (System.currentTimeMillis() - clickLoginTime < CLICK_INTERVAL) {
-            Logger.e("调用登录接口太频繁,拦截此次操作")
-            callback.onResult(-1, "调用登录接口太频繁,拦截此次操作")
-            return
-        }
-
-        clickLoginTime = System.currentTimeMillis()
-
-        impl.login(activity, isAutoLogin) { code, result ->
-            callback.onResult(code, result)
-        }
+        impl.login(activity, isAutoLogin, callback)
     }
 
     /**
@@ -139,28 +87,12 @@ class EYuanGameSdk private constructor() {
      * @param activity Activity上下文
      * @param callback 登出回调对象
      */
-    fun logout(activity: Activity, callback: ICallback) {
+    fun logout(activity: Activity, callback: (Int, String) -> Unit) {
         if (checkSdkNonInit("logout", callback)) {
             return
         }
 
-        if (System.currentTimeMillis() - clickLoginTime < CLICK_INTERVAL) {
-            Logger.e("调用登录接口后,调用登出账号接口间隔太短,拦截此次操作")
-            callback.onResult(-1, "调用登录接口后,调用登出账号接口间隔太短,拦截此次操作")
-            return
-        }
-
-        if (System.currentTimeMillis() - clickLogoutTime < CLICK_INTERVAL) {
-            Logger.e("调用登出账号接口太频繁,拦截此次操作")
-            callback.onResult(-1, "调用登出账号接口太频繁,拦截此次操作")
-            return
-        }
-
-        clickLogoutTime = System.currentTimeMillis()
-
-        impl.logout(activity) { code, result ->
-            callback.onResult(code, result)
-        }
+        impl.logout(activity, callback)
     }
 
     /**
@@ -168,22 +100,13 @@ class EYuanGameSdk private constructor() {
      *
      * @param activity   Activity上下文
      * @param chargeInfo 支付信息实体对象
-     * @param isIab      是否内购
      * @param callback   支付回调对象
      */
-    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: ICallback) {
+    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
         if (checkSdkNonInit("charge", callback)) {
             return
         }
-
-        if (System.currentTimeMillis() - clickChargeTime < CLICK_INTERVAL) {
-            Logger.e("调用充值接口太频繁,拦截此次操作")
-            callback.onResult(-1, "调用充值接口太频繁,拦截此次操作")
-            return
-        }
-        impl.charge(activity, chargeInfo, isIab) { code, result ->
-            callback.onResult(code, result)
-        }
+        impl.charge(activity, chargeInfo, callback)
     }
 
     /**
@@ -233,9 +156,9 @@ class EYuanGameSdk private constructor() {
      * @param activity Activity上下文
      * @param callback 退出回调对象
      */
-    fun openExitView(activity: Activity, callback: ICallback) {
+    fun openExitView(activity: Activity, callback: (Int, String) -> Unit) {
         impl.openExitView(activity) { code, result ->
-            callback.onResult(code, result)
+            callback(code, result)
         }
     }
 
@@ -284,26 +207,12 @@ class EYuanGameSdk private constructor() {
         return Version.VERSION_NAME
     }
 
-    fun traceEvent(context: Context, sdkEvent: SdkEvent) {
-        if (checkSdkNonInit("traceEvent", null)) {
-            return
-        }
-        impl.traceEvent(context, sdkEvent)
-    }
-
-    fun share(activity: Activity, line: String, tag: String, quote: String, callback: ICallback) {
-        if (checkSdkNonInit("share", null)) {
-            return
-        }
-        impl.share(activity, line, tag, quote) { code, result ->
-            callback.onResult(code, result)
-        }
-    }
-
-    private fun checkSdkNonInit(function: String, callback: ICallback?): Boolean {
+    private fun checkSdkNonInit(function: String, callback: ((Int, String) -> Unit)?): Boolean {
         return if (!doSdkInit) {
             Logger.e("invoke $function error ... EYuanGameSdk not initialized yet")
-            callback?.onResult(-1, "EYuanGameSdk 还未进行初始化")
+            if (callback != null) {
+                callback(-1, "EYuanGameSdk 还未进行初始化")
+            }
             true
         } else {
             false

+ 0 - 22
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/entity/ResultInfo.kt

@@ -1,22 +0,0 @@
-package cn.yyxx.eyuangame.entity
-
-/**
- * @author #Suyghur.
- * Created on 2021/06/21
- */
-data class ResultInfo(
-    /**
-     * 1是成功,非1失败
-     */
-    var code: Int = -1,
-
-    /**
-     * 返回信息
-     */
-    var msg: String = "",
-
-    /**
-     * 返回的数据
-     */
-    var data: String = "",
-)

+ 0 - 29
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/entity/SdkChargeInfo.kt

@@ -1,29 +0,0 @@
-package cn.yyxx.eyuangame.entity
-
-/**
- * @author #Suyghur.
- * Created on 2021/06/15
- */
-class SdkChargeInfo {
-    var userId: String = ""
-    var roleId: String = ""
-    var roleName: String = ""
-    var roleLevel: String = ""
-    var roleCTime: Long = 0
-    var serverId: String = ""
-    var serverName: String = ""
-    var amount = 0
-    var productId: String = ""
-    var productName: String = ""
-    var productDesc: String = ""
-    var cpOrderId: String = ""
-    var orderId: String = ""
-    var cpExt: String = ""
-    var cpPayTime: Long = 0
-    var cpPaySign: String = ""
-
-    override fun toString(): String {
-        return "SdkChargeInfo(userId='$userId', roleId='$roleId', roleName='$roleName', roleLevel='$roleLevel', roleCTIme=$roleCTime, serverId='$serverId', serverName='$serverName', amount=$amount, productId='$productId', productName='$productName', productDesc='$productDesc', cpOrderId='$cpOrderId', orderId='$orderId', cpExt='$cpExt', cpPayTime=$cpPayTime, cpPaySign='$cpPaySign')"
-    }
-
-}

+ 0 - 23
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/entity/SdkRoleInfo.kt

@@ -1,23 +0,0 @@
-package cn.yyxx.eyuangame.entity
-
-/**
- * @author #Suyghur.
- * Created on 2021/06/15
- */
-class SdkRoleInfo {
-    var userId: String = ""
-    var roleId: String = ""
-    var roleName: String = ""
-    var roleLevel: String = ""
-    var roleCTime: Long = 0
-    var serverId: String = ""
-    var serverName: String = ""
-    var vipLevel: String = ""
-    var balance: String = ""
-    var totalPurchase: Int = 0
-
-
-    override fun toString(): String {
-        return "SdkRoleInfo(userId='$userId', roleId='$roleId', roleName='$roleName', roleLevel='$roleLevel', roleCTime=$roleCTime, serverId='$serverId', serverName='$serverName', vipLevel='$vipLevel', balance='$balance', totalPurchase=$totalPurchase)"
-    }
-}

+ 21 - 21
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/GameSdkDrive.kt

@@ -8,25 +8,25 @@ import android.content.Context
  */
 class GameSdkDrive {
 
-    init {
-        System.loadLibrary("eyuangame")
-    }
-
-    external fun initSdkDrive(context: Context)
-
-    external fun setParam(key: String, value: String)
-
-    external fun getParam(key: String): String
-
-    external fun invokeJob(context: Context, key: String, data: String): String
-
-    external fun parseJob(context: Context, key: String, data: String): String
-
-    external fun getComm(context: Context): String
-
-    companion object {
-        val instance: GameSdkDrive by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
-            GameSdkDrive()
-        }
-    }
+//    init {
+//        System.loadLibrary("eyuangame")
+//    }
+//
+//    external fun initSdkDrive(context: Context)
+//
+//    external fun setParam(key: String, value: String)
+//
+//    external fun getParam(key: String): String
+//
+//    external fun invokeJob(context: Context, key: String, data: String): String
+//
+//    external fun parseJob(context: Context, key: String, data: String): String
+//
+//    external fun getComm(context: Context): String
+//
+//    companion object {
+//        val instance: GameSdkDrive by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+//            GameSdkDrive()
+//        }
+//    }
 }

+ 27 - 162
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/GameSdkImpl.kt

@@ -2,34 +2,28 @@ package cn.yyxx.eyuangame.impl
 
 import android.app.Activity
 import android.app.Activity.RESULT_OK
-import android.app.Application
 import android.content.Context
 import android.content.Intent
 import android.text.TextUtils
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVUtils
+import cn.yyxx.eyuancomm.comm.utils.MMKVHandler
 import cn.yyxx.eyuangame.entity.SdkBackLoginInfo
-import cn.yyxx.eyuangame.entity.SdkChargeInfo
 import cn.yyxx.eyuangame.entity.SdkEvent
-import cn.yyxx.eyuangame.entity.SdkRoleInfo
 import cn.yyxx.eyuangame.entity.bean.init.InitBean
 import cn.yyxx.eyuangame.impl.center.HybridFeatureContainer
 import cn.yyxx.eyuangame.impl.floatball.FloatCenterServiceManager
 import cn.yyxx.eyuangame.impl.iab.ChargeImpl
 import cn.yyxx.eyuangame.impl.login.LoginActivity
 import cn.yyxx.eyuangame.impl.share.ShareImpl
-import cn.yyxx.eyuangame.network.Host
 import cn.yyxx.eyuangame.network.SdkRequest
 import cn.yyxx.eyuangame.trace.TraceEventManager
-import cn.yyxx.eyuangame.utils.ParamsUtils
-import cn.yyxx.eyuangame.widget.dialog.ScaleLoadingDialog
 import cn.yyxx.eyuangame.widget.dialog.TipsDialog
 import cn.yyxx.support.BeanUtils
-import cn.yyxx.support.DensityUtils
 import cn.yyxx.support.ResUtils
 import cn.yyxx.support.device.DeviceInfoUtils
 import com.google.firebase.crashlytics.FirebaseCrashlytics
-import java.util.concurrent.atomic.AtomicInteger
 
 
 /**
@@ -38,132 +32,30 @@ import java.util.concurrent.atomic.AtomicInteger
  */
 class GameSdkImpl {
 
-//    private var hasReadGaid = false
-
     private var initState = false
 
     private var isSubmitRoleData = false
 
-//    @Volatile
-//    private var timeCount = AtomicInteger(0)
-
     private var exitDialog: TipsDialog? = null
 
-    private var initLoadingDialog: ScaleLoadingDialog? = null
-
-    fun attachBaseContext(application: Application, context: Context) {
-        GameSdkDrive.instance.initSdkDrive(application)
-//        GAIDUtils.initGoogleAdid(application) { code, _ ->
-//            if (code == 0) {
-//                if (GAIDUtils.getGoogleAdid() == "00000000-0000-0000-0000-000000000000") {
-//                    Logger.i("谷歌框架可以访问,gaid被限制跟踪,使用android id替代")
-//                    GameSdkDrive.instance.setParam("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
-//                    FirebaseCrashlytics.getInstance().setCustomKey("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
-//                } else {
-//                    Logger.i("谷歌框架可以访问,请求gaid")
-//                    GameSdkDrive.instance.setParam("device_id", GAIDUtils.getGoogleAdid())
-//                    FirebaseCrashlytics.getInstance().setCustomKey("device_id", GAIDUtils.getGoogleAdid())
-//                }
-//            } else {
-//                Logger.e("谷歌框架不可访问,使用android id替代")
-//                GameSdkDrive.instance.setParam("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
-//                FirebaseCrashlytics.getInstance().setCustomKey("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
-//            }
-//            hasReadGaid = true
-//        }
-    }
-
-    fun initApplication(application: Application) {
-        Logger.i("EYuanGameSdk initApplication ...")
-        Host.initHostModel(application)
-        TraceEventManager.instance.initialize(application, object : TraceEventManager.OnTraceIdRead {
-            override fun onAdjustIdRead(id: String) {
-                Logger.d("onAdjustIdRead : $id")
-                GameSdkDrive.instance.setParam("aid", id)
-                MMKVUtils.instance.eventKV.encode("adjust_id", id)
-            }
-        })
+    companion object {
+        var isLandscape = false
+        lateinit var initBean: InitBean
     }
 
     fun initialize(activity: Activity, isLandscape: Boolean, callback: (Int, String) -> Unit) {
         Logger.i("EYuanGameSdk initialize ...")
-        isLand = isLandscape
-        if (TextUtils.isEmpty(ParamsUtils.getGcpCode(activity))) {
-            Logger.e("初始化失败,参数异常,请检查yyxx_cfg.properties中YYXX_GCP_CODE的值")
-            callback(-1, "初始化失败,参数异常,请检查yyxx_cfg.properties中YYXX_GCP_CODE的值")
-            return
-        }
-
-        if (TextUtils.isEmpty(ParamsUtils.getGameCode(activity))) {
-            Logger.e("初始化失败,参数异常,请检查yyxx_cfg.properties中YYXX_GAME_CODE的值")
-            callback(-1, "初始化失败,参数异常,请检查yyxx_cfg.properties中YYXX_GAME_CODE的值")
-            return
-        }
-
-        if (TextUtils.isEmpty(ParamsUtils.getGoogleClientId(activity))) {
-            Logger.e("初始化失败,参数异常,请检查yyxx_cfg.properties中YYXX_SERVER_CLIENT_ID的值")
-            callback(-1, "初始化失败,参数异常,请检查yyxx_cfg.properties中YYXX_SERVER_CLIENT_ID的值")
-            return
-        }
-
-        //获取当前屏幕尺寸
-        GameSdkDrive.instance.setParam("screen", DensityUtils.getResolutionByFullScreen(activity))
-
-        val adjustId = MMKVUtils.instance.eventKV.decodeString("adjust_id")
-        if (TextUtils.isEmpty(adjustId)) {
-            GameSdkDrive.instance.setParam("aid", "")
-        } else {
-            GameSdkDrive.instance.setParam("aid", adjustId!!)
-        }
-
-        showInitLoadingDialog(activity)
-//        if (!hasReadGaid) {
-//            Logger.e("还未完成gaid加载,将延迟初始化")
-//            Thread {
-//                while (!hasReadGaid) {
-//                    try {
-//                        Logger.e("还未完成gaid加载,延迟1s初始化,$hasReadGaid")
-//                        Thread.sleep(1000)
-//                        timeCount.getAndIncrement()
-//                    } catch (e: InterruptedException) {
-//                        e.printStackTrace()
-//                    }
-//                }
-//                activity.runOnUiThread {
-//                    if (TextUtils.isEmpty(GAIDUtils.getGoogleAdid())) {
-//                        Logger.e("加载gaid失败,共延迟${timeCount}s初始化,将进行初始化操作...")
-//                    } else {
-//                        Logger.i("加载gaid成功,共延迟${timeCount}s初始化,将进行初始化操作...")
-//                    }
-//                    startSdkInit(activity, callback)
-//                }
-//            }.start()
-//        } else {
-//            Logger.i("加载gaid成功,开始初始化...")
-//            startSdkInit(activity, callback)
-//        }
-        startSdkInit(activity, callback)
+        GameSdkImpl.isLandscape = isLandscape
+        initState = true
+        callback(0, "SDK初始化成功")
     }
 
-    private fun startSdkInit(activity: Activity, callback: (Int, String) -> Unit) {
-        SdkRequest.instance.initSdk(activity) { resultInfo ->
-            hideInitLoadingDialog()
-            if (resultInfo.code == 1 && !TextUtils.isEmpty(resultInfo.data)) {
-                initBean = InitBean.toBean(resultInfo.data)
-                cacheImageResource(activity)
-
-                TraceEventManager.instance.create(activity)
-                FloatCenterServiceManager.instance.init(activity)
-                initState = true
-                callback(0, "SDK初始化成功")
-            } else {
-                initState = false
-                callback(-1, "SDK初始化失败")
-            }
-        }
+    fun installConfig(activity: Activity, config: String) {
+        initBean = InitBean.toBean(config)
+        cacheImageResource(activity)
+        FloatCenterServiceManager.instance.init(activity)
     }
 
-
     private fun cacheImageResource(activity: Activity) {
         //全图标
         SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
@@ -213,7 +105,7 @@ class GameSdkImpl {
         callback(0, "用户登出成功")
     }
 
-    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: (Int, String) -> Unit) {
+    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
         Logger.i("EYuanGameSdk charge ...")
 
         if (!initState) {
@@ -243,25 +135,20 @@ class GameSdkImpl {
             callback(-1, "支付失败,支付信息对象拷贝过程异常")
             return
         }
-        if (isIab) {
-            ChargeImpl.instance.charge(activity, innerChargeInfo) { code, result ->
-                when (code) {
-                    0 -> {
-                        TraceEventManager.instance.charge(activity, innerChargeInfo)
-                        callback(0, result)
-                    }
-                    1 -> {
-                        //H5支付
-                        HybridFeatureContainer(activity, initBean.floatCfg.chargeCfg.url).show()
-                    }
-                    else -> {
-                        callback(-1, result)
-                    }
+        ChargeImpl.instance.charge(activity, innerChargeInfo) { code, result ->
+            when (code) {
+                0 -> {
+                    TraceEventManager.instance.charge(activity, innerChargeInfo)
+                    callback(0, result)
+                }
+                1 -> {
+                    //H5支付
+                    HybridFeatureContainer(activity, initBean.floatCfg.chargeCfg.url).show()
+                }
+                else -> {
+                    callback(-1, result)
                 }
             }
-        } else {
-            //H5支付
-            HybridFeatureContainer(activity, initBean.floatCfg.chargeCfg.url).show()
         }
     }
 
@@ -357,7 +244,7 @@ class GameSdkImpl {
         Logger.i("EYuanGameSdk onDestroy ...")
         FloatCenterServiceManager.instance.release()
         TraceEventManager.instance.release()
-        MMKVUtils.instance.release()
+        MMKVHandler.instance.release()
     }
 
     fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
@@ -404,26 +291,4 @@ class GameSdkImpl {
         ShareImpl.instance.invokeShare2Fb(activity, line, tag, quote, callback)
     }
 
-    private fun showInitLoadingDialog(context: Context) {
-        initLoadingDialog?.apply {
-            dismiss()
-            initLoadingDialog = null
-        }
-
-        initLoadingDialog = ScaleLoadingDialog(context, "")
-        initLoadingDialog?.show()
-    }
-
-    private fun hideInitLoadingDialog() {
-        initLoadingDialog?.apply {
-            dismiss()
-            initLoadingDialog = null
-        }
-    }
-
-    companion object {
-        var isLand = false
-        lateinit var initBean: InitBean
-    }
-
 }

+ 1 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/BindAccountContainer.kt

@@ -50,7 +50,7 @@ class BindAccountContainer(context: Context, private val callback: (Int, String)
 
         val attr = window?.attributes as WindowManager.LayoutParams
         attr.height = DensityUtils.dip2px(context, 250f)
-        if (GameSdkImpl.isLand) {
+        if (GameSdkImpl.isLandscape) {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] / 2
         } else {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] - 80

+ 1 - 2
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/BindEmailContainer.kt

@@ -54,7 +54,7 @@ class BindEmailContainer(context: Context, private val callback: (Int, String) -
 
         val attr = window?.attributes as WindowManager.LayoutParams
         attr.height = DensityUtils.dip2px(context, 250f)
-        if (GameSdkImpl.isLand) {
+        if (GameSdkImpl.isLandscape) {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] / 2
         } else {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] - 80
@@ -66,7 +66,6 @@ class BindEmailContainer(context: Context, private val callback: (Int, String) -
 
         ivReturn.setOnClickListener {
             dismiss()
-
         }
 
         llGroup = findViewById(ResUtils.getResId(context, "yyxx_ll_group", "id"))

+ 1 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/BindPhoneContainer.kt

@@ -63,7 +63,7 @@ class BindPhoneContainer(context: Context, private val callback: (Int, String) -
 
         val attr = window?.attributes as WindowManager.LayoutParams
         attr.height = DensityUtils.dip2px(context, 250f)
-        if (GameSdkImpl.isLand) {
+        if (GameSdkImpl.isLandscape) {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] / 2
         } else {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] - 80

+ 4 - 6
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/HybridFeatureContainer.kt

@@ -13,13 +13,13 @@ import android.view.*
 import android.webkit.*
 import android.widget.FrameLayout
 import android.widget.ImageView
+import cn.yyxx.eyuancomm.comm.impl.CommSdkDrive
+import cn.yyxx.eyuancomm.comm.network.Host
 import cn.yyxx.eyuancomm.comm.utils.Logger
 import cn.yyxx.eyuangame.entity.SdkBackLoginInfo
-import cn.yyxx.eyuangame.impl.GameSdkDrive
 import cn.yyxx.eyuangame.impl.GameSdkImpl
 import cn.yyxx.eyuangame.impl.SdkJsImpl
 import cn.yyxx.eyuangame.impl.share.ShareImpl
-import cn.yyxx.eyuangame.network.Host
 import cn.yyxx.eyuangame.network.SdkRequest
 import cn.yyxx.eyuangame.widget.dialog.ScaleLoadingDialog
 import cn.yyxx.support.DensityUtils
@@ -48,7 +48,7 @@ class HybridFeatureContainer(private val activity: Activity, private val url: St
     private val jsCallback = object : (String, String) -> String {
         override fun invoke(method: String, data: String): String {
             when (method) {
-                "getCommon" -> return GameSdkDrive.instance.getComm(activity)
+                "getCommon" -> return CommSdkDrive.instance.getCommMap()
                 "getToken" -> return SdkBackLoginInfo.instance.token
                 "close" -> {
                     activity.runOnUiThread {
@@ -133,16 +133,14 @@ class HybridFeatureContainer(private val activity: Activity, private val url: St
 
         val attr = window?.attributes as WindowManager.LayoutParams
         attr.height = ViewGroup.LayoutParams.WRAP_CONTENT
-        if (GameSdkImpl.isLand) {
+        if (GameSdkImpl.isLandscape) {
             attr.width = (3 * DensityUtils.getHeightAndWidth(context)[0]) / 4
         } else {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] - 80
         }
-//        attr.width = ViewGroup.LayoutParams.WRAP_CONTENT
         attr.gravity = Gravity.CENTER
         showDialog(context)
         initWebView()
-
     }
 
     private fun initWebView() {

+ 1 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/MemberCenterContainer.kt

@@ -51,7 +51,7 @@ class MemberCenterContainer(context: Context) : Dialog(context) {
 
         val attr = window?.attributes as WindowManager.LayoutParams
         attr.height = DensityUtils.dip2px(context, 250f)
-        if (GameSdkImpl.isLand) {
+        if (GameSdkImpl.isLandscape) {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] / 2
         } else {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] - 80

+ 1 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/center/ModifyPwdContainer.kt

@@ -49,7 +49,7 @@ class ModifyPwdContainer(context: Context) : Dialog(context) {
 
         val attr = window?.attributes as WindowManager.LayoutParams
         attr.height = DensityUtils.dip2px(context, 250f)
-        if (GameSdkImpl.isLand) {
+        if (GameSdkImpl.isLandscape) {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] / 2
         } else {
             attr.width = DensityUtils.getHeightAndWidth(context)[0] - 80

+ 1 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/floatball/FloatCenterService.kt

@@ -129,7 +129,7 @@ class FloatCenterService : Service() {
         }
 
         if (floatingBall == null) {
-            floatingBall = FloatingBall(mActivity!!, GameSdkImpl.isLand, callback)
+            floatingBall = FloatingBall(mActivity!!, GameSdkImpl.isLandscape, callback)
         }
         floatingBall?.attach()
     }

+ 44 - 80
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/iab/ChargeImpl.kt

@@ -2,16 +2,14 @@ package cn.yyxx.eyuangame.impl.iab
 
 import android.app.Activity
 import android.text.TextUtils
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVUtils
-import cn.yyxx.eyuangame.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.utils.MMKVHandler
 import cn.yyxx.eyuangame.impl.GameSdkImpl
-import cn.yyxx.eyuangame.network.SdkRequest
 import cn.yyxx.support.ResUtils
 import cn.yyxx.support.hawkeye.ToastUtils
 import com.android.billingclient.api.*
 import org.json.JSONException
-import org.json.JSONObject
 
 /**
  * @author #Suyghur.
@@ -33,7 +31,7 @@ class ChargeImpl : InAppBilling() {
         this.implCallback = callback
         this.chargeInfo = chargeInfo
         showDialog(activity)
-        getOrderId(activity)
+        createOrder(activity)
     }
 
     override fun chargePurchasesUpdated(activity: Activity, purchase: Purchase) {
@@ -138,54 +136,20 @@ class ChargeImpl : InAppBilling() {
     /**
      * 获取订单号
      */
-    private fun getOrderId(activity: Activity) {
-        SdkRequest.instance.createOrder(activity, chargeInfo) { resultInfo ->
-            if (resultInfo.code == 1 && !TextUtils.isEmpty(resultInfo.data)) {
-                try {
-                    val jsonObject = JSONObject(resultInfo.data)
-                    chargeInfo.orderId = jsonObject.getString("order_id")
-                    val payment = jsonObject.getInt("payment")
-                    Logger.d("order_id ---> ${chargeInfo.orderId}")
-                    Logger.d("payment ---> $payment")
-
-                    when (payment) {
-                        1 -> {
-                            // 获取订单号成功,初始化IAB收银台客户端
-                            Logger.d("获取订单号成功,初始化IAB收银台客户端")
-                            initializeBillingClient(activity)
-                            connectGooglePlay(activity, false)
-                        }
-                        3 -> {
-                            // 切换第三方支付
-                            dismissDialog()
-                            implCallback(1, "切换第三方支付")
-                        }
-                        else -> {
-                            dismissDialog()
-                            ToastUtils.toastInfo(activity, ResUtils.getResString(activity, "yyxx_charge_tv_error"))
-                            implCallback(-1, "获取订单异常")
-                        }
-                    }
-                } catch (e: JSONException) {
-                    e.printStackTrace()
-                    dismissDialog()
-                    val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
-                        ResUtils.getResString(activity, "yyxx_charge_tv_error")
-                    } else {
-                        resultInfo.msg
-                    }
-                    ToastUtils.toastInfo(activity, msg)
-                    implCallback(-1, "获取订单异常")
-                }
-            } else {
+    private fun createOrder(activity: Activity) {
+        Logger.d("order_id ---> ${chargeInfo.orderId}")
+        Logger.d("payment ---> ${chargeInfo.payment}")
+        when (chargeInfo.payment) {
+            1 -> {
+                // 获取订单号成功,初始化IAB收银台客户端
+                Logger.d("获取订单号成功,初始化IAB收银台客户端")
+                initializeBillingClient(activity)
+                connectGooglePlay(activity, false)
+            }
+            3 -> {
+                // 切换第三方支付
                 dismissDialog()
-                val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
-                    ResUtils.getResString(activity, "yyxx_charge_tv_error")
-                } else {
-                    resultInfo.msg
-                }
-                ToastUtils.toastInfo(activity, msg)
-                implCallback(-1, "获取订单异常")
+                implCallback(1, "切换第三方支付")
             }
         }
     }
@@ -248,31 +212,31 @@ class ChargeImpl : InAppBilling() {
      * 通知服务端发货
      */
     private fun notifyOrder2Backend(activity: Activity, orderId: String, purchase: Purchase, isCache: Boolean = false) {
-        SdkRequest.instance.notifyOrder(activity, orderId, purchase.originalJson) { resultInfo ->
-            when (resultInfo.code) {
-                1 -> {
-                    //消耗订单
-                    consumeAsync(activity, purchase, isCache)
-                }
-                2 -> {
-                    Logger.d(resultInfo.msg)
-                    consumeAsync(activity, purchase, isCache)
-                }
-                else -> {
-                    //失败则缓存订单
-                    saveOrderInfo(purchase.orderId, orderId)
-                    dismissDialog()
-                    disConnection()
-                    val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
-                        ResUtils.getResString(activity, "yyxx_charge_tv_error")
-                    } else {
-                        resultInfo.msg
-                    }
-                    ToastUtils.toastInfo(activity, msg)
-                    implCallback(-1, "发货失败")
-                }
-            }
-        }
+//        SdkRequest.instance.notifyOrder(activity, orderId, purchase.originalJson) { resultInfo ->
+//            when (resultInfo.code) {
+//                1 -> {
+//                    //消耗订单
+//                    consumeAsync(activity, purchase, isCache)
+//                }
+//                2 -> {
+//                    Logger.d(resultInfo.msg)
+//                    consumeAsync(activity, purchase, isCache)
+//                }
+//                else -> {
+//                    //失败则缓存订单
+//                    saveOrderInfo(purchase.orderId, orderId)
+//                    dismissDialog()
+//                    disConnection()
+//                    val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
+//                        ResUtils.getResString(activity, "yyxx_charge_tv_error")
+//                    } else {
+//                        resultInfo.msg
+//                    }
+//                    ToastUtils.toastInfo(activity, msg)
+//                    implCallback(-1, "发货失败")
+//                }
+//            }
+//        }
     }
 
     /**
@@ -328,14 +292,14 @@ class ChargeImpl : InAppBilling() {
 
     private fun saveOrderInfo(googleOrderId: String, orderId: String) {
         try {
-            MMKVUtils.instance.orderKV.encode(googleOrderId, orderId)
+            MMKVHandler.instance.orderKV.encode(googleOrderId, orderId)
         } catch (e: JSONException) {
             e.printStackTrace()
         }
     }
 
     private fun getOrderInfo(googleOrderId: String): String {
-        val info = MMKVUtils.instance.orderKV.decodeString(googleOrderId)
+        val info = MMKVHandler.instance.orderKV.decodeString(googleOrderId)
         Logger.d("getOrderInfo : $info")
         return if (TextUtils.isEmpty(info)) {
             ""
@@ -345,7 +309,7 @@ class ChargeImpl : InAppBilling() {
     }
 
     private fun removeOrderInfo(googleOrderId: String) {
-        MMKVUtils.instance.orderKV.removeValueForKey(googleOrderId)
+        MMKVHandler.instance.orderKV.removeValueForKey(googleOrderId)
     }
 
 

+ 2 - 2
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/login/LoginActivity.kt

@@ -229,12 +229,12 @@ class LoginActivity : FragmentActivity(), View.OnClickListener {
     }
 
     private fun initView() {
-        if (GameSdkImpl.isLand) {
+        if (GameSdkImpl.isLandscape) {
             window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
         }
         setContentView(ResUtils.getResId(this, "yyxx_login", "layout"))
 
-        if (!GameSdkImpl.isLand) {
+        if (!GameSdkImpl.isLandscape) {
             AndroidBug5497Workaround.assistActivity(this)
         }
 

+ 1 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/login/UserSignInImpl.kt

@@ -5,12 +5,12 @@ import android.content.Context
 import android.content.Intent
 import android.text.TextUtils
 import cn.yyxx.eyuancomm.comm.utils.Logger
+import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
 import cn.yyxx.eyuangame.entity.LoginType
 import cn.yyxx.eyuangame.entity.SdkBackLoginInfo
 import cn.yyxx.eyuangame.entity.Session
 import cn.yyxx.eyuangame.network.SdkRequest
 import cn.yyxx.eyuangame.widget.dialog.ScaleLoadingDialog
-import cn.yyxx.eyuangame.utils.ParamsUtils
 import cn.yyxx.support.ResUtils
 import cn.yyxx.support.hawkeye.ToastUtils
 import com.facebook.*

+ 2 - 3
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/login/fragment/LauncherFragment.kt

@@ -76,7 +76,6 @@ class LauncherFragment : Fragment(), View.OnClickListener {
         mInflater = inflater
         mView = inflater.inflate(ResUtils.getResId(requireActivity(), "yyxx_login_launcher", "layout"), container, false)
         initView(mView)
-        Logger.d("aaaa")
         return mView
     }
 
@@ -297,7 +296,7 @@ class LauncherFragment : Fragment(), View.OnClickListener {
             dismiss()
             forgetPwdDialog = null
         }
-        forgetPwdDialog = ForgetPwdDialog(requireContext(), GameSdkImpl.isLand)
+        forgetPwdDialog = ForgetPwdDialog(requireContext(), GameSdkImpl.isLandscape)
         forgetPwdDialog?.apply {
             loginImpl.hideLoginView()
             ivReturn.setOnClickListener {
@@ -330,7 +329,7 @@ class LauncherFragment : Fragment(), View.OnClickListener {
             dismiss()
             agreementDialog = null
         }
-        agreementDialog = AgreementDialog(requireContext(), GameSdkImpl.initBean.privacyCfg.url, GameSdkImpl.isLand)
+        agreementDialog = AgreementDialog(requireContext(), GameSdkImpl.initBean.privacyCfg.url, GameSdkImpl.isLandscape)
         agreementDialog?.apply {
             loginImpl.hideLoginView()
             ivReturn.setOnClickListener {

+ 1 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/impl/login/fragment/RegisterFragment.kt

@@ -137,7 +137,7 @@ class RegisterFragment : Fragment(), View.OnClickListener {
             dismiss()
             agreementDialog = null
         }
-        agreementDialog = AgreementDialog(requireContext(), GameSdkImpl.initBean.privacyCfg.url, GameSdkImpl.isLand)
+        agreementDialog = AgreementDialog(requireContext(), GameSdkImpl.initBean.privacyCfg.url, GameSdkImpl.isLandscape)
         agreementDialog?.apply {
             loginImpl.hideLoginView()
             ivReturn.setOnClickListener {

+ 0 - 10
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/internal/ICallback.kt

@@ -1,10 +0,0 @@
-package cn.yyxx.eyuangame.internal
-
-/**
- * @author #Suyghur.
- * Created on 2021/06/12
- */
-interface ICallback {
-
-    fun onResult(code: Int, result: String)
-}

+ 1 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/internal/ITrace.kt

@@ -3,7 +3,7 @@ package cn.yyxx.eyuangame.internal
 import android.app.Activity
 import android.app.Application
 import android.content.Context
-import cn.yyxx.eyuangame.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import cn.yyxx.eyuangame.entity.SdkEvent
 
 /**

+ 85 - 89
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/network/Host.kt

@@ -1,89 +1,85 @@
-package cn.yyxx.eyuangame.network
-
-import android.content.Context
-import cn.yyxx.eyuangame.utils.ParamsUtils
-import cn.yyxx.support.HostModelUtils
-
-/**
- * @author #Suyghur.
- * Created on 2021/06/17
- */
-object Host {
-
-    private var DEFAULT_ONLINE_HOST = ""
-    private var DEFAULT_TEST_HOST = ""
-
-    private const val DEFAULT_ONLINE_HOST_HK = "https://sdkapi.eyuangame.com"
-    private const val DEFAULT_TEST_HOST_HK = "https://testsdkapi.eyuangame.com"
-
-    private const val DEFAULT_ONLINE_HOST_VN = "https://sdkapi.aiigame.com"
-    private const val DEFAULT_TEST_HOST_VN = "https://testsdkapi.aiigame.com"
-
-    var HOST = ""
-
-    /**
-     * 默认线上环境
-     */
-    var IP_MODEL = 3
-
-    /**
-     * 默认港澳台
-     */
-    var ENV = 1
-
-    const val BASIC_ROUTE_INIT_SDK = "activate"
-    const val BASIC_ROUTE_LOGIN = "member_login"
-    const val BASIC_ROUTE_THIRD_PART_LOGIN = "third_plat_login"
-    const val BASIC_ROUTE_REGISTER = "member_register"
-    const val BASIC_ROUTE_BIND_ACCOUNT = "bind_member_user"
-    const val BASIC_ROUTE_BIND_PHONE = "bind_phone"
-    const val BASIC_ROUTE_BIND_EMAIL = "bind_email"
-    const val BASIC_ROUTE_GET_PHONE_CAPTCHA = "phone_captcha"
-    const val BASIC_ROUTE_GET_EMAIL_CAPTCHA = "email_captcha"
-    const val BASIC_ROUTE_FORGET_PWD_BY_PHONE = "forgot_pwd_auto"
-    const val BASIC_ROUTE_FORGET_PWD_BY_EMAIL = "forgot_pwd_email_auto"
-    const val BASIC_ROUTE_MODIFY_PWD = "modify_pwd"
-    const val BASIC_ROUTE_CREATE_ORDER = "iap_init"
-    const val BASIC_ROUTE_NOTIFY_ORDER = "iap_notify"
-    const val BASIC_ROUTE_NOTIFY_REWARD = ""
-    const val BASIC_ROUTE_SUBMIT_ROLE_INFO = "game_role_report"
-    const val BASIC_ROUTE_UPLOAD_SDK_LOG = "upload_log"
-
-
-    fun initHostModel(context: Context) {
-        IP_MODEL = HostModelUtils.getHostModel(context)
-        ENV = ParamsUtils.getDoMainEnv(context)
-        setDefaultHost()
-    }
-
-    fun originHost(url: String): Boolean {
-        return (url.startsWith(DEFAULT_ONLINE_HOST_HK)
-                || url.startsWith(DEFAULT_TEST_HOST_HK)
-                || url.startsWith(DEFAULT_ONLINE_HOST_VN)
-                || url.startsWith(DEFAULT_TEST_HOST_VN))
-
-    }
-
-    private fun setDefaultHost() {
-        DEFAULT_ONLINE_HOST = when (ENV) {
-            Env.HK -> DEFAULT_ONLINE_HOST_HK
-            Env.VN -> DEFAULT_ONLINE_HOST_VN
-            else -> DEFAULT_ONLINE_HOST_HK
-        }
-        DEFAULT_TEST_HOST = when (ENV) {
-            Env.HK -> DEFAULT_TEST_HOST_HK
-            Env.VN -> DEFAULT_TEST_HOST_VN
-            else -> DEFAULT_TEST_HOST_HK
-        }
-        HOST = when (IP_MODEL) {
-            HostModelUtils.ENV_TEST -> DEFAULT_TEST_HOST
-            HostModelUtils.ENV_ONLINE -> DEFAULT_ONLINE_HOST
-            else -> DEFAULT_ONLINE_HOST
-        }
-    }
-
-    object Env {
-        const val HK = 1
-        const val VN = 2
-    }
-}
+//package cn.yyxx.eyuangame.network
+//
+//import android.content.Context
+//import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
+//import cn.yyxx.support.HostModelUtils
+//
+///**
+// * @author #Suyghur.
+// * Created on 2021/06/17
+// */
+//object Host {
+//
+//    private var DEFAULT_ONLINE_HOST = ""
+//    private var DEFAULT_TEST_HOST = ""
+//
+//    private const val DEFAULT_ONLINE_HOST_HK = "https://sdkapi.eyuangame.com"
+//    private const val DEFAULT_TEST_HOST_HK = "https://testsdkapi.eyuangame.com"
+//
+//    private const val DEFAULT_ONLINE_HOST_VN = "https://sdkapi.aiigame.com"
+//    private const val DEFAULT_TEST_HOST_VN = "https://testsdkapi.aiigame.com"
+//
+//    var HOST = ""
+//
+//    /**
+//     * 默认线上环境
+//     */
+//    var IP_MODEL = 3
+//
+//    /**
+//     * 默认港澳台
+//     */
+//    var ENV = 1
+//
+//    const val BASIC_ROUTE_LOGIN = "member_login"
+//    const val BASIC_ROUTE_THIRD_PART_LOGIN = "third_plat_login"
+//    const val BASIC_ROUTE_REGISTER = "member_register"
+//    const val BASIC_ROUTE_BIND_ACCOUNT = "bind_member_user"
+//    const val BASIC_ROUTE_BIND_PHONE = "bind_phone"
+//    const val BASIC_ROUTE_BIND_EMAIL = "bind_email"
+//    const val BASIC_ROUTE_GET_PHONE_CAPTCHA = "phone_captcha"
+//    const val BASIC_ROUTE_GET_EMAIL_CAPTCHA = "email_captcha"
+//    const val BASIC_ROUTE_FORGET_PWD_BY_PHONE = "forgot_pwd_auto"
+//    const val BASIC_ROUTE_FORGET_PWD_BY_EMAIL = "forgot_pwd_email_auto"
+//    const val BASIC_ROUTE_MODIFY_PWD = "modify_pwd"
+//    const val BASIC_ROUTE_SUBMIT_ROLE_INFO = "game_role_report"
+//    const val BASIC_ROUTE_UPLOAD_SDK_LOG = "upload_log"
+//
+//
+//    fun initHostModel(context: Context) {
+//        IP_MODEL = HostModelUtils.getHostModel(context)
+//        ENV = ParamsUtils.getDoMainEnv(context)
+//        setDefaultHost()
+//    }
+//
+//    fun originHost(url: String): Boolean {
+//        return (url.startsWith(DEFAULT_ONLINE_HOST_HK)
+//                || url.startsWith(DEFAULT_TEST_HOST_HK)
+//                || url.startsWith(DEFAULT_ONLINE_HOST_VN)
+//                || url.startsWith(DEFAULT_TEST_HOST_VN))
+//
+//    }
+//
+//    private fun setDefaultHost() {
+//        DEFAULT_ONLINE_HOST = when (ENV) {
+//            Env.HK -> DEFAULT_ONLINE_HOST_HK
+//            Env.VN -> DEFAULT_ONLINE_HOST_VN
+//            else -> DEFAULT_ONLINE_HOST_HK
+//        }
+//        DEFAULT_TEST_HOST = when (ENV) {
+//            Env.HK -> DEFAULT_TEST_HOST_HK
+//            Env.VN -> DEFAULT_TEST_HOST_VN
+//            else -> DEFAULT_TEST_HOST_HK
+//        }
+//        HOST = when (IP_MODEL) {
+//            HostModelUtils.ENV_TEST -> DEFAULT_TEST_HOST
+//            HostModelUtils.ENV_ONLINE -> DEFAULT_ONLINE_HOST
+//            else -> DEFAULT_ONLINE_HOST
+//        }
+//    }
+//
+//    object Env {
+//        const val HK = 1
+//        const val VN = 2
+//    }
+//}

+ 65 - 64
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/network/SdkRequest.kt

@@ -1,13 +1,17 @@
 package cn.yyxx.eyuangame.network
 
 import android.content.Context
+import android.text.TextUtils
+import cn.yyxx.eyuancomm.comm.entity.ResultInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
+import cn.yyxx.eyuancomm.comm.network.Host
+import cn.yyxx.eyuancomm.comm.network.VolleyRequest
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuangame.entity.*
+import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
+import cn.yyxx.eyuangame.entity.LoginType
+import cn.yyxx.eyuangame.entity.SdkBackLoginInfo
 import cn.yyxx.eyuangame.ext.zipAll
-import cn.yyxx.eyuangame.internal.IFileRequestCallback
-import cn.yyxx.eyuangame.utils.ParamsUtils
 import cn.yyxx.support.encryption.Md5Utils
-import cn.yyxx.support.volley.source.VolleyError
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.launch
@@ -21,14 +25,20 @@ import java.io.File
  */
 class SdkRequest {
 
-    fun initSdk(context: Context, callback: (ResultInfo) -> Unit) {
-        val jsonObject = JSONObject()
-        try {
-            jsonObject.put("route_path", Host.BASIC_ROUTE_INIT_SDK)
-        } catch (e: JSONException) {
-            e.printStackTrace()
+//    fun initSdk(context: Context, callback: (ResultInfo) -> Unit) {
+//        val jsonObject = JSONObject()
+//        try {
+//            jsonObject.put("route_path", Host.BASIC_ROUTE_INIT_SDK)
+//        } catch (e: JSONException) {
+//            e.printStackTrace()
+//        }
+//        VolleyRequest.post(context, jsonObject, callback)
+//    }
+
+    companion object {
+        val instance: SdkRequest by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+            SdkRequest()
         }
-        VolleyRequest.post(context, jsonObject, callback)
     }
 
     fun userLoginVerify(context: Context, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
@@ -127,44 +137,44 @@ class SdkRequest {
     }
 
 
-    fun createOrder(context: Context, chargeInfo: SdkChargeInfo, callback: (ResultInfo) -> Unit) {
-        val jsonObject = JSONObject()
-        try {
-            jsonObject.put("route_path", Host.BASIC_ROUTE_CREATE_ORDER)
-            jsonObject.put("login_type", SdkBackLoginInfo.instance.loginType)
-            jsonObject.put("uid", chargeInfo.userId)
-            jsonObject.put("role_id", chargeInfo.roleId)
-            jsonObject.put("role_name", chargeInfo.roleName)
-            jsonObject.put("role_level", chargeInfo.roleLevel)
-            jsonObject.put("role_ctime", chargeInfo.roleCTime)
-            jsonObject.put("server_id", chargeInfo.serverId)
-            jsonObject.put("server_name", chargeInfo.serverName)
-            jsonObject.put("amount", chargeInfo.amount)
-            jsonObject.put("product_id", chargeInfo.productId)
-            jsonObject.put("product_name", chargeInfo.productName)
-            jsonObject.put("product_desc", chargeInfo.productDesc)
-            jsonObject.put("cp_order_id", chargeInfo.cpOrderId)
-            jsonObject.put("cp_ext", chargeInfo.cpExt)
-            jsonObject.put("cp_pay_time", chargeInfo.cpPayTime)
-            jsonObject.put("cp_pay_sign", chargeInfo.cpPaySign)
-        } catch (e: JSONException) {
-            e.printStackTrace()
-        }
-        VolleyRequest.post(context, jsonObject, callback)
-    }
-
-
-    fun notifyOrder(context: Context, orderId: String, originalJson: String, callback: (ResultInfo) -> Unit) {
-        val jsonObject = JSONObject()
-        try {
-            jsonObject.put("route_path", Host.BASIC_ROUTE_NOTIFY_ORDER)
-            jsonObject.put("order_id", orderId)
-            jsonObject.put("iap_notify_data", originalJson)
-        } catch (e: JSONException) {
-            e.printStackTrace()
-        }
-        VolleyRequest.post(context, jsonObject, callback)
-    }
+//    fun createOrder(context: Context, chargeInfo: SdkChargeInfo, callback: (ResultInfo) -> Unit) {
+//        val jsonObject = JSONObject()
+//        try {
+//            jsonObject.put("route_path", Host.BASIC_ROUTE_CREATE_ORDER)
+//            jsonObject.put("login_type", SdkBackLoginInfo.instance.loginType)
+//            jsonObject.put("uid", chargeInfo.userId)
+//            jsonObject.put("role_id", chargeInfo.roleId)
+//            jsonObject.put("role_name", chargeInfo.roleName)
+//            jsonObject.put("role_level", chargeInfo.roleLevel)
+//            jsonObject.put("role_ctime", chargeInfo.roleCTime)
+//            jsonObject.put("server_id", chargeInfo.serverId)
+//            jsonObject.put("server_name", chargeInfo.serverName)
+//            jsonObject.put("amount", chargeInfo.amount)
+//            jsonObject.put("product_id", chargeInfo.productId)
+//            jsonObject.put("product_name", chargeInfo.productName)
+//            jsonObject.put("product_desc", chargeInfo.productDesc)
+//            jsonObject.put("cp_order_id", chargeInfo.cpOrderId)
+//            jsonObject.put("cp_ext", chargeInfo.cpExt)
+//            jsonObject.put("cp_pay_time", chargeInfo.cpPayTime)
+//            jsonObject.put("cp_pay_sign", chargeInfo.cpPaySign)
+//        } catch (e: JSONException) {
+//            e.printStackTrace()
+//        }
+//        VolleyRequest.post(context, jsonObject, callback)
+//    }
+
+
+//    fun notifyOrder(context: Context, orderId: String, originalJson: String, callback: (ResultInfo) -> Unit) {
+//        val jsonObject = JSONObject()
+//        try {
+//            jsonObject.put("route_path", Host.BASIC_ROUTE_NOTIFY_ORDER)
+//            jsonObject.put("order_id", orderId)
+//            jsonObject.put("iap_notify_data", originalJson)
+//        } catch (e: JSONException) {
+//            e.printStackTrace()
+//        }
+//        VolleyRequest.post(context, jsonObject, callback)
+//    }
 
     fun submitRoleData(context: Context, timing: Int, roleInfo: SdkRoleInfo, callback: (ResultInfo) -> Unit) {
         val jsonObject = JSONObject()
@@ -188,15 +198,12 @@ class SdkRequest {
     }
 
     fun downloadImageFile(context: Context, url: String) {
-        VolleyRequest.downloadImageFile(context, url, object : IFileRequestCallback {
-            override fun onResponse(result: String) {
-                Logger.d("downloadImageFile onResponse $result")
-            }
-
-            override fun onErrorResponse(error: VolleyError) {
-                Logger.e("downloadImageFile onErrorResponse")
-            }
-        })
+        if (TextUtils.isEmpty(url)) {
+            return
+        }
+        VolleyRequest.downloadImageFile(context, url) { _, result ->
+            Logger.d("downloadImageFile onResponse $result")
+        }
     }
 
 
@@ -221,10 +228,4 @@ class SdkRequest {
             VolleyRequest.uploadFile(context, url, file, jsonObject, callback)
         }
     }
-
-    companion object {
-        val instance: SdkRequest by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
-            SdkRequest()
-        }
-    }
 }

+ 244 - 245
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/network/VolleyRequest.kt

@@ -1,246 +1,245 @@
-package cn.yyxx.eyuangame.network
-
-import android.content.Context
-import android.text.TextUtils
-import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuangame.entity.ResultInfo
-import cn.yyxx.eyuangame.impl.GameSdkDrive
-import cn.yyxx.eyuangame.internal.IFileRequestCallback
-import cn.yyxx.support.FileUtils
-import cn.yyxx.support.JsonUtils
-import cn.yyxx.support.ResUtils
-import cn.yyxx.support.StrUtils
-import cn.yyxx.support.encryption.Base64Utils
-import cn.yyxx.support.encryption.HexUtils
-import cn.yyxx.support.encryption.Md5Utils
-import cn.yyxx.support.volley.MultipartRequest
-import cn.yyxx.support.volley.VolleySingleton
-import cn.yyxx.support.volley.entity.FileEntity
-import cn.yyxx.support.volley.source.*
-import cn.yyxx.support.volley.source.toolbox.HttpHeaderParser
-import cn.yyxx.support.volley.source.toolbox.JsonObjectRequest
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import org.json.JSONException
-import org.json.JSONObject
-import java.io.File
-import java.io.IOException
-
-/**
- * @author #Suyghur.
- * Created on 2021/06/21
- */
-object VolleyRequest {
-
-    private const val MAX_TIMEOUT = 10 * 1000
-
-    fun post(context: Context, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
-        try {
-            val time = System.currentTimeMillis().toString()
-            val randomKey = time + StrUtils.getRandomString(16)
-            val rawKey = Md5Utils.encodeByMD5(randomKey)
-            val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
-            val hexP = GameSdkDrive.instance.invokeJob(context, aesKey.substring(8, 24), jsonObject.toString())
-            val tmp = HexUtils.hexString2Bytes(hexP)
-            val p = Base64Utils.encode(tmp)
-
-            Logger.d("请求路由 : ${jsonObject["route_path"]}")
-            Logger.d("请求参数 : $jsonObject")
-            Logger.logHandler("请求路由 : ${jsonObject["route_path"]}\n")
-            Logger.logHandler("请求参数 : $jsonObject\n")
-            val obj = JSONObject()
-            obj.put("p", p)
-            obj.put("ts", rawKey)
-            Logger.d("$obj")
-            //TODO 拉起登录接口时会莫名其妙ANR,后续再排查
-//            val json = SdkDrive.invokeJob(context, jsonObject.toString())
-//            val obj = JSONObject(json)
-//            //因为native c++中aes加密后生成的base64字符串可能会因为\0的原因被截断,所以使用hex进行编码
-//            //得到json对象后将p内容由hex转为base64,然后再赋值回json对象中的p。
-//            //ts因为是rsa加密,得到的base64字符串不会被截断,可能因为是长度远比aes生成的报文长度短
-//            val hexP = obj.getString("p")
-//            Logger.d("hex: $hexP")
+//package cn.yyxx.eyuangame.network
+//
+//import android.content.Context
+//import android.text.TextUtils
+//import cn.yyxx.eyuancomm.comm.impl.CommSdkDrive
+//import cn.yyxx.eyuancomm.comm.utils.Logger
+//import cn.yyxx.eyuangame.internal.IFileRequestCallback
+//import cn.yyxx.support.FileUtils
+//import cn.yyxx.support.JsonUtils
+//import cn.yyxx.support.ResUtils
+//import cn.yyxx.support.StrUtils
+//import cn.yyxx.support.encryption.Base64Utils
+//import cn.yyxx.support.encryption.HexUtils
+//import cn.yyxx.support.encryption.Md5Utils
+//import cn.yyxx.support.volley.MultipartRequest
+//import cn.yyxx.support.volley.VolleySingleton
+//import cn.yyxx.support.volley.entity.FileEntity
+//import cn.yyxx.support.volley.source.*
+//import cn.yyxx.support.volley.source.toolbox.HttpHeaderParser
+//import cn.yyxx.support.volley.source.toolbox.JsonObjectRequest
+//import kotlinx.coroutines.Dispatchers
+//import kotlinx.coroutines.GlobalScope
+//import kotlinx.coroutines.launch
+//import org.json.JSONException
+//import org.json.JSONObject
+//import java.io.File
+//import java.io.IOException
+//
+///**
+// * @author #Suyghur.
+// * Created on 2021/06/21
+// */
+//object VolleyRequest {
+//
+//    private const val MAX_TIMEOUT = 10 * 1000
+//
+//    fun post(context: Context, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
+//        try {
+//            val time = System.currentTimeMillis().toString()
+//            val randomKey = time + StrUtils.getRandomString(16)
+//            val rawKey = Md5Utils.encodeByMD5(randomKey)
+//            val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
+//            val hexP = CommSdkDrive.instance.invokeJob(aesKey.substring(8, 24), jsonObject.toString())
 //            val tmp = HexUtils.hexString2Bytes(hexP)
-//            val base64P = Base64Utils.encode(tmp)
-//            obj.put("p", base64P)
-            Logger.d("host: ${Host.HOST}")
-
-            val request = object : JsonObjectRequest(Method.POST, Host.HOST, obj, Response.Listener {
-                val resultInfo = ResultInfo()
-                resultInfo.code = -1
-                resultInfo.msg = "接口请求异常"
-                it?.apply {
-                    try {
-                        resultInfo.code = it.getInt("code")
-                        resultInfo.msg = it.getString("msg")
-                        resultInfo.data = if (JsonUtils.hasJsonKey(it, "data")) {
-//                            //返回要对p进行base64 -> hex
-//                            val responseObj = it.getJSONObject("data")
-//                            val base64P2 = responseObj.getString("p")
-//                            val tmp2 = Base64Utils.decode(base64P2)
-//                            val hexP2 = HexUtils.bytes2HexString(tmp2)
-//                            responseObj.put("p", hexP2)
-//                            SdkDrive.parseJob(context, responseObj.toString())
-                            parseResponse(context, it.getJSONObject("data"))
-                        } else {
-                            "{}"
-                        }
-                    } catch (e: JSONException) {
-                        e.printStackTrace()
-                    }
-                }
-                it.put("data", JSONObject(resultInfo.data))
-                Logger.d("返回信息 : $it")
-                Logger.logHandler("返回信息 : $it\n")
-                callback(resultInfo)
-            }, Response.ErrorListener {
-                it?.apply {
-                    Logger.e("postByVolley onErrorResponse : $it")
-                    callback(getErrorResultInfo(context, it))
-                }
-            }) {
-                override fun getHeaders(): MutableMap<String, String> {
-                    val headers = HashMap<String, String>()
-                    headers["Accept"] = "application/json"
-                    headers["Content-Type"] = "application/json;charset=UTF-8"
-                    return headers
-                }
-            }
-            //设置超时时间
-            request.retryPolicy = DefaultRetryPolicy(MAX_TIMEOUT, 1, 1.0f)
-            VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-    }
-
-    fun downloadImageFile(context: Context, url: String, callback: IFileRequestCallback) {
-        val cacheFolder = File(context.getExternalFilesDir("cache")!!.absolutePath)
-        if (!cacheFolder.exists()) {
-            cacheFolder.mkdirs()
-        }
-        val fileName = Md5Utils.encodeByMD5(url)
-        val filePath = "$cacheFolder/$fileName"
-        Logger.d(filePath)
-        if (File(filePath).exists()) {
-            callback.onResponse("image has been cached locally")
-            return
-        }
-        val request: Request<ByteArray> = object : Request<ByteArray>(Method.GET, url, Response.ErrorListener {
-            callback.onErrorResponse(it)
-        }) {
-            override fun parseNetworkResponse(response: NetworkResponse): Response<ByteArray> {
-                return try {
-                    if (response.data == null) {
-                        Response.error(ParseError(response))
-                    } else {
-                        Response.success(response.data, HttpHeaderParser.parseCacheHeaders(response))
-                    }
-                } catch (e: OutOfMemoryError) {
-                    e.printStackTrace()
-                    Response.error(ParseError(e))
-                }
-            }
-
-            override fun deliverResponse(response: ByteArray) {
-                Logger.d("volley download image file success, start to save file ...")
-                try {
-                    GlobalScope.launch(Dispatchers.IO) {
-                        Logger.d("with io coroutines do save file")
-                        FileUtils.saveFile(filePath, response)
-                    }
-                    callback.onResponse("download file success, path: $filePath")
-                } catch (e: IOException) {
-                    e.printStackTrace()
-                    callback.onErrorResponse(ParseError(e))
-                }
-            }
-        }
-
-        VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
-    }
-
-    fun uploadFile(context: Context, url: String, file: File, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
-        if (!file.exists()) {
-            Logger.e("${file.name}不存在请检查")
-            return
-        }
-        val resultInfo = ResultInfo()
-        resultInfo.code = -1
-        resultInfo.msg = "接口请求异常"
-
-        val time = System.currentTimeMillis().toString()
-        val randomKey = time + StrUtils.getRandomString(16)
-        val rawKey = Md5Utils.encodeByMD5(randomKey)
-        val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
-        val hexP = GameSdkDrive.instance.invokeJob(context, aesKey.substring(8, 24), jsonObject.toString())
-        val tmp = HexUtils.hexString2Bytes(hexP)
-        val p = Base64Utils.encode(tmp)
-
-        Logger.d("请求地址 : $url")
-        Logger.d("请求参数 : $jsonObject")
-        Logger.logHandler("请求地址 : $url\n")
-        Logger.logHandler("请求参数 : $jsonObject\n")
-        val params = HashMap<String, Any>()
-        params["p"] = p
-        params["ts"] = rawKey
-
-        Logger.d("上传文件: ${file.name} ...")
-        val fileEntity = FileEntity()
-        fileEntity.mName = "upload_file"
-        fileEntity.mFileName = file.name
-        fileEntity.mFile = file
-
-        kotlin.runCatching {
-            val request = MultipartRequest(url, params, fileEntity, {
-                with(JSONObject(it)) {
-                    resultInfo.code = getInt("code")
-                    resultInfo.msg = getString("msg")
-                }
-                callback(resultInfo)
-            }) {
-                if (TextUtils.isEmpty(it.localizedMessage)) {
-                    resultInfo.msg = it.localizedMessage!!
-                }
-                callback(resultInfo)
-            }
-            VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
-        }.onFailure {
-            if (TextUtils.isEmpty(it.localizedMessage)) {
-                resultInfo.msg = it.localizedMessage!!
-            }
-            callback(resultInfo)
-        }
-    }
-
-    private fun parseResponse(context: Context, data: JSONObject): String {
-        try {
-            val ts = data.getString("ts")
-            val aesKey = Md5Utils.encodeByMD5(ts + StrUtils.reverseString(ts))
-            val base64P = data.getString("p")
-            val tmp = Base64Utils.decode(base64P)
-            val p = HexUtils.bytes2HexString(tmp)
-            return GameSdkDrive.instance.parseJob(context, aesKey.substring(8, 24), p)
-        } catch (e: JSONException) {
-            e.printStackTrace()
-        }
-        return ""
-    }
-
-    private fun getErrorResultInfo(context: Context, volleyError: VolleyError): ResultInfo {
-        val resultInfo = ResultInfo()
-        resultInfo.code = 400
-        resultInfo.msg = ""
-        volleyError.networkResponse?.apply {
-            resultInfo.code = statusCode
-            if (!TextUtils.isEmpty(volleyError.message)) {
-                resultInfo.msg = volleyError.message!!
-            } else {
-                resultInfo.msg = ResUtils.getResString(context, "yyxx_network_tv_error")
-            }
-        }
-        resultInfo.data = ""
-        return resultInfo
-    }
-}
+//            val p = Base64Utils.encode(tmp)
+//
+//            Logger.d("请求路由 : ${jsonObject["route_path"]}")
+//            Logger.d("请求参数 : $jsonObject")
+//            Logger.logHandler("请求路由 : ${jsonObject["route_path"]}\n")
+//            Logger.logHandler("请求参数 : $jsonObject\n")
+//            val obj = JSONObject()
+//            obj.put("p", p)
+//            obj.put("ts", rawKey)
+//            Logger.d("$obj")
+//            //TODO 拉起登录接口时会莫名其妙ANR,后续再排查
+////            val json = SdkDrive.invokeJob(context, jsonObject.toString())
+////            val obj = JSONObject(json)
+////            //因为native c++中aes加密后生成的base64字符串可能会因为\0的原因被截断,所以使用hex进行编码
+////            //得到json对象后将p内容由hex转为base64,然后再赋值回json对象中的p。
+////            //ts因为是rsa加密,得到的base64字符串不会被截断,可能因为是长度远比aes生成的报文长度短
+////            val hexP = obj.getString("p")
+////            Logger.d("hex: $hexP")
+////            val tmp = HexUtils.hexString2Bytes(hexP)
+////            val base64P = Base64Utils.encode(tmp)
+////            obj.put("p", base64P)
+//            Logger.d("host: ${Host.HOST}")
+//
+//            val request = object : JsonObjectRequest(Method.POST, Host.HOST, obj, Response.Listener {
+//                val resultInfo = ResultInfo()
+//                resultInfo.code = -1
+//                resultInfo.msg = "接口请求异常"
+//                it?.apply {
+//                    try {
+//                        resultInfo.code = it.getInt("code")
+//                        resultInfo.msg = it.getString("msg")
+//                        resultInfo.data = if (JsonUtils.hasJsonKey(it, "data")) {
+////                            //返回要对p进行base64 -> hex
+////                            val responseObj = it.getJSONObject("data")
+////                            val base64P2 = responseObj.getString("p")
+////                            val tmp2 = Base64Utils.decode(base64P2)
+////                            val hexP2 = HexUtils.bytes2HexString(tmp2)
+////                            responseObj.put("p", hexP2)
+////                            SdkDrive.parseJob(context, responseObj.toString())
+//                            parseResponse(context, it.getJSONObject("data"))
+//                        } else {
+//                            "{}"
+//                        }
+//                    } catch (e: JSONException) {
+//                        e.printStackTrace()
+//                    }
+//                }
+//                it.put("data", JSONObject(resultInfo.data))
+//                Logger.d("返回信息 : $it")
+//                Logger.logHandler("返回信息 : $it\n")
+//                callback(resultInfo)
+//            }, Response.ErrorListener {
+//                it?.apply {
+//                    Logger.e("postByVolley onErrorResponse : $it")
+//                    callback(getErrorResultInfo(context, it))
+//                }
+//            }) {
+//                override fun getHeaders(): MutableMap<String, String> {
+//                    val headers = HashMap<String, String>()
+//                    headers["Accept"] = "application/json"
+//                    headers["Content-Type"] = "application/json;charset=UTF-8"
+//                    return headers
+//                }
+//            }
+//            //设置超时时间
+//            request.retryPolicy = DefaultRetryPolicy(MAX_TIMEOUT, 1, 1.0f)
+//            VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
+//        } catch (e: Exception) {
+//            e.printStackTrace()
+//        }
+//    }
+//
+//    fun downloadImageFile(context: Context, url: String, callback: IFileRequestCallback) {
+//        val cacheFolder = File(context.getExternalFilesDir("cache")!!.absolutePath)
+//        if (!cacheFolder.exists()) {
+//            cacheFolder.mkdirs()
+//        }
+//        val fileName = Md5Utils.encodeByMD5(url)
+//        val filePath = "$cacheFolder/$fileName"
+//        Logger.d(filePath)
+//        if (File(filePath).exists()) {
+//            callback.onResponse("image has been cached locally")
+//            return
+//        }
+//        val request: Request<ByteArray> = object : Request<ByteArray>(Method.GET, url, Response.ErrorListener {
+//            callback.onErrorResponse(it)
+//        }) {
+//            override fun parseNetworkResponse(response: NetworkResponse): Response<ByteArray> {
+//                return try {
+//                    if (response.data == null) {
+//                        Response.error(ParseError(response))
+//                    } else {
+//                        Response.success(response.data, HttpHeaderParser.parseCacheHeaders(response))
+//                    }
+//                } catch (e: OutOfMemoryError) {
+//                    e.printStackTrace()
+//                    Response.error(ParseError(e))
+//                }
+//            }
+//
+//            override fun deliverResponse(response: ByteArray) {
+//                Logger.d("volley download image file success, start to save file ...")
+//                try {
+//                    GlobalScope.launch(Dispatchers.IO) {
+//                        Logger.d("with io coroutines do save file")
+//                        FileUtils.saveFile(filePath, response)
+//                    }
+//                    callback.onResponse("download file success, path: $filePath")
+//                } catch (e: IOException) {
+//                    e.printStackTrace()
+//                    callback.onErrorResponse(ParseError(e))
+//                }
+//            }
+//        }
+//
+//        VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
+//    }
+//
+//    fun uploadFile(context: Context, url: String, file: File, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
+//        if (!file.exists()) {
+//            Logger.e("${file.name}不存在请检查")
+//            return
+//        }
+//        val resultInfo = ResultInfo()
+//        resultInfo.code = -1
+//        resultInfo.msg = "接口请求异常"
+//
+//        val time = System.currentTimeMillis().toString()
+//        val randomKey = time + StrUtils.getRandomString(16)
+//        val rawKey = Md5Utils.encodeByMD5(randomKey)
+//        val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
+//        val hexP = CommSdkDrive.instance.invokeJob(aesKey.substring(8, 24), jsonObject.toString())
+//        val tmp = HexUtils.hexString2Bytes(hexP)
+//        val p = Base64Utils.encode(tmp)
+//
+//        Logger.d("请求地址 : $url")
+//        Logger.d("请求参数 : $jsonObject")
+//        Logger.logHandler("请求地址 : $url\n")
+//        Logger.logHandler("请求参数 : $jsonObject\n")
+//        val params = HashMap<String, Any>()
+//        params["p"] = p
+//        params["ts"] = rawKey
+//
+//        Logger.d("上传文件: ${file.name} ...")
+//        val fileEntity = FileEntity()
+//        fileEntity.mName = "upload_file"
+//        fileEntity.mFileName = file.name
+//        fileEntity.mFile = file
+//
+//        kotlin.runCatching {
+//            val request = MultipartRequest(url, params, fileEntity, {
+//                with(JSONObject(it)) {
+//                    resultInfo.code = getInt("code")
+//                    resultInfo.msg = getString("msg")
+//                }
+//                callback(resultInfo)
+//            }) {
+//                if (TextUtils.isEmpty(it.localizedMessage)) {
+//                    resultInfo.msg = it.localizedMessage!!
+//                }
+//                callback(resultInfo)
+//            }
+//            VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
+//        }.onFailure {
+//            if (TextUtils.isEmpty(it.localizedMessage)) {
+//                resultInfo.msg = it.localizedMessage!!
+//            }
+//            callback(resultInfo)
+//        }
+//    }
+//
+//    private fun parseResponse(context: Context, data: JSONObject): String {
+//        try {
+//            val ts = data.getString("ts")
+//            val aesKey = Md5Utils.encodeByMD5(ts + StrUtils.reverseString(ts))
+//            val base64P = data.getString("p")
+//            val tmp = Base64Utils.decode(base64P)
+//            val p = HexUtils.bytes2HexString(tmp)
+//            return CommSdkDrive.instance.parseJob(aesKey.substring(8, 24), p)
+//        } catch (e: JSONException) {
+//            e.printStackTrace()
+//        }
+//        return ""
+//    }
+//
+//    private fun getErrorResultInfo(context: Context, volleyError: VolleyError): ResultInfo {
+//        val resultInfo = ResultInfo()
+//        resultInfo.code = 400
+//        resultInfo.msg = ""
+//        volleyError.networkResponse?.apply {
+//            resultInfo.code = statusCode
+//            if (!TextUtils.isEmpty(volleyError.message)) {
+//                resultInfo.msg = volleyError.message!!
+//            } else {
+//                resultInfo.msg = ResUtils.getResString(context, "yyxx_network_tv_error")
+//            }
+//        }
+//        resultInfo.data = ""
+//        return resultInfo
+//    }
+//}

+ 1 - 1
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/trace/TraceEventManager.kt

@@ -3,7 +3,7 @@ package cn.yyxx.eyuangame.trace
 import android.app.Activity
 import android.app.Application
 import android.content.Context
-import cn.yyxx.eyuangame.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import cn.yyxx.eyuangame.entity.SdkEvent
 import cn.yyxx.eyuangame.internal.ITrace
 import cn.yyxx.eyuangame.trace.channel.TraceAdjustImpl

+ 7 - 7
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/trace/channel/TraceAdjustImpl.kt

@@ -4,14 +4,14 @@ import android.app.Activity
 import android.app.Application
 import android.content.Context
 import android.text.TextUtils
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVUtils
+import cn.yyxx.eyuancomm.comm.utils.MMKVHandler
+import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
 import cn.yyxx.eyuangame.entity.LoginType
 import cn.yyxx.eyuangame.entity.SdkBackLoginInfo
-import cn.yyxx.eyuangame.entity.SdkChargeInfo
 import cn.yyxx.eyuangame.entity.SdkEvent
 import cn.yyxx.eyuangame.internal.ITrace
-import cn.yyxx.eyuangame.utils.ParamsUtils
 import cn.yyxx.support.JsonUtils
 import cn.yyxx.support.hawkeye.LogUtils
 import com.adjust.sdk.Adjust
@@ -62,7 +62,7 @@ class TraceAdjustImpl(val callback: OnAdjustIdRead) : ITrace {
             callback.onRead(it.adid)
         }
         Adjust.onCreate(config)
-        if (MMKVUtils.instance.eventKV.decodeBool("adjust_activities")) {
+        if (MMKVHandler.instance.eventKV.decodeBool("adjust_activities")) {
             isInitSuccess = true
             return
         }
@@ -70,7 +70,7 @@ class TraceAdjustImpl(val callback: OnAdjustIdRead) : ITrace {
             if (JsonUtils.hasJsonKey(this, "open_app")) {
                 Adjust.trackEvent(AdjustEvent(this.getString("open_app")))
                 Logger.d("adjust log open app success")
-                MMKVUtils.instance.eventKV.encode("adjust_activities", true)
+                MMKVHandler.instance.eventKV.encode("adjust_activities", true)
                 isInitSuccess = true
             }
         }
@@ -148,14 +148,14 @@ class TraceAdjustImpl(val callback: OnAdjustIdRead) : ITrace {
         }
 
         sdkConfig?.apply {
-            if (!MMKVUtils.instance.eventKV.decodeBool("adjust_first_purchase")) {
+            if (!MMKVHandler.instance.eventKV.decodeBool("adjust_first_purchase")) {
                 if (JsonUtils.hasJsonKey(this, "first_purchase")) {
                     val event = AdjustEvent(this.getString("first_purchase"))
                     event.setRevenue(chargeInfo.amount.toDouble() / 100, "USD")
                     event.setOrderId(chargeInfo.orderId)
                     Adjust.trackEvent(event)
                     Logger.d("adjust log first charge success")
-                    MMKVUtils.instance.eventKV.encode("adjust_first_purchase", true)
+                    MMKVHandler.instance.eventKV.encode("adjust_first_purchase", true)
                 }
             }
 

+ 6 - 6
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/trace/channel/TraceFacebookImpl.kt

@@ -5,11 +5,11 @@ import android.app.Application
 import android.content.Context
 import android.os.Bundle
 import android.text.TextUtils
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVUtils
+import cn.yyxx.eyuancomm.comm.utils.MMKVHandler
 import cn.yyxx.eyuangame.entity.LoginType
 import cn.yyxx.eyuangame.entity.SdkBackLoginInfo
-import cn.yyxx.eyuangame.entity.SdkChargeInfo
 import cn.yyxx.eyuangame.entity.SdkEvent
 import cn.yyxx.eyuangame.internal.ITrace
 import com.facebook.FacebookSdk
@@ -35,14 +35,14 @@ class TraceFacebookImpl : ITrace {
 
         fbLogger = AppEventsLogger.newLogger(application)
 
-        if (MMKVUtils.instance.eventKV.decodeBool("facebook_activities")) {
+        if (MMKVHandler.instance.eventKV.decodeBool("facebook_activities")) {
             isInitSuccess = true
             return
         }
         //open_app
         Logger.d("facebook log open app success")
         fbLogger.logEvent("open_app")
-        MMKVUtils.instance.eventKV.encode("facebook_activities", true)
+        MMKVHandler.instance.eventKV.encode("facebook_activities", true)
         isInitSuccess = true
     }
 
@@ -106,10 +106,10 @@ class TraceFacebookImpl : ITrace {
         params.putDouble("price", chargeInfo.amount.toDouble() / 100)
         params.putString("order", chargeInfo.orderId)
 
-        if (!MMKVUtils.instance.eventKV.decodeBool("facebook_first_purchase")) {
+        if (!MMKVHandler.instance.eventKV.decodeBool("facebook_first_purchase")) {
             fbLogger.logEvent("first_purchase", params)
             Logger.d("facebook log first charge success")
-            MMKVUtils.instance.eventKV.encode("facebook_first_purchase", true)
+            MMKVHandler.instance.eventKV.encode("facebook_first_purchase", true)
         }
 
         fbLogger.logPurchase(BigDecimal.valueOf(chargeInfo.amount.toDouble() / 100), Currency.getInstance("USD"), params)

+ 6 - 6
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/trace/channel/TraceFirebaseImpl.kt

@@ -4,11 +4,11 @@ import android.app.Activity
 import android.app.Application
 import android.content.Context
 import android.text.TextUtils
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVUtils
+import cn.yyxx.eyuancomm.comm.utils.MMKVHandler
 import cn.yyxx.eyuangame.entity.LoginType
 import cn.yyxx.eyuangame.entity.SdkBackLoginInfo
-import cn.yyxx.eyuangame.entity.SdkChargeInfo
 import cn.yyxx.eyuangame.entity.SdkEvent
 import cn.yyxx.eyuangame.internal.ITrace
 import com.google.firebase.analytics.FirebaseAnalytics
@@ -25,13 +25,13 @@ class TraceFirebaseImpl : ITrace {
     private var isInitSuccess = false
 
     override fun onInitialize(application: Application) {
-        if (MMKVUtils.instance.eventKV.decodeBool("firebase_activities")) {
+        if (MMKVHandler.instance.eventKV.decodeBool("firebase_activities")) {
             isInitSuccess = true
             return
         }
         Firebase.analytics.logEvent("open_app", null)
         Logger.d("firebase log open app success")
-        MMKVUtils.instance.eventKV.encode("firebase_activities", true)
+        MMKVHandler.instance.eventKV.encode("firebase_activities", true)
         isInitSuccess = true
     }
 
@@ -92,13 +92,13 @@ class TraceFirebaseImpl : ITrace {
             return
         }
 
-        if (!MMKVUtils.instance.eventKV.decodeBool("firebase_first_purchase")) {
+        if (!MMKVHandler.instance.eventKV.decodeBool("firebase_first_purchase")) {
             Firebase.analytics.logEvent("first_purchase") {
                 param(FirebaseAnalytics.Param.PRICE, (chargeInfo.amount.toDouble() / 100).toString())
                 param("order_id", chargeInfo.orderId)
             }
             Logger.d("firebase log first charge success")
-            MMKVUtils.instance.eventKV.encode("firebase_first_purchase", true)
+            MMKVHandler.instance.eventKV.encode("firebase_first_purchase", true)
         }
 
         Firebase.analytics.logEvent("ecommerce_purchase") {

+ 0 - 98
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/utils/ParamsUtils.kt

@@ -1,98 +0,0 @@
-package cn.yyxx.eyuangame.utils
-
-import android.content.Context
-import android.text.TextUtils
-import cn.yyxx.support.PropertiesUtils
-
-/**
- * @author #Suyghur.
- * Created on 2021/06/17
- */
-object ParamsUtils {
-
-    private const val CONFIG_FILE = "yyxx_cfg.properties"
-    private const val YYXX_GCP_CODE = "YYXX_GCP_CODE"
-    private const val YYXX_GAME_CODE = "YYXX_GAME_CODE"
-    private const val YYXX_ADJSUT_APP_ID = "YYXX_ADJUST_APP_ID"
-    private const val YYXX_GOOGLE_APP_ID = "YYXX_GOOGLE_APP_ID"
-    private const val YYXX_GOOGLE_CLIENT_ID = "YYXX_GOOGLE_CLIENT_ID"
-    private const val YYXX_DO_MAIN_ENV = "YYXX_DO_MAIN_ENV"
-
-    @JvmStatic
-    fun getGcpCode(context: Context): String {
-        try {
-            val code = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_GCP_CODE)
-            if (!TextUtils.isEmpty(code)) {
-                return code
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-        return ""
-    }
-
-    @JvmStatic
-    fun getGameCode(context: Context): String {
-        try {
-            val code = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_GAME_CODE)
-            if (!TextUtils.isEmpty(code)) {
-                return code
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-        return ""
-    }
-
-    @JvmStatic
-    fun getAdjustAppId(context: Context): String {
-        try {
-            val appId = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_ADJSUT_APP_ID)
-            if (!TextUtils.isEmpty(appId)) {
-                return appId
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-        return ""
-    }
-
-    @JvmStatic
-    fun getGoogleAppId(context: Context): String {
-        try {
-            val appId = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_GOOGLE_APP_ID)
-            if (!TextUtils.isEmpty(appId)) {
-                return appId
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-        return ""
-    }
-
-    @JvmStatic
-    fun getGoogleClientId(context: Context): String {
-        try {
-            val clientId = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_GOOGLE_CLIENT_ID)
-            if (!TextUtils.isEmpty(clientId)) {
-                return clientId
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-        return ""
-    }
-
-    @JvmStatic
-    fun getDoMainEnv(context: Context): Int {
-        try {
-            val env = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_DO_MAIN_ENV)
-            if (!TextUtils.isEmpty(env)) {
-                return env.toInt()
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-        return 1
-    }
-}

+ 5 - 5
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/utils/SessionUtils.kt

@@ -1,11 +1,11 @@
 package cn.yyxx.eyuangame.utils
 
 import android.text.TextUtils
+import cn.yyxx.eyuancomm.comm.network.Host
 import cn.yyxx.eyuancomm.comm.utils.Logger
-import cn.yyxx.eyuancomm.comm.utils.MMKVUtils
+import cn.yyxx.eyuancomm.comm.utils.MMKVHandler
 import cn.yyxx.eyuangame.entity.LoginType
 import cn.yyxx.eyuangame.entity.Session
-import cn.yyxx.eyuangame.network.Host
 import cn.yyxx.support.HostModelUtils
 import cn.yyxx.support.JsonUtils
 import org.json.JSONArray
@@ -56,7 +56,7 @@ class SessionUtils private constructor() {
                 HostModelUtils.ENV_TEST -> "test"
                 else -> "online"
             }
-            MMKVUtils.instance.userKV.encode(keyName, jsonObject.toString())
+            MMKVHandler.instance.userKV.encode(keyName, jsonObject.toString())
         }
     }
 
@@ -100,7 +100,7 @@ class SessionUtils private constructor() {
             HostModelUtils.ENV_TEST -> "test"
             else -> "online"
         }
-        val json = MMKVUtils.instance.userKV.decodeString(keyName)
+        val json = MMKVHandler.instance.userKV.decodeString(keyName)
         return if (TextUtils.isEmpty(json)) {
             mutableListOf()
         } else {
@@ -146,7 +146,7 @@ class SessionUtils private constructor() {
             HostModelUtils.ENV_TEST -> "test"
             else -> "online"
         }
-        MMKVUtils.instance.userKV.encode(keyName, jsonObject.toString())
+        MMKVHandler.instance.userKV.encode(keyName, jsonObject.toString())
     }
 
     private fun toList(json: String): MutableList<Session> {

+ 12 - 11
module_eyuan/library_eyuan/src/main/kotlin/cn/yyxx/eyuangame/widget/dialog/ChooseLoginDialog.kt

@@ -8,7 +8,6 @@ import android.view.LayoutInflater
 import android.view.View
 import android.view.Window
 import android.widget.ImageView
-import cn.yyxx.eyuangame.network.Host
 import cn.yyxx.support.ResUtils
 
 /**
@@ -54,16 +53,18 @@ class ChooseLoginDialog(context: Context) : Dialog(context) {
         typeFacebook = view.findViewById(ResUtils.getResId(context, "yyxx_iv_facebook", "id"))
         typeAccount = view.findViewById(ResUtils.getResId(context, "yyxx_iv_account", "id"))
         typeGuest = view.findViewById(ResUtils.getResId(context, "yyxx_iv_guest", "id"))
-        when (Host.ENV) {
-            Host.Env.HK -> {
-                typeAccount.setImageResource(ResUtils.getResId(context, "yyxx_account_login_img", "drawable"))
-                typeGuest.setImageResource(ResUtils.getResId(context, "yyxx_guest_login_img", "drawable"))
-            }
-            Host.Env.VN -> {
-                typeAccount.setImageResource(ResUtils.getResId(context, "yyxx_account_login_vn_img", "drawable"))
-                typeGuest.setImageResource(ResUtils.getResId(context, "yyxx_guest_login_vn_img", "drawable"))
-            }
-        }
+        typeAccount.setImageResource(ResUtils.getResId(context, "yyxx_account_login_img", "drawable"))
+        typeGuest.setImageResource(ResUtils.getResId(context, "yyxx_guest_login_img", "drawable"))
+//        when (Host.ENV) {
+//            Host.Env.HK -> {
+//                typeAccount.setImageResource(ResUtils.getResId(context, "yyxx_account_login_img", "drawable"))
+//                typeGuest.setImageResource(ResUtils.getResId(context, "yyxx_guest_login_img", "drawable"))
+//            }
+//            Host.Env.VN -> {
+//                typeAccount.setImageResource(ResUtils.getResId(context, "yyxx_account_login_vn_img", "drawable"))
+//                typeGuest.setImageResource(ResUtils.getResId(context, "yyxx_guest_login_vn_img", "drawable"))
+//            }
+//        }
 
     }
 }

+ 2 - 2
module_eyuan/library_eyuan/src/main/res/layout/yyxx_login_launcher.xml

@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_gravity="center"
     android:background="@color/yyxx_transparent"
     android:gravity="center"
     android:orientation="vertical"
-    android:padding="20dp">
+    android:paddingLeft="20dp"
+    android:paddingRight="20dp">
 
     <cn.yyxx.eyuangame.widget.EventEditText
         android:id="@+id/yyxx_eet_account"

+ 2 - 1
module_eyuan/library_eyuan/src/main/res/layout/yyxx_login_register.xml

@@ -6,7 +6,8 @@
     android:background="@color/yyxx_transparent"
     android:gravity="center"
     android:orientation="vertical"
-    android:padding="20dp">
+    android:paddingLeft="20dp"
+    android:paddingRight="20dp">
 
     <cn.yyxx.eyuangame.widget.EventEditText
         android:id="@+id/yyxx_eet_account"

+ 1 - 1
module_eyuan/library_hk_language/src/main/AndroidManifest.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="cn.yyxx.eyuancomm.language">
+    package="cn.yyxx.eyuangame.language">
 
 </manifest>

+ 1 - 1
module_eyuan/library_vn_language/src/main/AndroidManifest.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="cn.yyxx.eyuancomm.language">
+    package="cn.yyxx.eyuangame.language">
 
 </manifest>