Commit ba310efb by 刘鹏

feat: 新域名配置flutter升级

parent 73336195
......@@ -21,7 +21,7 @@ public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = "new_test";//配置未上传到maven库
public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
// public static String appEnv = YDLConstants.ENV_PROD;
@Override
......
......@@ -12,11 +12,11 @@ ext {
"m-home" : "0.0.22.60",
"m-im" : "0.0.18.53",
"m-dynamic" : "0.0.7.21",
"m-article" : "0.0.0.8",
"m-article" : "0.0.0.9",
"m-muse" : "0.0.28.22",
"m-tests" : "0.0.24.12",
"m-course" : "0.0.42.23",
"m-muse" : "0.0.28.23",
"m-tests" : "0.0.24.13",
"m-course" : "0.0.42.24",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
......@@ -33,14 +33,14 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.40.02",
"ydl-platform" : "0.0.40.03",
//第二步 若干
"ydl-webview" : "0.0.38.44",
"ydl-media" : "0.0.21.9",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.37",
"ydl-flutter-base": "0.0.14.25",
"ydl-flutter-base": "0.0.14.26",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -95,11 +95,11 @@ ext {
"m-home" : "0.0.22.54",
"m-im" : "0.0.18.53",
"m-dynamic" : "0.0.7.19",
"m-article" : "0.0.0.6",
"m-article" : "0.0.0.9",
"m-muse" : "0.0.20.7",
"m-tests" : "0.0.24.9",
"m-course" : "0.0.42.20",
"m-muse" : "0.0.28.23",
"m-tests" : "0.0.24.13",
"m-course" : "0.0.42.24",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.1",
......@@ -115,14 +115,14 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.40.02",
"ydl-platform" : "0.0.40.03",
//第二步 若干
"ydl-webview" : "0.0.38.44",
"ydl-media" : "0.0.21.9",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.37",
"ydl-flutter-base": "0.0.14.25",
"ydl-flutter-base": "0.0.14.26",
//以下 几乎不会动
"router" : "0.0.1",
......
......@@ -16,6 +16,7 @@ import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.ModularServiceManager.provide
......@@ -71,10 +72,19 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
override fun onMethodCall(methodCall: MethodCall, result: MethodChannel.Result) {
when (methodCall.method) {
GETPUBLICPARAMAS -> {
val appEnv = BaseApp.instance.getGlobalConfig().appEnv
var isDevelopment = 0
if (YDLConstants.ENV_TEST == appEnv) {
isDevelopment = 1
} else if (YDLConstants.ENV_NEW_TEST == appEnv) {
isDevelopment = 2
}
val loginBean = ModularServiceManager.getPlatformUserService()?.getUser()
val mMap = mutableMapOf<String, Any>()
var uid = loginBean?.userId ?: ""
mMap["isDevelopment"] = false
mMap["isDevelopment"] = isDevelopment
mMap["uid"] = if (TextUtils.isEmpty(uid)) "0" else uid
mMap["accessToken"] = loginBean?.token ?: ""
?: ""
......
......@@ -44,7 +44,7 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
}
companion object {
var pluginDelegate:CommonPluginDelegate?=null
var pluginDelegate: CommonPluginDelegate? = null
const val CHANNEL: String = "lib/common/channel"
const val GETPUBLICPARAMAS: String = "getPublicParamas"
const val GET_PACKAGE_AND_FFROM: String = "get_package_and_ffrom" // 获取包名和渠道名,中间用,分割
......@@ -81,13 +81,24 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
val appEnv = BaseApp.instance.getGlobalConfig().appEnv
val cacheAppEnv = YDLCacheUtils.getCacheApi()
var isDevelopment: Boolean = false
var isDevelopment = 0
if (!TextUtils.isEmpty(cacheAppEnv)) {
isDevelopment = YDLConstants.ENV_TEST == cacheAppEnv
if (YDLConstants.ENV_TEST == cacheAppEnv || YDLConstants.ENV_AUTO_TEST == cacheAppEnv) {
isDevelopment = 1
} else if (YDLConstants.ENV_NEW_TEST == cacheAppEnv) {
isDevelopment = 2
}
} else {
isDevelopment = YDLConstants.ENV_TEST == appEnv || YDLConstants.ENV_AUTO_TEST == appEnv
if (YDLConstants.ENV_TEST == cacheAppEnv || YDLConstants.ENV_AUTO_TEST == appEnv) {
isDevelopment = 1
} else if (YDLConstants.ENV_NEW_TEST == cacheAppEnv) {
isDevelopment = 2
}
}
mMap["isDevelopment"] = if(isDevelopment) "1" else "0"
mMap["isDevelopment"] = isDevelopment
mMap["uid"] = if (TextUtils.isEmpty(uid)) "0" else uid
mMap["accessToken"] = loginBean?.token ?: ""
......@@ -114,8 +125,8 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
field.isAccessible = true
val property = field.get(ownerClass)
if (property is Boolean && property) {
var activity: Activity?= mActivity
if (mActivity==null&&mFragment!=null){
var activity: Activity? = mActivity
if (mActivity == null && mFragment != null) {
activity = mFragment?.activity!!
}
activity?.let {
......@@ -143,27 +154,27 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
}
ACTION_ORIGIN_THEME -> {
val mMap = mutableMapOf<String, String>()
if (pluginDelegate!=null){
if (pluginDelegate != null) {
val appTheme = pluginDelegate?.getAppTheme()
appTheme?.let { mMap.putAll(it) }
}
LogUtil.i("platform_origin_theme:"+GsonProvider.getGson().toJson(mMap))
LogUtil.i("platform_origin_theme:" + GsonProvider.getGson().toJson(mMap))
result.success(mMap)
}
ACTION_GET_SUB_CHANNEL_THEME -> {
val mMap = arrayListOf<Any>()
if (pluginDelegate!=null){
if (methodCall.hasArgument("channelName")){
val channelName = methodCall.argument<String>("channelName")
if (pluginDelegate != null) {
if (methodCall.hasArgument("channelName")) {
val channelName = methodCall.argument<String>("channelName")
LogUtil.i("platform_sub_channel_theme channelName:$channelName")
if (!TextUtils.isEmpty(channelName)){
if (!TextUtils.isEmpty(channelName)) {
val appTheme = pluginDelegate?.getSubChannelTheme(channelName!!)
appTheme?.let { mMap.addAll(it) }
}
}
}
LogUtil.i("platform_sub_channel_theme:"+GsonProvider.getGson().toJson(mMap))
LogUtil.i("platform_sub_channel_theme:" + GsonProvider.getGson().toJson(mMap))
result.success(mMap)
}
REQUESTMAINSCROLLFOCUS -> {
......@@ -185,24 +196,24 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
val ffrom = PlatformDataManager.getRam().getChannelName()
result.success("$packageName,$ffrom")
}
ACTION_HTTP_BURIED_POINT ->{
ACTION_HTTP_BURIED_POINT -> {
val map = methodCall.arguments as HashMap<*, *>
val position = map["position"] as String
val partId = map["partId"] as String
val sign = map["sign"] as String
ActionCountUtils.count("$partId|$position",sign)
ActionCountUtils.count("$partId|$position", sign)
}
PAGE_GO_BACK ->{
PAGE_GO_BACK -> {
mActivity?.finish()
}
}
}
interface CommonPluginDelegate{
fun getAppTheme():HashMap<String,String>
interface CommonPluginDelegate {
fun getAppTheme(): HashMap<String, String>
fun getSubChannelTheme(channelName:String):ArrayList<Any>
fun getSubChannelTheme(channelName: String): ArrayList<Any>
}
}
\ No newline at end of file
......@@ -2,14 +2,11 @@ package com.ydl.ydlcommon.utils
import android.app.ActivityManager
import android.content.Context
import com.ydl.ydlcommon.BuildConfig
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.base.config.YDLConstants.ENV_NEW_TEST
import com.ydl.ydlcommon.base.config.YDLConstants.ENV_TEST
import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.data.http.YdlCommonApi
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonOut
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool
......@@ -23,8 +20,10 @@ object AppUtils {
return false
}
var isRunning: Boolean = false
val activityManager: ActivityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val serviceList: List<ActivityManager.RunningServiceInfo> = activityManager.getRunningServices(30)
val activityManager: ActivityManager =
context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val serviceList: List<ActivityManager.RunningServiceInfo> =
activityManager.getRunningServices(30)
if (serviceList.isEmpty()) {
return false
}
......@@ -41,20 +40,28 @@ object AppUtils {
* 获取http请求公用参数
*
*/
fun getHttpCommonParams():Map<String,Any>{
fun getHttpCommonParams(): Map<String, Any> {
val mMap = mutableMapOf<String, Any>()
val appEnv = BaseApp.instance.getGlobalConfig().appEnv
val isTest = ENV_TEST == appEnv
var isDevelopment = 0
val osBuild = "${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()},${RxAppTool.getAppVersionName(
BaseApp.getApp()
)}"
if (ENV_TEST == appEnv) {
isDevelopment = 1
} else if (ENV_NEW_TEST == appEnv) {
isDevelopment = 2
}
val osBuild = "${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()},${
RxAppTool.getAppVersionName(
BaseApp.getApp()
)
}"
val loginBean = ModularServiceManager.getPlatformUserService()?.getUser()
mMap["isDevelopment"] = isTest
mMap["uid"] = loginBean?.userId?:""
mMap["accessToken"] = loginBean?.token?:""
mMap["isDevelopment"] = isDevelopment
mMap["uid"] = loginBean?.userId ?: ""
mMap["accessToken"] = loginBean?.token ?: ""
mMap["isFromApp"] = "1"
mMap["version"] = RxAppTool.getAppVersionName(BaseApp.getApp())
mMap["osBuild"] = osBuild
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment