Explorar el Código

Merge branch 'master' into release

* master:
  v1.0.0开发:版本发布
  v1.0.0开发:增加正式环境域名
  v1.0.0开发:修改publish.gradle依赖的publish插件
  v1.0.0开发: 1)修改选择登陆方式展示逻辑 2)公共参数增加aid字段
  v1.0.0开发: 1)谷歌账号登录切增加注销操作 2)修复通知发货接口由于iap服务问题导致重复调用
  v1.0.0-alpha2开发:修改客户端接入文档

# Conflicts:
#	library_core/publish.gradle
#Suyghur hace 3 años
padre
commit
67806e872c
Se han modificado 63 ficheros con 915 adiciones y 613 borrados
  1. 3 0
      .gitignore
  2. 21 20
      build.gradle
  3. 14 14
      demo/build.gradle
  4. BIN
      demo/libs/library_core-release.aar
  5. 8 8
      demo/src/main/AndroidManifest.xml
  6. 52 0
      demo/src/main/assets/test.html
  7. 9 11
      demo/src/main/assets/yyxx_game/sdk_log.json
  8. 2 2
      demo/src/main/assets/yyxx_game/yyxx_cfg.properties
  9. 8 9
      demo/src/main/java/com/eyuangame/demo/DemoActivity.kt
  10. 0 1
      demo/src/main/java/com/eyuangame/demo/WelcomeActivity.kt
  11. 2 2
      demo/src/main/res/values/strings.xml
  12. 1 1
      gradle.properties
  13. 1 1
      gradle/wrapper/gradle-wrapper.properties
  14. 0 11
      keystore.properties
  15. 0 1
      library_base/build.gradle
  16. 1 1
      library_base/src/main/java/cn/yyxx/eyuangame/Version.kt
  17. 18 3
      library_base/src/main/java/cn/yyxx/eyuangame/base/EYuanGame.kt
  18. 2 0
      library_base/src/main/java/cn/yyxx/eyuangame/base/entity/Function.kt
  19. 9 18
      library_core/build.gradle
  20. 2 0
      library_core/proguard-rules.pro
  21. 79 51
      library_core/publish.gradle
  22. 82 0
      library_core/publish_old.gradle
  23. 5 0
      library_core/src/main/AndroidManifest.xml
  24. 3 3
      library_core/src/main/cpp/aes.cpp
  25. 2 1
      library_core/src/main/cpp/comm_map.cpp
  26. 2 0
      library_core/src/main/cpp/include/toolkit.h
  27. 11 52
      library_core/src/main/cpp/sdk_drive.cpp
  28. 16 21
      library_core/src/main/cpp/toolkit.cpp
  29. 4 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/SdkBridge.kt
  30. 10 1
      library_core/src/main/java/cn/yyxx/eyuangame/core/entity/SdkBackLoginInfo.kt
  31. 60 34
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkBridgeImpl.kt
  32. 1 11
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkDrive.kt
  33. 18 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkJsImpl.kt
  34. 237 29
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/center/HybridActivity.kt
  35. 41 33
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/floatball/FloatCenterService.kt
  36. 6 2
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/iab/ChargeImpl.kt
  37. 16 9
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/LoginActivity.kt
  38. 4 3
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/UserSignInImpl.kt
  39. 2 2
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/fragment/LauncherFragment.kt
  40. 0 1
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/fragment/RegisterFragment.kt
  41. 67 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/impl/share/ShareImpl.kt
  42. 2 2
      library_core/src/main/java/cn/yyxx/eyuangame/core/internal/IEventObserver.kt
  43. 5 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/internal/IJsCallback.kt
  44. 12 15
      library_core/src/main/java/cn/yyxx/eyuangame/core/linking/Linking.kt
  45. 8 39
      library_core/src/main/java/cn/yyxx/eyuangame/core/linking/channel/LinkingAdjustImpl.kt
  46. 4 30
      library_core/src/main/java/cn/yyxx/eyuangame/core/linking/channel/LinkingFacebookImpl.kt
  47. 1 28
      library_core/src/main/java/cn/yyxx/eyuangame/core/linking/channel/LinkingFirebaseImpl.kt
  48. 2 2
      library_core/src/main/java/cn/yyxx/eyuangame/core/network/Host.kt
  49. 5 8
      library_core/src/main/java/cn/yyxx/eyuangame/core/network/VolleyRequest.kt
  50. 0 2
      library_core/src/main/java/cn/yyxx/eyuangame/core/ui/floatview/FloatingBall.kt
  51. 12 5
      library_core/src/main/java/cn/yyxx/eyuangame/core/ui/floatview/FloatingBallMenu.kt
  52. 25 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/utils/LocalCacheUtils.kt
  53. 4 0
      library_core/src/main/java/cn/yyxx/eyuangame/core/utils/MMKVUtils.kt
  54. 7 62
      library_core/src/main/res/layout-land/yyxx_hybrid.xml
  55. 2 0
      library_core/src/main/res/layout/yyxx_account_list_item.xml
  56. 7 62
      library_core/src/main/res/layout/yyxx_hybrid.xml
  57. BIN
      libs/dolin_zap_1.0.0.jar
  58. BIN
      libs/eyuangamesdk_base_1.0.0.jar
  59. BIN
      libs/mmkv-static-1.2.8.jar
  60. BIN
      libs/yyxx_support_1.0.1.jar
  61. 0 2
      settings.gradle
  62. BIN
      zkeystore/demo_yyxx.keystore
  63. BIN
      zkeystore/demo_yyxx_backup.keystore

+ 3 - 0
.gitignore

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

+ 21 - 20
build.gradle

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

+ 14 - 14
demo/build.gradle

