Commit f49ab12b by zhengnw@sobot.com

common 1.5.2 域名存到SobotSharedPreferencesUtil里边

parent 9b84aab8
...@@ -9,6 +9,10 @@ import android.net.Uri; ...@@ -9,6 +9,10 @@ import android.net.Uri;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.sobot.common.login.SobotLoginTools;
import com.sobot.common.login.callback.SobotResultBlock;
import com.sobot.common.login.callback.SobotResultCode;
import com.sobot.common.login.model.HostModel;
import com.sobot.common.utils.SobotImageUtils; import com.sobot.common.utils.SobotImageUtils;
import com.sobot.pictureframe.SobotBitmapUtil; import com.sobot.pictureframe.SobotBitmapUtil;
import com.sobot.utils.SobotLogUtils; import com.sobot.utils.SobotLogUtils;
...@@ -209,8 +213,15 @@ public class MainActivity extends SobotBaseActivity { ...@@ -209,8 +213,15 @@ public class MainActivity extends SobotBaseActivity {
map1.put("ack", "1"); map1.put("ack", "1");
Map<String, String> headers1 = new HashMap<>(); Map<String, String> headers1 = new HashMap<>();
headers1.put("language", "zh"); headers1.put("language", "zh");
// HostModel hostModel=null;
// SobotLoginTools.getInstance().doAppLogin(MainActivity.this, MainActivity.this, "https://api-c.sobot.com/text","https://api-c.soboten.com/text", 8000, map1, headers1, new SobotResultBlock() { // hostModel= SobotLoginTools.getInstance().getHostInfo(MainActivity.this);
// if(hostModel==null){
// hostModel=new HostModel();
// hostModel.setHost("https://api-c.sobot.com");
// SobotLoginTools.getInstance().setHostInfo(MainActivity.this,hostModel);
// }
//
// SobotLoginTools.getInstance().doAppLogin(MainActivity.this, MainActivity.this, hostModel.getHost(),"https://api-c.soboten.com/text", 8000, map1, headers1, new SobotResultBlock() {
// @Override // @Override
// public void resultBolok(SobotResultCode code, String msg, Object obj) { // public void resultBolok(SobotResultCode code, String msg, Object obj) {
// SobotLoginTools.getInstance().checkExpiresToken(); // SobotLoginTools.getInstance().checkExpiresToken();
...@@ -219,6 +230,8 @@ public class MainActivity extends SobotBaseActivity { ...@@ -219,6 +230,8 @@ public class MainActivity extends SobotBaseActivity {
// SobotLogUtils.i(SobotLoginTools.getInstance().getToken()+""); // SobotLogUtils.i(SobotLoginTools.getInstance().getToken()+"");
// } // }
// }); // });
// LoginUserEntity sa=new LoginUserEntity(); // LoginUserEntity sa=new LoginUserEntity();
// sa.setLogin_time(System.currentTimeMillis()); // sa.setLogin_time(System.currentTimeMillis());
// SobotLoginTools.getInstance().setLoginUser(sa); // SobotLoginTools.getInstance().setLoginUser(sa);
......
...@@ -11,7 +11,7 @@ android { ...@@ -11,7 +11,7 @@ android {
//这里就是打jar包 //这里就是打jar包
task makeJar(type: Copy) { task makeJar(type: Copy) {
//删除旧的jar包 //删除旧的jar包
delete 'build/libs/sobot_common_1.5.1.jar' delete 'build/libs/sobot_common_1.5.2.jar'
//原地址 //原地址
from('build/intermediates/packaged-classes/release/') from('build/intermediates/packaged-classes/release/')
//导出jar包的地址 //导出jar包的地址
...@@ -19,7 +19,7 @@ android { ...@@ -19,7 +19,7 @@ android {
//包含的jar包 //包含的jar包
include('classes.jar') include('classes.jar')
//重命名jar包为mysdk //重命名jar包为mysdk
rename ('classes.jar', 'sobot_common_1.5.1.jar') rename ('classes.jar', 'sobot_common_1.5.2.jar')
} }
makeJar.dependsOn(build) makeJar.dependsOn(build)
} }
......
...@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) { ...@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext { ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名 PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'sobotcommon_x' //项目名 PUBLISH_ARTIFACT_ID = 'sobotcommon_x' //项目名
PUBLISH_VERSION = '1.5.1' //版本号 PUBLISH_VERSION = '1.5.2' //版本号
} }
......
...@@ -73,12 +73,25 @@ public class SobotLoginTools { ...@@ -73,12 +73,25 @@ public class SobotLoginTools {
private HostModel mHostModel; private HostModel mHostModel;
//获取域名 //获取域名
public HostModel getHostInfo() { public HostModel getHostInfo(Context context) {
if (context != null && mHostModel == null) {
mHostModel = SobotSharedPreferencesUtil.getInstance(context).get("app_login_host", HostModel.class);
}
return mHostModel; return mHostModel;
} }
public void setHostInfo(HostModel newHostModel) { public void setHostInfo(Context context, HostModel newHostModel) {
mHostModel = newHostModel; if (context != null && newHostModel != null) {
if ((newHostModel.getHost().contains("test-branche1")) || (newHostModel.getHost().contains("api-c.sobot.com") || newHostModel.getHost().contains("api-c.soboten.com")) && (!newHostModel.getHost().contains("api-c.sobot.com/text") && !newHostModel.getHost().contains("api-c.soboten.com/text"))) {
if (!newHostModel.getHost().endsWith("/")) {
newHostModel.setHost(newHostModel.getHost() + "/text/");
} else {
newHostModel.setHost(newHostModel.getHost() + "text/");
}
}
mHostModel = newHostModel;
SobotSharedPreferencesUtil.getInstance(context).put("app_login_host", newHostModel);
}
} }
//呼叫 v6 获取 accessToken //呼叫 v6 获取 accessToken
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment