| | |
| | | |
| | | import java.io.File; |
| | | |
| | | import cn.flightfeather.thirdapp.bean.Userinfo; |
| | | 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; |
| | |
| | | |
| | | //初始化网络请求 |
| | | RetrofitFactory.init(this); |
| | | |
| | | //x5内核初始化 |
| | | Tbs.Companion.init(this); |
| | | |
| | | //Android8.0后注册通知通道 |
| | | MyNotificationChannel.Companion.init(this); |
| | | |
| | | //初始化移动推送 |
| | | PushService.Companion.init(this); |
| | | |
| | | if (instance == null) { |
| | | instance = this; |
| | |
| | | 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; |
| | | } |
| | | |