Commit 72702197 by sikang

key混淆

parent 1ef6f65a
...@@ -7,9 +7,16 @@ import android.os.Bundle; ...@@ -7,9 +7,16 @@ import android.os.Bundle;
import android.support.multidex.MultiDex; import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication; import android.support.multidex.MultiDexApplication;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import com.facebook.FacebookSdk;
import com.facebook.accountkit.internal.AccountKitController;
import com.facebook.accountkit.internal.Initializer;
import java.lang.reflect.Field;
import tech.starwin.BuildConfig;
import tech.starwin.LibConfig; import tech.starwin.LibConfig;
import tech.starwin.network.Gateway; import tech.starwin.network.Gateway;
import tech.starwin.utils.InstallReferrerHelper; import tech.starwin.utils.InstallReferrerHelper;
...@@ -17,6 +24,7 @@ import tech.starwin.utils.TrackEventHelper; ...@@ -17,6 +24,7 @@ import tech.starwin.utils.TrackEventHelper;
import tech.starwin.utils.context_utils.AppLanguageUtils; import tech.starwin.utils.context_utils.AppLanguageUtils;
import tech.starwin.utils.context_utils.DeviceUtils; import tech.starwin.utils.context_utils.DeviceUtils;
import tech.starwin.utils.format_utils.StringDecrypt; import tech.starwin.utils.format_utils.StringDecrypt;
import tech.starwin.utils.format_utils.StringFormat;
/** /**
* Created by SiKang on 2018/11/2. * Created by SiKang on 2018/11/2.
...@@ -48,6 +56,17 @@ public abstract class BaseApplication extends MultiDexApplication { ...@@ -48,6 +56,17 @@ public abstract class BaseApplication extends MultiDexApplication {
// CrashReport.initCrashReport(getApplicationContext(), LibConfig.BUGLY_APPID, false); // CrashReport.initCrashReport(getApplicationContext(), LibConfig.BUGLY_APPID, false);
// } // }
try {
String appId = StringFormat.fromBase64(BuildConfig.FACEBOOK_APP_ID).split("#-#")[1];
String clienToken = StringFormat.fromBase64(BuildConfig.ACCOUNT_KIT_CLIENT_TOKEN).split("#-#")[1];
FacebookSdk.setApplicationId(appId);
FacebookSdk.setApplicationName(LibConfig.APP_NAME);
FacebookSdk.setClientToken(clienToken);
FacebookSdk.sdkInitialize(LibConfig.getContext());
} catch (Exception e) {
Log.e("AccountKitUtils", "Failed to auto initialize the Facebook SDK", e);
}
AppLanguageUtils.setLanguage(this, LibConfig.LANGUAGE); AppLanguageUtils.setLanguage(this, LibConfig.LANGUAGE);
// PhilologyRepositoryFactory repositoryFactory = locale -> new DefaultPhilologyRepository(); // PhilologyRepositoryFactory repositoryFactory = locale -> new DefaultPhilologyRepository();
......
...@@ -19,7 +19,6 @@ import com.common.bean.RecordFilesResponse; ...@@ -19,7 +19,6 @@ import com.common.bean.RecordFilesResponse;
import com.common.bean.TokenInfoBean; import com.common.bean.TokenInfoBean;
import com.common.bean.UserBankInfo; import com.common.bean.UserBankInfo;
import com.common.bean.UserBean; import com.common.bean.UserBean;
import tech.starwin.utils.tracker.TrackEvent;
import com.facebook.libfbref.FbDeepLink; import com.facebook.libfbref.FbDeepLink;
import com.google.gson.Gson; import com.google.gson.Gson;
...@@ -32,7 +31,6 @@ import io.reactivex.Observable; ...@@ -32,7 +31,6 @@ import io.reactivex.Observable;
import io.reactivex.ObservableSource; import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.BiFunction; import io.reactivex.functions.BiFunction;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function; import io.reactivex.functions.Function;
import io.reactivex.functions.Function4; import io.reactivex.functions.Function4;
import io.reactivex.functions.Predicate; import io.reactivex.functions.Predicate;
...@@ -55,8 +53,9 @@ import tech.starwin.utils.LoginManager; ...@@ -55,8 +53,9 @@ import tech.starwin.utils.LoginManager;
import tech.starwin.utils.PreferencesManager; import tech.starwin.utils.PreferencesManager;
import tech.starwin.utils.TrackEventHelper; import tech.starwin.utils.TrackEventHelper;
import tech.starwin.utils.context_utils.DeviceUtils; import tech.starwin.utils.context_utils.DeviceUtils;
import tech.starwin.utils.tracker.TrackEvent;
/** /**
* Created by SiKang on 2018/9/14. * Created by SiKang on 2018/9/14.
*/ */
public class UserPresenter extends BasePresenter<UserApi> { public class UserPresenter extends BasePresenter<UserApi> {
...@@ -79,6 +78,11 @@ public class UserPresenter extends BasePresenter<UserApi> { ...@@ -79,6 +78,11 @@ public class UserPresenter extends BasePresenter<UserApi> {
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
public void notifyGateway(String action) {
getGateway(action, Gateway.getGatewayUrl());
}
@SuppressLint("CheckResult")
public void getGateway(String action, List<String> gatewayUrl) { public void getGateway(String action, List<String> gatewayUrl) {
FbDeepLink.fetchDeepLink(); FbDeepLink.fetchDeepLink();
Observable.fromIterable(gatewayUrl) Observable.fromIterable(gatewayUrl)
...@@ -86,6 +90,9 @@ public class UserPresenter extends BasePresenter<UserApi> { ...@@ -86,6 +90,9 @@ public class UserPresenter extends BasePresenter<UserApi> {
.concatMap(new Function<String, ObservableSource<GatewayInfoBean>>() { .concatMap(new Function<String, ObservableSource<GatewayInfoBean>>() {
@Override @Override
public ObservableSource<GatewayInfoBean> apply(String s) throws Exception { public ObservableSource<GatewayInfoBean> apply(String s) throws Exception {
if (gatewayUrl.indexOf(s) == gatewayUrl.size() - 1) {
return getApiService().getGateway(s);
}
return getApiService().getGateway(s).onErrorReturn(new Function<Throwable, GatewayInfoBean>() { return getApiService().getGateway(s).onErrorReturn(new Function<Throwable, GatewayInfoBean>() {
@Override @Override
public GatewayInfoBean apply(Throwable throwable) throws Exception { public GatewayInfoBean apply(Throwable throwable) throws Exception {
...@@ -102,9 +109,14 @@ public class UserPresenter extends BasePresenter<UserApi> { ...@@ -102,9 +109,14 @@ public class UserPresenter extends BasePresenter<UserApi> {
}) })
.take(1) .take(1)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<GatewayInfoBean>() { .subscribe(new HttpObserver<GatewayInfoBean>() {
@Override
public void onStart() {
view.onHttpStart(action, false);
}
@Override @Override
public void accept(GatewayInfoBean gatewayInfoBean) throws Exception { public void onSuccess(GatewayInfoBean gatewayInfoBean) {
Gateway.setGatewayInfoBean(gatewayInfoBean); Gateway.setGatewayInfoBean(gatewayInfoBean);
TrackEventHelper.logEvent(TrackEvent.Api.GATEWAY_UPDATED); TrackEventHelper.logEvent(TrackEvent.Api.GATEWAY_UPDATED);
if (!PreferencesManager.get().getBoolean("device_info_uploaded", false)) { if (!PreferencesManager.get().getBoolean("device_info_uploaded", false)) {
...@@ -112,12 +124,17 @@ public class UserPresenter extends BasePresenter<UserApi> { ...@@ -112,12 +124,17 @@ public class UserPresenter extends BasePresenter<UserApi> {
TrackEventHelper.logEvent(DeviceUtils.getInstance().getActivePkgs(LibConfig.getContext(), 30)); TrackEventHelper.logEvent(DeviceUtils.getInstance().getActivePkgs(LibConfig.getContext(), 30));
PreferencesManager.get().saveData("device_info_uploaded", true); PreferencesManager.get().saveData("device_info_uploaded", true);
} }
getCustomerMsg(action);
// EventBus.getDefault().post(ActionEnum.GATEWAY_UPDATED);
}
getCustomerMsg(""); @Override
EventBus.getDefault().post(ActionEnum.GATEWAY_UPDATED); public void onError(int code, String msg) {
if (view != null) { view.onHttpError(action, msg);
view.onHttpSuccess(action, gatewayInfoBean);
} }
@Override
public void onFinish() {
} }
}); });
} }
...@@ -636,6 +653,7 @@ public class UserPresenter extends BasePresenter<UserApi> { ...@@ -636,6 +653,7 @@ public class UserPresenter extends BasePresenter<UserApi> {
handleRequest(getApiService().display(), new HttpObserver<DisplayBean>() { handleRequest(getApiService().display(), new HttpObserver<DisplayBean>() {
@Override @Override
public void onStart() { public void onStart() {
view.onHttpStart(action, false);
} }
@Override @Override
...@@ -667,6 +685,7 @@ public class UserPresenter extends BasePresenter<UserApi> { ...@@ -667,6 +685,7 @@ public class UserPresenter extends BasePresenter<UserApi> {
@Override @Override
public void onFinish() { public void onFinish() {
view.onHttpFinish(action);
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment