Commit 190b12d2203c2d7b60ef740193c272aaebd66733

Authored by 张道锋
1 parent d177b23c

no message

.idea/modules.xml
@@ -4,8 +4,8 @@ @@ -4,8 +4,8 @@
4 <modules> 4 <modules>
5 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> 5 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
6 <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" /> 6 <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" />
  7 + <module fileurl="file://$PROJECT_DIR$/parentWorkHolper.iml" filepath="$PROJECT_DIR$/parentWorkHolper.iml" />
7 <module fileurl="file://E:\parentwork\parentWorkHolper.iml" filepath="E:\parentwork\parentWorkHolper.iml" /> 8 <module fileurl="file://E:\parentwork\parentWorkHolper.iml" filepath="E:\parentwork\parentWorkHolper.iml" />
8 - <module fileurl="file://$PROJECT_DIR$/parentwork.iml" filepath="$PROJECT_DIR$/parentwork.iml" />  
9 <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" /> 9 <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" />
10 <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" /> 10 <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" />
11 </modules> 11 </modules>
app/src/main/java/com/shunzhi/parent/manager/MessageManager.java
@@ -60,12 +60,14 @@ public class MessageManager { @@ -60,12 +60,14 @@ public class MessageManager {
60 NIMClient.getService(AuthServiceObserver.class).observeOnlineStatus(new Observer<StatusCode>() { 60 NIMClient.getService(AuthServiceObserver.class).observeOnlineStatus(new Observer<StatusCode>() {
61 @Override 61 @Override
62 public void onEvent(StatusCode statusCode) { 62 public void onEvent(StatusCode statusCode) {
63 - if (statusCode==StatusCode.KICKOUT){  
64 - Intent i = new Intent(AppContext.getInstance(), LoginAndRegistActivity.class);  
65 - i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK); 63 + if (statusCode == StatusCode.KICKOUT) {
  64 + Context context = AppContext.getInstance();
  65 + Intent i = new Intent(context, LoginAndRegistActivity.class);
  66 + i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
  67 + context.startActivity(i);
66 } 68 }
67 } 69 }
68 - },true); 70 + }, true);
69 71
70 } 72 }
71 73
@@ -89,11 +91,12 @@ public class MessageManager { @@ -89,11 +91,12 @@ public class MessageManager {
89 public void onSuccess(Object o) { 91 public void onSuccess(Object o) {
90 NIMLoginResultBean bean = new NIMLoginResultBean(true, 200, null); 92 NIMLoginResultBean bean = new NIMLoginResultBean(true, 200, null);
91 subject.onNext(bean); 93 subject.onNext(bean);
  94 + Timber.i("----===onSuccess : %s",o);
92 } 95 }
93 96
94 @Override 97 @Override
95 public void onFailed(int i) { 98 public void onFailed(int i) {
96 - Timber.i("------nim login failed : %s", i); 99 + Timber.i("----===nim login failed : %s", i);
97 ToastUtils.showToast("云信服务器登录失败:" + i); 100 ToastUtils.showToast("云信服务器登录失败:" + i);
98 NIMLoginResultBean bean = new NIMLoginResultBean(false, i, null); 101 NIMLoginResultBean bean = new NIMLoginResultBean(false, i, null);
99 subject.onNext(bean); 102 subject.onNext(bean);
@@ -101,6 +104,7 @@ public class MessageManager { @@ -101,6 +104,7 @@ public class MessageManager {
101 104
102 @Override 105 @Override
103 public void onException(Throwable throwable) { 106 public void onException(Throwable throwable) {
  107 + Timber.i("----===onException");
104 if (throwable != null) throwable.printStackTrace(); 108 if (throwable != null) throwable.printStackTrace();
105 NIMLoginResultBean bean = new NIMLoginResultBean(false, 0, throwable); 109 NIMLoginResultBean bean = new NIMLoginResultBean(false, 0, throwable);
106 subject.onNext(bean); 110 subject.onNext(bean);
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
@@ -23,6 +23,7 @@ import java.util.regex.Pattern; @@ -23,6 +23,7 @@ import java.util.regex.Pattern;
23 23
24 import io.reactivex.functions.Consumer; 24 import io.reactivex.functions.Consumer;
25 import retrofit2.HttpException; 25 import retrofit2.HttpException;
  26 +import timber.log.Timber;
26 27
27 /** 28 /**
28 * Created by Administrator on 2018/3/6 0006. 29 * Created by Administrator on 2018/3/6 0006.
@@ -45,6 +46,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre @@ -45,6 +46,7 @@ public class LoginAndRegisterPresenter extends LoginAndRegisterContract.LoginPre
45 mRxManager.register(mIModel.getLoginResult(loginName, loginPwd).subscribe(new Consumer<JsonObject>() { 46 mRxManager.register(mIModel.getLoginResult(loginName, loginPwd).subscribe(new Consumer<JsonObject>() {
46 @Override 47 @Override
47 public void accept(JsonObject jsonObject) throws Exception { 48 public void accept(JsonObject jsonObject) throws Exception {
  49 + Timber.i("---=== loginResult :%s",jsonObject);
48 try { 50 try {
49 if (jsonObject != null && !TextUtils.isEmpty(jsonObject.get("access_token").getAsString())) { 51 if (jsonObject != null && !TextUtils.isEmpty(jsonObject.get("access_token").getAsString())) {
50 AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.ACCESS_TOKEN, jsonObject.get("access_token").getAsString()); 52 AppConfig.getAppConfig(AppContext.getInstance()).set(AppConfig.ACCESS_TOKEN, jsonObject.get("access_token").getAsString());