正在查看: Petal Maps v4.7.0.310001 应用的 FeedItemJavascriptObj.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Petal Maps v4.7.0.310001 应用的 FeedItemJavascriptObj.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.huawei.maps.app.search.model.nearby;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import androidx.annotation.IdRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.navigation.fragment.NavHostFragment;
import com.google.gson.Gson;
import com.huawei.maps.app.R;
import com.huawei.maps.app.api.banner.repository.BannerRequestHelper;
import com.huawei.maps.app.common.remoteconfig.MapRemoteConfig;
import com.huawei.maps.app.common.utils.task.TaskRunnable;
import com.huawei.maps.app.operation.ui.OperationFragment;
import com.huawei.maps.app.petalmaps.PetalMapsActivity;
import com.huawei.maps.app.petalmaps.a;
import com.huawei.maps.app.petalmaps.viewmode.ActivityViewModel;
import com.huawei.maps.app.routeplan.ui.bean.TicketErrorInfo;
import com.huawei.maps.app.search.model.nearby.FeedItemJavascriptObj;
import com.huawei.maps.app.search.ui.launch.ExploreBaseFragment;
import com.huawei.maps.app.search.ui.launch.FeedListFragment;
import com.huawei.maps.app.setting.constant.RoadReportType;
import com.huawei.maps.app.setting.utils.SettingNavUtil;
import com.huawei.maps.businessbase.at.ApplicationAtClient;
import com.huawei.maps.businessbase.bean.HtmlDeviceInfoEx;
import com.huawei.maps.businessbase.database.explore.FeedListConfig;
import com.huawei.maps.businessbase.database.explore.NearbyDomainDbHelper;
import com.huawei.maps.businessbase.manager.MapHelper;
import com.huawei.maps.businessbase.manager.routeplan.RouteDataManager;
import com.huawei.maps.businessbase.model.Site;
import com.huawei.maps.businessbase.network.MapApiKeyClient;
import com.huawei.maps.businessbase.network.MapHttpClient;
import com.huawei.maps.businessbase.servicepermission.ServicePermission;
import com.huawei.maps.businessbase.siteservice.bean.TextSearchRequest;
import com.huawei.maps.businessbase.ui.BaseFragment;
import com.huawei.maps.commonui.view.MapScrollLayout;
import com.huawei.maps.poi.model.DetailOptions;
import com.huawei.maps.poi.model.VMInPoiModule;
import com.huawei.maps.poi.utils.DetailReportUtil;
import com.huawei.secure.android.common.intent.IntentUtils;
import com.huawei.secure.android.common.intent.SafeBundle;
import com.huawei.secure.android.common.intent.SafeIntent;
import com.huawei.secure.android.common.webview.SafeGetUrl;
import defpackage.e36;
import defpackage.l36;
import defpackage.ow6;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Locale;
import kotlin.jvm.functions.Function0;
public class FeedItemJavascriptObj {
private static final int ONE_PAGE_SIZE = 1;
private static final int RADIUS = 50000;
public static final String TAG = "FeedItemJavascriptObj";
private final WeakReference<Fragment> mFragmentWeakReference;
private final String mFromPage;
private final String mInput;
private String[] mOpeWhiteList;
private final SafeGetUrl mSafeGetUrl;
private String mTabName;
private final WebView mWebView;
public FeedItemJavascriptObj(Fragment fragment, WebView webView, String str) {
this(fragment, webView, str, RoadReportType.CAMERA_INCORRECT);
}
private Fragment getParentFragment() {
Fragment fragment = this.mFragmentWeakReference.get();
if (fragment == null || !fragment.isAdded()) {
return null;
}
return fragment;
}
private boolean isInOpeWhiteList(String str) {
if (tha.e(this.mOpeWhiteList)) {
hm4.h(TAG, "isInOpeWhiteList: whitelist is empty");
return false;
}
boolean h = c55.h(str, this.mOpeWhiteList);
hm4.p(TAG, "isInOpeWhiteList:" + h);
return h;
}
public static mda lambda$ctripNoteUrlJump$6() {
ow6.a.D(MapScrollLayout.Status.EXPANDED);
return null;
}
public static void lambda$goToCommentAdd$3(Activity activity) {
IntentUtils.safeStartActivityForResultStatic(activity, e4.a().getAccountIntent(), 20001);
}
public static void lambda$goToCommentAdd$4(Fragment fragment) {
SettingNavUtil.h0(fragment.getActivity(), R.id.explore_to_post_create_page, null);
}
public void lambda$goToCommentDetailPage$5(String str, String str2) {
SafeBundle safeBundle = new SafeBundle();
safeBundle.putString("commentId", str);
safeBundle.putString("CONTENT_ID", str2);
navigateByActionId(R.id.operation_to_post_comment_detail, safeBundle.getBundle());
a.x1().R5();
a.x1().hideBottomNav();
}
public void lambda$goToDetailPage$1(Site site, Fragment fragment, DetailOptions detailOptions, Fragment fragment2) {
Bundle bundle = new Bundle();
ArrayList arrayList = new ArrayList();
arrayList.add(site);
MapHelper.F2().z8(arrayList);
MapHelper.F2().I3(0);
MapHelper.F2().p5(site, true);
if (fragment instanceof ExploreBaseFragment) {
xg8.C(this.mTabName, e36.b().c(), a.x1().V2());
((ExploreBaseFragment) fragment).startDetailByDetailOptions(detailOptions, R.id.result_to_detail, bundle);
} else {
if (fragment2 == null || !fragment2.isAdded()) {
return;
}
MapHelper.F2().K7(true);
((BaseFragment) fragment2).getActivityViewModel(VMInPoiModule.class).detailOptionsData.setValue(detailOptions);
navigateByActionId(R.id.operation_to_detail, bundle);
}
}
public void lambda$goToPoiDetailPage$2(Fragment fragment, DetailOptions detailOptions, Bundle bundle) {
if (!(fragment instanceof OperationFragment)) {
ExploreBaseFragment parentFragment = fragment.getParentFragment();
if (parentFragment instanceof ExploreBaseFragment) {
parentFragment.startDetailByDetailOptions(detailOptions, R.id.result_to_detail, bundle);
return;
} else {
hm4.h(TAG, "parentFragment not instanceof ExploreBaseFragment");
return;
}
}
if (fragment.isAdded()) {
hm4.f(TAG, "start Detail page");
MapHelper.F2().K7(true);
jh8.h0(0);
((OperationFragment) fragment).getActivityViewModel(VMInPoiModule.class).detailOptionsData.setValue(detailOptions);
navigateByActionId(R.id.operation_to_detail, bundle);
}
}
private void navigateByActionId(@IdRes int i, Bundle bundle) {
com.huawei.maps.app.common.utils.a.u(getParentFragment(), i, bundle);
}
@JavascriptInterface
public void appOutUrlJump(String str) {
Fragment fragment;
if (TextUtils.isEmpty(str) || (fragment = this.mFragmentWeakReference.get()) == null) {
return;
}
SafeIntent safeIntent = new SafeIntent(new Intent("android.intent.action.VIEW", Uri.parse(str)));
if (!str.startsWith("petalmaps") && !str.startsWith("hwcloudtest")) {
cz9.o(com.huawei.maps.businessbase.R.string.third_jump_tip);
}
IntentUtils.safeStartActivity(fragment.getActivity(), safeIntent);
}
@JavascriptInterface
public void cacheFeedList(String str, String str2) {
hm4.p(TAG, "cache feed list");
if (isInOpeWhiteList()) {
NearbyDomainDbHelper.b.a().i(str, str2);
}
}
@JavascriptInterface
public void ctripNoteUrlJump(String str, String str2, String str3, String str4) {
if (isInOpeWhiteList()) {
com.huawei.maps.app.common.utils.a.i(getParentFragment(), str, str3, str4, "originHome", new Function0() {
public final Object invoke() {
mda lambda$ctripNoteUrlJump$6;
lambda$ctripNoteUrlJump$6 = FeedItemJavascriptObj.lambda$ctripNoteUrlJump$6();
return lambda$ctripNoteUrlJump$6;
}
});
}
}
@JavascriptInterface
public void doShare(String str, String str2, String str3, String str4) {
Fragment fragment = this.mFragmentWeakReference.get();
if (fragment == null) {
return;
}
a.x1().showCustomShareFragment(fragment.getChildFragmentManager(), str, str2, str3, str4, DetailReportUtil.ShareFrom.SHARE_CUSTOM_RANKINGS.ordinal());
}
@JavascriptInterface
public void exitPage() {
fk2.b(new Runnable() {
@Override
public final void run() {
FeedItemJavascriptObj.this.lambda$exitPage$0();
}
});
}
@JavascriptInterface
public String getApiKey() {
hm4.p(TAG, "event getApiKey:");
if (isInOpeWhiteList()) {
return lm7.d();
}
return null;
}
@JavascriptInterface
public String getAppClientVersion() {
hm4.p(TAG, "getAppClientVersion");
return String.valueOf(qk9.u(o41.b()));
}
@JavascriptInterface
public String getApplicationAt() {
hm4.p(TAG, "event getApplicationAt:");
if (isInOpeWhiteList()) {
return ApplicationAtClient.e();
}
return null;
}
@JavascriptInterface
public String getCachedFeedList(String str) {
hm4.p(TAG, "get cached feed list");
if (isInOpeWhiteList()) {
return NearbyDomainDbHelper.b.a().g(str);
}
return null;
}
@JavascriptInterface
public String getCloudApiAddr() {
String siteUrl = isInOpeWhiteList() ? MapHttpClient.getSiteUrl() : null;
return TextUtils.isEmpty(siteUrl) ? RoadReportType.CAMERA_INCORRECT : siteUrl;
}
@JavascriptInterface
public String getCurrentLocation() {
FeedListFragment feedListFragment = (Fragment) this.mFragmentWeakReference.get();
if (!isInOpeWhiteList() || feedListFragment == null || !(feedListFragment instanceof FeedListFragment)) {
return null;
}
FeedListConfig feedListConfig = new FeedListConfig((String) null, (String) null, (String) null, (Double) null, (Double) null);
FeedListFragment feedListFragment2 = feedListFragment;
feedListConfig.setCountryCode(feedListFragment2.y());
feedListConfig.setCityCode(feedListFragment2.x());
if (feedListFragment2.z() != null) {
feedListConfig.setLatitude(Double.valueOf(feedListFragment2.z().latitude));
feedListConfig.setLongitude(Double.valueOf(feedListFragment2.z().longitude));
}
return og3.a(feedListConfig);
}
@JavascriptInterface
public String getDeviceInfo() {
if (!isInOpeWhiteList()) {
return null;
}
hm4.p(TAG, "event get device");
HtmlDeviceInfoEx htmlDeviceInfoEx = new HtmlDeviceInfoEx();
htmlDeviceInfoEx.setAppPackage(o41.b().getPackageName());
htmlDeviceInfoEx.setAppVersion(qk9.v(o41.c()));
htmlDeviceInfoEx.setDeviceType(ct3.Y(o41.c()) ? "PAD" : "MobilePhone");
htmlDeviceInfoEx.setDeviceCategory(q42.f());
htmlDeviceInfoEx.setDeviceId(p19.F().r0());
htmlDeviceInfoEx.setLanguage(br3.a());
htmlDeviceInfoEx.setCountry(BannerRequestHelper.getServiceCountryCode());
htmlDeviceInfoEx.setLocaleCountry(Locale.getDefault().getCountry());
htmlDeviceInfoEx.setOtCountry(BannerRequestHelper.getOtCountryCode());
return og3.a(htmlDeviceInfoEx);
}
@JavascriptInterface
public String getMapApiKey() {
hm4.p(TAG, "event getMapApiKey:");
if (isInOpeWhiteList()) {
return MapApiKeyClient.getMapApiKey();
}
return null;
}
@JavascriptInterface
public boolean getNetworkStatus() {
if (isInOpeWhiteList()) {
return qk9.r();
}
return true;
}
@JavascriptInterface
public String getOperationRegion() {
return isInOpeWhiteList() ? com.huawei.maps.app.common.utils.a.l() : RoadReportType.CAMERA_INCORRECT;
}
@JavascriptInterface
public String getRequest() {
if (!isInOpeWhiteList()) {
return RoadReportType.CAMERA_INCORRECT;
}
hm4.p(TAG, "getRequest");
TextSearchRequest textSearchRequest = new TextSearchRequest();
textSearchRequest.setQuery(this.mInput);
textSearchRequest.setRadius(Integer.valueOf(RADIUS));
textSearchRequest.setPageIndex(1);
textSearchRequest.setPageSize(15);
textSearchRequest.setLocation(MapHelper.F2().m3());
textSearchRequest.setChildren(true);
textSearchRequest.setDeviceId(x52.a(p19.F().r0()));
textSearchRequest.setLanguage(gg4.l());
textSearchRequest.setPoliticalView(ServicePermission.getPoliticalView());
return new Gson().toJsonTree(lm7.b(textSearchRequest)).toString();
}
@JavascriptInterface
public String getToken() {
hm4.p(TAG, "event getToken:");
if (isInOpeWhiteList()) {
return e4.a().getAccessToken();
}
return null;
}
@JavascriptInterface
public String getUserCurrentLocation() {
if (!isInOpeWhiteList()) {
return null;
}
return com.huawei.maps.businessbase.manager.location.a.v().getLatitude() + "," + com.huawei.maps.businessbase.manager.location.a.v().getLongitude();
}
@JavascriptInterface
public String getUserLocationCountry() {
return com.huawei.maps.app.common.utils.a.m();
}
@JavascriptInterface
public String getWindowSize() {
int f0 = ct3.f0(o41.c(), ct3.m(o41.c()));
String str = (this.mWebView != null ? ct3.f0(o41.c(), this.mWebView.getWidth()) : f0) + "&" + f0;
hm4.p(TAG, "getWindowSize size:" + str);
return str;
}
@JavascriptInterface
public void goToCommentAdd() {
final Fragment fragment = this.mFragmentWeakReference.get();
if (fragment != null && fragment.isAdded() && (fragment instanceof FeedListFragment)) {
if (e4.a().hasLogin()) {
xg8.x();
RouteDataManager.b().M("SEARCH_FROM_EXPLORE_PAGE");
RouteDataManager.b().I("2");
fk2.b(new Runnable() {
@Override
public final void run() {
FeedItemJavascriptObj.lambda$goToCommentAdd$4(fragment);
}
});
return;
}
final FragmentActivity activity = fragment.getActivity();
if (activity == null) {
return;
}
fk2.b(new Runnable() {
@Override
public final void run() {
FeedItemJavascriptObj.lambda$goToCommentAdd$3(activity);
}
});
}
}
@JavascriptInterface
public void goToCommentDetailPage(final String str, final String str2) {
View view;
Fragment fragment = this.mFragmentWeakReference.get();
if (fragment != null && fragment.isAdded() && (fragment instanceof FeedListFragment) && l36.v() && (view = fragment.getView()) != null) {
view.post(new Runnable() {
@Override
public final void run() {
FeedItemJavascriptObj.this.lambda$goToCommentDetailPage$5(str, str2);
}
});
}
}
@JavascriptInterface
public String goToDetailPage(String str) {
hm4.p(TAG, "goToDetailPage: ");
final Site site = (Site) og3.d(str, Site.class);
if (site == null) {
return TicketErrorInfo.TICKET_ERROR_TYPE_NO_DATA;
}
final DetailOptions e = "Explore_Custom_Recommended".equals(this.mFromPage) ? d32.e(site) : d32.i(site, this.mTabName);
final Fragment fragment = this.mFragmentWeakReference.get();
if (fragment == null || !fragment.isAdded()) {
return TicketErrorInfo.TICKET_ERROR_TYPE_NO_DATA;
}
final Fragment parentFragment = fragment.getParentFragment();
View view = fragment.getView();
if (view == null) {
return TicketErrorInfo.TICKET_ERROR_TYPE_NO_DATA;
}
view.post(new Runnable() {
@Override
public final void run() {
FeedItemJavascriptObj.this.lambda$goToDetailPage$1(site, parentFragment, e, fragment);
}
});
return "1";
}
@JavascriptInterface
public void goToPoiDetailPage(String str, String str2) {
final BaseFragment baseFragment = (Fragment) this.mFragmentWeakReference.get();
if (baseFragment != null && (baseFragment.getActivity() instanceof PetalMapsActivity)) {
ActivityViewModel activityViewModel = (ActivityViewModel) baseFragment.getActivityViewModel(ActivityViewModel.class);
if (activityViewModel != null && !a.x1().V2()) {
activityViewModel.n().postValue(Boolean.TRUE);
}
if (!(baseFragment instanceof OperationFragment)) {
xg8.C(this.mTabName, e36.b().c(), a.x1().V2());
}
final Bundle bundle = new Bundle();
Site site = new Site();
site.setStatus("nearby_native");
site.setSiteId(str);
final DetailOptions showCenter = "Explore_Custom_Recommended".equals(this.mFromPage) ? d32.e(site).showCenter(true) : d32.i(site, this.mTabName).showCenter(true);
bundle.putBoolean("load_native_to_poi_detail", true);
bundle.putBoolean("web_view_to_poi_detail", true);
bundle.putString("web_view_poi_detail_url", str2);
bundle.putString("WEB_VIEW_NEARBY_SOURCE", "explore_click_feed_list");
fk2.b(new Runnable() {
@Override
public final void run() {
FeedItemJavascriptObj.this.lambda$goToPoiDetailPage$2(baseFragment, showCenter, bundle);
}
});
}
}
@JavascriptInterface
public boolean isAnonymous() {
boolean m = k0a.k().m();
hm4.p(TAG, "event isAnonymous:" + m);
return m;
}
@JavascriptInterface
public boolean isAppMirrorMode() {
String appFlavor = o41.b().getAppFlavor();
if (TextUtils.isEmpty(appFlavor)) {
return false;
}
return appFlavor.toLowerCase(Locale.ROOT).contains("mirror");
}
@JavascriptInterface
public boolean isChildAccount() {
boolean isChildren = e4.a().isChildren();
hm4.p(TAG, "event isChild:" + isChildren);
return isChildren;
}
@JavascriptInterface
public boolean isShowComplain() {
Boolean k = MapRemoteConfig.g().k("agc_ctrip_complain_is_show");
if (k == null) {
return false;
}
return k.booleanValue();
}
public boolean lambda$exitPage$0() {
Fragment fragment = this.mFragmentWeakReference.get();
if (fragment == null || !fragment.isAdded()) {
return true;
}
NavHostFragment.findNavController(fragment).navigateUp();
return true;
}
@JavascriptInterface
public void onPageReady() {
n05.b("poi_forex_calc");
OperationFragment operationFragment = (Fragment) this.mFragmentWeakReference.get();
if (operationFragment != null && (operationFragment instanceof OperationFragment)) {
operationFragment.u1();
}
}
@JavascriptInterface
public void setComplainAddInfo(final String str) {
com.huawei.maps.app.common.utils.task.a.c(new TaskRunnable() {
public String getClassName() {
return FeedItemJavascriptObj.TAG;
}
public void run() {
Fragment fragment = (Fragment) FeedItemJavascriptObj.this.mFragmentWeakReference.get();
if (fragment == null) {
return;
}
com.huawei.maps.app.common.utils.a.h(fragment, str);
ow6.a.D(MapScrollLayout.Status.EXPANDED);
}
});
}
public void setTabName(String str) {
this.mTabName = str;
}
public FeedItemJavascriptObj(Fragment fragment, WebView webView, String str, String str2) {
this.mFragmentWeakReference = new WeakReference<>(fragment);
this.mWebView = webView;
this.mInput = str;
this.mFromPage = str2;
String m = MapRemoteConfig.g().m("agc_atomization_host_white_list");
if (!TextUtils.isEmpty(m)) {
this.mOpeWhiteList = m.replaceAll("\\s", RoadReportType.CAMERA_INCORRECT).split(",");
}
this.mSafeGetUrl = new SafeGetUrl(webView);
}
private boolean isInOpeWhiteList() {
try {
String urlMethod = this.mSafeGetUrl.getUrlMethod();
if (urlMethod == null || !(urlMethod.startsWith("https://htmlassets.huawei.com") || urlMethod.startsWith("file:"))) {
return isInOpeWhiteList(urlMethod);
}
return true;
} catch (Exception unused) {
hm4.h(TAG, "get url from webview error");
return false;
}
}
}