package com.kwad.components.ad.reward.model; import android.content.Intent; import android.text.TextUtils; import com.kwad.components.ad.reward.KSRewardVideoActivityProxy; import com.kwad.sdk.api.KsVideoPlayConfig; import com.kwad.sdk.core.e.b; import com.kwad.sdk.core.response.a.a; import com.kwad.sdk.core.response.a.d; import com.kwad.sdk.core.response.model.AdInfo; import com.kwad.sdk.core.response.model.AdTemplate; import com.kwad.sdk.utils.s; import java.io.File; import java.io.Serializable; import org.json.JSONObject; public final class c { private AdInfo mAdInfo; private AdTemplate mAdTemplate; private JSONObject mReportExtData; public int mScreenOrientation; private KsVideoPlayConfig mVideoPlayConfig; private int rewardType = 1; private static c a(AdTemplate adTemplate, AdTemplate adTemplate2, int i, KsVideoPlayConfig ksVideoPlayConfig) { File cm; c cVar = new c(); AdInfo cs = d.cs(adTemplate); String C = a.C(cs); if (com.kwad.sdk.core.config.d.KX() < 0 && ((cm = com.kwad.sdk.core.diskcache.a.a.LV().cm(C)) == null || !cm.exists())) { return null; } boolean isShowLandscape = ksVideoPlayConfig.isShowLandscape(); adTemplate.mInitVoiceStatus = ksVideoPlayConfig.isVideoSoundEnable() ? 2 : 1; if (!TextUtils.isEmpty(ksVideoPlayConfig.getShowScene())) { JSONObject jSONObject = new JSONObject(); s.putValue(jSONObject, "ext_showscene", ksVideoPlayConfig.getShowScene()); cVar.mReportExtData = jSONObject; } cVar.mVideoPlayConfig = ksVideoPlayConfig; cVar.mAdTemplate = adTemplate; cVar.mAdInfo = cs; cVar.mScreenOrientation = isShowLandscape ? 1 : 0; cVar.rewardType = i; adTemplate.mPlayAgain = adTemplate2; return cVar; } public static c c(Intent intent) { AdTemplate adTemplate; Serializable serializableExtra = intent.getSerializableExtra("key_video_play_config"); if (!(serializableExtra instanceof KsVideoPlayConfig)) { b.e("RewardActivityModel", "data is not instanceof VideoPlayConfigImpl:" + serializableExtra); return null; } KsVideoPlayConfig ksVideoPlayConfig = (KsVideoPlayConfig) serializableExtra; int intExtra = intent.getIntExtra(KSRewardVideoActivityProxy.KEY_REWARD_TYPE, 1); String stringExtra = intent.getStringExtra("key_template_json"); try { AdTemplate adTemplate2 = new AdTemplate(); adTemplate2.parseJson(new JSONObject(stringExtra)); String stringExtra2 = intent.getStringExtra(KSRewardVideoActivityProxy.KEY_TEMPLATE_PLAY_AGAIN); if (stringExtra2 != null) { adTemplate = new AdTemplate(); adTemplate.parseJson(new JSONObject(stringExtra2)); } else { adTemplate = null; } return a(adTemplate2, adTemplate, intExtra, ksVideoPlayConfig); } catch (Throwable th) { b.printStackTraceOnly(th); return null; } } public final AdInfo bC() { return this.mAdInfo; } public final boolean bD() { return d.cA(this.mAdTemplate); } public final AdTemplate getAdTemplate() { return this.mAdTemplate; } public final int getScreenOrientation() { return this.mScreenOrientation; } public final boolean hc() { return d.f(getAdTemplate(), com.kwad.components.ad.reward.kwai.b.j(bC())); } public final boolean hd() { return d.q(getAdTemplate()); } public final KsVideoPlayConfig he() { return this.mVideoPlayConfig; } public final int hf() { return this.rewardType; } public final JSONObject hg() { return this.mReportExtData; } public final void z(AdTemplate adTemplate) { this.mAdTemplate = adTemplate; this.mAdInfo = d.cs(adTemplate); } }