version:beta
fix: update:接口优化
This commit is contained in:
@@ -73,8 +73,8 @@ android {
|
|||||||
|
|
||||||
official {
|
official {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 5
|
versionCode 6
|
||||||
versionName "1.4"
|
versionName "1.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ public class NetInterfaceManager {
|
|||||||
public void getSnInfo(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, ObserverCallback callback) {
|
public void getSnInfo(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, ObserverCallback callback) {
|
||||||
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
connectMode = ConnectMode.ONE_MINUTE;
|
connectMode = ConnectMode.ONE_HOUR;
|
||||||
}
|
}
|
||||||
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.SNINFO, connectMode)) {
|
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.SNINFO, connectMode)) {
|
||||||
getSnInfo(lifecycle, callback);
|
getSnInfo(lifecycle, callback);
|
||||||
@@ -1360,36 +1360,76 @@ public class NetInterfaceManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getBrowserWhiteList(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
|
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
||||||
|
if (refresh) {
|
||||||
|
connectMode = ConnectMode.ONE_HOUR;
|
||||||
|
}
|
||||||
|
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.SET_BROWSER_URL, connectMode)) {
|
||||||
|
getBrowserWhiteList(lifecycle, callback);
|
||||||
|
} else {
|
||||||
|
String jsonString = mCacheHelper.getAsString(UrlAddress.SET_BROWSER_URL);
|
||||||
|
//为 "" 是已经请求成功的
|
||||||
|
if (jsonString == null) {
|
||||||
|
getBrowserWhiteList(lifecycle, callback);
|
||||||
|
} else {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
Type type = new TypeToken<String>() {
|
||||||
|
}.getType();
|
||||||
|
callback.onComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getBrowserWhiteList(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
|
getBrowserControl()
|
||||||
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
|
.subscribe(getBrowserWhiteListObserver(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getBrowserWhiteList(CompleteCallback callback) {
|
||||||
|
getBrowserControl()
|
||||||
|
.subscribe(getBrowserWhiteListObserver(callback));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取浏览器黑白名单
|
* 获取浏览器黑白名单
|
||||||
*/
|
*/
|
||||||
public void getBrowserWhiteList() {
|
public void getBrowserWhiteList() {
|
||||||
getBrowserControl()
|
getBrowserControl()
|
||||||
.subscribe(new Observer<BaseResponse<BrowserApiData>>() {
|
.subscribe(getBrowserWhiteListObserver(null));
|
||||||
@Override
|
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
|
||||||
Log.e("getBrowserWhiteList", "onSubscribe: ");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(@NonNull BaseResponse<BrowserApiData> response) {
|
|
||||||
setBrowserResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(@NonNull Throwable e) {
|
|
||||||
Log.e("getBrowserWhiteList", "onError: " + e.getMessage());
|
|
||||||
onComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
Log.e("getBrowserWhiteList", "onComplete: ");
|
|
||||||
new URLUtils(mContext).setBrowserList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Observer<BaseResponse<BrowserApiData>> getBrowserWhiteListObserver(CompleteCallback callback) {
|
||||||
|
return new Observer<BaseResponse<BrowserApiData>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
Log.e("getBrowserWhiteList", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseResponse<BrowserApiData> response) {
|
||||||
|
setBrowserResponse(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
Log.e("getBrowserWhiteList", "onError: " + e.getMessage());
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("getBrowserWhiteList", "onComplete: ");
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onComplete();
|
||||||
|
}
|
||||||
|
new URLUtils(mContext).setBrowserList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setBrowserResponse(BaseResponse<BrowserApiData> response) {
|
private void setBrowserResponse(BaseResponse<BrowserApiData> response) {
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
//白名单
|
//白名单
|
||||||
@@ -1416,31 +1456,73 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void getBrowserLabel(boolean refresh, BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
|
ConnectMode connectMode = ConnectMode.SIX_HOUR;
|
||||||
|
if (refresh) {
|
||||||
|
connectMode = ConnectMode.ONE_HOUR;
|
||||||
|
}
|
||||||
|
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.SET_BROWSER_LABEL, connectMode)) {
|
||||||
|
getBrowserLabel(lifecycle, callback);
|
||||||
|
} else {
|
||||||
|
String jsonString = mCacheHelper.getAsString(UrlAddress.SET_BROWSER_LABEL);
|
||||||
|
//为 "" 是已经请求成功的
|
||||||
|
if (jsonString == null) {
|
||||||
|
getBrowserLabel(lifecycle, callback);
|
||||||
|
} else {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
Type type = new TypeToken<String>() {
|
||||||
|
}.getType();
|
||||||
|
callback.onComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getBrowserLabel(BehaviorSubject<ActivityEvent> lifecycle, CompleteCallback callback) {
|
||||||
|
getLabelControl()
|
||||||
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
|
.subscribe(getBrowserLabelObserver(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getBrowserLabel(CompleteCallback callback) {
|
||||||
|
getLabelControl()
|
||||||
|
.subscribe(getBrowserLabelObserver(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getBrowserLabel() {
|
public void getBrowserLabel() {
|
||||||
getLabelControl()
|
getLabelControl()
|
||||||
.subscribe(new Observer<BaseResponse<Label>>() {
|
.subscribe(getBrowserLabelObserver(null));
|
||||||
@Override
|
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
|
||||||
Log.e("getBrowserLabel", "onSubscribe: ");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void onNext(@NonNull BaseResponse<Label> response) {
|
|
||||||
setLabelResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public Observer<BaseResponse<Label>> getBrowserLabelObserver(CompleteCallback callback) {
|
||||||
public void onError(@NonNull Throwable e) {
|
return new Observer<BaseResponse<Label>>() {
|
||||||
Log.e("getBrowserLabel", "onError: " + e.getMessage());
|
@Override
|
||||||
onComplete();
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
}
|
Log.e("getBrowserLabel", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onNext(@NonNull BaseResponse<Label> response) {
|
||||||
Log.e("getBrowserLabel", "onComplete: ");
|
setLabelResponse(response);
|
||||||
new URLUtils(mContext).setBrowserList();
|
}
|
||||||
}
|
|
||||||
});
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
Log.e("getBrowserLabel", "onError: " + e.getMessage());
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("getBrowserLabel", "onComplete: ");
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onComplete();
|
||||||
|
}
|
||||||
|
new URLUtils(mContext).setBrowserList();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLabelResponse(BaseResponse<Label> response) {
|
private void setLabelResponse(BaseResponse<Label> response) {
|
||||||
@@ -2142,8 +2224,11 @@ public class NetInterfaceManager {
|
|||||||
|
|
||||||
public void sendRunningApp() {
|
public void sendRunningApp() {
|
||||||
String packageName = AppUsedTimeUtils.getInstance().getApp_package();
|
String packageName = AppUsedTimeUtils.getInstance().getApp_package();
|
||||||
if (TextUtils.isEmpty(packageName))
|
Log.e(TAG, "sendRunningApp: packageName = " + packageName);
|
||||||
|
if (TextUtils.isEmpty(packageName)) {
|
||||||
|
Log.e(TAG, "sendRunningApp: packageName is empty");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
long time = AppUsedTimeUtils.getInstance().getStart_time();
|
long time = AppUsedTimeUtils.getInstance().getStart_time();
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("app_package", packageName);
|
jsonObject.addProperty("app_package", packageName);
|
||||||
|
|||||||
@@ -226,38 +226,38 @@ public class ManagerService extends Service implements NetworkUtils.OnNetworkSta
|
|||||||
topView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.activity_screen_lock, null);
|
topView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.activity_screen_lock, null);
|
||||||
TextView textView = topView.findViewById(R.id.textView);
|
TextView textView = topView.findViewById(R.id.textView);
|
||||||
textView.setText(name);
|
textView.setText(name);
|
||||||
EditText et_password = topView.findViewById(R.id.et_password);
|
// EditText et_password = topView.findViewById(R.id.et_password);
|
||||||
TextView tv_confirm = topView.findViewById(R.id.tv_confirm);
|
// TextView tv_confirm = topView.findViewById(R.id.tv_confirm);
|
||||||
tv_confirm.setOnClickListener(new View.OnClickListener() {
|
// tv_confirm.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
// @Override
|
||||||
public void onClick(View view) {
|
// public void onClick(View view) {
|
||||||
String password = (String) SPUtils.get(ManagerService.this, UrlAddress.LOCK_SCREEN_PWD, "");
|
// String password = (String) SPUtils.get(ManagerService.this, UrlAddress.LOCK_SCREEN_PWD, "");
|
||||||
String pwd = et_password.getText().toString();
|
// String pwd = et_password.getText().toString();
|
||||||
if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(password) && password.equals(pwd)) {
|
// if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(password) && password.equals(pwd)) {
|
||||||
hideFloatingWindow();
|
// hideFloatingWindow();
|
||||||
}else {
|
// }else {
|
||||||
ToastUtil.show("密码错误");
|
// ToastUtil.show("密码错误");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
} else {
|
} else {
|
||||||
if ("added".equals(topView.getTag())) {
|
if ("added".equals(topView.getTag())) {
|
||||||
TextView textView = topView.findViewById(R.id.textView);
|
TextView textView = topView.findViewById(R.id.textView);
|
||||||
textView.setText(name);
|
textView.setText(name);
|
||||||
EditText et_password = topView.findViewById(R.id.et_password);
|
// EditText et_password = topView.findViewById(R.id.et_password);
|
||||||
TextView tv_confirm = topView.findViewById(R.id.tv_confirm);
|
// TextView tv_confirm = topView.findViewById(R.id.tv_confirm);
|
||||||
tv_confirm.setOnClickListener(new View.OnClickListener() {
|
// tv_confirm.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
// @Override
|
||||||
public void onClick(View view) {
|
// public void onClick(View view) {
|
||||||
String password = (String) SPUtils.get(ManagerService.this, UrlAddress.LOCK_SCREEN_PWD, "");
|
// String password = (String) SPUtils.get(ManagerService.this, UrlAddress.LOCK_SCREEN_PWD, "");
|
||||||
String pwd = et_password.getText().toString();
|
// String pwd = et_password.getText().toString();
|
||||||
if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(password) && password.equals(pwd)) {
|
// if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(password) && password.equals(pwd)) {
|
||||||
hideFloatingWindow();
|
// hideFloatingWindow();
|
||||||
}else {
|
// }else {
|
||||||
ToastUtil.show("密码错误");
|
// ToastUtil.show("密码错误");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -394,7 +394,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
|||||||
}
|
}
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case Intent.ACTION_USER_PRESENT:
|
case Intent.ACTION_USER_PRESENT:
|
||||||
mPresenter.getAppTimeControl();
|
// TODO: 2022/11/3 暂时屏蔽获取
|
||||||
|
// mPresenter.getAppTimeControl();
|
||||||
break;
|
break;
|
||||||
case Intent.ACTION_SCREEN_ON:
|
case Intent.ACTION_SCREEN_ON:
|
||||||
|
|
||||||
|
|||||||
@@ -17,30 +17,30 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<EditText
|
<!-- <EditText-->
|
||||||
android:id="@+id/et_password"
|
<!-- android:id="@+id/et_password"-->
|
||||||
android:layout_width="@dimen/dp_200"
|
<!-- android:layout_width="@dimen/dp_200"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
<!-- android:layout_marginTop="@dimen/dp_16"-->
|
||||||
android:background="@drawable/edit_background"
|
<!-- android:background="@drawable/edit_background"-->
|
||||||
android:gravity="center"
|
<!-- android:gravity="center"-->
|
||||||
android:hint="请输入密码解锁"
|
<!-- android:hint="请输入密码解锁"-->
|
||||||
android:maxEms="20"
|
<!-- android:maxEms="20"-->
|
||||||
android:maxLines="1"
|
<!-- android:maxLines="1"-->
|
||||||
android:singleLine="true"
|
<!-- android:singleLine="true"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
<!-- app:layout_constraintTop_toBottomOf="@+id/textView" />-->
|
||||||
|
|
||||||
<TextView
|
<!-- <TextView-->
|
||||||
android:id="@+id/tv_confirm"
|
<!-- android:id="@+id/tv_confirm"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
<!-- android:layout_marginTop="@dimen/dp_16"-->
|
||||||
android:text="确定"
|
<!-- android:text="确定"-->
|
||||||
android:textColor="@color/white"
|
<!-- android:textColor="@color/white"-->
|
||||||
android:textSize="24sp"
|
<!-- android:textSize="24sp"-->
|
||||||
app:layout_constraintEnd_toEndOf="@+id/et_password"
|
<!-- app:layout_constraintEnd_toEndOf="@+id/et_password"-->
|
||||||
app:layout_constraintStart_toStartOf="@+id/et_password"
|
<!-- app:layout_constraintStart_toStartOf="@+id/et_password"-->
|
||||||
app:layout_constraintTop_toBottomOf="@+id/et_password" />
|
<!-- app:layout_constraintTop_toBottomOf="@+id/et_password" />-->
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -17,30 +17,30 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<EditText
|
<!-- <EditText-->
|
||||||
android:id="@+id/et_password"
|
<!-- android:id="@+id/et_password"-->
|
||||||
android:layout_width="@dimen/dp_200"
|
<!-- android:layout_width="@dimen/dp_200"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
<!-- android:layout_marginTop="@dimen/dp_16"-->
|
||||||
android:background="@drawable/edit_background"
|
<!-- android:background="@drawable/edit_background"-->
|
||||||
android:gravity="center"
|
<!-- android:gravity="center"-->
|
||||||
android:hint="请输入密码解锁"
|
<!-- android:hint="请输入密码解锁"-->
|
||||||
android:maxEms="20"
|
<!-- android:maxEms="20"-->
|
||||||
android:maxLines="1"
|
<!-- android:maxLines="1"-->
|
||||||
android:singleLine="true"
|
<!-- android:singleLine="true"-->
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
<!-- app:layout_constraintTop_toBottomOf="@+id/textView" />-->
|
||||||
|
|
||||||
<TextView
|
<!-- <TextView-->
|
||||||
android:id="@+id/tv_confirm"
|
<!-- android:id="@+id/tv_confirm"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="wrap_content"
|
<!-- android:layout_height="wrap_content"-->
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
<!-- android:layout_marginTop="@dimen/dp_16"-->
|
||||||
android:text="确定"
|
<!-- android:text="确定"-->
|
||||||
android:textColor="@color/white"
|
<!-- android:textColor="@color/white"-->
|
||||||
android:textSize="24sp"
|
<!-- android:textSize="24sp"-->
|
||||||
app:layout_constraintEnd_toEndOf="@+id/et_password"
|
<!-- app:layout_constraintEnd_toEndOf="@+id/et_password"-->
|
||||||
app:layout_constraintStart_toStartOf="@+id/et_password"
|
<!-- app:layout_constraintStart_toStartOf="@+id/et_password"-->
|
||||||
app:layout_constraintTop_toBottomOf="@+id/et_password" />
|
<!-- app:layout_constraintTop_toBottomOf="@+id/et_password" />-->
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user