Просмотр исходного кода

添加截图方案是否启用的接口

zengjiebin лет назад: 7
Родитель
Сommit
cc9f736030

+ 6 - 0
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -1011,4 +1011,10 @@ public interface ApiService {
      */
      */
     @GET("app/event_tracking/check_user_first")
     @GET("app/event_tracking/check_user_first")
     Observable<BaseMessage> checkUserFirst();
     Observable<BaseMessage> checkUserFirst();
+    /**
+     * 查询用户截图加密开关
+     * @return
+     */
+    @GET("app/common_config/need_shot_screen")
+    Observable<BaseMessage> needShotScreen();
 }
 }

+ 23 - 3
app/src/main/java/com/sheep/gamegroup/util/DataUtil.java

@@ -18,6 +18,7 @@ import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.SystemNotification;
 import com.sheep.gamegroup.model.entity.SystemNotification;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.util.AutoTaskListUtil;
 import com.sheep.gamegroup.model.util.AutoTaskListUtil;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.service.FloatShotScreenService;
 import com.sheep.jiuyan.samllsheep.service.FloatShotScreenService;
@@ -59,9 +60,10 @@ public class DataUtil {
         if (userEntity != null && !TextUtils.equals(userEntity.getId(), uid)) {//当前用户id与缓存的用户信息不符时,清除缓存
         if (userEntity != null && !TextUtils.equals(userEntity.getId(), uid)) {//当前用户id与缓存的用户信息不符时,清除缓存
             clearData();
             clearData();
         }
         }
-
+        initScreenShotConfig();
     }
     }
 
 
+
     public static DataUtil getInstance() {
     public static DataUtil getInstance() {
         if (instance == null) {
         if (instance == null) {
             instance = new DataUtil();
             instance = new DataUtil();
@@ -292,9 +294,27 @@ public class DataUtil {
         return null;
         return null;
     }
     }
     //是否使用小绵羊截图方案
     //是否使用小绵羊截图方案
-    public static final boolean IS_USE_SCREEN_SHOT = true;
+    public static boolean IS_USE_SCREEN_SHOT = true;
     //是否监听媒体库图片变化
     //是否监听媒体库图片变化
-    public static final boolean IS_LISTEN_SCREEN_SHOT = true;
+    public static boolean IS_LISTEN_SCREEN_SHOT = true;
+    //初始化是否启用小绵羊两种截图方案
+    private void initScreenShotConfig() {
+        SheepApp.getInstance().getNetComponent().getApiService().needShotScreen()
+                        .subscribeOn(Schedulers.io())
+                        .observeOn(AndroidSchedulers.mainThread())
+                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                            @Override
+                            public void onNext(BaseMessage baseMessage) {
+                                boolean isOpen = baseMessage.getData(Boolean.class);
+                                IS_USE_SCREEN_SHOT = isOpen;
+                                IS_LISTEN_SCREEN_SHOT = isOpen;
+                            }
+
+                            @Override
+                            public void onError(BaseMessage baseMessage) {
+                            }
+                        });
+    }
     /**
     /**
      * 截图路径
      * 截图路径
      *
      *