From 979d9cff22806f213b420452ab4a68fcbaf021b6 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 31 五月 2021 17:43:49 +0800
Subject: [PATCH] 1. 修复多项可能引起空指针崩溃的bug; 2. 新建子任务时默认执行人员从全体人员改为当前用户; 3. 新建子任务时默认执行时间强制固定为总任务对应的时段内,确保子任务执行时间不会超出总任务范围。

---
 app/src/main/java/cn/flightfeather/thirdapp/CommonApplication.java |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdapp/CommonApplication.java b/app/src/main/java/cn/flightfeather/thirdapp/CommonApplication.java
index 5eb080e..708c711 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/CommonApplication.java
+++ b/app/src/main/java/cn/flightfeather/thirdapp/CommonApplication.java
@@ -16,7 +16,11 @@
 
 import cn.flightfeather.thirdapp.bean.entity.Userinfo;
 import cn.flightfeather.thirdapp.common.net.RetrofitFactory;
+import cn.flightfeather.thirdapp.util.GlobalConfig;
 import cn.flightfeather.thirdapp.util.crashreport.MyCrashHandler;
+import cn.flightfeather.thirdapp.util.notification.MyNotificationChannel;
+import cn.flightfeather.thirdapp.util.push.PushService;
+import cn.flightfeather.thirdapp.util.tbs.Tbs;
 import retrofit2.Retrofit;
 import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
 import retrofit2.converter.gson.GsonConverterFactory;
@@ -51,6 +55,15 @@
 
         //鍒濆鍖栫綉缁滆姹�
         RetrofitFactory.init(this);
+
+        //x5鍐呮牳鍒濆鍖�
+        Tbs.Companion.init(this);
+
+        //Android8.0鍚庢敞鍐岄�氱煡閫氶亾
+        MyNotificationChannel.Companion.init(this);
+
+        //鍒濆鍖栫Щ鍔ㄦ帹閫�
+        PushService.Companion.init(this);
 
         if (instance == null) {
             instance = this;
@@ -151,12 +164,18 @@
     public Userinfo getCurrentUser() {
         if (currentUser ==null){
             userinfoDao = this.getDaoSession().getUserinfoDao();
-            currentUser = userinfoDao.queryBuilder().unique();
+            String userId = GlobalConfig.Companion.getInstance().getUserId();
+            if (userId == null) {
+                currentUser = userinfoDao.queryBuilder().unique();
+            } else {
+                currentUser = userinfoDao.queryBuilder().where(UserinfoDao.Properties.Guid.eq(userId)).unique();
+            }
         }
         return currentUser;
     }
 
     public void setCurrentUser(Userinfo currentUser) {
+        GlobalConfig.Companion.getInstance().setUserId(currentUser.getGuid());
         this.currentUser = currentUser;
     }
 

--
Gitblit v1.9.3