完善SDK

This commit is contained in:
董宏宇
2021-02-18 15:52:37 +08:00
parent a9d09d1a3f
commit e3ffaccc73
11 changed files with 101 additions and 83 deletions

1
.idea/gradle.xml generated
View File

@@ -26,7 +26,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -36,5 +36,20 @@
<option name="name" value="maven3" />
<option name="url" value="http://nexus.zhidaoauto.com/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="$USER_HOME$/Library/Android/sdk/extras/android/m2repository" />
<option name="name" value="$USER_HOME$/Library/Android/sdk/extras/android/m2repository" />
<option name="url" value="file:$USER_HOME$/Library/Android/sdk/extras/android/m2repository/" />
</remote-repository>
<remote-repository>
<option name="id" value="$USER_HOME$/Library/Android/sdk/extras/m2repository" />
<option name="name" value="$USER_HOME$/Library/Android/sdk/extras/m2repository" />
<option name="url" value="file:$USER_HOME$/Library/Android/sdk/extras/m2repository/" />
</remote-repository>
<remote-repository>
<option name="id" value="$USER_HOME$/Library/Android/sdk/extras/google/m2repository" />
<option name="name" value="$USER_HOME$/Library/Android/sdk/extras/google/m2repository" />
<option name="url" value="file:$USER_HOME$/Library/Android/sdk/extras/google/m2repository/" />
</remote-repository>
</component>
</project>

View File

