|
|
@@ -8,11 +8,16 @@ import android.util.Log;
|
|
|
|
|
|
import com.softforum.xas.XecureAppShield;
|
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+
|
|
|
+import io.reactivex.Completable;
|
|
|
import io.reactivex.Single;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.disposables.Disposable;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.EmergencyBean;
|
|
|
import kr.co.zumo.app.lifeplus.config.NetworkConfig;
|
|
|
+import kr.co.zumo.app.lifeplus.model.module.APIModuleHelper;
|
|
|
import kr.co.zumo.app.lifeplus.util.AppUtil;
|
|
|
import kr.co.zumo.app.lifeplus.util.StringUtil;
|
|
|
|
|
|
@@ -37,6 +42,7 @@ public class AppShieldHelper {
|
|
|
}
|
|
|
|
|
|
private Disposable disposable;
|
|
|
+ private EmergencyBean emergencyBean;
|
|
|
|
|
|
/**
|
|
|
* dispose
|
|
|
@@ -64,14 +70,22 @@ public class AppShieldHelper {
|
|
|
.subscribe(result -> {
|
|
|
Log.d("APP# AppShieldHelper | setup", "|" + "app shield result: " + result);
|
|
|
// Log.d("APP# AppShieldHelper | setup", "|" + "app shield result: " + XecureAppShield.getInstance().GetErrorMsg(result));
|
|
|
- if (result != 0) {
|
|
|
- // error
|
|
|
- // fixme 에러 발송 필요
|
|
|
- // fixme 에러 발송 필요
|
|
|
- // fixme 에러 발송 필요
|
|
|
-// dispatchInvalidAppEvent();
|
|
|
- {}
|
|
|
- }
|
|
|
+// if (result != 0) {
|
|
|
+// // error
|
|
|
+// // fixme 에러 발송 필요
|
|
|
+// // fixme 에러 발송 필요
|
|
|
+// // fixme 에러 발송 필요
|
|
|
+//// dispatchInvalidAppEvent();
|
|
|
+// {}
|
|
|
+// }
|
|
|
+
|
|
|
+ if(AppUtil.isRelease()) {
|
|
|
+ if (result == EmergencyBean.CODE_ROUTING) {
|
|
|
+ dispatchRoutingAppEvent();
|
|
|
+ } else if (result == EmergencyBean.CODE_FORGERY || result == EmergencyBean.CODE_MODULATION) {
|
|
|
+ dispatchForgeryAppEvent();
|
|
|
+ }
|
|
|
+ }
|
|
|
}, e -> {
|
|
|
// error
|
|
|
// fixme 에러 발송 필요
|
|
|
@@ -84,12 +98,30 @@ public class AppShieldHelper {
|
|
|
// fixme 에러 발송 필요
|
|
|
// fixme 에러 발송 필요
|
|
|
// fixme 에러 발송 필요
|
|
|
-// private void dispatchInvalidAppEvent() {
|
|
|
-// boolean consumed = APIModuleHelper.dispatchEmergencyEvent(new EmergencyBean(EmergencyBean.CODE_INVALID_APP));
|
|
|
-// if (false == consumed) {
|
|
|
-// Log.d("APP# AppShieldHelper | dispatchInvalidAppEvent", "|" + "------------ again.......");
|
|
|
-// disposable = Completable.timer(500, TimeUnit.MILLISECONDS)
|
|
|
-// .subscribe(this::dispatchInvalidAppEvent);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ private void dispatchInvalidAppEvent() {
|
|
|
+ boolean consumed = APIModuleHelper.dispatchEmergencyEvent(new EmergencyBean(EmergencyBean.CODE_INVALID_APP));
|
|
|
+// boolean consumed = APIModuleHelper.dispatchEmergencyEvent(emergencyBean);
|
|
|
+ if (false == consumed) {
|
|
|
+ Log.d("APP# AppShieldHelper | dispatchInvalidAppEvent", "|" + "------------ again.......");
|
|
|
+ disposable = Completable.timer(500, TimeUnit.MILLISECONDS).subscribe(this::dispatchInvalidAppEvent);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void dispatchRoutingAppEvent() {
|
|
|
+ boolean consumed = APIModuleHelper.dispatchEmergencyEvent(new EmergencyBean(EmergencyBean.CODE_ROUTING));
|
|
|
+// boolean consumed = APIModuleHelper.dispatchEmergencyEvent(emergencyBean);
|
|
|
+ if (false == consumed) {
|
|
|
+ Log.d("APP# AppShieldHelper | dispatchInvalidAppEvent", "|" + "------------ again.......");
|
|
|
+ disposable = Completable.timer(500, TimeUnit.MILLISECONDS).subscribe(this::dispatchRoutingAppEvent);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void dispatchForgeryAppEvent() {
|
|
|
+ boolean consumed = APIModuleHelper.dispatchEmergencyEvent(new EmergencyBean(EmergencyBean.CODE_FORGERY));
|
|
|
+// boolean consumed = APIModuleHelper.dispatchEmergencyEvent(emergencyBean);
|
|
|
+ if (false == consumed) {
|
|
|
+ Log.d("APP# AppShieldHelper | dispatchInvalidAppEvent", "|" + "------------ again.......");
|
|
|
+ disposable = Completable.timer(500, TimeUnit.MILLISECONDS).subscribe(this::dispatchForgeryAppEvent);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|