|
|
@@ -1,6 +1,18 @@
|
|
|
package com.sheep.gamegroup.util.js;
|
|
|
|
|
|
+import android.view.View;
|
|
|
+
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
+import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
+import com.sheep.gamegroup.util.CommonUtil;
|
|
|
+import com.sheep.gamegroup.util.share.ShareLinkConfig;
|
|
|
+import com.sheep.jiuyan.samllsheep.R;
|
|
|
+import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
+
|
|
|
+import rx.functions.Action1;
|
|
|
|
|
|
/**
|
|
|
* Created by realicing on 2018/11/23.
|
|
|
@@ -20,4 +32,39 @@ public abstract class BaseActWeb extends BaseActivity {
|
|
|
public void superFinish(){
|
|
|
super.finish();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public static String addUrlToken(String url) {
|
|
|
+ return addUrl(url, "authorization", SpUtils.getToken(SheepApp.getInstance()));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String addUrl(String url, String key, String value) {
|
|
|
+ return url + ((url.contains("?") || url.contains("#") && url.contains("=")) ? "&" : "?") + key + "=" + value;
|
|
|
+ }
|
|
|
+ public void setH5Type(String h5Type) {
|
|
|
+ switch (h5Type){
|
|
|
+ case "is_unicom":
|
|
|
+ TitleBarUtils
|
|
|
+ .getInstance()
|
|
|
+ .setRightImgBotton(this, R.mipmap.share, new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ CommonUtil.getInstance().callActionWithUserInfo(new Action1<UserEntity>() {
|
|
|
+ @Override
|
|
|
+ public void call(UserEntity userEntity) {
|
|
|
+ if (userEntity == null) {
|
|
|
+ G.showToast("分享功能调试中");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+// 是否是联通卡分享 1:是 0:不是
|
|
|
+// 分享链接需要加个 is_unicom 参数
|
|
|
+ String url = addUrl(userEntity.getShareLink(), "is_unicom", "1");
|
|
|
+ new ShareLinkConfig().setLink(url).toShare(BaseActWeb.this);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|