refactor(sdk): 重构项目并添加 native 代码支持
- 移除了不必要的日志库 LogUtil - 添加了高德地图服务并配置了相关权限 - 更新了 API 接口定义,统一添加了前缀 -重构了 AppConfig 类,使用 native代码获取配置信息 - 更新了项目构建配置,支持 native 代码编译 - 优化了部分代码结构,提高了代码的可维护性
This commit is contained in:
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="21" />
|
<bytecodeTargetLevel target="17" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
2
.idea/gradle.xml
generated
2
.idea/gradle.xml
generated
@ -6,7 +6,7 @@
|
|||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
<option name="gradleJvm" value="corretto-17" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,6 +1,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.jetbrains.kotlin.android)
|
alias(libs.plugins.jetbrains.kotlin.android)
|
||||||
id 'com.google.devtools.ksp'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@ -31,6 +30,11 @@ android {
|
|||||||
VIVO_APPKEY : "cfd443e2a1757cf537361588c988a12a",//vivo的APPKEY
|
VIVO_APPKEY : "cfd443e2a1757cf537361588c988a12a",//vivo的APPKEY
|
||||||
VIVO_APPID : "105470845",//vivo的APPID
|
VIVO_APPID : "105470845",//vivo的APPID
|
||||||
]
|
]
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
cppFlags ''
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
@ -50,6 +54,7 @@ android {
|
|||||||
}
|
}
|
||||||
debug {
|
debug {
|
||||||
minifyEnabled false // 开启混淆
|
minifyEnabled false // 开启混淆
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.config
|
signingConfig signingConfigs.config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,6 +80,12 @@ android {
|
|||||||
jniLibs.srcDirs = ["libs"]
|
jniLibs.srcDirs = ["libs"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
path file('src/main/cpp/CMakeLists.txt')
|
||||||
|
version '3.22.1'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
38
app/src/main/cpp/CMakeLists.txt
Normal file
38
app/src/main/cpp/CMakeLists.txt
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
# For more information about using CMake with Android Studio, read the
|
||||||
|
# documentation: https://d.android.com/studio/projects/add-native-code.html.
|
||||||
|
# For more examples on how to use CMake, see https://github.com/android/ndk-samples.
|
||||||
|
|
||||||
|
# Sets the minimum CMake version required for this project.
|
||||||
|
cmake_minimum_required(VERSION 3.22.1)
|
||||||
|
|
||||||
|
# Declares the project name. The project name can be accessed via ${ PROJECT_NAME},
|
||||||
|
# Since this is the top level CMakeLists.txt, the project name is also accessible
|
||||||
|
# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level
|
||||||
|
# build script scope).
|
||||||
|
project("config")
|
||||||
|
|
||||||
|
# Creates and names a library, sets it as either STATIC
|
||||||
|
# or SHARED, and provides the relative paths to its source code.
|
||||||
|
# You can define multiple libraries, and CMake builds them for you.
|
||||||
|
# Gradle automatically packages shared libraries with your APK.
|
||||||
|
#
|
||||||
|
# In this top level CMakeLists.txt, ${CMAKE_PROJECT_NAME} is used to define
|
||||||
|
# the target library name; in the sub-module's CMakeLists.txt, ${PROJECT_NAME}
|
||||||
|
# is preferred for the same purpose.
|
||||||
|
#
|
||||||
|
# In order to load a library into your app from Java/Kotlin, you must call
|
||||||
|
# System.loadLibrary() and pass the name of the library defined here;
|
||||||
|
# for GameActivity/NativeActivity derived applications, the same library name must be
|
||||||
|
# used in the AndroidManifest.xml file.
|
||||||
|
add_library(${CMAKE_PROJECT_NAME} SHARED
|
||||||
|
# List C/C++ source files with relative paths to this CMakeLists.txt.
|
||||||
|
config.cpp)
|
||||||
|
|
||||||
|
# Specifies libraries CMake should link to your target library. You
|
||||||
|
# can link libraries from various origins, such as libraries defined in this
|
||||||
|
# build script, prebuilt third-party libraries, or Android system libraries.
|
||||||
|
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||||
|
# List libraries link to the target library
|
||||||
|
android
|
||||||
|
log)
|
279
app/src/main/cpp/config.cpp
Normal file
279
app/src/main/cpp/config.cpp
Normal file
@ -0,0 +1,279 @@
|
|||||||
|
// Write C++ code here.
|
||||||
|
//
|
||||||
|
// Do not forget to dynamically load the C++ library into your application.
|
||||||
|
//
|
||||||
|
// For instance,
|
||||||
|
//
|
||||||
|
// In MainActivity.java:
|
||||||
|
// static {
|
||||||
|
// System.loadLibrary("demo");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Or, in MainActivity.kt:
|
||||||
|
// companion object {
|
||||||
|
// init {
|
||||||
|
// System.loadLibrary("demo")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
#include <jni.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jobject JNICALL
|
||||||
|
Java_com_za_base_Config_getUrls(JNIEnv *env, jobject thiz) {
|
||||||
|
// 创建 HashMap 类引用
|
||||||
|
jclass hashMapClass = env->FindClass("java/util/HashMap");
|
||||||
|
jmethodID hashMapConstructor = env->GetMethodID(hashMapClass, "<init>", "()V");
|
||||||
|
jmethodID putMethod = env->GetMethodID(hashMapClass, "put",
|
||||||
|
"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
||||||
|
|
||||||
|
// 创建 HashMap 实例
|
||||||
|
jobject hashMap = env->NewObject(hashMapClass, hashMapConstructor);
|
||||||
|
|
||||||
|
// 插入键值对
|
||||||
|
jstring key1 = env->NewStringUTF("release");
|
||||||
|
jstring value1 = env->NewStringUTF("https://api.sinoassist.com");
|
||||||
|
env->CallObjectMethod(hashMap, putMethod, key1, value1);
|
||||||
|
|
||||||
|
jstring key2 = env->NewStringUTF("review");
|
||||||
|
jstring value2 = env->NewStringUTF("25");
|
||||||
|
env->CallObjectMethod(hashMap, putMethod, key2, value2);
|
||||||
|
|
||||||
|
return hashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------- 基础的地址配置-------------------------------------------------
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReleaseBaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://api.sinoassist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReleaseImgBaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://api.sinoassist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReleaseResourceUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://www.sinoassist.com/res";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReleaseTrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://www.sinoassist.com/h5/supplier/dispatch/diverTrainDocment";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReleaseDocumentUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://www.sinoassist.com/h5/supplier/dispatch/docmentList";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReleaseNewDriverTrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://www.sinoassist.com/h5/supplier/dispatch/driverTrainingList";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReviewBaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "http://interface.review.sino-assist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReviewImgBaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "http://interface.review.sino-assist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReviewResourceUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://www.sinoassist.com/res";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReviewTrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "http://interface.review.sino-assist.com/h5/supplier/dispatch/diverTrainDocment";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReviewDocumentUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "http://interface.review.sino-assist.com/h5/supplier/dispatch/docmentList";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getReviewNewDriverTrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "http://interface.review.sino-assist.com/h5/supplier/dispatch/driverTrainingList";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm1BaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://api1.sino-assist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm1ImgBaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://api1.sino-assist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm1ResourceUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://crm1.sino-assist.com/res";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm1TrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://crm1.sino-assist.com/h5/supplier/dispatch/diverTrainDocment";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm1DocumentUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://crm1.sino-assist.com/h5/supplier/dispatch/docmentList";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm1NewDriverTrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://crm1.sino-assist.com/h5/supplier/dispatch/driverTrainingList";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm2BaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://api2.sino-assist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm2ImgBaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://api2.sino-assist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm2ResourceUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://crm2.sino-assist.com/res";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm2TrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://api.sinoassist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm2DocumentUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getCrm2NewDriverTrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getUatBaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://api-uat.sino-assist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getUatImgBaseUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://api-uat.sino-assist.com";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getUatResourceUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://uat.sino-assist.com/res";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getUatTrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://uat.sino-assist.com/h5/supplier/dispatch/diverTrainDocment";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getUatDocumentUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://uat.sino-assist.com/h5/supplier/dispatch/docmentList";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_base_AppConfig_getUatNewDriverTrainUrl(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string baseUrl = "https://uat.sino-assist.com/h5/supplier/dispatch/driverTrainingList";
|
||||||
|
return env->NewStringUTF(baseUrl.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------bugly appid---------------------
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_common_ZDManager_getBuglyAppId(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string bugly = "6972a6b56d";
|
||||||
|
return env->NewStringUTF(bugly.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_net_RequestEncryptInterceptor_getPublicKey(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string bugly = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7UM6zdWdBuO0DZZVkxVfJioawUe6qH1p5Uz/qR9zbawl2oWyxxcBfxQyPS+HxOej/ZnyS4bu7qhh99alDqkJzk6g9oGZWs+jEF5GRWt9nChlfUsjvHQwuF2TSQMTdPtDPCByF/QgMFCAfbCqTrNmOETrZ/2GFy1Re0BTlhh6X/XzpzqtK+enikEMlQ5fIM5ljdXgyCnvDou9ptWqzw8Zmsat6LeA0UKz+bgpJAbw6KfK+8lPMqUpNFfkmJuEd5+JQOG9McH7j9pBagohkC6k3Cn92dAf9iD6NSDKSNgt1vxXhaNnfAbYJ5pqeSGy6QMSVO0TXYj4asln5OutD/284QIDAQAB";
|
||||||
|
return env->NewStringUTF(bugly.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------MQTT 配置---------------------
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_service_mqtt_MqttConfig_getMqttInstanceId(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string bugly = "mqtt-cn-oew23jbkb1f";
|
||||||
|
return env->NewStringUTF(bugly.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_service_mqtt_MqttConfig_getMqttEndpoint(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string bugly = "mqtt-cn-oew23jbkb1f.mqtt.aliyuncs.com";
|
||||||
|
return env->NewStringUTF(bugly.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_service_mqtt_MqttConfig_getMqttAccessKey(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string bugly = "LTAI5tKgZ9ACKorXzzWLxgg7";
|
||||||
|
return env->NewStringUTF(bugly.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_service_mqtt_MqttConfig_getMqttSecretKey(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string bugly = "D04F0UH2GzrDsYaJ9GTfULGPjcsvvz";
|
||||||
|
return env->NewStringUTF(bugly.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_service_mqtt_MqttConfig_getMqttGroupId(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string bugly = "GID_ZDJY";
|
||||||
|
return env->NewStringUTF(bugly.c_str());
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_za_service_mqtt_MqttConfig_getMqttTopicPrefix(JNIEnv *env, jobject thiz) {
|
||||||
|
std::string bugly = "pushBaseTopic/p2p";
|
||||||
|
return env->NewStringUTF(bugly.c_str());
|
||||||
|
}
|
@ -13,7 +13,6 @@ import androidx.compose.material3.Scaffold
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import com.za.base.view.CommonButton
|
import com.za.base.view.CommonButton
|
||||||
import com.za.common.log.LogUtil
|
|
||||||
import com.za.sdk.demo.ui.theme.Zd_sdk_demoTheme
|
import com.za.sdk.demo.ui.theme.Zd_sdk_demoTheme
|
||||||
import com.za.ui.main.ServiceLauncherActivity
|
import com.za.ui.main.ServiceLauncherActivity
|
||||||
|
|
||||||
@ -33,8 +32,7 @@ class ActionActivity : ComponentActivity() {
|
|||||||
val phone = intent.data?.getQueryParameter("driverPhone")
|
val phone = intent.data?.getQueryParameter("driverPhone")
|
||||||
val taskCode = intent.data?.getQueryParameter("taskCode")
|
val taskCode = intent.data?.getQueryParameter("taskCode")
|
||||||
val vehicleName = intent.data?.getQueryParameter("rescueVehicle")
|
val vehicleName = intent.data?.getQueryParameter("rescueVehicle")
|
||||||
LogUtil.print("参数",
|
|
||||||
"name:$name,phone:$phone,taskCode:$taskCode,vehicleName:$vehicleName")
|
|
||||||
|
|
||||||
Log.e("ActionActivity",
|
Log.e("ActionActivity",
|
||||||
"name:$name,phone:$phone,taskCode:$taskCode,vehicleName:$vehicleName")
|
"name:$name,phone:$phone,taskCode:$taskCode,vehicleName:$vehicleName")
|
||||||
|
@ -27,7 +27,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.clickable {
|
.clickable {
|
||||||
val uri =
|
val uri =
|
||||||
"zd.assist://app?taskCode=ZD250521100686&driverName=宋志领&driverPhone=17630035658&rescueVehicle=沪88888".toUri()
|
"zd.assist://app?taskCode=ZD250708100532&driverName=宋志领&driverPhone=17630035658&rescueVehicle=沪88888".toUri()
|
||||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
15
build.gradle
15
build.gradle
@ -1,7 +1,14 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
//plugins {
|
||||||
|
// id(libs.plugins.android.application) apply false
|
||||||
|
// id(libs.plugins.jetbrains.kotlin.android) apply false
|
||||||
|
// id(libs.plugins.android.library) apply false
|
||||||
|
// id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
|
||||||
|
//}
|
||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application) apply false
|
id 'com.android.application' version '8.2.2' apply false
|
||||||
alias(libs.plugins.jetbrains.kotlin.android) apply false
|
id 'com.android.library' version '8.2.2' apply false
|
||||||
alias(libs.plugins.android.library) apply false
|
id 'org.jetbrains.kotlin.android' version '1.9.25' apply false
|
||||||
id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
|
id 'com.google.devtools.ksp' version "1.9.0-1.0.13" apply false
|
||||||
}
|
}
|
@ -48,6 +48,7 @@ activity = "1.10.0"
|
|||||||
xz = "1.9"
|
xz = "1.9"
|
||||||
exifinterface = "1.3.7"
|
exifinterface = "1.3.7"
|
||||||
uiToolingVersion = "1.4.0"
|
uiToolingVersion = "1.4.0"
|
||||||
|
roomCompiler = "2.7.2"
|
||||||
[libraries]
|
[libraries]
|
||||||
accompanist-pager = { module = "com.google.accompanist:accompanist-pager", version.ref = "accompanistPager" }
|
accompanist-pager = { module = "com.google.accompanist:accompanist-pager", version.ref = "accompanistPager" }
|
||||||
accompanist-pager-indicators = { module = "com.google.accompanist:accompanist-pager-indicators", version.ref = "accompanistPager" }
|
accompanist-pager-indicators = { module = "com.google.accompanist:accompanist-pager-indicators", version.ref = "accompanistPager" }
|
||||||
@ -106,6 +107,7 @@ androidx-activity = { group = "androidx.activity", name = "activity", version.re
|
|||||||
xz = { module = "org.tukaani:xz", version.ref = "xz" }
|
xz = { module = "org.tukaani:xz", version.ref = "xz" }
|
||||||
androidx-exifinterface = { group = "androidx.exifinterface", name = "exifinterface", version.ref = "exifinterface" }
|
androidx-exifinterface = { group = "androidx.exifinterface", name = "exifinterface", version.ref = "exifinterface" }
|
||||||
ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "uiToolingVersion" }
|
ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "uiToolingVersion" }
|
||||||
|
androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "roomCompiler" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
import com.android.build.gradle.LibraryExtension
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.library)
|
alias(libs.plugins.android.library)
|
||||||
alias(libs.plugins.jetbrains.kotlin.android)
|
|
||||||
id 'com.google.devtools.ksp'
|
id 'com.google.devtools.ksp'
|
||||||
|
alias(libs.plugins.jetbrains.kotlin.android)
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
// kotlin 序列化注解
|
// kotlin 序列化注解
|
||||||
id 'kotlin-parcelize'
|
id 'kotlin-parcelize'
|
||||||
@ -19,6 +21,12 @@ android {
|
|||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
useSupportLibrary true
|
useSupportLibrary true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ndk {
|
||||||
|
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
||||||
|
}
|
||||||
|
|
||||||
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -31,7 +39,6 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
|
|
||||||
// publishNonDefault true
|
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
@ -48,9 +55,17 @@ android {
|
|||||||
composeOptions {
|
composeOptions {
|
||||||
kotlinCompilerExtensionVersion '1.5.15'
|
kotlinCompilerExtensionVersion '1.5.15'
|
||||||
}
|
}
|
||||||
|
if (project.extensions.getByName("android") is LibraryExtension) {
|
||||||
|
// AGP 7.0+
|
||||||
packaging {
|
packaging {
|
||||||
resources {
|
resources {
|
||||||
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
excludes += "META-INF/LICENSE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// AGP 6.x
|
||||||
|
packagingOptions {
|
||||||
|
exclude("META-INF/LICENSE")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
publishing {
|
publishing {
|
||||||
@ -64,7 +79,7 @@ publishing {
|
|||||||
release(MavenPublication) {
|
release(MavenPublication) {
|
||||||
groupId = 'io.github.szl9'
|
groupId = 'io.github.szl9'
|
||||||
artifactId = 'zd_servicing'
|
artifactId = 'zd_servicing'
|
||||||
version = "1.0.1.9.9.138"
|
version = "1.0.3"
|
||||||
|
|
||||||
pom {
|
pom {
|
||||||
packaging = "aar"
|
packaging = "aar"
|
||||||
@ -135,81 +150,87 @@ tasks.register('generateRepo', Zip) {
|
|||||||
into 'zd_servicing'
|
into 'zd_servicing'
|
||||||
archiveFileName.set('zd_servicing.zip')
|
archiveFileName.set('zd_servicing.zip')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api libs.androidx.core.ktx
|
api "androidx.core:core-ktx:1.15.0" // coreKtx = "1.15.0"
|
||||||
api libs.androidx.appcompat
|
api "androidx.appcompat:appcompat:1.7.0" // appcompat = "1.7.0"
|
||||||
api libs.material
|
api "com.google.android.material:material:1.12.0" // material = "1.12.0"
|
||||||
api libs.androidx.lifecycle.viewmodel.compose
|
api "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7" // lifecycleRuntimeKtx = "2.8.7"
|
||||||
api libs.androidx.lifecycle.runtime.ktx
|
api "androidx.lifecycle:lifecycle-runtime-ktx:2.8.7" // lifecycleRuntimeKtx = "2.8.7"
|
||||||
api libs.androidx.activity.compose
|
api "androidx.activity:activity-compose:1.10.0" // activityCompose = "1.10.0"
|
||||||
api platform(libs.androidx.compose.bom)
|
api platform("androidx.compose:compose-bom:2025.01.01") // composeBom = "2025.01.01"
|
||||||
api libs.androidx.ui
|
api "androidx.compose.ui:ui:1.7.7" // uiVersion = "1.7.7"
|
||||||
api libs.androidx.ui.graphics
|
api "androidx.compose.ui:ui-graphics:1.7.7" // uiGraphics = "1.7.7"
|
||||||
api libs.androidx.ui.tooling.preview
|
api "androidx.compose.ui:ui-tooling-preview:1.7.7" // uiToolingPreview = "1.7.7"
|
||||||
api libs.androidx.material3
|
api "androidx.compose.material3:material3:1.3.1" // material3="1.3.1"
|
||||||
api libs.androidx.work.runtime.ktx
|
api "androidx.work:work-runtime-ktx:2.10.0" // workRuntimeKtx = "2.10.0"
|
||||||
api libs.androidx.exifinterface
|
api "androidx.exifinterface:exifinterface:1.3.7" // exifinterface = "1.3.7"
|
||||||
|
|
||||||
testApi libs.junit
|
testApi "junit:junit:4.13.2" // junit = "4.13.2"
|
||||||
androidTestApi libs.androidx.junit
|
androidTestApi "androidx.test.ext:junit:1.2.1" // junitVersion = "1.2.1"
|
||||||
androidTestApi libs.androidx.espresso.core
|
androidTestApi "androidx.test.espresso:espresso-core:3.6.1" // espressoCore = "3.6.1"
|
||||||
androidTestApi platform(libs.androidx.compose.bom)
|
androidTestApi platform("androidx.compose:compose-bom:2025.01.01") // composeBom = "2025.01.01"
|
||||||
androidTestApi libs.androidx.ui.test.junit4
|
androidTestApi "androidx.compose.ui:ui-test-junit4:1.7.7" // uiGraphics = "1.7.7"
|
||||||
debugApi libs.androidx.ui.test.manifest
|
debugApi "androidx.compose.ui:ui-test-manifest:1.7.7" // uiGraphics = "1.7.7"
|
||||||
debugApi libs.ui.tooling
|
debugApi "androidx.compose.ui:ui-tooling:1.4.0"
|
||||||
|
// From [libraries] ui-tooling, version.ref = "uiToolingVersion", and [versions] uiToolingVersion = "1.4.0"
|
||||||
|
|
||||||
api libs.coil.compose
|
api "io.coil-kt:coil-compose:2.6.0" // coilCompose = "2.6.0"
|
||||||
api libs.coil.gif
|
api "io.coil-kt:coil-gif:2.6.0" // coilCompose = "2.6.0"
|
||||||
|
|
||||||
api libs.permissionx
|
api "com.guolindev.permissionx:permissionx:1.8.0" // permissionx = "1.8.0"
|
||||||
api libs.utilcodex
|
api "com.blankj:utilcodex:1.31.1" // utilcodex = "1.31.1"
|
||||||
|
|
||||||
api libs.crashreport
|
api "com.tencent.bugly:crashreport:4.0.4" // crashreport = "4.0.4"
|
||||||
|
|
||||||
// 高德地图
|
// 高德地图
|
||||||
api libs.xdmap
|
api "com.amap.api:3dmap:8.1.0" // xdmap = "8.1.0"
|
||||||
api libs.location
|
api "com.amap.api:location:5.6.1" // location = "5.6.1"
|
||||||
api libs.search
|
api "com.amap.api:search:7.3.0" // search = "7.3.0"
|
||||||
|
|
||||||
// // JPush
|
// JPush
|
||||||
api libs.jpush
|
api "cn.jiguang.sdk:jpush:5.6.0" // jpush = "5.6.0"
|
||||||
api libs.gson
|
api "com.google.code.gson:gson:2.11.0" // gson = "2.11.0"
|
||||||
|
|
||||||
// 网络
|
// 网络
|
||||||
api libs.retrofit
|
api "com.squareup.retrofit2:retrofit:2.9.0" // retrofit = "2.9.0"
|
||||||
api libs.converter.gson
|
api "com.squareup.retrofit2:converter-gson:2.9.0" // converterGson = "2.9.0"
|
||||||
api libs.adapter.rxjava3
|
api "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
|
||||||
api libs.rxjava
|
// From [libraries] adapter-rxjava3, version.ref = "converterGson"
|
||||||
api libs.rxandroid
|
api "io.reactivex.rxjava3:rxjava:3.1.7" // rxjava = "3.1.7"
|
||||||
api libs.logging.interceptor
|
api "io.reactivex.rxjava3:rxandroid:3.0.2" // rxandroid = "3.0.2"
|
||||||
api libs.fastjson
|
api "com.squareup.okhttp3:logging-interceptor:4.11.0" // loggingInterceptor = "4.11.0"
|
||||||
|
api "com.alibaba:fastjson:1.2.69" // fastjson = "1.2.69"
|
||||||
|
|
||||||
// 本地数据
|
// 本地数据
|
||||||
api libs.room.runtime
|
api "androidx.room:room-runtime:2.6.1" // roomRuntimeVersion = "2.6.1"
|
||||||
annotationProcessor libs.room.compiler
|
annotationProcessor "androidx.room:room-compiler:2.6.1" // roomCompilerVersion = "2.6.1"
|
||||||
ksp libs.room.compiler
|
ksp "androidx.room:room-compiler:2.6.1" // roomCompilerVersion = "2.6.1"
|
||||||
api libs.mmkv
|
api "com.tencent:mmkv:1.3.11" // mmkv = "1.3.11"
|
||||||
|
|
||||||
// 7z
|
// 7z
|
||||||
api libs.xz
|
api "org.tukaani:xz:1.9" // xz = "1.9"
|
||||||
api libs.commons.compress
|
api "org.apache.commons:commons-compress:1.23.0" // commonsCompress = "1.23.0"
|
||||||
|
|
||||||
api libs.core
|
api "com.google.zxing:core:3.5.3" // core = "3.5.3"
|
||||||
api libs.tbssdk
|
api "com.tencent.tbs:tbssdk:44286" // tbssdk = "44286"
|
||||||
|
|
||||||
// CameraX
|
// CameraX - Assuming all camera dependencies use 'cameraCore' version
|
||||||
api libs.androidx.camera.core
|
api "androidx.camera:camera-core:1.4.1" // cameraCore = "1.4.1"
|
||||||
api libs.androidx.camera.camera2
|
api "androidx.camera:camera-camera2:1.4.1" // cameraCore = "1.4.1"
|
||||||
api libs.androidx.camera.lifecycle
|
api "androidx.camera:camera-lifecycle:1.4.1" // cameraCore = "1.4.1"
|
||||||
api libs.androidx.camera.view
|
api "androidx.camera:camera-view:1.4.1" // cameraCore = "1.4.1"
|
||||||
api libs.androidx.camera.extensions
|
api "androidx.camera:camera-extensions:1.4.1" // cameraCore = "1.4.1"
|
||||||
|
|
||||||
api libs.glide
|
api "com.github.bumptech.glide:glide:4.16.0" // glide = "4.16.0"
|
||||||
annotationProcessor libs.compiler
|
annotationProcessor "com.github.bumptech.glide:compiler:4.14.2" // compiler = "4.14.2"
|
||||||
|
|
||||||
api libs.org.eclipse.paho.client.mqttv3
|
api "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5"
|
||||||
api libs.org.eclipse.paho.android.service
|
// orgEclipsePahoClientMqttv3 = "1.2.5"
|
||||||
|
api "org.eclipse.paho:org.eclipse.paho.android.service:1.1.1"
|
||||||
|
// orgEclipsePahoAndroidService = "1.1.1"
|
||||||
|
|
||||||
api libs.face.detection
|
api "com.google.mlkit:face-detection:16.1.7" // faceDetection = "16.1.7"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
servicing/proguard-rules.pro
vendored
6
servicing/proguard-rules.pro
vendored
@ -1,5 +1,11 @@
|
|||||||
-dontwarn java.lang.invoke.StringConcatFactory
|
-dontwarn java.lang.invoke.StringConcatFactory
|
||||||
|
|
||||||
|
# 设置混淆的压缩比率 0 ~ 7
|
||||||
|
-optimizationpasses 5
|
||||||
|
|
||||||
|
# 混淆采用的算法
|
||||||
|
-optimizations !code/simplification/cast,!field/*,!class/merging/*
|
||||||
|
|
||||||
# 保留行号用于调试
|
# 保留行号用于调试
|
||||||
-keepattributes SourceFile,LineNumberTable
|
-keepattributes SourceFile,LineNumberTable
|
||||||
-renamesourcefileattribute SourceFile
|
-renamesourcefileattribute SourceFile
|
||||||
|
@ -226,6 +226,12 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.Dealer" />
|
android:theme="@style/Theme.Dealer" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.amap.api.location.APSService"
|
||||||
|
android:exported="false"
|
||||||
|
android:foregroundServiceType="location"
|
||||||
|
android:process=":aps" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.za.service.ZdPushServiceReceive"
|
android:name="com.za.service.ZdPushServiceReceive"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
|
@ -3,7 +3,7 @@ package com.za.base
|
|||||||
import com.za.common.GlobalData
|
import com.za.common.GlobalData
|
||||||
import com.za.net.RetrofitHelper
|
import com.za.net.RetrofitHelper
|
||||||
|
|
||||||
object AppConfig {
|
internal object AppConfig {
|
||||||
var isRelease = false
|
var isRelease = false
|
||||||
|
|
||||||
// API 相关地址
|
// API 相关地址
|
||||||
@ -52,14 +52,14 @@ object AppConfig {
|
|||||||
fun release() {
|
fun release() {
|
||||||
isRelease = true // API 配置
|
isRelease = true // API 配置
|
||||||
GlobalData.networkEnv = Const.NetEnv.Main
|
GlobalData.networkEnv = Const.NetEnv.Main
|
||||||
BASE_URL = "https://api.sinoassist.com"
|
BASE_URL = getReleaseBaseUrl()
|
||||||
IMG_BASE_URL = "https://api.sinoassist.com"
|
IMG_BASE_URL = getReleaseImgBaseUrl()
|
||||||
Resource_URL = "https://www.sinoassist.com/res"
|
Resource_URL = getReleaseResourceUrl()
|
||||||
|
|
||||||
// H5 配置
|
// H5 配置
|
||||||
trainUrl = "https://www.sinoassist.com/h5/supplier/dispatch/diverTrainDocment"
|
trainUrl = getReleaseTrainUrl()
|
||||||
documentUrl = "https://www.sinoassist.com/h5/supplier/dispatch/docmentList"
|
documentUrl = getReleaseDocumentUrl()
|
||||||
newDriverTrainUrl = "https://www.sinoassist.com/h5/supplier/dispatch/driverTrainingList";
|
newDriverTrainUrl = getReleaseNewDriverTrainUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -71,13 +71,12 @@ object AppConfig {
|
|||||||
GlobalData.networkEnv = Const.NetEnv.Review
|
GlobalData.networkEnv = Const.NetEnv.Review
|
||||||
|
|
||||||
// API 配置
|
// API 配置
|
||||||
BASE_URL = "http://interface.review.sino-assist.com"
|
BASE_URL = getReviewBaseUrl()
|
||||||
IMG_BASE_URL = "http://interface.review.sino-assist.com"
|
IMG_BASE_URL = getReviewImgBaseUrl()
|
||||||
Resource_URL = "https://www.sinoassist.com/res"
|
Resource_URL = getReviewResourceUrl()
|
||||||
documentUrl = "http://interface.review.sino-assist.com/h5/supplier/dispatch/docmentList"
|
documentUrl = getReviewDocumentUrl()
|
||||||
trainUrl = "http://interface.review.sino-assist.com/h5/supplier/dispatch/diverTrainDocment"
|
trainUrl = getReviewTrainUrl()
|
||||||
newDriverTrainUrl =
|
newDriverTrainUrl = getReviewNewDriverTrainUrl()
|
||||||
"http://interface.review.sino-assist.com/h5/supplier/dispatch/driverTrainingList"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,13 +87,13 @@ object AppConfig {
|
|||||||
GlobalData.networkEnv = Const.NetEnv.CRM1
|
GlobalData.networkEnv = Const.NetEnv.CRM1
|
||||||
|
|
||||||
// API 配置
|
// API 配置
|
||||||
BASE_URL = "https://api1.sino-assist.com"
|
BASE_URL = getCrm1BaseUrl()
|
||||||
IMG_BASE_URL = "https://api1.sino-assist.com"
|
IMG_BASE_URL = getCrm1ImgBaseUrl()
|
||||||
Resource_URL = "https://crm1.sino-assist.com/res"
|
Resource_URL = getCrm1ResourceUrl()
|
||||||
|
|
||||||
documentUrl = "https://crm1.sino-assist.com/h5/supplier/dispatch/docmentList";
|
documentUrl = getCrm1DocumentUrl()
|
||||||
trainUrl = "https://crm1.sino-assist.com/h5/supplier/dispatch/diverTrainDocment";
|
trainUrl = getCrm1TrainUrl()
|
||||||
newDriverTrainUrl = "https://crm1.sino-assist.com/h5/supplier/dispatch/driverTrainingList";
|
newDriverTrainUrl = getCrm1NewDriverTrainUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,9 +104,9 @@ object AppConfig {
|
|||||||
GlobalData.networkEnv = Const.NetEnv.CRM2
|
GlobalData.networkEnv = Const.NetEnv.CRM2
|
||||||
|
|
||||||
// API 配置
|
// API 配置
|
||||||
BASE_URL = "https://api2.sino-assist.com"
|
BASE_URL = getCrm2BaseUrl()
|
||||||
IMG_BASE_URL = "https://api2.sino-assist.com"
|
IMG_BASE_URL = getCrm2ImgBaseUrl()
|
||||||
Resource_URL = "https://crm2.sino-assist.com/res"
|
Resource_URL = getCrm2ResourceUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -115,15 +114,12 @@ object AppConfig {
|
|||||||
isRelease = false
|
isRelease = false
|
||||||
GlobalData.networkEnv = Const.NetEnv.UAT
|
GlobalData.networkEnv = Const.NetEnv.UAT
|
||||||
|
|
||||||
BASE_URL = "https://api-uat.sino-assist.com" //crm2
|
BASE_URL = getUatBaseUrl()
|
||||||
IMG_BASE_URL = "https://api-uat.sino-assist.com"
|
IMG_BASE_URL = getUatImgBaseUrl()
|
||||||
Resource_URL = "https://uat.sino-assist.com/res"
|
Resource_URL = getUatResourceUrl()
|
||||||
documentUrl = "https://uat.sino-assist.com/h5/supplier/dispatch/docmentList"
|
documentUrl = getUatDocumentUrl()
|
||||||
trainUrl = "https://uat.sino-assist.com/h5/supplier/dispatch/diverTrainDocment"
|
trainUrl = getUatTrainUrl()
|
||||||
newDriverTrainUrl = "https://uat.sino-assist.com/h5/supplier/dispatch/driverTrainingList"
|
newDriverTrainUrl = getUatNewDriverTrainUrl()
|
||||||
documentUrl = "https://uat.sino-assist.com/h5/supplier/dispatch/docmentList";
|
|
||||||
trainUrl = "https://uat.sino-assist.com/h5/supplier/dispatch/diverTrainDocment";
|
|
||||||
newDriverTrainUrl = "https://uat.sino-assist.com/h5/supplier/dispatch/driverTrainingList";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -151,4 +147,42 @@ object AppConfig {
|
|||||||
}
|
}
|
||||||
return documentUrl + "?token=${GlobalData.token}&driverId=${GlobalData.driverInfoBean?.userId}&keyword=$keyWord"
|
return documentUrl + "?token=${GlobalData.token}&driverId=${GlobalData.driverInfoBean?.userId}&keyword=$keyWord"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private external fun getReleaseBaseUrl() : String
|
||||||
|
private external fun getReleaseImgBaseUrl() : String
|
||||||
|
private external fun getReleaseResourceUrl() : String
|
||||||
|
private external fun getReleaseTrainUrl() : String
|
||||||
|
private external fun getReleaseDocumentUrl() : String
|
||||||
|
private external fun getReleaseNewDriverTrainUrl() : String
|
||||||
|
|
||||||
|
private external fun getReviewBaseUrl() : String
|
||||||
|
private external fun getReviewImgBaseUrl() : String
|
||||||
|
private external fun getReviewResourceUrl() : String
|
||||||
|
private external fun getReviewTrainUrl() : String
|
||||||
|
private external fun getReviewDocumentUrl() : String
|
||||||
|
private external fun getReviewNewDriverTrainUrl() : String
|
||||||
|
|
||||||
|
|
||||||
|
private external fun getCrm1BaseUrl() : String
|
||||||
|
private external fun getCrm1ImgBaseUrl() : String
|
||||||
|
private external fun getCrm1ResourceUrl() : String
|
||||||
|
private external fun getCrm1TrainUrl() : String
|
||||||
|
private external fun getCrm1DocumentUrl() : String
|
||||||
|
private external fun getCrm1NewDriverTrainUrl() : String
|
||||||
|
|
||||||
|
private external fun getCrm2BaseUrl() : String
|
||||||
|
private external fun getCrm2ImgBaseUrl() : String
|
||||||
|
private external fun getCrm2ResourceUrl() : String
|
||||||
|
private external fun getCrm2TrainUrl() : String
|
||||||
|
private external fun getCrm2DocumentUrl() : String
|
||||||
|
private external fun getCrm2NewDriverTrainUrl() : String
|
||||||
|
|
||||||
|
private external fun getUatBaseUrl() : String
|
||||||
|
private external fun getUatImgBaseUrl() : String
|
||||||
|
private external fun getUatResourceUrl() : String
|
||||||
|
private external fun getUatTrainUrl() : String
|
||||||
|
private external fun getUatDocumentUrl() : String
|
||||||
|
private external fun getUatNewDriverTrainUrl() : String
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.za.base
|
package com.za.base
|
||||||
|
|
||||||
interface AppForegroundListener {
|
internal interface AppForegroundListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP处于 前台
|
* APP处于 前台
|
||||||
|
@ -9,7 +9,7 @@ import com.za.common.GlobalData
|
|||||||
import com.za.common.log.LogUtil
|
import com.za.common.log.LogUtil
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
|
||||||
open class BaseActivityLifecycleCallbacks : ActivityLifecycleCallbacks {
|
internal class BaseActivityLifecycleCallbacks : ActivityLifecycleCallbacks {
|
||||||
|
|
||||||
|
|
||||||
override fun onActivityCreated(activity : Activity, savedInstanceState : Bundle?) {
|
override fun onActivityCreated(activity : Activity, savedInstanceState : Bundle?) {
|
||||||
|
@ -5,7 +5,7 @@ import androidx.lifecycle.ViewModel
|
|||||||
|
|
||||||
val showTipDialog = mutableStateOf<String?>(null) //提示框
|
val showTipDialog = mutableStateOf<String?>(null) //提示框
|
||||||
|
|
||||||
abstract class BaseVm<T, U> : ViewModel() {
|
internal abstract class BaseVm<T, U> : ViewModel() {
|
||||||
val tag : String = javaClass.simpleName
|
val tag : String = javaClass.simpleName
|
||||||
abstract fun updateState(uiState : U)
|
abstract fun updateState(uiState : U)
|
||||||
abstract fun dispatch(action : T)
|
abstract fun dispatch(action : T)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.za.base
|
package com.za.base
|
||||||
|
|
||||||
object Const {
|
internal object Const {
|
||||||
const val Image_Max_length = 1024 * 400L
|
const val Image_Max_length = 1024 * 400L
|
||||||
const val faceFileName = "zd_com.dear"
|
const val faceFileName = "zd_com.dear"
|
||||||
const val NetWorkException = 999
|
const val NetWorkException = 999
|
||||||
|
@ -12,7 +12,7 @@ import com.za.offline.OfflineManager
|
|||||||
import com.za.offline.OfflineUpdateTaskBean
|
import com.za.offline.OfflineUpdateTaskBean
|
||||||
import com.za.room.RoomHelper
|
import com.za.room.RoomHelper
|
||||||
|
|
||||||
abstract class IServicingVm<T, U> : BaseVm<T, U>() {
|
internal abstract class IServicingVm<T, U> : BaseVm<T, U>() {
|
||||||
|
|
||||||
fun getCurrentOrder() : OrderInfo? =
|
fun getCurrentOrder() : OrderInfo? =
|
||||||
GlobalData.currentOrder ?: RoomHelper.db?.orderDao()?.getCurrentOrder()
|
GlobalData.currentOrder ?: RoomHelper.db?.orderDao()?.getCurrentOrder()
|
||||||
|
@ -106,7 +106,7 @@ enum class DetectionStatus {
|
|||||||
ABNORMAL // 异常
|
ABNORMAL // 异常
|
||||||
}
|
}
|
||||||
|
|
||||||
class NetworkRouteSelectionActivity : BaseActivity() {
|
internal class NetworkRouteSelectionActivity : BaseActivity() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
NetworkRouteScreen(telephonyManager = getSystemService(TELEPHONY_SERVICE) as TelephonyManager,
|
NetworkRouteScreen(telephonyManager = getSystemService(TELEPHONY_SERVICE) as TelephonyManager,
|
||||||
|
@ -7,7 +7,6 @@ import androidx.appcompat.app.AlertDialog
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.za.bean.JpushBean
|
import com.za.bean.JpushBean
|
||||||
import com.za.common.GlobalData
|
|
||||||
import com.za.common.log.LogUtil
|
import com.za.common.log.LogUtil
|
||||||
import com.za.service.PushListener
|
import com.za.service.PushListener
|
||||||
import com.za.service.ServiceManager
|
import com.za.service.ServiceManager
|
||||||
@ -82,7 +81,7 @@ open class PushMessageActivity : AppCompatActivity() {
|
|||||||
currentDialog?.dismiss()
|
currentDialog?.dismiss()
|
||||||
currentDialog = null
|
currentDialog = null
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
LogUtil.print("PushActivityLifecycleCallbacks", "关闭对话框失败: ${e.message}")
|
LogUtil.print("PushMessageActivity", "关闭对话框失败: ${e.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,10 +90,11 @@ open class PushMessageActivity : AppCompatActivity() {
|
|||||||
internal const val DIALOG_TAG_GIVE_UP = "giveUp"
|
internal const val DIALOG_TAG_GIVE_UP = "giveUp"
|
||||||
|
|
||||||
private fun sendMessageToMainProcess(context : Context, type : String, message : String) {
|
private fun sendMessageToMainProcess(context : Context, type : String, message : String) {
|
||||||
|
val intent = if (context.packageName == "com.za.rescue.dealer") {
|
||||||
// 使用广播将消息发送到主进程
|
Intent(Const.PushMessageType.ACTION_MAIN)
|
||||||
val intent = Intent(Const.PushMessageType.ACTION_MAIN.takeIf { GlobalData.isMaster }
|
} else {
|
||||||
?: Const.PushMessageType.ACTION_SDK)
|
Intent(Const.PushMessageType.ACTION_SDK)
|
||||||
|
}
|
||||||
intent.setPackage(context.packageName)
|
intent.setPackage(context.packageName)
|
||||||
intent.putExtra("type", type)
|
intent.putExtra("type", type)
|
||||||
intent.putExtra("message", message)
|
intent.putExtra("message", message)
|
||||||
|
@ -19,72 +19,48 @@ import coil.compose.AsyncImage
|
|||||||
import com.za.servicing.R
|
import com.za.servicing.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun EmptyView(
|
fun EmptyView(modifier : Modifier = Modifier,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
message : String = "暂无数据",
|
message : String = "暂无数据",
|
||||||
imageSize : Pair<Int, Int> = Pair(118, 143),
|
imageSize : Pair<Int, Int> = Pair(118, 143),
|
||||||
imageRes: Int = R.drawable.sv_emty_data
|
imageRes : Int = R.drawable.sv_emty_data) {
|
||||||
) {
|
Column(modifier = modifier.fillMaxSize(),
|
||||||
Column(
|
|
||||||
modifier = modifier.fillMaxSize(),
|
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
) {
|
AsyncImage(model = imageRes,
|
||||||
AsyncImage(
|
|
||||||
model = imageRes,
|
|
||||||
contentDescription = message,
|
contentDescription = message,
|
||||||
modifier = Modifier.size(imageSize.first.dp, imageSize.second.dp)
|
modifier = Modifier.size(imageSize.first.dp, imageSize.second.dp))
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
|
|
||||||
Text(
|
Text(text = message, color = Color.Gray, fontSize = 14.sp, textAlign = TextAlign.Center)
|
||||||
text = message,
|
|
||||||
color = Color.Gray,
|
|
||||||
fontSize = 14.sp,
|
|
||||||
textAlign = TextAlign.Center
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LoadError(
|
fun LoadError(modifier : Modifier = Modifier,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
message : String = "加载出错",
|
message : String = "加载出错",
|
||||||
imageSize : Pair<Int, Int> = Pair(118, 143),
|
imageSize : Pair<Int, Int> = Pair(118, 143),
|
||||||
onRetry: (() -> Unit)? = null
|
onRetry : (() -> Unit)? = null) {
|
||||||
) {
|
Column(modifier = modifier.fillMaxSize(),
|
||||||
Column(
|
|
||||||
modifier = modifier.fillMaxSize(),
|
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
) {
|
AsyncImage(model = R.drawable.sv_load_error,
|
||||||
AsyncImage(
|
|
||||||
model = R.drawable.sv_load_error,
|
|
||||||
contentDescription = message,
|
contentDescription = message,
|
||||||
modifier = Modifier.size(imageSize.first.dp, imageSize.second.dp)
|
modifier = Modifier.size(imageSize.first.dp, imageSize.second.dp))
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
|
|
||||||
Text(
|
Text(text = message, color = Color.Gray, fontSize = 14.sp, textAlign = TextAlign.Center)
|
||||||
text = message,
|
|
||||||
color = Color.Gray,
|
|
||||||
fontSize = 14.sp,
|
|
||||||
textAlign = TextAlign.Center
|
|
||||||
)
|
|
||||||
|
|
||||||
if (onRetry != null) {
|
if (onRetry != null) {
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
Text(
|
Text(text = "点击重试",
|
||||||
text = "点击重试",
|
|
||||||
color = Color(0xFF1BA8F7),
|
color = Color(0xFF1BA8F7),
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.CenterHorizontally)
|
.align(Alignment.CenterHorizontally)
|
||||||
.clickable { onRetry() }
|
.clickable { onRetry() })
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ import com.za.net.RetrofitHelper
|
|||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
|
|
||||||
object CallLogManager {
|
internal object CallLogManager {
|
||||||
private const val TAG = "CallLogManager"
|
private const val TAG = "CallLogManager"
|
||||||
private var lastUploadTime : Long? = null
|
private var lastUploadTime : Long? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
|
@ -12,7 +12,7 @@ import com.za.room.RoomHelper
|
|||||||
import com.za.room.db.user.DriverInfoBean
|
import com.za.room.db.user.DriverInfoBean
|
||||||
import com.za.service.location.ZdLocationManager
|
import com.za.service.location.ZdLocationManager
|
||||||
|
|
||||||
object GlobalData : GlobalLocalData() {
|
internal object GlobalData : GlobalLocalData() {
|
||||||
lateinit var application : Application
|
lateinit var application : Application
|
||||||
private val mmkv : MMKV by lazy { MMKV.defaultMMKV() }
|
private val mmkv : MMKV by lazy { MMKV.defaultMMKV() }
|
||||||
var activityCount : Int = 0
|
var activityCount : Int = 0
|
||||||
|
@ -11,6 +11,7 @@ import com.za.service.location.ZdLocationManager
|
|||||||
|
|
||||||
object ZDManager {
|
object ZDManager {
|
||||||
lateinit var application : Application
|
lateinit var application : Application
|
||||||
|
|
||||||
fun init(application : Application, isRelease : Boolean = false) {
|
fun init(application : Application, isRelease : Boolean = false) {
|
||||||
this.application = application
|
this.application = application
|
||||||
thirdSdkInit(isRelease)
|
thirdSdkInit(isRelease)
|
||||||
@ -20,10 +21,17 @@ object ZDManager {
|
|||||||
GlobalData.application = application
|
GlobalData.application = application
|
||||||
MMKV.initialize(application)
|
MMKV.initialize(application)
|
||||||
AppConfig.init(isRelease)
|
AppConfig.init(isRelease)
|
||||||
Bugly.init(application, "6972a6b56d", true)
|
Bugly.init(application, getBuglyAppId(), true)
|
||||||
LogUtil.init(application)
|
LogUtil.init(application)
|
||||||
RoomHelper.init(application)
|
RoomHelper.init(application)
|
||||||
ZdLocationManager.init(application)
|
ZdLocationManager.init(application)
|
||||||
SpeechManager.init(application)
|
SpeechManager.init(application)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
init {
|
||||||
|
System.loadLibrary("config")
|
||||||
|
}
|
||||||
|
|
||||||
|
private external fun getBuglyAppId() : String
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import java.io.UnsupportedEncodingException
|
|||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
object LogRetrofitHelper {
|
internal object LogRetrofitHelper {
|
||||||
private var retrofit: Retrofit? = null
|
private var retrofit: Retrofit? = null
|
||||||
private var apiService: LogService? = null
|
private var apiService: LogService? = null
|
||||||
private val loggerInterceptor = HttpLoggingInterceptor {
|
private val loggerInterceptor = HttpLoggingInterceptor {
|
||||||
|
@ -7,7 +7,7 @@ import retrofit2.http.POST
|
|||||||
import retrofit2.http.Part
|
import retrofit2.http.Part
|
||||||
import retrofit2.http.Query
|
import retrofit2.http.Query
|
||||||
|
|
||||||
interface LogService {
|
internal interface LogService {
|
||||||
//日志上传
|
//日志上传
|
||||||
@Multipart
|
@Multipart
|
||||||
@POST("/oss/minio/upload")
|
@POST("/oss/minio/upload")
|
||||||
|
@ -32,7 +32,7 @@ import java.util.concurrent.ExecutorService
|
|||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
object LogUtil {
|
internal object LogUtil {
|
||||||
private var context : Application? = null
|
private var context : Application? = null
|
||||||
private var executors : ExecutorService? = null
|
private var executors : ExecutorService? = null
|
||||||
private var normalLogDirPath : String? = null
|
private var normalLogDirPath : String? = null
|
||||||
@ -113,6 +113,7 @@ object LogUtil {
|
|||||||
}
|
}
|
||||||
LogUtils.getConfig().setFilePrefix(this.vehicleName)
|
LogUtils.getConfig().setFilePrefix(this.vehicleName)
|
||||||
LogUtils.e("$tag---$content")
|
LogUtils.e("$tag---$content")
|
||||||
|
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
@ -1,122 +0,0 @@
|
|||||||
package com.za.common.speech
|
|
||||||
|
|
||||||
import android.media.MediaPlayer
|
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.JsonObject
|
|
||||||
import com.za.common.log.LogUtil
|
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import okhttp3.ResponseBody
|
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Retrofit
|
|
||||||
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory
|
|
||||||
import retrofit2.converter.gson.GsonConverterFactory
|
|
||||||
import retrofit2.http.Body
|
|
||||||
import retrofit2.http.POST
|
|
||||||
import java.io.File
|
|
||||||
import java.io.FileOutputStream
|
|
||||||
import java.io.IOException
|
|
||||||
|
|
||||||
interface SpeechApiService {
|
|
||||||
@POST("v1/audio/speech")
|
|
||||||
fun textToSpeech(@Body request: JsonObject): Call<ResponseBody>
|
|
||||||
}
|
|
||||||
|
|
||||||
object CustomerSpeechManager {
|
|
||||||
|
|
||||||
private const val BASE_URL = "http://192.168.3.129:8880/"
|
|
||||||
|
|
||||||
private val gson: Gson by lazy {
|
|
||||||
Gson().newBuilder()
|
|
||||||
.setLenient()
|
|
||||||
.create()
|
|
||||||
}
|
|
||||||
|
|
||||||
private val retrofit: Retrofit by lazy {
|
|
||||||
val loggingInterceptor = HttpLoggingInterceptor().apply {
|
|
||||||
level = HttpLoggingInterceptor.Level.BODY
|
|
||||||
}
|
|
||||||
|
|
||||||
val client = OkHttpClient.Builder()
|
|
||||||
.addInterceptor(loggingInterceptor)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
Retrofit.Builder()
|
|
||||||
.baseUrl(BASE_URL)
|
|
||||||
.client(client)
|
|
||||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
|
||||||
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
private val speechApiService: SpeechApiService by lazy {
|
|
||||||
retrofit.create(SpeechApiService::class.java)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun textToSpeech(input: String, destinationFile: File): Boolean {
|
|
||||||
val requestBody = JsonObject().apply {
|
|
||||||
addProperty("input", input)
|
|
||||||
addProperty("voice", "zf_xiaoxiao")
|
|
||||||
addProperty("response_format", "mp3")
|
|
||||||
addProperty("stream", true)
|
|
||||||
addProperty("speed", 1)
|
|
||||||
addProperty("return_download_link", false) // Set to false to get the stream directly
|
|
||||||
addProperty("lang_code", "z")
|
|
||||||
}
|
|
||||||
|
|
||||||
val call = speechApiService.textToSpeech(requestBody)
|
|
||||||
try {
|
|
||||||
val response = call.execute()
|
|
||||||
LogUtil.print("CustomerSpeechManager", "response: $response")
|
|
||||||
if (response.isSuccessful) {
|
|
||||||
val responseBody = response.body()
|
|
||||||
if (responseBody != null) {
|
|
||||||
saveToFile(responseBody, destinationFile)
|
|
||||||
playAudio(destinationFile)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LogUtil.print("CustomerSpeechManager", "Request failed: ${response.code()}")
|
|
||||||
}
|
|
||||||
} catch (e: IOException) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun saveToFile(body: ResponseBody, destinationFile: File) {
|
|
||||||
body.byteStream().use {
|
|
||||||
FileOutputStream(destinationFile).buffered().use { outputStream ->
|
|
||||||
val buffer = ByteArray(4096)
|
|
||||||
var bytesRead: Int
|
|
||||||
while (it.read(buffer).also { bytesRead = it } != -1) {
|
|
||||||
outputStream.write(buffer, 0, bytesRead)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun playAudio(file: File) {
|
|
||||||
val mediaPlayer = MediaPlayer().apply {
|
|
||||||
try {
|
|
||||||
setDataSource(file.absolutePath)
|
|
||||||
prepare()
|
|
||||||
start()
|
|
||||||
} catch (e: IOException) {
|
|
||||||
e.printStackTrace()
|
|
||||||
release()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mediaPlayer.setOnCompletionListener {
|
|
||||||
it.release()
|
|
||||||
}
|
|
||||||
|
|
||||||
mediaPlayer.setOnErrorListener { mp, what, extra ->
|
|
||||||
mp.release()
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ import kotlinx.coroutines.delay
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
object SpeechManager {
|
internal object SpeechManager {
|
||||||
private var mContext : Application? = null
|
private var mContext : Application? = null
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import java.util.Locale
|
|||||||
|
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
object TTSManager {
|
internal object TTSManager {
|
||||||
private var tts : TextToSpeech? = null
|
private var tts : TextToSpeech? = null
|
||||||
private var context : Context? = null
|
private var context : Context? = null
|
||||||
private var listener : OnTTSListener? = null
|
private var listener : OnTTSListener? = null
|
||||||
|
@ -95,7 +95,7 @@ import retrofit2.http.Multipart
|
|||||||
import retrofit2.http.POST
|
import retrofit2.http.POST
|
||||||
import retrofit2.http.Part
|
import retrofit2.http.Part
|
||||||
|
|
||||||
interface ApiService {
|
internal interface ApiService {
|
||||||
|
|
||||||
//获取车辆列表
|
//获取车辆列表
|
||||||
@POST("/driverApp/supplier/listVehicleNew")
|
@POST("/driverApp/supplier/listVehicleNew")
|
||||||
@ -236,35 +236,35 @@ interface ApiService {
|
|||||||
@POST("/driverApp/task/getTaskSettlementAndTrace")
|
@POST("/driverApp/task/getTaskSettlementAndTrace")
|
||||||
fun getTaskSettlementAndTrace(@Body info : HistoryDetailRequest) : Observable<BaseResponse<TaskSettlementAndTraceBean>>
|
fun getTaskSettlementAndTrace(@Body info : HistoryDetailRequest) : Observable<BaseResponse<TaskSettlementAndTraceBean>>
|
||||||
|
|
||||||
@POST("driverApp/task/updateSettleInfo")
|
@POST("/driverApp/task/updateSettleInfo")
|
||||||
fun updateSettleInfo(@Body settleInfoRequest : SettleInfoRequest) : Observable<BaseResponse<String>>
|
fun updateSettleInfo(@Body settleInfoRequest : SettleInfoRequest) : Observable<BaseResponse<String>>
|
||||||
|
|
||||||
|
|
||||||
//人脸比对
|
//人脸比对
|
||||||
@POST("driverApp/supplier/driverFaceCompare")
|
@POST("/driverApp/supplier/driverFaceCompare")
|
||||||
fun driverFaceCompare(@Body driverFaceCompareRequest : DriverFaceCompareRequest) : Observable<BaseResponse<DriverFaceCompareBean>>
|
fun driverFaceCompare(@Body driverFaceCompareRequest : DriverFaceCompareRequest) : Observable<BaseResponse<DriverFaceCompareBean>>
|
||||||
|
|
||||||
@POST("driverApp/supplier/driverIdentityAuthWeb")
|
@POST("/driverApp/supplier/driverIdentityAuthWeb")
|
||||||
fun driverIdentityAuthWeb(@Body request : DriverIdentityAuthWebRequest) : Observable<BaseResponse<DriverIdentityAuthWebBean>>
|
fun driverIdentityAuthWeb(@Body request : DriverIdentityAuthWebRequest) : Observable<BaseResponse<DriverIdentityAuthWebBean>>
|
||||||
|
|
||||||
//今日保养
|
//今日保养
|
||||||
@POST("driverApp/supplier/getTodayMaintain")
|
@POST("/driverApp/supplier/getTodayMaintain")
|
||||||
fun getTodayMaintain(@Body info : TodayMaintainRequest) : Observable<BaseResponse<List<TodayMaintainbean>>>
|
fun getTodayMaintain(@Body info : TodayMaintainRequest) : Observable<BaseResponse<List<TodayMaintainbean>>>
|
||||||
|
|
||||||
//今日保养
|
//今日保养
|
||||||
@POST("driverApp/supplier/uploadTodayMaintain")
|
@POST("/driverApp/supplier/uploadTodayMaintain")
|
||||||
fun uploadTodayMaintain(@Body params : TodayMaintainUploadRequest) : Observable<BaseResponse<String>>
|
fun uploadTodayMaintain(@Body params : TodayMaintainUploadRequest) : Observable<BaseResponse<String>>
|
||||||
|
|
||||||
//加油小票识别
|
//加油小票识别
|
||||||
@POST("driverApp/supplier/recognizeRefuelTicket")
|
@POST("/driverApp/supplier/recognizeRefuelTicket")
|
||||||
fun recognizeRefuelTicket(@Body bean : RecognizeRefuelOcrRequestBean?) : Observable<BaseResponse<RecognizeRefuelTicketBean>>
|
fun recognizeRefuelTicket(@Body bean : RecognizeRefuelOcrRequestBean?) : Observable<BaseResponse<RecognizeRefuelTicketBean>>
|
||||||
|
|
||||||
//提交加油记录
|
//提交加油记录
|
||||||
@POST("driverApp/supplier/vehicleRefuelSubmit")
|
@POST("/driverApp/supplier/vehicleRefuelSubmit")
|
||||||
fun vehicleRefuelSubmit(@Body info : RecognizeRefuelTicketRequestBean?) : Observable<BaseResponse<String>>
|
fun vehicleRefuelSubmit(@Body info : RecognizeRefuelTicketRequestBean?) : Observable<BaseResponse<String>>
|
||||||
|
|
||||||
//获取车辆维保记录
|
//获取车辆维保记录
|
||||||
@POST("driverApp/supplier/v2/getVehicleMaintenanceSubmit")
|
@POST("/driverApp/supplier/v2/getVehicleMaintenanceSubmit")
|
||||||
fun getVehicleMaintenanceSubmit(@Body info : FetchVehicleMaintenanceSubmitHistoryRequestBean) : Observable<BaseResponse<VehicleRepairBean>>
|
fun getVehicleMaintenanceSubmit(@Body info : FetchVehicleMaintenanceSubmitHistoryRequestBean) : Observable<BaseResponse<VehicleRepairBean>>
|
||||||
|
|
||||||
//获取车辆维保详细信息
|
//获取车辆维保详细信息
|
||||||
@ -272,31 +272,29 @@ interface ApiService {
|
|||||||
fun getVehicleRepairDetail(@Body info : FetchVehicleMaintenanceSubmitHistoryRequestBean) : Observable<BaseResponse<VehicleRepairBean>>
|
fun getVehicleRepairDetail(@Body info : FetchVehicleMaintenanceSubmitHistoryRequestBean) : Observable<BaseResponse<VehicleRepairBean>>
|
||||||
|
|
||||||
//维修地点匹配
|
//维修地点匹配
|
||||||
@POST("driverApp/supplier/v2/vehicleRepairPointMatcherList")
|
@POST("/driverApp/supplier/v2/vehicleRepairPointMatcherList")
|
||||||
fun vehicleRepairPointMatcherList(@Body info : VehicleRepairPointMatcherListRequest) : Observable<BaseResponse<List<VehicleRepairPointMatcherItem>>>
|
fun vehicleRepairPointMatcherList(@Body info : VehicleRepairPointMatcherListRequest) : Observable<BaseResponse<List<VehicleRepairPointMatcherItem>>>
|
||||||
|
|
||||||
//提交维保记录
|
//提交维保记录
|
||||||
@POST("driverApp/supplier/v2/vehicleMaintenanceSubmit")
|
@POST("/driverApp/supplier/v2/vehicleMaintenanceSubmit")
|
||||||
fun vehicleMaintenanceSubmit(@Body info : VehicleMaintenanceSubmitRequest) : Observable<BaseResponse<String>>
|
fun vehicleMaintenanceSubmit(@Body info : VehicleMaintenanceSubmitRequest) : Observable<BaseResponse<String>>
|
||||||
|
|
||||||
//获取车辆维修历史
|
//获取车辆维修历史
|
||||||
@POST("/driverApp/supplier/v2/vehicleMaintenanceList")
|
@POST("/driverApp/supplier/v2/vehicleMaintenanceList")
|
||||||
fun vehicleMaintenanceList(@Body info : FetchVehicleMaintenanceSubmitHistoryRequestBean) : Observable<BaseResponse<List<VehicleMaintenanceHistoryBean>>>
|
fun vehicleMaintenanceList(@Body info : FetchVehicleMaintenanceSubmitHistoryRequestBean) : Observable<BaseResponse<List<VehicleMaintenanceHistoryBean>>>
|
||||||
|
|
||||||
@POST("driverApp/base/getVoiceUrl")
|
@POST("/driverApp/base/getVoiceUrl")
|
||||||
fun getVoiceUrl(@Body info : AppNewOrderVoiceRequest) : Observable<BaseResponse<String>>
|
fun getVoiceUrl(@Body info : AppNewOrderVoiceRequest) : Observable<BaseResponse<String>>
|
||||||
|
|
||||||
@POST("driverApp/supplier/iaiCompareFace")
|
@POST("/driverApp/supplier/iaiCompareFace")
|
||||||
fun iaiCompareFace(@Body info : DriverFaceCompareRequest) : Observable<BaseResponse<IaiCompareFaceBean>>
|
fun iaiCompareFace(@Body info : DriverFaceCompareRequest) : Observable<BaseResponse<IaiCompareFaceBean>>
|
||||||
|
|
||||||
@POST("driverApp/task/getTaskNotes")
|
@POST("/driverApp/task/getTaskNotes")
|
||||||
fun getTaskNotes(@Body request : TaskNotesRequest) : Observable<BaseResponse<TaskNotesBean>>
|
fun getTaskNotes(@Body request : TaskNotesRequest) : Observable<BaseResponse<TaskNotesBean>>
|
||||||
|
|
||||||
@POST("driverApp/supplier/unifiedOCRWithCompress")
|
@POST("/driverApp/supplier/unifiedOCRWithCompress")
|
||||||
fun unifiedOCRWithCompress(@Body request : UnifiedOCRWithCompressRequest) : Observable<BaseResponse<String>>
|
fun unifiedOCRWithCompress(@Body request : UnifiedOCRWithCompressRequest) : Observable<BaseResponse<String>>
|
||||||
|
|
||||||
@POST("driverApp/v2/user/saveSignature")
|
@POST("/driverApp/v2/user/saveSignature")
|
||||||
fun saveSignature(@Body request : SaveSignatureRequest) : Observable<BaseResponse<String>>
|
fun saveSignature(@Body request : SaveSignatureRequest) : Observable<BaseResponse<String>>
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import javax.net.ssl.SSLHandshakeException
|
|||||||
/**
|
/**
|
||||||
* Created by DoggieX on 2017/7/26.
|
* Created by DoggieX on 2017/7/26.
|
||||||
*/
|
*/
|
||||||
abstract class BaseObserver<T> : Observer<BaseResponse<T>> {
|
internal abstract class BaseObserver<T> : Observer<BaseResponse<T>> {
|
||||||
override fun onSubscribe(d : Disposable) { // if (!NetworkUtils.isAvailable()) {
|
override fun onSubscribe(d : Disposable) { // if (!NetworkUtils.isAvailable()) {
|
||||||
// doFailure(999, "网络无法使用")
|
// doFailure(999, "网络无法使用")
|
||||||
// d.dispose()
|
// d.dispose()
|
||||||
|
@ -39,7 +39,7 @@ import okhttp3.MultipartBody
|
|||||||
import okhttp3.RequestBody.Companion.asRequestBody
|
import okhttp3.RequestBody.Companion.asRequestBody
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object CommonMethod {
|
internal object CommonMethod {
|
||||||
fun uploadGps(uploadGpsRequest : UploadGpsRequest,
|
fun uploadGps(uploadGpsRequest : UploadGpsRequest,
|
||||||
success : () -> Unit = {},
|
success : () -> Unit = {},
|
||||||
failed : (String?) -> Unit = {}) {
|
failed : (String?) -> Unit = {}) {
|
||||||
|
@ -6,7 +6,7 @@ import com.za.bean.db.order.PhotoTemplateInfo
|
|||||||
import com.za.common.log.LogUtil
|
import com.za.common.log.LogUtil
|
||||||
import com.za.servicing.R
|
import com.za.servicing.R
|
||||||
|
|
||||||
object LocalPhotoTemplateControl {
|
internal object LocalPhotoTemplateControl {
|
||||||
|
|
||||||
fun buildPhotoTemplate(orderInfo : OrderInfo?) : List<PhotoTemplateInfo> {
|
fun buildPhotoTemplate(orderInfo : OrderInfo?) : List<PhotoTemplateInfo> {
|
||||||
if (orderInfo == null) {
|
if (orderInfo == null) {
|
||||||
|
@ -26,12 +26,14 @@ import okio.Buffer;
|
|||||||
*/
|
*/
|
||||||
public class RequestEncryptInterceptor implements Interceptor {
|
public class RequestEncryptInterceptor implements Interceptor {
|
||||||
|
|
||||||
static final String PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7UM6zdWdBuO0DZZVkxVfJioawUe6qH1p5Uz/qR9zbawl2oWyxxcBfxQyPS+HxOej/ZnyS4bu7qhh99alDqkJzk6g9oGZWs+jEF5GRWt9nChlfUsjvHQwuF2TSQMTdPtDPCByF/QgMFCAfbCqTrNmOETrZ/2GFy1Re0BTlhh6X/XzpzqtK+enikEMlQ5fIM5ljdXgyCnvDou9ptWqzw8Zmsat6LeA0UKz+bgpJAbw6KfK+8lPMqUpNFfkmJuEd5+JQOG9McH7j9pBagohkC6k3Cn92dAf9iD6NSDKSNgt1vxXhaNnfAbYJ5pqeSGy6QMSVO0TXYj4asln5OutD/284QIDAQAB";
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(@NonNull Chain chain) throws IOException {
|
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||||
Request request = chain.request();
|
return chain.proceed(invoke(chain.request()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Request invoke(Request req) throws IOException {
|
||||||
|
Request request = req;
|
||||||
String method = request.method().toLowerCase().trim();
|
String method = request.method().toLowerCase().trim();
|
||||||
HttpUrl url = request.url();
|
HttpUrl url = request.url();
|
||||||
boolean skipEncrypt = url.encodedPath().endsWith("appVersion")
|
boolean skipEncrypt = url.encodedPath().endsWith("appVersion")
|
||||||
@ -87,7 +89,7 @@ public class RequestEncryptInterceptor implements Interceptor {
|
|||||||
|| url.encodedPath().endsWith("fastLogin")
|
|| url.encodedPath().endsWith("fastLogin")
|
||||||
|| url.encodedPath().endsWith("loginWithTask")) {
|
|| url.encodedPath().endsWith("loginWithTask")) {
|
||||||
|
|
||||||
byte[] bytes = RSAUtils.encryptByPublicKey(aesKey.getBytes(StandardCharsets.UTF_8), PUBLIC_KEY);
|
byte[] bytes = RSAUtils.encryptByPublicKey(aesKey.getBytes(StandardCharsets.UTF_8), getPublicKey());
|
||||||
String tokenSecret = Base64.encodeToString(bytes, Base64.NO_WRAP);
|
String tokenSecret = Base64.encodeToString(bytes, Base64.NO_WRAP);
|
||||||
requestBuilder.addHeader("secret", tokenSecret);
|
requestBuilder.addHeader("secret", tokenSecret);
|
||||||
} else {
|
} else {
|
||||||
@ -104,6 +106,10 @@ public class RequestEncryptInterceptor implements Interceptor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return chain.proceed(request);
|
|
||||||
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native String getPublicKey();
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.za.net
|
package com.za.net
|
||||||
|
|
||||||
import com.za.base.AppConfig
|
import com.za.base.AppConfig
|
||||||
|
import com.za.common.GlobalData
|
||||||
import com.za.common.log.LogUtil
|
import com.za.common.log.LogUtil
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
@ -11,7 +12,7 @@ import java.io.UnsupportedEncodingException
|
|||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
object RetrofitHelper {
|
internal object RetrofitHelper {
|
||||||
private var retrofit : Retrofit? = null
|
private var retrofit : Retrofit? = null
|
||||||
private var apiService : ApiService? = null
|
private var apiService : ApiService? = null
|
||||||
private val loggerInterceptor = HttpLoggingInterceptor {
|
private val loggerInterceptor = HttpLoggingInterceptor {
|
||||||
@ -29,8 +30,9 @@ object RetrofitHelper {
|
|||||||
if (it.contains("name=\"file\"; filename")) {
|
if (it.contains("name=\"file\"; filename")) {
|
||||||
return@HttpLoggingInterceptor
|
return@HttpLoggingInterceptor
|
||||||
}
|
}
|
||||||
LogUtil.print("--network--",
|
|
||||||
URLDecoder.decode(it.replace(Regex("%(?![0-9a-fA-F]{2})"), ""), "utf-8"))
|
// LogUtil.print("--network--",
|
||||||
|
// URLDecoder.decode(it.replace(Regex("%(?![0-9a-fA-F]{2})"), ""), "utf-8"))
|
||||||
} catch (e : UnsupportedEncodingException) {
|
} catch (e : UnsupportedEncodingException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import com.za.base.Const
|
|||||||
import com.za.room.db.GlobalRoom
|
import com.za.room.db.GlobalRoom
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
object RoomHelper {
|
internal object RoomHelper {
|
||||||
const val VERSION: Int = 43
|
const val VERSION: Int = 43
|
||||||
private lateinit var mContext: Context
|
private lateinit var mContext: Context
|
||||||
var db: GlobalRoom? = null
|
var db: GlobalRoom? = null
|
||||||
|
@ -26,7 +26,7 @@ import com.za.room.db.water_marker.WaterMarkerDao
|
|||||||
@Database(entities = [EleWorkOrderBean::class, EleCarDamagePhotoBean::class, LocalResourceBean::class, WaterMarkerTemplateBean::class, WaterMarkerItemBean::class, ChangeBatteryPhoto::class, NewPhotoTemplateBean::class, OrderInfo::class, OfflineUpdateTaskBean::class, PhotoTemplateInfo::class],
|
@Database(entities = [EleWorkOrderBean::class, EleCarDamagePhotoBean::class, LocalResourceBean::class, WaterMarkerTemplateBean::class, WaterMarkerItemBean::class, ChangeBatteryPhoto::class, NewPhotoTemplateBean::class, OrderInfo::class, OfflineUpdateTaskBean::class, PhotoTemplateInfo::class],
|
||||||
version = RoomHelper.VERSION,
|
version = RoomHelper.VERSION,
|
||||||
exportSchema = false)
|
exportSchema = false)
|
||||||
abstract class GlobalRoom : RoomDatabase() {
|
internal abstract class GlobalRoom : RoomDatabase() {
|
||||||
abstract fun eleWorkOrderDao() : EleWorkOrderDao
|
abstract fun eleWorkOrderDao() : EleWorkOrderDao
|
||||||
|
|
||||||
abstract fun eleCarDamagePhotoDao() : EleCarDamagePhotoDao
|
abstract fun eleCarDamagePhotoDao() : EleCarDamagePhotoDao
|
||||||
|
@ -9,7 +9,7 @@ import androidx.room.Update
|
|||||||
import com.za.bean.db.ele.EleCarDamagePhotoBean
|
import com.za.bean.db.ele.EleCarDamagePhotoBean
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface EleCarDamagePhotoDao {
|
internal interface EleCarDamagePhotoDao {
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE, entity = EleCarDamagePhotoBean::class)
|
@Insert(onConflict = OnConflictStrategy.REPLACE, entity = EleCarDamagePhotoBean::class)
|
||||||
fun insert(eleCarDamagePhotoBean: EleCarDamagePhotoBean)
|
fun insert(eleCarDamagePhotoBean: EleCarDamagePhotoBean)
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import androidx.room.Update
|
|||||||
import com.za.bean.db.ele.EleWorkOrderBean
|
import com.za.bean.db.ele.EleWorkOrderBean
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface EleWorkOrderDao {
|
internal interface EleWorkOrderDao {
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE, entity = EleWorkOrderBean::class)
|
@Insert(onConflict = OnConflictStrategy.REPLACE, entity = EleWorkOrderBean::class)
|
||||||
fun insertEleWorkOrder(eleWorkOrderBean: EleWorkOrderBean)
|
fun insertEleWorkOrder(eleWorkOrderBean: EleWorkOrderBean)
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import com.za.base.Const
|
|||||||
import com.za.bean.db.order.PhotoTemplateInfo
|
import com.za.bean.db.order.PhotoTemplateInfo
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface ChangeBatteryDao {
|
internal interface ChangeBatteryDao {
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE, entity = PhotoTemplateInfo::class)
|
@Insert(onConflict = OnConflictStrategy.REPLACE, entity = PhotoTemplateInfo::class)
|
||||||
fun insert(photoTemplateInfo: PhotoTemplateInfo)
|
fun insert(photoTemplateInfo: PhotoTemplateInfo)
|
||||||
|
@ -8,7 +8,7 @@ import androidx.room.Update
|
|||||||
import com.za.bean.db.order.OrderInfo
|
import com.za.bean.db.order.OrderInfo
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface OrderDao {
|
internal interface OrderDao {
|
||||||
//更换电瓶照片
|
//更换电瓶照片
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
fun insertOrder(orderInfo: OrderInfo)
|
fun insertOrder(orderInfo: OrderInfo)
|
||||||
|
@ -9,7 +9,7 @@ import com.za.base.Const
|
|||||||
import com.za.bean.db.order.PhotoTemplateInfo
|
import com.za.bean.db.order.PhotoTemplateInfo
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface PhotoTemplateDao {
|
internal interface PhotoTemplateDao {
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE, entity = PhotoTemplateInfo::class)
|
@Insert(onConflict = OnConflictStrategy.REPLACE, entity = PhotoTemplateInfo::class)
|
||||||
fun insert(photoTemplateInfo: PhotoTemplateInfo)
|
fun insert(photoTemplateInfo: PhotoTemplateInfo)
|
||||||
|
@ -35,7 +35,7 @@ interface PushListener {
|
|||||||
|
|
||||||
data class LastJPushBean(val msg : String, val time : Long = System.currentTimeMillis())
|
data class LastJPushBean(val msg : String, val time : Long = System.currentTimeMillis())
|
||||||
|
|
||||||
object ServiceManager {
|
internal object ServiceManager {
|
||||||
@Volatile
|
@Volatile
|
||||||
private var pushListener : PushListener? = null
|
private var pushListener : PushListener? = null
|
||||||
private var lastJPushBean : LastJPushBean? = null
|
private var lastJPushBean : LastJPushBean? = null
|
||||||
|
@ -43,7 +43,7 @@ class ZdPushServiceReceive : BroadcastReceiver() {
|
|||||||
if (ActivityUtils.getTopActivity() == null) {
|
if (ActivityUtils.getTopActivity() == null) {
|
||||||
AppUtils.launchApp(GlobalData.application.packageName)
|
AppUtils.launchApp(GlobalData.application.packageName)
|
||||||
}
|
}
|
||||||
LogUtil.print("PushActivityLifecycleCallbacks", "收到来自远程进程的消息: $type")
|
LogUtil.print("ZdPushServiceReceive", "收到来自远程进程的消息: $type")
|
||||||
when (type) {
|
when (type) {
|
||||||
Const.PushMessageType.BROADCAST -> handleBroadcast("broadcast:$message")
|
Const.PushMessageType.BROADCAST -> handleBroadcast("broadcast:$message")
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class ZdPushServiceReceive : BroadcastReceiver() {
|
|||||||
handleGiveUpOrder(activity, jpushBean)
|
handleGiveUpOrder(activity, jpushBean)
|
||||||
}
|
}
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
LogUtil.print("PushActivityLifecycleCallbacks",
|
LogUtil.print("ZdPushServiceReceive",
|
||||||
"处理订单放弃消息失败: ${e.message}")
|
"处理订单放弃消息失败: ${e.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ class ZdPushServiceReceive : BroadcastReceiver() {
|
|||||||
handleImportantTip(activity, jpushBean)
|
handleImportantTip(activity, jpushBean)
|
||||||
}
|
}
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
LogUtil.print("PushActivityLifecycleCallbacks",
|
LogUtil.print("ZdPushServiceReceive",
|
||||||
"处理重要提示消息失败: ${e.message}")
|
"处理重要提示消息失败: ${e.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ class ZdPushServiceReceive : BroadcastReceiver() {
|
|||||||
handleReDispatchOrder(activity, jpushBean)
|
handleReDispatchOrder(activity, jpushBean)
|
||||||
}
|
}
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
LogUtil.print("PushActivityLifecycleCallbacks",
|
LogUtil.print("ZdPushServiceReceive",
|
||||||
"处理订单重新派发消息失败: ${e.message}")
|
"处理订单重新派发消息失败: ${e.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ class ZdPushServiceReceive : BroadcastReceiver() {
|
|||||||
handlerModifyOrder()
|
handlerModifyOrder()
|
||||||
}
|
}
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
LogUtil.print("PushActivityLifecycleCallbacks",
|
LogUtil.print("ZdPushServiceReceive",
|
||||||
"处理重要提示消息失败: ${e.message}")
|
"处理重要提示消息失败: ${e.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ class ZdPushServiceReceive : BroadcastReceiver() {
|
|||||||
handleRevokeOrder(activity)
|
handleRevokeOrder(activity)
|
||||||
}
|
}
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
LogUtil.print("PushActivityLifecycleCallbacks",
|
LogUtil.print("ZdPushServiceReceive",
|
||||||
"处理订单撤回消息失败: ${e.message}")
|
"处理订单撤回消息失败: ${e.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ class ZdPushServiceReceive : BroadcastReceiver() {
|
|||||||
handeReportMessage(jpushBean = jpushBean)
|
handeReportMessage(jpushBean = jpushBean)
|
||||||
}
|
}
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
LogUtil.print("PushActivityLifecycleCallbacks",
|
LogUtil.print("ZdPushServiceReceive",
|
||||||
"处理重要提示消息失败: ${e.message}")
|
"处理重要提示消息失败: ${e.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import kotlin.math.sin
|
|||||||
import kotlin.math.sqrt
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
object ZdLocationManager : AMapLocationListener {
|
internal object ZdLocationManager : AMapLocationListener {
|
||||||
private const val TAG = "ZdLocationManager"
|
private const val TAG = "ZdLocationManager"
|
||||||
private var aMapLocationClient : AMapLocationClient? = null
|
private var aMapLocationClient : AMapLocationClient? = null
|
||||||
private var context : Context? = null
|
private var context : Context? = null
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
package com.za.service.mqtt
|
package com.za.service.mqtt
|
||||||
|
|
||||||
object MqttConfig {
|
object MqttConfig {
|
||||||
const val INSTANCE_ID = "mqtt-cn-oew23jbkb1f"
|
val INSTANCE_ID = getMqttInstanceId()
|
||||||
const val END_POINT = "mqtt-cn-oew23jbkb1f.mqtt.aliyuncs.com"
|
val END_POINT = getMqttEndpoint()
|
||||||
const val ACCESS_KEY = "LTAI5tKgZ9ACKorXzzWLxgg7"
|
val ACCESS_KEY = getMqttAccessKey()
|
||||||
const val SECRET_KEY = "D04F0UH2GzrDsYaJ9GTfULGPjcsvvz"
|
val SECRET_KEY = getMqttSecretKey()
|
||||||
const val GROUP_ID = "GID_ZDJY"
|
val GROUP_ID = getMqttGroupId()
|
||||||
const val TOPIC_PREFIX = "pushBaseTopic/p2p"
|
val TOPIC_PREFIX = getMqttTopicPrefix()
|
||||||
const val QOS_LEVEL = 0
|
const val QOS_LEVEL = 0
|
||||||
|
|
||||||
|
external fun getMqttInstanceId() : String
|
||||||
|
external fun getMqttEndpoint() : String
|
||||||
|
external fun getMqttAccessKey() : String
|
||||||
|
external fun getMqttSecretKey() : String
|
||||||
|
external fun getMqttGroupId() : String
|
||||||
|
external fun getMqttTopicPrefix() : String
|
||||||
}
|
}
|
@ -1,16 +1,16 @@
|
|||||||
package com.za.service.mqtt
|
package com.za.service.mqtt
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
import com.za.common.GlobalData
|
import com.za.common.GlobalData
|
||||||
import com.za.common.log.LogUtil
|
import com.za.common.log.LogUtil
|
||||||
import com.za.common.util.DeviceUtil
|
import com.za.common.util.DeviceUtil
|
||||||
import com.za.common.util.Tools.macSignature
|
import com.za.common.util.Tools.macSignature
|
||||||
import com.za.service.ServiceManager
|
import com.za.service.ServiceManager
|
||||||
import org.eclipse.paho.android.service.MqttAndroidClient
|
|
||||||
import org.eclipse.paho.client.mqttv3.IMqttActionListener
|
|
||||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken
|
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken
|
||||||
import org.eclipse.paho.client.mqttv3.IMqttToken
|
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended
|
||||||
import org.eclipse.paho.client.mqttv3.MqttCallback
|
import org.eclipse.paho.client.mqttv3.MqttClient
|
||||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions
|
import org.eclipse.paho.client.mqttv3.MqttConnectOptions
|
||||||
import org.eclipse.paho.client.mqttv3.MqttException
|
import org.eclipse.paho.client.mqttv3.MqttException
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage
|
import org.eclipse.paho.client.mqttv3.MqttMessage
|
||||||
@ -23,35 +23,45 @@ object MyMqttClient {
|
|||||||
private lateinit var topic : String
|
private lateinit var topic : String
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
private var mqttClient : MqttAndroidClient? = null
|
private var mqttClient : MqttClient? = null
|
||||||
|
|
||||||
fun initialize(deviceId : String?) {
|
fun initialize(deviceId : String?) {
|
||||||
clientId = "${MqttConfig.GROUP_ID}@@@$deviceId"
|
clientId = "${MqttConfig.GROUP_ID}@@@$deviceId"
|
||||||
topic = "${MqttConfig.TOPIC_PREFIX}/$clientId"
|
topic = "${MqttConfig.TOPIC_PREFIX}/$clientId"
|
||||||
mqttClient = MqttAndroidClient(GlobalData.application,
|
mqttClient = MqttClient("tcp://${MqttConfig.END_POINT}:1883", clientId, MemoryPersistence())
|
||||||
"tcp://${MqttConfig.END_POINT}:1883",
|
|
||||||
clientId,
|
|
||||||
MemoryPersistence())
|
|
||||||
setupMqttCallbacks()
|
setupMqttCallbacks()
|
||||||
connect()
|
connect()
|
||||||
LogUtil.print("MyMqttClient ", "initialize success")
|
LogUtil.print("MyMqttClient ", "initialize success")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupMqttCallbacks() {
|
private fun setupMqttCallbacks() {
|
||||||
mqttClient?.setCallback(object : MqttCallback {
|
mqttClient?.setCallback(object : MqttCallbackExtended {
|
||||||
|
override fun connectComplete(reconnect : Boolean, serverURI : String?) {
|
||||||
override fun connectionLost(throwable : Throwable) {
|
Handler(Looper.getMainLooper()).post {
|
||||||
LogUtil.print("MyMqttClient ",
|
isConnecting = false
|
||||||
"Connection lost: ${throwable.message}") // connect()
|
LogUtil.print("MyMqttClient ", "connect success==")
|
||||||
|
subscribeTopic()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun messageArrived(topic : String, mqttMessage : MqttMessage) {
|
override fun connectionLost(cause : Throwable?) {
|
||||||
val message = String(mqttMessage.payload)
|
isConnecting = false
|
||||||
|
LogUtil.print("MyMqttClient ", "Connection lost: ${cause?.message}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun messageArrived(topic : String?, message : MqttMessage?) {
|
||||||
|
if (message == null) {
|
||||||
|
LogUtil.print("MyMqttClient ", "Message arrived: null")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Handler(Looper.getMainLooper()).post {
|
||||||
|
val message = String(message.payload)
|
||||||
LogUtil.print("MyMqttClient ", "Message arrived: $message")
|
LogUtil.print("MyMqttClient ", "Message arrived: $message")
|
||||||
ServiceManager.handlerPushMsg(message)
|
ServiceManager.handlerPushMsg(message)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun deliveryComplete(token : IMqttDeliveryToken) {
|
override fun deliveryComplete(token : IMqttDeliveryToken?) {
|
||||||
LogUtil.print("MyMqttClient ", "Message delivery complete")
|
LogUtil.print("MyMqttClient ", "Message delivery complete")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -78,19 +88,7 @@ object MyMqttClient {
|
|||||||
mqttConnectOption.maxReconnectDelay = 30 * 1000
|
mqttConnectOption.maxReconnectDelay = 30 * 1000
|
||||||
mqttConnectOption.mqttVersion = MqttConnectOptions.MQTT_VERSION_3_1_1
|
mqttConnectOption.mqttVersion = MqttConnectOptions.MQTT_VERSION_3_1_1
|
||||||
mqttConnectOption.connectionTimeout = 30
|
mqttConnectOption.connectionTimeout = 30
|
||||||
|
mqttClient?.connect(mqttConnectOption)
|
||||||
mqttClient?.connect(mqttConnectOption, null, object : IMqttActionListener {
|
|
||||||
override fun onSuccess(asyncActionToken : IMqttToken?) {
|
|
||||||
isConnecting = false
|
|
||||||
LogUtil.print("MyMqttClient ", "connect success==")
|
|
||||||
subscribeTopic()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(asyncActionToken : IMqttToken?, exception : Throwable?) {
|
|
||||||
isConnecting = false
|
|
||||||
LogUtil.print("MyMqttClient ", "connect failed== ${exception?.message}")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} catch (e : MqttException) {
|
} catch (e : MqttException) {
|
||||||
LogUtil.print("MyMqttClient ", "Connection failed2: ${e.message}")
|
LogUtil.print("MyMqttClient ", "Connection failed2: ${e.message}")
|
||||||
}
|
}
|
||||||
@ -99,7 +97,6 @@ object MyMqttClient {
|
|||||||
|
|
||||||
//检测mqtt连接状态
|
//检测mqtt连接状态
|
||||||
fun publishMessage() {
|
fun publishMessage() {
|
||||||
|
|
||||||
if (mqttClient == null) {
|
if (mqttClient == null) {
|
||||||
initialize(deviceId = DeviceUtil.getAndroidId(GlobalData.application))
|
initialize(deviceId = DeviceUtil.getAndroidId(GlobalData.application))
|
||||||
return
|
return
|
||||||
@ -117,19 +114,8 @@ object MyMqttClient {
|
|||||||
private fun subscribeTopic() {
|
private fun subscribeTopic() {
|
||||||
try {
|
try {
|
||||||
if (mqttClient?.isConnected == true) {
|
if (mqttClient?.isConnected == true) {
|
||||||
mqttClient?.subscribe(topic,
|
mqttClient?.subscribe(topic, MqttConfig.QOS_LEVEL)
|
||||||
MqttConfig.QOS_LEVEL,
|
LogUtil.print("MyMqttClient ", "mqtt subscribe $topic ")
|
||||||
null,
|
|
||||||
object : IMqttActionListener {
|
|
||||||
override fun onSuccess(asyncActionToken : IMqttToken?) {
|
|
||||||
LogUtil.print("MyMqttClient ", "Subscribed to topic: $topic")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(asyncActionToken : IMqttToken?,
|
|
||||||
exception : Throwable) {
|
|
||||||
LogUtil.print("MyMqttClient ", "Subscribe failed: ${exception.message}")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
LogUtil.print("MyMqttClient ", "Cannot subscribe: MQTT client is not connected")
|
LogUtil.print("MyMqttClient ", "Cannot subscribe: MQTT client is not connected")
|
||||||
}
|
}
|
||||||
@ -141,15 +127,7 @@ object MyMqttClient {
|
|||||||
fun disconnect() {
|
fun disconnect() {
|
||||||
try {
|
try {
|
||||||
if (mqttClient?.isConnected == true) {
|
if (mqttClient?.isConnected == true) {
|
||||||
mqttClient?.disconnect(null, object : IMqttActionListener {
|
mqttClient?.disconnect()
|
||||||
override fun onSuccess(asyncActionToken : IMqttToken?) {
|
|
||||||
LogUtil.print("MyMqttClient ", "Disconnected")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(asyncActionToken : IMqttToken?, exception : Throwable) {
|
|
||||||
LogUtil.print("MyMqttClient ", "Disconnect failed")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
} catch (e : MqttException) {
|
} catch (e : MqttException) {
|
||||||
LogUtil.print("MyMqttClient ", "Disconnect failed: ${e.message}")
|
LogUtil.print("MyMqttClient ", "Disconnect failed: ${e.message}")
|
||||||
|
@ -41,7 +41,7 @@ import com.za.common.log.LogUtil
|
|||||||
import com.za.ext.finish
|
import com.za.ext.finish
|
||||||
import com.za.servicing.R
|
import com.za.servicing.R
|
||||||
|
|
||||||
class CommonH5Activity : BaseActivity() {
|
internal class CommonH5Activity : BaseActivity() {
|
||||||
private var webView : WebView? = null
|
private var webView : WebView? = null
|
||||||
private var isDestroyed = false
|
private var isDestroyed = false
|
||||||
|
|
||||||
|
@ -136,11 +136,12 @@ class ServicingMainActivity : BaseActivity() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendMessageToMainProcess(context : Context,
|
fun sendMessageToMainProcess(context : Context, type : String, message : String) {
|
||||||
type : String,
|
val intent = if (context.packageName == "com.za.rescue.dealer") {
|
||||||
message : String) { // 使用广播将消息发送到主进程
|
Intent(Const.PushMessageType.ACTION_MAIN)
|
||||||
val intent = Intent(Const.PushMessageType.ACTION_MAIN.takeIf { GlobalData.isMaster }
|
} else {
|
||||||
?: Const.PushMessageType.ACTION_SDK)
|
Intent(Const.PushMessageType.ACTION_SDK)
|
||||||
|
}
|
||||||
intent.setPackage(context.packageName)
|
intent.setPackage(context.packageName)
|
||||||
intent.putExtra("type", type)
|
intent.putExtra("type", type)
|
||||||
intent.putExtra("message", message)
|
intent.putExtra("message", message)
|
||||||
|
@ -15,7 +15,7 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
|||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
class ServicingMainVm : BaseVm<ServicingMainVm.Action, ServicingMainVm.UiState>() {
|
internal class ServicingMainVm : BaseVm<ServicingMainVm.Action, ServicingMainVm.UiState>() {
|
||||||
|
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
@ -87,6 +87,9 @@ class ServicingMainVm : BaseVm<ServicingMainVm.Action, ServicingMainVm.UiState>(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
GlobalData.token = it.token
|
GlobalData.token = it.token
|
||||||
|
GlobalData.driverId = it.userId
|
||||||
|
GlobalData.vehicleId = it.vehicleId
|
||||||
|
GlobalData.deviceId = deviceId
|
||||||
CommonMethod.getGenerateInfo(success = { success() },
|
CommonMethod.getGenerateInfo(success = { success() },
|
||||||
failed = { failure(it ?: "") })
|
failed = { failure(it ?: "") })
|
||||||
}
|
}
|
||||||
|
@ -98,18 +98,15 @@ fun MapSearchScreen(onLocationSelected: (PoiData) -> Unit) {
|
|||||||
|
|
||||||
// Permission handling
|
// Permission handling
|
||||||
val locationPermissionGranted = remember { mutableStateOf(false) }
|
val locationPermissionGranted = remember { mutableStateOf(false) }
|
||||||
val locationPermissionLauncher = rememberLauncherForActivityResult(
|
val locationPermissionLauncher =
|
||||||
ActivityResultContracts.RequestPermission()
|
rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted : Boolean ->
|
||||||
) { isGranted: Boolean ->
|
|
||||||
locationPermissionGranted.value = isGranted
|
locationPermissionGranted.value = isGranted
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if location permission is granted
|
// Check if location permission is granted
|
||||||
val checkPermission = {
|
val checkPermission = {
|
||||||
if (ContextCompat.checkSelfPermission(
|
if (ContextCompat.checkSelfPermission(context,
|
||||||
context,
|
Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION
|
|
||||||
) == PackageManager.PERMISSION_GRANTED
|
|
||||||
) {
|
) {
|
||||||
locationPermissionGranted.value = true
|
locationPermissionGranted.value = true
|
||||||
} else {
|
} else {
|
||||||
@ -118,14 +115,11 @@ fun MapSearchScreen(onLocationSelected: (PoiData) -> Unit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
errorMessage?.let { message ->
|
errorMessage?.let { message ->
|
||||||
Snackbar(
|
Snackbar(action = {
|
||||||
action = {
|
|
||||||
Button(onClick = { errorMessage = null }) {
|
Button(onClick = { errorMessage = null }) {
|
||||||
Text("关闭")
|
Text("关闭")
|
||||||
}
|
}
|
||||||
},
|
}, modifier = Modifier.padding(8.dp)) {
|
||||||
modifier = Modifier.padding(8.dp)
|
|
||||||
) {
|
|
||||||
Text(message)
|
Text(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,36 +169,25 @@ fun MapSearchScreen(onLocationSelected: (PoiData) -> Unit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(topBar = {
|
||||||
topBar = {
|
|
||||||
HeadView(title = "地图选点", onBack = { context.finish() })
|
HeadView(title = "地图选点", onBack = { context.finish() })
|
||||||
}
|
}) { paddingValues ->
|
||||||
) { paddingValues ->
|
Column(modifier = Modifier
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(paddingValues)
|
.padding(paddingValues)
|
||||||
.padding(16.dp)
|
.padding(16.dp)
|
||||||
.verticalScroll(state = rememberScrollState())
|
.verticalScroll(state = rememberScrollState())) {
|
||||||
) {
|
Card(modifier = Modifier
|
||||||
Card(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(bottom = 16.dp)
|
.padding(bottom = 16.dp)) {
|
||||||
) {
|
Column(modifier = Modifier.padding(16.dp)) {
|
||||||
Column(
|
TextField(value = searchText,
|
||||||
modifier = Modifier.padding(16.dp)
|
|
||||||
) {
|
|
||||||
TextField(
|
|
||||||
value = searchText,
|
|
||||||
onValueChange = { searchText = it },
|
onValueChange = { searchText = it },
|
||||||
label = { Text("搜索地址") },
|
label = { Text("搜索地址") },
|
||||||
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
|
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth())
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
Button(
|
Button(onClick = {
|
||||||
onClick = {
|
|
||||||
if (searchText.isNotBlank()) {
|
if (searchText.isNotBlank()) {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
errorMessage = null
|
errorMessage = null
|
||||||
@ -217,25 +200,19 @@ fun MapSearchScreen(onLocationSelected: (PoiData) -> Unit) {
|
|||||||
} else {
|
} else {
|
||||||
errorMessage = "请输入地址"
|
errorMessage = "请输入地址"
|
||||||
}
|
}
|
||||||
},
|
}, modifier = Modifier.fillMaxWidth()) {
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
) {
|
|
||||||
Text("搜索")
|
Text("搜索")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(modifier = Modifier.align(Alignment.CenterHorizontally))
|
||||||
modifier = Modifier.align(Alignment.CenterHorizontally)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if (searchResults.isNotEmpty()) {
|
if (searchResults.isNotEmpty()) {
|
||||||
LazyColumn(
|
LazyColumn(modifier = Modifier
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(180.dp)
|
.height(180.dp)
|
||||||
.padding(bottom = 16.dp)
|
.padding(bottom = 16.dp)) {
|
||||||
) {
|
|
||||||
items(items = searchResults) {
|
items(items = searchResults) {
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@ -248,16 +225,13 @@ fun MapSearchScreen(onLocationSelected: (PoiData) -> Unit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // Wrap MapView with AndroidView
|
||||||
// Wrap MapView with AndroidView
|
AndroidView(factory = {
|
||||||
AndroidView(
|
|
||||||
factory = {
|
|
||||||
mapView.apply {
|
mapView.apply {
|
||||||
onCreate(null)
|
onCreate(null)
|
||||||
onResume()
|
onResume()
|
||||||
}
|
}
|
||||||
},
|
}, update = {
|
||||||
update = {
|
|
||||||
it.map.setOnMapClickListener { latLng ->
|
it.map.setOnMapClickListener { latLng ->
|
||||||
selectLatLng = LatLonPoint(latLng.latitude, latLng.longitude)
|
selectLatLng = LatLonPoint(latLng.latitude, latLng.longitude)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
@ -268,16 +242,16 @@ fun MapSearchScreen(onLocationSelected: (PoiData) -> Unit) {
|
|||||||
if (! mapInitialized) {
|
if (! mapInitialized) {
|
||||||
mapInitialized = true
|
mapInitialized = true
|
||||||
}
|
}
|
||||||
},
|
}, modifier = Modifier
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(300.dp)
|
.height(300.dp))
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
|
|
||||||
CommonButton(text = "确定") {
|
CommonButton(text = "确定") {
|
||||||
onLocationSelected(PoiData(name = searchText, lat = selectLatLng.latitude, lng = selectLatLng.longitude))
|
onLocationSelected(PoiData(name = searchText,
|
||||||
|
lat = selectLatLng.latitude,
|
||||||
|
lng = selectLatLng.longitude))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,8 +275,8 @@ private suspend fun searchPoi(context: Context, query: String): List<PoiItem> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPoiItemSearched(poiItem: PoiItem?, rCode: Int) {
|
override fun onPoiItemSearched(poiItem : PoiItem?,
|
||||||
// Not used in this case
|
rCode : Int) { // Not used in this case
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -324,8 +298,8 @@ private suspend fun reverseGeocode(context: Context, latLng: LatLonPoint): Strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onGeocodeSearched(result: GeocodeResult?, rCode: Int) {
|
override fun onGeocodeSearched(result : GeocodeResult?,
|
||||||
// Not used in reverse geocoding
|
rCode : Int) { // Not used in reverse geocoding
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -335,7 +309,8 @@ private suspend fun reverseGeocode(context: Context, latLng: LatLonPoint): Strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class PoiData(val name: String? = null, val lat: Double? = null, val lng: Double? = null) : Serializable
|
data class PoiData(val name : String? = null, val lat : Double? = null, val lng : Double? = null) :
|
||||||
|
Serializable
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -74,7 +74,7 @@ import com.za.ext.finish
|
|||||||
import com.za.servicing.R
|
import com.za.servicing.R
|
||||||
import com.za.ui.servicing.in_servicing_setting.OrderTaskNotesDialog
|
import com.za.ui.servicing.in_servicing_setting.OrderTaskNotesDialog
|
||||||
|
|
||||||
class NewOrderActivity : BaseActivity() {
|
internal class NewOrderActivity : BaseActivity() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
|
@ -89,7 +89,7 @@ data class NewOrderItemUIBean(
|
|||||||
|
|
||||||
// 1 服务中 2 历史订单
|
// 1 服务中 2 历史订单
|
||||||
@Composable
|
@Composable
|
||||||
fun NewOrderItem(uiBean : NewOrderItemUIBean?,
|
internal fun NewOrderItem(uiBean : NewOrderItemUIBean?,
|
||||||
goInServicing : () -> Unit = {},
|
goInServicing : () -> Unit = {},
|
||||||
goHistory : () -> Unit = {},
|
goHistory : () -> Unit = {},
|
||||||
goDetail : () -> Unit = {},
|
goDetail : () -> Unit = {},
|
||||||
|
@ -34,7 +34,7 @@ import java.text.SimpleDateFormat
|
|||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class NewOrderVm : BaseVm<NewOrderVm.Action, NewOrderVm.UiState>() {
|
internal class NewOrderVm : BaseVm<NewOrderVm.Action, NewOrderVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ import com.za.base.view.EmptyView
|
|||||||
import com.za.base.view.HeadView
|
import com.za.base.view.HeadView
|
||||||
import com.za.ext.finish
|
import com.za.ext.finish
|
||||||
|
|
||||||
class HistoryReportActivity : BaseActivity() {
|
internal class HistoryReportActivity : BaseActivity() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
HistoryReportScreen()
|
HistoryReportScreen()
|
||||||
@ -50,7 +50,7 @@ class HistoryReportActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HistoryReportScreen(vm : HistoryReportVm = viewModel()) {
|
internal fun HistoryReportScreen(vm : HistoryReportVm = viewModel()) {
|
||||||
val uiState by vm.uiState.collectAsStateWithLifecycle()
|
val uiState by vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val lifecycleOwner = LocalLifecycleOwner.current
|
val lifecycleOwner = LocalLifecycleOwner.current
|
||||||
|
@ -13,7 +13,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
|||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
|
||||||
class HistoryReportVm : BaseVm<HistoryReportVm.Action, HistoryReportVm.UiState>() {
|
internal class HistoryReportVm : BaseVm<HistoryReportVm.Action, HistoryReportVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState.asStateFlow()
|
val uiState get() = _uiState.asStateFlow()
|
||||||
|
|
||||||
@ -30,8 +30,7 @@ class HistoryReportVm : BaseVm<HistoryReportVm.Action, HistoryReportVm.UiState>(
|
|||||||
private fun init() {
|
private fun init() {
|
||||||
LoadingManager.showLoading()
|
LoadingManager.showLoading()
|
||||||
val request = ReportHistoryRequest(taskId = "${GlobalData.currentOrder?.taskId}")
|
val request = ReportHistoryRequest(taskId = "${GlobalData.currentOrder?.taskId}")
|
||||||
RetrofitHelper.getDefaultService().getReportHistory(request)
|
RetrofitHelper.getDefaultService().getReportHistory(request).subscribeOn(Schedulers.io())
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(object : BaseObserver<List<ReportHistoryBean>>() {
|
.subscribe(object : BaseObserver<List<ReportHistoryBean>>() {
|
||||||
override fun doSuccess(it : List<ReportHistoryBean>?) {
|
override fun doSuccess(it : List<ReportHistoryBean>?) {
|
||||||
|
@ -44,7 +44,6 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|||||||
import androidx.compose.ui.res.vectorResource
|
import androidx.compose.ui.res.vectorResource
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
@ -61,7 +60,7 @@ import com.za.ui.map_search.MapSearchActivity
|
|||||||
import com.za.ui.map_search.PoiData
|
import com.za.ui.map_search.PoiData
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class OrderReportActivity : BaseActivity() {
|
internal class OrderReportActivity : BaseActivity() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
OrderReportScreen()
|
OrderReportScreen()
|
||||||
@ -73,7 +72,7 @@ private val TextGrey = Color(0xFF5F6368)
|
|||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderReportScreen(vm: OrderReportVm = viewModel()) {
|
internal fun OrderReportScreen(vm: OrderReportVm = viewModel()) {
|
||||||
val uiState by vm.uiState.collectAsStateWithLifecycle()
|
val uiState by vm.uiState.collectAsStateWithLifecycle()
|
||||||
val scaffoldState = rememberBottomSheetScaffoldState()
|
val scaffoldState = rememberBottomSheetScaffoldState()
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
@ -202,9 +201,3 @@ fun OrderReportScreen(vm: OrderReportVm = viewModel()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
fun OrderReportPreview(modifier: Modifier = Modifier) {
|
|
||||||
OrderReportScreen()
|
|
||||||
}
|
|
@ -14,7 +14,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
|||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
|
||||||
class OrderReportVm : BaseVm<OrderReportVm.Action, OrderReportVm.UiState>() {
|
internal class OrderReportVm : BaseVm<OrderReportVm.Action, OrderReportVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState.asStateFlow()
|
val uiState get() = _uiState.asStateFlow()
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ import kotlinx.coroutines.Job
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
class ReportFloatingManager : Service() {
|
internal class ReportFloatingManager : Service() {
|
||||||
private var windowManager : WindowManager? = null
|
private var windowManager : WindowManager? = null
|
||||||
private var floatingView : View? = null
|
private var floatingView : View? = null
|
||||||
private var touchJob : Job? = null
|
private var touchJob : Job? = null
|
||||||
|
@ -359,7 +359,7 @@ private fun ocrRecognition(photoTemplateInfo : PhotoTemplateInfo,
|
|||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun InServicingPhotoView(modifier : Modifier = Modifier,
|
internal fun InServicingPhotoView(modifier : Modifier = Modifier,
|
||||||
photoTemplateInfo : PhotoTemplateInfo,
|
photoTemplateInfo : PhotoTemplateInfo,
|
||||||
index : Int? = null,
|
index : Int? = null,
|
||||||
success : (PhotoTemplateInfo) -> Unit) {
|
success : (PhotoTemplateInfo) -> Unit) {
|
||||||
@ -445,7 +445,7 @@ fun InServicingPhotoView(modifier : Modifier = Modifier,
|
|||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun InServicingPhotoViewIsCanClick(modifier : Modifier = Modifier,
|
internal fun InServicingPhotoViewIsCanClick(modifier : Modifier = Modifier,
|
||||||
photoTemplateInfo : PhotoTemplateInfo,
|
photoTemplateInfo : PhotoTemplateInfo,
|
||||||
index : Int? = null,
|
index : Int? = null,
|
||||||
isCanClick : Boolean = true,
|
isCanClick : Boolean = true,
|
||||||
@ -534,7 +534,7 @@ fun InServicingPhotoViewIsCanClick(modifier : Modifier = Modifier,
|
|||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun InServicingPhotoWithoutTitleView(modifier : Modifier = Modifier,
|
internal fun InServicingPhotoWithoutTitleView(modifier : Modifier = Modifier,
|
||||||
photoTemplateInfo : PhotoTemplateInfo,
|
photoTemplateInfo : PhotoTemplateInfo,
|
||||||
index : Int? = null,
|
index : Int? = null,
|
||||||
success : (PhotoTemplateInfo) -> Unit) {
|
success : (PhotoTemplateInfo) -> Unit) {
|
||||||
@ -591,7 +591,7 @@ fun InServicingPhotoWithoutTitleView(modifier : Modifier = Modifier,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun InServicingPhotoItemView(modifier : Modifier = Modifier,
|
internal fun InServicingPhotoItemView(modifier : Modifier = Modifier,
|
||||||
photoTemplateInfo : PhotoTemplateInfo,
|
photoTemplateInfo : PhotoTemplateInfo,
|
||||||
isCanClick : Boolean = true,
|
isCanClick : Boolean = true,
|
||||||
success : (PhotoTemplateInfo) -> Unit) {
|
success : (PhotoTemplateInfo) -> Unit) {
|
||||||
|
@ -24,7 +24,7 @@ import com.za.ext.goNextPage
|
|||||||
import com.za.ui.servicing.InServicingPhotoView
|
import com.za.ui.servicing.InServicingPhotoView
|
||||||
import com.za.ui.servicing.view.InServicingHeadView
|
import com.za.ui.servicing.view.InServicingHeadView
|
||||||
|
|
||||||
class CheckVehicleActivity : BaseActivity() {
|
internal class CheckVehicleActivity : BaseActivity() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
CheckVehicleScreen()
|
CheckVehicleScreen()
|
||||||
@ -32,7 +32,7 @@ class CheckVehicleActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CheckVehicleScreen(vm: CheckVehicleVm = viewModel()) {
|
internal fun CheckVehicleScreen(vm: CheckVehicleVm = viewModel()) {
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import com.za.offline.OfflineUpdateTaskBean
|
|||||||
import com.za.service.location.ZdLocationManager
|
import com.za.service.location.ZdLocationManager
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
class CheckVehicleVm : IServicingVm<CheckVehicleVm.Action, CheckVehicleVm.UiState>() {
|
internal class CheckVehicleVm : IServicingVm<CheckVehicleVm.Action, CheckVehicleVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
override fun updateState(uiState : UiState) {
|
override fun updateState(uiState : UiState) {
|
||||||
|
@ -24,7 +24,7 @@ import com.za.ext.goNextPage
|
|||||||
import com.za.ui.servicing.InServicingPhotoView
|
import com.za.ui.servicing.InServicingPhotoView
|
||||||
import com.za.ui.servicing.view.InServicingHeadView
|
import com.za.ui.servicing.view.InServicingHeadView
|
||||||
|
|
||||||
class DeparturePhotoActivity : BaseActivity() {
|
internal class DeparturePhotoActivity : BaseActivity() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
DeparturePhotoScreen()
|
DeparturePhotoScreen()
|
||||||
@ -32,7 +32,7 @@ class DeparturePhotoActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DeparturePhotoScreen(vm : DeparturePhotoVm = viewModel()) {
|
internal fun DeparturePhotoScreen(vm : DeparturePhotoVm = viewModel()) {
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import com.za.net.CommonMethod
|
|||||||
import com.za.service.location.ZdLocationManager
|
import com.za.service.location.ZdLocationManager
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
class DeparturePhotoVm : IServicingVm<DeparturePhotoVm.Action, DeparturePhotoVm.UiState>() {
|
internal class DeparturePhotoVm : IServicingVm<DeparturePhotoVm.Action, DeparturePhotoVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import com.za.ext.goNextPage
|
|||||||
import com.za.ui.servicing.InServicingPhotoView
|
import com.za.ui.servicing.InServicingPhotoView
|
||||||
import com.za.ui.servicing.view.InServicingHeadView
|
import com.za.ui.servicing.view.InServicingHeadView
|
||||||
|
|
||||||
class DestinationPhotoActivity : BaseActivity() {
|
internal class DestinationPhotoActivity : BaseActivity() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
DestinationPhotoScreen()
|
DestinationPhotoScreen()
|
||||||
@ -32,7 +32,7 @@ class DestinationPhotoActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DestinationPhotoScreen(vm: DestinationPhotoVm = viewModel()) {
|
internal fun DestinationPhotoScreen(vm: DestinationPhotoVm = viewModel()) {
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import com.za.offline.OfflineUpdateTaskBean
|
|||||||
import com.za.service.location.ZdLocationManager
|
import com.za.service.location.ZdLocationManager
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
class DestinationPhotoVm : IServicingVm<DestinationPhotoVm.Action, DestinationPhotoVm.UiState>() {
|
internal class DestinationPhotoVm : IServicingVm<DestinationPhotoVm.Action, DestinationPhotoVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
override fun updateState(uiState : UiState) {
|
override fun updateState(uiState : UiState) {
|
||||||
|
@ -61,7 +61,7 @@ import com.za.ui.camera.ZdCameraXActivity
|
|||||||
import com.za.ui.servicing.view.InServicingHeadView
|
import com.za.ui.servicing.view.InServicingHeadView
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun EleSignCheckScreen(vm: EleSignCheckVm = viewModel()) {
|
internal fun EleSignCheckScreen(vm: EleSignCheckVm = viewModel()) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
LaunchedEffect(key1 = Unit) {
|
LaunchedEffect(key1 = Unit) {
|
||||||
@ -163,8 +163,8 @@ private fun EleSignCheckContent(eleWorkOrderBean: EleWorkOrderBean?,
|
|||||||
.background(color = Color.White, shape = RoundedCornerShape(4.dp))) {
|
.background(color = Color.White, shape = RoundedCornerShape(4.dp))) {
|
||||||
Column(modifier = Modifier
|
Column(modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(brush = Brush.verticalGradient(arrayListOf(Color(0xFF97A0BA), Color(0xFFE1E8F3))),
|
.background(brush = Brush.verticalGradient(arrayListOf(Color(0xFF97A0BA),
|
||||||
shape = RoundedCornerShape(topStart = 4.dp, topEnd = 4.dp))
|
Color(0xFFE1E8F3))), shape = RoundedCornerShape(topStart = 4.dp, topEnd = 4.dp))
|
||||||
.padding(10.dp)) {
|
.padding(10.dp)) {
|
||||||
Text(text = "验车拍照", color = Color(0xFF213B54), fontWeight = FontWeight.Bold, fontSize = 16.sp)
|
Text(text = "验车拍照", color = Color(0xFF213B54), fontWeight = FontWeight.Bold, fontSize = 16.sp)
|
||||||
Row(modifier = Modifier
|
Row(modifier = Modifier
|
||||||
|
@ -24,7 +24,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
class EleSignCheckVm : IServicingVm<EleSignCheckVm.Action, EleSignCheckVm.UiState>() {
|
internal class EleSignCheckVm : IServicingVm<EleSignCheckVm.Action, EleSignCheckVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
override fun updateState(uiState: UiState) {
|
override fun updateState(uiState: UiState) {
|
||||||
|
@ -49,7 +49,7 @@ import com.za.ui.view.SignatureView
|
|||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun EleSignScreen(vm : EleSignVm = viewModel()) {
|
internal fun EleSignScreen(vm : EleSignVm = viewModel()) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
LaunchedEffect(key1 = Unit) {
|
LaunchedEffect(key1 = Unit) {
|
||||||
|
@ -26,7 +26,7 @@ import kotlinx.coroutines.launch
|
|||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class EleSignVm : IServicingVm<EleSignVm.Action, EleSignVm.UiState>() {
|
internal class EleSignVm : IServicingVm<EleSignVm.Action, EleSignVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
override fun updateState(uiState : UiState) {
|
override fun updateState(uiState : UiState) {
|
||||||
|
@ -52,7 +52,7 @@ import com.za.ui.new_order.NewOrderUiType
|
|||||||
import com.za.ui.servicing.view.InServicingHeadView
|
import com.za.ui.servicing.view.InServicingHeadView
|
||||||
import com.za.ui.servicing.view.ServiceOperation
|
import com.za.ui.servicing.view.ServiceOperation
|
||||||
|
|
||||||
class GoAccidentSiteActivity : BaseActivity() {
|
internal class GoAccidentSiteActivity : BaseActivity() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
GoAccidentSiteScreen()
|
GoAccidentSiteScreen()
|
||||||
@ -61,7 +61,7 @@ class GoAccidentSiteActivity : BaseActivity() {
|
|||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun GoAccidentSiteScreen(vm : GoAccidentSiteVm = viewModel()) {
|
internal fun GoAccidentSiteScreen(vm : GoAccidentSiteVm = viewModel()) {
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val lifecycleOwner = LocalLifecycleOwner.current
|
val lifecycleOwner = LocalLifecycleOwner.current
|
||||||
@ -121,16 +121,13 @@ fun GoAccidentSiteScreen(vm : GoAccidentSiteVm = viewModel()) {
|
|||||||
title = "任务提交失败,是否离线提交?",
|
title = "任务提交失败,是否离线提交?",
|
||||||
cancelEnable = true,
|
cancelEnable = true,
|
||||||
cancel = {
|
cancel = {
|
||||||
vm.dispatch(GoAccidentSiteVm.Action.UpdateState(uiState.value.copy(
|
vm.dispatch(GoAccidentSiteVm.Action.UpdateState(uiState.value.copy(showOfflineDialog = false)))
|
||||||
showOfflineDialog = false)))
|
|
||||||
},
|
},
|
||||||
dismiss = {
|
dismiss = {
|
||||||
vm.dispatch(GoAccidentSiteVm.Action.UpdateState(uiState.value.copy(
|
vm.dispatch(GoAccidentSiteVm.Action.UpdateState(uiState.value.copy(showOfflineDialog = false)))
|
||||||
showOfflineDialog = false)))
|
|
||||||
},
|
},
|
||||||
confirm = {
|
confirm = {
|
||||||
vm.dispatch(GoAccidentSiteVm.Action.UpdateState(uiState.value.copy(
|
vm.dispatch(GoAccidentSiteVm.Action.UpdateState(uiState.value.copy(showOfflineDialog = false)))
|
||||||
showOfflineDialog = false)))
|
|
||||||
vm.dispatch(GoAccidentSiteVm.Action.UpdateOffline)
|
vm.dispatch(GoAccidentSiteVm.Action.UpdateOffline)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import java.util.Calendar
|
|||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class GoAccidentSiteVm : IServicingVm<GoAccidentSiteVm.Action, GoAccidentSiteVm.UiState>() {
|
internal class GoAccidentSiteVm : IServicingVm<GoAccidentSiteVm.Action, GoAccidentSiteVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
override fun updateState(uiState : UiState) {
|
override fun updateState(uiState : UiState) {
|
||||||
|
@ -52,7 +52,7 @@ import com.za.ui.new_order.NewOrderUiType
|
|||||||
import com.za.ui.servicing.view.InServicingHeadView
|
import com.za.ui.servicing.view.InServicingHeadView
|
||||||
import com.za.ui.servicing.view.ServiceOperation
|
import com.za.ui.servicing.view.ServiceOperation
|
||||||
|
|
||||||
class GoToDestinationActivity : BaseActivity() {
|
internal class GoToDestinationActivity : BaseActivity() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
GoToDestinationScreen()
|
GoToDestinationScreen()
|
||||||
@ -61,7 +61,7 @@ class GoToDestinationActivity : BaseActivity() {
|
|||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun GoToDestinationScreen(vm : GoToDestinationVm = viewModel()) {
|
internal fun GoToDestinationScreen(vm : GoToDestinationVm = viewModel()) {
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val lifecycleOwner = LocalLifecycleOwner.current
|
val lifecycleOwner = LocalLifecycleOwner.current
|
||||||
|
@ -39,7 +39,7 @@ import java.util.Calendar
|
|||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class GoToDestinationVm : IServicingVm<GoToDestinationVm.Action, GoToDestinationVm.UiState>() {
|
internal class GoToDestinationVm : IServicingVm<GoToDestinationVm.Action, GoToDestinationVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
override fun updateState(uiState : UiState) {
|
override fun updateState(uiState : UiState) {
|
||||||
|
@ -47,7 +47,7 @@ import com.za.ext.copy
|
|||||||
import com.za.servicing.R
|
import com.za.servicing.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderDetailItemScreen(orderInfo : OrderInfo?) {
|
internal fun OrderDetailItemScreen(orderInfo : OrderInfo?) {
|
||||||
Column(modifier = Modifier
|
Column(modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.verticalScroll(state = rememberScrollState())
|
.verticalScroll(state = rememberScrollState())
|
||||||
@ -433,7 +433,7 @@ private fun OrderDetailServiceInformationView(orderInfo : OrderInfo?) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderDetailTime(orderInfo : OrderInfo?) {
|
internal fun OrderDetailTime(orderInfo : OrderInfo?) {
|
||||||
val titleSize = 12.sp
|
val titleSize = 12.sp
|
||||||
val titleColor = Color(0xFF7A7A7A)
|
val titleColor = Color(0xFF7A7A7A)
|
||||||
val contentColor = Color.Black
|
val contentColor = Color.Black
|
||||||
|
@ -44,7 +44,7 @@ import com.za.ui.servicing.order_give_up.OrderGiveUpActivity
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderDetailScreen(orderInfo : OrderInfo?) {
|
internal fun OrderDetailScreen(orderInfo : OrderInfo?) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val titleList = listOf("订单详情", "案件要求")
|
val titleList = listOf("订单详情", "案件要求")
|
||||||
val pagerState = rememberPagerState(initialPage = 0, pageCount = { titleList.size })
|
val pagerState = rememberPagerState(initialPage = 0, pageCount = { titleList.size })
|
||||||
|
@ -9,7 +9,7 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import com.za.bean.db.order.OrderInfo
|
import com.za.bean.db.order.OrderInfo
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderEleScreen(orderInfo: OrderInfo?) {
|
internal fun OrderEleScreen(orderInfo : OrderInfo?) {
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
Text(text = "电子工单", color = Color.Black)
|
Text(text = "电子工单", color = Color.Black)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import com.za.bean.db.order.OrderInfo
|
|||||||
import com.za.ext.finish
|
import com.za.ext.finish
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderOnSitePhotoScreen(orderInfo: OrderInfo?) {
|
internal fun OrderOnSitePhotoScreen(orderInfo: OrderInfo?) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val showPreviewPhotoDialog = remember { mutableStateOf<String?>("") }
|
val showPreviewPhotoDialog = remember { mutableStateOf<String?>("") }
|
||||||
if (!showPreviewPhotoDialog.value.isNullOrBlank()) {
|
if (!showPreviewPhotoDialog.value.isNullOrBlank()) {
|
||||||
|
@ -9,7 +9,7 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import com.za.bean.db.order.OrderInfo
|
import com.za.bean.db.order.OrderInfo
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderPhotoScreen(orderInfo: OrderInfo?) {
|
internal fun OrderPhotoScreen(orderInfo: OrderInfo?) {
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
Text(text = "案件照片", color = Color.Black)
|
Text(text = "案件照片", color = Color.Black)
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.za.base.BaseActivity
|
|||||||
import com.za.base.Const
|
import com.za.base.Const
|
||||||
import com.za.bean.db.order.OrderInfo
|
import com.za.bean.db.order.OrderInfo
|
||||||
|
|
||||||
class OrderRequirementsActivity : BaseActivity() {
|
internal class OrderRequirementsActivity : BaseActivity() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
val orderInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
val orderInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
@ -44,7 +44,7 @@ import com.za.servicing.R
|
|||||||
import com.za.ui.h5.CommonH5Activity
|
import com.za.ui.h5.CommonH5Activity
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderRequirementsScreen(orderInfo : OrderInfo?) {
|
internal fun OrderRequirementsScreen(orderInfo : OrderInfo?) {
|
||||||
Scaffold {
|
Scaffold {
|
||||||
Column(modifier = Modifier
|
Column(modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@ -63,7 +63,7 @@ fun OrderRequirementsScreen(orderInfo : OrderInfo?) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderRequirementsItemView(title : String?, content : String?) {
|
internal fun OrderRequirementsItemView(title : String?, content : String?) {
|
||||||
Column(modifier = Modifier
|
Column(modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(vertical = 5.dp)) {
|
.padding(vertical = 5.dp)) {
|
||||||
|
@ -9,7 +9,7 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import com.za.bean.db.order.OrderInfo
|
import com.za.bean.db.order.OrderInfo
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderSettleScreen(orderInfo: OrderInfo?) {
|
internal fun OrderSettleScreen(orderInfo: OrderInfo?) {
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
Text(text = "结算单", color = Color.Black)
|
Text(text = "结算单", color = Color.Black)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import com.za.bean.db.order.OrderInfo
|
import com.za.bean.db.order.OrderInfo
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderTriceScreen(orderInfo: OrderInfo?) {
|
internal fun OrderTriceScreen(orderInfo : OrderInfo?) {
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
Text(text = "订单轨迹", color = Color.Black)
|
Text(text = "订单轨迹", color = Color.Black)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import com.za.base.BaseActivity
|
import com.za.base.BaseActivity
|
||||||
|
|
||||||
|
|
||||||
class ServicePeopleConfirmActivity : BaseActivity() {
|
internal class ServicePeopleConfirmActivity : BaseActivity() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
|
@ -23,7 +23,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class InServicePeopleConfirmVm : IServicingVm<Action, UiState>() {
|
internal class InServicePeopleConfirmVm : IServicingVm<Action, UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState as StateFlow<UiState>
|
val uiState get() = _uiState as StateFlow<UiState>
|
||||||
override fun updateState(uiState : UiState) {
|
override fun updateState(uiState : UiState) {
|
||||||
|
@ -43,7 +43,7 @@ import com.za.servicing.R
|
|||||||
import com.za.ui.camera.ServicePeopleRealActivity
|
import com.za.ui.camera.ServicePeopleRealActivity
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ServicePeopleConfirmScreen(vm : InServicePeopleConfirmVm = viewModel(),
|
internal fun ServicePeopleConfirmScreen(vm : InServicePeopleConfirmVm = viewModel(),
|
||||||
success : () -> Unit = {},
|
success : () -> Unit = {},
|
||||||
onBack : () -> Unit) {
|
onBack : () -> Unit) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
@ -7,7 +7,7 @@ import com.za.ext.getEleState
|
|||||||
import com.za.ui.servicing.ele_check.EleSignCheckScreen
|
import com.za.ui.servicing.ele_check.EleSignCheckScreen
|
||||||
import com.za.ui.servicing.ele_sign.EleSignScreen
|
import com.za.ui.servicing.ele_sign.EleSignScreen
|
||||||
|
|
||||||
class InOperationActivity : BaseActivity() {
|
internal class InOperationActivity : BaseActivity() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
|
@ -24,7 +24,7 @@ import com.za.ui.servicing.InServicingPhotoView
|
|||||||
import com.za.ui.servicing.view.InServicingHeadView
|
import com.za.ui.servicing.view.InServicingHeadView
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun InOperationScreen(vm: InOperationVm = viewModel()) {
|
internal fun InOperationScreen(vm: InOperationVm = viewModel()) {
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import com.za.offline.OfflineUpdateTaskBean
|
|||||||
import com.za.service.location.ZdLocationManager
|
import com.za.service.location.ZdLocationManager
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
class InOperationVm : IServicingVm<InOperationVm.Action, InOperationVm.UiState>() {
|
internal class InOperationVm : IServicingVm<InOperationVm.Action, InOperationVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
override fun updateState(uiState : UiState) {
|
override fun updateState(uiState : UiState) {
|
||||||
|
@ -33,7 +33,7 @@ import com.za.ext.goStatusPage
|
|||||||
import com.za.ui.servicing.InServicingPhotoView
|
import com.za.ui.servicing.InServicingPhotoView
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ChangeBatteryScreen(vm : ChangeBatteryVm = viewModel()) {
|
internal fun ChangeBatteryScreen(vm : ChangeBatteryVm = viewModel()) {
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
LaunchedEffect(key1 = Unit) {
|
LaunchedEffect(key1 = Unit) {
|
||||||
|
@ -23,7 +23,7 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
|||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
class ChangeBatteryVm : BaseVm<ChangeBatteryVm.Action, ChangeBatteryVm.UiState>() {
|
internal class ChangeBatteryVm : BaseVm<ChangeBatteryVm.Action, ChangeBatteryVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ import kotlin.math.ceil
|
|||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
fun ConfirmEleScreen(vm : ConfirmEleVm = viewModel()) {
|
internal fun ConfirmEleScreen(vm : ConfirmEleVm = viewModel()) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
LaunchedEffect(key1 = Unit) {
|
LaunchedEffect(key1 = Unit) {
|
||||||
@ -414,7 +414,8 @@ fun ConfirmEleScreen(vm : ConfirmEleVm = viewModel()) {
|
|||||||
vm.dispatch(ConfirmEleVm.Action.UploadServiceSignature(it))
|
vm.dispatch(ConfirmEleVm.Action.UploadServiceSignature(it))
|
||||||
},
|
},
|
||||||
serverPath = uiState.value.eleWorkOrderBean?.localServicePeopleSignPath
|
serverPath = uiState.value.eleWorkOrderBean?.localServicePeopleSignPath
|
||||||
?: uiState.value.eleWorkOrderBean?.serverServicePeopleSignPath)
|
?: uiState.value.eleWorkOrderBean?.serverServicePeopleSignPath
|
||||||
|
?: GlobalData.driverInfoBean?.signatureUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import kotlinx.coroutines.launch
|
|||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class ConfirmEleVm : IServicingVm<ConfirmEleVm.Action, ConfirmEleVm.UiState>() {
|
internal class ConfirmEleVm : IServicingVm<ConfirmEleVm.Action, ConfirmEleVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
|
|
||||||
@ -283,7 +283,8 @@ class ConfirmEleVm : IServicingVm<ConfirmEleVm.Action, ConfirmEleVm.UiState>() {
|
|||||||
} else null,
|
} else null,
|
||||||
hasSuccess = eleWorkOrderBean.isSuccess,
|
hasSuccess = eleWorkOrderBean.isSuccess,
|
||||||
recipientSignPath = eleWorkOrderBean.serverAcceptCarSignPath,
|
recipientSignPath = eleWorkOrderBean.serverAcceptCarSignPath,
|
||||||
waitstaffSignPath = eleWorkOrderBean.serverServicePeopleSignPath)
|
waitstaffSignPath = eleWorkOrderBean.serverServicePeopleSignPath
|
||||||
|
?: GlobalData.driverInfoBean?.signatureUrl)
|
||||||
LoadingManager.showLoading()
|
LoadingManager.showLoading()
|
||||||
RetrofitHelper.getDefaultService().saveElectronOrder(saveEleOrderRequest)
|
RetrofitHelper.getDefaultService().saveElectronOrder(saveEleOrderRequest)
|
||||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||||
|
@ -55,7 +55,7 @@ import com.za.signature.GridPaintActivity
|
|||||||
import com.za.signature.config.PenConfig
|
import com.za.signature.config.PenConfig
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ConfirmH5SuccessScreen(vm : ConfirmH5SuccessVm = viewModel()) {
|
internal fun ConfirmH5SuccessScreen(vm : ConfirmH5SuccessVm = viewModel()) {
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val webView = WebView(context)
|
val webView = WebView(context)
|
||||||
|
@ -26,7 +26,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
|||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class ConfirmH5SuccessVm : IServicingVm<ConfirmH5SuccessVm.Action, ConfirmH5SuccessVm.UiState>() {
|
internal class ConfirmH5SuccessVm : IServicingVm<ConfirmH5SuccessVm.Action, ConfirmH5SuccessVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
override fun updateState(uiState : UiState) {
|
override fun updateState(uiState : UiState) {
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
package com.za.ui.servicing.order_confirm
|
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun EleSuccessScreen(modifier: Modifier = Modifier) {
|
|
||||||
|
|
||||||
}
|
|
@ -17,7 +17,7 @@ import com.za.ui.servicing.order_confirm.input_money.InputMoneyActivity
|
|||||||
import com.za.ui.servicing.order_confirm.real_order_confirm.RealOrderConfirmActivity
|
import com.za.ui.servicing.order_confirm.real_order_confirm.RealOrderConfirmActivity
|
||||||
import com.za.ui.servicing.order_confirm.receive_money.ReceiveMoneyActivity
|
import com.za.ui.servicing.order_confirm.receive_money.ReceiveMoneyActivity
|
||||||
|
|
||||||
class OrderConfirmActivity : BaseActivity() {
|
internal class OrderConfirmActivity : BaseActivity() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun ContentView() {
|
override fun ContentView() {
|
||||||
@ -26,7 +26,7 @@ class OrderConfirmActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OrderConfirmInitScreen(vm : OrderConfirmInitVm = viewModel()) {
|
internal fun OrderConfirmInitScreen(vm : OrderConfirmInitVm = viewModel()) {
|
||||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
LaunchedEffect(key1 = Unit) {
|
LaunchedEffect(key1 = Unit) {
|
||||||
|
@ -16,7 +16,7 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
|||||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
class OrderConfirmInitVm : IServicingVm<OrderConfirmInitVm.Action, OrderConfirmInitVm.UiState>() {
|
internal class OrderConfirmInitVm : IServicingVm<OrderConfirmInitVm.Action, OrderConfirmInitVm.UiState>() {
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
val uiState get() = _uiState
|
val uiState get() = _uiState
|
||||||
override fun updateState(uiState : UiState) {
|
override fun updateState(uiState : UiState) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user