Kaynağa Gözat

v1.0.0开发:接入华为和oppo支付

#Suyghur 2 yıl önce
ebeveyn
işleme
3eb4dcbd9c
80 değiştirilmiş dosya ile 634 ekleme ve 789 silme
  1. 4 10
      demo/build.gradle
  2. 3 3
      demo/src/main/AndroidManifest.xml
  3. 0 19
      demo/src/main/assets/yyxx_game/yyxx_cfg.properties
  4. 10 0
      demo/src/main/assets/yyxx_game/yyxx_comm.properties
  5. 1 1
      demo/src/main/java/com/eyuancomm/demo/CacheRoleInfo.kt
  6. 6 6
      demo/src/main/java/com/eyuancomm/demo/DemoActivity.kt
  7. 1 1
      demo/src/main/java/com/eyuancomm/demo/DemoApplication.kt
  8. 1 1
      demo/src/main/java/com/eyuancomm/demo/EnvActivity.kt
  9. 2 2
      demo/src/main/java/com/eyuancomm/demo/WelcomeActivity.kt
  10. 3 3
      demo/src/main/res/values/strings.xml
  11. 0 2
      library_base/.gitignore
  12. 0 72
      library_base/build.gradle
  13. 0 21
      library_base/buildJar.gradle
  14. 0 148
      library_base/proguard-rules.pro
  15. 0 5
      library_base/src/main/AndroidManifest.xml
  16. 0 18
      library_base/src/main/java/cn/yyxx/eyuancomm/base/internal/feature/IOrder.kt
  17. 0 140
      library_base/src/main/java/cn/yyxx/eyuancomm/base/utils/ParamsUtils.kt
  18. BIN
      library_base/src/main/jniLibs/arm64-v8a/libsecsdk.so
  19. BIN
      library_base/src/main/jniLibs/armeabi-v7a/libsecsdk.so
  20. BIN
      library_base/src/main/jniLibs/x86/libsecsdk.so
  21. BIN
      library_base/src/main/jniLibs/x86_64/libsecsdk.so
  22. 2 1
      library_comm/.gitignore
  23. 2 2
      library_comm/CMakeLists.txt
  24. 16 5
      library_comm/build.gradle
  25. 0 0
      library_comm/src/main/cpp/aes.cpp
  26. 0 0
      library_comm/src/main/cpp/aes_utils.cpp
  27. 0 34
      library_comm/src/main/cpp/comm_map.cpp
  28. 1 49
      library_comm/src/main/cpp/eyuancomm.cpp
  29. 0 0
      library_comm/src/main/cpp/hex_utils.cpp
  30. 0 0
      library_comm/src/main/cpp/include/aes/aes.h
  31. 0 0
      library_comm/src/main/cpp/include/aes/aes_utils.h
  32. 0 5
      library_comm/src/main/cpp/include/comm_map.h
  33. 0 0
      library_comm/src/main/cpp/include/hex_utils.h
  34. 0 0
      library_comm/src/main/cpp/include/logger.h
  35. 0 0
      library_comm/src/main/cpp/include/md5/md5.h
  36. 1 7
      library_comm/src/main/cpp/include/params_kit.h
  37. 0 0
      library_comm/src/main/cpp/include/third_part/json/json-forwards.h
  38. 0 0
      library_comm/src/main/cpp/include/third_part/json/json.h
  39. 0 0
      library_comm/src/main/cpp/include/third_part/json/jsoncpp.cpp
  40. 0 0
      library_comm/src/main/cpp/include/toolkit.h
  41. 4 4
      library_comm/src/main/cpp/logger.cpp
  42. 0 0
      library_comm/src/main/cpp/md5.cpp
  43. 0 8
      library_comm/src/main/cpp/params_kit.cpp
  44. 0 0
      library_comm/src/main/cpp/toolkit.cpp
  45. 0 0
      library_comm/src/main/java/cn/yyxx/eyuancomm/Version.kt
  46. 10 11
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/EYuanCommSdk.kt
  47. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/ChannelId.kt
  48. 2 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/Function.kt
  49. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/ResultInfo.kt
  50. 4 3
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/SdkChargeInfo.kt
  51. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/SdkEvent.kt
  52. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/SdkRoleInfo.kt
  53. 12 0
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/ext/DialogExt.kt
  54. 2 2
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/ext/MetaDataExt.kt
  55. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/ext/ZipExt.kt
  56. 4 12
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/impl/CommSdkDrive.kt
  57. 111 53
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/impl/CommSdkImpl.kt
  58. 3 3
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/impl/SdkProxyManager.kt
  59. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/ICallback.kt
  60. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/IInitialize.kt
  61. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/IApplication.kt
  62. 3 3
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/IFeature.kt
  63. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/ILifeCycle.kt
  64. 17 0
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/IOrder.kt
  65. 2 2
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/IRoleData.kt
  66. 14 6
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/network/SdkRequest.kt
  67. 11 17
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/network/VolleyRequest.kt
  68. 3 3
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/utils/Logger.kt
  69. 57 0
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/utils/ParamsUtils.kt
  70. 1 1
      library_comm/src/main/java/cn/yyxx/eyuancomm/comm/widget/ScaleLoadingDialog.kt
  71. 1 2
      library_impl/build.gradle
  72. 18 53
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/ImplSdkProxy.kt
  73. 2 2
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/SdkGenerator.kt
  74. 6 6
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/ChannelSdkYYXX.kt
  75. 18 12
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/ChannelSdkHuawei.kt
  76. 252 0
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/HuaweiInAppPay.kt
  77. 0 7
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/huawei/HuaweiLoginDialog.kt
  78. 10 9
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/oppo/ChannelSdkOppo.kt
  79. 4 4
      library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/vivo/ChannelSdkVivo.kt
  80. 1 1
      settings.gradle

+ 4 - 10
demo/build.gradle

