Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@@ -12,8 +12,9 @@
|
|||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
<option value="$PROJECT_DIR$/foudations" />
|
<option value="$PROJECT_DIR$/foudations" />
|
||||||
|
<option value="$PROJECT_DIR$/foudations/mogo-base-services-apk" />
|
||||||
|
<option value="$PROJECT_DIR$/foudations/mogo-base-services-sdk" />
|
||||||
<option value="$PROJECT_DIR$/foudations/mogo-commons" />
|
<option value="$PROJECT_DIR$/foudations/mogo-commons" />
|
||||||
<option value="$PROJECT_DIR$/foudations/mogo-connection" />
|
|
||||||
<option value="$PROJECT_DIR$/foudations/mogo-utils" />
|
<option value="$PROJECT_DIR$/foudations/mogo-utils" />
|
||||||
<option value="$PROJECT_DIR$/libraries" />
|
<option value="$PROJECT_DIR$/libraries" />
|
||||||
<option value="$PROJECT_DIR$/libraries/map-amap" />
|
<option value="$PROJECT_DIR$/libraries/map-amap" />
|
||||||
|
|||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -4,7 +4,7 @@
|
|||||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||||
<groovy codeStyle="LEGACY" />
|
<groovy codeStyle="LEGACY" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -320,6 +320,8 @@ dependencies {
|
|||||||
f8xxImplementation project(':modules:mogo-module-left-panel-noop')
|
f8xxImplementation project(':modules:mogo-module-left-panel-noop')
|
||||||
em3Implementation project(':modules:mogo-module-left-panel-noop')
|
em3Implementation project(':modules:mogo-module-left-panel-noop')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply from: "./functions/baseservices.gradle"
|
||||||
}
|
}
|
||||||
|
|
||||||
//android.applicationVariants.all { variant ->
|
//android.applicationVariants.all { variant ->
|
||||||
|
|||||||
1
app/functions/README.md
Normal file
1
app/functions/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# 不同渠道,依赖的实现不一样,需要各个渠道都去依赖各自需要的实现,渠道太多导致build.gradle 文件臃肿,可以通过分gradle文件方式减少臃肿
|
||||||
26
app/functions/baseservices.gradle
Normal file
26
app/functions/baseservices.gradle
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 基础服务:仅比亚迪渠道用sdk方式实现,其他都基于apk基础服务
|
||||||
|
|
||||||
|
project.dependencies {
|
||||||
|
if (Boolean.valueOf(RELEASE)) {
|
||||||
|
bydImplementation rootProject.ext.dependencies.mogobaseservicesdk
|
||||||
|
|
||||||
|
d82xImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||||
|
em1Implementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||||
|
d8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||||
|
em4Implementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||||
|
e8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||||
|
e8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||||
|
f8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||||
|
em3Implementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||||
|
} else {
|
||||||
|
bydImplementation project(':foudations:mogo-base-services-sdk')
|
||||||
|
|
||||||
|
d82xImplementation project(':foudations:mogo-base-services-apk')
|
||||||
|
em1Implementation project(':foudations:mogo-base-services-apk')
|
||||||
|
d8xxImplementation project(':foudations:mogo-base-services-apk')
|
||||||
|
em4Implementation project(':foudations:mogo-base-services-apk')
|
||||||
|
e8xxImplementation project(':foudations:mogo-base-services-apk')
|
||||||
|
f8xxImplementation project(':foudations:mogo-base-services-apk')
|
||||||
|
em3Implementation project(':foudations:mogo-base-services-apk')
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ import com.auto.zhidao.logsdk.CrashSystem;
|
|||||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||||
import com.mogo.commons.AbsMogoApplication;
|
import com.mogo.commons.AbsMogoApplication;
|
||||||
import com.mogo.commons.debug.DebugConfig;
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
|
import com.mogo.map.location.IMogoLocationListener;
|
||||||
|
import com.mogo.map.location.MogoLocation;
|
||||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||||
import com.mogo.module.carchatting.card.CallChatConstant;
|
import com.mogo.module.carchatting.card.CallChatConstant;
|
||||||
import com.mogo.module.common.MogoModule;
|
import com.mogo.module.common.MogoModule;
|
||||||
@@ -19,8 +21,12 @@ import com.mogo.module.push.base.PushUIConstants;
|
|||||||
import com.mogo.module.service.ServiceConst;
|
import com.mogo.module.service.ServiceConst;
|
||||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||||
import com.mogo.module.v2x.V2XConst;
|
import com.mogo.module.v2x.V2XConst;
|
||||||
|
import com.mogo.service.IMogoServiceApis;
|
||||||
import com.mogo.service.MogoServicePaths;
|
import com.mogo.service.MogoServicePaths;
|
||||||
import com.mogo.service.connection.IMogoSocketManager;
|
import com.mogo.service.connection.IMogoSocketManager;
|
||||||
|
import com.mogo.service.passport.IMogoPassportManager;
|
||||||
|
import com.mogo.service.passport.IMogoTicketCallback;
|
||||||
|
import com.mogo.utils.UiThreadHandler;
|
||||||
import com.mogo.utils.logger.LogLevel;
|
import com.mogo.utils.logger.LogLevel;
|
||||||
import com.mogo.utils.logger.Logger;
|
import com.mogo.utils.logger.Logger;
|
||||||
import com.zhidao.boot.persistent.lib.PersistentManager;
|
import com.zhidao.boot.persistent.lib.PersistentManager;
|
||||||
@@ -43,66 +49,79 @@ public class MogoApplication extends AbsMogoApplication {
|
|||||||
super.onCreate();
|
super.onCreate();
|
||||||
// Crash 日志收集
|
// Crash 日志收集
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
CrashSystem crashSystem = CrashSystem.getInstance(this);
|
CrashSystem crashSystem = CrashSystem.getInstance( this );
|
||||||
crashSystem.init();
|
crashSystem.init();
|
||||||
//设置debug模式,日志不上传
|
//设置debug模式,日志不上传
|
||||||
crashSystem.setDebug(BuildConfig.DEBUG);
|
crashSystem.setDebug( BuildConfig.DEBUG );
|
||||||
Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF);
|
Logger.init( BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF );
|
||||||
|
|
||||||
// MogoModulePaths.addModule(new MogoModule(PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME));
|
// MogoModulePaths.addModule(new MogoModule(PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME));
|
||||||
MogoModulePaths.addModule(new MogoModule(AuthorizeConstant.PATH_AGREEMENT_FRAGMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME));
|
MogoModulePaths.addModule( new MogoModule( AuthorizeConstant.PATH_AGREEMENT_FRAGMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
|
||||||
|
|
||||||
//运营位卡片,需要默认显示,放在第一个加载
|
//运营位卡片,需要默认显示,放在第一个加载
|
||||||
if (DebugConfig.isLauncher()) {
|
if ( DebugConfig.isLauncher() ) {
|
||||||
MogoModulePaths.addModule(new MogoModule(MediaConstants.TAG, MediaConstants.MODULE_TYPE));
|
MogoModulePaths.addModule( new MogoModule( MediaConstants.TAG, MediaConstants.MODULE_TYPE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
|
||||||
MogoModulePaths.addModule(new MogoModule(TanluConstants.TAG, TanluConstants.MODEL_NAME));
|
MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) );
|
||||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_SHARE, "ShareControl"));
|
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) );
|
||||||
|
|
||||||
MogoModulePaths.addModule(new MogoModule(EventPanelConstants.PATH_NAME,
|
MogoModulePaths.addModule( new MogoModule( EventPanelConstants.PATH_NAME,
|
||||||
EventPanelConstants.MODULE_NAME));
|
EventPanelConstants.MODULE_NAME ) );
|
||||||
MogoModulePaths.addModule(new MogoModule(LeftPanelConst.PATH_NAME,
|
MogoModulePaths.addModule( new MogoModule( LeftPanelConst.PATH_NAME,
|
||||||
LeftPanelConst.MODULE_NAME));
|
LeftPanelConst.MODULE_NAME ) );
|
||||||
|
|
||||||
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||||
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
|
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
|
||||||
MogoModulePaths.addModule(new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME));
|
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
|
||||||
|
|
||||||
if (!DebugConfig.isLauncher()) {
|
if ( !DebugConfig.isLauncher() ) {
|
||||||
PersistentManager.getInstance().initManager(this);
|
PersistentManager.getInstance().initManager( this );
|
||||||
Intent intent = new Intent(this, MogoMainService.class);
|
Intent intent = new Intent( this, MogoMainService.class );
|
||||||
startService(intent);
|
startService( intent );
|
||||||
}
|
}
|
||||||
Log.i("timer", "cost " + (System.currentTimeMillis() - start) + "ms");
|
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDebugConfig(){
|
private void initDebugConfig() {
|
||||||
DebugConfig.setNetMode(BuildConfig.NET_ENV);
|
DebugConfig.setNetMode( BuildConfig.NET_ENV );
|
||||||
DebugConfig.setDebug(BuildConfig.DEBUG);
|
DebugConfig.setDebug( BuildConfig.DEBUG );
|
||||||
DebugConfig.setAIType(BuildConfig.AIType);
|
DebugConfig.setAIType( BuildConfig.AIType );
|
||||||
DebugConfig.setLaunchLocationService(BuildConfig.LAUNCH_LOCATION_SERVICE);
|
DebugConfig.setLaunchLocationService( BuildConfig.LAUNCH_LOCATION_SERVICE );
|
||||||
DebugConfig.setUseCustomNavi(BuildConfig.USE_CUSTOM_NAVI);
|
DebugConfig.setUseCustomNavi( BuildConfig.USE_CUSTOM_NAVI );
|
||||||
DebugConfig.setLauncher(BuildConfig.IS_LAUNCHER);
|
DebugConfig.setLauncher( BuildConfig.IS_LAUNCHER );
|
||||||
DebugConfig.setActiveAIAssistFlag( BuildConfig.AI_ASSIST_ACTIVE_STAUTS );
|
DebugConfig.setActiveAIAssistFlag( BuildConfig.AI_ASSIST_ACTIVE_STAUTS );
|
||||||
DebugConfig.setCarMachineType(BuildConfig.CAR_MACHINE_TYPE);
|
DebugConfig.setCarMachineType( BuildConfig.CAR_MACHINE_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
IMogoSocketManager mMogoSocketManager = ARouter.getInstance().navigation(IMogoSocketManager.class);
|
UiThreadHandler.postDelayed( () -> {
|
||||||
if (mMogoSocketManager != null) {
|
final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||||
mMogoSocketManager.init(getApplicationContext(), "com.mogo.launcher");
|
apis.getSocketManagerApi( getApplicationContext() ).init( getApplicationContext(), "com.mogo.launcher" );
|
||||||
} else {
|
apis.getPassportManagerApi().requestTicket( new IMogoTicketCallback() {
|
||||||
Logger.e(TAG, "init socket server error.");
|
@Override
|
||||||
}
|
public void onSuccess( String ticket ) {
|
||||||
|
Logger.d( TAG, "ticket = %s", ticket );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError( int code, String msg ) {
|
||||||
|
Logger.w( TAG, "code = %s, msg = %s", code, msg );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
apis.getLocationInfoApi().start();
|
||||||
|
apis.getMapServiceApi().getSingletonLocationClient( getApplicationContext() ).addLocationListener( location -> {
|
||||||
|
apis.getLocationInfoApi().provideLocation( location );
|
||||||
|
} );
|
||||||
|
}, 2_000L );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context base) {
|
protected void attachBaseContext( Context base ) {
|
||||||
super.attachBaseContext(base);
|
super.attachBaseContext( base );
|
||||||
BoostMultiDex.install(base);
|
BoostMultiDex.install( base );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ ext {
|
|||||||
android = [
|
android = [
|
||||||
// applicationId : "com.mogo.launcher",
|
// applicationId : "com.mogo.launcher",
|
||||||
// zhidadoApplicationId: "com.zhidao.launcher",
|
// zhidadoApplicationId: "com.zhidao.launcher",
|
||||||
launcherApplicationId : "com.mogo.launcher",
|
launcherApplicationId : "com.mogo.launcher",
|
||||||
independentApplicationId: "com.mogo.launcher.app",
|
independentApplicationId: "com.mogo.launcher.app",
|
||||||
compileSdkVersion : 28,
|
compileSdkVersion : 28,
|
||||||
buildToolsVersion : "29.0.2",
|
buildToolsVersion : "29.0.2",
|
||||||
minSdkVersion : 19,
|
minSdkVersion : 19,
|
||||||
targetSdkVersion : 22,
|
targetSdkVersion : 22,
|
||||||
]
|
]
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@@ -172,5 +172,9 @@ ext {
|
|||||||
moduleleftpanelnoop : "com.mogo.module:module-left-panel-noop:${MOGO_MODULE_LEFT_PANEL_VERSION}",
|
moduleleftpanelnoop : "com.mogo.module:module-left-panel-noop:${MOGO_MODULE_LEFT_PANEL_VERSION}",
|
||||||
// 闪屏页
|
// 闪屏页
|
||||||
modulesplash : "com.mogo.module:module-splash:${MOGO_MODULE_SPLASH_VERSION}",
|
modulesplash : "com.mogo.module:module-splash:${MOGO_MODULE_SPLASH_VERSION}",
|
||||||
|
|
||||||
|
// 基础服务实现
|
||||||
|
mogobaseservicesdk : "com.mogo.base:services-apk:${MOGO_BASE_SERVICES_SDK_VERSION}",
|
||||||
|
mogobaseserviceapk : "com.mogo.base:services-sdk:${MOGO_BASE_SERVICES_APK_VERSION}",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
1
foudations/mogo-base-services-apk/.gitignore
vendored
Normal file
1
foudations/mogo-base-services-apk/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
7
foudations/mogo-base-services-apk/README.md
Normal file
7
foudations/mogo-base-services-apk/README.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
## 基实现功能
|
||||||
|
|
||||||
|
基础服务apk实现对应功能:位置上报、长连接、passport
|
||||||
|
|
||||||
|
位置上报:com.zhidao.locationinfo
|
||||||
|
长链:com.zhidao.socketservice
|
||||||
|
passport:
|
||||||
51
foudations/mogo-base-services-apk/build.gradle
Normal file
51
foudations/mogo-base-services-apk/build.gradle
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||||
|
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||||
|
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||||
|
versionCode Integer.valueOf(VERSION_CODE)
|
||||||
|
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||||
|
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
|
implementation rootProject.ext.dependencies.arouter
|
||||||
|
|
||||||
|
api rootProject.ext.dependencies.socketsdk
|
||||||
|
api rootProject.ext.dependencies.socketsdkconnsvrprotoco
|
||||||
|
api rootProject.ext.dependencies.socketsdkprotobufjava
|
||||||
|
implementation rootProject.ext.dependencies.accountsdk
|
||||||
|
|
||||||
|
if (Boolean.valueOf(RELEASE)) {
|
||||||
|
implementation rootProject.ext.dependencies.mogoutils
|
||||||
|
implementation rootProject.ext.dependencies.mogocommons
|
||||||
|
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||||
|
} else {
|
||||||
|
implementation project(":foudations:mogo-utils")
|
||||||
|
implementation project(":foudations:mogo-commons")
|
||||||
|
implementation project(":services:mogo-service-api")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||||
3
foudations/mogo-base-services-apk/gradle.properties
Normal file
3
foudations/mogo-base-services-apk/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
GROUP=com.mogo.base
|
||||||
|
POM_ARTIFACT_ID=services-apk
|
||||||
|
VERSION_CODE=1
|
||||||
21
foudations/mogo-base-services-apk/proguard-rules.pro
vendored
Normal file
21
foudations/mogo-base-services-apk/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# 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,0 +1,26 @@
|
|||||||
|
package com.mogo.base.services.apk;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith( AndroidJUnit4.class )
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
|
assertEquals( "com.mogo.base.services.apk.test", appContext.getPackageName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.mogo.base.services.apk">
|
||||||
|
|
||||||
|
/
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.mogo.base.services.locationinfo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.Keep;
|
||||||
|
|
||||||
|
import com.mogo.map.location.MogoLocation;
|
||||||
|
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 位置服务
|
||||||
|
*/
|
||||||
|
@Keep
|
||||||
|
class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||||
|
|
||||||
|
private static final String TAG = "MogoLocationInfoServices-apk";
|
||||||
|
|
||||||
|
private static volatile MogoLocationInfoServices sInstance;
|
||||||
|
|
||||||
|
private MogoLocationInfoServices() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public static MogoLocationInfoServices getInstance() {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
synchronized ( MogoLocationInfoServices.class ) {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
sInstance = new MogoLocationInfoServices();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void provideLocation( MogoLocation location ) {
|
||||||
|
Logger.d( TAG, "apk - provideLocation" );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
Logger.d( TAG, "apk - start" );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
Logger.d( TAG, "apk - stop" );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context ) {
|
||||||
|
Logger.d( TAG, "apk - init" );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package com.mogo.base.services.passport;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.Keep;
|
||||||
|
|
||||||
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
|
import com.mogo.commons.storage.SpStorage;
|
||||||
|
import com.mogo.service.passport.IMogoPassportManager;
|
||||||
|
import com.mogo.service.passport.IMogoTicketCallback;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
import com.zhidao.account.sdk.AccountClientManager;
|
||||||
|
import com.zhidao.account.sdk.callback.TicketInfoCallback;
|
||||||
|
import com.zhidao.account.sdk.network.NetEnvironManager;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Keep
|
||||||
|
class PassportManager implements IMogoPassportManager {
|
||||||
|
|
||||||
|
private static final String TAG = "PassportManager-apk";
|
||||||
|
|
||||||
|
private static volatile PassportManager sInstance;
|
||||||
|
|
||||||
|
private PassportManager(){}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public static PassportManager getInstance(){
|
||||||
|
if( sInstance == null ){
|
||||||
|
synchronized( PassportManager.class ) {
|
||||||
|
if( sInstance == null ){
|
||||||
|
sInstance = new PassportManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release(){
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void requestTicket( final IMogoTicketCallback callback ) {
|
||||||
|
getTicket( new TicketInfoCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess( String ticket ) {
|
||||||
|
Logger.d( TAG, "success" );
|
||||||
|
SpStorage.setTicket( ticket );
|
||||||
|
if ( callback != null ) {
|
||||||
|
callback.onSuccess( ticket );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure( int code, String msg ) {
|
||||||
|
Logger.d( TAG, "fail" );
|
||||||
|
if ( callback != null ) {
|
||||||
|
callback.onError( code, msg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void getTicket( TicketInfoCallback callback ) {
|
||||||
|
if ( DebugConfig.isLauncher() ) {
|
||||||
|
AccountClientManager.getTicket( callback );
|
||||||
|
} else {
|
||||||
|
AccountClientManager.getAppTicket( callback );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context ) {
|
||||||
|
int mode = DebugConfig.getNetMode();
|
||||||
|
if ( mode == DebugConfig.NET_MODE_DEMO ) {
|
||||||
|
// 演示环境用 qa 的
|
||||||
|
mode = DebugConfig.NET_MODE_QA;
|
||||||
|
}
|
||||||
|
AccountClientManager.init( context.getApplicationContext(), mode, NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,224 @@
|
|||||||
|
package com.mogo.base.services.socket;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.Keep;
|
||||||
|
|
||||||
|
import com.google.protobuf.ByteString;
|
||||||
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
|
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||||
|
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||||
|
import com.mogo.service.connection.IMogoSocketManager;
|
||||||
|
import com.mogo.service.connection.MsgBody;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
import com.mogo.utils.network.utils.GsonUtil;
|
||||||
|
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||||
|
import com.zhidao.ptech.connsvr.protocol.MogoConnsvr;
|
||||||
|
import com.zhidao.socketsdk.manager.OnSocketAckCallback;
|
||||||
|
import com.zhidao.socketsdk.manager.OnSocketReceiveCallback;
|
||||||
|
import com.zhidao.socketsdk.manager.SocketConnManager;
|
||||||
|
import com.zhidao.socketsdk.manager.SocketConnManagerImpl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2019-12-31
|
||||||
|
* <p>
|
||||||
|
* 长链实现:基于 netty
|
||||||
|
*/
|
||||||
|
@Keep
|
||||||
|
public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallback, OnSocketAckCallback {
|
||||||
|
|
||||||
|
private static final String TAG = "SocketManager-apk";
|
||||||
|
|
||||||
|
public static final int MSG_PRODUCT_LINE = MogoCommon.Product.mogoBussiness_VALUE;
|
||||||
|
private static final int MSG_HEADER_TYPE = MogoConnsvr.MsgType.mogoMsgTypeDispatchSvrNoRspReq_VALUE;
|
||||||
|
|
||||||
|
private static volatile SocketManager sInstance;
|
||||||
|
|
||||||
|
private SocketManager( Context context ) {
|
||||||
|
mSocketConnManager = SocketConnManagerImpl.getInstance( context );
|
||||||
|
mSocketConnManager.addSocketMessageCallback( this );
|
||||||
|
mSocketConnManager.addSocketAckCallback( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public static SocketManager getInstance( Context context ) {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
synchronized ( SocketManager.class ) {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
sInstance = new SocketManager( context );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理消息分发
|
||||||
|
* <p>
|
||||||
|
* key - msgType
|
||||||
|
*/
|
||||||
|
private Map< Integer, List< IMogoOnMessageListener > > mListeners = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理消息回执
|
||||||
|
* <p>
|
||||||
|
* key - msgId
|
||||||
|
*/
|
||||||
|
private Map< Long, IMogoMsgAckListener > mAckListeners = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
private SocketConnManager mSocketConnManager;
|
||||||
|
public static final int MAX_CAP = 64; //保证充足的容量应对非常延时的推送
|
||||||
|
private ArrayList< Long > mReceivedMsgId = new ArrayList<>( MAX_CAP );
|
||||||
|
private int mCurrentIndex = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context, String appId ) {
|
||||||
|
if ( mSocketConnManager != null ) {
|
||||||
|
mSocketConnManager.init( appId );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageReceived( byte[] content, long msgId ) {
|
||||||
|
try {
|
||||||
|
MogoConnsvr.Payload payload = MogoConnsvr.Payload.parseFrom( content );
|
||||||
|
int msgType = payload.getMsgType();
|
||||||
|
Logger.d( TAG, "received msg type = %d", msgType );
|
||||||
|
List< IMogoOnMessageListener > listeners = mListeners.get( msgType );
|
||||||
|
if ( listeners != null && !listeners.isEmpty() ) {
|
||||||
|
Iterator< IMogoOnMessageListener > iterator = listeners.iterator();
|
||||||
|
if ( msgId != 0 ) { //兼容老版本
|
||||||
|
if ( mReceivedMsgId.contains( msgId ) ) { // 避免消息重发
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cacheLastReceivedMsgId( msgId );
|
||||||
|
}
|
||||||
|
Object object = null;
|
||||||
|
while ( iterator.hasNext() ) {
|
||||||
|
IMogoOnMessageListener listener = iterator.next();
|
||||||
|
if ( object == null ) {
|
||||||
|
object = GsonUtil.objectFromJson( payload.getPayload().toStringUtf8(), listener.target() );
|
||||||
|
}
|
||||||
|
if ( listener != null ) {
|
||||||
|
Logger.d( TAG, "received msgId = %s, content = %s", msgId, payload.getPayload().toStringUtf8() );
|
||||||
|
listener.onMsgReceived( object );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch ( InvalidProtocolBufferException e ) {
|
||||||
|
Logger.e( TAG, e, "parse msg error." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cacheLastReceivedMsgId( long msgId ) {
|
||||||
|
if ( msgId == 0 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
synchronized ( this ){
|
||||||
|
mReceivedMsgId.add( mCurrentIndex % MAX_CAP, msgId );
|
||||||
|
mCurrentIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAck( byte[] headerBytes, byte[] payloadBytes ) {
|
||||||
|
try {
|
||||||
|
MogoConnsvr.Header header = MogoConnsvr.Header.parseFrom( headerBytes );
|
||||||
|
int msgType = header.getMsgType();
|
||||||
|
String appId = header.getAppId();
|
||||||
|
int productLine = header.getProductLine();
|
||||||
|
long msgId = header.getMsgId();
|
||||||
|
IMogoMsgAckListener listener = mAckListeners.remove( msgId );
|
||||||
|
if ( listener != null ) {
|
||||||
|
listener.onAck( msgId );
|
||||||
|
}
|
||||||
|
Logger.d( TAG, "send message success: msgType = %d, appId = %s, productLine = %d", msgType, appId, productLine );
|
||||||
|
} catch ( InvalidProtocolBufferException e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerOnMessageListener( int msgType, IMogoOnMessageListener listener ) {
|
||||||
|
if ( mListeners.containsKey( msgType ) ) {
|
||||||
|
Logger.w( TAG, "msgType %d is exist.", msgType );
|
||||||
|
}
|
||||||
|
if ( !mListeners.containsKey( msgType ) ) {
|
||||||
|
mListeners.put( msgType, new ArrayList< IMogoOnMessageListener >() );
|
||||||
|
}
|
||||||
|
mListeners.get( msgType ).add( listener );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unregisterOnMessageListener( int msgType ) {
|
||||||
|
mListeners.remove( msgType );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unregisterOnMessageListener( int msgType, IMogoOnMessageListener listener ) {
|
||||||
|
if ( listener == null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( !mListeners.containsKey( msgType ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List< IMogoOnMessageListener > listeners = mListeners.get( msgType );
|
||||||
|
if ( listeners != null && listeners.contains( listener ) ) {
|
||||||
|
listeners.remove( listener );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMsg( MsgBody body, IMogoMsgAckListener listener ) {
|
||||||
|
Logger.d( TAG, "sendMsg." );
|
||||||
|
if ( mSocketConnManager != null ) {
|
||||||
|
if ( mSocketConnManager.isConnected() ) {
|
||||||
|
Logger.d( TAG, "isConnected." );
|
||||||
|
final byte[] pb = convertToPBBytes( body.getMsgType(), objectToBytes( body.getContent() ) );
|
||||||
|
mSocketConnManager.sendPayload(
|
||||||
|
MSG_PRODUCT_LINE,
|
||||||
|
pb,
|
||||||
|
MSG_HEADER_TYPE,
|
||||||
|
body.isAck(),
|
||||||
|
body.getMsgId()
|
||||||
|
);
|
||||||
|
mAckListeners.put( body.getMsgId(), listener );
|
||||||
|
} else {
|
||||||
|
Logger.e( TAG, "sendMsg error, connect is lost." );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Logger.e( TAG, "sendMsg error, client is null." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] objectToBytes( Object obj ) {
|
||||||
|
String jsonStr = GsonUtil.jsonFromObject( obj );
|
||||||
|
return jsonStr.getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] convertToPBBytes( int msgType, byte[] payloadBytes ) {
|
||||||
|
MogoConnsvr.Payload payloadData = MogoConnsvr.Payload.newBuilder()
|
||||||
|
.setMsgType( msgType )
|
||||||
|
.setPayload( ByteString.copyFrom( payloadBytes ) ).build();
|
||||||
|
return payloadData.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
mListeners.clear();
|
||||||
|
mListeners = null;
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.mogo.base.services.apk;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() {
|
||||||
|
assertEquals( 4, 2 + 2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
1
foudations/mogo-base-services-sdk/.gitignore
vendored
Normal file
1
foudations/mogo-base-services-sdk/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
3
foudations/mogo-base-services-sdk/README.md
Normal file
3
foudations/mogo-base-services-sdk/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## sdk实现功能
|
||||||
|
|
||||||
|
脱离基础服务apk实现对应功能:位置上报、长连接、passport
|
||||||
53
foudations/mogo-base-services-sdk/build.gradle
Normal file
53
foudations/mogo-base-services-sdk/build.gradle
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||||
|
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||||
|
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||||
|
versionCode Integer.valueOf(VERSION_CODE)
|
||||||
|
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
|
implementation rootProject.ext.dependencies.arouter
|
||||||
|
// 上报位置
|
||||||
|
implementation 'com.zhidao.locupload:loc-upload-sdk:1.0.6'
|
||||||
|
// 长链
|
||||||
|
implementation 'com.zhidao.socket:built-in-socket:1.0.11'
|
||||||
|
// passport
|
||||||
|
implementation 'com.zhidao.tcloginsdk:tclogin:1.0.6'
|
||||||
|
|
||||||
|
annotationProcessor 'com.elegant.spi:compiler:1.0.3'
|
||||||
|
|
||||||
|
|
||||||
|
if (Boolean.valueOf(RELEASE)) {
|
||||||
|
implementation rootProject.ext.dependencies.mogoutils
|
||||||
|
implementation rootProject.ext.dependencies.mogocommons
|
||||||
|
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||||
|
} else {
|
||||||
|
implementation project(":foudations:mogo-utils")
|
||||||
|
implementation project(":foudations:mogo-commons")
|
||||||
|
implementation project(":services:mogo-service-api")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||||
3
foudations/mogo-base-services-sdk/gradle.properties
Normal file
3
foudations/mogo-base-services-sdk/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
GROUP=com.mogo.connection
|
||||||
|
POM_ARTIFACT_ID=mogo-base-services-sdk
|
||||||
|
VERSION_CODE=1
|
||||||
21
foudations/mogo-base-services-sdk/proguard-rules.pro
vendored
Normal file
21
foudations/mogo-base-services-sdk/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# 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,0 +1,26 @@
|
|||||||
|
package com.mogo.base.services;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith( AndroidJUnit4.class )
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
|
assertEquals( "com.mogo.base.services.test", appContext.getPackageName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.mogo.base.services">
|
||||||
|
|
||||||
|
/
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package com.mogo.base.services.locationinfo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.Keep;
|
||||||
|
|
||||||
|
import com.elegant.spi.annotations.Service;
|
||||||
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
|
import com.mogo.map.location.MogoLocation;
|
||||||
|
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
import com.zhidao.locupload.LocEnvironment;
|
||||||
|
import com.zhidao.locupload.LocUploadConfig;
|
||||||
|
import com.zhidao.locupload.LocUploadManager;
|
||||||
|
import com.zhidao.locupload.Platform;
|
||||||
|
import com.zhidao.locupload.location.LocationServiceProvider;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 位置服务
|
||||||
|
*/
|
||||||
|
@Keep
|
||||||
|
class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||||
|
|
||||||
|
private static final String TAG = "MogoLocationInfoServices-sdk";
|
||||||
|
|
||||||
|
private static volatile MogoLocationInfoServices sInstance;
|
||||||
|
private MogoLocation mLocation;
|
||||||
|
|
||||||
|
private MogoLocationInfoServices() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public static MogoLocationInfoServices getInstance() {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
synchronized ( MogoLocationInfoServices.class ) {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
sInstance = new MogoLocationInfoServices();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void provideLocation( MogoLocation location ) {
|
||||||
|
mLocation = location;
|
||||||
|
Logger.d(TAG, "sdk - provideLocation");
|
||||||
|
}
|
||||||
|
|
||||||
|
public MogoLocation getLocation() {
|
||||||
|
return mLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
LocUploadManager.getInstance().startUpload();
|
||||||
|
Logger.d(TAG, "sdk - start");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
LocUploadManager.getInstance().stopUpload();
|
||||||
|
Logger.d(TAG, "sdk - stop");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context ) {
|
||||||
|
LocUploadConfig.instance().
|
||||||
|
setAppId( "dataCrawler" ).
|
||||||
|
setContext( context.getApplicationContext() ).
|
||||||
|
setLocEnvironment( getEnvironment() ).
|
||||||
|
setLoggable( DebugConfig.isDebug() ).
|
||||||
|
setPlatform( Platform.car ).
|
||||||
|
setLocInterval( 2000L );
|
||||||
|
Logger.d(TAG, "sdk - init");
|
||||||
|
}
|
||||||
|
|
||||||
|
private LocEnvironment getEnvironment() {
|
||||||
|
switch ( DebugConfig.getNetMode() ) {
|
||||||
|
case 1:
|
||||||
|
return LocEnvironment.dev;
|
||||||
|
case 2:
|
||||||
|
case 4:
|
||||||
|
return LocEnvironment.qa;
|
||||||
|
case 3:
|
||||||
|
default:
|
||||||
|
return LocEnvironment.release;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.mogo.base.services.locationinfo;
|
||||||
|
|
||||||
|
import com.elegant.spi.annotations.Service;
|
||||||
|
import com.zhidao.locupload.location.LocationServiceProvider;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Service( value = LocationServiceProvider.class )
|
||||||
|
class MogoLocationSource extends LocationServiceProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getBearing() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getBearing();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getAccuracy() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getAccuracy();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProvider() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getProvider();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSpeed() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getSpeed();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getAltitude() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getAltitude();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAdCode() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getAdCode();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLocType() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getLocType();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLatitude() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getLatitude();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLongitude() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getLongitude();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTime() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getTime();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCityCode() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getCityCode();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCityName() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getCityName();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getGpsAccuracyStatus() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getGpsAccuracyStatus();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSatellites() {
|
||||||
|
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||||
|
return MogoLocationInfoServices.getInstance().getLocation().getSatellite();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCarStatus() {
|
||||||
|
// 常开状态
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package com.mogo.base.services.passport;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.Keep;
|
||||||
|
|
||||||
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
|
import com.mogo.commons.storage.SpStorage;
|
||||||
|
import com.mogo.service.passport.IMogoPassportManager;
|
||||||
|
import com.mogo.service.passport.IMogoTicketCallback;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
import com.zhidao.accountsdk.manager.CarPadClientManagerImpl;
|
||||||
|
import com.zhidao.accountsdk.manager.TicketInfoCallback;
|
||||||
|
import com.zhidao.accountsdk.network.NetEnvironManager;
|
||||||
|
import com.zhidao.tcloginsdk.ToCLoginManagerImpl;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Keep
|
||||||
|
class PassportManager implements IMogoPassportManager {
|
||||||
|
|
||||||
|
private static final String TAG = "PassportManager-sdk";
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
private static volatile PassportManager sInstance;
|
||||||
|
|
||||||
|
private PassportManager(){}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public static PassportManager getInstance(){
|
||||||
|
if( sInstance == null ){
|
||||||
|
synchronized( PassportManager.class ) {
|
||||||
|
if( sInstance == null ){
|
||||||
|
sInstance = new PassportManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release(){
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void requestTicket( final IMogoTicketCallback callback ) {
|
||||||
|
getTicket( new TicketInfoCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess( String ticket ) {
|
||||||
|
Logger.d( TAG, "success" );
|
||||||
|
SpStorage.setTicket( ticket );
|
||||||
|
if ( callback != null ) {
|
||||||
|
callback.onSuccess( ticket );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure( int code ) {
|
||||||
|
Logger.d( TAG, "fail" );
|
||||||
|
if ( callback != null ) {
|
||||||
|
callback.onError( code, "error." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getTicket( TicketInfoCallback callback ) {
|
||||||
|
CarPadClientManagerImpl.getInstance( mContext ).getTicket( "os2.0-launcher", new TicketInfoCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess( String ticket ) {
|
||||||
|
if ( callback != null ) {
|
||||||
|
callback.onSuccess( ticket );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure( int code ) {
|
||||||
|
if ( callback != null ) {
|
||||||
|
callback.onFailure( code );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context ) {
|
||||||
|
mContext = context;
|
||||||
|
int mode = DebugConfig.getNetMode();
|
||||||
|
if ( mode == DebugConfig.NET_MODE_DEMO ) {
|
||||||
|
// 演示环境用 qa 的
|
||||||
|
mode = DebugConfig.NET_MODE_QA;
|
||||||
|
}
|
||||||
|
ToCLoginManagerImpl.getInstance( context ).setNetEnviron( mode );
|
||||||
|
ToCLoginManagerImpl.getInstance( context ).showLoginView();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,227 @@
|
|||||||
|
package com.mogo.base.services.socket;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.Keep;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.google.protobuf.ByteString;
|
||||||
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
|
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||||
|
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||||
|
import com.mogo.service.connection.IMogoSocketManager;
|
||||||
|
import com.mogo.service.connection.MsgBody;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
import com.mogo.utils.network.utils.GsonUtil;
|
||||||
|
import com.zhidao.locupload.Platform;
|
||||||
|
import com.zhidao.ptech.connsvr.protocol.MogoConnsvr;
|
||||||
|
import com.zhidao.socket.Callback;
|
||||||
|
import com.zhidao.socket.CallbackManager;
|
||||||
|
import com.zhidao.socket.Environment;
|
||||||
|
import com.zhidao.socket.SocketConfig;
|
||||||
|
import com.zhidao.socket.SocketMessageDispatcher;
|
||||||
|
import com.zhidao.socket.utils.RequestUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 长链
|
||||||
|
*/
|
||||||
|
@Keep
|
||||||
|
class SocketManager implements IMogoSocketManager, Callback {
|
||||||
|
|
||||||
|
private static final String TAG = "SocketManager-sdk";
|
||||||
|
|
||||||
|
private static volatile SocketManager sInstance;
|
||||||
|
private String mAppId;
|
||||||
|
|
||||||
|
public SocketManager( Context context ) {
|
||||||
|
CallbackManager.getInstance().register( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public static SocketManager getInstance( Context context ) {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
synchronized ( SocketManager.class ) {
|
||||||
|
if ( sInstance == null ) {
|
||||||
|
sInstance = new SocketManager( context );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理消息分发
|
||||||
|
* <p>
|
||||||
|
* key - msgType
|
||||||
|
*/
|
||||||
|
private Map< Integer, List< IMogoOnMessageListener > > mListeners = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理消息回执
|
||||||
|
* <p>
|
||||||
|
* key - msgId
|
||||||
|
*/
|
||||||
|
private Map< Long, IMogoMsgAckListener > mAckListeners = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
public static final int MAX_CAP = 64; //保证充足的容量应对非常延时的推送
|
||||||
|
private ArrayList< Long > mReceivedMsgId = new ArrayList<>( MAX_CAP );
|
||||||
|
private int mCurrentIndex = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context, String appId ) {
|
||||||
|
mAppId = appId;
|
||||||
|
SocketConfig.instance()
|
||||||
|
.setAppContext( context.getApplicationContext() )
|
||||||
|
.setEnvironment( getEnvironment() )
|
||||||
|
.setClient( Platform.getClient( Platform.car ) )
|
||||||
|
.setAppId( appId )
|
||||||
|
.setDebug( DebugConfig.isDebug() );
|
||||||
|
SocketMessageDispatcher.getInstance().start( context );
|
||||||
|
}
|
||||||
|
|
||||||
|
private Environment getEnvironment() {
|
||||||
|
switch ( DebugConfig.getNetMode() ) {
|
||||||
|
case 1:
|
||||||
|
return Environment.dev;
|
||||||
|
case 2:
|
||||||
|
case 4:
|
||||||
|
return Environment.qa;
|
||||||
|
case 3:
|
||||||
|
default:
|
||||||
|
return Environment.release;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update( @NonNull CallbackManager manager, @NonNull byte[] content, String appId, long msgId ) {
|
||||||
|
try {
|
||||||
|
MogoConnsvr.Payload payload = MogoConnsvr.Payload.parseFrom( content );
|
||||||
|
int msgType = payload.getMsgType();
|
||||||
|
Logger.d( TAG, "received msg type = %d", msgType );
|
||||||
|
List< IMogoOnMessageListener > listeners = mListeners.get( msgType );
|
||||||
|
if ( listeners != null && !listeners.isEmpty() ) {
|
||||||
|
Iterator< IMogoOnMessageListener > iterator = listeners.iterator();
|
||||||
|
if ( msgId != 0 ) { //兼容老版本
|
||||||
|
if ( mReceivedMsgId.contains( msgId ) ) { // 避免消息重发
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cacheLastReceivedMsgId( msgId );
|
||||||
|
}
|
||||||
|
Object object = null;
|
||||||
|
while ( iterator.hasNext() ) {
|
||||||
|
IMogoOnMessageListener listener = iterator.next();
|
||||||
|
if ( object == null ) {
|
||||||
|
object = GsonUtil.objectFromJson( payload.getPayload().toStringUtf8(), listener.target() );
|
||||||
|
}
|
||||||
|
if ( listener != null ) {
|
||||||
|
Logger.d( TAG, "received msgId = %s, content = %s", msgId, payload.getPayload().toStringUtf8() );
|
||||||
|
listener.onMsgReceived( object );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch ( InvalidProtocolBufferException e ) {
|
||||||
|
Logger.e( TAG, e, "parse msg error." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAck( @NonNull CallbackManager manager, @NonNull byte[] headerBytes, byte[] content ) {
|
||||||
|
try {
|
||||||
|
MogoConnsvr.Header header = MogoConnsvr.Header.parseFrom( headerBytes );
|
||||||
|
int msgType = header.getMsgType();
|
||||||
|
String appId = header.getAppId();
|
||||||
|
int productLine = header.getProductLine();
|
||||||
|
long msgId = header.getMsgId();
|
||||||
|
IMogoMsgAckListener listener = mAckListeners.remove( msgId );
|
||||||
|
if ( listener != null ) {
|
||||||
|
listener.onAck( msgId );
|
||||||
|
}
|
||||||
|
Logger.d( TAG, "send message success: msgType = %d, appId = %s, productLine = %d", msgType, appId, productLine );
|
||||||
|
} catch ( InvalidProtocolBufferException e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cacheLastReceivedMsgId( long msgId ) {
|
||||||
|
if ( msgId == 0 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
synchronized ( this ) {
|
||||||
|
mReceivedMsgId.add( mCurrentIndex % MAX_CAP, msgId );
|
||||||
|
mCurrentIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerOnMessageListener( int msgType, IMogoOnMessageListener listener ) {
|
||||||
|
if ( mListeners.containsKey( msgType ) ) {
|
||||||
|
Logger.w( TAG, "msgType %d is exist.", msgType );
|
||||||
|
}
|
||||||
|
if ( !mListeners.containsKey( msgType ) ) {
|
||||||
|
mListeners.put( msgType, new ArrayList< IMogoOnMessageListener >() );
|
||||||
|
}
|
||||||
|
mListeners.get( msgType ).add( listener );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unregisterOnMessageListener( int msgType ) {
|
||||||
|
mListeners.remove( msgType );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unregisterOnMessageListener( int msgType, IMogoOnMessageListener listener ) {
|
||||||
|
if ( listener == null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( !mListeners.containsKey( msgType ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List< IMogoOnMessageListener > listeners = mListeners.get( msgType );
|
||||||
|
if ( listeners != null && listeners.contains( listener ) ) {
|
||||||
|
listeners.remove( listener );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMsg( MsgBody body, IMogoMsgAckListener listener ) {
|
||||||
|
Logger.d( TAG, "sendMsg." );
|
||||||
|
final byte[] pb = convertToPBBytes( body.getMsgType(), objectToBytes( body.getContent() ) );
|
||||||
|
RequestUtil.sendPayloadData( mAppId, 2, pb, 1, true, System.currentTimeMillis() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] objectToBytes( Object obj ) {
|
||||||
|
String jsonStr = GsonUtil.jsonFromObject( obj );
|
||||||
|
return jsonStr.getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] convertToPBBytes( int msgType, byte[] payloadBytes ) {
|
||||||
|
MogoConnsvr.Payload payloadData = MogoConnsvr.Payload.newBuilder()
|
||||||
|
.setMsgType( msgType )
|
||||||
|
.setPayload( ByteString.copyFrom( payloadBytes ) ).build();
|
||||||
|
return payloadData.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void release() {
|
||||||
|
mListeners.clear();
|
||||||
|
mListeners = null;
|
||||||
|
sInstance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.mogo.base.services;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() {
|
||||||
|
assertEquals( 4, 2 + 2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.mogo.commons;
|
package com.mogo.commons;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -20,11 +18,7 @@ import com.mogo.commons.network.X509TrustManagerImpl;
|
|||||||
import com.mogo.commons.storage.SpStorage;
|
import com.mogo.commons.storage.SpStorage;
|
||||||
import com.mogo.utils.ThreadPoolService;
|
import com.mogo.utils.ThreadPoolService;
|
||||||
import com.mogo.utils.TipToast;
|
import com.mogo.utils.TipToast;
|
||||||
import com.mogo.utils.logger.Logger;
|
|
||||||
import com.mogo.utils.network.NetConfig;
|
import com.mogo.utils.network.NetConfig;
|
||||||
import com.zhidao.account.sdk.AccountClientManager;
|
|
||||||
import com.zhidao.account.sdk.callback.TicketInfoCallback;
|
|
||||||
import com.zhidao.account.sdk.network.NetEnvironManager;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
@@ -98,7 +92,6 @@ public class AbsMogoApplication extends Application {
|
|||||||
private void asyncInit() {
|
private void asyncInit() {
|
||||||
ThreadPoolService.execute( () -> {
|
ThreadPoolService.execute( () -> {
|
||||||
initNetConfig();
|
initNetConfig();
|
||||||
initAccountSdk();
|
|
||||||
// 初始化toast
|
// 初始化toast
|
||||||
// 初始化埋点
|
// 初始化埋点
|
||||||
Analytics.getInstance().start( sApp );
|
Analytics.getInstance().start( sApp );
|
||||||
@@ -109,37 +102,42 @@ public class AbsMogoApplication extends Application {
|
|||||||
AnalyticsConfig.getInstance( sApp ).shouldLog( DebugConfig.isDebug() );
|
AnalyticsConfig.getInstance( sApp ).shouldLog( DebugConfig.isDebug() );
|
||||||
Devices.init( getApp() );
|
Devices.init( getApp() );
|
||||||
Devices.checkBindState();
|
Devices.checkBindState();
|
||||||
|
asyncInitImpl();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initAccountSdk() {
|
protected void asyncInitImpl(){
|
||||||
int mode = DebugConfig.getNetMode();
|
|
||||||
if ( mode == DebugConfig.NET_MODE_DEMO ) {
|
|
||||||
// 演示环境用 qa 的
|
|
||||||
mode = DebugConfig.NET_MODE_QA;
|
|
||||||
}
|
|
||||||
AccountClientManager.init( sApp, mode, NetEnvironManager.OS_2C, "os2.0-launcher" );
|
|
||||||
getTicket( new TicketInfoCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess( String ticket ) {
|
|
||||||
SpStorage.setTicket( ticket );
|
|
||||||
Logger.w( TAG, "request ticket success" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure( int code, String msg ) {
|
|
||||||
Logger.w( TAG, "request ticket error code = %d, msg = %s", code, msg );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getTicket( TicketInfoCallback callback ) {
|
// private static void initAccountSdk() {
|
||||||
if ( DebugConfig.isLauncher() ) {
|
// int mode = DebugConfig.getNetMode();
|
||||||
AccountClientManager.getTicket( callback );
|
// if ( mode == DebugConfig.NET_MODE_DEMO ) {
|
||||||
} else {
|
// // 演示环境用 qa 的
|
||||||
AccountClientManager.getAppTicket( callback );
|
// mode = DebugConfig.NET_MODE_QA;
|
||||||
}
|
// }
|
||||||
}
|
// AccountClientManager.init( sApp, mode, NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||||
|
// getTicket( new TicketInfoCallback() {
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess( String ticket ) {
|
||||||
|
// SpStorage.setTicket( ticket );
|
||||||
|
// Logger.w( TAG, "request ticket success" );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onFailure( int code, String msg ) {
|
||||||
|
// Logger.w( TAG, "request ticket error code = %d, msg = %s", code, msg );
|
||||||
|
// }
|
||||||
|
// } );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private static void getTicket( TicketInfoCallback callback ) {
|
||||||
|
// if ( DebugConfig.isLauncher() ) {
|
||||||
|
// AccountClientManager.getTicket( callback );
|
||||||
|
// } else {
|
||||||
|
// AccountClientManager.getAppTicket( callback );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
private static void initNetConfig() {
|
private static void initNetConfig() {
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.telephony.CellLocation;
|
|||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.cdma.CdmaCellLocation;
|
import android.telephony.cdma.CdmaCellLocation;
|
||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@@ -55,11 +56,16 @@ public class Utils {
|
|||||||
|
|
||||||
public static final String GET = "get";
|
public static final String GET = "get";
|
||||||
public static final String GSM_SERIAL = "gsm.serial";
|
public static final String GSM_SERIAL = "gsm.serial";
|
||||||
|
public static final String BYD_SERIAL = "ro.serialno";
|
||||||
public static final String FOTA_VERSION = "ro.fota.version";
|
public static final String FOTA_VERSION = "ro.fota.version";
|
||||||
public static final String PROPERTIES = "android.os.SystemProperties";
|
public static final String PROPERTIES = "android.os.SystemProperties";
|
||||||
|
|
||||||
public static String getSn() {
|
public static String getSn() {
|
||||||
return getSystemProperties( GSM_SERIAL );
|
String sn = getSystemProperties( GSM_SERIAL );
|
||||||
|
if ( TextUtils.isEmpty( sn ) ) {
|
||||||
|
sn = getSystemProperties( BYD_SERIAL );
|
||||||
|
}
|
||||||
|
return sn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFotaVersion() {
|
public static String getFotaVersion() {
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
package com.mogo.connection.socket;
|
|
||||||
|
|
||||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
|
||||||
import com.zhidao.ptech.connsvr.protocol.MogoConnsvr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author congtaowang
|
|
||||||
* @since 2019-12-31
|
|
||||||
* <p>
|
|
||||||
* 描述
|
|
||||||
*/
|
|
||||||
public class MsgBody {
|
|
||||||
|
|
||||||
private int mMsgType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 服务端分发,业务线
|
|
||||||
*/
|
|
||||||
private int mProductLine = MogoCommon.Product.mogoBussiness_VALUE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private int mHeaderType = MogoConnsvr.MsgType.mogoMsgTypeDispatchSvrNoRspReq_VALUE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否回执
|
|
||||||
*/
|
|
||||||
private boolean mAck = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息ID
|
|
||||||
*/
|
|
||||||
private final long mMsgId = System.currentTimeMillis();
|
|
||||||
|
|
||||||
private Object mContent;
|
|
||||||
|
|
||||||
public MsgBody msgType( int msgType ) {
|
|
||||||
this.mMsgType = msgType;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MsgBody ack( boolean ack ) {
|
|
||||||
this.mAck = ack;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MsgBody content( Object content ) {
|
|
||||||
this.mContent = content;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMsgType() {
|
|
||||||
return mMsgType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getProductLine() {
|
|
||||||
return mProductLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeaderType() {
|
|
||||||
return mHeaderType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean ismAck() {
|
|
||||||
return mAck;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getMsgId() {
|
|
||||||
return mMsgId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getContent() {
|
|
||||||
return mContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -71,9 +71,9 @@ MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2
|
|||||||
# v2x
|
# v2x
|
||||||
MOGO_MODULE_V2X_VERSION=1.2.9
|
MOGO_MODULE_V2X_VERSION=1.2.9
|
||||||
# 推送
|
# 推送
|
||||||
MOGO_MODULE_PUSH_VERSION=1.1.5.6
|
MOGO_MODULE_PUSH_VERSION=1.1.5.7
|
||||||
MOGO_MODULE_PUSH_BASE_VERSION=1.1.5.5
|
MOGO_MODULE_PUSH_BASE_VERSION=1.1.5.5
|
||||||
MOGO_MODULE_PUSH_NOOP_VERSION=1.1.5.5
|
MOGO_MODULE_PUSH_NOOP_VERSION=1.1.5.6
|
||||||
# 广告资源位
|
# 广告资源位
|
||||||
MOGO_MODULE_AD_CARD_VERSION=1.0.1
|
MOGO_MODULE_AD_CARD_VERSION=1.0.1
|
||||||
# 探路上报和分享模块
|
# 探路上报和分享模块
|
||||||
@@ -96,6 +96,10 @@ MOGO_MODULE_OBU_VERSION = 1.2.1.10-SNAPSHOT
|
|||||||
MOGO_MODULE_SPLASH_VERSION = 1.0.0-SNAPSHOT
|
MOGO_MODULE_SPLASH_VERSION = 1.0.0-SNAPSHOT
|
||||||
MOGO_MODULE_SPLASH_NOOP_VERSION = 1.0.0-SNAPSHOT
|
MOGO_MODULE_SPLASH_NOOP_VERSION = 1.0.0-SNAPSHOT
|
||||||
|
|
||||||
|
# 基础服务实现:passport、socket、location
|
||||||
|
MOGO_BASE_SERVICES_APK_VERSION = 1.0.0
|
||||||
|
MOGO_BASE_SERVICES_SDK_VERSION = 1.0.0
|
||||||
|
|
||||||
## 产品库必备配置
|
## 产品库必备配置
|
||||||
applicationId=com.mogo.launcer
|
applicationId=com.mogo.launcer
|
||||||
applicationName=IntelligentPilot
|
applicationName=IntelligentPilot
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<dimen name="module_main_entrance_fragment_container_marginLeft">635px</dimen>
|
||||||
|
<dimen name="module_main_header_fragment_container_marginLeft">366px</dimen>
|
||||||
|
</resources>
|
||||||
@@ -6,6 +6,7 @@ import android.transition.AutoTransition;
|
|||||||
import android.transition.Transition;
|
import android.transition.Transition;
|
||||||
import android.transition.TransitionManager;
|
import android.transition.TransitionManager;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
@@ -394,6 +395,11 @@ public class TopViewAnimHelper {
|
|||||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
||||||
computeNaviMarginTop(params.height));
|
computeNaviMarginTop(params.height));
|
||||||
|
|
||||||
|
// 动态改变相关字体大小
|
||||||
|
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize_small));
|
||||||
|
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize_small));
|
||||||
|
|
||||||
}
|
}
|
||||||
constraintSet.applyTo(topMotionLayout);
|
constraintSet.applyTo(topMotionLayout);
|
||||||
ivTurnIcon.getLayoutParams().height =
|
ivTurnIcon.getLayoutParams().height =
|
||||||
@@ -487,6 +493,9 @@ public class TopViewAnimHelper {
|
|||||||
remainDistanceGroup.setVisibility(View.VISIBLE);
|
remainDistanceGroup.setVisibility(View.VISIBLE);
|
||||||
remainTimeGroup.setVisibility(View.VISIBLE);
|
remainTimeGroup.setVisibility(View.VISIBLE);
|
||||||
arriveTimeGroup.setVisibility(View.VISIBLE);
|
arriveTimeGroup.setVisibility(View.VISIBLE);
|
||||||
|
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize));
|
||||||
|
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize));
|
||||||
|
|
||||||
}
|
}
|
||||||
constraintSet.clone(topMotionLayout);
|
constraintSet.clone(topMotionLayout);
|
||||||
|
|
||||||
@@ -547,6 +556,9 @@ public class TopViewAnimHelper {
|
|||||||
remainDistanceGroup.setVisibility(View.VISIBLE);
|
remainDistanceGroup.setVisibility(View.VISIBLE);
|
||||||
remainTimeGroup.setVisibility(View.VISIBLE);
|
remainTimeGroup.setVisibility(View.VISIBLE);
|
||||||
arriveTimeGroup.setVisibility(View.VISIBLE);
|
arriveTimeGroup.setVisibility(View.VISIBLE);
|
||||||
|
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize));
|
||||||
|
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize));
|
||||||
|
|
||||||
// 调整约束
|
// 调整约束
|
||||||
constraintSet.clone(topMotionLayout);
|
constraintSet.clone(topMotionLayout);
|
||||||
constraintSet.clear(tvNextDistance.getId(), ConstraintSet.BOTTOM);
|
constraintSet.clear(tvNextDistance.getId(), ConstraintSet.BOTTOM);
|
||||||
@@ -576,6 +588,8 @@ public class TopViewAnimHelper {
|
|||||||
remainDistanceGroup.setVisibility(View.GONE);
|
remainDistanceGroup.setVisibility(View.GONE);
|
||||||
remainTimeGroup.setVisibility(View.GONE);
|
remainTimeGroup.setVisibility(View.GONE);
|
||||||
arriveTimeGroup.setVisibility(View.GONE);
|
arriveTimeGroup.setVisibility(View.GONE);
|
||||||
|
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize_small));
|
||||||
|
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize_small));
|
||||||
// 调整约束
|
// 调整约束
|
||||||
constraintSet.clone(topMotionLayout);
|
constraintSet.clone(topMotionLayout);
|
||||||
constraintSet.connect(tvNextDistance.getId(), ConstraintSet.BOTTOM,
|
constraintSet.connect(tvNextDistance.getId(), ConstraintSet.BOTTOM,
|
||||||
@@ -655,7 +669,7 @@ public class TopViewAnimHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float getDimen(int resId) {
|
private float getDimen(int resId) {
|
||||||
return (int) topMotionLayout.getContext().getResources().getDimension(resId);
|
return (int) topMotionLayout.getContext().getResources().getDimensionPixelSize(resId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int computeNaviMarginTop(int height) {
|
private int computeNaviMarginTop(int height) {
|
||||||
|
|||||||
@@ -202,7 +202,7 @@
|
|||||||
<androidx.constraintlayout.widget.Group
|
<androidx.constraintlayout.widget.Group
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
android:visibility="visible"
|
||||||
app:constraint_referenced_ids="btnDebugCtrlNaviView,btnDebugCtrlSubView,btnDebugCtrlTopView"
|
app:constraint_referenced_ids="btnDebugCtrlNaviView,btnDebugCtrlSubView,btnDebugCtrlTopView"
|
||||||
android:id="@+id/groupTopViewDebug" />
|
android:id="@+id/groupTopViewDebug" />
|
||||||
|
|
||||||
|
|||||||
@@ -89,9 +89,11 @@
|
|||||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginTop">24px</dimen>
|
<dimen name="module_ext_navi_info_panel_turn_icon_marginTop">24px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_marginTop">40px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_marginTop">40px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize">60px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize">60px</dimen>
|
||||||
|
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize_small">50px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginLeft">12px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginLeft">12px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginBottom">10px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginBottom">10px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize">40px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize">40px</dimen>
|
||||||
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize_small">30px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_road_textSize">34px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_road_textSize">34px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px</dimen>
|
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_textSize">28px</dimen>
|
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_textSize">28px</dimen>
|
||||||
|
|||||||
@@ -89,9 +89,11 @@
|
|||||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginTop">24px</dimen>
|
<dimen name="module_ext_navi_info_panel_turn_icon_marginTop">24px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_marginTop">40px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_marginTop">40px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize">60px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize">60px</dimen>
|
||||||
|
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize_small">50px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginLeft">12px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginLeft">12px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginBottom">10px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginBottom">10px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize">40px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize">40px</dimen>
|
||||||
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize_small">30px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_road_textSize">34px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_road_textSize">34px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px</dimen>
|
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_textSize">28px</dimen>
|
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_textSize">28px</dimen>
|
||||||
|
|||||||
@@ -91,9 +91,11 @@
|
|||||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginTop">13px</dimen>
|
<dimen name="module_ext_navi_info_panel_turn_icon_marginTop">13px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_marginTop">20px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_marginTop">20px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize">32px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize">32px</dimen>
|
||||||
|
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize_small">32px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginLeft">7px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginLeft">7px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginBottom">5px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginBottom">5px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize">22px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize">22px</dimen>
|
||||||
|
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize_small">22px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel_next_info_road_textSize">18px</dimen>
|
<dimen name="module_ext_navi_info_panel_next_info_road_textSize">18px</dimen>
|
||||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px
|
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px
|
||||||
</dimen>
|
</dimen>
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ dependencies {
|
|||||||
api rootProject.ext.dependencies.mogoservice
|
api rootProject.ext.dependencies.mogoservice
|
||||||
api rootProject.ext.dependencies.moduleservice
|
api rootProject.ext.dependencies.moduleservice
|
||||||
api rootProject.ext.dependencies.moduleapps
|
api rootProject.ext.dependencies.moduleapps
|
||||||
api rootProject.ext.dependencies.mogoconnection
|
|
||||||
api rootProject.ext.dependencies.moduleextensions
|
api rootProject.ext.dependencies.moduleextensions
|
||||||
api rootProject.ext.dependencies.mogomoduleback
|
api rootProject.ext.dependencies.mogomoduleback
|
||||||
} else {
|
} else {
|
||||||
@@ -62,7 +61,6 @@ dependencies {
|
|||||||
api project(':services:mogo-service-api')
|
api project(':services:mogo-service-api')
|
||||||
api project(':services:mogo-service')
|
api project(':services:mogo-service')
|
||||||
api project(':modules:mogo-module-apps')
|
api project(':modules:mogo-module-apps')
|
||||||
api project(':foudations:mogo-connection')
|
|
||||||
api project(':modules:mogo-module-extensions')
|
api project(':modules:mogo-module-extensions')
|
||||||
api project(':modules:mogo-module-back')
|
api project(':modules:mogo-module-back')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,10 @@
|
|||||||
<!--快捷操作浮层-->
|
<!--快捷操作浮层-->
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/module_main_id_entrance_fragment_container"
|
android:id="@+id/module_main_id_entrance_fragment_container"
|
||||||
android:layout_width="@dimen/module_main_entrance_fragment_container_width"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="right"
|
android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft"
|
||||||
android:paddingRight="@dimen/module_main_entrance_fragment_container_padding"
|
android:padding="@dimen/module_main_entrance_fragment_container_padding" />
|
||||||
android:paddingBottom="@dimen/module_main_entrance_fragment_container_padding"
|
|
||||||
android:paddingTop="@dimen/module_main_entrance_fragment_container_padding" />
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/module_main_id_event_panel_fragment_container"
|
android:id="@+id/module_main_id_event_panel_fragment_container"
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ public class UserDataMarkerInfoWindowAdapter implements IMogoInfoWindowAdapter {
|
|||||||
mContent = mInfoWindowView.findViewById( R.id.module_service_id_content );
|
mContent = mInfoWindowView.findViewById( R.id.module_service_id_content );
|
||||||
mTag = mInfoWindowView.findViewById( R.id.module_service_id_tag );
|
mTag = mInfoWindowView.findViewById( R.id.module_service_id_tag );
|
||||||
mCall = mInfoWindowView.findViewById( R.id.module_service_id_call );
|
mCall = mInfoWindowView.findViewById( R.id.module_service_id_call );
|
||||||
|
|
||||||
|
mCall.setVisibility( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD ? View.GONE : View.VISIBLE );
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
|||||||
import com.mogo.service.imageloader.IMogoImageloader;
|
import com.mogo.service.imageloader.IMogoImageloader;
|
||||||
import com.mogo.service.intent.IMogoIntentManager;
|
import com.mogo.service.intent.IMogoIntentManager;
|
||||||
import com.mogo.service.launcher.IMogoLauncher;
|
import com.mogo.service.launcher.IMogoLauncher;
|
||||||
|
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||||
import com.mogo.service.map.IMogoMapService;
|
import com.mogo.service.map.IMogoMapService;
|
||||||
import com.mogo.service.module.IMogoActionManager;
|
import com.mogo.service.module.IMogoActionManager;
|
||||||
import com.mogo.service.module.IMogoAddressManager;
|
import com.mogo.service.module.IMogoAddressManager;
|
||||||
@@ -23,6 +24,7 @@ import com.mogo.service.module.IMogoSearchManager;
|
|||||||
import com.mogo.service.module.IMogoSettingManager;
|
import com.mogo.service.module.IMogoSettingManager;
|
||||||
import com.mogo.service.network.IMogoNetwork;
|
import com.mogo.service.network.IMogoNetwork;
|
||||||
import com.mogo.service.obu.IMogoObuManager;
|
import com.mogo.service.obu.IMogoObuManager;
|
||||||
|
import com.mogo.service.passport.IMogoPassportManager;
|
||||||
import com.mogo.service.share.IMogoShareManager;
|
import com.mogo.service.share.IMogoShareManager;
|
||||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||||
@@ -188,31 +190,50 @@ public interface IMogoServiceApis extends IProvider {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取顶部1/2屏界面管理类
|
* 获取顶部1/2屏界面管理类
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IMogoTopViewManager getTopViewManager();
|
IMogoTopViewManager getTopViewManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他模块调用公共的marker打点
|
* 其他模块调用公共的marker打点
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IMogoMarkerService getMarkerService();
|
IMogoMarkerService getMarkerService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他模块调用分享框的显示和隐藏
|
* 其他模块调用分享框的显示和隐藏
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IMogoShareManager getShareManager();
|
IMogoShareManager getShareManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取obuManager
|
* 获取obuManager
|
||||||
|
*
|
||||||
* @return obuManager
|
* @return obuManager
|
||||||
*/
|
*/
|
||||||
IMogoObuManager getObuManager();
|
IMogoObuManager getObuManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取事件面板manager
|
* 获取事件面板manager
|
||||||
|
*
|
||||||
* @return eventPanelProvider
|
* @return eventPanelProvider
|
||||||
*/
|
*/
|
||||||
IEventPanelProvider getEventPanelManager();
|
IEventPanelProvider getEventPanelManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取位置上报服务接口
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IMogoLocationInfoService getLocationInfoApi();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取位置上报服务接口
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IMogoPassportManager getPassportManagerApi();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,4 +208,16 @@ public class MogoServicePaths {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final String PATH_SPLASH = "/splash/api";
|
public static final String PATH_SPLASH = "/splash/api";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 位置上报
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final String PATH_LOCATION_INFO = "/locationinfo/api";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* passport
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final String PATH_PASSPORT = "/passport/api";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.mogo.service.locationinfo;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||||
|
import com.mogo.map.location.MogoLocation;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 位置服务:上报位置信息和车机状态
|
||||||
|
*/
|
||||||
|
interface IMogoLocationInfoService extends IProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提供位置信息
|
||||||
|
*
|
||||||
|
* @param location
|
||||||
|
*/
|
||||||
|
void provideLocation( MogoLocation location );
|
||||||
|
|
||||||
|
void start();
|
||||||
|
|
||||||
|
void stop();
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.mogo.service.passport;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
interface IMogoPassportManager extends IProvider {
|
||||||
|
|
||||||
|
void requestTicket( IMogoTicketCallback callback );
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.mogo.service.passport;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
* <p>
|
||||||
|
* ticket 回调
|
||||||
|
*/
|
||||||
|
interface IMogoTicketCallback {
|
||||||
|
|
||||||
|
void onSuccess( String ticket );
|
||||||
|
|
||||||
|
void onError( int code, String msg );
|
||||||
|
}
|
||||||
@@ -47,7 +47,6 @@ dependencies {
|
|||||||
implementation rootProject.ext.dependencies.mogoutils
|
implementation rootProject.ext.dependencies.mogoutils
|
||||||
implementation rootProject.ext.dependencies.mogocommons
|
implementation rootProject.ext.dependencies.mogocommons
|
||||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||||
implementation rootProject.ext.dependencies.mogoconnection
|
|
||||||
implementation rootProject.ext.dependencies.modulecommon
|
implementation rootProject.ext.dependencies.modulecommon
|
||||||
} else {
|
} else {
|
||||||
api project(":libraries:mogo-map")
|
api project(":libraries:mogo-map")
|
||||||
@@ -55,7 +54,6 @@ dependencies {
|
|||||||
implementation project(":foudations:mogo-utils")
|
implementation project(":foudations:mogo-utils")
|
||||||
implementation project(":foudations:mogo-commons")
|
implementation project(":foudations:mogo-commons")
|
||||||
implementation project(":services:mogo-service-api")
|
implementation project(":services:mogo-service-api")
|
||||||
implementation project(":foudations:mogo-connection")
|
|
||||||
implementation project(":modules:mogo-module-common")
|
implementation project(":modules:mogo-module-common")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.content.Context;
|
|||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
import com.mogo.connection.socket.SocketManager;
|
|
||||||
import com.mogo.service.IMogoServiceApis;
|
import com.mogo.service.IMogoServiceApis;
|
||||||
import com.mogo.service.MogoServicePaths;
|
import com.mogo.service.MogoServicePaths;
|
||||||
import com.mogo.service.adas.IMogoADASController;
|
import com.mogo.service.adas.IMogoADASController;
|
||||||
@@ -23,6 +22,7 @@ import com.mogo.service.impl.intent.IntentManager;
|
|||||||
import com.mogo.service.impl.singleton.SingletonsHolder;
|
import com.mogo.service.impl.singleton.SingletonsHolder;
|
||||||
import com.mogo.service.intent.IMogoIntentManager;
|
import com.mogo.service.intent.IMogoIntentManager;
|
||||||
import com.mogo.service.launcher.IMogoLauncher;
|
import com.mogo.service.launcher.IMogoLauncher;
|
||||||
|
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||||
import com.mogo.service.map.IMogoMapService;
|
import com.mogo.service.map.IMogoMapService;
|
||||||
import com.mogo.service.module.IMogoActionManager;
|
import com.mogo.service.module.IMogoActionManager;
|
||||||
import com.mogo.service.module.IMogoAddressManager;
|
import com.mogo.service.module.IMogoAddressManager;
|
||||||
@@ -32,6 +32,7 @@ import com.mogo.service.module.IMogoSearchManager;
|
|||||||
import com.mogo.service.module.IMogoSettingManager;
|
import com.mogo.service.module.IMogoSettingManager;
|
||||||
import com.mogo.service.network.IMogoNetwork;
|
import com.mogo.service.network.IMogoNetwork;
|
||||||
import com.mogo.service.obu.IMogoObuManager;
|
import com.mogo.service.obu.IMogoObuManager;
|
||||||
|
import com.mogo.service.passport.IMogoPassportManager;
|
||||||
import com.mogo.service.share.IMogoShareManager;
|
import com.mogo.service.share.IMogoShareManager;
|
||||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||||
@@ -61,7 +62,7 @@ public class MogoServiceApis implements IMogoServiceApis {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IMogoSocketManager getSocketManagerApi( Context context ) {
|
public IMogoSocketManager getSocketManagerApi( Context context ) {
|
||||||
return SocketManager.getInstance( context );
|
return getApiInstance( IMogoSocketManager.class, MogoServicePaths.PATH_SOCKET_MANAGER );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -176,20 +177,30 @@ public class MogoServiceApis implements IMogoServiceApis {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IMogoShareManager getShareManager() {
|
public IMogoShareManager getShareManager() {
|
||||||
return getApiInstance(IMogoShareManager.class,MogoServicePaths.PATH_SHARE);
|
return getApiInstance( IMogoShareManager.class, MogoServicePaths.PATH_SHARE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IMogoObuManager getObuManager() {
|
public IMogoObuManager getObuManager() {
|
||||||
return getApiInstance(IMogoObuManager.class, MogoServicePaths.PATH_OBU);
|
return getApiInstance( IMogoObuManager.class, MogoServicePaths.PATH_OBU );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IEventPanelProvider getEventPanelManager() {
|
public IEventPanelProvider getEventPanelManager() {
|
||||||
return getApiInstance(IEventPanelProvider.class, MogoServicePaths.PATH_EVENT_PANEL);
|
return getApiInstance( IEventPanelProvider.class, MogoServicePaths.PATH_EVENT_PANEL );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static < T extends IProvider > T getApiInstance(Class< T > clazz, String path ) {
|
@Override
|
||||||
|
public IMogoLocationInfoService getLocationInfoApi() {
|
||||||
|
return getApiInstance( IMogoLocationInfoService.class, MogoServicePaths.PATH_LOCATION_INFO );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMogoPassportManager getPassportManagerApi() {
|
||||||
|
return getApiInstance( IMogoPassportManager.class, MogoServicePaths.PATH_PASSPORT );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static < T extends IProvider > T getApiInstance( Class< T > clazz, String path ) {
|
||||||
T inst = SingletonsHolder.get( clazz );
|
T inst = SingletonsHolder.get( clazz );
|
||||||
if ( inst == null ) {
|
if ( inst == null ) {
|
||||||
synchronized ( sLock ) {
|
synchronized ( sLock ) {
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package com.mogo.service.impl.connection;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.mogo.connection.socket.SocketManager;
|
|
||||||
import com.mogo.service.MogoServicePaths;
|
import com.mogo.service.MogoServicePaths;
|
||||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||||
import com.mogo.service.connection.IMogoSocketManager;
|
import com.mogo.service.connection.IMogoSocketManager;
|
||||||
import com.mogo.service.connection.MsgBody;
|
import com.mogo.service.connection.MsgBody;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author congtaowang
|
* @author congtaowang
|
||||||
@@ -19,6 +21,7 @@ import com.mogo.service.connection.MsgBody;
|
|||||||
@Route( path = MogoServicePaths.PATH_SOCKET_MANAGER )
|
@Route( path = MogoServicePaths.PATH_SOCKET_MANAGER )
|
||||||
public class MogoSocketManager implements IMogoSocketManager {
|
public class MogoSocketManager implements IMogoSocketManager {
|
||||||
|
|
||||||
|
private static final String TAG = "MogoSocketManager";
|
||||||
private IMogoSocketManager mDelegate;
|
private IMogoSocketManager mDelegate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,6 +61,18 @@ public class MogoSocketManager implements IMogoSocketManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init( Context context ) {
|
public void init( Context context ) {
|
||||||
mDelegate = SocketManager.getInstance( context );
|
|
||||||
|
try {
|
||||||
|
Class< ? > clazz = Class.forName( "com.mogo.base.services.socket.SocketManager" );
|
||||||
|
Method getInstanceMethod = clazz.getMethod( "getInstance", Context.class );
|
||||||
|
getInstanceMethod.setAccessible( true );
|
||||||
|
mDelegate = ( IMogoSocketManager ) getInstanceMethod.invoke( null, context );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
Logger.e( TAG, e, "error." );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mDelegate != null ) {
|
||||||
|
mDelegate.init( context );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.mogo.service.impl.locationinfo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.mogo.map.location.MogoLocation;
|
||||||
|
import com.mogo.service.MogoServicePaths;
|
||||||
|
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Route( path = MogoServicePaths.PATH_LOCATION_INFO )
|
||||||
|
class MogoLocationInfoService implements IMogoLocationInfoService {
|
||||||
|
|
||||||
|
private static final String TAG = "MogoLocationInfoService";
|
||||||
|
|
||||||
|
private IMogoLocationInfoService mDelegate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void provideLocation( MogoLocation location ) {
|
||||||
|
if ( mDelegate != null ) {
|
||||||
|
mDelegate.provideLocation( location );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
if ( mDelegate != null ) {
|
||||||
|
mDelegate.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
if ( mDelegate != null ) {
|
||||||
|
mDelegate.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context ) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class< ? > clazz = Class.forName( "com.mogo.base.services.locationinfo.MogoLocationInfoServices" );
|
||||||
|
Method getInstanceMethod = clazz.getMethod( "getInstance" );
|
||||||
|
getInstanceMethod.setAccessible( true );
|
||||||
|
mDelegate = ( IMogoLocationInfoService ) getInstanceMethod.invoke( null );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
Logger.e( TAG, e, "error." );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mDelegate != null ) {
|
||||||
|
mDelegate.init( context );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.mogo.service.impl.passport;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.mogo.service.MogoServicePaths;
|
||||||
|
import com.mogo.service.connection.IMogoSocketManager;
|
||||||
|
import com.mogo.service.passport.IMogoPassportManager;
|
||||||
|
import com.mogo.service.passport.IMogoTicketCallback;
|
||||||
|
import com.mogo.utils.logger.Logger;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2020/7/16
|
||||||
|
*
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@Route( path = MogoServicePaths.PATH_PASSPORT )
|
||||||
|
class MogoPassportManager implements IMogoPassportManager {
|
||||||
|
|
||||||
|
private static final String TAG = "MogoPassportManager";
|
||||||
|
|
||||||
|
private IMogoPassportManager mDelegate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void requestTicket( IMogoTicketCallback callback ) {
|
||||||
|
if ( mDelegate != null ) {
|
||||||
|
mDelegate.requestTicket( callback );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init( Context context ) {
|
||||||
|
try {
|
||||||
|
Class< ? > clazz = Class.forName( "com.mogo.base.services.passport.PassportManager" );
|
||||||
|
Method getInstanceMethod = clazz.getMethod( "getInstance" );
|
||||||
|
getInstanceMethod.setAccessible( true );
|
||||||
|
mDelegate = ( IMogoPassportManager ) getInstanceMethod.invoke( null );
|
||||||
|
} catch ( Exception e ) {
|
||||||
|
Logger.e( TAG, e, "error." );
|
||||||
|
}
|
||||||
|
if ( mDelegate != null ) {
|
||||||
|
mDelegate.init( context );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
include ':foudations:mogo-base-services-apk'
|
||||||
|
include ':foudations:mogo-base-services-sdk'
|
||||||
include ':modules:mogo-module-splash-noop'
|
include ':modules:mogo-module-splash-noop'
|
||||||
include ':modules:mogo-module-splash'
|
include ':modules:mogo-module-splash'
|
||||||
include ':modules:mogo-module-left-panel-noop'
|
include ':modules:mogo-module-left-panel-noop'
|
||||||
@@ -25,7 +27,7 @@ include ':libraries:map-amap'
|
|||||||
include ':libraries:mogo-map-api'
|
include ':libraries:mogo-map-api'
|
||||||
include ':modules:mogo-module-apps'
|
include ':modules:mogo-module-apps'
|
||||||
include ':modules:mogo-module-extensions'
|
include ':modules:mogo-module-extensions'
|
||||||
include ':foudations:mogo-connection'
|
//include ':foudations:mogo-connection'
|
||||||
include ':modules:mogo-module-gps-simulator'
|
include ':modules:mogo-module-gps-simulator'
|
||||||
include ':modules:mogo-module-gps-simulator-debug'
|
include ':modules:mogo-module-gps-simulator-debug'
|
||||||
include ':modules:mogo-module-gps-simulator-noop'
|
include ':modules:mogo-module-gps-simulator-noop'
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
./gradlew :foudations:mogo-commons:clean :foudations:mogo-commons:uploadArchives
|
./gradlew :foudations:mogo-commons:clean :foudations:mogo-commons:uploadArchives
|
||||||
./gradlew :libraries:mogo-map-api:clean :libraries:mogo-map-api:uploadArchives
|
./gradlew :libraries:mogo-map-api:clean :libraries:mogo-map-api:uploadArchives
|
||||||
./gradlew :services:mogo-service-api:clean :services:mogo-service-api:uploadArchives
|
./gradlew :services:mogo-service-api:clean :services:mogo-service-api:uploadArchives
|
||||||
./gradlew :foudations:mogo-connection:clean :foudations:mogo-connection:uploadArchives
|
|
||||||
./gradlew :libraries:map-amap:clean :libraries:map-amap:uploadArchives
|
./gradlew :libraries:map-amap:clean :libraries:map-amap:uploadArchives
|
||||||
./gradlew :libraries:map-autonavi:clean :libraries:map-autonavi:uploadArchives
|
./gradlew :libraries:map-autonavi:clean :libraries:map-autonavi:uploadArchives
|
||||||
./gradlew :libraries:mogo-map:clean :libraries:mogo-map:uploadArchives
|
./gradlew :libraries:mogo-map:clean :libraries:mogo-map:uploadArchives
|
||||||
@@ -32,4 +31,6 @@
|
|||||||
./gradlew :modules:mogo-module-left-panel:clean :modules:mogo-module-left-panel:uploadArchives
|
./gradlew :modules:mogo-module-left-panel:clean :modules:mogo-module-left-panel:uploadArchives
|
||||||
./gradlew :modules:mogo-module-left-panel-noop:clean :modules:mogo-module-left-panel-noop:uploadArchives
|
./gradlew :modules:mogo-module-left-panel-noop:clean :modules:mogo-module-left-panel-noop:uploadArchives
|
||||||
./gradlew :modules:mogo-module-byd:clean :modules:mogo-module-byd:uploadArchives
|
./gradlew :modules:mogo-module-byd:clean :modules:mogo-module-byd:uploadArchives
|
||||||
|
./gradlew :foudations:mogo-base-services-apk:clean :foudations:mogo-base-services-apk:uploadArchives
|
||||||
|
./gradlew :foudations:mogo-base-services-sdk:clean :foudations:mogo-base-services-sdk:uploadArchives
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user