Parcourir la source

1.添加bugly更新

shihuiyun il y a 2 ans
Parent
commit
155849e3c3
30 fichiers modifiés avec 314 ajouts et 281 suppressions
  1. 5 4
      app/build.gradle
  2. 0 98
      app/src/main/java/com/zswc/creativity/App.java
  3. 69 0
      app/src/main/java/com/zswc/creativity/App.kt
  4. 4 0
      app/src/main/java/com/zswc/creativity/activity/MainActivity.kt
  5. 101 1
      app/src/main/java/com/zswc/creativity/activity/MyInfoActivity.kt
  6. 3 0
      app/src/main/java/com/zswc/creativity/activity/MyWalletActivity.kt
  7. 4 1
      app/src/main/java/com/zswc/creativity/activity/WithdrawActivity.kt
  8. 1 1
      app/src/main/java/com/zswc/creativity/config/Config.kt
  9. 7 0
      app/src/main/java/com/zswc/creativity/config/IConfigBugly.java
  10. 24 58
      app/src/main/java/com/zswc/creativity/utils/ChosePhotoUtils.java
  11. 6 6
      app/src/main/java/com/zswc/creativity/utils/PackageUtils.java
  12. 1 4
      app/src/main/java/com/zswc/creativity/utils/SettingsUtil.kt
  13. 7 0
      app/src/main/java/com/zswc/creativity/vmodel/HomeFirstVModel.kt
  14. 6 0
      app/src/main/java/com/zswc/creativity/vmodel/MyInfoVModel.kt
  15. 10 5
      app/src/main/res/layout/activity_my_info.xml
  16. 1 0
      app/src/main/res/layout/fragment_home_first.xml
  17. 1 1
      app/src/main/res/layout/fragment_home_my.xml
  18. 8 5
      base/src/main/java/com/ysnows/base/base/BApp.kt
  19. 6 2
      common-build.gradle
  20. 1 1
      jpush/src/main/java/com/zswc/jpush/componnent/CpJpush.kt
  21. 0 6
      update/.classpath
  22. 0 23
      update/.project
  23. 0 2
      update/.settings/org.eclipse.buildship.core.prefs
  24. 2 5
      update/build.gradle
  25. 1 3
      update/src/main/AndroidManifest.xml
  26. 5 8
      update/src/main/java/com/ysnows/update/StormUpgradeActivity.java
  27. 0 45
      update/src/main/java/com/ysnows/update/component/CpUpdate.java
  28. 36 0
      update/src/main/java/com/ysnows/update/component/UpdateUtils.kt
  29. 3 2
      update/src/main/java/com/ysnows/update/util/InitUpgrade.java
  30. 2 0
      update/src/main/res/layout/activity_custom_upgrade.xml

+ 5 - 4
app/build.gradle

