|
|
@@ -17,10 +17,16 @@ import com.usoftchina.uu.mobile.grpc.api.AccountSignoutRequest;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.AccountSignoutResponse;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.AccountSignupRequest;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.AccountSignupResponse;
|
|
|
+import com.usoftchina.uu.mobile.grpc.api.AppServiceGrpc;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.AuthedToken;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.DeviceInfo;
|
|
|
+import com.usoftchina.uu.mobile.grpc.api.GetAppConfigRequest;
|
|
|
+import com.usoftchina.uu.mobile.grpc.api.GetAppConfigResponse;
|
|
|
+import com.usoftchina.uu.mobile.grpc.api.GetHomeConfigRequest;
|
|
|
+import com.usoftchina.uu.mobile.grpc.api.GetHomeConfigResponse;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.GetMessageConfigRequest;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.GetMessageConfigResponse;
|
|
|
+import com.usoftchina.uu.mobile.grpc.api.HomeServiceGrpc;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.MessageServiceGrpc;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.ResponseHeader;
|
|
|
import com.usoftchina.uu.mobile.grpc.api.SwitchCompanyRequest;
|
|
|
@@ -68,6 +74,10 @@ public class TestMainActivity extends AppCompatActivity {
|
|
|
|
|
|
//读取配置
|
|
|
getConfig();
|
|
|
+ //应用配置
|
|
|
+ getAppConfig();
|
|
|
+ //我的配置
|
|
|
+ getMeConfig();
|
|
|
}
|
|
|
}).start();
|
|
|
|
|
|
@@ -119,7 +129,9 @@ public class TestMainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
AuthedToken token = response.getAuthedToken();
|
|
|
+
|
|
|
LogUtils.d("login token:"+token.getToken());
|
|
|
+ LogUtils.d("account:"+JSON.toJSONString(response.getAccount()));
|
|
|
// 登录成功后记录auth信息
|
|
|
Authentication.set(token.getToken());
|
|
|
|
|
|
@@ -220,4 +232,47 @@ public class TestMainActivity extends AppCompatActivity {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public void getAppConfig() {
|
|
|
+ GetAppConfigRequest request = GetAppConfigRequest.newBuilder().build();
|
|
|
+ try {
|
|
|
+ GetAppConfigResponse response = AppServiceGrpc.newBlockingStub(channel).getConfig(request);
|
|
|
+ ResponseHeader header = response.getResponseHeader();
|
|
|
+ if (header.getSuccess()) {
|
|
|
+ if (response.getConfigCount() > 0) {
|
|
|
+ LogUtils.d("应用配置:"+ JSON.toJSONString(response.getConfigList()));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // error return by ResponseHeader
|
|
|
+ System.err.println(header.getCode() + "," + header.getMessage());
|
|
|
+ }
|
|
|
+ } catch (StatusRuntimeException e) {
|
|
|
+ // error return by Exception
|
|
|
+ System.err.println(e.getStatus().getCode() + "," + e.getStatus().getDescription());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void getMeConfig() {
|
|
|
+ GetHomeConfigRequest request = GetHomeConfigRequest.newBuilder().build();
|
|
|
+ try {
|
|
|
+ GetHomeConfigResponse response = HomeServiceGrpc.newBlockingStub(channel).getConfig(request);
|
|
|
+ ResponseHeader header = response.getResponseHeader();
|
|
|
+ if (header.getSuccess()) {
|
|
|
+ if (response.getConfigCount() > 0) {
|
|
|
+ LogUtils.d("我的主页配置:"+JSON.toJSONString(response.getConfigList()));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // error return by ResponseHeader
|
|
|
+ System.err.println(header.getCode() + "," + header.getMessage());
|
|
|
+ }
|
|
|
+ } catch (StatusRuntimeException e) {
|
|
|
+ // error return by Exception
|
|
|
+ System.err.println(e.getStatus().getCode() + "," + e.getStatus().getDescription());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|