@@ -15,6 +15,17 @@ android {
//解决编译时com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'META-INF/rxjava.properties'这个错误
exclude 'META-INF/rxjava.properties'
}
ndk {
abiFilters "armeabi-v7a"//, "arm64-v8a"//, "armeabi"
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
jni.srcDirs = []
}
}
buildTypes {

View File

@@ -1,9 +1,9 @@
ext {
time = ""
kotlin_version = "1.4.10"
kotlin_version = "1.3.41"
android = [
compileSdkVersion: 28,
buildToolsVersion: "29.0.2",
buildToolsVersion: "28.0.3",
minSdkVersion : 19,
targetSdkVersion : 22,
]
@@ -60,7 +60,7 @@ ext {
videoprocessor : "com.zhidao.video:video-processor:1.0.2.1",
// 直播SDK
live_sdk_zego : "im.zego:express-video:2.0.1",
live_sdk_zego : "im.zego:express-video:2.2.0",
aspectj : "org.aspectj:aspectjrt:1.8.9",
adasapi : "com.zhidao.autopilot.support:adas:1.0.6.6",

View File

@@ -42,7 +42,7 @@ class NetWorkUtil {
L.d(TAG, "activityNetworkInfo.type == -1")
statusCallback?.invoke(false)
} else {
L.d(TAG, "activityNetworkInfo.type: ${activeNetworkInfo!!.type}")
//L.d(TAG, "activityNetworkInfo.type: ${activeNetworkInfo!!.type}")
statusCallback?.invoke(true)
}
}

View File

@@ -11,6 +11,16 @@ android {
versionName "${MOGO_LIVE_VERSION}"
consumerProguardFiles "consumer-rules.pro"
ndk {
abiFilters "armeabi-v7a"
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
buildTypes {
@@ -41,10 +51,10 @@ dependencies {
implementation rootProject.ext.dependencies.rxandroid
if (Boolean.valueOf(RELEASE)) {
implementation "com.mogo.cloud:network:${MOGO_NETWORK_VERSION}"
api "com.mogo.cloud:network:${MOGO_NETWORK_VERSION}"
implementation "com.mogo.cloud:socket:${MOGO_SOCKET_VERSION}"
} else {
implementation project(":foudations:mogo-network")
api project(":foudations:mogo-network")
implementation project(":foudations:mogo-socket")
}

View File

@@ -7,8 +7,6 @@ import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener;
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
import com.mogo.cloud.socket.MsgBody;
import com.mogo.cloud.socket.SocketManager;
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
import com.zhidao.socket.SocketClient;
/**
* Socket常链接工具类
@@ -66,10 +64,7 @@ public class SocketMsgUtils implements IMogoCloudSocketMsgAckListener {
* @param body 数据包
*/
public void uploadCamInfo(MsgBody body) {
SocketClient.getInstance().sendData(appId,
MogoCommon.Product.mogoBussiness.getNumber(),
(byte[]) body.getContent(), headerType, true, body.getMsgId());
mSocketManager.sendMsg(appId, headerType, body, this);
}
@Override

View File

@@ -1,7 +1,5 @@
package com.mogo.cloud.live.socket;
import com.google.protobuf.ByteString;
import com.zhidao.ptech.connsvr.protocol.MogoConnsvr;
import com.zhidao.ptech.shadow.server.protocol.DeviceInfo;
import com.zhidao.utils.common.TelephoneUtil;
@@ -17,14 +15,7 @@ public class SocketRequestUtils {
.setCameraInfo(cameraInfo)
.setSn(TelephoneUtil.getSerialNumber())
.setTimestamp(System.currentTimeMillis()).build();
return buildSocketPayload(data.toByteArray(), 196614);
}
private static byte[] buildSocketPayload(byte[] payload, int payloadType) {
MogoConnsvr.Payload payloadData = MogoConnsvr.Payload.newBuilder()
.setMsgType(payloadType)
.setPayload(ByteString.copyFrom(payload)).build();
return payloadData.toByteArray();
return data.toByteArray();
}
}

View File

@@ -30,7 +30,6 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation rootProject.ext.dependencies.androidAppCompat
implementation rootProject.ext.dependencies.gson
}

View File

@@ -2,8 +2,6 @@ package com.mogo.utils.storage;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import java.util.Set;
@@ -13,11 +11,11 @@ public class SharedPrefsMgr {
private static SharedPrefsMgr sInstance;
private static SharedPreferences sSharedPrefs;
public synchronized static SharedPrefsMgr getInstance(@NonNull Context context ) {
if ( sInstance == null ) {
public synchronized static SharedPrefsMgr getInstance(Context context) {
if (sInstance == null) {
try {
sInstance = new SharedPrefsMgr( context.getApplicationContext() );
} catch ( Exception e ) {
sInstance = new SharedPrefsMgr(context.getApplicationContext());
} catch (Exception e) {
sInstance = new SharedPrefsMgr();
}
}
@@ -28,127 +26,127 @@ public class SharedPrefsMgr {
}
private SharedPrefsMgr( Context context ) {
private SharedPrefsMgr(Context context) {
try {
sSharedPrefs = context.getSharedPreferences( File_Name, Context.MODE_PRIVATE );
} catch ( Exception e ) {
sSharedPrefs = context.getSharedPreferences(File_Name, Context.MODE_PRIVATE);
} catch (Exception e) {
e.printStackTrace();
}
}
public void putString( String key, String value ) {
public void putString(String key, String value) {
try {
SharedPreferences.Editor editor = sSharedPrefs.edit();
editor.putString( key, value );
editor.putString(key, value);
editor.apply();
} catch ( Exception e ) {
} catch (Exception e) {
}
}
public String getString( String tag ) {
public String getString(String tag) {
try {
return sSharedPrefs.getString( tag, "" );
} catch ( Exception e ) {
return sSharedPrefs.getString(tag, "");
} catch (Exception e) {
return "";
}
}
public String getString( String tag, String defVal ) {
public String getString(String tag, String defVal) {
try {
return sSharedPrefs.getString( tag, defVal );
} catch ( Exception e ) {
return sSharedPrefs.getString(tag, defVal);
} catch (Exception e) {
return "";
}
}
public boolean getBoolean( String key, boolean defaultValue ) {
public boolean getBoolean(String key, boolean defaultValue) {
try {
return sSharedPrefs.getBoolean( key, defaultValue );
} catch ( Exception e ) {
return sSharedPrefs.getBoolean(key, defaultValue);
} catch (Exception e) {
return defaultValue;
}
}
public long getLong( String key, long defaultValue ) {
public long getLong(String key, long defaultValue) {
try {
return sSharedPrefs.getLong( key, defaultValue );
} catch ( Exception e ) {
return sSharedPrefs.getLong(key, defaultValue);
} catch (Exception e) {
return defaultValue;
}
}
public float getFloat( String key, float defaultValue ) {
public float getFloat(String key, float defaultValue) {
try {
return sSharedPrefs.getFloat( key, defaultValue );
} catch ( Exception e ) {
return sSharedPrefs.getFloat(key, defaultValue);
} catch (Exception e) {
return defaultValue;
}
}
public int getInt( String key, int value ) {
public int getInt(String key, int value) {
try {
return sSharedPrefs.getInt( key, value );
} catch ( Exception e ) {
return sSharedPrefs.getInt(key, value);
} catch (Exception e) {
return value;
}
}
public void putBoolean( String key, boolean value ) {
public void putBoolean(String key, boolean value) {
try {
SharedPreferences.Editor editor = sSharedPrefs.edit();
editor.putBoolean( key, value );
editor.putBoolean(key, value);
editor.apply();
} catch ( Exception e ) {
} catch (Exception e) {
}
}
public void putLong( String key, long value ) {
public void putLong(String key, long value) {
try {
SharedPreferences.Editor editor = sSharedPrefs.edit();
editor.putLong( key, value );
editor.putLong(key, value);
editor.apply();
} catch ( Exception e ) {
} catch (Exception e) {
}
}
public void putInt( String key, int value ) {
public void putInt(String key, int value) {
try {
SharedPreferences.Editor editor = sSharedPrefs.edit();
editor.putInt( key, value );
editor.putInt(key, value);
editor.apply();
} catch ( Exception e ) {
} catch (Exception e) {
}
}
public void putFloat( String key, float value ) {
public void putFloat(String key, float value) {
try {
SharedPreferences.Editor editor = sSharedPrefs.edit();
editor.putFloat( key, value );
editor.putFloat(key, value);
editor.apply();
} catch ( Exception e ) {
} catch (Exception e) {
}
}
public void remove( String key ) {
public void remove(String key) {
try {
SharedPreferences.Editor editor = sSharedPrefs.edit();
editor.remove( key );
editor.remove(key);
editor.apply();
} catch ( Exception e ) {
} catch (Exception e) {
}
}
public void putStringSet( String key, Set< String > values ) {
public void putStringSet(String key, Set<String> values) {
try {
SharedPreferences.Editor editor = sSharedPrefs.edit();
editor.putStringSet( key, values );
editor.putStringSet(key, values);
editor.apply();
} catch ( Exception e ) {
} catch (Exception e) {
}
}
public Set<String> getStringSet( String key ) {
return sSharedPrefs.getStringSet( key, null );
public Set<String> getStringSet(String key) {
return sSharedPrefs.getStringSet(key, null);
}
}

View File

@@ -29,12 +29,12 @@ PASSWORD=xintai2018
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
RELEASE=true
# AI CLOUD 云平台
MOGO_UTILS_VERSION=1.0.14-SNAPSHOT
MOGO_NETWORK_VERSION=1.0.14-SNAPSHOT
MOGO_HTTPDNS_VERSION=1.0.14-SNAPSHOT
MOGO_PASSPORT_VERSION=1.0.14-SNAPSHOT
MOGO_SOCKET_VERSION=1.0.14-SNAPSHOT
MOGO_REALTIME_VERSION=1.0.14-SNAPSHOT
MOGO_TANLU_VERSION=1.0.14-SNAPSHOT
MOGO_LIVE_VERSION=1.0.14-SNAPSHOT
MOGO_TRAFFICLIVE_VERSION=1.0.14-SNAPSHOT
MOGO_UTILS_VERSION=1.0.20-SNAPSHOT
MOGO_NETWORK_VERSION=1.0.20-SNAPSHOT
MOGO_HTTPDNS_VERSION=1.0.20-SNAPSHOT
MOGO_PASSPORT_VERSION=1.0.20-SNAPSHOT
MOGO_SOCKET_VERSION=1.0.20-SNAPSHOT
MOGO_REALTIME_VERSION=1.0.20-SNAPSHOT
MOGO_TANLU_VERSION=1.0.20-SNAPSHOT
MOGO_LIVE_VERSION=1.0.20-SNAPSHOT
MOGO_TRAFFICLIVE_VERSION=1.0.20-SNAPSHOT