@@ -14,8 +14,8 @@ android {
 
     defaultConfig {
 //        applicationId 'com.shzd.eyuangame'
-        applicationId 'com.xgyy.jpcq.nearme.gamecenter'
-//        applicationId 'com.xgyy.jpcq.huawei'
+//        applicationId 'com.xgyy.jpcq.nearme.gamecenter'
+        applicationId 'com.xgyy.jpcq.huawei'
         minSdk rootProject.ext.android.minSdk
         targetSdk rootProject.ext.android.targetSdk
         versionCode 1
@@ -70,16 +70,10 @@ android {
 }
 
 dependencies {
-//    if (rootProject.ext.module.publish) {
-//        implementation 'io.github.yyxxgame.sdk:eyuangame-sdk-ktx:1.0.3'
-//        implementation 'io.github.yyxxgame.sdk:eyuangame-component-lang-vn:1.0.2'
-//    } else {
-//        api project(':core:library_core')
-//    }
-    implementation project(':library_base')
     implementation project(':library_comm')
     implementation project(':library_impl')
-    implementation project(':channel_registry:channel_oppo')
+//    implementation project(':channel_registry:channel_oppo')
+    implementation project(':channel_registry:channel_huawei')
 
     // ktx
     implementation rootProject.ext.ktxLibs

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

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.eyuangame.demo">
+    package="com.eyuancomm.demo">
 
     <application
-        android:name="com.eyuangame.demo.DemoApplication"
+        android:name=".DemoApplication"
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
@@ -30,7 +30,7 @@
             android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
             android:exported="true"
             android:launchMode="singleTask"
-            android:screenOrientation="sensorLandscape">
+            android:screenOrientation="landscape">
             <intent-filter>
                 <action android:name="${applicationId}" />
                 <category android:name="android.intent.category.DEFAULT" />

+ 0 - 19
demo/src/main/assets/yyxx_game/yyxx_cfg.properties

@@ -1,19 +0,0 @@
-# 应用编号
-YYXX_GCP_CODE=G010199
-YYXX_GAME_CODE=100001
-# 融合应用编号
-YYXX_COMM_GCP_CODE=Y010101
-YYXX_COMM_GAME_CODE=100001
-YYXX_CHANNEL_ID=1
-# 事件打点应用ID
-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=229604925839347
-#debug模式(cp出正式包请关闭)
-YYXX_OWN_DEBUG=true
-#地区环境
-YYXX_DO_MAIN_ENV=2

+ 10 - 0
demo/src/main/assets/yyxx_game/yyxx_comm.properties

@@ -0,0 +1,10 @@
+# 应用编号
+YYXX_GCP_CODE=G010199
+YYXX_GAME_CODE=100001
+# 融合应用编号
+YYXX_COMM_GCP_CODE=Y010301
+YYXX_COMM_GAME_CODE=100001
+# 渠道Id
+YYXX_CHANNEL_ID=3
+# debug模式(cp出正式包请关闭)
+YYXX_OWN_DEBUG=true

+ 1 - 1
demo/src/main/java/com/eyuangame/demo/CacheRoleInfo.kt → demo/src/main/java/com/eyuancomm/demo/CacheRoleInfo.kt

@@ -1,4 +1,4 @@
-package com.eyuangame.demo
+package com.eyuancomm.demo
 
 import android.content.Context
 import android.text.TextUtils

+ 6 - 6
demo/src/main/java/com/eyuangame/demo/DemoActivity.kt → demo/src/main/java/com/eyuancomm/demo/DemoActivity.kt

@@ -1,4 +1,4 @@
-package com.eyuangame.demo
+package com.eyuancomm.demo
 
 import android.content.Intent
 import android.os.Bundle
@@ -10,10 +10,10 @@ import android.view.View
 import android.widget.*
 import androidx.appcompat.app.AlertDialog
 import androidx.appcompat.app.AppCompatActivity
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.base.entity.SdkRoleInfo
-import cn.yyxx.eyuancomm.base.internal.ICallback
 import cn.yyxx.eyuancomm.comm.EYuanCommSdk
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
+import cn.yyxx.eyuancomm.comm.internal.ICallback
 import cn.yyxx.support.hawkeye.LogUtils
 import cn.yyxx.support.hawkeye.ToastUtils
 import kotlin.system.exitProcess
@@ -131,7 +131,7 @@ class DemoActivity : AppCompatActivity(), View.OnClickListener {
                 4 -> EYuanCommSdk.getInstance().roleLauncher(this@DemoActivity, getGameRoleInfo())
                 5 -> EYuanCommSdk.getInstance().roleLevelUp(this@DemoActivity, getGameRoleInfo())
                 6 -> {
-                    EYuanCommSdk.getInstance().charge(this@DemoActivity, getGameChargeInfo(), true, object : ICallback {
+                    EYuanCommSdk.getInstance().charge(this@DemoActivity, getGameChargeInfo(), object : ICallback {
                         override fun onResult(code: Int, result: String) {
                             ToastUtils.toastInfo(this@DemoActivity, "---- demo提示不做翻译 ----\ncode : $code\n msg : $result\n ---- demo提示不做翻译 ----")
                         }
@@ -193,7 +193,7 @@ class DemoActivity : AppCompatActivity(), View.OnClickListener {
         //透传字段,会在回调地址中原样返回
         gameChargeInfo.cpExt = "cp_callback_info||$orderId"
         //金额,单位分,币种美金
-        gameChargeInfo.amount = 100
+        gameChargeInfo.amount = 10
         //商品ID,计费点
 //        gameChargeInfo.productId = "com.shzd.1usd"
         gameChargeInfo.productId = "p.1yuan"

+ 1 - 1
demo/src/main/java/com/eyuangame/demo/DemoApplication.kt → demo/src/main/java/com/eyuancomm/demo/DemoApplication.kt

@@ -1,4 +1,4 @@
-package com.eyuangame.demo
+package com.eyuancomm.demo
 
 import android.content.Context
 import cn.yyxx.eyuancomm.comm.EYuanCommSdkApplication

+ 1 - 1
demo/src/main/java/com/eyuangame/demo/EnvActivity.kt → demo/src/main/java/com/eyuancomm/demo/EnvActivity.kt

@@ -1,4 +1,4 @@
-package com.eyuangame.demo
+package com.eyuancomm.demo
 
 import android.app.Activity
 import android.content.Intent

+ 2 - 2
demo/src/main/java/com/eyuangame/demo/WelcomeActivity.kt → demo/src/main/java/com/eyuancomm/demo/WelcomeActivity.kt

@@ -1,4 +1,4 @@
-package com.eyuangame.demo
+package com.eyuancomm.demo
 
 import android.app.Activity
 import android.content.Intent
@@ -10,7 +10,7 @@ import android.os.Message
 import android.view.animation.AlphaAnimation
 import android.view.animation.Animation
 import android.widget.LinearLayout
-import cn.yyxx.eyuancomm.base.utils.Logger
+import cn.yyxx.eyuancomm.comm.utils.Logger
 import cn.yyxx.support.ResUtils
 
 /**

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

@@ -1,9 +1,9 @@
 <resources>
-    <string name="facebook_app_id">673741596978163</string>
-    <string name="fb_login_protocol_scheme">fb673741596978163</string>
+    <string name="facebook_app_id">265361418929970</string>
+    <string name="fb_login_protocol_scheme">fb265361418929970</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-Oppo</string>
+    <string name="app_name" translatable="false">EYuanCommSdk-KTX-Huawei</string>
     <string name="google_app_id">242301350243</string>
     <string name="google_client_id">242301350243-0qdvdetd5j13movtkvv2cno0jh9843no.apps.googleusercontent.com</string>
     <!-- project_number -->

+ 0 - 2
library_base/.gitignore

@@ -1,2 +0,0 @@
-.cxx
-/build

+ 0 - 72
library_base/build.gradle

@@ -1,72 +0,0 @@
-plugins {
-    id 'com.android.library'
-    id 'kotlin-android'
-}
-
-android {
-    compileSdk rootProject.ext.android.compileSdk
-    buildToolsVersion rootProject.ext.android.buildToolsVersion
-    ndkVersion ndkVersion
-    defaultConfig {
-        minSdk rootProject.ext.android.minSdk
-        targetSdk rootProject.ext.android.targetSdk
-
-        externalNativeBuild {
-            cmake {
-                cppFlags '-std=c++11 -frtti -fexceptions -lz'
-                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
-            }
-        }
-
-        ndk {
-            // 设置支持的SO库架构
-            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
-        }
-    }
-
-
-    buildTypes {
-        release {
-            minifyEnabled rootProject.ext.module.minifyEnabled
-            proguardFiles 'proguard-rules.pro'
-        }
-    }
-
-    buildFeatures {
-        buildConfig false
-    }
-
-    lintOptions {
-        abortOnError false
-    }
-
-    compileOptions {
-        kotlinOptions.freeCompilerArgs += ['-module-name', "cn.yyxx.eyauncomm.base"]
-    }
-
-    compileOptions {
-        sourceCompatibility JavaVersion.VERSION_1_8
-        targetCompatibility JavaVersion.VERSION_1_8
-    }
-
-    kotlinOptions {
-        jvmTarget = "1.8"
-    }
-
-    externalNativeBuild {
-        cmake {
-            path "CMakeLists.txt"
-        }
-    }
-}
-
-dependencies {
-    api files('../libs/yyxx_support_1.0.2.jar')
-    api files('../libs/oaid_sdk_1.0.25.jar')
-    implementation 'io.github.suyghur.dolin:zap:1.0.0'
-    compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
-    compileOnly "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
-    compileOnly "androidx.core:core-ktx:1.7.0"
-}
-
-apply from: 'buildJar.gradle'

+ 0 - 21
library_base/buildJar.gradle

@@ -1,21 +0,0 @@
-def SDK_BASENAME = "eyuangamesdk_base"
-def SDK_VERSION = "1.0.3"
-def SEPARATOR = "_"
-def sdkDestinationPath = "build/jar/"
-def zipFile = file('build/intermediates/aar_main_jar/release/classes.jar')
-
-static def buildTime() {
-    return new Date().format("yyyyMMddHHmm", TimeZone.getDefault())
-}
-
-task deleteBaseBuild(type: Delete) {
-    delete sdkDestinationPath
-}
-
-task makeJar(type: Jar) {
-    from zipTree(zipFile)
-    baseName = SDK_BASENAME + SEPARATOR + SDK_VERSION
-    destinationDir = file(sdkDestinationPath)
-}
-
-makeJar.dependsOn(deleteBaseBuild, build)

+ 0 - 148
library_base/proguard-rules.pro

@@ -1,148 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-#   http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
-
-# 代码混淆压缩比,在0~7之间,默认为5,一般不做修改
--optimizationpasses 7
-# 混合时不使用大小写混合,混合后的类名为小写
--dontusemixedcaseclassnames
-# 指定不去忽略非公共库的类
--dontskipnonpubliclibraryclasses
--dontoptimize
-# 这句话能够使我们的项目混淆后产生映射文件
-# 包含有类名->混淆后类名的映射关系
--verbose
--ignorewarnings
-# 指定不去忽略非公共库的类成员
--dontskipnonpubliclibraryclassmembers
-# 指定混淆是采用的算法,后面的参数是一个过滤器
-# 这个过滤器是谷歌推荐的算法,一般不做更改
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-
-# 保留java与js交互注解
--keepattributes *Annotation*
--keepattributes *JavascriptInterface*
-
-# keep javascript注释的方法,使用到webview js回调方法的需要添加此配置
--keepclassmembers class * {
-    @android.webkit.JavascriptInterface <methods>;
-}
-
-#  #保留内部接口或内部类、内部类、泛型签名类型
--keepattributes Exceptions,InnerClasses,Signature
-
-# 将崩溃日志文件来源重命名为"SourceFile"
--renamesourcefileattribute SourceFile
-# 产生有用的混淆堆栈跟踪
--keepattributes SourceFile,LineNumberTable
-# 保留注释
--keepattributes *Annotation*
-
-# 保留函数的参数名
--keepparameternames
-
--keepnames class * implements java.io.Serializable
--keepclassmembers class * implements java.io.Serializable {
-   static final long serialVersionUID;
-   private static final java.io.ObjectStreamField[] serialPersistentFields;
-   !static !transient <fields>;
-   private void writeObject(java.io.ObjectOutputStream);
-   private void readObject(java.io.ObjectInputStream);
-   java.lang.Object writeReplace();
-   java.lang.Object readResolve();
-}
-
--keepclassmembers class **.R$* {
-    public static <fields>;
-}
--keep class **.R$* {
- *;
-}
-
--keep public class * extends android.app.Activity{
-	public <fields>;
-	public <methods>;
-}
--keep public class * extends android.app.Application{
-	public <fields>;
-	public <methods>;
-}
--keep public class * extends android.app.Service
--keep public class * extends android.content.BroadcastReceiver
--keep public class * extends android.content.ContentProvider
--keep public class * extends android.app.backup.BackupAgentHelper
--keep public class * extends android.preference.Preference
-
-
--keepclassmembers enum * {
-    public static **[] values();
-    public static ** valueOf(java.lang.String);
-}
-
--keepclasseswithmembers class * {
-	public <init>(android.content.Context, android.util.AttributeSet);
-}
-
--keepclasseswithmembers class * {
-	public <init>(android.content.Context, android.util.AttributeSet, int);
-}
-
--keepclasseswithmembernames class *{
-	native <methods>;
-}
-
--keep class * implements android.os.Parcelable {
-  public static final android.os.Parcelable$Creator *;
-}
-
--keepclasseswithmembers class * {
-    ... *JNI*(...);
-}
-
--keepclasseswithmembernames class * {
-	... *JRI*(...);
-}
-
--keep class **JNI* {*;}
-
-# 保留native方法
--keepclasseswithmembernames class * {
-    native <methods>;
-}
-
-# keep R文件的静态字段
--keepclassmembers class **.R$* {
-    public static <fields>;
-}
-
--keeppackagenames cn.yyxx.eyuangame.**
--keep class cn.yyxx.support.**{*;}
--keep class cn.yyxx.eyuancomm.base.entity.SdkEvent{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.base.entity.SdkChargeInfo{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.base.entity.SdkRoleInfo{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.base.internal.ICallback{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.base.internal.IInitialize{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.base.utils.Logger{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.base.utils.ParamsUtils{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.base.EYuanGame{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.base.EYuanGame$Companion{*;}
--keep class cn.yyxx.eyuancomm.base.EYuanGameApplication{public <fields>; public <methods>;}
--keep class cn.yyxx.eyuancomm.Version{public <fields>; public <methods>;}

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

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

+ 0 - 18
library_base/src/main/java/cn/yyxx/eyuancomm/base/internal/feature/IOrder.kt

@@ -1,18 +0,0 @@
-package cn.yyxx.eyuancomm.base.internal.feature
-
-import android.app.Activity
-import cn.yyxx.eyuancomm.base.entity.ResultInfo
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-
-/**
- * @author #Suyghur.
- * Created on 2022/01/17
- */
-interface IOrder {
-
-    /**
-     * 获取订单号
-     * 不是所有渠道都需要自定义获取订单号
-     */
-    fun getOrderId(activity: Activity?, sdkChargeInfo: SdkChargeInfo, callback: (ResultInfo) -> Unit)
-}

+ 0 - 140
library_base/src/main/java/cn/yyxx/eyuancomm/base/utils/ParamsUtils.kt

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

BIN
library_base/src/main/jniLibs/arm64-v8a/libsecsdk.so


BIN
library_base/src/main/jniLibs/armeabi-v7a/libsecsdk.so


BIN
library_base/src/main/jniLibs/x86/libsecsdk.so


BIN
library_base/src/main/jniLibs/x86_64/libsecsdk.so


+ 2 - 1
library_comm/.gitignore

@@ -1 +1,2 @@
-/build
+/build
+.cxx

+ 2 - 2
library_base/CMakeLists.txt → library_comm/CMakeLists.txt

@@ -18,8 +18,8 @@ include_directories(src/main/cpp/include/aes)
 aux_source_directory(src/main/cpp DIR_SOURCE)
 aux_source_directory(src/main/cpp/include/third_part/json JSON_SOURCE)
 
-add_library(local_crypto STATIC IMPORTED)
-add_library(local_openssl STATIC IMPORTED)
+#add_library(local_crypto STATIC IMPORTED)
+#add_library(local_openssl STATIC IMPORTED)
 
 
 add_library(

+ 16 - 5
library_comm/build.gradle

@@ -6,6 +6,7 @@ plugins {
 android {
     compileSdk rootProject.ext.android.compileSdk
     buildToolsVersion rootProject.ext.android.buildToolsVersion
+    ndkVersion rootProject.ext.android.ndkVersion
 
     defaultConfig {
         minSdk rootProject.ext.android.minSdk
@@ -40,7 +41,7 @@ android {
     }
 
     compileOptions {
-        kotlinOptions.freeCompilerArgs += ['-module-name', "cn.yyxx.eyuangame.core"]
+        kotlinOptions.freeCompilerArgs += ['-module-name', "cn.yyxx.eyuancomm.comm"]
     }
 
     compileOptions {
@@ -51,12 +52,22 @@ android {
     kotlinOptions {
         jvmTarget = "1.8"
     }
+
+    externalNativeBuild {
+        cmake {
+            path "CMakeLists.txt"
+        }
+    }
 }
 
 dependencies {
-    compileOnly project(':library_base')
+    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
+    implementation "androidx.core:core-ktx:1.7.0"
+    // 日志采集框架
+    implementation 'io.github.suyghur.dolin:zap:1.0.0'
+
+    api files("../libs/yyxx_support_1.0.2.jar")
+    api files("../libs/oaid_sdk_1.0.25.jar")
 
-    compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
-    compileOnly "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
-    compileOnly "androidx.core:core-ktx:1.7.0"
 }

+ 0 - 0
library_base/src/main/cpp/aes.cpp → library_comm/src/main/cpp/aes.cpp


+ 0 - 0
library_base/src/main/cpp/aes_utils.cpp → library_comm/src/main/cpp/aes_utils.cpp


+ 0 - 34
library_base/src/main/cpp/comm_map.cpp → library_comm/src/main/cpp/comm_map.cpp

@@ -16,11 +16,6 @@ CommMap *CommMap::GetInstance() {
 }
 
 void CommMap::Init(JNIEnv *env, jobject context) {
-    InitComm(env, context);
-    InitCore(env, context);
-}
-
-void CommMap::InitComm(JNIEnv *env, jobject context) {
     //biz
     comm_params["gcp_code"] = ParamsKit::GetCommGcpCode(env, context);
     comm_params["game_code"] = ParamsKit::GetCommGameCode(env, context);
@@ -51,33 +46,4 @@ void CommMap::InitComm(JNIEnv *env, jobject context) {
     comm_params["mobile_brand"] = ToolKit::GetMobileBrand();
 }
 
-void CommMap::InitCore(JNIEnv *env, jobject context) {
-    //biz
-    core_params["gcp_code"] = ParamsKit::GetGcpCode(env, context);
-    core_params["game_code"] = ParamsKit::GetGameCode(env, context);
-    core_params["game_name"] = ToolKit::GetAppName(env, context);
-    core_params["package_name"] = ToolKit::GetPackageName(env, context);
-
-    //vers
-    core_params["server_version"] = ToolKit::GetServerVersion(env);
-    core_params["client_version"] = ToolKit::GetClientVersion(env);
-    core_params["game_version"] = ToolKit::GetVersionName(env, context);
-
-    //device
-    if (ToolKit::IsEmulator(env, context)) {
-        core_params["simulator"] = 1;
-    } else {
-        core_params["simulator"] = 0;
-    }
-    core_params["aid"] = "";
-    core_params["android_id"] = ToolKit::GetAndroidDeviceId(env, context);
-    core_params["network"] = ToolKit::GetNetworkType(env, context);
-    core_params["os"] = 1;
-    core_params["os_version"] = ToolKit::GetDeviceSoftwareVersion();
-    core_params["mobile_model"] = ToolKit::GetDeviceModel();
-    core_params["mobile_mfrs"] = ToolKit::GetDeviceManufacturer();
-    core_params["mobile_brand"] = ToolKit::GetMobileBrand();
-}
-
-
 

+ 1 - 49
library_base/src/main/cpp/eyuancomm.cpp → library_comm/src/main/cpp/eyuancomm.cpp

@@ -37,24 +37,6 @@ static jstring GetCommParam(JNIEnv *env, jobject thiz, jstring key) {
     return env->NewStringUTF(CommMap::GetInstance()->comm_params[key_].asString().c_str());
 }
 
-static void SetCoreParam(JNIEnv *env, jobject thiz, jstring key, jstring value) {
-    std::string key_ = ToolKit::JString2String(env, key);
-    std::string value_ = ToolKit::JString2String(env, value);
-    if (key_ == "device_id") {
-        if (value_ == CommMap::GetInstance()->core_params["android_id"].asString()) {
-            CommMap::GetInstance()->core_params["id_type"] = 1;
-        } else {
-            CommMap::GetInstance()->core_params["id_type"] = 0;
-        }
-    }
-    CommMap::GetInstance()->core_params[key_] = value_;
-}
-
-static jstring GetCoreParam(JNIEnv *env, jobject thiz, jstring key) {
-    std::string key_ = ToolKit::JString2String(env, key);
-    return env->NewStringUTF(CommMap::GetInstance()->core_params[key_].asString().c_str());
-}
-
 static jstring InvokeCommJob(JNIEnv *env, jobject thiz, jstring key, jstring data) {
     const char *key_ = env->GetStringUTFChars(key, JNI_FALSE);
     const char *data_ = env->GetStringUTFChars(data, JNI_FALSE);
@@ -73,24 +55,6 @@ static jstring InvokeCommJob(JNIEnv *env, jobject thiz, jstring key, jstring dat
     return result;
 }
 
-static jstring InvokeCoreJob(JNIEnv *env, jobject thiz, 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_);
-    root["common"] = CommMap::GetInstance()->core_params;
-
-    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_);
-    free(p);
-    return result;
-}
-
 static jstring ParseJob(JNIEnv *env, jobject thiz, jstring key, jstring data) {
     const char *key_ = env->GetStringUTFChars(key, JNI_FALSE);
     const char *data_ = env->GetStringUTFChars(data, JNI_FALSE);
@@ -110,25 +74,13 @@ static jstring GetCommMap(JNIEnv *env, jobject thiz) {
     return data;
 }
 
-static jstring GetCoreMap(JNIEnv *env, jobject thiz) {
-    Json::Value root;
-    root["common"] = CommMap::GetInstance()->core_params;
-    jstring data = ToolKit::GetJString(env, ToolKit::ToJsonString(root).c_str());
-    return data;
-}
-
 static JNINativeMethod gMethod[] = {
         {"initSdkDrive",  "(Landroid/content/Context;)V",                             (void *) InitSdkDrive},
         {"setCommParam",  "(Ljava/lang/String;Ljava/lang/String;)V",                  (void *) SetCommParam},
         {"getCommParam",  "(Ljava/lang/String;)Ljava/lang/String;",                   (void *) GetCommParam},
-        {"setCoreParam",  "(Ljava/lang/String;Ljava/lang/String;)V",                  (void *) SetCoreParam},
-        {"getCoreParam",  "(Ljava/lang/String;)Ljava/lang/String;",                   (void *) GetCommParam},
         {"invokeCommJob", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) InvokeCommJob},
-        {"invokeCoreJob", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) InvokeCoreJob},
         {"parseJob",      "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void *) ParseJob},
         {"getCommMap",    "()Ljava/lang/String;",                                     (void *) GetCommMap},
-        {"getCoreMap",    "()Ljava/lang/String;",                                     (void *) GetCoreMap},
-
 };
 
 extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
@@ -136,7 +88,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
     if (vm->GetEnv((void **) &env, JNI_VERSION_1_6) != JNI_OK) {
         return JNI_ERR;
     }
-    jclass clz = env->FindClass("cn/yyxx/eyuancomm/base/SdkDrive");
+    jclass clz = env->FindClass("cn/yyxx/eyuancomm/comm/impl/CommSdkDrive");
     if (env->RegisterNatives(clz, gMethod, sizeof(gMethod) / sizeof(gMethod[0])) < 0) {
         return JNI_ERR;
     }

+ 0 - 0
library_base/src/main/cpp/hex_utils.cpp → library_comm/src/main/cpp/hex_utils.cpp


+ 0 - 0
library_base/src/main/cpp/include/aes/aes.h → library_comm/src/main/cpp/include/aes/aes.h


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


+ 0 - 5
library_base/src/main/cpp/include/comm_map.h → library_comm/src/main/cpp/include/comm_map.h

@@ -20,16 +20,11 @@ public:
     void Init(JNIEnv *env, jobject context);
 
     Json::Value comm_params;
-    Json::Value core_params;
 
 private:
     CommMap();
 
     ~CommMap();
-
-    void InitComm(JNIEnv *env, jobject context);
-
-    void InitCore(JNIEnv *env, jobject context);
 };
 
 #ifdef __cplusplus

+ 0 - 0
library_base/src/main/cpp/include/hex_utils.h → library_comm/src/main/cpp/include/hex_utils.h


+ 0 - 0
library_base/src/main/cpp/include/logger.h → library_comm/src/main/cpp/include/logger.h


+ 0 - 0
library_base/src/main/cpp/include/md5/md5.h → library_comm/src/main/cpp/include/md5/md5.h


+ 1 - 7
library_base/src/main/cpp/include/params_kit.h → library_comm/src/main/cpp/include/params_kit.h

@@ -14,9 +14,7 @@
 extern "C" {
 #endif
 
-#define CONFIG_FILE "yyxx_cfg.properties"
-#define YYXX_GCP_CODE "YYXX_GCP_CODE"
-#define YYXX_GAME_CODE "YYXX_GAME_CODE"
+#define CONFIG_FILE "yyxx_comm.properties"
 #define YYXX_COMM_GCP_CODE "YYXX_COMM_GCP_CODE"
 #define YYXX_COMM_GAME_CODE "YYXX_COMM_GAME_CODE"
 #define YYXX_CHANNEL_ID "YYXX_CHANNEL_ID"
@@ -25,10 +23,6 @@ extern "C" {
 
 class ParamsKit {
 public:
-    static std::string GetGcpCode(JNIEnv *env, jobject context);
-
-    static std::string GetGameCode(JNIEnv *env, jobject context);
-
     static std::string GetCommGcpCode(JNIEnv *env, jobject context);
 
     static std::string GetCommGameCode(JNIEnv *env, jobject context);

+ 0 - 0
library_base/src/main/cpp/include/third_part/json/json-forwards.h → library_comm/src/main/cpp/include/third_part/json/json-forwards.h


+ 0 - 0
library_base/src/main/cpp/include/third_part/json/json.h → library_comm/src/main/cpp/include/third_part/json/json.h


+ 0 - 0
library_base/src/main/cpp/include/third_part/json/jsoncpp.cpp → library_comm/src/main/cpp/include/third_part/json/jsoncpp.cpp


+ 0 - 0
library_base/src/main/cpp/include/toolkit.h → library_comm/src/main/cpp/include/toolkit.h


+ 4 - 4
library_base/src/main/cpp/logger.cpp → library_comm/src/main/cpp/logger.cpp

@@ -8,7 +8,7 @@ bool Logger::is_debug = true;
 
 void Logger::D(JNIEnv *env, const std::string &msg) {
     if (is_debug) {
-        jclass clz = env->FindClass("cn/yyxx/eyuancomm/base/utils/Logger");
+        jclass clz = env->FindClass("cn/yyxx/eyuancomm/comm/utils/Logger");
         if (clz == nullptr) {
             LOGE("Logger clz is null");
             return;
@@ -23,7 +23,7 @@ void Logger::D(JNIEnv *env, const std::string &msg) {
 }
 
 void Logger::I(JNIEnv *env, const std::string &msg) {
-    jclass clz = env->FindClass("cn/yyxx/eyuancomm/base/utils/Logger");
+    jclass clz = env->FindClass("cn/yyxx/eyuancomm/comm/utils/Logger");
     if (clz == nullptr) {
         LOGE("Logger clz is null");
         return;
@@ -37,7 +37,7 @@ void Logger::I(JNIEnv *env, const std::string &msg) {
 }
 
 void Logger::E(JNIEnv *env, const std::string &msg) {
-    jclass clz = env->FindClass("cn/yyxx/eyuancomm/base/utils/Logger");
+    jclass clz = env->FindClass("cn/yyxx/eyuancomm/comm/utils/Logger");
     if (clz == nullptr) {
         LOGE("Logger clz is null");
         return;
@@ -52,7 +52,7 @@ void Logger::E(JNIEnv *env, const std::string &msg) {
 }
 
 void Logger::LogHandler(JNIEnv *env, const std::string &msg) {
-    jclass clz = env->FindClass("cn/yyxx/eyuancomm/base/utils/Logger");
+    jclass clz = env->FindClass("cn/yyxx/eyuancomm/comm/utils/Logger");
     if (clz == nullptr) {
         LOGE("Logger clz is null");
         return;

+ 0 - 0
library_base/src/main/cpp/md5.cpp → library_comm/src/main/cpp/md5.cpp


+ 0 - 8
library_base/src/main/cpp/params_kit.cpp → library_comm/src/main/cpp/params_kit.cpp

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

+ 0 - 0
library_base/src/main/cpp/toolkit.cpp → library_comm/src/main/cpp/toolkit.cpp


+ 0 - 0
library_base/src/main/java/cn/yyxx/eyuancomm/Version.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/Version.kt


+ 10 - 11
library_comm/src/main/java/cn/yyxx/eyuancomm/comm/EYuanCommSdk.kt

@@ -8,12 +8,12 @@ import android.os.Build
 import android.text.TextUtils
 import android.webkit.WebView
 import cn.yyxx.eyuancomm.Version
-import cn.yyxx.eyuancomm.base.entity.Function
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.base.entity.SdkEvent
-import cn.yyxx.eyuancomm.base.entity.SdkRoleInfo
-import cn.yyxx.eyuancomm.base.internal.ICallback
-import cn.yyxx.eyuancomm.base.utils.Logger
+import cn.yyxx.eyuancomm.comm.entity.Function
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkEvent
+import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
+import cn.yyxx.eyuancomm.comm.internal.ICallback
+import cn.yyxx.eyuancomm.comm.utils.Logger
 import cn.yyxx.eyuancomm.comm.impl.CommSdkImpl
 import cn.yyxx.support.AppUtils
 
@@ -160,10 +160,9 @@ class EYuanCommSdk private constructor() {
      *
      * @param activity   Activity上下文
      * @param chargeInfo 支付信息实体对象
-     * @param isIab      是否内购
      * @param callback   支付回调对象
      */
-    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: ICallback) {
+    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
         if (checkSdkImplNull(Function.CHARGE, callback)) {
             return
         }
@@ -175,7 +174,7 @@ class EYuanCommSdk private constructor() {
         }
 
         clickChargeTime = System.currentTimeMillis()
-        commSdkImpl?.charge(activity, chargeInfo, isIab, callback)
+        commSdkImpl?.charge(activity, chargeInfo, callback)
     }
 
     /**
@@ -327,8 +326,8 @@ class EYuanCommSdk private constructor() {
 
     private fun checkSdkImplNull(function: String, callback: ICallback?): Boolean {
         return if (commSdkImpl == null) {
-            Logger.e("invoke $function error ... EYuanGameSdk initialized failed or not initialized yet")
-            callback?.onResult(-1, "EYuanGameSdk 初始化失败或还未进行初始化")
+            Logger.e("invoke $function error ... EYuanCommSdk initialized failed or not initialized yet")
+            callback?.onResult(-1, "EYuanCommSdk 初始化失败或还未进行初始化")
             true
         } else {
             false

+ 1 - 1
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/entity/ChannelId.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/ChannelId.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.impl.entity
+package cn.yyxx.eyuancomm.comm.entity
 
 /**
  * @author #Suyghur.

+ 2 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/entity/Function.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/Function.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.entity
+package cn.yyxx.eyuancomm.comm.entity
 
 /**
  * @author #Suyghur.
@@ -11,6 +11,7 @@ object Function {
     const val LOGIN = "login"
     const val LOGOUT = "logout"
     const val CHARGE = "charge"
+    const val GET_ORDER_EXT = "getOrderExt"
     const val HAS_EXIT_VIEW = "hasExitView"
     const val OPEN_EXIT_VIEW = "openExitView"
     const val ROLE_CREATE = "roleCreate"

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/entity/ResultInfo.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/ResultInfo.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.entity
+package cn.yyxx.eyuancomm.comm.entity
 
 /**
  * @author #Suyghur.

+ 4 - 3
library_base/src/main/java/cn/yyxx/eyuancomm/base/entity/SdkChargeInfo.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/SdkChargeInfo.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.entity
+package cn.yyxx.eyuancomm.comm.entity
 
 import java.io.Serializable
 
@@ -21,12 +21,13 @@ class SdkChargeInfo : Serializable {
     var productDesc: String = ""
     var cpOrderId: String = ""
     var orderId: String = ""
+    var channelNotifyUrl: String = ""
+    var channelExt: String = ""
     var cpExt: String = ""
     var cpPayTime: Long = 0
     var cpPaySign: String = ""
 
     override fun toString(): String {
-        return "SdkChargeInfo(userId='$userId', roleId='$roleId', roleName='$roleName', roleLevel='$roleLevel', roleCTIme=$roleCTime, serverId='$serverId', serverName='$serverName', amount=$amount, productId='$productId', productName='$productName', productDesc='$productDesc', cpOrderId='$cpOrderId', orderId='$orderId', cpExt='$cpExt', cpPayTime=$cpPayTime, cpPaySign='$cpPaySign')"
+        return "SdkChargeInfo(userId='$userId', roleId='$roleId', roleName='$roleName', roleLevel='$roleLevel', roleCTime=$roleCTime, serverId='$serverId', serverName='$serverName', amount=$amount, productId='$productId', productName='$productName', productDesc='$productDesc', cpOrderId='$cpOrderId', orderId='$orderId', channelNotifyUrl='$channelNotifyUrl', channelExt='$channelExt', cpExt='$cpExt', cpPayTime=$cpPayTime, cpPaySign='$cpPaySign')"
     }
-
 }

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/entity/SdkEvent.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/SdkEvent.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.entity
+package cn.yyxx.eyuancomm.comm.entity
 
 /**
  * @author #Suyghur.

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/entity/SdkRoleInfo.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/entity/SdkRoleInfo.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.entity
+package cn.yyxx.eyuancomm.comm.entity
 
 /**
  * @author #Suyghur.

+ 12 - 0
library_comm/src/main/java/cn/yyxx/eyuancomm/comm/ext/DialogExt.kt

@@ -0,0 +1,12 @@
+package cn.yyxx.eyuancomm.comm.ext
+
+import android.content.Context
+
+/**
+ * @author #Suyghur.
+ * Created on 2022/02/17
+ */
+
+//fun Context.showScaleLoading(text: String) {
+//
+//}

+ 2 - 2
library_base/src/main/java/cn/yyxx/eyuancomm/base/ext/MetaDataExt.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/ext/MetaDataExt.kt

@@ -1,9 +1,9 @@
-package cn.yyxx.eyuancomm.base.ext
+package cn.yyxx.eyuancomm.comm.ext
 
 import android.content.Context
 import android.content.pm.PackageManager
 import android.text.TextUtils
-import cn.yyxx.eyuancomm.base.utils.Logger
+import cn.yyxx.eyuancomm.comm.utils.Logger
 
 /**
  * @author #Suyghur.

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/ext/ZipExt.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/ext/ZipExt.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.ext
+package cn.yyxx.eyuancomm.comm.ext
 
 import java.io.*
 import java.util.zip.ZipEntry

+ 4 - 12
library_base/src/main/java/cn/yyxx/eyuancomm/base/SdkDrive.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/impl/CommSdkDrive.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base
+package cn.yyxx.eyuancomm.comm.impl
 
 import android.content.Context
 
@@ -6,7 +6,7 @@ import android.content.Context
  * @author #Suyghur.
  * Created on 2021/06/09
  */
-class SdkDrive {
+class CommSdkDrive {
 
     init {
         System.loadLibrary("eyuancomm")
@@ -18,23 +18,15 @@ class SdkDrive {
 
     external fun getCommParam(key: String): String
 
-    external fun setCoreParam(key: String, value: String)
-
-    external fun getCoreParam(key: String): String
-
     external fun invokeCommJob(key: String, data: String): String
 
-    external fun invokeCoreJob(key: String, data: String): String
-
     external fun parseJob(key: String, data: String): String
 
     external fun getCommMap(): String
 
-    external fun getCoreMap(): String
-
     companion object {
-        val instance: SdkDrive by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
-            SdkDrive()
+        val instance: CommSdkDrive by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+            CommSdkDrive()
         }
     }
 }

+ 111 - 53
library_comm/src/main/java/cn/yyxx/eyuancomm/comm/impl/CommSdkImpl.kt

@@ -4,20 +4,20 @@ import android.app.Activity
 import android.app.Application
 import android.content.Context
 import android.content.Intent
-import cn.yyxx.eyuancomm.base.SdkDrive
-import cn.yyxx.eyuancomm.base.entity.Function
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.base.entity.SdkEvent
-import cn.yyxx.eyuancomm.base.entity.SdkRoleInfo
-import cn.yyxx.eyuancomm.base.internal.ICallback
-import cn.yyxx.eyuancomm.base.ui.dialog.ScaleLoadingDialog
-import cn.yyxx.eyuancomm.base.utils.Logger
-import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
+import android.text.TextUtils
+import cn.yyxx.eyuancomm.comm.entity.*
+import cn.yyxx.eyuancomm.comm.entity.Function
+import cn.yyxx.eyuancomm.comm.internal.ICallback
 import cn.yyxx.eyuancomm.comm.network.Host
 import cn.yyxx.eyuancomm.comm.network.SdkRequest
+import cn.yyxx.eyuancomm.comm.utils.Logger
+import cn.yyxx.eyuancomm.comm.utils.ParamsUtils
+import cn.yyxx.eyuancomm.comm.widget.ScaleLoadingDialog
+import cn.yyxx.support.JsonUtils
 import cn.yyxx.support.device.DeviceInfoUtils
 import cn.yyxx.support.gaid.GAIDUtils
 import cn.yyxx.support.msa.MsaDeviceIdsHandler
+import org.json.JSONObject
 import java.util.concurrent.atomic.AtomicInteger
 
 /**
@@ -32,19 +32,20 @@ class CommSdkImpl(context: Context) {
     private var hasReadDeviceId = false
     private var channelId: String = ""
 
-    private var initDialog: ScaleLoadingDialog? = null
-
+    private var initLoadingDialog: ScaleLoadingDialog? = null
+    private var payLoadingDialog: ScaleLoadingDialog? = null
 
     @Volatile
     private var timeCount = AtomicInteger(0)
 
     init {
+        channelId = ParamsUtils.getChannelId(context)
         getSdkProxyManager(context)
     }
 
     private fun getSdkProxyManager(context: Context): Any? {
         if (mSdkProxy == null) {
-            mSdkProxy = SdkProxyManager.initSdkProxyManager(context)
+            mSdkProxy = SdkProxyManager.initSdkProxyManager(context, channelId)
         }
         return mSdkProxy
     }
@@ -55,7 +56,7 @@ class CommSdkImpl(context: Context) {
     fun attachBaseContext(application: Application, context: Context) {
         Logger.initZap(application)
         Logger.i("EYuanCommSdk attachBaseContext ...")
-        SdkDrive.instance.initSdkDrive(application)
+        CommSdkDrive.instance.initSdkDrive(application)
         initGaid(application)
 
         if (mSdkProxy == null) {
@@ -73,7 +74,7 @@ class CommSdkImpl(context: Context) {
                     initOaid(application)
                 } else {
                     Logger.i("谷歌框架可以访问,请求gaid")
-                    SdkDrive.instance.setCommParam("device_id", GAIDUtils.getGoogleAdid())
+                    CommSdkDrive.instance.setCommParam("device_id", GAIDUtils.getGoogleAdid())
                     hasReadDeviceId = true
                 }
             } else {
@@ -87,10 +88,10 @@ class CommSdkImpl(context: Context) {
         MsaDeviceIdsHandler.initMsaDeviceIds(application) { code, msg, _ ->
             if (code == 0) {
                 Logger.e("获取oaid成功,使用oaid替代")
-                SdkDrive.instance.setCommParam("device_id", MsaDeviceIdsHandler.oaid)
+                CommSdkDrive.instance.setCommParam("device_id", MsaDeviceIdsHandler.oaid)
             } else {
                 Logger.d("获取oaid失败,msg: $msg,使用android id替代")
-                SdkDrive.instance.setCommParam("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
+                CommSdkDrive.instance.setCommParam("device_id", DeviceInfoUtils.getAndroidDeviceId(application))
             }
             hasReadDeviceId = true
         }
@@ -127,7 +128,7 @@ class CommSdkImpl(context: Context) {
             return
         }
 
-        showInitDialog(activity)
+        showInitLoadingDialog(activity)
 
         if (!hasReadDeviceId) {
             Logger.e("还未完成deviceId加载,将延迟初始化")
@@ -158,7 +159,7 @@ class CommSdkImpl(context: Context) {
     private fun startSdkInit(activity: Activity, isLandscape: Boolean, callback: ICallback) {
         // 先渠道后融合,因为个别渠道需要在融合初始化接口透传数据
         // 渠道Sdk初始化
-        val channelInitCallback = object : ICallback {
+        val channelCallback = object : ICallback {
             override fun onResult(code: Int, result: String) {
                 // 不管结果如何都不在这里回调cp
                 // 融合Sdk初始化
@@ -169,7 +170,7 @@ class CommSdkImpl(context: Context) {
         SdkProxyManager.call(
             Function.INITIALIZE,
             arrayOf(Activity::class.java, Boolean::class.java, ICallback::class.java),
-            arrayOf(activity, isLandscape, channelInitCallback)
+            arrayOf(activity, isLandscape, channelCallback)
         )
     }
 
@@ -177,9 +178,9 @@ class CommSdkImpl(context: Context) {
         Logger.d("融合Sdk初始化...")
         SdkRequest.instance.initSdk(activity, "") { resultInfo ->
             hasSdkInit = resultInfo.code == 1
-            initDialog?.apply {
+            initLoadingDialog?.apply {
                 dismiss()
-                initDialog = null
+                initLoadingDialog = null
             }
             if (hasSdkInit) {
                 callback.onResult(0, "Sdk初始化成功")
@@ -203,21 +204,28 @@ class CommSdkImpl(context: Context) {
             return
         }
 
-        val loginCallback = object : ICallback {
+        val channelCallback = object : ICallback {
             override fun onResult(code: Int, result: String) {
-                callback.onResult(code, result)
+                if (code == 0) {
+                    SdkRequest.instance.userVerify(activity, result) { resultInfo ->
+                        if (resultInfo.code == 1) {
+                            if (!TextUtils.isEmpty(resultInfo.data)) {
+                                val jsonObject = JSONObject(resultInfo.data)
+                                SdkLoginInfo.instance.userId = jsonObject.getString("uid")
+                                SdkLoginInfo.instance.token = jsonObject.getString("token")
+                            }
+                            callback.onResult(0, SdkLoginInfo.instance.toJsonString())
+                        } else {
+                            callback.onResult(-1, resultInfo.msg)
+                        }
+                    }
+                } else {
+                    callback.onResult(-1, result)
+                }
             }
         }
 
-        SdkProxyManager.call(
-            Function.LOGIN,
-            arrayOf(
-                Activity::
-                class.java, ICallback::
-                class.java
-            ),
-            arrayOf(activity, loginCallback)
-        )
+        SdkProxyManager.call(Function.LOGIN, arrayOf(Activity::class.java, ICallback::class.java), arrayOf(activity, channelCallback))
     }
 
     /**
@@ -242,10 +250,9 @@ class CommSdkImpl(context: Context) {
      *
      * @param activity   Activity上下文
      * @param chargeInfo 支付信息实体对象
-     * @param isIab      是否内购
      * @param callback   支付回调对象
      */
-    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: ICallback) {
+    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
         if (checkSdkProxyNull(Function.CHARGE, callback)) {
             return
         }
@@ -253,17 +260,56 @@ class CommSdkImpl(context: Context) {
             return
         }
 
-        val chargeCallback = object : ICallback {
-            override fun onResult(code: Int, result: String) {
-                callback.onResult(code, result)
-            }
+        showPayLoadingDialog(activity)
+        // 判断渠道
+        if (channelId == ChannelId.YYXX) {
+            // 特殊渠道,先调用渠道sdk生成支付扩展参数,在请求生成订单
+            // 获取拿到channel_ext
+            SdkProxyManager.call(
+                Function.GET_ORDER_EXT,
+                arrayOf(Activity::class.java, SdkChargeInfo::class.java, ICallback::class.java),
+                arrayOf(activity, chargeInfo, object : ICallback {
+                    override fun onResult(code: Int, result: String) {
+                        if (code == 0 && !TextUtils.isEmpty(result)) {
+                            chargeInfo.channelExt = result
+                            doCharge(activity, chargeInfo, callback)
+                        } else {
+                            dimissPayLoadingDialog(activity)
+                            callback.onResult(-1, result)
+                        }
+                    }
+                })
+            )
+        } else {
+            doCharge(activity, chargeInfo, callback)
         }
+    }
 
-        SdkProxyManager.call(
-            Function.CHARGE,
-            arrayOf(Activity::class.java, SdkChargeInfo::class.java, Boolean::class.java, ICallback::class.java),
-            arrayOf(activity, chargeInfo, isIab, chargeCallback)
-        )
+    private fun doCharge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
+        SdkRequest.instance.createOrder(activity, "", chargeInfo) { resultInfo ->
+            dimissPayLoadingDialog(activity)
+            if (resultInfo.code == 1 && !TextUtils.isEmpty(resultInfo.data)) {
+                val jsonObject = JSONObject(resultInfo.data)
+                chargeInfo.orderId = if (JsonUtils.hasJsonKey(jsonObject, "order_id")) {
+                    jsonObject.getString("order_id")
+                } else {
+                    ""
+                }
+                chargeInfo.channelNotifyUrl = if (JsonUtils.hasJsonKey(jsonObject, "notify_url")) {
+                    jsonObject.getString("notify_url")
+                } else {
+                    ""
+                }
+                // 调用渠道sdk支付
+                SdkProxyManager.call(
+                    Function.CHARGE,
+                    arrayOf(Activity::class.java, SdkChargeInfo::class.java, ICallback::class.java),
+                    arrayOf(activity, chargeInfo, callback)
+                )
+            } else {
+                callback.onResult(-1, resultInfo.msg)
+            }
+        }
     }
 
     /**
@@ -410,11 +456,7 @@ class CommSdkImpl(context: Context) {
             return
         }
 
-        SdkProxyManager.call(
-            Function.ON_NEW_INTENT,
-            arrayOf(Activity::class.java, Intent::class.java),
-            arrayOf(activity, intent)
-        )
+        SdkProxyManager.call(Function.ON_NEW_INTENT, arrayOf(Activity::class.java, Intent::class.java), arrayOf(activity, intent))
     }
 
     fun getCurrentUserId(): String = SdkLoginInfo.instance.userId
@@ -486,12 +528,28 @@ class CommSdkImpl(context: Context) {
         }
     }
 
-    private fun showInitDialog(context: Context) {
-        initDialog?.apply {
+    private fun showInitLoadingDialog(context: Context) {
+        initLoadingDialog?.apply {
+            dismiss()
+            initLoadingDialog = null
+        }
+        initLoadingDialog = ScaleLoadingDialog(context, "")
+        initLoadingDialog?.show()
+    }
+
+    private fun showPayLoadingDialog(context: Context) {
+        payLoadingDialog?.apply {
+            dismiss()
+            payLoadingDialog = null
+        }
+        payLoadingDialog = ScaleLoadingDialog(context, "")
+        payLoadingDialog?.show()
+    }
+
+    private fun dimissPayLoadingDialog(context: Context) {
+        payLoadingDialog?.apply {
             dismiss()
-            initDialog = null
+            payLoadingDialog = null
         }
-        initDialog = ScaleLoadingDialog(context, "")
-        initDialog?.show()
     }
 }

+ 3 - 3
library_comm/src/main/java/cn/yyxx/eyuancomm/comm/impl/SdkProxyManager.kt

@@ -12,7 +12,7 @@ object SdkProxyManager {
     var sdkProxy: Any? = null
     var clzProxy: Class<*>? = null
 
-    fun initSdkProxyManager(context: Context): Any? {
+    fun initSdkProxyManager(context: Context, channelId: String): Any? {
         if (sdkProxy != null) {
             return sdkProxy
         }
@@ -20,8 +20,8 @@ object SdkProxyManager {
         try {
             clzProxy = Class.forName("cn.yyxx.eyuancomm.impl.ImplSdkProxy")
             //获取构造函数的构造器
-            val constructor = clzProxy!!.getDeclaredConstructor(Context::class.java)
-            sdkProxy = constructor.newInstance(context)
+            val constructor = clzProxy!!.getDeclaredConstructor(Context::class.java, String::class.java)
+            sdkProxy = constructor.newInstance(context, channelId)
         } catch (e: Exception) {
             e.printStackTrace()
         }

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/internal/ICallback.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/ICallback.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.internal
+package cn.yyxx.eyuancomm.comm.internal
 
 /**
  * @author #Suyghur.

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/internal/IInitialize.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/IInitialize.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.internal
+package cn.yyxx.eyuancomm.comm.internal
 
 /**
  * @author #Suyghur.

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/internal/feature/IApplication.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/IApplication.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.internal.feature
+package cn.yyxx.eyuancomm.comm.internal.feature
 
 import android.app.Application
 import android.content.Context

+ 3 - 3
library_base/src/main/java/cn/yyxx/eyuancomm/base/internal/feature/IFeature.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/IFeature.kt

@@ -1,7 +1,7 @@
-package cn.yyxx.eyuancomm.base.internal.feature
+package cn.yyxx.eyuancomm.comm.internal.feature
 
 import android.app.Activity
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 
 /**
  * @author #Suyghur.
@@ -15,7 +15,7 @@ interface IFeature {
 
     fun logout(activity: Activity, callback: (Int, String) -> Unit)
 
-    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: (Int, String) -> Unit)
+    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit)
 
     fun hasExitView(activity: Activity): Boolean
 

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/internal/feature/ILifeCycle.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/ILifeCycle.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.internal.feature
+package cn.yyxx.eyuancomm.comm.internal.feature
 
 import android.app.Activity
 import android.content.Intent

+ 17 - 0
library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/IOrder.kt

@@ -0,0 +1,17 @@
+package cn.yyxx.eyuancomm.comm.internal.feature
+
+import android.app.Activity
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+
+/**
+ * @author #Suyghur.
+ * Created on 2022/01/17
+ */
+interface IOrder {
+
+    /**
+     * 获取订单号
+     * 不是所有渠道都需要自定义获取订单号
+     */
+    fun getOrderExt(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit)
+}

+ 2 - 2
library_base/src/main/java/cn/yyxx/eyuancomm/base/internal/feature/IRoleData.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/internal/feature/IRoleData.kt

@@ -1,7 +1,7 @@
-package cn.yyxx.eyuancomm.base.internal.feature
+package cn.yyxx.eyuancomm.comm.internal.feature
 
 import android.app.Activity
-import cn.yyxx.eyuancomm.base.entity.SdkRoleInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
 
 /**
  * @author #Suyghur.

+ 14 - 6
library_comm/src/main/java/cn/yyxx/eyuancomm/comm/network/SdkRequest.kt

@@ -1,9 +1,8 @@
 package cn.yyxx.eyuancomm.comm.network
 
 import android.content.Context
-import cn.yyxx.eyuancomm.base.entity.ResultInfo
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.base.network.VolleyRequest
+import cn.yyxx.eyuancomm.comm.entity.ResultInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
 import org.json.JSONException
 import org.json.JSONObject
 
@@ -23,14 +22,14 @@ class SdkRequest {
         val jsonObject = JSONObject()
         jsonObject.put("route_path", Host.BASIC_ROUTE_INIT_SDK)
         jsonObject.put("channel_init_ext", extObject)
-        VolleyRequest.post(context, Host.HOST, jsonObject, true, onResponse)
+        VolleyRequest.post(context, Host.HOST, jsonObject, onResponse)
     }
 
     fun userVerify(context: Context, extObject: String, onResponse: (ResultInfo) -> Unit) {
         val jsonObject = JSONObject()
         jsonObject.put("route_path", Host.BASIC_ROUTE_USER_VERIFY)
         jsonObject.put("channel_ext", extObject)
-        VolleyRequest.post(context, Host.HOST, jsonObject, true, onResponse)
+        VolleyRequest.post(context, Host.HOST, jsonObject, onResponse)
     }
 
     fun createOrder(context: Context, extObject: String, chargeInfo: SdkChargeInfo, onResponse: (ResultInfo) -> Unit) {
@@ -54,6 +53,15 @@ class SdkRequest {
         } catch (e: JSONException) {
             e.printStackTrace()
         }
-        VolleyRequest.post(context, Host.HOST, jsonObject, true, onResponse)
+        VolleyRequest.post(context, Host.HOST, jsonObject, onResponse)
+    }
+
+    fun notifyOrder(context: Context, jsonObject: JSONObject, onResponse: (ResultInfo) -> Unit) {
+        try {
+            jsonObject.put("route_path", Host.BASIC_ROUTE_NOTIFY_ORDER)
+        } catch (e: JSONException) {
+            e.printStackTrace()
+        }
+        VolleyRequest.post(context, Host.HOST, jsonObject, onResponse)
     }
 }

+ 11 - 17
library_base/src/main/java/cn/yyxx/eyuancomm/base/network/VolleyRequest.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/network/VolleyRequest.kt

@@ -1,10 +1,10 @@
-package cn.yyxx.eyuancomm.base.network
+package cn.yyxx.eyuancomm.comm.network
 
 import android.content.Context
 import android.text.TextUtils
-import cn.yyxx.eyuancomm.base.SdkDrive
-import cn.yyxx.eyuancomm.base.entity.ResultInfo
-import cn.yyxx.eyuancomm.base.utils.Logger
+import cn.yyxx.eyuancomm.comm.entity.ResultInfo
+import cn.yyxx.eyuancomm.comm.impl.CommSdkDrive
+import cn.yyxx.eyuancomm.comm.utils.Logger
 import cn.yyxx.support.FileUtils
 import cn.yyxx.support.JsonUtils
 import cn.yyxx.support.ResUtils
@@ -34,17 +34,14 @@ object VolleyRequest {
 
     private const val MAX_TIMEOUT = 10 * 1000
 
-    fun post(context: Context, host: String, jsonObject: JSONObject, isCommJob: Boolean , callback: (ResultInfo) -> Unit) {
+    fun post(context: Context, host: String, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
         try {
             val time = System.currentTimeMillis().toString()
             val randomKey = time + StrUtils.getRandomString(16)
             val rawKey = Md5Utils.encodeByMD5(randomKey)
             val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
-            val hexP = if (isCommJob) {
-                SdkDrive.instance.invokeCommJob(aesKey.substring(8, 24), jsonObject.toString())
-            } else {
-                SdkDrive.instance.invokeCoreJob(aesKey.substring(8, 24), jsonObject.toString())
-            }
+            val hexP = CommSdkDrive.instance.invokeCommJob(aesKey.substring(8, 24), jsonObject.toString())
+
             val tmp = HexUtils.hexString2Bytes(hexP)
             val p = Base64Utils.encode(tmp)
 
@@ -146,7 +143,7 @@ object VolleyRequest {
         VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
     }
 
-    fun uploadFile(context: Context, url: String, file: File, jsonObject: JSONObject, isCommJob: Boolean, callback: (ResultInfo) -> Unit) {
+    fun uploadFile(context: Context, url: String, file: File, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
         if (!file.exists()) {
             Logger.e("${file.name}不存在请检查")
             return
@@ -160,11 +157,8 @@ object VolleyRequest {
         val rawKey = Md5Utils.encodeByMD5(randomKey)
         val aesKey = Md5Utils.encodeByMD5(rawKey + StrUtils.reverseString(rawKey))
 
-        val hexP = if (isCommJob) {
-            SdkDrive.instance.invokeCommJob(aesKey.substring(8, 24), jsonObject.toString())
-        } else {
-            SdkDrive.instance.invokeCoreJob(aesKey.substring(8, 24), jsonObject.toString())
-        }
+        val hexP = CommSdkDrive.instance.invokeCommJob(aesKey.substring(8, 24), jsonObject.toString())
+
         val tmp = HexUtils.hexString2Bytes(hexP)
         val p = Base64Utils.encode(tmp)
 
@@ -211,7 +205,7 @@ object VolleyRequest {
             val base64P = getString("p")
             val tmp = Base64Utils.decode(base64P)
             val p = HexUtils.bytes2HexString(tmp)
-            return SdkDrive.instance.parseJob(aesKey.substring(8, 24), p)
+            return CommSdkDrive.instance.parseJob(aesKey.substring(8, 24), p)
         } catch (e: JSONException) {
             e.printStackTrace()
         }

+ 3 - 3
library_base/src/main/java/cn/yyxx/eyuancomm/base/utils/Logger.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/utils/Logger.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.utils
+package cn.yyxx.eyuancomm.comm.utils
 
 import android.app.Application
 import cn.yyxx.support.hawkeye.LogUtils
@@ -13,13 +13,13 @@ import com.dolin.zap.entity.Level
  */
 object Logger {
 
-    private const val TAG: String = "eyuangame_sdk"
+    private const val TAG: String = "eyuancomm_sdk"
 
     private var hasZapInit = false
 
     @JvmStatic
     fun initZap(application: Application) {
-        LogUtils.DEBUG = OwnDebugUtils.isOwnDebug(application, "yyxx_cfg.properties", "yyxx_game", "YYXX_OWN_DEBUG")
+        LogUtils.DEBUG = OwnDebugUtils.isOwnDebug(application, "yyxx_comm.properties", "yyxx_game", "YYXX_OWN_DEBUG")
         val level = if (LogUtils.DEBUG) {
             Level.DEBUG
         } else {

+ 57 - 0
library_comm/src/main/java/cn/yyxx/eyuancomm/comm/utils/ParamsUtils.kt

@@ -0,0 +1,57 @@
+package cn.yyxx.eyuancomm.comm.utils
+
+import android.content.Context
+import android.text.TextUtils
+import cn.yyxx.support.PropertiesUtils
+
+/**
+ * @author #Suyghur.
+ * Created on 2021/06/17
+ */
+object ParamsUtils {
+
+    private const val CONFIG_FILE = "yyxx_comm.properties"
+
+    private const val YYXX_COMM_GCP_CODE = "YYXX_COMM_GCP_CODE"
+    private const val YYXX_COMM_GAME_CODE = "YYXX_COMM_GAME_CODE"
+    private const val YYXX_CHANNEL_ID = "YYXX_CHANNEL_ID"
+
+    @JvmStatic
+    fun getCommGcpCode(context: Context): String {
+        try {
+            val code = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_COMM_GCP_CODE)
+            if (!TextUtils.isEmpty(code)) {
+                return code
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+        }
+        return ""
+    }
+
+    @JvmStatic
+    fun getCommGameCode(context: Context): String {
+        try {
+            val code = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_COMM_GAME_CODE)
+            if (!TextUtils.isEmpty(code)) {
+                return code
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+        }
+        return ""
+    }
+
+    @JvmStatic
+    fun getChannelId(context: Context): String {
+        try {
+            val channelId = PropertiesUtils.getValue4Properties(context, CONFIG_FILE, "yyxx_game", YYXX_CHANNEL_ID)
+            if (!TextUtils.isEmpty(channelId)) {
+                return channelId
+            }
+        } catch (e: Exception) {
+            e.printStackTrace()
+        }
+        return ""
+    }
+}

+ 1 - 1
library_base/src/main/java/cn/yyxx/eyuancomm/base/ui/dialog/ScaleLoadingDialog.kt → library_comm/src/main/java/cn/yyxx/eyuancomm/comm/widget/ScaleLoadingDialog.kt

@@ -1,4 +1,4 @@
-package cn.yyxx.eyuancomm.base.ui.dialog
+package cn.yyxx.eyuancomm.comm.widget
 
 import android.app.Dialog
 import android.content.Context

+ 1 - 2
library_impl/build.gradle

@@ -42,8 +42,7 @@ android {
 }
 
 dependencies {
-    implementation project(path: ':library_comm')
-    compileOnly project(':library_base')
+    implementation project(':library_comm')
     compileOnly project(':channel_registry:channel_oppo')
     compileOnly project(':channel_registry:channel_vivo')
     compileOnly project(':channel_registry:channel_huawei')

+ 18 - 53
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/ImplSdkProxy.kt

@@ -4,30 +4,22 @@ import android.app.Activity
 import android.app.Application
 import android.content.Context
 import android.content.Intent
-import android.text.TextUtils
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.base.entity.SdkRoleInfo
-import cn.yyxx.eyuancomm.base.internal.ICallback
-import cn.yyxx.eyuancomm.base.internal.feature.*
-import cn.yyxx.eyuancomm.base.utils.Logger
-import cn.yyxx.eyuancomm.base.utils.ParamsUtils
-import cn.yyxx.eyuancomm.comm.entity.SdkLoginInfo
-import cn.yyxx.eyuancomm.comm.network.SdkRequest
-import cn.yyxx.eyuancomm.impl.entity.ChannelId
-import org.json.JSONObject
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkRoleInfo
+import cn.yyxx.eyuancomm.comm.internal.ICallback
+import cn.yyxx.eyuancomm.comm.internal.feature.*
 
 /**
  * @author #Suyghur.
  * Created on 2022/01/17
  */
-class ImplSdkProxy(context: Context) {
+class ImplSdkProxy(context: Context, channelId: String) {
 
     private var mImpl: IFeature? = null
-    private var channelId = ""
+//    private var channelId = ""
 
     init {
         //TODO 配置文件获取渠道id
-        channelId = ParamsUtils.getChannelId(context)
         mImpl = SdkGenerator.getSdkInstance(channelId)
     }
 
@@ -51,22 +43,7 @@ class ImplSdkProxy(context: Context) {
 
     fun login(activity: Activity, callback: ICallback) {
         mImpl?.login(activity) { code, result ->
-            if (code == 0) {
-                SdkRequest.instance.userVerify(activity, result) { resultInfo ->
-                    if (resultInfo.code == 1) {
-                        if (!TextUtils.isEmpty(resultInfo.data)) {
-                            val jsonObject = JSONObject(resultInfo.data)
-                            SdkLoginInfo.instance.userId = jsonObject.getString("uid")
-                            SdkLoginInfo.instance.token = jsonObject.getString("token")
-                        }
-                        callback.onResult(0, SdkLoginInfo.instance.toJsonString())
-                    } else {
-                        callback.onResult(-1, resultInfo.msg)
-                    }
-                }
-            } else {
-                callback.onResult(-1, result)
-            }
+            callback.onResult(code, result)
         }
     }
 
@@ -76,31 +53,19 @@ class ImplSdkProxy(context: Context) {
         }
     }
 
-    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: ICallback) {
-        // 判断渠道
-        if (channelId == ChannelId.YYXX || channelId == ChannelId.HUAWEI) {
-            Logger.d("特殊渠道先生成渠道订单号")
-            if (mImpl is IOrder) {
-                (mImpl as IOrder).getOrderId(activity, chargeInfo) {
-                    mImpl?.charge(activity, chargeInfo, isIab) { code, result ->
-                        callback.onResult(code, result)
-                    }
-                }
-            } else {
-                callback.onResult(0, "获取充值信息异常")
+    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
+        mImpl?.charge(activity, chargeInfo) { code, result ->
+            callback.onResult(code, result)
+        }
+    }
+
+    fun getOrderExt(activity: Activity, chargeInfo: SdkChargeInfo, callback: ICallback) {
+        if (mImpl is IOrder) {
+            (mImpl as IOrder).getOrderExt(activity, chargeInfo) { code, result ->
+                callback.onResult(code, result)
             }
         } else {
-            SdkRequest.instance.createOrder(activity, "", chargeInfo) { resultInfo ->
-                if (TextUtils.isEmpty(resultInfo.data)) {
-                    callback.onResult(-1, "生成订单异常")
-                    return@createOrder
-                }
-                val jsonObject = JSONObject(resultInfo.data)
-                chargeInfo.orderId = jsonObject.getString("order_id")
-                mImpl?.charge(activity, chargeInfo, isIab) { code, result ->
-                    callback.onResult(code, result)
-                }
-            }
+            callback.onResult(-1, "获取订单扩展参数异常")
         }
     }
 

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

@@ -1,11 +1,11 @@
 package cn.yyxx.eyuancomm.impl
 
-import cn.yyxx.eyuancomm.base.internal.feature.IFeature
+import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
 import cn.yyxx.eyuancomm.impl.channel.ChannelSdkYYXX
 import cn.yyxx.eyuancomm.impl.channel.huawei.ChannelSdkHuawei
 import cn.yyxx.eyuancomm.impl.channel.oppo.ChannelSdkOppo
 import cn.yyxx.eyuancomm.impl.channel.vivo.ChannelSdkVivo
-import cn.yyxx.eyuancomm.impl.entity.ChannelId
+import cn.yyxx.eyuancomm.comm.entity.ChannelId
 
 /**
  * @author #Suyghur.

+ 6 - 6
library_impl/src/main/java/cn/yyxx/eyuancomm/impl/channel/ChannelSdkYYXX.kt

@@ -4,11 +4,11 @@ import android.app.Activity
 import android.app.Application
 import android.content.Context
 import android.content.Intent
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.base.internal.feature.IApplication
-import cn.yyxx.eyuancomm.base.internal.feature.IFeature
-import cn.yyxx.eyuancomm.base.internal.feature.ILifeCycle
-import cn.yyxx.eyuancomm.base.utils.Logger
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.internal.feature.IApplication
+import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
+import cn.yyxx.eyuancomm.comm.internal.feature.ILifeCycle
+import cn.yyxx.eyuancomm.comm.utils.Logger
 
 /**
  * @author #Suyghur.
@@ -36,7 +36,7 @@ class ChannelSdkYYXX : IFeature, IApplication, ILifeCycle {
         Logger.d("ChannelSdkYYXX logout")
     }
 
-    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: (Int, String) -> Unit) {
+    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
         Logger.d("ChannelSdkYYXX charge")
     }
 

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

@@ -6,14 +6,13 @@ import android.content.Context
 import android.content.Intent
 import android.os.Bundle
 import android.text.TextUtils
-import cn.yyxx.eyuancomm.base.entity.ResultInfo
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.base.internal.feature.IApplication
-import cn.yyxx.eyuancomm.base.internal.feature.IFeature
-import cn.yyxx.eyuancomm.base.internal.feature.ILifeCycle
-import cn.yyxx.eyuancomm.base.internal.feature.IOrder
-import cn.yyxx.eyuancomm.base.ui.dialog.ScaleLoadingDialog
-import cn.yyxx.eyuancomm.base.utils.Logger
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.internal.feature.IApplication
+import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
+import cn.yyxx.eyuancomm.comm.internal.feature.ILifeCycle
+import cn.yyxx.eyuancomm.comm.internal.feature.IOrder
+import cn.yyxx.eyuancomm.comm.utils.Logger
+import cn.yyxx.eyuancomm.comm.widget.ScaleLoadingDialog
 import com.huawei.agconnect.AGCRoutePolicy
 import com.huawei.agconnect.AGConnectInstance
 import com.huawei.agconnect.AGConnectOptionsBuilder
@@ -147,11 +146,18 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle,IOrder {
         callback(0, "用户登出成功")
     }
 
-    override fun getOrderId(activity: Activity?, sdkChargeInfo: SdkChargeInfo, callback: (ResultInfo) -> Unit) {
-
+    override fun getOrderExt(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
+        Logger.d("getOrderExt")
+        callback(0, "test_ext")
     }
 
-    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: (Int, String) -> Unit) {
+    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
+        Logger.d("charge")
+        HuaweiInAppPay.instance.charge(activity, chargeInfo, object : HuaweiInAppPay.InAppPayCallback {
+            override fun onResult(code: Int, result: String) {
+                callback(code, result)
+            }
+        })
     }
 
     override fun hasExitView(activity: Activity): Boolean = false
@@ -193,6 +199,7 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle,IOrder {
 
     override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
         AGConnectApi.getInstance().activityLifecycle().onActivityResult(requestCode, resultCode, data)
+        HuaweiInAppPay.instance.onActivityResult(activity, requestCode, resultCode, data)
     }
 
     override fun onNewIntent(activity: Activity, intent: Intent?) {
@@ -220,7 +227,6 @@ class ChannelSdkHuawei : IFeature, IApplication, ILifeCycle,IOrder {
         }.addOnFailureListener {
             // onFailure
             dismissLoadingDialog()
-            Logger.e(it.localizedMessage)
             loginCallback(-1, "登录失败")
         }
     }

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

@@ -0,0 +1,252 @@
+package cn.yyxx.eyuancomm.impl.channel.huawei
+
+import android.app.Activity
+import android.content.Context
+import android.content.Intent
+import android.content.IntentSender
+import cn.yyxx.eyuancomm.comm.entity.ResultInfo
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.network.SdkRequest
+import cn.yyxx.eyuancomm.comm.utils.Logger
+import cn.yyxx.eyuancomm.comm.widget.ScaleLoadingDialog
+import cn.yyxx.support.JsonUtils
+import com.huawei.hms.iap.Iap
+import com.huawei.hms.iap.IapApiException
+import com.huawei.hms.iap.entity.OrderStatusCode
+import com.huawei.hms.iap.entity.OwnedPurchasesReq
+import com.huawei.hms.iap.entity.ProductInfoReq
+import com.huawei.hms.iap.entity.PurchaseIntentReq
+import com.huawei.hms.support.api.client.Status
+import org.json.JSONObject
+
+/**
+ * @author #Suyghur.
+ * Created on 2022/02/16
+ */
+class HuaweiInAppPay {
+
+    private var loadingDialog: ScaleLoadingDialog? = null
+    private var callback: InAppPayCallback? = null
+
+    companion object {
+        val instance: HuaweiInAppPay by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+            HuaweiInAppPay()
+        }
+    }
+
+    fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: InAppPayCallback) {
+        showLoadingDialog(activity)
+        this.callback = callback
+        Iap.getIapClient(activity).isEnvReady.addOnSuccessListener {
+            // 获取接口请求的结果
+//            obtainProductInfo(activity, chargeInfo, callback)
+            obtainOwnedPurchases(activity, chargeInfo)
+        }.addOnFailureListener { e ->
+            dismissLoadingDialog()
+            if (e is IapApiException) {
+                val status: Status = e.status
+                when (status.statusCode) {
+                    OrderStatusCode.ORDER_HWID_NOT_LOGIN -> {
+                        // 未登录帐号
+                        Logger.e("未登录帐号")
+                        if (status.hasResolution()) {
+                            try {
+                                // 6666是您自定义的常量
+                                // 启动IAP返回的登录页面
+                                status.startResolutionForResult(activity, 6666)
+                            } catch (exp: IntentSender.SendIntentException) {
+                            }
+                        }
+                    }
+                    OrderStatusCode.ORDER_ACCOUNT_AREA_NOT_SUPPORTED -> {
+                        // 用户当前登录的华为帐号所在的服务地不在华为IAP支持结算的国家/地区中
+                        Logger.e("用户当前登录的华为帐号所在的服务地不在华为IAP支持结算的国家/地区中")
+                    }
+                    else -> {
+                        // 其他外部错误
+                        Logger.e("其他外部错误")
+                    }
+                }
+            } else {
+                // 其他外部错误
+                Logger.e("其他外部错误")
+            }
+        }
+    }
+
+    /**
+     * 查询未消耗的阻塞订单
+     */
+    private fun obtainOwnedPurchases(activity: Activity, chargeInfo: SdkChargeInfo) {
+        // 构造一个OwnedPurchasesReq对象
+        val ownedPurchasesReq = OwnedPurchasesReq()
+        // priceType: 0:消耗型商品; 1:非消耗型商品; 2:订阅型商品
+        ownedPurchasesReq.priceType = 0
+        // 调用obtainOwnedPurchases接口获取所有已购但未发货的消耗型商品的购买信息
+        Iap.getIapClient(activity).obtainOwnedPurchases(ownedPurchasesReq).addOnSuccessListener { result ->
+            // 获取接口请求成功的结果
+            if (result.inAppPurchaseDataList.isNullOrEmpty()) {
+                obtainProductInfo(activity, chargeInfo)
+            } else {
+                // 永远保持只有一笔未消耗订单
+                val purchaseData = result.inAppPurchaseDataList[0]
+                val signature = result.inAppSignature[0]
+                notifyOrder2Backend(activity, purchaseData, signature) { resultInfo ->
+                    dismissLoadingDialog()
+                    if (resultInfo.code == 1) {
+                        // 重新消耗成功,继续发起支付
+                        obtainProductInfo(activity, chargeInfo)
+                    } else {
+                        // 消耗失败
+                        callback?.onResult(-1, "obtainOwnedPurchases: 支付发生异常")
+                    }
+                }
+            }
+        }.addOnFailureListener { e ->
+            dismissLoadingDialog()
+            callback?.onResult(-1, "obtainOwnedPurchases: 支付发生异常")
+            if (e is IapApiException) {
+                val apiException = e as IapApiException
+                val status: Status = apiException.status
+                val returnCode = apiException.statusCode
+            } else {
+                // 其他外部错误
+            }
+        }
+    }
+
+    private fun obtainProductInfo(activity: Activity, chargeInfo: SdkChargeInfo) {
+        val productIdList: MutableList<String> = ArrayList()
+        // 查询的商品必须是您在AppGallery Connect网站配置的商品
+        productIdList.add(chargeInfo.productId)
+        val req = ProductInfoReq()
+        // priceType: 0:消耗型商品; 1:非消耗型商品; 2:订阅型商品
+        req.priceType = 0
+        req.productIds = productIdList
+        // 获取调用接口的Activity对象
+        // 调用obtainProductInfo接口获取AppGallery Connect网站配置的商品的详情信息
+        Iap.getIapClient(activity).obtainProductInfo(req).addOnSuccessListener {
+            // 获取接口请求成功时返回的商品详情信息
+            createPurchaseIntent(activity, chargeInfo)
+        }.addOnFailureListener { e ->
+            dismissLoadingDialog()
+            Logger.e(e.localizedMessage)
+            callback?.onResult(-1, "obtainProductInfo: 支付发生异常")
+            if (e is IapApiException) {
+                val apiException = e as IapApiException
+                val returnCode = apiException.statusCode
+            } else {
+                // 其他外部错误
+            }
+        }
+    }
+
+    private fun createPurchaseIntent(activity: Activity, chargeInfo: SdkChargeInfo) {
+        // 构造一个PurchaseIntentReq对象
+        val req = PurchaseIntentReq()
+        // 通过createPurchaseIntent接口购买的商品必须是您在AppGallery Connect网站配置的商品。
+        req.productId = chargeInfo.productId
+        // priceType: 0:消耗型商品; 1:非消耗型商品; 2:订阅型商品
+        req.priceType = 0
+        req.developerPayload = chargeInfo.orderId
+        // 获取调用接口的Activity对象
+        // 调用createPurchaseIntent接口创建托管商品订单
+        Iap.getIapClient(activity).createPurchaseIntent(req).addOnSuccessListener { result ->
+            // 获取创建订单的结果
+            if (result.status.hasResolution()) {
+                try {
+                    // 启动IAP返回的收银台页面
+                    result.status.startResolutionForResult(activity, 8888)
+                } catch (exp: IntentSender.SendIntentException) {
+                    callback?.onResult(-1, "支付发生异常")
+                }
+            } else {
+                callback?.onResult(-1, "支付发生异常")
+            }
+        }.addOnFailureListener { e ->
+            dismissLoadingDialog()
+            Logger.d(e.localizedMessage)
+            callback?.onResult(-1, "createPurchaseIntent: 支付发生异常")
+            if (e is IapApiException) {
+                val apiException = e as IapApiException
+                val status: Status = apiException.status
+                val returnCode = apiException.statusCode
+            } else {
+                // 其他外部错误
+            }
+        }
+    }
+
+    private fun notifyOrder2Backend(activity: Activity, purchaseData: String, signature: String, onResponse: (ResultInfo) -> Unit) {
+        val jsonObject = JSONObject()
+        with(JSONObject(purchaseData)) {
+            if (JsonUtils.hasJsonKey(this, "developerPayload")) {
+                jsonObject.put("order_id", getString("developerPayload"))
+            } else {
+                jsonObject.put("order_id", "")
+            }
+            val notifyData = JSONObject()
+            notifyData.put("purchase_data", purchaseData)
+            notifyData.put("signature", signature)
+            jsonObject.put("order_notify_data", notifyData.toString())
+        }
+        SdkRequest.instance.notifyOrder(activity, jsonObject, onResponse)
+    }
+
+    fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
+        if (requestCode == 6666) {
+            // 判断环境支付环境
+        } else if (requestCode == 8888) {
+            if (data != null) {
+                // 调用parsePurchaseResultInfoFromIntent方法解析支付结果数据
+                val purchaseResultInfo = Iap.getIapClient(activity).parsePurchaseResultInfoFromIntent(data)
+                when (purchaseResultInfo.returnCode) {
+                    OrderStatusCode.ORDER_STATE_CANCEL -> {
+                    }
+                    OrderStatusCode.ORDER_STATE_FAILED, OrderStatusCode.ORDER_PRODUCT_OWNED, OrderStatusCode.ORDER_STATE_DEFAULT_CODE -> {
+                    }
+                    OrderStatusCode.ORDER_STATE_SUCCESS -> {
+                        // 支付成功
+                        with(purchaseResultInfo) {
+                            // consumeOwnedPurchase(activity, inAppPurchaseData, inAppDataSignature)
+                            // 通知服务端支付流程完成,验证订单并确认交易
+                            notifyOrder2Backend(activity, inAppPurchaseData, inAppDataSignature) { resultInfo ->
+                                dismissLoadingDialog()
+                                if (resultInfo.code == 1) {
+                                    callback?.onResult(0, "支付流程完成")
+                                } else {
+                                    callback?.onResult(-1, "支付发生异常")
+                                }
+                            }
+                        }
+                    }
+                    else -> {
+                        callback?.onResult(-1, "支付发生异常")
+                    }
+                }
+            }
+        }
+    }
+
+    private fun showLoadingDialog(context: Context) {
+        loadingDialog?.apply {
+            dismiss()
+            loadingDialog = null
+        }
+        loadingDialog = ScaleLoadingDialog(context, "")
+        loadingDialog?.show()
+    }
+
+    private fun dismissLoadingDialog() {
+        loadingDialog?.apply {
+            dismiss()
+            loadingDialog = null
+        }
+    }
+
+
+
+    interface InAppPayCallback {
+        fun onResult(code: Int, result: String)
+    }
+}

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

@@ -38,13 +38,6 @@ class HuaweiLoginDialog(context: Context) : Dialog(context) {
         ivHw = view.findViewById(ResUtils.getResId(context, "yyxx_iv_hw", "id"))
         ivGoogle = view.findViewById(ResUtils.getResId(context, "yyxx_iv_google", "id"))
         ivFacebook = view.findViewById(ResUtils.getResId(context, "yyxx_iv_facebook", "id"))
-
-//        setOnKeyListener(this)
     }
-
-
-//    override fun onKey(dialog: DialogInterface?, keyCode: Int, event: KeyEvent): Boolean {
-//        return keyCode == KeyEvent.KEYCODE_BACK && event.repeatCount == 0
-//    }
 }
 

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

@@ -4,11 +4,11 @@ import android.app.Activity
 import android.app.Application
 import android.content.Context
 import android.text.TextUtils
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.base.ext.getMetaDataValue
-import cn.yyxx.eyuancomm.base.internal.feature.IApplication
-import cn.yyxx.eyuancomm.base.internal.feature.IFeature
-import cn.yyxx.eyuancomm.base.utils.Logger
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.ext.getMetaDataValue
+import cn.yyxx.eyuancomm.comm.internal.feature.IApplication
+import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
+import cn.yyxx.eyuancomm.comm.utils.Logger
 import com.nearme.game.sdk.GameCenterSDK
 import com.nearme.game.sdk.callback.ApiCallback
 import com.nearme.game.sdk.common.model.biz.PayInfo
@@ -99,17 +99,18 @@ class ChannelSdkOppo : IFeature, IApplication {
         callback(0, "用户登出成功")
     }
 
-    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: (Int, String) -> Unit) {
-        with(PayInfo(chargeInfo.orderId, "callback_info", chargeInfo.amount)) {
+    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
+        with(PayInfo(chargeInfo.orderId, "callback_info_${chargeInfo.orderId}", chargeInfo.amount)) {
             productDesc = chargeInfo.productDesc
             productName = chargeInfo.productName
             type = PayInfo.TYPE_NOARMAL_PAY
             currency = "USD"
-            callbackUrl = "http://xxxx"
+            callbackUrl = chargeInfo.channelNotifyUrl
             GameCenterSDK.getInstance().doPay(activity, this, object : ApiCallback {
                 override fun onSuccess(result: String) {
                     // 客户端Sdk支付成功
-                    Logger.d("aaaaa")
+                    Logger.d(result)
+                    callback(0, "oppo支付成功,msg:$result")
                 }
 
                 override fun onFailure(result: String, code: Int) {

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

@@ -3,9 +3,9 @@ package cn.yyxx.eyuancomm.impl.channel.vivo
 import android.app.Activity
 import android.app.Application
 import android.content.Context
-import cn.yyxx.eyuancomm.base.entity.SdkChargeInfo
-import cn.yyxx.eyuancomm.base.internal.feature.IApplication
-import cn.yyxx.eyuancomm.base.internal.feature.IFeature
+import cn.yyxx.eyuancomm.comm.entity.SdkChargeInfo
+import cn.yyxx.eyuancomm.comm.internal.feature.IApplication
+import cn.yyxx.eyuancomm.comm.internal.feature.IFeature
 import com.vivo.unionpay.sdk.open.VivoConstants
 import com.vivo.unionpay.sdk.open.VivoPayInfo
 import com.vivo.unionpay.sdk.open.VivoRoleInfo
@@ -48,7 +48,7 @@ class ChannelSdkVivo : IFeature, IApplication {
     override fun logout(activity: Activity, callback: (Int, String) -> Unit) {
     }
 
-    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, isIab: Boolean, callback: (Int, String) -> Unit) {
+    override fun charge(activity: Activity, chargeInfo: SdkChargeInfo, callback: (Int, String) -> Unit) {
         val params = HashMap<String, String>()
         val roleInfo = VivoRoleInfo()
         val payInfo = VivoPayInfo.Builder()

+ 1 - 1
settings.gradle

@@ -1,6 +1,6 @@
 rootProject.name = "EYuanCommSdk-KTX"
 include ':demo'
-include ':library_base'
+//include ':library_base'
 include ':library_comm'
 include ':library_impl'
 //include ':core:library_core'