Explorar el Código

更新版本到2.5;打点添加参数:邀请人的邀请码;修复个人资料中绵羊号复制功能的兼容性问题;修复个人资料中修改用户头像成功后,返回到个人中心时用户头像没有及时更新的问题

zengjiebin hace 8 años
padre
commit
fe03354b23

+ 24 - 32
app/src/main/java/com/kfzs/duanduan/fragment/FgtPersonalCenter.java

@@ -1,6 +1,7 @@
 package com.kfzs.duanduan.fragment;
 
 import android.os.Bundle;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -21,6 +22,7 @@ import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.FastJsonUtils;
 import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.activity.PersonalCenterAct;
@@ -62,41 +64,32 @@ public class FgtPersonalCenter extends BaseCompatFragment {
     }
 
     private void initData() {
-        getShardData();
-        try {
-            userEntitys = MyDbManager.getInstance().dbFindUser();
-        } catch (DbException e) {
-            e.printStackTrace();
-        }
-        if(userEntitys != null){
-            initWidget();
-        }else {
-            SheepApp.get(getActivity())
-                    .getNetComponent()
-                    .getApiService()
-                    .getInfo()
-                    .subscribeOn(Schedulers.io())
-                    .observeOn(AndroidSchedulers.mainThread())
-                    .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
-                        @Override
-                        public void onError(BaseMessage baseMessage) {
-                            G.showToast(baseMessage.getMsg() +"");
-
-                        }
+        SheepApp.getInstance().getNetComponent().getApiService().getInfo()
+                        .subscribeOn(Schedulers.io())
+                        .observeOn(AndroidSchedulers.mainThread())
+                        .subscribe(new SheepSubscriber<BaseMessage>(getContext()) {
+                            @Override
+                            public void onNext(BaseMessage baseMessage) {
+                                LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
+                                updateData(baseMessage);
+                            }
 
-                        @Override
-                        public void onNext(BaseMessage baseMessage) {
-                            userEntitys = JSON.parseObject(JSONObject.toJSONString(baseMessage.getData()), UserEntity.class);
-                            try {
-                                MyDbManager.getInstance().saveOrUpdateUser(userEntitys);
-                            } catch (Exception e) {
-                                e.printStackTrace();
+                            @Override
+                            public void onError(BaseMessage baseMessage) {
+                                LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
                             }
-                            initWidget();
-                        }
-                    });
+                        });
+        getShardData();
+    }
 