@@ -12,7 +12,7 @@ android {
     buildToolsVersion BUILD_TOOLS_VERSION
 
     defaultConfig {
-        applicationId "com.shzd.eyuangame"
+        applicationId 'com.shzd.eyuangame'
         minSdkVersion MIN_SDK_VERSION
         targetSdkVersion TARGET_SDK_VERSION
         versionCode 1
@@ -28,6 +28,8 @@ android {
             keyPassword keystoreProperties['keyPassword']
             storeFile file(keystoreProperties['storeFile'])
             storePassword keystoreProperties['storePassword']
+            v1SigningEnabled true
+            v2SigningEnabled true
         }
     }
 
@@ -70,14 +72,14 @@ android {
 }
 
 dependencies {
-
     if (PUBLISH_ENABLE) {
         if (REMOTE_LIBRARY) {
-            implementation 'io.github.yyxxgame.sdk:eyuangame-sdk-ktx:0.0.1'
+            implementation 'io.github.yyxxgame.sdk:eyuangame-sdk-ktx:1.0.0-alpha10'
         } else {
             api(name: 'library_core-release', ext: 'aar')
 
-            implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+            implementation "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION"
+            implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
 
             //mmkv
             implementation 'com.tencent:mmkv-static:1.2.10'
@@ -86,23 +88,22 @@ dependencies {
             implementation 'io.github.suyghur.dolin:zap:1.0.0'
 
             implementation 'androidx.core:core-ktx:1.6.0'
-            implementation 'androidx.fragment:fragment-ktx:1.3.5'
-            implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+            implementation 'androidx.fragment:fragment-ktx:1.3.6'
+            implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
             implementation 'com.google.android.material:material:1.4.0'
             implementation 'com.android.installreferrer:installreferrer:2.2'
 
             //google
-            implementation 'com.google.android.play:core:1.10.0'
-            implementation 'com.google.android.gms:play-services-auth:19.0.0'
+            implementation 'com.google.android.play:core:1.10.2'
+            implementation 'com.google.android.gms:play-services-auth:19.2.0'
             //4.0.0的billing库消耗商品会回调两次,后续在排查,先用3.0.3
             implementation "com.android.billingclient:billing-ktx:3.0.3"
-            implementation 'com.google.firebase:firebase-analytics-ktx:19.0.0'
-            implementation 'com.google.firebase:firebase-crashlytics-ktx:18.1.0'
-            implementation 'com.google.firebase:firebase-crashlytics-ndk:18.1.0'
+            implementation 'com.google.firebase:firebase-analytics-ktx:19.0.2'
+            implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.3'
+            implementation 'com.google.firebase:firebase-crashlytics-ndk:18.2.3'
 
             //facebook
-            implementation 'com.facebook.android:facebook-login:9.0.0'
-            implementation 'com.facebook.android:facebook-android-sdk:8.2.0'
+            implementation 'com.facebook.android:facebook-android-sdk:11.2.0'
 
             //adjust
             implementation 'com.adjust.sdk:adjust-android:4.28.2'
@@ -111,5 +112,4 @@ dependencies {
         api project(':library_core')
     }
     debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
-
 }

BIN
demo/libs/library_core-release.aar


+ 8 - 8
demo/src/main/AndroidManifest.xml

@@ -29,7 +29,7 @@
             android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
             android:exported="true"
             android:launchMode="singleTask"
-            android:screenOrientation="portrait">
+            android:screenOrientation="sensorLandscape">
             <intent-filter>
                 <action android:name="${applicationId}" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -41,19 +41,19 @@
             android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
             android:exported="true"
             android:launchMode="singleTask"
-            android:screenOrientation="portrait">
+            android:screenOrientation="sensorLandscape">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
 
-        <!-- Facebook 分享 -->
-        <!--        <provider-->
-        <!--            android:name="com.facebook.FacebookContentProvider"-->
-        <!--            android:authorities="com.facebook.app.FacebookContentProvider283753472796552"-->
-        <!--            android:exported="true" />-->
-        <!-- Facebook end -->
+        <!-- Facebook 分享 start -->
+        <provider
+            android:name="com.facebook.FacebookContentProvider"
+            android:authorities="com.facebook.app.FacebookContentProvider229604925839347"
+            android:exported="true" />
+        <!-- Facebook 分享 end-->
     </application>
 
 </manifest>

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

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

+ 9 - 11
demo/src/main/assets/yyxx_game/sdk_log.json

@@ -1,13 +1,11 @@
 {
-  "open_app": "rjo5ax",
-  "choose_login_page": "eo8k08",
-  "sign_up": "mzvwmo",
-  "login_success_quick": "3igk4b",
-  "login_success_fb": "dwbri1",
-  "login_success_google": "tk971u",
-  "login_success_account": "wp73dt",
-  "ecommerce_purchase": "qum6x5",
-  "first_purchase": "r1mt2x",
-  "create_player": "apjl7l",
-  "enter_game": "qfd1ul"
+  "open_app": "9titg2",
+  "choose_login_page": "l68ap0",
+  "sign_up": "oycdb6",
+  "login_success_quick": "sjxw4u",
+  "login_success_fb": "aorps6",
+  "login_success_google": "opymbu",
+  "login_success_account": "lmngli",
+  "ecommerce_purchase": "na9zu3",
+  "first_purchase": "6tgkgk"
 }

+ 2 - 2
demo/src/main/assets/yyxx_game/yyxx_cfg.properties

@@ -3,12 +3,12 @@ YYXX_GCP_CODE=G010101
 #分包标识
 YYXX_GAME_CODE=100001
 # 事件打点应用ID
-YYXX_ADJUST_APP_ID=43gp4f912rgg
+YYXX_ADJUST_APP_ID=q1lh43zvrv9c
 # Google AppId
 YYXX_GOOGLE_APP_ID=70429070957
 # Google Server Client Id
 YYXX_GOOGLE_CLIENT_ID=70429070957-7clr9u565jrjgbgg474ksg8q2esq2okj.apps.googleusercontent.com
 # Facebook AppId
-YYXX_FACEBOOK_ID=1047370039003298
+YYXX_FACEBOOK_ID=229604925839347
 #debug模式(cp出正式包请关闭)
 YYXX_OWN_DEBUG=true

+ 8 - 9
demo/src/main/java/com/eyuangame/demo/DemoActivity.kt

@@ -37,6 +37,7 @@ class DemoActivity : Activity(), View.OnClickListener {
         Item(8, "08 模拟CP打点(玩家首次完成新手引导)"),
         Item(0, "09 模拟CP打点(玩家首次完成结缘)"),
         Item(10, "10 crashlytics崩溃测试"),
+        Item(11, "11 Facebook分享测试")
     )
 
 
@@ -61,7 +62,7 @@ class DemoActivity : Activity(), View.OnClickListener {
         super.onCreate(savedInstanceState)
         initView()
         LogUtils.handler = handler
-        EYuanGame.getInstance().initialize(this, false, object : ICallback {
+        EYuanGame.getInstance().initialize(this, true, object : ICallback {
             override fun onResult(code: Int, result: String) {
                 ToastUtils.toastInfo(this@DemoActivity, "---- demo提示不做翻译 ----\ncode : $code\n msg : $result\n ---- demo提示不做翻译 ----")
             }
@@ -159,14 +160,12 @@ class DemoActivity : Activity(), View.OnClickListener {
                     EYuanGame.getInstance().linkingEvent(this@DemoActivity, sdkEvent)
                 }
                 10 -> throw RuntimeException("Test Crashlytics Feature")
-//                10 -> {
-//                    TimeDownUtils.startScope(60, object : TimeDownUtils.TimeCallback {
-//                        override fun onTime(time: Int) {
-//                            Logger.d(time)
-//                        }
-//
-//                    })
-//                }
+                11 -> EYuanGame.getInstance().share(this@DemoActivity, "https://www.baidu.com", "#测试标签", "测试引文", object : ICallback {
+                    override fun onResult(code: Int, result: String) {
+
+                    }
+
+                })
             }
         }
     }

+ 0 - 1
demo/src/main/java/com/eyuangame/demo/WelcomeActivity.kt

@@ -78,6 +78,5 @@ class WelcomeActivity : Activity() {
         layout.setBackgroundResource(id)
         layout.animation = animation
         setContentView(layout)
-
     }
 }

+ 2 - 2
demo/src/main/res/values/strings.xml

@@ -1,6 +1,6 @@
 <resources>
-    <string name="facebook_app_id" translatable="false">1047370039003298</string>
-    <string name="fb_login_protocol_scheme" translatable="false">fb1047370039003298</string>
+    <string name="facebook_app_id" translatable="false">229604925839347</string>
+    <string name="fb_login_protocol_scheme" translatable="false">fb229604925839347</string>
     <string name="app_name" translatable="false">EYuanGameSdk-KTX</string>
     <!-- project_number -->
     <string name="gcm_defaultSenderId" translatable="false">70429070957</string>

+ 1 - 1
gradle.properties

@@ -6,7 +6,7 @@
 # http://www.gradle.org/docs/current/userguide/build_environment.html
 # Specifies the JVM arguments used for the daemon process.
 # The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx1024m -Xms1024m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+org.gradle.jvmargs=-Xmx2048m -Xms2048m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
 # When configured, Gradle will run in incubating parallel mode.
 # This option should only be used with decoupled projects. More details, visit
 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects

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

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

+ 0 - 11
keystore.properties

@@ -1,14 +1,3 @@
-#demo
-#storePassword=demo6ztv_yyxx2021
-#keyPassword=demo6ztv_yyxx2021
-#keyAlias=alias.demo_yyxx2021
-#storeFile=../zkeystore/demo_yyxx.keystore
-
-#storePassword=demo53ux_yyxx2021
-#keyPassword=demo53ux_yyxx2021
-#keyAlias=alias.demo_yyxx2021
-#storeFile=../zkeystore/demo_yyxx_backup.keystore
-
 storePassword=shzd1y28_yyxx2021
 keyPassword=shzd1y28_yyxx2021
 keyAlias=alias.shzd_yyxx2021

+ 0 - 1
library_base/build.gradle

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

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuangame/Version.kt

@@ -5,7 +5,7 @@ package cn.yyxx.eyuangame
  * Created on 2021/06/09
  */
 object Version {
-    const val VERSION_NAME = "1.0.0-alpha2"
+    const val VERSION_NAME = "1.0.0"
     const val VERSION_CODE = 100
     const val SERVER_VERSION = "1.0.0"
 }

+ 18 - 3
library_base/src/main/java/cn/yyxx/eyuangame/base/EYuanGame.kt

@@ -405,6 +405,21 @@ class EYuanGame private constructor() {
         SdkBridgeManager.call(Function.LINKING_EVENT, arrayOf(Context::class.java, SdkEvent::class.java), arrayOf(context, sdkEvent))
     }
 
+    fun share(activity: Activity, line: String, tag: String, quote: String, callback: ICallback) {
+
+        if (checkSdkBridgeNull(Function.SHARE, null)) {
+            return
+        }
+
+        if (checkSdkNonInit(Function.SHARE, null)) {
+            return
+        }
+        SdkBridgeManager.call(
+            Function.SHARE, arrayOf(Activity::class.java, String::class.java, String::class.java, String::class.java, ICallback::class.java),
+            arrayOf(activity, line, tag, quote, callback)
+        )
+    }
+
 
     private fun checkSdkBridgeNull(function: String, callback: ICallback?): Boolean {
         return if (mSdkBridge == null) {
@@ -430,13 +445,13 @@ class EYuanGame private constructor() {
         @JvmStatic
         @Keep
         fun getInstance(): EYuanGame {
-            return ColumbusHolder.INSTANCE
+            return EYuanGameHolder.INSTANCE
         }
 
         private const val CLICK_INTERVAL: Int = 1500
 
         @Keep
-        private object ColumbusHolder {
+        private object EYuanGameHolder {
             val INSTANCE: EYuanGame = EYuanGame()
         }
 
@@ -445,7 +460,7 @@ class EYuanGame private constructor() {
          */
         @Keep
         private fun readResolve(): Any {
-            return ColumbusHolder.INSTANCE
+            return EYuanGameHolder.INSTANCE
         }
     }
 }

+ 2 - 0
library_base/src/main/java/cn/yyxx/eyuangame/base/entity/Function.kt

@@ -34,4 +34,6 @@ object Function {
     const val IS_GM_CENTER_ENABLE = "isGmCenterEnable"
     const val INVOKE_SDK_SHARING = "invokeSdkSharing"
     const val LINKING_EVENT="linkingEvent"
+    const val SHARE="share"
+
 }

+ 9 - 18
library_core/build.gradle

@@ -51,13 +51,6 @@ android {
         preDexLibraries = false
     }
 
-
-//    sourceSets {
-//        main {
-//            // let gradle pack the shared library into apk
-//            jniLibs.srcDirs = ['../soLibs']
-//        }
-//    }
     compileOptions {
         kotlinOptions.freeCompilerArgs += ['-module-name', "cn.yyxx.eyuangame.core"]
     }
@@ -73,7 +66,7 @@ android {
 
 dependencies {
     implementation "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION"
-    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
 
     //mmkv
     implementation 'com.tencent:mmkv-static:1.2.10'
@@ -82,23 +75,22 @@ dependencies {
     implementation 'io.github.suyghur.dolin:zap:1.0.0'
 
     implementation 'androidx.core:core-ktx:1.6.0'
-    implementation 'androidx.fragment:fragment-ktx:1.3.5'
-    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+    implementation 'androidx.fragment:fragment-ktx:1.3.6'
+    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
     implementation 'com.google.android.material:material:1.4.0'
     implementation 'com.android.installreferrer:installreferrer:2.2'
 
     //google
-    implementation 'com.google.android.play:core:1.10.0'
-    implementation 'com.google.android.gms:play-services-auth:19.0.0'
+    implementation 'com.google.android.play:core:1.10.2'
+    implementation 'com.google.android.gms:play-services-auth:19.2.0'
     //4.0.0的billing库消耗商品会回调两次,后续在排查,先用3.0.3
     implementation "com.android.billingclient:billing-ktx:3.0.3"
-    implementation 'com.google.firebase:firebase-analytics-ktx:19.0.0'
-    implementation 'com.google.firebase:firebase-crashlytics-ktx:18.1.0'
-    implementation 'com.google.firebase:firebase-crashlytics-ndk:18.1.0'
+    implementation 'com.google.firebase:firebase-analytics-ktx:19.0.2'
+    implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.3'
+    implementation 'com.google.firebase:firebase-crashlytics-ndk:18.2.3'
 
     //facebook
-    implementation 'com.facebook.android:facebook-login:9.0.0'
-    implementation 'com.facebook.android:facebook-android-sdk:8.2.0'
+    implementation 'com.facebook.android:facebook-android-sdk:11.2.0'
 
     //adjust
     implementation 'com.adjust.sdk:adjust-android:4.28.2'
@@ -108,7 +100,6 @@ dependencies {
     } else {
         api project(':library_base')
     }
-
 }
 
 apply from: 'publish.gradle'

+ 2 - 0
library_core/proguard-rules.pro

@@ -135,6 +135,8 @@
 -keep class cn.yyxx.eyuangame.core.internal.IJsCallback{public <fields>; public <methods>;}
 -keep class cn.yyxx.eyuangame.core.SdkBridge{public <fields>; public <methods>;}
 -keep class cn.yyxx.eyuangame.core.impl.SdkDrive{public <fields>; public <methods>;}
+-keep class cn.yyxx.eyuangame.core.impl.SdkJsImpl{*;}
+
 
 # firebase
 -keepattributes SourceFile,LineNumberTable        # Keep file names and line numbers.

+ 79 - 51
library_core/publish.gradle

@@ -1,9 +1,11 @@
-apply plugin: 'maven'
+apply plugin: 'maven-publish'
 apply plugin: 'signing'
 
-def PUBLISH_GROUP_ID = "io.github.yyxxgame.sdk"
-def PUBLISH_ARTIFACT_ID = "eyuangame-sdk-ktx"
-def PUBLISH_VERSION = "1.0.0-alpha3"
+ext {
+    PUBLISH_GROUP_ID = 'io.github.yyxxgame.sdk'
+    PUBLISH_ARTIFACT_ID = 'eyuangame-sdk-ktx'
+    PUBLISH_VERSION = '1.0.0'
+}
 
 Properties properties = new Properties()
 properties.load(project.rootProject.file('local.properties').newDataInputStream())
@@ -18,65 +20,91 @@ task androidSourcesJar(type: Jar) {
     } else {
         form sourceSets.main.java.srcDirs
     }
+    exclude "**/R.class"
+    exclude "**/BuildConfig.class"
 }
 
-artifacts {
-    archives androidSourcesJar
-}
-
-signing {
-    required {
-        gradle.taskGraph.hasTask("uploadArchives")
-    }
-    sign configurations.archives
-}
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            beforeDeployment {
-                MavenDeployment deployment -> signing.signPom(deployment)
-            }
-
-            repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
-                authentication(userName: ossrhUsername, password: ossrhPassword)
-            }
-
-            snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
-                authentication(userName: ossrhUsername, password: ossrhPassword)
-            }
-
-            pom.groupId = PUBLISH_GROUP_ID
-            pom.artifactId = PUBLISH_ARTIFACT_ID
-            pom.version = PUBLISH_VERSION
+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
 
-            pom.project {
-                name "${PUBLISH_GROUP_ID}:${PUBLISH_ARTIFACT_ID}"
-                packaging 'aar'
-                description 'game sdk of EYuan'
-                url 'https://github.com/yyxxgame'
-
-                scm {
-                    connection 'scm:git:ogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
-                    developerConnection 'scm:git:ssh://gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
-                    url 'http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX'
-                }
+            // Two artifacts, the `aar` and the sources
+            artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
+            artifact androidSourcesJar
 
+            // Self-explanatory metadata for the most part
+            pom {
+                name = "${PUBLISH_GROUP_ID}:${PUBLISH_ARTIFACT_ID}"
+                description = 'game sdk of eyuan'
+                // If your project has a dedicated site, use its URL here
+                url = 'https://github.com/yyxxgame'
                 licenses {
                     license {
-                        name 'The Apache License, Version 2.0'
-                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+                        //协议类型,一般默认Apache License2.0的话不用改:
+                        name = 'The Apache License, Version 2.0'
+                        url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                     }
                 }
-
                 developers {
                     developer {
-                        id 'yyxxgame'
-                        name 'yyxxgame'
-                        email 'developcentre@yyxxgame.com'
+                        id = 'yyxxgame'
+                        name = 'yyxxgame'
+                        email = 'developcentre@yyxxgame.com'
+                    }
+                }
+                // Version control info, if you're using GitHub, follow the format as seen here
+                scm {
+                    //修改成你的Git地址:
+                    connection = 'scm:git:gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
+                    developerConnection = 'scm:git:ssh://gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
+                    //分支地址:
+                    url = 'http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX'
+                }
+                // A slightly hacky fix so that your POM will include any transitive dependencies
+                // that your library builds upon
+                withXml {
+                    def dependenciesNode = asNode().appendNode('dependencies')
+                    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)

+ 82 - 0
library_core/publish_old.gradle

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

+ 5 - 0
library_core/src/main/AndroidManifest.xml

@@ -11,6 +11,11 @@
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="com.android.vending.BILLING" />
     <uses-permission android:name="com.farsitel.bazaar.permission.PAY_THROUGH_BAZAAR" />
+    <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
+
+    <queries>
+        <package android:name="com.facebook.katana" />
+    </queries>
 
     <application
         android:allowBackup="true"

+ 3 - 3
library_core/src/main/cpp/aes.cpp

@@ -471,7 +471,7 @@ void AES_CBC_encrypt_buffer(uint8_t *output, uint8_t *input, uint32_t length, co
     uint8_t extra = length % BLOCKLEN; /* Remaining bytes in the last non-full block */
 
     // Skip the key expansion if key is passed as 0
-    if (0 != key) {
+    if (nullptr != key) {
         Key = key;
         KeyExpansion();
     }
@@ -505,13 +505,13 @@ void AES_CBC_decrypt_buffer(uint8_t *output, uint8_t *input, uint32_t length, co
     uint8_t extra = length % BLOCKLEN; /* Remaining bytes in the last non-full block */
 
     // Skip the key expansion if key is passed as 0
-    if (0 != key) {
+    if (nullptr != key) {
         Key = key;
         KeyExpansion();
     }
 
     // If iv is passed as 0, we continue to encrypt without re-setting the Iv
-    if (iv != 0) {
+    if (iv != nullptr) {
         Iv = (uint8_t *) iv;
     }
 

+ 2 - 1
library_core/src/main/cpp/comm_map.cpp

@@ -19,6 +19,7 @@ void CommMap::Init(JNIEnv *env, jobject context) {
     //biz
     comm_params["gcp_code"] = ParamsKit::GetGcpCode(env, context);
     comm_params["game_code"] = ParamsKit::GetGameCode(env, context);
+    comm_params["game_name"] = ToolKit::GetAppName(env, context);
     comm_params["package_name"] = ToolKit::GetPackageName(env, context);
 
     //vers
@@ -32,7 +33,7 @@ void CommMap::Init(JNIEnv *env, jobject context) {
     } else {
         comm_params["simulator"] = 0;
     }
-
+    comm_params["aid"] = "";
     comm_params["android_id"] = ToolKit::GetAndroidDeviceId(env, context);
     comm_params["network"] = ToolKit::GetNetworkType(env, context);
     comm_params["os"] = 1;

+ 2 - 0
library_core/src/main/cpp/include/toolkit.h

@@ -20,6 +20,8 @@ public:
 
     static int String2Int(const std::string &s);
 
+    static std::string GetAppName(JNIEnv *env, jobject context);
+
     static std::string GetPackageName(JNIEnv *env, jobject context);
 
     static std::string GetServerVersion(JNIEnv *env);

+ 11 - 52
library_core/src/main/cpp/sdk_drive.cpp

@@ -16,7 +16,6 @@
 static void InitSdkDrive(JNIEnv *env, jobject thiz, jobject context) {
     CommMap::GetInstance()->Init(env, context);
     Logger::is_debug = ParamsKit::GetDebugModel(env, context);
-    Logger::D(env, ToolKit::ToJsonString(CommMap::GetInstance()->comm_params));
 }
 
 static void SetParam(JNIEnv *env, jobject thiz, jstring key, jstring value) {
@@ -30,7 +29,6 @@ static void SetParam(JNIEnv *env, jobject thiz, jstring key, jstring value) {
         }
     }
     CommMap::GetInstance()->comm_params[key_] = value_;
-    Logger::D(env, ToolKit::ToJsonString(CommMap::GetInstance()->comm_params));
 }
 
 static jstring GetParam(JNIEnv *env, jobject thiz, jstring key) {
@@ -46,83 +44,44 @@ static jstring InvokeJob(JNIEnv *env, jobject thiz, jobject context, jstring key
     Json::Value root = ToolKit::ToJsonObject(data_);
     root["common"] = CommMap::GetInstance()->comm_params;
 
-    //生成aes key
-//    char *raw_key = AesUtils::GetRawKey();
-//    std::string md5_key = md5(raw_key);
-//    auto *key64= static_cast<char *>(malloc(65));
-//    memset(key64,0,64);
-//    sprintf(key64,"%s%s",md5_key,reverse(md5_key.begin(),md5_key.end()))
-//    std::string  aes_key=md5()
-//    LOGD("test : %s", ToolKit::StrReverse(key_));
+    Logger::D(env, "请求参数 : " + ToolKit::ToJsonString(root));
+
     char *p = AesUtils::Encrypt(ToolKit::ToJsonString(root).c_str(), reinterpret_cast<const uint8_t *>(key_));
     jstring result = ToolKit::GetJString(env, p);
     env->ReleaseStringUTFChars(key, key_);
     env->ReleaseStringUTFChars(data, data_);
-//    delete (raw);
     free(p);
     return result;
-
-//    std::string enc = RequestKit::EncryptRequest2(env, context, data);
-//    env->ReleaseStringUTFChars(raw, raw_);
-//    jstring result = ToolKit::GetJString(env, enc.c_str());
-//    free(src);
-//    std::string raw = ToolKit::ToJsonString(HandleRequest(env, params));
-//    //aes key
-//    char *raw_key = AesUtils::GetRawKey();
-//    std::string raw_key_md5 = md5(raw_key);
-//    char *iv_32 = AesUtils::GetIv32(raw_key_md5.c_str());
-//    char *key_64 = static_cast<char *>(malloc(65));
-//    sprintf(key_64, "%s%s", raw_key_md5.c_str(), iv_32);
-//    key_64[65] = '\0';
-//    std::string key = md5(key_64);
-//    std::string aes_key = key.substr(8, 16);
-//    std::string p = AesUtils::Encrypt(raw.c_str(), reinterpret_cast<const uint8_t *>(aes_key.c_str()));
-//    Json::Value root;
-//    root["p"] = p;
-//    root["ts"] = raw_key_md5;
-//    free(raw_key);
-//    free(iv_32);
-//    free(key_64);
-//    delete aes_key;
-//    free((void *) aes_key);
 }
 
 static jstring ParseJob(JNIEnv *env, jobject thiz, jobject context, jstring key, jstring data) {
     const char *key_ = env->GetStringUTFChars(key, JNI_FALSE);
     const char *data_ = env->GetStringUTFChars(data, JNI_FALSE);
-
-//    Json::Value root = ToolKit::ToJsonObject(data_);
-//    const char *p = root["p"].asCString();
     char *raw = AesUtils::Decrypt(data_, reinterpret_cast<const uint8_t *>(key_));
+    Logger::D(env, raw);
     jstring result = ToolKit::GetJString(env, raw);
     env->ReleaseStringUTFChars(key, key_);
     env->ReleaseStringUTFChars(data, data_);
-//    delete (p);
     free(raw);
     return result;
-//    std::string raw = RequestKit::DecryptResponse2(env, context, data);
-//    jstring result = ToolKit::GetJString(env, raw.c_str());
-//    return result;
-//    time_t ts = time(nullptr);
-//    LOGD("%ld", ts);
-//    char *key = AesUtils::GetRawKey();
-//    return env->NewStringUTF("");
 }
 
-static jstring Test(JNIEnv *env, jobject thiz) {
-    char *key = AesUtils::GetRawKey();
-    jstring result = ToolKit::GetJString(env, key);
-    free(key);
-    return result;
+static jstring GetComm(JNIEnv *env, jobject thiz, jobject context) {
+    Json::Value root;
+    root["common"] = CommMap::GetInstance()->comm_params;
+    jstring data = ToolKit::GetJString(env, ToolKit::ToJsonString(root).c_str());
+    return data;
 }
 
+
 static JNINativeMethod gMethod[] = {
         {"initSdkDrive", "(Landroid/content/Context;)V",                                                      (void *) InitSdkDrive},
         {"setParam",     "(Ljava/lang/String;Ljava/lang/String;)V",                                           (void *) SetParam},
         {"getParam",     "(Ljava/lang/String;)Ljava/lang/String;",                                            (void *) GetParam},
         {"invokeJob",    "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) InvokeJob},
         {"parseJob",     "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) ParseJob},
-        {"test",         "()Ljava/lang/String;",                                                              (void *) Test},
+        {"getComm",      "(Landroid/content/Context;)Ljava/lang/String;",                                     (void *) GetComm},
+
 };
 
 extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {

+ 16 - 21
library_core/src/main/cpp/toolkit.cpp

@@ -64,6 +64,20 @@ int ToolKit::String2Int(const std::string &s) {
     return value;
 }
 
+std::string ToolKit::GetAppName(JNIEnv *env, jobject context) {
+    jclass clz = env->FindClass("cn/yyxx/support/AppUtils");
+    if (clz == nullptr) {
+        Logger::E(env, "AppUtils clz is null");
+        return "";
+    }
+    const char *method_name = "getAppName";
+    const char *sig = "(Landroid/content/Context;)Ljava/lang/String;";
+    jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
+    auto result = (jstring) env->CallStaticObjectMethod(clz, mid, context);
+    env->DeleteLocalRef(clz);
+    return JString2String(env, result);
+}
+
 std::string ToolKit::GetPackageName(JNIEnv *env, jobject context) {
     jclass clz = env->GetObjectClass(context);
     if (clz == nullptr) {
@@ -75,8 +89,6 @@ std::string ToolKit::GetPackageName(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallObjectMethod(context, mid);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -91,8 +103,6 @@ std::string ToolKit::GetServerVersion(JNIEnv *env) {
     jfieldID fid = env->GetStaticFieldID(clz, field_name, sig);
     auto result = (jstring) env->GetStaticObjectField(clz, fid);
     env->DeleteLocalRef(clz);
-//    free((void *) field_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -107,8 +117,6 @@ std::string ToolKit::GetClientVersion(JNIEnv *env) {
     jfieldID fid = env->GetStaticFieldID(clz, field_name, sig);
     auto result = (jstring) env->GetStaticObjectField(clz, fid);
     env->DeleteLocalRef(clz);
-//    free((void *) field_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -123,8 +131,6 @@ std::string ToolKit::GetVersionName(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallStaticObjectMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -139,15 +145,13 @@ std::string ToolKit::GetVersionCode(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallStaticObjectMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
 std::string ToolKit::GetAndroidDeviceId(JNIEnv *env, jobject context) {
     jclass clz = env->FindClass("cn/yyxx/support/device/DeviceInfoUtils");
     if (clz == nullptr) {
-        Logger::E(env, "UUIDUtils clz is null");
+        Logger::E(env, "DeviceInfoUtils clz is null");
         return "";
     }
     const char *method_name = "getAndroidDeviceId";
@@ -155,8 +159,6 @@ std::string ToolKit::GetAndroidDeviceId(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallStaticObjectMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return JString2String(env, result);
 }
 
@@ -166,13 +168,11 @@ int ToolKit::GetNetworkType(JNIEnv *env, jobject context) {
         Logger::E(env, "DeviceInfoUtils clz is null");
         return 0;
     }
-    const char *method_name = "getNetworkClass";
+    const char *method_name = "getNetworkType";
     const char *sig = "(Landroid/content/Context;)Ljava/lang/String;";
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jstring) env->CallStaticObjectMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return String2Int(JString2String(env, result));
 }
 
@@ -219,8 +219,6 @@ bool ToolKit::IsEmulator(JNIEnv *env, jobject context) {
     jmethodID mid = env->GetStaticMethodID(clz, method_name, sig);
     auto result = (jboolean) env->CallStaticBooleanMethod(clz, mid, context);
     env->DeleteLocalRef(clz);
-//    free((void *) method_name);
-//    free((void *) sig);
     return result == JNI_TRUE;
 }
 
@@ -254,12 +252,9 @@ char *ToolKit::StrReverse(const char *src) {
         *tmp++ = *p;
         *p-- = t;
     }
-//    free(p);
     return ret;
 }
 
 
 
 
-
-

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

@@ -110,4 +110,8 @@ class SdkBridge constructor(context: Context) {
         mImpl?.linkingEvent(context, sdkEvent)
     }
 
+    fun share(activity: Activity, line: String, tag: String, quote: String, callback: ICallback) {
+        mImpl?.share(activity, line, tag, quote, callback)
+    }
+
 }

+ 10 - 1
library_core/src/main/java/cn/yyxx/eyuangame/core/entity/SdkBackLoginInfo.kt

@@ -15,7 +15,11 @@ class SdkBackLoginInfo private constructor() {
     var phoneNum = ""
     var hasBindAccount = false
     var loginType = -1
-
+    var currentRoleId = ""
+    var currentRoleName = ""
+    var currentRoleLevel = ""
+    var currentServerId = ""
+    var currentServerName = ""
 
     fun reset() {
         this.userId = ""
@@ -24,6 +28,11 @@ class SdkBackLoginInfo private constructor() {
         this.phoneNum = ""
         this.hasBindAccount = false
         this.loginType = -1
+        this.currentRoleId = ""
+        this.currentRoleName = ""
+        this.currentRoleLevel = ""
+        this.currentServerId = ""
+        this.currentServerName = ""
     }
 
     fun toJsonString(): String {

+ 60 - 34
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkBridgeImpl.kt

@@ -19,6 +19,7 @@ import cn.yyxx.eyuangame.core.impl.center.HybridActivity
 import cn.yyxx.eyuangame.core.impl.floatball.FloatCenterServiceManager
 import cn.yyxx.eyuangame.core.impl.iab.ChargeImpl
 import cn.yyxx.eyuangame.core.impl.login.LoginActivity
+import cn.yyxx.eyuangame.core.impl.share.ShareImpl
 import cn.yyxx.eyuangame.core.internal.IImplCallback
 import cn.yyxx.eyuangame.core.internal.IRequestCallback
 import cn.yyxx.eyuangame.core.linking.Linking
@@ -78,13 +79,19 @@ class SdkBridgeImpl(context: Context) {
         Logger.i("EYuanGameSdk attachBaseContext ...")
         GAIDUtils.initGoogleAdid(application) { code, _ ->
             if (code == 0) {
-                Logger.i("谷歌框架可以访问,请求gaid")
-                SdkDrive.instance.setParam("device_id", GAIDUtils.getGoogleAdid())
-//                FirebaseCrashlytics.getInstance().setCustomKey("device_id", GAIDUtils.getGoogleAdid())
+                if (GAIDUtils.getGoogleAdid() == "00000000-0000-0000-0000-000000000000") {
+                    Logger.i("谷歌框架可以访问,gaid被限制跟踪,使用android id替代")
+                    SdkDrive.instance.setParam("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
+                    FirebaseCrashlytics.getInstance().setCustomKey("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
+                } else {
+                    Logger.i("谷歌框架可以访问,请求gaid")
+                    SdkDrive.instance.setParam("device_id", GAIDUtils.getGoogleAdid())
+                    FirebaseCrashlytics.getInstance().setCustomKey("device_id", GAIDUtils.getGoogleAdid())
+                }
             } else {
                 Logger.e("谷歌框架不可访问,使用android id替代")
                 SdkDrive.instance.setParam("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
-//                FirebaseCrashlytics.getInstance().setCustomKey("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
+                FirebaseCrashlytics.getInstance().setCustomKey("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
             }
             hasReadGaid = true
         }
@@ -93,13 +100,18 @@ class SdkBridgeImpl(context: Context) {
     fun initApplication(application: Application) {
         Logger.i("EYuanGameSdk initApplication ...")
         MMKVUtils.instance.init(application)
-        Linking.instance.initialize(application)
+        Linking.instance.initialize(application, object : Linking.OnTraceIdRead {
+            override fun onAdjustIdRead(id: String) {
+                Logger.d("onAdjustIdRead : $id")
+                SdkDrive.instance.setParam("aid", id)
+                MMKVUtils.instance.eventKV.encode("adjust_id", id)
+            }
+        })
     }
 
     fun initialize(activity: Activity, isLandscape: Boolean, callback: ICallback, initCallback: IInitialize) {
         Logger.i("EYuanGameSdk initialize ...")
         isLand = isLandscape
-
         if (TextUtils.isEmpty(ParamsUtils.getGcpCode(activity))) {
             Logger.e("初始化失败,参数异常,请检查yyxx_cfg.properties中YYXX_GCP_CODE的值")
             initCallback.onResult(-1, "初始化失败,参数异常,请检查yyxx_cfg.properties中YYXX_GAME_CODE的值")
@@ -124,6 +136,13 @@ class SdkBridgeImpl(context: Context) {
         //获取当前屏幕尺寸
         SdkDrive.instance.setParam("screen", DensityUtils.getResolutionByFullScreen(activity))
 
+        val adjustId = MMKVUtils.instance.eventKV.decodeString("adjust_id")
+        if (TextUtils.isEmpty(adjustId)) {
+            SdkDrive.instance.setParam("aid", "")
+        } else {
+            SdkDrive.instance.setParam("aid", adjustId!!)
+        }
+
         if (!hasReadGaid) {
             Logger.e("还未完成gaid加载,将延迟初始化")
             showInitLoadingDialog(activity)
@@ -158,7 +177,6 @@ class SdkBridgeImpl(context: Context) {
             override fun onResponse(resultInfo: ResultInfo) {
                 if (resultInfo.code == 1 && !TextUtils.isEmpty(resultInfo.data)) {
                     initBean = InitBean.toBean(resultInfo.data)
-                    //TODO 下载图片资源
                     cacheImageResource(activity)
 
                     Linking.instance.create(activity)
@@ -175,29 +193,22 @@ class SdkBridgeImpl(context: Context) {
 
 
     private fun cacheImageResource(activity: Activity) {
-        //浮标icon
-        initBean.floatCfg.floatIconUrl =
-            "http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX/raw/eb71e59d47ea88a5200cfe691e550334b38fff48/library_core/src/main/res/drawable-xhdpi/yyxx_float_logo_img.png"
-        initBean.floatCfg.floatIconLeftUrl =
-            "http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX/raw/eb71e59d47ea88a5200cfe691e550334b38fff48/library_core/src/main/res/drawable-xhdpi/yyxx_float_logo_left_img.png"
-        initBean.floatCfg.floatIconRightUrl =
-            "http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX/raw/eb71e59d47ea88a5200cfe691e550334b38fff48/library_core/src/main/res/drawable-xhdpi/yyxx_float_logo_right_img.png"
-
+        //全图标
         SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
         //左边
         SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconLeftUrl)
         //右边
         SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconRightUrl)
-//        //会员中心
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
-//        //礼包
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
-//        //客服
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
-//        //储值
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
-//        //邀请
-//        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //会员中心
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //礼包
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //客服
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //储值
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
+        //邀请
+        SdkRequest.instance.downloadImageFile(activity, initBean.floatCfg.floatIconUrl)
     }
 
     private fun showInitDialog(activity: Activity, callback: ICallback, initCallback: IInitialize) {
@@ -250,6 +261,7 @@ class SdkBridgeImpl(context: Context) {
         }
         isExistLoginHandle = false
         SdkBackLoginInfo.instance.reset()
+
         LoginActivity.login(activity, isAutoLogin, object : IImplCallback {
             override fun onResult(code: Int, result: String) {
                 Logger.d("onResult code : $code , result : $result")
@@ -322,30 +334,34 @@ class SdkBridgeImpl(context: Context) {
 
     fun roleCreate(activity: Activity, roleInfo: SdkRoleInfo) {
         Logger.i("EYuanGameSdk roleCreate ...")
-        Linking.instance.roleCreate(activity)
         isSubmitRoleData = true
+        submitRoleData(activity, 1, roleInfo)
     }
 
     fun roleLauncher(activity: Activity, roleInfo: SdkRoleInfo) {
         Logger.i("EYuanGameSdk roleLauncher ...")
-        Linking.instance.roleLauncher(activity)
         isSubmitRoleData = true
-
+        submitRoleData(activity, 2, roleInfo)
     }
 
     fun roleLevelUp(activity: Activity, roleInfo: SdkRoleInfo) {
         Logger.i("EYuanGameSdk roleLevelUp ...")
+        submitRoleData(activity, 3, roleInfo)
     }
 
     @Deprecated("暂时不需要向服务端上报角色信息")
     private fun submitRoleData(activity: Activity, timing: Int, roleInfo: SdkRoleInfo) {
         isSubmitRoleData = true
-        SdkRequest.instance.submitRoleData(activity, timing, roleInfo, object : IRequestCallback {
-            override fun onResponse(resultInfo: ResultInfo) {
-                Logger.d("submitRoleData code : ${resultInfo.code} , msg : ${resultInfo.msg}")
-            }
-
-        })
+        SdkBackLoginInfo.instance.currentRoleId = roleInfo.roleId
+        SdkBackLoginInfo.instance.currentRoleName = roleInfo.roleName
+        SdkBackLoginInfo.instance.currentRoleLevel = roleInfo.roleLevel
+        SdkBackLoginInfo.instance.currentServerId = roleInfo.serverId
+        SdkBackLoginInfo.instance.currentServerName = roleInfo.serverName
+//        SdkRequest.instance.submitRoleData(activity, timing, roleInfo, object : IRequestCallback {
+//            override fun onResponse(resultInfo: ResultInfo) {
+//                Logger.d("submitRoleData code : ${resultInfo.code} , msg : ${resultInfo.msg}")
+//            }
+//        })
     }
 
     fun openExitView(activity: Activity, callback: ICallback) {
@@ -407,6 +423,7 @@ class SdkBridgeImpl(context: Context) {
         Logger.i("EYuanGameSdk onDestroy ...")
         FloatCenterServiceManager.instance.release()
         Linking.instance.release()
+        MMKVUtils.instance.release()
     }
 
     fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, intent: Intent) {
@@ -427,6 +444,15 @@ class SdkBridgeImpl(context: Context) {
         Linking.instance.extEvent(context, sdkEvent)
     }
 
+    fun share(activity: Activity, line: String, tag: String, quote: String, callback: ICallback) {
+        Logger.i("EYuanGameSdk share ...")
+        ShareImpl.instance.invokeShare2Fb(activity, line, tag, quote, object : IImplCallback {
+            override fun onResult(code: Int, result: String) {
+                callback.onResult(code, result)
+            }
+        })
+    }
+
     private fun showInitLoadingDialog(context: Context) {
         initLoadingDialog?.apply {
             dismiss()

+ 1 - 11
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/SdkDrive.kt

@@ -12,16 +12,6 @@ class SdkDrive {
         System.loadLibrary("eyuangame")
     }
 
-//    external fun getAesKey()
-
-//    external fun aesEncrypt(src: String): String
-
-//    external fun aesDecrypt(raw: String, key: String): String
-
-//    external fun rsaEncrypt(src: String): String
-
-//    external fun rsaDecrypt(raw: String): String
-
     external fun initSdkDrive(context: Context)
 
     external fun setParam(key: String, value: String)
@@ -32,7 +22,7 @@ class SdkDrive {
 
     external fun parseJob(context: Context, key: String, data: String): String
 
-    external fun test(): String
+    external fun getComm(context: Context): String
 
     companion object {
         val instance: SdkDrive by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {

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

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

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

@@ -1,31 +1,108 @@
 package cn.yyxx.eyuangame.core.impl.center
 
 import android.app.Activity
+import android.content.Context
 import android.content.Intent
+import android.graphics.Color
 import android.net.Uri
 import android.net.http.SslError
 import android.os.Bundle
-import android.text.TextUtils
 import android.view.View
 import android.view.WindowManager
 import android.webkit.*
 import android.widget.FrameLayout
-import android.widget.ImageView
-import android.widget.TextView
+import cn.yyxx.eyuangame.base.utils.Logger
+import cn.yyxx.eyuangame.core.entity.ClickType
+import cn.yyxx.eyuangame.core.entity.SdkBackLoginInfo
 import cn.yyxx.eyuangame.core.impl.SdkBridgeImpl
+import cn.yyxx.eyuangame.core.impl.SdkDrive
+import cn.yyxx.eyuangame.core.impl.SdkJsImpl
+import cn.yyxx.eyuangame.core.impl.share.ShareImpl
+import cn.yyxx.eyuangame.core.internal.IImplCallback
+import cn.yyxx.eyuangame.core.internal.IJsCallback
+import cn.yyxx.eyuangame.core.ui.dialog.ScaleLoadingDialog
 import cn.yyxx.support.AndroidBug5497Workaround
+import cn.yyxx.support.JsonUtils
 import cn.yyxx.support.ResUtils
 import cn.yyxx.support.device.DeviceInfoUtils
+import org.json.JSONObject
 
 /**
  * @author #Suyghur.
  * Created on 2021/07/02
  */
-class HybridActivity : Activity() {
+class HybridActivity : Activity(), View.OnClickListener {
 
-    private lateinit var ivReturn: ImageView
-    private lateinit var tvTitle: TextView
+    private var uploadMessageForAndroid5: ValueCallback<Array<Uri>>? = null
+    private var mFileChooseParams: WebChromeClient.FileChooserParams? = null
     private lateinit var webView: WebView
+    private var loadingDialog: ScaleLoadingDialog? = null
+
+
+    private val callback = object : IJsCallback {
+
+        override fun onCallback(method: String, data: String): String {
+            when (method) {
+                "getCommon" -> return SdkDrive.instance.getComm(this@HybridActivity)
+                "close" -> {
+                    runOnUiThread {
+                        this@HybridActivity.finish()
+                    }
+                }
+                "back" -> {
+                    runOnUiThread {
+                        onBackPressed()
+                    }
+                }
+                "facebookShare" -> {
+                    kotlin.runCatching {
+                        val jsonObject = JSONObject(data)
+                        val line = if (JsonUtils.hasJsonKey(jsonObject, "line")) {
+                            jsonObject.getString("line")
+                        } else {
+                            ""
+                        }
+                        val tag = if (JsonUtils.hasJsonKey(jsonObject, "tag")) {
+                            jsonObject.getString("tag")
+                        } else {
+                            ""
+                        }
+                        val quote = if (JsonUtils.hasJsonKey(jsonObject, "quote")) {
+                            jsonObject.getString("quote")
+                        } else {
+                            ""
+                        }
+                        ShareImpl.instance.invokeShare2Fb(this@HybridActivity, line, tag, quote, object : IImplCallback {
+                            override fun onResult(code: Int, result: String) {
+                                Logger.d("invokeShare2Fb onResult")
+                                if (code == 0) {
+                                    webView.loadUrl("javascript:wk.FBShareCallback(1)")
+                                } else {
+                                    webView.loadUrl("javascript:wk.FBShareCallback(-1)")
+                                }
+                            }
+                        })
+
+                    }
+                }
+                "getRoleInfo" -> {
+                    val jsonObject = JSONObject()
+                    kotlin.runCatching {
+                        jsonObject.put("login_type", SdkBackLoginInfo.instance.loginType)
+                        jsonObject.put("uid", SdkBackLoginInfo.instance.userId)
+                        jsonObject.put("role_id", SdkBackLoginInfo.instance.currentRoleId)
+                        jsonObject.put("role_name", SdkBackLoginInfo.instance.currentRoleName)
+                        jsonObject.put("role_level", SdkBackLoginInfo.instance.currentRoleLevel)
+                        jsonObject.put("server_id", SdkBackLoginInfo.instance.currentServerId)
+                        jsonObject.put("server_name", SdkBackLoginInfo.instance.currentServerName)
+                    }
+                    return jsonObject.toString()
+                }
+            }
+            return ""
+        }
+
+    }
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -44,8 +121,14 @@ class HybridActivity : Activity() {
             AndroidBug5497Workaround.assistActivity(this)
         }
 
-        tvTitle = findViewById(ResUtils.getResId(this, "yyxx_tv_title", "id"))
-        ivReturn = findViewById(ResUtils.getResId(this, "yyxx_iv_return", "id"))
+//        tvTitle = findViewById(ResUtils.getResId(this, "yyxx_tv_title", "id"))
+//        ivReturn = findViewById(ResUtils.getResId(this, "yyxx_iv_return", "id"))
+//        ivReturn.apply {
+//            tag = ClickType.ACTION_RETURN
+//            setOnClickListener(this@HybridActivity)
+//        }
+
+        showDialog(this)
     }
 
 
@@ -53,7 +136,9 @@ class HybridActivity : Activity() {
         webView = WebView(this)
         webView.isVerticalScrollBarEnabled = true
         webView.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY
-//        webView.addJavascriptInterface(SdkJsImpl(this, callback), "FlyFunSdk")
+        webView.addJavascriptInterface(SdkJsImpl(callback), "eyuangame")
+        webView.setBackgroundColor(Color.TRANSPARENT)
+//        webView.alpha = 0F
         val container = findViewById<FrameLayout>(ResUtils.getResId(this, "yyxx_webview_container", "id"))
         container.addView(webView)
 
@@ -88,7 +173,7 @@ class HybridActivity : Activity() {
 
         if (DeviceInfoUtils.isNetworkConnected(this)) {
             webView.loadUrl(url)
-            //webView.loadUrl("file:///android_asset/test.html");
+//            webView.loadUrl("file:///android_asset/test.html");
         } else {
             //这种写法可以正确解码
             webView.loadData("网络异常,请检查重试", "text/html; charset=UTF-8", null)
@@ -106,6 +191,16 @@ class HybridActivity : Activity() {
 
             override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
                 val hitTestResult = view.hitTestResult
+                // 处理paypal
+                if (url.startsWith("https://www.sandbox.paypal.com")
+                    || url.startsWith("https://www.paypal.com")
+                    || url.startsWith("intent://")
+                ) {
+                    container.setBackgroundColor(Color.parseColor("#FFFFFF"))
+                } else {
+                    container.setBackgroundColor(Color.parseColor("#00FFFFFF"))
+                }
+
                 if (url.startsWith("http:") || url.startsWith("https:")) {
                     //解决重定向加载的问题 return false
                     if (!view.canGoBack()) {
@@ -116,7 +211,11 @@ class HybridActivity : Activity() {
                         return false
                     }
                     view.loadUrl(url)
+                } else {
+                    jump2MyCardClient(url)
+                    return true
                 }
+
                 return false
             }
 
@@ -132,45 +231,154 @@ class HybridActivity : Activity() {
             override fun onProgressChanged(view: WebView, newProgress: Int) {
                 super.onProgressChanged(view, newProgress)
                 //progressWebView.setProgressBarProgress(newProgress);
-//                if (newProgress == 100 && loadingDialog != null && loadingDialog!!.isShowing) {
-//                    //加载完成,关闭loading
-//                    loadingDialog!!.dismiss()
-//                }
+                if (newProgress == 100 && loadingDialog != null && loadingDialog!!.isShowing) {
+                    //加载完成,关闭loading
+                    dismissDialog()
+                }
             }
 
             //For Android > 5.0
             override fun onShowFileChooser(webView: WebView, filePathCallback: ValueCallback<Array<Uri>>, fileChooserParams: FileChooserParams): Boolean {
-//                openFileChooserImplForAndroid5(filePathCallback)
+                openFileChooserImplForAndroid5(filePathCallback)
+//                uploadMessageForAndroid5 = filePathCallback
+//                mFileChooseParams = fileChooserParams
+//                val intent = Intent(Intent.ACTION_GET_CONTENT)
+//                intent.addCategory(Intent.CATEGORY_OPENABLE)
+//                intent.putExtra("return-data", true)
+//                intent.type = "image/*"
+//                intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*")
+//                startActivityForResult(Intent.createChooser(intent, "选择相册"), FILE_CHOOSER_RESULT_CODE_FOR_ANDROID_5)
                 return true
             }
 
             override fun onReceivedTitle(view: WebView, title: String) {
                 super.onReceivedTitle(view, title)
-                if (!DeviceInfoUtils.isNetworkConnected(view.context)) {
-                    tvTitle.text = "网络异常"
-                    return
-                }
-                if (!TextUtils.isEmpty(view.title)) {
-                    var viewtitle = view.title
-                    if (viewtitle!!.length > 10) {
-                        viewtitle = viewtitle.substring(0, 10)
-                        viewtitle = "$viewtitle..."
-                    }
-                    tvTitle.text = viewtitle
-                }
+//                if (!DeviceInfoUtils.isNetworkConnected(view.context)) {
+//                    tvTitle.text = "网络异常"
+//                    return
+//                }
+//                if (!TextUtils.isEmpty(view.title)) {
+//                    var viewtitle = view.title
+//                    if (viewtitle!!.length > 10) {
+//                        viewtitle = viewtitle.substring(0, 10)
+//                        viewtitle = "$viewtitle..."
+//                    }
+//                    tvTitle.text = viewtitle
+//                }
+            }
+        }
+    }
+
+    override fun onNewIntent(intent: Intent?) {
+        super.onNewIntent(intent)
+    }
+
+    override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent) {
+        super.onActivityResult(requestCode, resultCode, intent)
+        if (requestCode == FILE_CHOOSER_RESULT_CODE_FOR_ANDROID_5) {
+            Logger.d("onActivityResult FILE_CHOOSER_RESULT_CODE_FOR_ANDROID_5")
+            if (uploadMessageForAndroid5 == null) {
+                Logger.d("mUploadMessageForAndroid5 == null")
+                return
+            }
+            if (intent == null) {
+                uploadMessageForAndroid5!!.onReceiveValue(arrayOf())
+                return
+            }
+            val result = if (resultCode != RESULT_OK) null else intent.data
+            if (result == null) {
+                uploadMessageForAndroid5!!.onReceiveValue(arrayOf())
+            } else {
+                uploadMessageForAndroid5!!.onReceiveValue(arrayOf(result))
+            }
+            uploadMessageForAndroid5 = null
+        } else {
+            ShareImpl.instance.onShareResult(requestCode, resultCode, intent)
+        }
+    }
+
+    override fun onResume() {
+        super.onResume()
+    }
+
+    override fun onDestroy() {
+        super.onDestroy()
+    }
+
+    private fun showDialog(context: Context) {
+        loadingDialog?.apply {
+            dismiss()
+            loadingDialog = null
+        }
+
+        loadingDialog = ScaleLoadingDialog(context, "")
+        loadingDialog?.show()
+    }
+
+    private fun dismissDialog() {
+        loadingDialog?.apply {
+            dismiss()
+            loadingDialog = null
+        }
+    }
+
+    private fun jump2MyCardClient(url: String) {
+        try {
+            val intent = if (url.startsWith("intent://")
+                || url.startsWith("line://")
+                || url.startsWith("shopeepay://")
+            ) {
+                Intent.parseUri(url, Intent.URI_INTENT_SCHEME)
+            } else {
+                Intent(Intent.ACTION_VIEW, Uri.parse(url))
+            }
+            startActivity(intent)
+        } catch (e: Exception) {
+            e.printStackTrace()
+            Logger.e("${e.message}")
+        }
+    }
+
+    private fun openFileChooserImplForAndroid5(uploadMsg: ValueCallback<Array<Uri>>) {
+        Logger.i("Open ImageChooser For Higher than Android5")
+        uploadMessageForAndroid5 = uploadMsg
+        val contentSelectionIntent = Intent(Intent.ACTION_GET_CONTENT)
+        contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE)
+        contentSelectionIntent.type = "image/*"
+
+        val chooserIntent = Intent(Intent.ACTION_CHOOSER)
+        chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent)
+        chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser")
+
+        startActivityForResult(chooserIntent, FILE_CHOOSER_RESULT_CODE_FOR_ANDROID_5)
+    }
+
+    override fun onBackPressed() {
+        if (webView.canGoBack()) {
+            webView.goBack()
+        } else {
+            finish()
+        }
+    }
+
+    override fun onClick(v: View?) {
+        v?.apply {
+            when (tag as Int) {
+                ClickType.ACTION_RETURN -> this@HybridActivity.finish()
             }
         }
     }
 
     companion object {
 
+        private const val FILE_CHOOSER_RESULT_CODE_FOR_ANDROID_5 = 2
+
         private var url = ""
 
         fun start(activity: Activity, url: String) {
             Companion.url = url
             activity.startActivity(Intent(activity, HybridActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
         }
-
-
     }
+
 }

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

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

+ 6 - 2
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/iab/ChargeImpl.kt

@@ -37,8 +37,6 @@ class ChargeImpl : InAppBilling() {
         this.implCallback = callback
         this.chargeInfo = chargeInfo
         showDialog(activity)
-
-//        checkLocalNotifyFailedOrder(activity)
         getOrderId(activity)
     }
 
@@ -123,9 +121,15 @@ class ChargeImpl : InAppBilling() {
     }
 
     override fun purchasesUpdatedFailed() {
+        disConnection()
+        dismissDialog()
+        implCallback.onResult(-1, "支付失败")
     }
 
     override fun connectGooglePlayFailed() {
+        disConnection()
+        dismissDialog()
+        implCallback.onResult(-1, "连接谷歌商店失败")
     }
 
     /**

+ 16 - 9
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/LoginActivity.kt

@@ -40,8 +40,6 @@ class LoginActivity : FragmentActivity(), View.OnClickListener {
         private set
 
     private lateinit var rootContainer: ConstraintLayout
-
-    //    private lateinit var loginContainer: ViewStub
     private lateinit var loginContainer: ConstraintLayout
     private lateinit var tabLayout: TabLayout
     private lateinit var viewPager: NoScrollViewPager
@@ -106,9 +104,8 @@ class LoginActivity : FragmentActivity(), View.OnClickListener {
             }
 
         })
-        showAutoLoginDialog()
-        showChooseDialog()
         initView()
+        showAutoLoginDialog()
     }
 
 
@@ -120,9 +117,17 @@ class LoginActivity : FragmentActivity(), View.OnClickListener {
 
         session = SessionUtils.instance.getLocalLastSession(this)
 
-        if (session == null || !isAutoLogin) {
+        if (session == null) {
             showChooseDialog = true
             showAutoLoginDialog = false
+            showChooseDialog()
+            return
+        }
+
+        if (!isAutoLogin) {
+            showChooseDialog = false
+            showAutoLoginDialog = false
+            showLoginView()
             return
         }
 
@@ -153,8 +158,9 @@ class LoginActivity : FragmentActivity(), View.OnClickListener {
             changeTimeNum()
             btnSwitch.setOnClickListener {
                 hideAutoLoginDialog()
-                showChooseDialog = true
-                showChooseDialog()
+//                showChooseDialog = true
+//                showChooseDialog()
+                showLoginView()
             }
             show()
         }
@@ -250,7 +256,7 @@ class LoginActivity : FragmentActivity(), View.OnClickListener {
 
             override fun onTabUnselected(tab: TabLayout.Tab?) {
                 if (pagerAdapter.currentFragment is LauncherFragment) {
-                    //TODO 收起下拉列表
+                    // TODO 收起下拉列表
                     (pagerAdapter.currentFragment as LauncherFragment).hideAccountList()
                 }
             }
@@ -260,7 +266,7 @@ class LoginActivity : FragmentActivity(), View.OnClickListener {
             }
         })
 
-        loginContainer.visibility = View.GONE
+        hideLoginView()
     }
 
     private fun setTabBackground(left: Int, right: Int) {
@@ -388,6 +394,7 @@ class LoginActivity : FragmentActivity(), View.OnClickListener {
     override fun onDestroy() {
         super.onDestroy()
         TimeDownUtils.cancel()
+
     }
 
 

+ 4 - 3
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/UserSignInImpl.kt

@@ -3,7 +3,6 @@ package cn.yyxx.eyuangame.core.impl.login
 import android.app.Activity
 import android.content.Context
 import android.content.Intent
-import android.os.Looper
 import android.text.TextUtils
 import cn.yyxx.eyuangame.base.utils.Logger
 import cn.yyxx.eyuangame.base.utils.ParamsUtils
@@ -68,8 +67,8 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
                     try {
                         val jsonObject = JSONObject()
                         jsonObject.put("login_type", LoginType.TYPE_FACEBOOK_LOGIN)
-                        jsonObject.put("third_plat_id", AccessToken.getCurrentAccessToken().userId)
-                        jsonObject.put("third_plat_token", AccessToken.getCurrentAccessToken().token)
+                        jsonObject.put("third_plat_id", AccessToken.getCurrentAccessToken()?.userId)
+                        jsonObject.put("third_plat_token", AccessToken.getCurrentAccessToken()?.token)
                         userLoginVerify(activity, jsonObject)
                     } catch (e: JSONException) {
                         e.printStackTrace()
@@ -99,7 +98,9 @@ class UserSignInImpl constructor(val activity: LoginActivity, private val callba
             return
         }
 
+
         googleSignInClient?.apply {
+            signOut()
             val intent = signInIntent
             activity.startActivityForResult(intent, 10000)
         }

+ 2 - 2
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/fragment/LauncherFragment.kt

@@ -239,7 +239,7 @@ class LauncherFragment : Fragment(), View.OnClickListener {
                 }
             }
         }
-        //循环添加列
+        // 循环添加列
         userLists.apply {
             for (i in indices) {
                 val session = this[i]
@@ -253,7 +253,7 @@ class LauncherFragment : Fragment(), View.OnClickListener {
                     }
                 }
 
-                //添加账号
+                // 添加账号
                 val item = mInflater.inflate(ResUtils.getResId(requireActivity(), "yyxx_account_list_item", "layout"), null)
                 item?.apply {
                     val tvAccountName = findViewById<TextView>(ResUtils.getResId(requireActivity(), "yyxx_tv_name", "id"))

+ 0 - 1
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/login/fragment/RegisterFragment.kt

@@ -182,6 +182,5 @@ class RegisterFragment : Fragment(), View.OnClickListener {
                 }
             }
         }
-
     }
 }

+ 67 - 0
library_core/src/main/java/cn/yyxx/eyuangame/core/impl/share/ShareImpl.kt

@@ -0,0 +1,67 @@
+package cn.yyxx.eyuangame.core.impl.share
+
+import android.app.Activity
+import android.content.Intent
+import android.net.Uri
+import cn.yyxx.eyuangame.base.utils.Logger
+import cn.yyxx.eyuangame.core.internal.IImplCallback
+import com.facebook.CallbackManager
+import com.facebook.FacebookCallback
+import com.facebook.FacebookException
+import com.facebook.share.Sharer
+import com.facebook.share.model.ShareHashtag
+import com.facebook.share.model.ShareLinkContent
+import com.facebook.share.widget.ShareDialog
+
+/**
+ * @author #Suyghur.
+ * Created on 2021/09/03
+ */
+class ShareImpl private constructor() {
+
+    private var shareDialog: ShareDialog? = null
+    private var fbCallback: CallbackManager? = null
+
+
+    init {
+        fbCallback = CallbackManager.Factory.create()
+    }
+
+    fun invokeShare2Fb(activity: Activity, line: String, tag: String, quote: String, callback: IImplCallback) {
+        shareDialog = ShareDialog(activity)
+        shareDialog?.registerCallback(fbCallback, object : FacebookCallback<Sharer.Result> {
+            override fun onSuccess(result: Sharer.Result?) {
+                Logger.d("facebook share onSuccess")
+                callback.onResult(0, "facebook share onSuccess")
+            }
+
+            override fun onCancel() {
+                Logger.d("facebook share onCancel")
+                callback.onResult(-1, "facebook share onSuccess")
+            }
+
+            override fun onError(error: FacebookException?) {
+                Logger.d("facebook share onError")
+                callback.onResult(-1, "facebook share onSuccess")
+            }
+        })
+
+        val shareLinkContent = ShareLinkContent.Builder()
+            .setContentUrl(Uri.parse(line))
+            .setShareHashtag(ShareHashtag.Builder().setHashtag(tag).build())
+            .setQuote(quote)
+            .build()
+        shareDialog?.show(shareLinkContent)
+    }
+
+
+    fun onShareResult(requestCode: Int, resultCode: Int, intent: Intent) {
+        fbCallback?.onActivityResult(requestCode, resultCode, intent)
+    }
+
+    companion object {
+        val instance: ShareImpl by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+            ShareImpl()
+        }
+    }
+}

+ 2 - 2
library_core/src/main/java/cn/yyxx/eyuangame/core/internal/IEventObserver.kt

@@ -19,9 +19,9 @@ interface IEventObserver {
 
     fun onCharge(context: Context, amount: Int)
 
-    fun onRoleCreate(context: Context)
+//    fun onRoleCreate(context: Context)
 
-    fun onRoleLauncher(context: Context)
+//    fun onRoleLauncher(context: Context)
 
     fun onCreate(activity: Activity)
 

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

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

+ 12 - 15
library_core/src/main/java/cn/yyxx/eyuangame/core/linking/Linking.kt

@@ -17,8 +17,13 @@ class Linking private constructor() {
 
     private val observers: MutableList<IEventObserver> = mutableListOf()
 
-    fun initialize(application: Application) {
-        observers.add(LinkingAdjustImpl())
+    fun initialize(application: Application, callback: OnTraceIdRead) {
+        observers.add(LinkingAdjustImpl(object : LinkingAdjustImpl.OnAdjustIdRead {
+            override fun onRead(id: String) {
+                callback.onAdjustIdRead(id)
+            }
+
+        }))
         observers.add(LinkingFirebaseImpl())
         observers.add(LinkingFacebookImpl())
 
@@ -53,18 +58,6 @@ class Linking private constructor() {
         }
     }
 
-    fun roleCreate(context: Context) {
-        for (ob in observers) {
-            ob.onRoleCreate(context)
-        }
-    }
-
-    fun roleLauncher(context: Context) {
-        for (ob in observers) {
-            ob.onRoleLauncher(context)
-        }
-    }
-
     fun create(activity: Activity) {
         for (ob in observers) {
             ob.onCreate(activity)
@@ -95,10 +88,14 @@ class Linking private constructor() {
         }
     }
 
-
     companion object {
         val instance: Linking by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
             Linking()
         }
     }
+
+    interface OnTraceIdRead {
+
+        fun onAdjustIdRead(id: String)
+    }
 }

+ 8 - 39
library_core/src/main/java/cn/yyxx/eyuangame/core/linking/channel/LinkingAdjustImpl.kt

@@ -25,7 +25,7 @@ import java.io.InputStreamReader
  * @author #Suyghur.
  * Created on 2021/06/17
  */
-class LinkingAdjustImpl : IEventObserver {
+class LinkingAdjustImpl(val callback: OnAdjustIdRead) : IEventObserver {
 
     private var isInitSuccess = false
     private var sdkConfig: JSONObject? = null
@@ -57,6 +57,9 @@ class LinkingAdjustImpl : IEventObserver {
 
         val config = AdjustConfig(application, appId, environment, true)
         config.setLogLevel(LogLevel.VERBOSE)
+        config.setOnAttributionChangedListener {
+            callback.onRead(it.adid)
+        }
         Adjust.onCreate(config)
         if (MMKVUtils.instance.eventKV.decodeBool("adjust_activities")) {
             isInitSuccess = true
@@ -163,44 +166,6 @@ class LinkingAdjustImpl : IEventObserver {
         }
     }
 
-    override fun onRoleCreate(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("adjust log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkBackLoginInfo.instance.userId)) {
-            Logger.e("adjust log failed , user is null")
-            return
-        }
-
-        sdkConfig?.apply {
-            if (JsonUtils.hasJsonKey(this, "create_player")) {
-                Adjust.trackEvent(AdjustEvent(this.getString("create_player")))
-                Logger.d("adjust log create player success")
-            }
-        }
-    }
-
-    override fun onRoleLauncher(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("adjust log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkBackLoginInfo.instance.userId)) {
-            Logger.e("adjust log failed , user is null")
-            return
-        }
-
-        sdkConfig?.apply {
-            if (JsonUtils.hasJsonKey(this, "enter_game")) {
-                Adjust.trackEvent(AdjustEvent(this.getString("enter_game")))
-                Logger.d("adjust log enter game success")
-            }
-        }
-    }
-
     override fun onCreate(activity: Activity) {
     }
 
@@ -289,4 +254,8 @@ class LinkingAdjustImpl : IEventObserver {
         }
         return null
     }
+
+    interface OnAdjustIdRead {
+        fun onRead(id: String)
+    }
 }

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

@@ -37,7 +37,8 @@ class LinkingFacebookImpl : IEventObserver {
             isInitSuccess = true
             return
         }
-        fbLogger.logEvent("open_app")
+        //open_app
+        fbLogger.logEvent(AppEventsConstants.EVENT_NAME_ADDED_PAYMENT_INFO)
         Logger.d("facebook log open app success")
         MMKVUtils.instance.eventKV.encode("facebook_activities", true)
         isInitSuccess = true
@@ -110,34 +111,6 @@ class LinkingFacebookImpl : IEventObserver {
         Logger.d("facebook log charge success")
     }
 
-    override fun onRoleCreate(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("facebook log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkBackLoginInfo.instance.userId)) {
-            Logger.e("facebook log failed , user is null")
-            return
-        }
-        fbLogger.logEvent("create_player")
-        Logger.d("facebook log create player success")
-    }
-
-    override fun onRoleLauncher(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("facebook log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkBackLoginInfo.instance.userId)) {
-            Logger.e("facebook log failed , user is null")
-            return
-        }
-        fbLogger.logEvent("enter_game")
-        Logger.d("facebook log create player success")
-    }
-
     override fun onCreate(activity: Activity) {
         if (!isInitSuccess) {
             Logger.e("facebook log failed , component initialize failed")
@@ -171,7 +144,6 @@ class LinkingFacebookImpl : IEventObserver {
                 "fb_mobile_tutorial_completion" -> AppEventsConstants.EVENT_NAME_COMPLETED_TUTORIAL
                 "fb_mobile_level_achieved" -> AppEventsConstants.EVENT_NAME_ACHIEVED_LEVEL
                 "fb_mobile_spent_credits" -> AppEventsConstants.EVENT_NAME_SPENT_CREDITS
-                "fb_mobile_add_payment_info" -> AppEventsConstants.EVENT_NAME_ADDED_PAYMENT_INFO
                 "fb_mobile_initiated_checkout" -> AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT
                 "fb_mobile_add_to_cart" -> AppEventsConstants.EVENT_NAME_ADDED_TO_CART
                 "fb_mobile_add_to_wishlist" -> AppEventsConstants.EVENT_NAME_ADDED_TO_WISHLIST
@@ -186,5 +158,7 @@ class LinkingFacebookImpl : IEventObserver {
         }
         Logger.d("facebook log ext event ${sdkEvent.eventName} success")
     }
+
+
 }
 

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

@@ -106,34 +106,6 @@ class LinkingFirebaseImpl : IEventObserver {
 
     }
 
-    override fun onRoleCreate(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("firebase log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkBackLoginInfo.instance.userId)) {
-            Logger.e("firebase log failed , user is null")
-            return
-        }
-        Firebase.analytics.logEvent("create_player", null)
-        Logger.d("firebase log create player success")
-    }
-
-    override fun onRoleLauncher(context: Context) {
-        if (!isInitSuccess) {
-            Logger.e("firebase log failed , component initialize failed")
-            return
-        }
-
-        if (TextUtils.isEmpty(SdkBackLoginInfo.instance.userId)) {
-            Logger.e("firebase log failed , user is null")
-            return
-        }
-        Firebase.analytics.logEvent("enter_game", null)
-        Logger.d("firebase log enter game success")
-    }
-
     override fun onCreate(activity: Activity) {
     }
 
@@ -161,4 +133,5 @@ class LinkingFirebaseImpl : IEventObserver {
         Firebase.analytics.logEvent(sdkEvent.eventName, null)
         Logger.d("firebase log ext event ${sdkEvent.eventName} success")
     }
+
 }

+ 2 - 2
library_core/src/main/java/cn/yyxx/eyuangame/core/network/Host.kt

@@ -9,8 +9,8 @@ import cn.yyxx.support.HostModelUtils
  */
 object Host {
 
-    private const val DEFAULT_ONLINE_HOST = "http://testsdkapi.eyuangame.com"
-    private const val DEFAULT_TEST_HOST = "http://testsdkapi.eyuangame.com"
+    private const val DEFAULT_ONLINE_HOST = "https://sdkapi.eyuangame.com"
+    private const val DEFAULT_TEST_HOST = "https://testsdkapi.eyuangame.com"
 
     var HOST = ""
 

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

@@ -39,9 +39,7 @@ object VolleyRequest {
             val randomKey = time + StrUtils.getRandomString(16)
             val rawKey = Md5Utils.encodeByMD5(randomKey)
             val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
-//            val p = AesUtils.encrypt(aesKey.substring(8, 24), jsonObject.toString())
-            val hexP =
-                SdkDrive.instance.invokeJob(context, aesKey.substring(8, 24), jsonObject.toString())
+            val hexP = SdkDrive.instance.invokeJob(context, aesKey.substring(8, 24), jsonObject.toString())
             val tmp = HexUtils.hexString2Bytes(hexP)
             val p = Base64Utils.encode(tmp)
 
@@ -52,6 +50,7 @@ object VolleyRequest {
             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)
@@ -68,7 +67,6 @@ object VolleyRequest {
                 val resultInfo = ResultInfo()
                 resultInfo.code = -1
                 resultInfo.msg = "接口请求异常"
-                Logger.d(it)
                 it?.apply {
                     try {
                         resultInfo.code = it.getInt("code")
@@ -83,13 +81,13 @@ object VolleyRequest {
 //                            SdkDrive.parseJob(context, responseObj.toString())
                             parseResponse(context, it.getJSONObject("data"))
                         } else {
-                            ""
+                            "{}"
                         }
                     } catch (e: JSONException) {
                         e.printStackTrace()
                     }
                 }
-                it.put("data", resultInfo.data)
+                it.put("data", JSONObject(resultInfo.data))
                 Logger.d("返回信息 : $it")
                 Logger.logHandler("返回信息 : $it\n")
                 callback.onResponse(resultInfo)
@@ -145,7 +143,7 @@ object VolleyRequest {
             override fun deliverResponse(response: ByteArray) {
                 Logger.d("volley download image file success, start to save file ...")
                 try {
-                    GlobalScope.launch(Dispatchers.IO){
+                    GlobalScope.launch(Dispatchers.IO) {
                         Logger.d("with io coroutines do save file")
                         FileUtils.saveFile(filePath, response)
                     }
@@ -184,7 +182,6 @@ object VolleyRequest {
                 resultInfo.msg = volleyError.message!!
             }
         }
-
         resultInfo.data = ""
         return resultInfo
     }

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

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

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

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

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

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

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

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

+ 7 - 62
library_core/src/main/res/layout-land/yyxx_hybrid.xml

@@ -3,73 +3,18 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_gravity="center">
+    android:layout_gravity="center"
+    android:background="@color/yyxx_transparent">
 
-
-    <androidx.constraintlayout.widget.ConstraintLayout
+    <FrameLayout
+        android:id="@+id/yyxx_webview_container"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="300dp"
         android:layout_margin="50dp"
+        android:background="@color/yyxx_transparent"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent">
-
-        <androidx.constraintlayout.widget.ConstraintLayout
-            android:id="@+id/yyxx_title_container"
-            android:layout_width="match_parent"
-            android:layout_height="30dp"
-            android:background="@drawable/yyxx_green_blue_panel_title"
-            app:layout_constraintBottom_toTopOf="@id/yyxx_content_container"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent">
-
-            <ImageView
-                android:id="@+id/yyxx_iv_return"
-                android:layout_width="20dp"
-                android:layout_height="20dp"
-                android:layout_marginStart="10dp"
-                android:background="@drawable/yyxx_back_img"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent" />
-
-            <TextView
-                android:id="@+id/yyxx_tv_title"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="@color/yyxx_color_white"
-                android:textSize="18sp"
-                android:textStyle="bold"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent" />
-        </androidx.constraintlayout.widget.ConstraintLayout>
-
-
-        <androidx.constraintlayout.widget.ConstraintLayout
-            android:id="@+id/yyxx_content_container"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="@drawable/yyxx_white_panel_content_bg"
-            android:padding="10dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/yyxx_title_container">
-
-            <FrameLayout
-                android:id="@+id/yyxx_webview_container"
-                android:layout_width="match_parent"
-                android:layout_height="260dp"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent" />
-        </androidx.constraintlayout.widget.ConstraintLayout>
-    </androidx.constraintlayout.widget.ConstraintLayout>
-
+        app:layout_constraintTop_toTopOf="parent" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 2 - 0
library_core/src/main/res/layout/yyxx_account_list_item.xml

@@ -10,6 +10,7 @@
         android:layout_width="14dp"
         android:layout_height="14dp"
         android:layout_marginStart="15dp"
+        android:layout_marginLeft="15dp"
         android:background="@drawable/yyxx_account_img" />
 
     <TextView
@@ -17,6 +18,7 @@
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginStart="10dp"
+        android:layout_marginLeft="10dp"
         android:layout_weight="1"
         android:gravity="center"
         android:text="账号"

+ 7 - 62
library_core/src/main/res/layout/yyxx_hybrid.xml

@@ -3,73 +3,18 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_gravity="center">
+    android:layout_gravity="center"
+    android:background="@color/yyxx_transparent">
 
-
-    <androidx.constraintlayout.widget.ConstraintLayout
+    <FrameLayout
+        android:id="@+id/yyxx_webview_container"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="320dp"
         android:layout_margin="20dp"
+        android:background="@color/yyxx_transparent"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent">
-
-        <androidx.constraintlayout.widget.ConstraintLayout
-            android:id="@+id/yyxx_title_container"
-            android:layout_width="match_parent"
-            android:layout_height="30dp"
-            android:background="@drawable/yyxx_green_blue_panel_title"
-            app:layout_constraintBottom_toTopOf="@id/yyxx_content_container"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent">
-
-            <ImageView
-                android:id="@+id/yyxx_iv_return"
-                android:layout_width="20dp"
-                android:layout_height="20dp"
-                android:layout_marginStart="10dp"
-                android:background="@drawable/yyxx_back_img"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent" />
-
-            <TextView
-                android:id="@+id/yyxx_tv_title"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="@color/yyxx_color_white"
-                android:textSize="18sp"
-                android:textStyle="bold"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent" />
-        </androidx.constraintlayout.widget.ConstraintLayout>
-
-
-        <androidx.constraintlayout.widget.ConstraintLayout
-            android:id="@+id/yyxx_content_container"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="@drawable/yyxx_white_panel_content_bg"
-            android:padding="10dp"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/yyxx_title_container">
-
-            <FrameLayout
-                android:id="@+id/yyxx_webview_container"
-                android:layout_width="match_parent"
-                android:layout_height="320dp"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent" />
-        </androidx.constraintlayout.widget.ConstraintLayout>
-    </androidx.constraintlayout.widget.ConstraintLayout>
-
+        app:layout_constraintTop_toTopOf="parent" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>

BIN
libs/dolin_zap_1.0.0.jar


BIN
libs/eyuangamesdk_base_1.0.0.jar


BIN
libs/mmkv-static-1.2.8.jar


BIN
libs/yyxx_support_1.0.1.jar


+ 0 - 2
settings.gradle

@@ -1,6 +1,4 @@
 rootProject.name = "EYuanGameSdk-KTX"
 include ':demo'
 include ':library_base'
-//include ':library_comm'
 include ':library_core'
-//include ':library_drive'

BIN
zkeystore/demo_yyxx.keystore


BIN
zkeystore/demo_yyxx_backup.keystore