@@ -121,11 +121,12 @@ android {
 dependencies {
 
     implementation project(':base')
-    addComponent 'update'
+    implementation project(path: ':update')
+
   // addComponent 'umeng'
-    addComponent 'jpush'
+//    addComponent 'jpush'
 //    addComponent 'gaode'
-   addComponent 'lookimg'
+//   addComponent 'lookimg'
 
     //首页导航图
     implementation 'cn.bingoogolapple:bga-banner:2.2.6@aar'//首页导航图
@@ -137,7 +138,7 @@ dependencies {
      //时间选择器
     implementation 'com.contrarywind:Android-PickerView:4.1.9'
    //选择图片
-    implementation 'com.github.LuckSiege.PictureSelector:picture_library:v2.5.9'
+    implementation 'com.github.LuckSiege.PictureSelector:picture_library:v2.6.0'
 
     //高仿微信朋友圈图片展示效果 ImageWatcher
     implementation 'com.github.iielse:ImageWatcher:2.1.2'

+ 0 - 98
app/src/main/java/com/zswc/creativity/App.java

@@ -1,98 +0,0 @@
-package com.zswc.creativity;
-
-
-import com.zswc.creativity.activity.CustomErrorActivity;
-import com.zswc.creativity.config.Config;
-import com.zswc.creativity.utils.WeChatUtil;
-import com.ysnows.base.base.BApp;
-import com.ysnows.base.ccretrofit.CCRetrofit;
-import com.ysnows.base.config.IConfig;
-import com.ysnows.base.route.IGaode;
-import com.ysnows.base.route.IJpush;
-import com.ysnows.base.route.IUpdate;
-import cat.ereza.customactivityoncrash.config.CaocConfig;
-
-public class App extends BApp {
-
-    private static App app = null;
-
-    private IConfig config;
-
-
-    @Override
-    protected void init() {
-        app = this;
-
-//        new Thread() {
-//            @Override
-//            public void run() {
-//                super.run();
-//
-//                CCRetrofit.instance()
-//                        .create(IUpdate.class)
-//                        .init()
-//                        .subscribe();
-//
-//                //注册微信
-//                WeChatUtil.Companion.regToWx(app);
-//
-//            }
-//        }.start();
-
-        CCRetrofit.instance()
-                .create(IUpdate.class)
-                .init()
-                .subscribe();
-
-        //注册微信
-        WeChatUtil.Companion.regToWx(app);
-
-
-        //一键登录
-        CCRetrofit.instance()
-                .with(app)
-                .create(IJpush.class)
-                .init()
-                .subscribe();
-
-        CCRetrofit.instance()
-                .with(app)
-                .create(IJpush.class)
-                .initPush()
-                .subscribe();
-
-//        CCRetrofit.instance()
-//                .create(IUmeng.class)
-//                .init()
-//                .subscribe();
-
-
-        CCRetrofit.instance()
-                .create(IGaode.class)
-                .setNotification()
-                .subscribe();
-
-        //整个配置属性,可以设置一个或多个,也可以一个都不设置
-        CaocConfig.Builder.create()
-                .showErrorDetails(true)
-                .errorActivity(CustomErrorActivity.class)
-               // .eventListener(new CustomEventListener())
-                .apply();
-
-    }
-
-
-
-    public static App getApp() {
-        return app;
-    }
-
-
-    @Override
-    public IConfig config() {
-        if (config == null) {
-            config = new Config();
-        }
-        return config;
-    }
-}

+ 69 - 0
app/src/main/java/com/zswc/creativity/App.kt

@@ -0,0 +1,69 @@
+package com.zswc.creativity
+
+import android.speech.tts.TextToSpeech
+import android.util.Log
+import cat.ereza.customactivityoncrash.config.CaocConfig
+import com.ysnows.base.base.BApp
+import com.ysnows.base.config.IConfig
+import com.ysnows.update.component.UpdateUtils
+import com.zswc.creativity.activity.CustomErrorActivity
+import com.zswc.creativity.config.Config
+import java.util.*
+
+
+class App : BApp() {
+    private val TAG = "MIXPUSH"
+
+
+
+    override fun init() {
+        config = Config
+
+        instance = this
+
+        tts = TextToSpeech(applicationContext) { status ->
+            if (status == TextToSpeech.SUCCESS) tts?.language = Locale.CHINESE
+        }
+
+        UpdateUtils.init(this)
+
+        //注册微信
+       // regToWx(this)
+        //  Bugtags.start(instance()!!.config()!!.bugTagsAppkey(), this, Bugtags.BTGInvocationEventBubble)
+
+
+
+//        CCRetrofit.instance()
+//                .create(IUmeng.class)
+//                .init()
+//                .subscribe();
+
+        //整个配置属性,可以设置一个或多个,也可以一个都不设置
+        CaocConfig.Builder.create()
+                .showErrorDetails(true)
+                .errorActivity(CustomErrorActivity::class.java) // .eventListener(new CustomEventListener())
+                .apply()
+    }
+
+    override fun config(): IConfig? {
+        return config
+    }
+
+
+
+
+    companion object {
+
+        //全局弹框
+        var isShow = 0 //1是已经弹出
+
+
+        var tts: TextToSpeech? = null
+
+
+        lateinit var instance: App
+
+
+    }
+
+}

+ 4 - 0
app/src/main/java/com/zswc/creativity/activity/MainActivity.kt

@@ -12,6 +12,7 @@ import com.zswc.creativity.fragment.HomeFirstFragment
 import com.zswc.creativity.fragment.HomeMyFragment
 import com.zswc.creativity.vmodel.MainVModel
 import com.ysnows.base.utils.KeySimulateUtils
+import com.ysnows.update.component.UpdateUtils
 import java.util.*
 
 /**
@@ -25,6 +26,9 @@ class MainActivity : MBActivity<MainVModel, ActivityMainBinding>(){
         super.init(savedInstanceState)
         StatusBarCompat.setStatusBarColor(this, Color.parseColor("#00ffffff"))
         initData()
+        //检查更新
+        UpdateUtils.checkUpgrade(false,true)
+
 
     }
 

+ 101 - 1
app/src/main/java/com/zswc/creativity/activity/MyInfoActivity.kt

@@ -1,23 +1,59 @@
 package com.zswc.creativity.activity
 
+import android.Manifest
+import android.app.Activity
+import android.content.Intent
 import android.os.Bundle
+import android.util.Log
+import androidx.core.net.toUri
+import androidx.lifecycle.lifecycleScope
+import com.eazypermissions.common.model.PermissionResult
+import com.eazypermissions.coroutinespermission.PermissionManager
+import com.luck.picture.lib.PictureSelector
+import com.qmuiteam.qmui.kotlin.onClick
 import com.zswc.creativity.base.MBActivity
+import com.zswc.creativity.config.MIntentAction
 import com.zswc.creativity.databinding.ActivityMyInfoBinding
 import com.zswc.creativity.databinding.ActivitySpreadBinding
+import com.zswc.creativity.inte.OnUploadCallback
+import com.zswc.creativity.utils.ChosePhotoUtils
+import com.zswc.creativity.utils.FileUtils
+import com.zswc.creativity.utils.OssUtils
 import com.zswc.creativity.vmodel.MyInfoVModel
 import com.zswc.creativity.vmodel.SpreadVModel
+import kotlinx.coroutines.launch
+import java.util.ArrayList
 
 /**
  * 我的账户信息
  *Created by shihuiyun
  */
-class MyInfoActivity : MBActivity<MyInfoVModel, ActivityMyInfoBinding>() {
+class MyInfoActivity : MBActivity<MyInfoVModel, ActivityMyInfoBinding>(), OnUploadCallback<String> {
 
     override fun init(savedInstanceState: Bundle?) {
         super.init(savedInstanceState)
 
     }
 
+    override fun listeners() {
+        super.listeners()
+        binding.imgAvator.onClick {
+            lifecycleScope.launch {
+                if (PermissionManager.requestPermissions(
+                                this@MyInfoActivity, 1000,
+                                Manifest.permission.CAMERA,
+                                Manifest.permission.WRITE_EXTERNAL_STORAGE,
+                                Manifest.permission.READ_EXTERNAL_STORAGE
+                        ) is PermissionResult.PermissionGranted
+                ) {
+
+                    ChosePhotoUtils.getChosePhoto(view()!!.context(), 1)
+                }
+
+            }
+        }
+    }
+
     override fun binding(): ActivityMyInfoBinding {
        return ActivityMyInfoBinding.inflate(layoutInflater)
     }
@@ -30,5 +66,69 @@ class MyInfoActivity : MBActivity<MyInfoVModel, ActivityMyInfoBinding>() {
         return "账户信息"
     }
 
+    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+        super.onActivityResult(requestCode, resultCode, data)
+        if (resultCode != Activity.RESULT_OK) {
+            return
+        }
+        if (requestCode == MIntentAction.REQUEST_CODE_THREE) {//图片
+
+            val selectList = PictureSelector.obtainMultipleResult(data)
+            val list = ArrayList<String>()
+            if (null != selectList) {
+                if(selectList[0].path.contains("content://")){
+
+                    val cr = this.contentResolver
+
+                    list.add( FileUtils.getFilePathFromContentUri(selectList[0].path.toUri(),cr))
+
+                }else{
+                    list.add(selectList[0].path)
+                }
+
+                OssUtils(this,vm)
+                        .setUpLoad("bank", list, this)
+
+            }
+
+            return
+
+        }
+        if (requestCode == MIntentAction.REQUEST_CODE_CAMERA) {//拍照
+            //拍照
+            val selectList = PictureSelector.obtainMultipleResult(data) ?: return
+            val list = ArrayList<String>()
+            if(selectList[0].path.contains("content://")){
+
+                val cr = this.contentResolver
+                list.add( FileUtils.getFilePathFromContentUri(selectList[0].path.toUri(),cr))
+
+            }else{
+                list.add(selectList[0].path)
+            }
+            OssUtils(this, vm)
+                    .setUpLoad("bank", list, this)
+
+            return
+        }
+
+    }
+
+    override fun onUploadSuccess(t: String) {
+        val ss: Array<String> = t.split(",".toRegex()).toTypedArray()
+        //ss[0]--//不完整路径-接口需要   ss[1]完整路径
+
+        Log.e("-shy-", "ss[1]=: "+ss[1] )
+
+//        vm.image = ss[1]
+//        vm.discernBank(ss[1])
+
+
+    }
+
+    override fun onUploadError(error: String?) {
+        TODO("Not yet implemented")
+    }
+
 
 }

+ 3 - 0
app/src/main/java/com/zswc/creativity/activity/MyWalletActivity.kt

@@ -19,6 +19,9 @@ class MyWalletActivity : MBRActivity<MyWalletVModel, MyWalletAdapter, ActivityMy
         return MyWalletAdapter(vm)
     }
 
+    override fun transluent(): Boolean {
+        return true
+    }
 
     override fun title(): String? {
         return null

+ 4 - 1
app/src/main/java/com/zswc/creativity/activity/WithdrawActivity.kt

@@ -27,9 +27,12 @@ class WithdrawActivity : MBActivity<WithdrawVModel, ActivityWithdrawBinding>() {
     override fun vmClass(): Class<WithdrawVModel> {
         return WithdrawVModel::class.java
     }
+    override fun transluent(): Boolean {
+        return true
+    }
 
     override fun title(): String? {
-        return "账户信息"
+        return null
     }
 
 

+ 1 - 1
app/src/main/java/com/zswc/creativity/config/Config.kt

@@ -3,7 +3,7 @@ package com.zswc.creativity.config
 import com.zswc.creativity.BuildConfig
 import com.ysnows.base.config.IConfig
 
-class Config : IConfig {
+object  Config : IConfig {
     override fun baseUrl(): String {
       // return "https://heifengwuliu.qs110.com/"
      // return "https://heifengwuliudev.qs110.com/"

+ 7 - 0
app/src/main/java/com/zswc/creativity/config/IConfigBugly.java

@@ -0,0 +1,7 @@
+package com.zswc.creativity.config;
+
+public interface IConfigBugly {
+
+    String buglyAppId();
+
+}

+ 24 - 58
app/src/main/java/com/zswc/creativity/utils/ChosePhotoUtils.java

@@ -2,6 +2,7 @@ package com.zswc.creativity.utils;
 
 import android.app.Activity;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.util.Log;
 import android.view.View;
 
@@ -20,7 +21,12 @@ import com.yanzhenjie.permission.runtime.Permission;
  */
 public class ChosePhotoUtils {
 
-    public static void getChosePhoto(Context context, int maxPics){
+    public static void getChosePhoto(Context context, int maxPics) {
+        getChosePhoto(context, maxPics, null);
+
+    }
+
+    public static void getChosePhoto(Context context, int maxPics, DialogInterface.OnDismissListener dismissListener) {
 
         new QMUIBottomSheet.BottomListSheetBuilder(context)
                 .addItem("拍照")
@@ -31,70 +37,30 @@ public class ChosePhotoUtils {
                 .setOnSheetItemClickListener(new QMUIBottomSheet.BottomListSheetBuilder.OnSheetItemClickListener() {
                     @Override
                     public void onClick(QMUIBottomSheet dialog, View itemView, int position, String tag) {
-
                         if (position == 0) {
-                            AndPermission.with(context)
-                                    .runtime()
-                                    .permission(
-                                            Permission.CAMERA,
-                                            Permission.WRITE_EXTERNAL_STORAGE,
-                                            Permission.READ_EXTERNAL_STORAGE)
-                                    .onGranted(permissions -> {
-
-//                                        ImageSelectorUtils.showCameraAction((Activity) context, C.REQUEST_CODE_CAMERA);
+                            PictureSelector.create((Activity) context)
+                                    .openCamera(PictureMimeType.ofImage())
+                                    .imageEngine(LoadEngin.INSTANCE) // Please refer to the Demo GlideEngine.java
+                                    .forResult(MIntentAction.REQUEST_CODE_CAMERA);
 
-                                        Log.e("-shy-", "--相机-- " );
-                                        PictureSelector.create((Activity) context)
-                                                .openCamera(PictureMimeType.ofImage())
-                                                .imageEngine(LoadEngin.INSTANCE) // Please refer to the Demo GlideEngine.java
-                                                .forResult(MIntentAction.REQUEST_CODE_CAMERA);
-
-                                        dialog.dismiss();
-
-
-                                    })
-                                    .onDenied(permissions -> {
-                                        dialog.dismiss();
-                                    })
-                                    .start();
+                            dialog.dismiss();
                         } else {
-
-                            AndPermission.with(context)
-                                    .runtime()
-                                    .permission(
-                                            Permission.CAMERA,
-                                            Permission.WRITE_EXTERNAL_STORAGE,
-                                            Permission.READ_EXTERNAL_STORAGE)
-                                    .onGranted(permissions -> {
-
-                                        //照片
-                                        PictureSelector.create((Activity) context)
-                                        .openGallery(PictureMimeType.ofImage())
-                                                .imageEngine( LoadEngin.INSTANCE)// 外部传入图片加载引擎,必传项
-                                                .isMaxSelectEnabledMask(true)// 选择数到了最大阀值列表是否启用蒙层效果
-                                                .maxSelectNum(maxPics)
-                                                .selectionMode(PictureConfig.MULTIPLE)
-                                                .isPreviewImage(true)// 是否可预览图片
-                                                .isCompress(false)// 是否压缩
-                                                .forResult(MIntentAction.REQUEST_CODE_IMG);
-                                        dialog.dismiss();
-
-
-                                    })
-                                    .onDenied(permissions -> {
-                                        dialog.dismiss();
-                                    })
-                                    .start();
-
+                            //照片
+                            PictureSelector.create((Activity) context)
+                                    .openGallery(PictureMimeType.ofImage())
+                                    .imageEngine(LoadEngin.INSTANCE)// 外部传入图片加载引擎,必传项
+                                    .isMaxSelectEnabledMask(true)// 选择数到了最大阀值列表是否启用蒙层效果
+                                    .maxSelectNum(maxPics)
+                                    .selectionMode(PictureConfig.MULTIPLE)
+                                    .isPreviewImage(true)// 是否可预览图片
+                                    .isCompress(false)// 是否压缩
+                                    .forResult(MIntentAction.REQUEST_CODE_IMG);
+                            dialog.dismiss();
                         }
-
-
                     }
                 })
+                .setOnBottomDialogDismissListener(dismissListener)
                 .build()
                 .show();
-
-
-
     }
 }

+ 6 - 6
app/src/main/java/com/zswc/creativity/utils/PackageUtils.java

@@ -67,10 +67,10 @@ public class PackageUtils {
     }
 
 
-    public static void openApp(Context context, String packageName) {
-        Intent intent = App.getApp().getPackageManager().getLaunchIntentForPackage(packageName);
-        if (intent != null) {
-            context.startActivity(intent);
-        }
-    }
+//    public static void openApp(Context context, String packageName) {
+//        Intent intent = App.getApp().getPackageManager().getLaunchIntentForPackage(packageName);
+//        if (intent != null) {
+//            context.startActivity(intent);
+//        }
+//    }
 }

+ 1 - 4
app/src/main/java/com/zswc/creativity/utils/SettingsUtil.kt

@@ -1,9 +1,6 @@
 package com.zswc.creativity.utils
 
-import android.appwidget.AppWidgetManager
-import android.content.Intent
 import com.hwangjr.rxbus.RxBus
-import com.zswc.creativity.App
 import com.zswc.creativity.config.ConfigRx
 import com.zswc.creativity.model.AppSetting
 import com.ysnows.base.utils.MMKVManager
@@ -19,7 +16,7 @@ object SettingsUtil {
         MMKVManager.instance().encode("setting_pin_google_icon", enable)
 
         RxBus.get().post(ConfigRx.ROUND_SEARCH_BAR_CHANGED, "changed")
-        App.getApp().sendBroadcast(Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE))
+       // App.getApp().sendBroadcast(Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE))
 
     }
 

+ 7 - 0
app/src/main/java/com/zswc/creativity/vmodel/HomeFirstVModel.kt

@@ -7,6 +7,8 @@ import com.zswc.creativity.model.HomeBanner
 import com.zswc.creativity.utils.net.NetEngine
 import com.ysnows.base.base.BRepository
 import com.ysnows.base.base.BViewModel
+import com.ysnows.base.utils.UiSwitch
+import com.zswc.creativity.activity.CertificationActivity
 import kotlinx.coroutines.launch
 
 /**
@@ -38,6 +40,11 @@ open class HomeFirstVModel(application: Application) : BViewModel<BRepository>(a
         toGetBanner()
     }
 
+    fun toCertification(){
+
+        UiSwitch.single(repository().context, CertificationActivity::class.java)
+
+    }
 
     fun  toGetBanner(){
         viewModelScope.launch {

+ 6 - 0
app/src/main/java/com/zswc/creativity/vmodel/MyInfoVModel.kt

@@ -6,6 +6,7 @@ import com.tencent.mmkv.MMKV
 import com.ysnows.base.base.BRepository
 import com.ysnows.base.base.BViewModel
 import com.ysnows.base.utils.UiSwitch
+import com.zswc.creativity.utils.ChosePhotoUtils
 
 class MyInfoVModel(application: Application) : BViewModel<BRepository>(application)  {
 
@@ -16,7 +17,12 @@ class MyInfoVModel(application: Application) : BViewModel<BRepository>(applicati
         UiSwitch.single_new_task_with_clear_task(repository().context, LoginActivity::class.java)
     }
 
+    fun choseImg(){
 
+        //选择照片
+        ChosePhotoUtils.getChosePhoto(view()!!.context(), 1)
+
+    }
 
 
 

+ 10 - 5
app/src/main/res/layout/activity_my_info.xml

@@ -38,6 +38,7 @@
 
 
             <com.qmuiteam.qmui.widget.QMUIRadiusImageView
+                android:id="@+id/img_avator"
                 android:layout_width="38dp"
                 android:layout_height="38dp"
                 android:layout_marginEnd="8dp"
@@ -78,14 +79,18 @@
                 android:textColor="@color/text_title"
                 android:textSize="15sp" />
 
-            <TextView
+            <com.ysnows.base.widget.DelEditText
                 android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="收藏家Edit_"
-                android:textColor="#999999"
+                android:layout_height="match_parent"
+                android:background="@null"
+                android:hint="收藏家Edit_"
+                android:inputType="phone"
+                android:paddingStart="12dp"
+                android:paddingEnd="8dp"
+                android:textColor="@color/text_title"
+                android:textColorHint="#999999"
                 android:textSize="15sp" />
 
-
             <ImageView
                 android:layout_width="6dp"
                 android:layout_height="12dp"

+ 1 - 0
app/src/main/res/layout/fragment_home_first.xml

@@ -191,6 +191,7 @@
                      android:text="去实名"
                      android:textSize="15sp"
                      app:qmui_radius="4dp"
+                     android:onClick="@{v->vm.toCertification()}"
                      app:qmui_backgroundColor="#38D3D3"
                      app:qmui_borderColor="@color/translucent"
                      android:textColor="@color/white"

+ 1 - 1
app/src/main/res/layout/fragment_home_my.xml

@@ -594,7 +594,6 @@
                 android:layout_height="wrap_content"
                 android:layout_marginStart="50dp"
                 android:layout_marginEnd="50dp"
-                android:onClick="@{v->vm.toCertification()}"
                 android:orientation="vertical"
                 app:qmui_backgroundColor="@color/white"
                 app:qmui_borderColor="@color/translucent"
@@ -633,6 +632,7 @@
                     android:layout_marginEnd="50dp"
                     android:layout_marginBottom="20dp"
                     android:text="实名认证"
+                    android:onClick="@{v->vm.toCertification()}"
                     android:textColor="@color/white"
                     android:textSize="15sp"
                     android:textStyle="bold"

+ 8 - 5
base/src/main/java/com/ysnows/base/base/BApp.kt

@@ -1,13 +1,15 @@
 package com.ysnows.base.base
 
+import android.app.Activity
 import android.app.ActivityManager
 import android.app.Application
 import android.os.Process
+import com.billy.cc.core.component.BuildConfig
 import com.billy.cc.core.component.CC
 import com.kingja.loadsir.callback.SuccessCallback
 import com.kingja.loadsir.core.LoadSir
 import com.tencent.mmkv.MMKV
-import com.ysnows.base.BuildConfig
+import com.ysnows.base.config.IConfig
 import com.ysnows.base.config.IConfigInit
 import com.ysnows.base.emptyview.callback.*
 import io.reactivex.plugins.RxJavaPlugins
@@ -40,14 +42,13 @@ abstract class BApp : Application(), IConfigInit {
     }
 
     private fun initCC() {
-        CC.enableVerboseLog(BuildConfig.DEBUG)
-        CC.enableDebug(BuildConfig.DEBUG)
+        CC.enableVerboseLog(com.ysnows.base.BuildConfig.DEBUG)
+        CC.enableDebug(com.ysnows.base.BuildConfig.DEBUG)
 //        CC.enableRemoteCC(BuildConfig.DEBUG);
     }
 
     private fun initMMKV() {
         val rootDir = MMKV.initialize(this)
-        println("mmkv root: $rootDir")
     }
 
     private fun initLoadSir() {
@@ -79,11 +80,13 @@ abstract class BApp : Application(), IConfigInit {
     companion object {
         const val TAG = "MiPush"
         private var instance: BApp? = null
-
+        lateinit var config: IConfig
 
         @JvmStatic
         fun instance(): BApp? {
             return instance
         }
     }
+
+
 }

+ 6 - 2
common-build.gradle

@@ -52,8 +52,12 @@ dependencies {
     implementation "androidx.lifecycle:lifecycle-viewmodel:$rootProject.archLifecycleVersion"
     implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion"
     implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.archLifecycleVersion"
+
+    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$rootProject.archLifecycleVersion"
+    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$rootProject.archLifecycleVersion"
+
 //
-    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
+    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
 
 
     implementation 'com.sagar:coroutinespermission:2.0.2'
@@ -67,7 +71,7 @@ dependencies {
 
     implementation 'com.yanzhenjie:permission:2.0.3'
 
-    implementation("io.coil-kt:coil:0.13.0")
+    implementation("io.coil-kt:coil:1.2.1")
 
     implementation "com.google.dagger:hilt-android:$hilt_version"
     kapt "com.google.dagger:hilt-android-compiler:$hilt_version"

+ 1 - 1
jpush/src/main/java/com/zswc/jpush/componnent/CpJpush.kt

@@ -4,10 +4,10 @@ import android.util.Log
 import android.widget.Toast
 import cn.jiguang.verifysdk.api.*
 import cn.jpush.android.api.JPushInterface
+import com.billy.cc.core.component.BuildConfig
 import com.billy.cc.core.component.CC
 import com.billy.cc.core.component.CCResult
 import com.billy.cc.core.component.IComponent
-import com.quansu.jpush.BuildConfig
 import com.zswc.jpush.utils.Alias
 import com.ysnows.base.ccextension.BIComponent
 import com.ysnows.base.ccretrofit.CCRetrofit

+ 0 - 6
update/.classpath

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
-	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
-	<classpathentry kind="output" path="bin/default"/>
-</classpath>

+ 0 - 23
update/.project

@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>update</name>
-	<comment>Project update created by Buildship.</comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
-	</natures>
-</projectDescription>

+ 0 - 2
update/.settings/org.eclipse.buildship.core.prefs

@@ -1,2 +0,0 @@
-connection.project.dir=..
-eclipse.preferences.version=1

+ 2 - 5
update/build.gradle

@@ -1,4 +1,4 @@
-apply from: rootProject.file('cc-settings.gradle')
+apply plugin: 'com.android.library'
 apply from: rootProject.file('common-build.gradle')
 
 
@@ -27,11 +27,8 @@ android {
 
 
 dependencies {
-//    implementation 'com.tencent.bugly:crashreport_upgrade:1.4.5'
+    implementation 'com.tencent.bugly:crashreport_upgrade:1.5.0'
 //    implementation 'mi-appstore:xiaomi-update-sdk:4.0.3'
 //    implementation 'com.tencent.bugly:nativecrashreport:latest.release'
-    implementation 'com.tencent.bugly:crashreport_upgrade:latest.release'
-//其中latest.release指代最新版本号,也可以指定明确的版本号,例如1.2.0
-    implementation 'com.tencent.bugly:nativecrashreport:latest.release'
     implementation project(':base')
 }

+ 1 - 3
update/src/main/AndroidManifest.xml

@@ -12,7 +12,6 @@
     <application
         android:allowBackup="true"
         android:label="@string/app_name"
-        android:exported="false"
         android:supportsRtl="true" >
 
         <!--        <meta-data-->
@@ -25,8 +24,7 @@
         <!--        </meta-data >-->
 
         <activity
-            android:name="com.ysnows.update.StormUpgradeActivity"
-            android:launchMode="singleTask"
+            android:name=".StormUpgradeActivity"
             android:theme="@style/dialog" />
 
     </application >

+ 5 - 8
update/src/main/java/com/ysnows/update/StormUpgradeActivity.java

@@ -39,7 +39,10 @@ public class StormUpgradeActivity extends UpgradeActivity {
 
         tvFillsieze.setText(getString(R.string.package_size) + fill_size + getString(R.string.m));
 
-        String time = times(String.valueOf(Beta.getUpgradeInfo().publishTime));
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String time = sdf.format(new Date(Beta.getUpgradeInfo().publishTime));
+
+       // String time = times(String.valueOf(Beta.getUpgradeInfo().publishTime));
         tvUpdatetime.setText(getString(R.string.update_time) + time);
         tvUpdatecontent.setText(Beta.getUpgradeInfo().newFeature);
 
@@ -47,9 +50,6 @@ public class StormUpgradeActivity extends UpgradeActivity {
     }
 
     private void updateBtn(DownloadTask task) {
-        if(null==task){
-            return;
-        }
 
         switch (task.getStatus()) {
             case DownloadTask.INIT:
@@ -96,7 +96,7 @@ public class StormUpgradeActivity extends UpgradeActivity {
             } else {
                 ss = time;
             }
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:io.agora.rtc.ss");
             Long lcc = java.lang.Long.valueOf(ss);
             String times = sdf.format(new Date(lcc * 1000L));
             return times;
@@ -132,9 +132,6 @@ public class StormUpgradeActivity extends UpgradeActivity {
         //立即升级
         buttonRight.setOnClickListener(v -> {
             DownloadTask task = Beta.startDownload();
-            if(null==task){
-                return;
-            }
             updateBtn(task);
             if (task.getStatus() == DownloadTask.DOWNLOADING) {
                 finish();

+ 0 - 45
update/src/main/java/com/ysnows/update/component/CpUpdate.java

@@ -1,45 +0,0 @@
-package com.ysnows.update.component;
-
-import com.billy.cc.core.component.CC;
-import com.billy.cc.core.component.CCResult;
-import com.billy.cc.core.component.IComponent;
-import com.tencent.bugly.beta.Beta;
-import com.ysnows.base.ccextension.BIComponent;
-import com.ysnows.update.util.InitUpgrade;
-
-/**
- * 初始化
- * CCRetrofit.getInstance()
- * .create(IUpdate.class)
- * .init();
- * <p>
- * 静默提示
- * CCRetrofit.getInstance()
- * .create(IUpdate.class)
- * .checkUpgrade(false);
- * 有提示
- * CCRetrofit.getInstance()
- * .create(IUpdate.class)
- * .checkUpgrade(true);
- */
-public class CpUpdate extends BIComponent implements IComponent {
-
-    public boolean init(CC cc) {
-        if(null!=cc.getContext()) {
-            InitUpgrade.initBugly(cc.getContext().getApplicationContext());
-            CC.sendCCResult(cc.getCallId(), CCResult.success());
-        }
-        return false;
-    }
-
-    public boolean checkUpgrade(CC cc, boolean isManual) {
-        Beta.checkUpgrade(isManual, false);//立即启动升级提示
-        CC.sendCCResult(cc.getCallId(), CCResult.success());
-        return false;
-    }
-}
-
-
-
-
-

+ 36 - 0
update/src/main/java/com/ysnows/update/component/UpdateUtils.kt

@@ -0,0 +1,36 @@
+package com.ysnows.update.component
+
+import android.content.Context
+import com.tencent.bugly.beta.Beta
+import com.ysnows.update.util.InitUpgrade
+
+/**
+ * 初始化
+ * CCRetrofit.getInstance()
+ * .create(IUpdate.class)
+ * .init();
+ *
+ *
+ * 静默提示
+ * CCRetrofit.getInstance()
+ * .create(IUpdate.class)
+ * .checkUpgrade(false);
+ * 有提示
+ * CCRetrofit.getInstance()
+ * .create(IUpdate.class)
+ * .checkUpgrade(true);
+ */
+object UpdateUtils {
+    fun init(context: Context) {
+        InitUpgrade.initBugly(context)
+    }
+
+    //    参数1:isManual 用户手动点击检查,非用户点击操作请传false
+    //    参数2:isSilence 是否显示弹窗等交互,[true:没有弹窗和toast] [false:有弹窗或toast]
+
+    fun checkUpgrade(isManual: Boolean, isSilence: Boolean) {
+        Beta.checkUpgrade(isManual, isSilence) //立即启动升级提示
+    }
+
+
+}

+ 3 - 2
update/src/main/java/com/ysnows/update/util/InitUpgrade.java

@@ -4,6 +4,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.os.Environment;
 import android.os.Handler;
+
 import com.tencent.bugly.Bugly;
 import com.tencent.bugly.beta.Beta;
 import com.tencent.bugly.beta.upgrade.UpgradeStateListener;
@@ -23,7 +24,7 @@ public class InitUpgrade {
 
     public static void initBugly(Context context) {
         Beta.autoInit = true;
-        Beta.autoCheckUpgrade = false;
+        Beta.autoCheckUpgrade = true;
         Beta.enableNotification = true;
         Beta.showInterruptedStrategy = true;
         Beta.initDelay = 1 * 500;
@@ -77,6 +78,6 @@ public class InitUpgrade {
             }
         };
 
-        Bugly.init(context, BApp.instance().config().buglyAppId(), BuildConfig.DEBUG);
+        Bugly.init(context, BApp.config.buglyAppId(), BuildConfig.DEBUG);
     }
 }

+ 2 - 0
update/src/main/res/layout/activity_custom_upgrade.xml

@@ -85,10 +85,12 @@
                     android:layout_marginTop="5dp"
                     android:orientation="vertical"
                     >
+
                     <TextView
                         android:id="@+id/tv_updatecontent"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
+                        android:background="#ffffff"
                         android:lineSpacingExtra="5dp"
                         android:textColor="#303237"
                         android:textSize="14sp"