+    private void updateData(BaseMessage baseMessage) {
+        userEntitys = baseMessage.getData(UserEntity.class);
+        try {
+            MyDbManager.getInstance().saveOrUpdateUser(userEntitys);
+        } catch (Exception e) {
+            e.printStackTrace();
         }
+        initWidget();
     }
 
     private void initWidget(){
@@ -115,7 +108,6 @@ public class FgtPersonalCenter extends BaseCompatFragment {
         // TODO: inflate a fragment view
         View rootView = super.onCreateView(inflater, container, savedInstanceState);
         unbinder = ButterKnife.bind(this, rootView);
-        initData();
         return rootView;
     }
 

+ 8 - 8
app/src/main/java/com/sheep/gamegroup/model/util/SheepSubscriber.java

@@ -70,14 +70,14 @@ public abstract class SheepSubscriber<T> extends Subscriber<T> {
                 if(throwable.message.startsWith("{")){
                     baseMessage = JSONObject.parseObject(throwable.message, BaseMessage.class);
                 }else if(ViewUtil.isH5Content(throwable.message)){
-                    if(BuildConfig.DEBUG){
-                        StringBuilder title = new StringBuilder("调用接口错误");
-                        if(e instanceof HttpException) {
-                            title.append(";");
-                            title.append(((HttpException) e).response().toString());
-                        }
-                        Jump2View.getInstance().goNotice(ActivityManager.getInstance().currentActivity(), title.toString(), throwable.message, 0);
-                    }
+//                    if(BuildConfig.DEBUG){
+//                        StringBuilder title = new StringBuilder("调用接口错误");
+//                        if(e instanceof HttpException) {
+//                            title.append(";");
+//                            title.append(((HttpException) e).response().toString());
+//                        }
+//                        Jump2View.getInstance().goNotice(ActivityManager.getInstance().currentActivity(), title.toString(), throwable.message, 0);
+//                    }
                     baseMessage = new BaseMessage();
                     baseMessage.setMsg("服务器错误");
                 }else {

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/statistics/AppStatistics.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.ChannelContent;
 import com.sheep.gamegroup.util.DeviceUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
@@ -58,6 +59,7 @@ public class AppStatistics {
         jsonObject.put("type",type);
         jsonObject.put("subtype",subType);
         jsonObject.put("substring",subString);
+        jsonObject.put("invitation_code", ChannelContent.getInstance().getChannel_name());
         apiService.appEventTracking(jsonObject).subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {

+ 1 - 32
app/src/main/java/com/sheep/gamegroup/view/activity/PersonalCenterAct.java

@@ -29,12 +29,9 @@ import javax.inject.Inject;
  * Created by ljy on 2018/3/10.
  */
 
-public class PersonalCenterAct extends BaseActivity implements PersonalCenterContract.View{
+public class PersonalCenterAct extends BaseActivity {
 
     Activity activity;
-    @Inject
-    PersonalCenterPresenter presenter;
-    UserEntity userEntity;
 
     @Override
     protected int getLayoutId() {
@@ -44,11 +41,6 @@ public class PersonalCenterAct extends BaseActivity implements PersonalCenterCon
     @Override
     public void initView() {
         activity = this;
-        DaggerPersonalCenterComponent.builder()
-                .netComponent(SheepApp.get(this).getNetComponent())
-                .personalCenterModule(new PersonalCenterModule(this))
-                .build()
-                .inject(this);
 
         TitleBarUtils
                 .getInstance()
@@ -83,30 +75,7 @@ public class PersonalCenterAct extends BaseActivity implements PersonalCenterCon
 
     @Override
     public void initData() {
-        presenter.getUserInfo();
 
     }
 
-    @Override
-    public void updateData2View(Object o) {
-        Log.e("---getInfo-", o.toString());
-        if(o == null){
-            return;
-        }
-        BaseMessage baseMessage = (BaseMessage) o;
-        userEntity = JSON.parseObject(JSONObject.toJSONString(baseMessage.getData()), UserEntity.class);
-
-        try {
-            MyDbManager.getInstance().saveOrUpdateUser(userEntity);
-            UserEntity userEntitys = MyDbManager.getInstance().dbFindUser();
-            Log.e("------userEntity",userEntity.getNickname()+"|"+userEntity.getMobile()+"");
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    @Override
-    public void failData2View(Object o) {
-        showToast("网络错误");
-    }
 }

+ 1 - 4
app/src/main/res/layout/xpersion_info_act_layout.xml

@@ -136,16 +136,13 @@
 
 
 
-            <EditText
+            <TextView
                 android:id="@+id/tv_sheep_id"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:background="@null"
-                android:src="@mipmap/icon"
                 android:layout_alignParentEnd="true"
                 android:layout_centerVertical="true"
                 android:textCursorDrawable="@null"
-                android:inputType="none"
                 android:textIsSelectable="true"
                 />
 

+ 2 - 2
gradle.properties

@@ -17,8 +17,8 @@
 # org.gradle.parallel=true
 #android.injected.build.model.only.versioned = 3
 
-VERSION_NAME=2.4.0
-VERSION_CODE=2004000
+VERSION_NAME=2.5.0
+VERSION_CODE=2005000
 ANDROID_COMPILE_SDK_VERSION=27
 ANDROID_BUILD_TOOLS_VERSION=27.0.2
 ANDROID_MIN_SDK_VERSION=18