导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - DashboardFragment.java 源代码

正在查看: BetterTogether v3.0.0 应用的 DashboardFragment.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.bettertogether.screens.dashboard;

import android.R;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.support.v4.app.hwJQ.rnaioAkxVmZTT;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.widget.ContentLoadingProgressBar;
import androidx.emoji2.text.HPE.gudG;
import androidx.fragment.app.e0;
import androidx.fragment.app.w0;
import androidx.recyclerview.widget.k0;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.viewpager2.widget.ViewPager2;
import aq.i;
import cd.r0;
import cd.v0;
import com.adapty.Adapty;
import com.adapty.models.AdaptyPaywall;
import com.adapty.utils.AdaptyResult;
import com.adapty.utils.TimeIntervalKt;
import com.android.billingclient.api.Purchase;
import com.appsamurai.storyly.PlayMode;
import com.appsamurai.storyly.StoryGroupAnimation;
import com.appsamurai.storyly.StoryGroupSize;
import com.appsamurai.storyly.StorylyInit;
import com.appsamurai.storyly.StorylyView;
import com.appsamurai.storyly.config.StorylyConfig;
import com.appsamurai.storyly.config.StorylyShareConfig;
import com.appsamurai.storyly.config.styling.bar.StorylyBarStyling;
import com.appsamurai.storyly.config.styling.group.StorylyStoryGroupStyling;
import com.bettertogether.BetterTogetherApp;
import com.bettertogether.cache.preferences.PreferenceData;
import com.bettertogether.firebase.FirebaseUtils$getDailyTipsImagesList$;
import com.bettertogether.remote.model.common.DailyMessageConfig;
import com.bettertogether.remote.model.common.FoodLogFirebaseRemoteConfig;
import com.bettertogether.remote.model.common.GraphValues;
import com.bettertogether.remote.model.common.GroupData;
import com.bettertogether.remote.model.common.Records;
import com.bettertogether.remote.model.common.TimeZoneData;
import com.bettertogether.remote.model.common.Translations;
import com.bettertogether.remote.model.common.UserData;
import com.bettertogether.remote.model.common.subscription.SubscriptionReminderConfig;
import com.bettertogether.remote.model.response.DashboardResponse;
import com.bettertogether.screens.group.create.CreateGroupActivity;
import com.bettertogether.screens.group.details.GroupDetailsActivity;
import com.bettertogether.screens.login.LoginActivity;
import com.bettertogether.screens.main.MainActivity;
import com.bettertogether.screens.records.weight.WeightRecordActivity;
import com.bettertogether.screens.storyly.StorylyProfileActivity;
import com.bettertogether.screens.tips.DailyTipsImage;
import com.bettertogether.screens.trialEnd.TrialEndReminderActivity;
import com.bettertogether.subscription.SubscriptionPlansActivity;
import com.bettertogether.subscription.SubscriptionPlansInAppActivity;
import com.bettertogether.subscription.SubscriptionUpdateRequest;
import com.bettertogether.views.speedometer.RaySpeedometer;
import com.google.android.gms.fitness.LocalRecordingClient;
import com.google.android.gms.fitness.data.DataType;
import com.google.android.gms.fitness.data.LocalDataPoint;
import com.google.android.gms.fitness.data.LocalDataSet;
import com.google.android.gms.fitness.data.LocalDataType;
import com.google.android.gms.fitness.data.LocalField;
import com.google.android.gms.fitness.request.LocalDataReadRequest;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.textview.MaterialTextView;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.messaging.a0;
import com.google.firebase.messaging.e;
import com.onesignal.y3;
import cp.g;
import dd.s;
import df.y;
import hd.c;
import hr.m0;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import k7.j;
import kc.z1;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.collections.f0;
import kotlin.collections.o0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.g0;
import kotlin.text.Charsets;
import kotlin.text.u;
import kr.Cc.YzboWgFC;
import l.o;
import lq.d;
import lq.n;
import md.l;
import me.b0;
import me.i0;
import me.j0;
import me.q;
import me.r;
import me.v;
import me.x;
import mp.dp.EBJSxTDURlwkNZ;
import ne.b;
import nl.f;
import o9.l0;
import pl.c1;
import pq.OYV.zQugKAAxaKyBz;
import s6.t;
import s8.h;
import u.w;
import v.u1;
import vg.p;
import w1.v2;
import xh.k;
import zc.m;
import zs.a;

@Metadata
public final class DashboardFragment extends m implements j0, c, j {
    private static final long ANIMATION_TOTAL_TIME = 3000;
    public static final me.c Companion = new me.c();
    private static final String GROUP_DATA = "group_data";
    private static final String OPEN_STORY_NEW_USER = "open_story_for_new_user";
    private static final int REQUEST_CODE = 999;
    private static final String SHOW_JOIN_GROUP = "show_join_group";
    private static final String SHOW_WATER_REMINDER = "show_water_reminder";
    private static FoodLogFirebaseRemoteConfig foodLogDataFromRemoteConfig;
    private static GroupData group;
    private static boolean isAdaptyPaywallBuilderAvailable;
    private static UserData user;
    private final String analyticsScreenName = "dashboard_android";
    private final lq.m billingManager$delegate;
    private r0 binding;
    private String dailyTip;
    private o dashboardMenuBuilder;
    private DashboardResponse dashboardResponse;
    private final a dashboardScope;
    private CountDownTimer floorsTimer;
    private GroupData groupData;
    private final lq.m imageLoader$delegate;
    private boolean isDailyTipShown;
    public dg.c itemDecoration;
    private int lastRecord;
    private final int layout;
    private float mAlphaValue;
    private nf.a mDailyTipsDialog;
    private b mGraphAdapter;
    private boolean mIsInviteDialog;
    private zf.c mOpenStory;
    private sf.c mStoryly;
    private u7.m pageTransformer;
    private final lq.m preferenceData$delegate;
    private final lq.m presenter$delegate;
    private y recordType;
    private int selectedGroup;
    private boolean showWaterReminder;
    private CountDownTimer stepsTimer;
    private CountDownTimer waterTimer;

    public DashboardFragment() {
        h s3 = e.s(this);
        a a = ((ys.a) s3.a).a(e.o(), new xs.c(g0.a(DashboardFragment.class)));
        this.dashboardScope = a;
        me.h hVar = new me.h(this, 7);
        lq.o oVar = lq.o.d;
        this.presenter$delegate = n.a(oVar, new l(a, hVar, 8));
        this.preferenceData$delegate = n.b(new me.h(this, 6));
        this.imageLoader$delegate = n.a(oVar, new s(this, 12));
        this.billingManager$delegate = n.a(oVar, new s(this, 13));
        this.layout = 2131558522;
        this.isDailyTipShown = true;
        this.mAlphaValue = 1.0f;
        this.recordType = y.e;
    }

    private final void askForNotification() {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.askForNotification():void");
    }

    private final void cancelCountDownTimers() {
        CountDownTimer countDownTimer = this.stepsTimer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
        CountDownTimer countDownTimer2 = this.floorsTimer;
        if (countDownTimer2 != null) {
            countDownTimer2.cancel();
        }
        CountDownTimer countDownTimer3 = this.waterTimer;
        if (countDownTimer3 != null) {
            countDownTimer3.cancel();
        }
    }

    private final void checkFromPlayStore() {
        getBillingManager().e(getActivity(), new k0(this, 1));
    }

    private final boolean checkGroupConditions() {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.checkGroupConditions():boolean");
    }

    public final void checkPermission() {
        MainActivity activity = getActivity();
        if (activity == null || !(activity instanceof MainActivity)) {
            return;
        }
        activity.checkNotificationPermission();
    }

    @d
    private final void checkWhichAppIsConnected(MainActivity mainActivity, int i) {
        Unit unit;
        Integer id;
        String str;
        Unit unit2;
        Integer id2;
        i iVar;
        Unit unit3;
        Integer id3;
        boolean hasFitbitConnected = mainActivity.hasFitbitConnected();
        boolean hasGoogleFitConnected = hasGoogleFitConnected();
        boolean e3 = getPreferenceData().e();
        boolean a = getPresenter().e.a();
        int i2 = 0;
        et.d.d("CheckingHealthSdk").c("is health connect connected " + a + "  , " + hasFitbitConnected + " , " + e3, new Object[0]);
        if (hasFitbitConnected) {
            i0 presenter = getPresenter();
            me.e eVar = new me.e(this, i2);
            presenter.getClass();
            Intrinsics.checkNotNullParameter(eVar, "success");
            et.d.d("History Sync Api").a(a0.g0.f("sync the data using fitbit ", i), new Object[0]);
            boolean v2 = presenter.v();
            j0 j0Var = ((ad.a) presenter).a;
            if (v2) {
                GroupData groupData = presenter.h;
                Integer id4 = groupData != null ? groupData.getId() : null;
                boolean b = s6.s.l().b(id.n.d);
                boolean b4 = s6.s.l().b(id.n.e);
                et.d.c("FitbitSync: hasAccessToReadDailyActivity: " + b + " hasAccessToReadNutrition: " + b4 + " groupId: " + id4, new Object[0]);
                if (b || b4) {
                    GroupData groupData2 = presenter.h;
                    if (groupData2 == null || (id3 = groupData2.getId()) == null) {
                        unit3 = null;
                    } else {
                        int intValue = id3.intValue();
                        et.d.d("History Sync Api").a("group id is not null for the fitbit", new Object[0]);
                        ArrayList arrayList = new ArrayList();
                        i iVar2 = new i(new aq.a(new ca.a(i, 1), 0), new a9.h(25, new v(presenter, intValue, 1)), 0);
                        Intrinsics.checkNotNullExpressionValue(iVar2, "fun getFitBitDataForLast…se\")\n            }\n\n    }");
                        i iVar3 = new i(new aq.a(new ca.a(i, 2), 0), new a9.h(26, new v(presenter, intValue, 3)), 0);
                        Intrinsics.checkNotNullExpressionValue(iVar3, "fun getFitBitDataForLast…se\")\n            }\n\n    }");
                        i iVar4 = new i(new aq.a(new ca.a(i, 3), 0), new a9.h(27, new v(presenter, intValue, 2)), 0);
                        Intrinsics.checkNotNullExpressionValue(iVar4, "fun getFitBitDataForLast…se\")\n            }\n\n    }");
                        if (b && b4) {
                            arrayList.add(iVar2);
                            arrayList.add(iVar3);
                            arrayList.add(iVar4);
                        } else if (b) {
                            arrayList.add(iVar2);
                            arrayList.add(iVar4);
                        } else if (b4) {
                            arrayList.add(iVar3);
                        }
                        if (arrayList.isEmpty()) {
                            et.d.d("History Sync Api").a("observable is empty for the fitbit", new Object[0]);
                            j0Var.hideLoadingDialog();
                        } else {
                            aq.b bVar = new aq.b(3, arrayList, new a9.h(28, me.m.R));
                            Intrinsics.checkNotNullExpressionValue(bVar, "zip(observables) { return@zip true }");
                            aq.b bVar2 = new aq.b(1, new aq.e(new aq.e(kotlin.jvm.internal.o.D0(kotlin.jvm.internal.o.S0(bVar)), new fe.l(27, new x(eVar, presenter, 0)), 2), new fe.l(28, me.m.S), 0), new q(presenter, 4));
                            Intrinsics.checkNotNullExpressionValue(bVar2, "fun getFitBitDataForLast…se\")\n            }\n\n    }");
                            com.bumptech.glide.d.m(presenter, bVar2);
                            unit3 = Unit.a;
                        }
                    }
                    if (unit3 == null) {
                        et.d.d("History Sync Api").a("group id is null for the fitbit case", new Object[0]);
                    }
                } else {
                    et.d.d("History Sync Api").a("all permission for the fitbit is denied or not given by the user", new Object[0]);
                    j0Var.hideLoadingDialog();
                }
            } else {
                et.d.d("History Sync Api").a(og.m.i("should not sync record call fitbit ", !presenter.v()), new Object[0]);
                j0Var.hideLoadingDialog();
            }
        } else {
            if (!hasGoogleFitConnected || e3) {
                if (!e3) {
                    if (!a) {
                        et.d.d("switch status").a("no connected", new Object[0]);
                        return;
                    }
                    i0 presenter2 = getPresenter();
                    me.e eVar2 = new me.e(this, 3);
                    presenter2.getClass();
                    Intrinsics.checkNotNullParameter(eVar2, "success");
                    et.d.d("History Sync Api").a(a0.g0.f("sync the data using health connect ", i), new Object[0]);
                    if (!presenter2.v()) {
                        et.d.d("History Sync Api").a(og.m.i("should not sync record call health connect ", !presenter2.v()), new Object[0]);
                        ((ad.a) presenter2).a.hideLoadingDialog();
                        return;
                    }
                    u1 u1Var = new u1(presenter2, i, eVar2, 8);
                    Intrinsics.checkNotNullParameter(u1Var, "callback");
                    if (((Boolean) presenter2.e.j().d).booleanValue()) {
                        f.O(lh.d.b(m0.b), (kotlin.coroutines.a) null, 0, new b0(presenter2, u1Var, (oq.c) null), 3);
                        return;
                    } else {
                        u1Var.invoke(Boolean.FALSE, new LinkedHashSet());
                        return;
                    }
                }
                if (z2.h.checkSelfPermission(requireContext(), "android.permission.ACTIVITY_RECOGNITION") == -1) {
                    return;
                }
                i0 presenter3 = getPresenter();
                MainActivity activity = getActivity();
                Intrinsics.f(activity, "null cannot be cast to non-null type com.bettertogether.screens.main.MainActivity");
                MainActivity mainActivity2 = activity;
                me.e eVar3 = new me.e(this, 2);
                presenter3.getClass();
                Intrinsics.checkNotNullParameter(mainActivity2, "activity");
                Intrinsics.checkNotNullParameter(eVar3, "success");
                et.d.c("syncUserRecordedData: " + (!presenter3.j()) + " " + zf.d.b, new Object[0]);
                boolean v3 = presenter3.v();
                j0 j0Var2 = ((ad.a) presenter3).a;
                if (!v3) {
                    et.d.d("History Sync Api").a(og.m.i("should not sync record call google fit ", !presenter3.v()), new Object[0]);
                    j0Var2.hideLoadingDialog();
                    return;
                }
                GroupData groupData3 = presenter3.h;
                if (groupData3 == null || (id = groupData3.getId()) == null) {
                    unit = null;
                } else {
                    int intValue2 = id.intValue();
                    et.d.d("History Sync Api").a("group id is not null for the google fit", new Object[0]);
                    ArrayList arrayList2 = new ArrayList();
                    arrayList2.add(new i(new aq.a(new me.s(mainActivity2, i, 2), 0), new if.d(6, new v(presenter3, intValue2, 8)), 0));
                    if (arrayList2.isEmpty()) {
                        et.d.d("History Sync Api").a("observable are empty for the google fit", new Object[0]);
                        j0Var2.hideLoadingDialog();
                        return;
                    }
                    aq.b bVar3 = new aq.b(3, arrayList2, new if.d(7, me.m.Z));
                    Intrinsics.checkNotNullExpressionValue(bVar3, "zip(observables) { return@zip true }");
                    aq.b bVar4 = new aq.b(1, new aq.e(new aq.e(kotlin.jvm.internal.o.D0(kotlin.jvm.internal.o.S0(bVar3)), new r(5, new x(eVar3, presenter3, 3)), 2), new r(6, me.m.f646a0), 0), new q(presenter3, 7));
                    Intrinsics.checkNotNullExpressionValue(bVar4, "fun getRecordingApiDataF…ase\")\n            }\n    }");
                    com.bumptech.glide.d.m(presenter3, bVar4);
                    unit = Unit.a;
                }
                if (unit == null) {
                    et.d.d("History Sync Api").a("group id is null for the google fit case", new Object[0]);
                    return;
                }
                return;
            }
            i0 presenter4 = getPresenter();
            MainActivity activity2 = getActivity();
            Intrinsics.f(activity2, "null cannot be cast to non-null type com.bettertogether.screens.main.MainActivity");
            MainActivity mainActivity3 = activity2;
            me.e eVar4 = new me.e(this, 1);
            presenter4.getClass();
            Intrinsics.checkNotNullParameter(mainActivity3, "activity");
            Intrinsics.checkNotNullParameter(eVar4, "success");
            et.d.c("syncUserRecordedData: " + (!presenter4.j()) + " " + zf.d.b, new Object[0]);
            et.d.d("History Sync Api").a(a0.g0.f("sync the data using google fit ", i), new Object[0]);
            boolean v4 = presenter4.v();
            j0 j0Var3 = ((ad.a) presenter4).a;
            if (v4) {
                DataType dataType = DataType.TYPE_HYDRATION;
                Intrinsics.checkNotNullExpressionValue(dataType, "TYPE_HYDRATION");
                boolean checkGooglePermissionsGrantedFor = mainActivity3.checkGooglePermissionsGrantedFor(dataType);
                DataType dataType2 = DataType.AGGREGATE_CALORIES_EXPENDED;
                Intrinsics.checkNotNullExpressionValue(dataType2, "AGGREGATE_CALORIES_EXPENDED");
                mainActivity3.checkGooglePermissionsGrantedFor(dataType2);
                DataType dataType3 = DataType.TYPE_STEP_COUNT_DELTA;
                Intrinsics.checkNotNullExpressionValue(dataType3, "TYPE_STEP_COUNT_DELTA");
                boolean checkGooglePermissionsGrantedFor2 = mainActivity3.checkGooglePermissionsGrantedFor(dataType3);
                if (checkGooglePermissionsGrantedFor || checkGooglePermissionsGrantedFor2) {
                    int i3 = 0;
                    et.d.c("syncUserRecordedData: permissions: " + checkGooglePermissionsGrantedFor + " " + checkGooglePermissionsGrantedFor2 + " " + presenter4.j(), new Object[0]);
                    GroupData groupData4 = presenter4.h;
                    if (groupData4 == null || (id2 = groupData4.getId()) == null) {
                        str = "group id is null for the google fit case";
                        unit2 = null;
                    } else {
                        int intValue3 = id2.intValue();
                        et.d.d("History Sync Api").a("group id is not null for the google fit", new Object[0]);
                        ArrayList arrayList3 = new ArrayList();
                        if (checkGooglePermissionsGrantedFor2) {
                            str = "group id is null for the google fit case";
                            i3 = 0;
                            iVar = new i(new aq.a(new me.s(mainActivity3, i, 0), 0), new if.d(1, new v(presenter4, intValue3, 4)), 0);
                        } else {
                            str = "group id is null for the google fit case";
                            iVar = null;
                        }
                        i iVar5 = checkGooglePermissionsGrantedFor ? new i(new aq.a(new me.s(mainActivity3, i, 1), i3), new if.d(2, new v(presenter4, intValue3, 5)), i3) : null;
                        if (checkGooglePermissionsGrantedFor && checkGooglePermissionsGrantedFor2) {
                            if (iVar5 != null) {
                                arrayList3.add(iVar5);
                            }
                            if (iVar != null) {
                                arrayList3.add(iVar);
                            }
                        } else if (checkGooglePermissionsGrantedFor) {
                            if (iVar5 != null) {
                                arrayList3.add(iVar5);
                            }
                        } else if (checkGooglePermissionsGrantedFor2 && iVar != null) {
                            arrayList3.add(iVar);
                        }
                        if (arrayList3.isEmpty()) {
                            et.d.d("History Sync Api").a("observable are empty for the google fit", new Object[0]);
                            j0Var3.hideLoadingDialog();
                        } else {
                            aq.b bVar5 = new aq.b(3, arrayList3, new if.d(3, me.m.T));
                            Intrinsics.checkNotNullExpressionValue(bVar5, "zip(observables) { return@zip true }");
                            aq.b bVar6 = new aq.b(1, new aq.e(new aq.e(kotlin.jvm.internal.o.D0(kotlin.jvm.internal.o.S0(bVar5)), new r(1, new x(eVar4, presenter4, 1)), 2), new r(2, me.m.U), 0), new q(presenter4, 6));
                            Intrinsics.checkNotNullExpressionValue(bVar6, "fun getGoogleFitDataForS…ase\")\n            }\n    }");
                            com.bumptech.glide.d.m(presenter4, bVar6);
                            unit2 = Unit.a;
                        }
                    }
                    if (unit2 == null) {
                        et.d.d("History Sync Api").a(str, new Object[0]);
                    }
                } else {
                    et.d.d("History Sync Api").a("all permission for the google fit is denied or not given by the user", new Object[0]);
                    j0Var3.hideLoadingDialog();
                }
            } else {
                et.d.d("History Sync Api").a(og.m.i("should not sync record call google fit ", !presenter4.v()), new Object[0]);
                j0Var3.hideLoadingDialog();
            }
        }
    }

    private final java.lang.String currentWeek() {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.currentWeek():java.lang.String");
    }

    private final String encrypt(SecretKeySpec secretKeySpec, byte[] bArr, byte[] bArr2) {
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
        cipher.init(1, secretKeySpec, new IvParameterSpec(bArr));
        String encodeToString = Base64.encodeToString(cipher.doFinal(bArr2), 2);
        Intrinsics.checkNotNullExpressionValue(encodeToString, "encodeToString(cipherText, Base64.NO_WRAP)");
        return encodeToString;
    }

    public static String encrypt$default(DashboardFragment dashboardFragment, SecretKeySpec secretKeySpec, byte[] bArr, byte[] bArr2, int i, Object obj) {
        if ((i & 1) != 0) {
            byte[] bytes = "UghtK3K22lVat5CCjrr6gL7C8yZxFzbQ".getBytes(Charsets.UTF_8);
            Intrinsics.checkNotNullExpressionValue(bytes, "getBytes(...)");
            secretKeySpec = new SecretKeySpec(bytes, "AES");
        }
        if ((i & 2) != 0) {
            bArr = "7bFnhabfS5WAlh76".getBytes(Charsets.UTF_8);
            Intrinsics.checkNotNullExpressionValue(bArr, "getBytes(...)");
        }
        return dashboardFragment.encrypt(secretKeySpec, bArr, bArr2);
    }

    private final String encryptUserPayload(me.d dVar) {
        throw null;
    }

    public final wf.l getBillingManager() {
        return (wf.l) this.billingManager$delegate.getValue();
    }

    private final ArrayList<GroupData> getCommonGroups() {
        ArrayList<GroupData> arrayList = new ArrayList<>();
        tf.o oVar = zf.d.a;
        arrayList.addAll(zf.d.f);
        arrayList.addAll(zf.d.g);
        return arrayList;
    }

    public final String getCurrentLanguage() {
        Translations translations;
        Translations translations2;
        Translations translations3;
        Translations translations4;
        Translations translations5;
        Translations translations6;
        et.a d2 = et.d.d("currentLanguage");
        String language = Locale.getDefault().getLanguage();
        FoodLogFirebaseRemoteConfig foodLogFirebaseRemoteConfig = foodLogDataFromRemoteConfig;
        d2.c("the current language is " + language + " " + (foodLogFirebaseRemoteConfig != null ? foodLogFirebaseRemoteConfig.getTranslations() : null) + " ", new Object[0]);
        String language2 = Locale.getDefault().getLanguage();
        Intrinsics.checkNotNullExpressionValue(language2, "getDefault().language");
        if (kotlin.text.y.C(language2, "de", false)) {
            FoodLogFirebaseRemoteConfig foodLogFirebaseRemoteConfig2 = foodLogDataFromRemoteConfig;
            if (foodLogFirebaseRemoteConfig2 == null || (translations6 = foodLogFirebaseRemoteConfig2.getTranslations()) == null) {
                return null;
            }
            return translations6.getDe();
        }
        String language3 = Locale.getDefault().getLanguage();
        Intrinsics.checkNotNullExpressionValue(language3, "getDefault().language");
        if (kotlin.text.y.C(language3, "es", false)) {
            FoodLogFirebaseRemoteConfig foodLogFirebaseRemoteConfig3 = foodLogDataFromRemoteConfig;
            if (foodLogFirebaseRemoteConfig3 == null || (translations5 = foodLogFirebaseRemoteConfig3.getTranslations()) == null) {
                return null;
            }
            return translations5.getSp();
        }
        String language4 = Locale.getDefault().getLanguage();
        Intrinsics.checkNotNullExpressionValue(language4, "getDefault().language");
        if (kotlin.text.y.C(language4, "fr", false)) {
            FoodLogFirebaseRemoteConfig foodLogFirebaseRemoteConfig4 = foodLogDataFromRemoteConfig;
            if (foodLogFirebaseRemoteConfig4 == null || (translations4 = foodLogFirebaseRemoteConfig4.getTranslations()) == null) {
                return null;
            }
            return translations4.getFr();
        }
        String language5 = Locale.getDefault().getLanguage();
        Intrinsics.checkNotNullExpressionValue(language5, "getDefault().language");
        if (!kotlin.text.y.C(language5, "he", false)) {
            String language6 = Locale.getDefault().getLanguage();
            Intrinsics.checkNotNullExpressionValue(language6, "getDefault().language");
            if (!kotlin.text.y.C(language6, "iw", false)) {
                String language7 = Locale.getDefault().getLanguage();
                Intrinsics.checkNotNullExpressionValue(language7, "getDefault().language");
                if (kotlin.text.y.C(language7, "zh", false)) {
                    FoodLogFirebaseRemoteConfig foodLogFirebaseRemoteConfig5 = foodLogDataFromRemoteConfig;
                    if (foodLogFirebaseRemoteConfig5 == null || (translations3 = foodLogFirebaseRemoteConfig5.getTranslations()) == null) {
                        return null;
                    }
                    return translations3.getZhCN();
                }
                FoodLogFirebaseRemoteConfig foodLogFirebaseRemoteConfig6 = foodLogDataFromRemoteConfig;
                if (foodLogFirebaseRemoteConfig6 == null || (translations2 = foodLogFirebaseRemoteConfig6.getTranslations()) == null) {
                    return null;
                }
                return translations2.getEn();
            }
        }
        FoodLogFirebaseRemoteConfig foodLogFirebaseRemoteConfig7 = foodLogDataFromRemoteConfig;
        if (foodLogFirebaseRemoteConfig7 == null || (translations = foodLogFirebaseRemoteConfig7.getTranslations()) == null) {
            return null;
        }
        return translations.getHe();
    }

    private final String getDailyMessage(int i, int i2) {
        String[] stringArray = getResources().getStringArray(i);
        Intrinsics.checkNotNullExpressionValue(stringArray, "resources.getStringArray(array)");
        if (i2 >= stringArray.length) {
            i2 = 0;
        }
        String str = stringArray[i2];
        Intrinsics.checkNotNullExpressionValue(str, "messages[index]");
        return str;
    }

    private final long getDayDiff() {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.getDayDiff():long");
    }

    private final void getGoogleFitData(MainActivity mainActivity) {
        boolean z = !getPresenter().j();
        tf.o oVar = zf.d.a;
        et.d.c("syncUserRecordedData: " + z + " " + zf.d.b, new Object[0]);
        DataType dataType = DataType.TYPE_HYDRATION;
        Intrinsics.checkNotNullExpressionValue(dataType, "TYPE_HYDRATION");
        boolean checkGooglePermissionsGrantedFor = mainActivity.checkGooglePermissionsGrantedFor(dataType);
        DataType dataType2 = DataType.AGGREGATE_CALORIES_EXPENDED;
        Intrinsics.checkNotNullExpressionValue(dataType2, "AGGREGATE_CALORIES_EXPENDED");
        boolean checkGooglePermissionsGrantedFor2 = mainActivity.checkGooglePermissionsGrantedFor(dataType2);
        DataType dataType3 = DataType.TYPE_STEP_COUNT_DELTA;
        Intrinsics.checkNotNullExpressionValue(dataType3, "TYPE_STEP_COUNT_DELTA");
        boolean checkGooglePermissionsGrantedFor3 = mainActivity.checkGooglePermissionsGrantedFor(dataType3);
        if (!checkGooglePermissionsGrantedFor && !checkGooglePermissionsGrantedFor3) {
            hideLoadingDialog();
            return;
        }
        et.d.c("syncUserRecordedData: permissions: " + checkGooglePermissionsGrantedFor + " " + checkGooglePermissionsGrantedFor3 + " " + getPresenter().j(), new Object[0]);
        if (checkGooglePermissionsGrantedFor) {
            mainActivity.readDailyWaterLogFromGoogleFit(new me.e(this, 4));
        }
        if (checkGooglePermissionsGrantedFor2) {
            mainActivity.readDailyCaloriesLogFromGoogleFit(new me.e(this, 5));
        }
        if (checkGooglePermissionsGrantedFor3) {
            mainActivity.readDailyStepsLogFromGoogleFit(new me.e(this, 6));
        }
    }

    private final void getHealthConnectData(MainActivity mainActivity) {
        mainActivity.getHealthConnectData(true, new w(15, this, mainActivity, mainActivity));
    }

    private final bg.b getImageLoader() {
        return (bg.b) this.imageLoader$delegate.getValue();
    }

    public final dg.c getItemDecorator(int i, int i2) {
        Context context = getContext();
        Locale locale = Locale.getDefault();
        Intrinsics.checkNotNullExpressionValue(locale, "getDefault()");
        setItemDecoration(new dg.c(context, i2, i, TextUtils.getLayoutDirectionFromLocale(locale) == 1));
        return getItemDecoration();
    }

    private final eg.e getListenerShowCaseBuilder(View view) {
        e0 activity = getActivity();
        if (activity == null) {
            return null;
        }
        eg.e eVar = new eg.e(activity);
        Intrinsics.checkNotNullParameter("", "title");
        eVar.b = "";
        String string = getString(2131952597);
        Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.view_story_message)");
        Intrinsics.checkNotNullParameter(string, "subtitle");
        eVar.c = string;
        eVar.d = 2131100369;
        eVar.e = 14;
        hh.b bVar = hh.b.i;
        Intrinsics.checkNotNullParameter(bVar, "arrowPosition");
        ArrayList arrayList = eVar.h;
        arrayList.clear();
        arrayList.add(bVar);
        mh.c cVar = new mh.c();
        Intrinsics.checkNotNullParameter(cVar, "bubbleShowCaseListener");
        eVar.j = cVar;
        Intrinsics.checkNotNullParameter(view, "targetView");
        eVar.i = new WeakReference(view);
        return eVar;
    }

    private final void getPaywallData() {
        if (!k.q()) {
            showPopup();
            return;
        }
        GroupData groupData = getPresenter().h;
        if (groupData != null) {
            SubscriptionReminderConfig o = com.bumptech.glide.e.o(groupData.getId());
            Integer daysSinceStarted = groupData.getDaysSinceStarted();
            String m = com.bumptech.glide.e.m(Integer.valueOf(daysSinceStarted != null ? daysSinceStarted.intValue() : 0), o);
            Adapty adapty = Adapty.INSTANCE;
            Adapty.getPaywall(m, yc.c.b(), AdaptyPaywall.FetchPolicy.ReloadRevalidatingCacheData, TimeIntervalKt.getSeconds(10), new a0(this, 1));
        }
    }

    public static final void getPaywallData$lambda$130$lambda$129(DashboardFragment dashboardFragment, AdaptyResult adaptyResult) {
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        Intrinsics.checkNotNullParameter(adaptyResult, "result");
        if (adaptyResult instanceof AdaptyResult.Success) {
            yc.c.d((AdaptyPaywall) ((AdaptyResult.Success) adaptyResult).getValue(), new me.e(dashboardFragment, 7));
            isAdaptyPaywallBuilderAvailable = yc.c.a();
        } else if (adaptyResult instanceof AdaptyResult.Error) {
            et.d.b(a0.g0.j("Adapty Paywall: Error ", ((AdaptyResult.Error) adaptyResult).getError().getMessage()), new Object[0]);
        }
    }

    public final PreferenceData getPreferenceData() {
        return (PreferenceData) this.preferenceData$delegate.getValue();
    }

    public final i0 getPresenter() {
        return (i0) this.presenter$delegate.getValue();
    }

    public final boolean getProfilePopupSetting() {
        boolean z = getPresenter().n().isEmpty() || getPresenter().i(getPresenter().h) || zf.d.b || getPreferenceData().c();
        if (getActivity() != null && (getActivity() instanceof MainActivity)) {
            MainActivity activity = getActivity();
            Intrinsics.f(activity, "null cannot be cast to non-null type com.bettertogether.screens.main.MainActivity");
            activity.setDailyTipsPopupEnable(z);
        }
        return z;
    }

    private final void getRecordingApiDataForSteps(MainActivity mainActivity) {
        et.d.d("RecordingApiEnabled").a("syncUserRecordedData: RecordingApiEnabled and has been Used For Data Management", new Object[0]);
        if (z2.h.checkSelfPermission(requireContext(), "android.permission.ACTIVITY_RECOGNITION") != 0) {
            return;
        }
        mainActivity.readDailyCaloriesLogFromRecordingApi(new me.e(this, 8));
        et.d.d("RecordingTestingApiShubham").a("syncUserRecordedData: Steps has been Updated on the Server testing  " + (!getPresenter().j()) + "  " + zf.d.b, new Object[0]);
        if (!getPresenter().j() || zf.d.b) {
            et.d.d("RecordingTestingApiEnabled").a("syncUserRecordedData: Steps has been Updated on the Server ", new Object[0]);
            mainActivity.readDailyStepsFromTheRecordingApi(new me.e(this, 9));
        }
    }

    private final java.lang.String getWeekTarget(com.bettertogether.remote.model.common.GroupData r8, com.bettertogether.remote.model.response.DashboardResponse r9, java.lang.String r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.getWeekTarget(com.bettertogether.remote.model.common.GroupData, com.bettertogether.remote.model.response.DashboardResponse, java.lang.String):java.lang.String");
    }

    private final SpannableStringBuilder getWeekTargetFormattedText(String str, String str2) {
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
        if (str != null) {
            ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(z2.h.getColor(requireContext(), 2131099693));
            int length = spannableStringBuilder.length();
            spannableStringBuilder.append((CharSequence) str);
            spannableStringBuilder.setSpan(foregroundColorSpan, length, spannableStringBuilder.length(), 17);
        }
        if (str2 != null) {
            SpannableStringBuilder append = spannableStringBuilder.append((CharSequence) " ");
            Intrinsics.checkNotNullExpressionValue(append, "sb.append(\" \")");
            ForegroundColorSpan foregroundColorSpan2 = new ForegroundColorSpan(z2.h.getColor(requireContext(), 2131099695));
            int length2 = append.length();
            append.append(str2, new StyleSpan(1), 33);
            append.setSpan(foregroundColorSpan2, length2, append.length(), 17);
        }
        return spannableStringBuilder;
    }

    public static SpannableStringBuilder getWeekTargetFormattedText$default(DashboardFragment dashboardFragment, String str, String str2, int i, Object obj) {
        if ((i & 2) != 0) {
            str2 = null;
        }
        return dashboardFragment.getWeekTargetFormattedText(str, str2);
    }

    public final void hidShowAdView(boolean z) {
        MainActivity activity = getActivity();
        tf.o oVar = zf.d.a;
        et.d.a(og.m.i("BusinessUser: hidShowAdView: ", zf.d.b), new Object[0]);
        if (activity instanceof MainActivity) {
            activity.hideAdView(z);
        }
    }

    private final void initCreateChallengeTitle() {
        n9.b bVar;
        String e3 = u7.e.e("create_challenge_button_text", "getInstance().getString(CREATE_GROUP_CHALLENGE)");
        r0 r0Var = this.binding;
        MaterialButton materialButton = (r0Var == null || (bVar = r0Var.k) == null) ? null : bVar.d;
        if (materialButton == null) {
            return;
        }
        materialButton.setText(e3);
    }

    private final void initStoryly() {
        StorylyView storylyView;
        Float f;
        DisplayMetrics displayMetrics;
        et.d.d("CheckingStoryLy").c("Checking How many times the storyLy is Called ", new Object[0]);
        if (this.mStoryly == null) {
            sf.c cVar = new sf.c();
            this.mStoryly = cVar;
            e0 activity = getActivity();
            if (activity != null) {
                Intrinsics.checkNotNullParameter(activity, "<this>");
                Resources resources = activity.getResources();
                f = Float.valueOf(5 * ((resources == null || (displayMetrics = resources.getDisplayMetrics()) == null) ? 0.0f : displayMetrics.density));
            } else {
                f = null;
            }
            cVar.a = f != null ? f.floatValue() : 16.0f;
        }
        et.d.b("storylySetupLogger init storly called", new Object[0]);
        BetterTogetherApp betterTogetherApp = BetterTogetherApp.f198d;
        if (!g.n(s6.s.j())) {
            et.d.b("storylySetupLogger init storly called internet is not there", new Object[0]);
            return;
        }
        et.d.b("storylySetupLogger init storly called internet is there", new Object[0]);
        r0 r0Var = this.binding;
        if (r0Var != null && (storylyView = r0Var.N) != null) {
            sf.c cVar2 = this.mStoryly;
            if (cVar2 != null) {
                Intrinsics.checkNotNullParameter(storylyView, "storylyView");
                et.d.a("storylySetupLogger : storyly properties & config initialization", new Object[0]);
                try {
                    storylyView.setStorylyInit(new StorylyInit("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NfaWQiOjU2NjQsImFwcF9pZCI6MTMwMzEsImluc19pZCI6MTQxNTJ9.PWZqbnK4ZWu5D1yCSQlFAMSWMTgxl-oyPXxtHDBCdew", new StorylyConfig.Builder().setStoryGroupStyling(new StorylyStoryGroupStyling.Builder().setSize(StoryGroupSize.Small).setTitleLineCount(2).setTitleNotSeenColor(z2.h.getColor(s6.s.j(), R.color.white)).setIconBorderAnimation(StoryGroupAnimation.Disabled).setTitleSeenColor(z2.h.getColor(s6.s.j(), R.color.white)).build()).setBarStyling(new StorylyBarStyling.Builder().setHorizontalPaddingBetweenItems((int) cVar2.a).setVerticalPaddingBetweenItems((int) cVar2.a).build()).setShareConfig(new StorylyShareConfig.Builder().setShareUrl("https://bettertogether-app.com/applink/{story_id}").build()).build()));
                    cVar2.b = true;
                } catch (Exception e3) {
                    e3.printStackTrace();
                    cVar2.b = false;
                }
            }
            if (this.mStoryly != null) {
                me.e eVar = new me.e(this, 10);
                qd.g gVar = qd.g.N;
                me.e eVar2 = new me.e(this, 11);
                kc.a0 a0Var = new kc.a0(19, storylyView, this);
                Intrinsics.checkNotNullParameter(storylyView, "storylyView");
                Intrinsics.checkNotNullParameter(eVar, "isStoryShown");
                Intrinsics.checkNotNullParameter(gVar, "onHeaderClick");
                Intrinsics.checkNotNullParameter(eVar2, "onActionClicked");
                Intrinsics.checkNotNullParameter(a0Var, "onStoryDataLoaded");
                et.d.a("storylySetupLogger : listener initialization for the storyly", new Object[0]);
                storylyView.setStorylyListener(new sf.b(a0Var, eVar, eVar2));
            }
            openStoryForNewUser();
        }
        MainActivity activity2 = getActivity();
        if (activity2 == null || !(activity2 instanceof MainActivity)) {
            return;
        }
        MainActivity mainActivity = activity2;
        if (mainActivity.getStorylyData() == null) {
            if (mainActivity.getCustomStoryLink() != null) {
                et.d.d("CodeChecking").c(com.android.billingclient.api.a.m("Called from the init method else ", mainActivity.getCustomStoryLink(), " ", mainActivity.getStoryLyNotificationDaySinceStarted()), new Object[0]);
                refreshAndReloadStoryly();
                return;
            }
            return;
        }
        if (this.mStoryly != null) {
            r0 r0Var2 = this.binding;
            StorylyView storylyView2 = r0Var2 != null ? r0Var2.N : null;
            Uri storylyData = mainActivity.getStorylyData();
            PreferenceData preferenceData = getPreferenceData();
            Intrinsics.checkNotNullParameter(preferenceData, "preferenceData");
            String queryParameter = storylyData != null ? storylyData.getQueryParameter("g") : null;
            String queryParameter2 = storylyData != null ? storylyData.getQueryParameter("s") : null;
            if (queryParameter != null && storylyView2 != null) {
                er.k[] kVarArr = StorylyView.c0;
                storylyView2.n(queryParameter, queryParameter2, PlayMode.Default);
            }
            preferenceData.getClass();
            preferenceData.t("storyLyIntent", "");
        }
        mainActivity.setStorylyData(null);
    }

    public static final void initViews$lambda$17$lambda$10(DashboardFragment dashboardFragment, View view) {
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        if (i0.h(dashboardFragment.getPresenter(), dashboardFragment.getPresenter().h) || zf.d.a != tf.o.d || dashboardFragment.getPresenter().i(dashboardFragment.getPresenter().h)) {
            return;
        }
        dashboardFragment.getPreferenceData().c();
        GroupData groupData = dashboardFragment.getPresenter().h;
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            int i = 0;
            if (k.q()) {
                int i2 = SubscriptionPlansActivity.U;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                if (groupData != null && (daysSinceStarted2 = groupData.getDaysSinceStarted()) != null) {
                    i = daysSinceStarted2.intValue();
                }
                dashboardFragment.startActivity(cf.d.q(activity, i, groupData != null ? groupData.getId() : null, groupData));
            } else {
                int i3 = SubscriptionPlansInAppActivity.W;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                dashboardFragment.startActivity(cf.f.q(activity, (groupData == null || (daysSinceStarted = groupData.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData != null ? groupData.getId() : null, false, 16));
            }
        }
        fs.d.F(dashboardFragment, dashboardFragment.getPreferenceData(), true);
    }

    public static final void initViews$lambda$17$lambda$12(DashboardFragment dashboardFragment, View view) {
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        if (i0.h(dashboardFragment.getPresenter(), dashboardFragment.getPresenter().h) || zf.d.a != tf.o.d || dashboardFragment.getPresenter().i(dashboardFragment.getPresenter().h)) {
            return;
        }
        dashboardFragment.getPreferenceData().c();
        GroupData groupData = dashboardFragment.getPresenter().h;
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            int i = 0;
            if (k.q()) {
                int i2 = SubscriptionPlansActivity.U;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                if (groupData != null && (daysSinceStarted2 = groupData.getDaysSinceStarted()) != null) {
                    i = daysSinceStarted2.intValue();
                }
                dashboardFragment.startActivity(cf.d.q(activity, i, groupData != null ? groupData.getId() : null, groupData));
            } else {
                int i3 = SubscriptionPlansInAppActivity.W;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                dashboardFragment.startActivity(cf.f.q(activity, (groupData == null || (daysSinceStarted = groupData.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData != null ? groupData.getId() : null, false, 16));
            }
        }
        fs.d.F(dashboardFragment, dashboardFragment.getPreferenceData(), true);
    }

    public static final void initViews$lambda$17$lambda$16(DashboardFragment dashboardFragment, View view) {
        Integer steps;
        Records records;
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        if (i0.h(dashboardFragment.getPresenter(), dashboardFragment.getPresenter().h) || zf.d.b || dashboardFragment.getPresenter().i(dashboardFragment.getPresenter().h)) {
            GroupData groupData = dashboardFragment.getPresenter().h;
            if (groupData == null || (steps = groupData.getSteps()) == null) {
                return;
            }
            int intValue = steps.intValue();
            DashboardResponse dashboardResponse = dashboardFragment.dashboardResponse;
            if (dashboardResponse == null || (records = dashboardResponse.getRecords()) == null) {
                return;
            }
            dashboardFragment.openRecordScreen(y.i, records.getSteps(), intValue, true);
            return;
        }
        dashboardFragment.getPreferenceData().c();
        GroupData groupData2 = dashboardFragment.getPresenter().h;
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            int i = 0;
            if (k.q()) {
                int i2 = SubscriptionPlansActivity.U;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                if (groupData2 != null && (daysSinceStarted2 = groupData2.getDaysSinceStarted()) != null) {
                    i = daysSinceStarted2.intValue();
                }
                dashboardFragment.startActivity(cf.d.q(activity, i, groupData2 != null ? groupData2.getId() : null, groupData2));
            } else {
                int i3 = SubscriptionPlansInAppActivity.W;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                dashboardFragment.startActivity(cf.f.q(activity, (groupData2 == null || (daysSinceStarted = groupData2.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData2 != null ? groupData2.getId() : null, false, 16));
            }
        }
        fs.d.F(dashboardFragment, dashboardFragment.getPreferenceData(), true);
    }

    public static final void initViews$lambda$17$lambda$2(DashboardFragment dashboardFragment, View view) {
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        dashboardFragment.navigateToGroupDetails();
    }

    public static final void initViews$lambda$17$lambda$4(DashboardFragment dashboardFragment, View view) {
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        BetterTogetherApp betterTogetherApp = BetterTogetherApp.f198d;
        u7.e.l(FirebaseAnalytics.getInstance(s6.s.j()), "old_get_pro_button_click");
        dashboardFragment.getPreferenceData().c();
        GroupData groupData = dashboardFragment.getPresenter().h;
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            int i = 0;
            if (k.q()) {
                int i2 = SubscriptionPlansActivity.U;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                if (groupData != null && (daysSinceStarted2 = groupData.getDaysSinceStarted()) != null) {
                    i = daysSinceStarted2.intValue();
                }
                dashboardFragment.startActivity(cf.d.q(activity, i, groupData != null ? groupData.getId() : null, groupData));
            } else {
                int i3 = SubscriptionPlansInAppActivity.W;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                dashboardFragment.startActivity(cf.f.q(activity, (groupData == null || (daysSinceStarted = groupData.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData != null ? groupData.getId() : null, false, 16));
            }
        }
        fs.d.F(dashboardFragment, dashboardFragment.getPreferenceData(), true);
    }

    public static final void initViews$lambda$17$lambda$6(DashboardFragment dashboardFragment, View view) {
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        boolean z;
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        FoodLogFirebaseRemoteConfig foodLogFirebaseRemoteConfig = foodLogDataFromRemoteConfig;
        if (u.h(foodLogFirebaseRemoteConfig != null ? foodLogFirebaseRemoteConfig.getStatus() : null, "true", true)) {
            MainActivity.Companion.getClass();
            z = MainActivity.DOES_USER_SEE_LATEST_FOOD_LOG;
            if (z) {
                if (dashboardFragment.getActivity() != null) {
                    fs.d.p(dashboardFragment, new me.h(dashboardFragment, 1));
                }
                BetterTogetherApp betterTogetherApp = BetterTogetherApp.f198d;
                u7.e.l(FirebaseAnalytics.getInstance(s6.s.j()), "main_food_log_button_clicked");
                return;
            }
        }
        BetterTogetherApp betterTogetherApp2 = BetterTogetherApp.f198d;
        u7.e.l(FirebaseAnalytics.getInstance(s6.s.j()), "main_get_pro_button_click");
        dashboardFragment.getPreferenceData().c();
        GroupData groupData = dashboardFragment.getPresenter().h;
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            int i = 0;
            if (k.q()) {
                int i2 = SubscriptionPlansActivity.U;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                if (groupData != null && (daysSinceStarted2 = groupData.getDaysSinceStarted()) != null) {
                    i = daysSinceStarted2.intValue();
                }
                dashboardFragment.startActivity(cf.d.q(activity, i, groupData != null ? groupData.getId() : null, groupData));
            } else {
                int i3 = SubscriptionPlansInAppActivity.W;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                dashboardFragment.startActivity(cf.f.q(activity, (groupData == null || (daysSinceStarted = groupData.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData != null ? groupData.getId() : null, false, 16));
            }
        }
        fs.d.F(dashboardFragment, dashboardFragment.getPreferenceData(), true);
    }

    public static final void initViews$lambda$17$lambda$8(DashboardFragment dashboardFragment, View view) {
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        if (i0.h(dashboardFragment.getPresenter(), dashboardFragment.getPresenter().h) || zf.d.b || dashboardFragment.getPresenter().i(dashboardFragment.getPresenter().h)) {
            return;
        }
        dashboardFragment.getPreferenceData().c();
        GroupData groupData = dashboardFragment.getPresenter().h;
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            boolean q = k.q();
            int i = 0;
            String str = EBJSxTDURlwkNZ.JTbkRN;
            if (q) {
                int i2 = SubscriptionPlansActivity.U;
                Intrinsics.checkNotNullExpressionValue(activity, str);
                if (groupData != null && (daysSinceStarted2 = groupData.getDaysSinceStarted()) != null) {
                    i = daysSinceStarted2.intValue();
                }
                dashboardFragment.startActivity(cf.d.q(activity, i, groupData != null ? groupData.getId() : null, groupData));
            } else {
                int i3 = SubscriptionPlansInAppActivity.W;
                Intrinsics.checkNotNullExpressionValue(activity, str);
                dashboardFragment.startActivity(cf.f.q(activity, (groupData == null || (daysSinceStarted = groupData.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData != null ? groupData.getId() : null, false, 16));
            }
        }
        fs.d.F(dashboardFragment, dashboardFragment.getPreferenceData(), true);
    }

    private final boolean isAppInForeground() {
        if (!(getActivity() instanceof MainActivity)) {
            return false;
        }
        MainActivity activity = getActivity();
        Intrinsics.f(activity, "null cannot be cast to non-null type com.bettertogether.screens.main.MainActivity");
        return activity.isAppInForeground();
    }

    private final boolean isSetChartValue() {
        return (i0.h(getPresenter(), getPresenter().h) || getPresenter().i(getPresenter().h) || zf.d.b) && this.dashboardResponse != null;
    }

    private final void loadImage(String str) {
        String str2;
        et.d.d("loadImage").c("Load image is cakked ", new Object[0]);
        if (getActivity() != null) {
            ArrayList arrayList = (ArrayList) new en.o().e(u7.e.e("daily_tip_images_1", "getInstance().getString(DAILY_TIP_IMAGES)"), new FirebaseUtils$getDailyTipsImagesList$.inlined.fromJson.1().getType());
            if (arrayList.size() > 0) {
                int nextInt = new Random().nextInt(arrayList.size());
                et.d.c("CheckImage: " + ((DailyTipsImage) arrayList.get(nextInt)).getLink() + " " + nextInt, new Object[0]);
                str2 = ((DailyTipsImage) arrayList.get(nextInt)).getLink();
            } else {
                str2 = "";
            }
            e0 requireActivity = requireActivity();
            com.bumptech.glide.l D = com.bumptech.glide.b.c(requireActivity).g(requireActivity).i().w(new bh.f().l(p.a, new vg.v(), true)).D(str2);
            D.getClass();
            com.bumptech.glide.l C = D.n(tg.a.b, 60000).C(new me.i(0));
            C.B(new me.j(this, str2, str), C);
        }
    }

    private final void navigateToGroupDetails() {
        Integer id;
        GroupData groupData = getPresenter().h;
        if (groupData == null || (id = groupData.getId()) == null) {
            return;
        }
        int intValue = id.intValue();
        i0 presenter = getPresenter();
        ((ad.a) presenter).a.showLoadingDialog();
        i iVar = new i(com.android.billingclient.api.a.h(Unit.a, "just(view.showLoadingDialog())"), new a9.h(17, new v(presenter, intValue, 0)), 0);
        Intrinsics.checkNotNullExpressionValue(iVar, "fun fetchGroupById(group…   .addDisposable()\n    }");
        aq.e eVar = new aq.e(new aq.e(new aq.b(1, kotlin.jvm.internal.o.D0(iVar), new q(presenter, 0)), new fe.l(15, new me.w(presenter, 0)), 2), new fe.l(16, new me.w(presenter, 1)), 0);
        Intrinsics.checkNotNullExpressionValue(eVar, "fun fetchGroupById(group…   .addDisposable()\n    }");
        com.bumptech.glide.d.m(presenter, eVar);
    }

    public final void navigateToStoryLink(String str) {
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.setData(Uri.parse(str));
        startActivity(intent);
    }

    private final void navigateToStorylyProfile(String str, String str2) {
        e0 activity = getActivity();
        if (activity != null) {
            int i = StorylyProfileActivity.y;
            Intrinsics.checkNotNullParameter(activity, "context");
            Intrinsics.checkNotNullParameter(str, "userId");
            Intent intent = new Intent((Context) activity, (Class<?>) StorylyProfileActivity.class);
            intent.putExtra("param_user_id", str);
            intent.putExtra("param_user_name", str2);
            startActivity(intent);
        }
    }

    private final void navigateToTrialEndReminderScreen(GroupData groupData) {
        e0 activity;
        if (getPreferenceData().c()) {
            return;
        }
        tf.o oVar = zf.d.a;
        if (zf.d.b || (activity = getActivity()) == null) {
            return;
        }
        int i = TrialEndReminderActivity.x;
        Intrinsics.checkNotNullParameter(activity, "context");
        Intrinsics.checkNotNullParameter(groupData, "group");
        Intent intent = new Intent((Context) activity, (Class<?>) TrialEndReminderActivity.class);
        intent.putExtra("group", (Serializable) groupData);
        intent.addFlags(536870912);
        startActivity(intent);
        fs.d.F(this, getPreferenceData(), true);
    }

    public static final DashboardFragment newInstance(GroupData groupData, boolean z, boolean z2, String str) {
        Companion.getClass();
        return me.c.a(groupData, z, z2, str);
    }

    public final void notifyGraphAdapter() {
        b bVar = this.mGraphAdapter;
        if (bVar != null) {
            GroupData groupData = getPresenter().h;
            Integer steps = groupData != null ? groupData.getSteps() : null;
            DashboardResponse dashboardResponse = this.dashboardResponse;
            boolean isSetChartValue = isSetChartValue();
            bVar.j = this.mAlphaValue;
            bVar.f = steps;
            bVar.g = dashboardResponse;
            bVar.h = isSetChartValue;
            bVar.notifyDataSetChanged();
        }
        r0 r0Var = this.binding;
        ViewPager2 viewPager2 = r0Var != null ? r0Var.p0 : null;
        if (viewPager2 == null) {
            return;
        }
        viewPager2.setCurrentItem(0);
    }

    public final void onMotivationMessageLinkPressed(String str) {
        fs.d.p(this, new kc.a0(21, str, this));
    }

    private final void openEnrolledGroupsDialog() {
        dd.m mVar = new dd.m(getPresenter().n(), getImageLoader(), new me.e(this, 12), new me.e(this, 13), getPresenter().h);
        e0 activity = getActivity();
        if (activity != null) {
            mVar.show(activity.getSupportFragmentManager(), "enrolledGroups");
        }
    }

    private final void openLogoutDialog() {
        me.e eVar = new me.e(this, 14);
        Context requireContext = requireContext();
        Intrinsics.checkNotNullExpressionValue(requireContext, "requireContext()");
        dd.r rVar = new dd.r(requireContext, eVar);
        if (getActivity() != null) {
            rVar.show();
        }
    }

    private final void openRecordScreen(y yVar, int i, int i2, boolean z) {
        e0 activity = getActivity();
        if (activity == null || activity.getSupportFragmentManager().D("RecordScreenDialog") != null || activity.isFinishing()) {
            return;
        }
        int i3 = df.r.Q;
        GroupData groupData = getPresenter().h;
        Integer id = groupData != null ? groupData.getId() : null;
        me.h hVar = new me.h(this, 4);
        Intrinsics.checkNotNullParameter(yVar, "recordType");
        Intrinsics.checkNotNullParameter(hVar, "onDismiss");
        ?? rVar = new df.r();
        Bundle bundle = new Bundle();
        bundle.putInt("CurrentGroupId", id != null ? id.intValue() : 0);
        bundle.putBoolean("open_add_activity", z);
        bundle.putInt("last_record", i);
        bundle.putInt("target", i2);
        bundle.putSerializable("record_type", yVar);
        rVar.setArguments(bundle);
        rVar.y = hVar;
        rVar.show(activity.getSupportFragmentManager(), "RecordScreenDialog");
    }

    public static void openRecordScreen$default(DashboardFragment dashboardFragment, y yVar, int i, int i2, boolean z, int i3, Object obj) {
        if ((i3 & 8) != 0) {
            z = false;
        }
        dashboardFragment.openRecordScreen(yVar, i, i2, z);
    }

    private final void openStoryForNewUser() {
        RelativeLayout relativeLayout;
        eg.e listenerShowCaseBuilder;
        MainActivity activity;
        zf.c cVar = this.mOpenStory;
        if (cVar != null) {
            if (!this.mIsInviteDialog && cVar == zf.c.f1097e && (activity = getActivity()) != null && (activity instanceof MainActivity)) {
                activity.checkNotificationPermission();
            }
            r0 r0Var = this.binding;
            if (r0Var != null && (relativeLayout = r0Var.q0) != null && (listenerShowCaseBuilder = getListenerShowCaseBuilder(relativeLayout)) != null) {
                if (listenerShowCaseBuilder.f == null) {
                    listenerShowCaseBuilder.f = Boolean.TRUE;
                }
                if (listenerShowCaseBuilder.g == null) {
                    listenerShowCaseBuilder.g = Boolean.TRUE;
                }
                hh.d dVar = new hh.d(listenerShowCaseBuilder);
                WeakReference weakReference = listenerShowCaseBuilder.i;
                if (weakReference != null) {
                    View view = (View) weakReference.get();
                    Intrinsics.e(view);
                    if (view.getHeight() == 0 || view.getWidth() == 0) {
                        listenerShowCaseBuilder.l = new eg.d(dVar, view, listenerShowCaseBuilder);
                        view.getViewTreeObserver().addOnGlobalLayoutListener(listenerShowCaseBuilder.l);
                    } else {
                        dVar.f();
                    }
                } else {
                    dVar.f();
                }
            }
        }
        this.mOpenStory = null;
    }

    private final void openWaterreminderView() {
        if (this.showWaterReminder) {
            this.showWaterReminder = false;
            openRecordScreen$default(this, this.recordType, this.lastRecord, this.selectedGroup, false, 8, null);
        }
    }

    public final FoodLogFirebaseRemoteConfig parseFoodLogJson(String str) {
        if (kotlin.text.y.W(str).toString().length() == 0) {
            return new FoodLogFirebaseRemoteConfig((String) null, (String) null, (Translations) null, (String) null);
        }
        Object d2 = new en.o().d(FoodLogFirebaseRemoteConfig.class, str);
        Intrinsics.checkNotNullExpressionValue(d2, "gson.fromJson(jsonString…RemoteConfig::class.java)");
        return (FoodLogFirebaseRemoteConfig) d2;
    }

    private final java.lang.String previousWeek() {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.previousWeek():java.lang.String");
    }

    private final void readDailyCaloriesLogFromFitbit(Function1<? super Integer, Unit> function1) {
        id.d l = s6.s.l();
        Intrinsics.checkNotNullParameter(function1, "callback");
        l.c.b(new id.a(0, function1));
    }

    private final void readData(LocalRecordingClient localRecordingClient) {
        et.d.d("DumpDataSet").e("Unsubscribe failed: readData", new Object[0]);
        ?? atZone = LocalDateTime.now().atZone(ZoneId.systemDefault());
        ZonedDateTime minusWeeks = atZone.minusWeeks(1L);
        et.d.d("DumpDataSet").e("Unsubscribe failed: readData 2 ", new Object[0]);
        LocalDataReadRequest build = new LocalDataReadRequest.Builder().aggregate(LocalDataType.TYPE_STEP_COUNT_DELTA).bucketByTime(1, TimeUnit.DAYS).setTimeRange(minusWeeks.toEpochSecond(), atZone.toEpochSecond(), TimeUnit.SECONDS).build();
        Intrinsics.checkNotNullExpressionValue(build, "Builder().aggregate(Loca…\n                .build()");
        et.d.d("DumpDataSet").e("Unsubscribe failed: readData 3 ", new Object[0]);
        localRecordingClient.readData(build).addOnSuccessListener(new a9.h(14, new me.e(this, 15))).addOnFailureListener(new l0(17));
    }

    public static final void readData$lambda$51(Function1 function1, Object obj) {
        Intrinsics.checkNotNullParameter(function1, "$tmp0");
        function1.invoke(obj);
    }

    private final void refreshSelectedGroup(boolean z, boolean z2) {
        Unit unit;
        et.d.c("refreshSelectedGroup: isRefreshing " + z + " isFromResume " + z2, new Object[0]);
        addLogToFile("refreshSelectedGroup: isRefreshing " + z + " isFromResume " + z2 + " selected Group: " + getPresenter().h);
        if (z) {
            getPresenter().k(z, true);
            return;
        }
        if (z2) {
            GroupData groupData = getPresenter().h;
            if (groupData != null) {
                getPresenter().s(groupData);
                unit = Unit.a;
            } else {
                unit = null;
            }
            if (unit == null) {
                et.d.c("refreshSelectedGroup: selectedGroup null and activity:" + getActivity(), new Object[0]);
                ArrayList<GroupData> commonGroups = getCommonGroups();
                if (!commonGroups.isEmpty()) {
                    getPresenter().u(commonGroups);
                } else {
                    getPresenter().k(z, true);
                }
            }
        }
    }

    public static void refreshSelectedGroup$default(DashboardFragment dashboardFragment, boolean z, boolean z2, int i, Object obj) {
        if ((i & 1) != 0) {
            z = false;
        }
        if ((i & 2) != 0) {
            z2 = false;
        }
        dashboardFragment.refreshSelectedGroup(z, z2);
    }

    public final void setAutoWeightPopup(boolean z) {
        getPreferenceData().r("auto_weight_detection_popup_shown", z);
        if (!z || getActivity() == null) {
            return;
        }
        MainActivity activity = getActivity();
        Intrinsics.f(activity, "null cannot be cast to non-null type com.bettertogether.screens.main.MainActivity");
        activity.openRateUsDialog();
    }

    public static final void setChallengeNotStarted$lambda$95$lambda$92(View view) {
    }

    public static final void setChallengeNotStarted$lambda$95$lambda$93(View view) {
    }

    public static final void setChallengeNotStarted$lambda$95$lambda$94(View view) {
    }

    private final void setChallengeResults(String str, DashboardResponse dashboardResponse, String str2) {
        float f = dashboardResponse.getWeightInfo().getFinal();
        float current = dashboardResponse.getWeightInfo().getCurrent();
        float initial = dashboardResponse.getWeightInfo().getInitial();
        if (current > f && initial > current) {
            str2 = getString(2131952592, str);
        } else if (current > f && initial < current) {
            str2 = getString(2131952593, str);
        } else if (current <= f) {
            str2 = getString(2131952594, str);
        }
        Intrinsics.checkNotNullExpressionValue(str2, "when {\n            (curr…lse -> fallback\n        }");
        r0 r0Var = this.binding;
        MaterialTextView materialTextView = r0Var != null ? r0Var.i0 : null;
        if (materialTextView != null) {
            materialTextView.setText(getWeekTargetFormattedText$default(this, str2, null, 2, null));
        }
        Log.d("TargetWeight", "setChallengeResults: " + str2 + " dashboardResponse: " + dashboardResponse.getWeightInfo().getTarget());
    }

    public static void setChallengeResults$default(DashboardFragment dashboardFragment, String str, DashboardResponse dashboardResponse, String str2, int i, Object obj) {
        if ((i & 4) != 0) {
            str2 = "";
        }
        dashboardFragment.setChallengeResults(str, dashboardResponse, str2);
    }

    public static final void setChallengeStarted$lambda$73$lambda$68(DashboardFragment dashboardFragment, GroupData groupData, DashboardResponse dashboardResponse, View view) {
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        Intrinsics.checkNotNullParameter(groupData, "$selectedGroup");
        Intrinsics.checkNotNullParameter(dashboardResponse, "$dashboardResponse");
        if (i0.h(dashboardFragment.getPresenter(), dashboardFragment.getPresenter().h) || zf.d.b || dashboardFragment.getPresenter().i(groupData)) {
            y yVar = y.d;
            int floors = dashboardResponse.getRecords().getFloors();
            Integer floors2 = groupData.getFloors();
            Intrinsics.e(floors2);
            openRecordScreen$default(dashboardFragment, yVar, floors, floors2.intValue(), false, 8, null);
            return;
        }
        dashboardFragment.getPreferenceData().c();
        GroupData groupData2 = dashboardFragment.getPresenter().h;
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            int i = 0;
            if (k.q()) {
                int i2 = SubscriptionPlansActivity.U;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                if (groupData2 != null && (daysSinceStarted2 = groupData2.getDaysSinceStarted()) != null) {
                    i = daysSinceStarted2.intValue();
                }
                dashboardFragment.startActivity(cf.d.q(activity, i, groupData2 != null ? groupData2.getId() : null, groupData2));
            } else {
                int i3 = SubscriptionPlansInAppActivity.W;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                dashboardFragment.startActivity(cf.f.q(activity, (groupData2 == null || (daysSinceStarted = groupData2.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData2 != null ? groupData2.getId() : null, false, 16));
            }
        }
        fs.d.F(dashboardFragment, dashboardFragment.getPreferenceData(), true);
    }

    public static final void setChallengeStarted$lambda$73$lambda$70(DashboardFragment dashboardFragment, GroupData groupData, DashboardResponse dashboardResponse, View view) {
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        Intrinsics.checkNotNullParameter(groupData, "$selectedGroup");
        Intrinsics.checkNotNullParameter(dashboardResponse, "$dashboardResponse");
        int i = 0;
        boolean z = !i0.h(dashboardFragment.getPresenter(), groupData) || zf.d.b || dashboardFragment.getPresenter().i(groupData);
        et.d.c("CheckBlockUser: " + z + " RemoteDate: " + i0.h(dashboardFragment.getPresenter(), groupData) + "Subscribed: " + zf.d.b + "Trial: " + dashboardFragment.getPresenter().i(groupData), new Object[0]);
        if (i0.h(dashboardFragment.getPresenter(), groupData) || zf.d.b || dashboardFragment.getPresenter().i(groupData)) {
            y yVar = y.e;
            int water = dashboardResponse.getRecords().getWater();
            Integer water2 = groupData.getWater();
            Intrinsics.e(water2);
            openRecordScreen$default(dashboardFragment, yVar, water, water2.intValue(), false, 8, null);
            return;
        }
        dashboardFragment.getPreferenceData().c();
        GroupData groupData2 = dashboardFragment.getPresenter().h;
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            if (k.q()) {
                int i2 = SubscriptionPlansActivity.U;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                if (groupData2 != null && (daysSinceStarted2 = groupData2.getDaysSinceStarted()) != null) {
                    i = daysSinceStarted2.intValue();
                }
                dashboardFragment.startActivity(cf.d.q(activity, i, groupData2 != null ? groupData2.getId() : null, groupData2));
            } else {
                int i3 = SubscriptionPlansInAppActivity.W;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                dashboardFragment.startActivity(cf.f.q(activity, (groupData2 == null || (daysSinceStarted = groupData2.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData2 != null ? groupData2.getId() : null, false, 16));
            }
        }
        fs.d.F(dashboardFragment, dashboardFragment.getPreferenceData(), true);
    }

    public static final void setChallengeStarted$lambda$73$lambda$72(DashboardFragment dashboardFragment, GroupData groupData, DashboardResponse dashboardResponse, View view) {
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        Intrinsics.checkNotNullParameter(groupData, "$selectedGroup");
        Intrinsics.checkNotNullParameter(dashboardResponse, "$dashboardResponse");
        if (i0.h(dashboardFragment.getPresenter(), dashboardFragment.getPresenter().h) || zf.d.b || dashboardFragment.getPresenter().i(groupData)) {
            y yVar = y.i;
            int steps = dashboardResponse.getRecords().getSteps();
            Integer steps2 = groupData.getSteps();
            Intrinsics.e(steps2);
            openRecordScreen$default(dashboardFragment, yVar, steps, steps2.intValue(), false, 8, null);
            return;
        }
        dashboardFragment.getPreferenceData().c();
        GroupData groupData2 = dashboardFragment.getPresenter().h;
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            int i = 0;
            if (k.q()) {
                int i2 = SubscriptionPlansActivity.U;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                if (groupData2 != null && (daysSinceStarted2 = groupData2.getDaysSinceStarted()) != null) {
                    i = daysSinceStarted2.intValue();
                }
                dashboardFragment.startActivity(cf.d.q(activity, i, groupData2 != null ? groupData2.getId() : null, groupData2));
            } else {
                int i3 = SubscriptionPlansInAppActivity.W;
                Intrinsics.checkNotNullExpressionValue(activity, "context");
                dashboardFragment.startActivity(cf.f.q(activity, (groupData2 == null || (daysSinceStarted = groupData2.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData2 != null ? groupData2.getId() : null, false, 16));
            }
        }
        fs.d.F(dashboardFragment, dashboardFragment.getPreferenceData(), true);
    }

    private final void setEmptyImageDirectionLayout() {
        n9.b bVar;
        ImageView imageView;
        ViewGroup.LayoutParams layoutParams;
        r0 r0Var = this.binding;
        if (r0Var == null || (bVar = r0Var.k) == null || (imageView = bVar.b) == null || (layoutParams = imageView.getLayoutParams()) == null) {
            return;
        }
        layoutParams.resolveLayoutDirection(0);
    }

    private final void setFloorsBadge(int i) {
        r0 r0Var = this.binding;
        if (r0Var != null) {
            ConstraintLayout constraintLayout = r0Var.h;
            if (i <= 0) {
                Intrinsics.checkNotNullExpressionValue(constraintLayout, "clFloorsMedals");
                fs.d.t(constraintLayout);
            } else {
                Intrinsics.checkNotNullExpressionValue(constraintLayout, "clFloorsMedals");
                fs.d.x(constraintLayout);
                r0Var.T.setText(String.valueOf(i));
            }
        }
    }

    public final void setGraphPager(boolean z) {
        ViewPager2 viewPager2;
        TabLayout tabLayout;
        ViewPager2 viewPager22;
        r0 r0Var = this.binding;
        if (r0Var != null && (viewPager22 = r0Var.p0) != null) {
            viewPager22.setOffscreenPageLimit(1);
            b bVar = new b(new me.h(this, 9));
            this.mGraphAdapter = bVar;
            viewPager22.setAdapter(bVar);
        }
        if (z) {
            viewPagerTransformation();
        }
        r0 r0Var2 = this.binding;
        if (r0Var2 != null && (viewPager2 = r0Var2.p0) != null && (tabLayout = r0Var2.x) != null) {
            new wj.o(tabLayout, viewPager2, new l0(16)).a();
        }
        et.a d2 = et.d.d("codeVerification");
        GroupData groupData = getPresenter().h;
        d2.c(a0.g0.j("codeChecking is the ", groupData != null ? groupData.getName() : null), new Object[0]);
        b bVar2 = this.mGraphAdapter;
        if (bVar2 != null) {
            GroupData groupData2 = getPresenter().h;
            Integer steps = groupData2 != null ? groupData2.getSteps() : null;
            DashboardResponse dashboardResponse = this.dashboardResponse;
            boolean isSetChartValue = isSetChartValue();
            bVar2.j = this.mAlphaValue;
            bVar2.f = steps;
            bVar2.g = dashboardResponse;
            bVar2.h = isSetChartValue;
            bVar2.notifyDataSetChanged();
        }
    }

    public static void setGraphPager$default(DashboardFragment dashboardFragment, boolean z, int i, Object obj) {
        if ((i & 1) != 0) {
            z = true;
        }
        dashboardFragment.setGraphPager(z);
    }

    public static final void setGraphPager$lambda$28$lambda$27$lambda$26(wj.g gVar, int i) {
        et.d.a(a0.g0.f("checkViewPager initViewPager: ", i), new Object[0]);
    }

    public final void setLockTitle() {
        String e3 = u7.e.e("main_pro_title_after_trial", "getInstance().getString(titleForLockedState)");
        r0 r0Var = this.binding;
        MaterialTextView materialTextView = r0Var != null ? r0Var.n0 : null;
        if (materialTextView != null) {
            materialTextView.setText(e3);
        }
        String e4 = u7.e.e("main_pro_button_color_code", "getInstance().getString(colorCode)");
        if (e4.length() > 0) {
            r0 r0Var2 = this.binding;
            ConstraintLayout constraintLayout = r0Var2 != null ? r0Var2.l0 : null;
            if (constraintLayout == null) {
                return;
            }
            constraintLayout.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#".concat(e4))));
        }
    }

    private final void setNoGroupView() {
        r0 r0Var = this.binding;
        if (r0Var != null) {
            n9.b bVar = r0Var.k;
            MaterialTextView materialTextView = bVar.h;
            Intrinsics.checkNotNullExpressionValue(materialTextView, "clNoGroups.tvSubtitle");
            materialTextView.setVisibility(8);
            e0 activity = getActivity();
            if (activity != null) {
                MaterialTextView materialTextView2 = bVar.i;
                Intrinsics.checkNotNullExpressionValue(materialTextView2, "clNoGroups.tvTitle");
                fs.d.E(materialTextView2, new int[]{activity.getColor(2131099813), activity.getColor(2131099813), activity.getColor(2131099813)});
            }
            bVar.d.setOnClickListener(new me.a(this, 8));
        }
    }

    public static final void setNoGroupView$lambda$24$lambda$23(DashboardFragment dashboardFragment, View view) {
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        dashboardFragment.getPreferenceData().r("from_challenge", false);
        BetterTogetherApp betterTogetherApp = BetterTogetherApp.f198d;
        u7.e.l(FirebaseAnalytics.getInstance(s6.s.j()), "create_challenge_clicked_on_home");
        s6.s sVar = CreateGroupActivity.y;
        Context requireContext = dashboardFragment.requireContext();
        Intrinsics.checkNotNullExpressionValue(requireContext, YzboWgFC.IpGeaQA);
        dashboardFragment.startActivity(sVar.n(requireContext));
    }

    private final void setNoWeightRecorded(GroupData groupData) {
        Integer weightDay = groupData.getWeightDay();
        Intrinsics.e(weightDay);
        if (g3.g.A(weightDay.intValue())) {
            r0 r0Var = this.binding;
            MaterialTextView materialTextView = r0Var != null ? r0Var.i0 : null;
            if (materialTextView != null) {
                materialTextView.setText(getWeekTargetFormattedText(getString(2131952561), getString(2131951898)));
            }
        } else {
            Integer currentWeek = groupData.getCurrentWeek();
            Intrinsics.e(currentWeek);
            int intValue = currentWeek.intValue();
            Integer duration = groupData.getDuration();
            Intrinsics.e(duration);
            if (intValue < duration.intValue()) {
                r0 r0Var2 = this.binding;
                MaterialTextView materialTextView2 = r0Var2 != null ? r0Var2.i0 : null;
                if (materialTextView2 != null) {
                    materialTextView2.setText(getWeekTargetFormattedText$default(this, getString(2131952332), null, 2, null));
                }
            } else {
                r0 r0Var3 = this.binding;
                MaterialTextView materialTextView3 = r0Var3 != null ? r0Var3.i0 : null;
                if (materialTextView3 != null) {
                    materialTextView3.setText(getWeekTargetFormattedText$default(this, getString(2131952332), null, 2, null));
                }
            }
        }
        r0 r0Var4 = this.binding;
        if (r0Var4 != null) {
            RaySpeedometer raySpeedometer = r0Var4.G;
            raySpeedometer.m(0.0f, 1.0f);
            raySpeedometer.n(0L, 0.0f);
            r0Var4.R.setText(2131952337);
            MaterialTextView materialTextView4 = r0Var4.X;
            Intrinsics.checkNotNullExpressionValue(materialTextView4, "tvInitialWeight");
            fs.d.t(materialTextView4);
            MaterialTextView materialTextView5 = r0Var4.S;
            Intrinsics.checkNotNullExpressionValue(materialTextView5, "tvFinalWeight");
            fs.d.t(materialTextView5);
        }
        setTotalProgressGraph();
    }

    private final void setStepsBadge(int i) {
        r0 r0Var = this.binding;
        if (r0Var != null) {
            ConstraintLayout constraintLayout = r0Var.m;
            if (i <= 0) {
                Intrinsics.checkNotNullExpressionValue(constraintLayout, "clStepsMedals");
                fs.d.t(constraintLayout);
            } else {
                Intrinsics.checkNotNullExpressionValue(constraintLayout, "clStepsMedals");
                fs.d.x(constraintLayout);
                r0Var.a0.setText(String.valueOf(i));
            }
        }
    }

    private final void setTotalProgressGraph() {
        b bVar;
        if (this.binding == null || (bVar = this.mGraphAdapter) == null) {
            return;
        }
        bVar.a(this.mAlphaValue, false);
    }

    public final void setUnlockTitle() {
        String e3 = u7.e.e("main_pro_title_trial", "getInstance().getString(title)");
        r0 r0Var = this.binding;
        MaterialTextView materialTextView = r0Var != null ? r0Var.n0 : null;
        if (materialTextView != null) {
            materialTextView.setText(e3);
        }
        String e4 = u7.e.e("main_pro_button_color_code", "getInstance().getString(colorCode)");
        if (e4.length() > 0) {
            r0 r0Var2 = this.binding;
            ConstraintLayout constraintLayout = r0Var2 != null ? r0Var2.l0 : null;
            if (constraintLayout == null) {
                return;
            }
            constraintLayout.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#".concat(e4))));
        }
    }

    private final void setUpBillingManager() {
        if (getPreferenceData().c() || zf.d.b) {
            et.d.c(og.m.i("BusinessUser UserSubscribed: ", getPreferenceData().c()), new Object[0]);
            et.d.d("isSubscribedUser").c(og.m.i("This User is Subscribed from Dashboard  setUpBillingManager ", zf.d.b), new Object[0]);
            zf.d.b = true;
            tf.o oVar = tf.o.e;
            Intrinsics.checkNotNullParameter(oVar, "<set-?>");
            zf.d.a = oVar;
            hidShowAdView(zf.d.b);
            return;
        }
        et.d.c("BusinessUser UserSubscribed: " + getPreferenceData().c() + " Not Subscribed", new Object[0]);
        zf.d.b = false;
        tf.o oVar2 = tf.o.d;
        Intrinsics.checkNotNullParameter(oVar2, "<set-?>");
        zf.d.a = oVar2;
        hidShowAdView(zf.d.b);
        checkFromPlayStore();
    }

    private final void setUpStoryly() {
        try {
            et.a d2 = et.d.d("StoryLyIssues");
            boolean z = this.mStoryly == null;
            r0 r0Var = this.binding;
            StorylyView storylyView = r0Var != null ? r0Var.N : null;
            d2.c("binding is " + z + " " + storylyView + " " + getPresenter().h + "  " + getPresenter().j, new Object[0]);
            r0 r0Var2 = this.binding;
            StorylyView storylyView2 = r0Var2 != null ? r0Var2.N : null;
            if (storylyView2 == null) {
                this.binding = r0.a(getLayoutInflater(), (ViewGroup) null);
            }
            if (storylyView2 == null || this.mStoryly == null) {
                return;
            }
            sf.c.b(storylyView2, getPresenter().h, getPresenter().j);
        } catch (Exception e3) {
            e3.printStackTrace();
        }
    }

    private final synchronized void setViewsForProUser(boolean z) {
        fs.d.p(this, new e0.a(1, this, z));
    }

    public static void setViewsForProUser$default(DashboardFragment dashboardFragment, boolean z, int i, Object obj) {
        if ((i & 1) != 0) {
            z = true;
        }
        dashboardFragment.setViewsForProUser(z);
    }

    private final void setWaterBadge(int i) {
        r0 r0Var = this.binding;
        if (r0Var != null) {
            ConstraintLayout constraintLayout = r0Var.q;
            if (i <= 0) {
                Intrinsics.checkNotNullExpressionValue(constraintLayout, "clWaterMedals");
                fs.d.t(constraintLayout);
            } else {
                Intrinsics.checkNotNullExpressionValue(constraintLayout, "clWaterMedals");
                fs.d.x(constraintLayout);
                r0Var.f0.setText(String.valueOf(i));
            }
        }
    }

    private final void setWeightBadge(int i) {
        r0 r0Var = this.binding;
        if (r0Var != null) {
            RelativeLayout relativeLayout = r0Var.K;
            if (i <= 0) {
                Intrinsics.checkNotNullExpressionValue(relativeLayout, "rlWeight");
                fs.d.t(relativeLayout);
                return;
            }
            Intrinsics.checkNotNullExpressionValue(relativeLayout, "rlWeight");
            fs.d.x(relativeLayout);
            MaterialTextView materialTextView = r0Var.j0;
            Intrinsics.checkNotNullExpressionValue(materialTextView, "setWeightBadge$lambda$88$lambda$87");
            fs.d.x(materialTextView);
            materialTextView.setText(String.valueOf(i));
        }
    }

    private final void setWeightRecorded(GroupData groupData, DashboardResponse dashboardResponse, String str, String str2) {
        Integer goal;
        RaySpeedometer raySpeedometer;
        r0 r0Var = this.binding;
        if (r0Var != null) {
            MaterialTextView materialTextView = r0Var.X;
            Intrinsics.checkNotNullExpressionValue(materialTextView, "tvInitialWeight");
            fs.d.x(materialTextView);
            MaterialTextView materialTextView2 = r0Var.S;
            Intrinsics.checkNotNullExpressionValue(materialTextView2, zQugKAAxaKyBz.nACdkxgz);
            fs.d.x(materialTextView2);
            Integer timeLeft = groupData.getTimeLeft();
            Intrinsics.e(timeLeft);
            int intValue = timeLeft.intValue();
            Log.d("TargetWeight", "dashboardResponse: " + dashboardResponse.getWeightInfo().getTarget());
            if (intValue > 0) {
                int x = (int) ((GraphValues) CollectionsKt.I(dashboardResponse.getGraph().getValues())).getX();
                Integer duration = groupData.getDuration();
                if (duration != null && x == duration.intValue()) {
                    setChallengeResults$default(this, str2, dashboardResponse, null, 4, null);
                    goal = groupData.getGoal();
                    raySpeedometer = r0Var.G;
                    if (goal != null && goal.intValue() == 0) {
                        raySpeedometer.m(dashboardResponse.getWeightInfo().getInitial(), dashboardResponse.getWeightInfo().getInitial() * 1.1f);
                        raySpeedometer.n(0L, dashboardResponse.getWeightInfo().getInitial() * 1.1f);
                        raySpeedometer.n(2000L, dashboardResponse.getWeightInfo().getCurrent());
                        DecimalFormat decimalFormat = zf.f.a;
                        Context requireContext = requireContext();
                        Intrinsics.checkNotNullExpressionValue(requireContext, "requireContext()");
                        materialTextView.setText(zf.f.e(requireContext, dashboardResponse.getWeightInfo().getInitial() * 1.1f, str, false));
                        Context requireContext2 = requireContext();
                        Intrinsics.checkNotNullExpressionValue(requireContext2, "requireContext()");
                        materialTextView2.setText(zf.f.e(requireContext2, dashboardResponse.getWeightInfo().getInitial(), str, false));
                    } else {
                        raySpeedometer.m(dashboardResponse.getWeightInfo().getFinal(), dashboardResponse.getWeightInfo().getInitial());
                        raySpeedometer.n(0L, dashboardResponse.getWeightInfo().getInitial());
                        raySpeedometer.n(2000L, dashboardResponse.getWeightInfo().getCurrent());
                        DecimalFormat decimalFormat2 = zf.f.a;
                        Context requireContext3 = requireContext();
                        Intrinsics.checkNotNullExpressionValue(requireContext3, "requireContext()");
                        materialTextView.setText(zf.f.e(requireContext3, dashboardResponse.getWeightInfo().getInitial(), str, false));
                        Context requireContext4 = requireContext();
                        Intrinsics.checkNotNullExpressionValue(requireContext4, "requireContext()");
                        materialTextView2.setText(zf.f.e(requireContext4, dashboardResponse.getWeightInfo().getFinal(), str, false));
                    }
                    Context requireContext5 = requireContext();
                    Intrinsics.checkNotNullExpressionValue(requireContext5, "requireContext()");
                    r0Var.R.setText(zf.f.e(requireContext5, dashboardResponse.getWeightInfo().getCurrent(), str, false));
                }
            }
            MaterialTextView materialTextView3 = r0Var.i0;
            if (intValue > 0) {
                materialTextView3.setText(getWeekTargetFormattedText(getString(2131952561), getWeekTarget(groupData, dashboardResponse, str)));
            } else {
                if (intValue <= 0) {
                    int x2 = (int) ((GraphValues) CollectionsKt.I(dashboardResponse.getGraph().getValues())).getX();
                    Integer currentWeek = groupData.getCurrentWeek();
                    if (currentWeek == null || x2 != currentWeek.intValue()) {
                        materialTextView3.setText(getWeekTargetFormattedText(getString(2131952561), getWeekTarget(groupData, dashboardResponse, str)));
                    }
                }
                int x3 = (int) ((GraphValues) CollectionsKt.I(dashboardResponse.getGraph().getValues())).getX();
                Integer duration2 = groupData.getDuration();
                if (duration2 != null && x3 == duration2.intValue()) {
                    setChallengeResults$default(this, str2, dashboardResponse, null, 4, null);
                } else {
                    materialTextView3.setText(getWeekTargetFormattedText(getString(2131952561), getWeekTarget(groupData, dashboardResponse, str)));
                }
            }
            goal = groupData.getGoal();
            raySpeedometer = r0Var.G;
            if (goal != null) {
                raySpeedometer.m(dashboardResponse.getWeightInfo().getInitial(), dashboardResponse.getWeightInfo().getInitial() * 1.1f);
                raySpeedometer.n(0L, dashboardResponse.getWeightInfo().getInitial() * 1.1f);
                raySpeedometer.n(2000L, dashboardResponse.getWeightInfo().getCurrent());
                DecimalFormat decimalFormat3 = zf.f.a;
                Context requireContext6 = requireContext();
                Intrinsics.checkNotNullExpressionValue(requireContext6, "requireContext()");
                materialTextView.setText(zf.f.e(requireContext6, dashboardResponse.getWeightInfo().getInitial() * 1.1f, str, false));
                Context requireContext22 = requireContext();
                Intrinsics.checkNotNullExpressionValue(requireContext22, "requireContext()");
                materialTextView2.setText(zf.f.e(requireContext22, dashboardResponse.getWeightInfo().getInitial(), str, false));
                Context requireContext52 = requireContext();
                Intrinsics.checkNotNullExpressionValue(requireContext52, "requireContext()");
                r0Var.R.setText(zf.f.e(requireContext52, dashboardResponse.getWeightInfo().getCurrent(), str, false));
            }
            raySpeedometer.m(dashboardResponse.getWeightInfo().getFinal(), dashboardResponse.getWeightInfo().getInitial());
            raySpeedometer.n(0L, dashboardResponse.getWeightInfo().getInitial());
            raySpeedometer.n(2000L, dashboardResponse.getWeightInfo().getCurrent());
            DecimalFormat decimalFormat22 = zf.f.a;
            Context requireContext32 = requireContext();
            Intrinsics.checkNotNullExpressionValue(requireContext32, "requireContext()");
            materialTextView.setText(zf.f.e(requireContext32, dashboardResponse.getWeightInfo().getInitial(), str, false));
            Context requireContext42 = requireContext();
            Intrinsics.checkNotNullExpressionValue(requireContext42, "requireContext()");
            materialTextView2.setText(zf.f.e(requireContext42, dashboardResponse.getWeightInfo().getFinal(), str, false));
            Context requireContext522 = requireContext();
            Intrinsics.checkNotNullExpressionValue(requireContext522, "requireContext()");
            r0Var.R.setText(zf.f.e(requireContext522, dashboardResponse.getWeightInfo().getCurrent(), str, false));
        }
    }

    private final void setupAppVersion() {
        o k2;
        MenuItem findItem;
        o oVar = this.dashboardMenuBuilder;
        if (oVar == null || (k2 = oVar.k()) == null || (findItem = k2.findItem(2131362529)) == null) {
            return;
        }
        findItem.setEnabled(false);
        String string = getString(2131951689);
        Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.app_version)");
        String format = String.format(string, Arrays.copyOf(new Object[]{"21.1.0"}, 1));
        Intrinsics.checkNotNullExpressionValue(format, "format(...)");
        findItem.setTitle(format);
    }

    public static final void shareApp$lambda$41(Function1 function1, Object obj) {
        Intrinsics.checkNotNullParameter(function1, "$tmp0");
        function1.invoke(obj);
    }

    public static final void shareApp$lambda$42(DashboardFragment dashboardFragment, Exception exc) {
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        Intrinsics.checkNotNullParameter(exc, "it");
        dashboardFragment.hideLoadingDialog();
        Toast.makeText(dashboardFragment.getContext(), "Please try again", 0).show();
    }

    public static final void showEnrolledGroups$lambda$63$lambda$60$lambda$59(View view) {
    }

    public static final void showEnrolledGroups$lambda$63$lambda$62$lambda$61(DashboardFragment dashboardFragment, View view) {
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        dashboardFragment.openEnrolledGroupsDialog();
    }

    public final void showPopup() {
        int i;
        ?? g;
        int i2;
        boolean z;
        Integer daysSinceStarted;
        Integer daysSinceStarted2;
        Integer every14Days;
        Integer twentyOneDays;
        Integer twentyOneDays2;
        Integer fourteenDaysAfter;
        Integer fourteenDaysAfter2;
        Integer sevenDaysAfter;
        Integer daysSinceStarted3;
        int i3 = 0;
        et.d.c("Adapty Paywall: showPopup called selectedgroup " + getPresenter().h, new Object[0]);
        if (getPresenter().h == null) {
            return;
        }
        fs.d.F((androidx.fragment.app.b0) this, getPreferenceData(), false);
        GroupData groupData = getPresenter().h;
        int intValue = (groupData == null || (daysSinceStarted3 = groupData.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted3.intValue();
        GroupData groupData2 = getPresenter().h;
        Integer id = groupData2 != null ? groupData2.getId() : null;
        et.d.c("SubscriptionPopupDisplay:showTopText: " + intValue + " " + id, new Object[0]);
        if (i0.h(getPresenter(), getPresenter().h) || zf.d.b || getPreferenceData().c()) {
            fs.d.F((androidx.fragment.app.b0) this, getPreferenceData(), true);
            return;
        }
        et.d.c(a0.g0.f("SubscriptionPopupDisplay:showTopText: Inner: ", intValue), new Object[0]);
        if (id != null) {
            int intValue2 = id.intValue();
            PreferenceData preferenceData = getPreferenceData();
            Intrinsics.checkNotNullParameter(preferenceData, "preferenceData");
            int i4 = intValue2 % 10;
            String e3 = u7.e.e("Group_digit", "getInstance().getString(GROUP_DIGITS)");
            int f = (int) cn.b.e().f("Paywall_times");
            if (f == 1) {
                i = 2;
            } else {
                i = 3;
                if (f != 2) {
                    i = f == 3 ? 4 : 1;
                }
            }
            if (e3.length() > 0) {
                List O = kotlin.text.y.O(e3, new String[]{"-"}, 0, 6);
                g = new ArrayList(f0.k(O, 10));
                Iterator it = O.iterator();
                while (it.hasNext()) {
                    g.add(Integer.valueOf(Integer.parseInt((String) it.next())));
                }
            } else {
                g = kotlin.collections.e0.g(new Integer[]{0, 0});
            }
            int intValue3 = ((Number) g.get(0)).intValue();
            int intValue4 = ((Number) g.get(1)).intValue();
            et.d.a("SubscriptionPopupDisplay : lastDigit: " + i4 + " groupDigit:" + e3 + " groupId:" + intValue2, new Object[0]);
            if (intValue3 <= i4 && i4 <= intValue4) {
                et.d.a("SubscriptionPopupDisplay : frequency : ".concat(u7.e.p(i)), new Object[0]);
                i2 = v.j.e(i);
            } else {
                et.d.a("SubscriptionPopupDisplay : weekly frequency : ".concat(u7.e.p(1)), new Object[0]);
                i2 = 0;
            }
            if (i2 == 0) {
                SubscriptionReminderConfig o = com.bumptech.glide.e.o(Integer.valueOf(intValue2));
                if (intValue >= ((o == null || (sevenDaysAfter = o.getSevenDaysAfter()) == null) ? 7 : sevenDaysAfter.intValue())) {
                    if (intValue < ((o == null || (fourteenDaysAfter2 = o.getFourteenDaysAfter()) == null) ? 14 : fourteenDaysAfter2.intValue())) {
                        String f2 = a0.g0.f("sub_pop_shown_7_", intValue2);
                        if (!preferenceData.g(f2)) {
                            Intrinsics.checkNotNullParameter(f2, "key");
                            preferenceData.r(f2, true);
                            String L = com.bumptech.glide.e.L(intValue2);
                            Intrinsics.checkNotNullParameter(L, "key");
                            preferenceData.r(L, true);
                            z = true;
                        }
                        z = false;
                    }
                }
                int i5 = 21;
                if (intValue >= ((o == null || (fourteenDaysAfter = o.getFourteenDaysAfter()) == null) ? 14 : fourteenDaysAfter.intValue())) {
                    if (intValue < ((o == null || (twentyOneDays2 = o.getTwentyOneDays()) == null) ? 21 : twentyOneDays2.intValue())) {
                        String f5 = a0.g0.f("sub_pop_shown_14_", intValue2);
                        if (!preferenceData.g(f5)) {
                            Intrinsics.checkNotNullParameter(f5, "key");
                            preferenceData.r(f5, true);
                            String L2 = com.bumptech.glide.e.L(intValue2);
                            Intrinsics.checkNotNullParameter(L2, "key");
                            preferenceData.r(L2, true);
                            z = true;
                        }
                        z = false;
                    }
                }
                if (o != null && (twentyOneDays = o.getTwentyOneDays()) != null) {
                    i5 = twentyOneDays.intValue();
                }
                if (i5 <= intValue && intValue < 26) {
                    String f7 = a0.g0.f("sub_pop_shown_21_", intValue2);
                    if (!preferenceData.g(f7)) {
                        Intrinsics.checkNotNullParameter(f7, "key");
                        preferenceData.r(f7, true);
                        String L3 = com.bumptech.glide.e.L(intValue2);
                        Intrinsics.checkNotNullParameter(L3, "key");
                        preferenceData.r(L3, true);
                        z = true;
                    }
                    z = false;
                } else {
                    if (intValue > 25) {
                        int i6 = intValue - 21;
                        int intValue5 = i6 % ((o == null || (every14Days = o.getEvery14Days()) == null) ? 14 : every14Days.intValue());
                        DateFormat dateFormat = zf.a.a;
                        String f9 = zf.a.f(new Date().getTime());
                        StringBuilder o2 = a0.g0.o("GroupDay: rem: ", intValue5, " ", i6, " TodayDate: ");
                        o2.append(f9);
                        et.d.c(o2.toString(), new Object[0]);
                        String str = "sub_pop_shown_every_14_day_" + intValue2 + f9;
                        if (intValue5 == 0 && !preferenceData.g(str)) {
                            Intrinsics.checkNotNullParameter(str, "key");
                            preferenceData.r(str, true);
                            String L4 = com.bumptech.glide.e.L(intValue2);
                            Intrinsics.checkNotNullParameter(L4, "key");
                            preferenceData.r(L4, true);
                            z = true;
                        }
                    }
                    z = false;
                }
            } else {
                String L5 = com.bumptech.glide.e.L(intValue2);
                et.d.c("checkPopup: " + L5 + " day:" + intValue, new Object[0]);
                int i7 = intValue % i2;
                if (intValue > 1 && i7 == 0 && !preferenceData.g(L5)) {
                    Intrinsics.checkNotNullParameter(L5, "key");
                    preferenceData.r(L5, true);
                    et.d.c("checkPopup: setPopup called", new Object[0]);
                    z = true;
                }
                z = false;
            }
            if (!z) {
                fs.d.F((androidx.fragment.app.b0) this, getPreferenceData(), true);
                return;
            }
            et.d.c("SubscriptionPopupDisplay: subscription screen shown", new Object[0]);
            if (7 <= intValue && intValue < 14) {
                GroupData groupData3 = getPresenter().h;
                Intrinsics.e(groupData3);
                navigateToTrialEndReminderScreen(groupData3);
                return;
            }
            getPreferenceData().c();
            GroupData groupData4 = getPresenter().h;
            e0 activity = getActivity();
            if (activity != null) {
                if (k.q()) {
                    int i9 = SubscriptionPlansActivity.U;
                    Intrinsics.checkNotNullExpressionValue(activity, "context");
                    if (groupData4 != null && (daysSinceStarted2 = groupData4.getDaysSinceStarted()) != null) {
                        i3 = daysSinceStarted2.intValue();
                    }
                    startActivity(cf.d.q(activity, i3, groupData4 != null ? groupData4.getId() : null, groupData4));
                } else {
                    int i10 = SubscriptionPlansInAppActivity.W;
                    Intrinsics.checkNotNullExpressionValue(activity, "context");
                    startActivity(cf.f.q(activity, (groupData4 == null || (daysSinceStarted = groupData4.getDaysSinceStarted()) == null) ? 0 : daysSinceStarted.intValue(), groupData4 != null ? groupData4.getId() : null, false, 16));
                }
            }
            fs.d.F((androidx.fragment.app.b0) this, getPreferenceData(), true);
        }
    }

    public static final void showWeightRecordButton$lambda$86$lambda$85$lambda$84(DashboardFragment dashboardFragment, int i, float f, float f2, String str, String str2, Integer num, boolean z, View view) {
        Intrinsics.checkNotNullParameter(dashboardFragment, "this$0");
        Intrinsics.checkNotNullParameter(str, "$measureType");
        e0 activity = dashboardFragment.getActivity();
        if (activity != null) {
            Intrinsics.checkNotNullParameter(activity, "context");
            Intrinsics.checkNotNullParameter(str, "measureType");
            if (!z) {
                dp.l.k(activity, new dd.l(f, f2, i, activity, num, str, str2, z));
            } else {
                int i2 = WeightRecordActivity.O;
                activity.startActivityForResult(cf.f.k(activity, i, str, f, f2, str2, num, z), 1450);
            }
        }
    }

    private final void startAnimations(Records records, GroupData groupData) {
        r0 r0Var = this.binding;
        if (r0Var != null) {
            Integer intOrNull = u.toIntOrNull(r0Var.V.getText().toString());
            int intValue = intOrNull != null ? intOrNull.intValue() : 0;
            float floors = records.getFloors();
            Intrinsics.e(groupData.getFloors());
            float intValue2 = floors / r4.intValue();
            if (intValue != records.getFloors()) {
                me.n nVar = new me.n(r0Var, intValue2, 0);
                this.floorsTimer = nVar;
                nVar.start();
            } else {
                r0Var.s.setProgress(intValue2);
            }
            Integer intOrNull2 = u.toIntOrNull(r0Var.h0.getText().toString());
            int intValue3 = intOrNull2 != null ? intOrNull2.intValue() : 0;
            float water = records.getWater();
            Intrinsics.e(groupData.getWater());
            float intValue4 = water / r4.intValue();
            if (intValue3 != records.getWater()) {
                me.n nVar2 = new me.n(r0Var, intValue4, 1);
                this.waterTimer = nVar2;
                nVar2.start();
            } else {
                r0Var.u.setProgress(intValue4);
            }
            Integer intOrNull3 = u.toIntOrNull(r0Var.c0.getText().toString());
            int intValue5 = intOrNull3 != null ? intOrNull3.intValue() : 0;
            float steps = records.getSteps();
            Intrinsics.e(groupData.getSteps());
            float intValue6 = steps / r7.intValue();
            if (intValue5 == records.getSteps()) {
                r0Var.t.setProgress(intValue6);
                return;
            }
            me.n nVar3 = new me.n(r0Var, intValue6, 2);
            this.stepsTimer = nVar3;
            nVar3.start();
        }
    }

    private final void syncUserRecordedData(boolean z, boolean z2) {
        et.d.c("OneSignal syncUserRecordedData: called", new Object[0]);
        notifyGraphAdapter();
        hidShowAdView(zf.d.b);
        MainActivity activity = getActivity();
        MainActivity mainActivity = activity instanceof MainActivity ? activity : null;
        if (mainActivity != null) {
            boolean hasFitbitConnected = mainActivity.hasFitbitConnected();
            boolean hasGoogleFitConnected = hasGoogleFitConnected();
            boolean e3 = getPreferenceData().e();
            boolean a = getPresenter().e.a();
            r0 r0Var = this.binding;
            ConstraintLayout constraintLayout = r0Var != null ? r0Var.P : null;
            if (constraintLayout != null) {
                constraintLayout.setVisibility(8);
            }
            refreshSelectedGroup(z, z2);
            et.d.c("syncUserRecordedData: isConnected: " + hasFitbitConnected + " " + hasGoogleFitConnected + getPresenter().n().size(), new Object[0]);
            if (hasFitbitConnected) {
                if (!getPresenter().j() || zf.d.b) {
                    et.d.c("FitbitSync: syncWithFitbit", new Object[0]);
                    i0 presenter = getPresenter();
                    et.d.d(presenter.f).a("syncWithFitbit", new Object[0]);
                    boolean v2 = presenter.v();
                    j0 j0Var = ((ad.a) presenter).a;
                    if (v2) {
                        GroupData groupData = presenter.h;
                        r3 = groupData != null ? groupData.getId() : null;
                        boolean b = s6.s.l().b(id.n.d);
                        boolean b4 = s6.s.l().b(id.n.e);
                        et.d.c("FitbitSync: hasAccessToReadDailyActivity: " + b + " hasAccessToReadNutrition: " + b4 + " groupId: " + r3, new Object[0]);
                        if (!b && !b4) {
                            j0Var.hideLoadingDialog();
                        } else if (r3 != null) {
                            r3.intValue();
                            ArrayList arrayList = new ArrayList();
                            i iVar = new i(new aq.a(new l0(19), 0), new a9.h(21, new me.g0(presenter, r3, 0)), 0);
                            Intrinsics.checkNotNullExpressionValue(iVar, "fun syncWithFitbit() {\n …posable()\n        }\n    }");
                            i iVar2 = new i(new aq.a(new l0(20), 0), new a9.h(22, new me.g0(presenter, r3, 2)), 0);
                            Intrinsics.checkNotNullExpressionValue(iVar2, "fun syncWithFitbit() {\n …posable()\n        }\n    }");
                            i iVar3 = new i(new aq.a(new l0(21), 0), new a9.h(23, new me.g0(presenter, r3, 1)), 0);
                            Intrinsics.checkNotNullExpressionValue(iVar3, "fun syncWithFitbit() {\n …posable()\n        }\n    }");
                            if (b && b4) {
                                arrayList.add(iVar);
                                arrayList.add(iVar2);
                                arrayList.add(iVar3);
                            } else if (b) {
                                arrayList.add(iVar);
                                arrayList.add(iVar3);
                            } else if (b4) {
                                arrayList.add(iVar2);
                            }
                            if (arrayList.isEmpty()) {
                                et.d.c("FitbitSync: observables empty", new Object[0]);
                                j0Var.hideLoadingDialog();
                            } else {
                                aq.b bVar = new aq.b(3, arrayList, new a9.h(24, me.m.d0));
                                Intrinsics.checkNotNullExpressionValue(bVar, "zip(observables) { return@zip true }");
                                aq.b bVar2 = new aq.b(1, new aq.e(new aq.e(kotlin.jvm.internal.o.D0(kotlin.jvm.internal.o.S0(bVar)), new fe.l(25, new me.w(presenter, 14)), 2), new fe.l(26, me.m.e0), 0), new q(presenter, 3));
                                Intrinsics.checkNotNullExpressionValue(bVar2, "fun syncWithFitbit() {\n …posable()\n        }\n    }");
                                com.bumptech.glide.d.m(presenter, bVar2);
                            }
                        }
                    } else {
                        j0Var.hideLoadingDialog();
                    }
                } else {
                    et.d.c("FitbitSync: else", new Object[0]);
                    hideLoadingDialog();
                }
                readDailyCaloriesLogFromFitbit(new me.e(this, 18));
            } else if (hasGoogleFitConnected && !e3) {
                getGoogleFitData(mainActivity);
            } else if (e3) {
                et.d.d("CheckingIssueWithLiveVersion").c(og.m.i(gudG.exP, e3), new Object[0]);
                getRecordingApiDataForSteps(mainActivity);
            } else if (a) {
                getHealthConnectData(mainActivity);
            }
            r3 = Unit.a;
        }
        if (r3 == null) {
            getPresenter().k(false, true);
        }
    }

    public static void syncUserRecordedData$default(DashboardFragment dashboardFragment, boolean z, boolean z2, int i, Object obj) {
        if ((i & 1) != 0) {
            z = false;
        }
        if ((i & 2) != 0) {
            z2 = false;
        }
        dashboardFragment.syncUserRecordedData(z, z2);
    }

    public final void updateHealthConnectWeight(java.lang.Double r9, android.content.Context r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.updateHealthConnectWeight(java.lang.Double, android.content.Context):void");
    }

    private final void viewPagerTransformation() {
        r0 r0Var = this.binding;
        if (r0Var != null) {
            u7.m pVar = new y9.p(getResources().getDimension(2131166126) + getResources().getDimension(2131166588));
            this.pageTransformer = pVar;
            ViewPager2 viewPager2 = r0Var.p0;
            viewPager2.setPageTransformer(pVar);
            getItemDecorator(0, 2131166125);
            viewPager2.O.g(getItemDecoration());
            ((List) viewPager2.i.b).add(new u7.b(r0Var, this));
        }
    }

    public static final void viewPagerTransformation$lambda$30$lambda$29(float f, View view, float f2) {
        Intrinsics.checkNotNullParameter(view, "page");
        Locale locale = Locale.getDefault();
        Intrinsics.checkNotNullExpressionValue(locale, "getDefault()");
        if (TextUtils.getLayoutDirectionFromLocale(locale) == 1) {
            view.setTranslationX(f * f2);
        } else {
            view.setTranslationX((-f) * f2);
        }
    }

    public void addLogToFile(String str) {
        Intrinsics.checkNotNullParameter(str, "message");
        if (getActivity() != null) {
            MainActivity activity = getActivity();
            Intrinsics.f(activity, "null cannot be cast to non-null type com.bettertogether.screens.main.MainActivity");
            activity.addLogToFile(str);
        }
    }

    public final void checkNotificationPermission() {
        et.d.d("BUG_FIXING").a("Ask for Notification method is called outside the checkNotificationPermission preferenceData.isAutoWeightPopupShown() " + getPreferenceData().o() + " preferenceData.isPaywallShown()  " + getPreferenceData().b("paywall displayed", false) + " ", new Object[0]);
        if (getPreferenceData().o() || getPreferenceData().b("paywall displayed", false)) {
            et.d.d("BUG_FIXING").a("Ask for Notification method is called inside the checkNotificationPermission ", new Object[0]);
            askForNotification();
        }
    }

    public void checkWithPlaystore() {
        checkFromPlayStore();
    }

    public final void dumpDataSet(LocalDataSet localDataSet) {
        Intrinsics.checkNotNullParameter(localDataSet, "dataSet");
        et.d.d("DumpDataSet").e("Unsubscribe failed: readData 5 ", new Object[0]);
        for (LocalDataPoint localDataPoint : localDataSet.getDataPoints()) {
            et.d.c("Data point:", new Object[0]);
            et.d.c(a0.g0.j("\tType: ", localDataPoint.getDataType().getName()), new Object[0]);
            TimeUnit timeUnit = TimeUnit.HOURS;
            et.d.c(u7.e.d("\tStart: ", localDataPoint.getStartTime(timeUnit)), new Object[0]);
            et.d.c(u7.e.d("\tEnd: ", localDataPoint.getEndTime(timeUnit)), new Object[0]);
            for (LocalField localField : localDataPoint.getDataType().getFields()) {
                et.d.c("\tLocalField: " + localField.getName() + " LocalValue: " + localDataPoint.getValue(localField), new Object[0]);
            }
        }
    }

    public String getAnalyticsScreenName() {
        return this.analyticsScreenName;
    }

    public final dg.c getItemDecoration() {
        dg.c cVar = this.itemDecoration;
        if (cVar != null) {
            return cVar;
        }
        Intrinsics.m("itemDecoration");
        throw null;
    }

    public int getLayout() {
        return this.layout;
    }

    public void getPayWall() {
        getPaywallData();
    }

    public void groupOneSignalTags(List<GroupData> list, UserData userData) {
        GroupData groupData = getPresenter().h;
        et.d.c("groupOneSignalTags: latestGroup: " + groupData, new Object[0]);
        List<GroupData> list2 = list;
        if ((list2 == null || list2.isEmpty()) || groupData == null || !isAppInForeground()) {
            return;
        }
        et.d.c("groupOneSignalTags: Sending tags.....", new Object[0]);
        qh.a.i(groupData.getStartDate(), groupData.getName(), userData != null ? Integer.valueOf(userData.getId()) : null, userData != null ? userData.getCreatedAt() : null, userData != null ? userData.getFirstName() : null, userData != null ? userData.getGender() : null, userData != null ? userData.getSource() : null, Boolean.valueOf(getPreferenceData().c() ? false : zf.d.b), getPreferenceData().c());
    }

    public void hideLoadingDialog() {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.hideLoadingDialog():void");
    }

    public void hideWeightRecordButton() {
        FloatingActionButton floatingActionButton;
        r0 r0Var = this.binding;
        if (r0Var == null || (floatingActionButton = r0Var.v) == null) {
            return;
        }
        floatingActionButton.d(true);
    }

    public void initViews() {
        v0 v0Var;
        v0 v0Var2;
        v0 v0Var3;
        v0 v0Var4;
        SwipeRefreshLayout swipeRefreshLayout;
        zf.c cVar;
        v0 v0Var5;
        v0 v0Var6;
        v0 v0Var7;
        v0 v0Var8;
        PreferenceData preferenceData = getPreferenceData();
        preferenceData.getClass();
        Intrinsics.checkNotNullParameter("last_notification_popup_date", "key");
        if (preferenceData.j("last_notification_popup_date") == null) {
            askForNotification();
        }
        getPaywallData();
        setAutoWeightPopup(false);
        fs.d.F(this, getPreferenceData(), false);
        f.O(lh.d.b(m0.b), (kotlin.coroutines.a) null, 0, new me.g(this, (oq.c) null), 3);
        this.mIsInviteDialog = false;
        Locale locale = Locale.getDefault();
        Intrinsics.checkNotNullExpressionValue(locale, "getDefault()");
        if (TextUtils.getLayoutDirectionFromLocale(locale) == 1) {
            r0 r0Var = this.binding;
            View view = (r0Var == null || (v0Var8 = r0Var.b) == null) ? null : v0Var8.t;
            if (view != null) {
                view.setBackground(z2.h.getDrawable(requireContext(), 2131230904));
            }
            r0 r0Var2 = this.binding;
            View view2 = (r0Var2 == null || (v0Var7 = r0Var2.b) == null) ? null : v0Var7.q;
            if (view2 != null) {
                view2.setBackground(z2.h.getDrawable(requireContext(), 2131230904));
            }
            r0 r0Var3 = this.binding;
            View view3 = (r0Var3 == null || (v0Var6 = r0Var3.b) == null) ? null : v0Var6.s;
            if (view3 != null) {
                view3.setBackground(z2.h.getDrawable(requireContext(), 2131230904));
            }
            r0 r0Var4 = this.binding;
            View view4 = (r0Var4 == null || (v0Var5 = r0Var4.b) == null) ? null : v0Var5.r;
            if (view4 != null) {
                view4.setBackground(z2.h.getDrawable(requireContext(), 2131230904));
            }
        } else {
            r0 r0Var5 = this.binding;
            View view5 = (r0Var5 == null || (v0Var4 = r0Var5.b) == null) ? null : v0Var4.t;
            if (view5 != null) {
                view5.setBackground(z2.h.getDrawable(requireContext(), 2131230906));
            }
            r0 r0Var6 = this.binding;
            View view6 = (r0Var6 == null || (v0Var3 = r0Var6.b) == null) ? null : v0Var3.q;
            if (view6 != null) {
                view6.setBackground(z2.h.getDrawable(requireContext(), 2131230906));
            }
            r0 r0Var7 = this.binding;
            View view7 = (r0Var7 == null || (v0Var2 = r0Var7.b) == null) ? null : v0Var2.s;
            if (view7 != null) {
                view7.setBackground(z2.h.getDrawable(requireContext(), 2131230906));
            }
            r0 r0Var8 = this.binding;
            View view8 = (r0Var8 == null || (v0Var = r0Var8.b) == null) ? null : v0Var.r;
            if (view8 != null) {
                view8.setBackground(z2.h.getDrawable(requireContext(), 2131230906));
            }
        }
        r0 r0Var9 = this.binding;
        if (r0Var9 != null) {
            getPresenter().g = 0;
            getProfilePopupSetting();
            setNoGroupView();
            getPreferenceData().r("google_play_subs", false);
            Bundle arguments = getArguments();
            boolean z = arguments != null && arguments.containsKey(OPEN_STORY_NEW_USER);
            zf.c cVar2 = zf.c.CreateGroup;
            if (z) {
                String string = arguments.getString(OPEN_STORY_NEW_USER);
                if (string != null) {
                    int hashCode = string.hashCode();
                    if (hashCode != -126615167) {
                        if (hashCode == 1152076483 && string.equals("CreateGroup")) {
                            cVar = cVar2;
                            this.mOpenStory = cVar;
                        }
                    } else if (string.equals("WeightUpdate")) {
                        cVar = zf.c.f1097e;
                        this.mOpenStory = cVar;
                    }
                }
                cVar = null;
                this.mOpenStory = cVar;
            }
            Intrinsics.e(arguments);
            if (arguments.containsKey(SHOW_WATER_REMINDER) && arguments.getBoolean(SHOW_WATER_REMINDER)) {
                this.showWaterReminder = arguments.getBoolean(SHOW_WATER_REMINDER);
            }
            if (arguments.containsKey(SHOW_JOIN_GROUP) && arguments.getBoolean(SHOW_JOIN_GROUP)) {
                this.mIsInviteDialog = true;
                Intrinsics.checkNotNullParameter(new me.h(this, 0), "onDismiss");
                new te.n().show(requireActivity().getSupportFragmentManager(), "InviteScreenDialog");
            } else if (this.mOpenStory == cVar2) {
                checkPermission();
            }
            try {
                GroupData serializable = arguments.getSerializable(rnaioAkxVmZTT.zyPXh);
                Intrinsics.f(serializable, "null cannot be cast to non-null type com.bettertogether.remote.model.common.GroupData");
                setAttributes(serializable);
            } catch (Exception e3) {
                e3.printStackTrace();
            }
            getPresenter().t(this.groupData);
            setGraphPager$default(this, false, 1, null);
            r0Var9.d.setOnClickListener(new me.a(this, 0));
            r0Var9.c.setOnClickListener(new me.a(this, 1));
            r0Var9.m0.setOnClickListener(new me.a(this, 2));
            r0Var9.j.setOnClickListener(new me.a(this, 3));
            r0Var9.b.d.setOnClickListener(new me.a(this, 4));
            r0Var9.J.setOnClickListener(new me.a(this, 5));
            r0 r0Var10 = this.binding;
            if (r0Var10 != null && (swipeRefreshLayout = r0Var10.M) != null) {
                swipeRefreshLayout.setOnRefreshListener(this);
            }
            b bVar = this.mGraphAdapter;
            if (bVar != null) {
                bVar.a(this.mAlphaValue, true);
            }
            r0Var9.H.setOnClickListener(new me.a(this, 6));
            setViewsForProUser$default(this, false, 1, null);
            setUpBillingManager();
            if (getPreferenceData().m() != 0) {
                String valueOf = String.valueOf(getPreferenceData().m());
                Intrinsics.checkNotNullParameter(valueOf, "userId");
                BetterTogetherApp betterTogetherApp = BetterTogetherApp.f198d;
                FirebaseAnalytics.getInstance(s6.s.j()).a.zzN(valueOf);
            }
        }
    }

    public void moveToGroupDetail(GroupData groupData) {
        Intrinsics.checkNotNullParameter(groupData, "group");
        e0 activity = getActivity();
        if (activity != null) {
            t tVar = GroupDetailsActivity.Y;
            startActivity(t.j(activity, groupData, false, (String) null));
        }
    }

    public void navigateToLoginScreen() {
        e0 activity = getActivity();
        if (activity != null) {
            rh.k.b(activity);
            startActivity(LoginActivity.y.p(activity, true));
        }
    }

    public void onDestroy() {
        cancelCountDownTimers();
        user = null;
        group = null;
        super/*androidx.fragment.app.b0*/.onDestroy();
    }

    public void onPause() {
        cancelCountDownTimers();
        super/*androidx.fragment.app.b0*/.onPause();
    }

    public void onRefresh() {
        getPresenter().g = 0;
        syncUserRecordedData$default(this, true, false, 2, null);
        sf.c cVar = this.mStoryly;
        et.d.a("storylySetupLogger : bit val is " + (cVar != null ? Boolean.valueOf(cVar.b) : null), new Object[0]);
        sf.c cVar2 = this.mStoryly;
        if ((cVar2 == null || cVar2.b) ? false : true) {
            et.d.a("storylySetupLogger : storyly set up while refresh action occurs", new Object[0]);
            initStoryly();
        }
        user = null;
        group = null;
        setUpStoryly();
    }

    public void onResume() {
        super/*androidx.fragment.app.b0*/.onResume();
        syncUserRecordedData$default(this, false, true, 1, null);
        et.d.d("birthDate").c("the beikgnlndlg of user is 1  " + getPresenter().j, new Object[0]);
        i0 presenter = getPresenter();
        TimeZoneData timeZoneData = new TimeZoneData(TimeZone.getDefault().getID());
        presenter.getClass();
        Intrinsics.checkNotNullParameter(timeZoneData, "request");
        me.p pVar = presenter.c;
        String j = pVar.f650h.j("user_time_zone");
        if ((j == null || j.length() == 0) || !Intrinsics.c(timeZoneData.getTimezone(), pVar.f650h.j("user_time_zone"))) {
            Intrinsics.checkNotNullParameter(timeZoneData, "request");
            i iVar = new i(kotlin.jvm.internal.o.S0(pVar.g.c(timeZoneData)), new a9.h(10, me.m.O), 1);
            Intrinsics.checkNotNullExpressionValue(iVar, "authorizedService\n      …sponse.data\n            }");
            aq.e eVar = new aq.e(new aq.e(kotlin.jvm.internal.o.D0(kotlin.jvm.internal.o.S0(kotlin.jvm.internal.o.D0(iVar))), new r(7, new me.w(presenter, 16)), 2), new r(8, me.m.g0), 0);
            Intrinsics.checkNotNullExpressionValue(eVar, "fun updateUserTimeZone(r…posable()\n        }\n    }");
            com.bumptech.glide.d.m(presenter, eVar);
        }
        ye.a aVar = MainActivity.Companion;
        GroupData groupData = getPresenter().h;
        aVar.getClass();
        MainActivity.currentUserGroupData = groupData;
    }

    public void onStop() {
        super/*androidx.fragment.app.b0*/.onStop();
        ye.a aVar = MainActivity.Companion;
        GroupData groupData = getPresenter().h;
        aVar.getClass();
        MainActivity.currentUserGroupData = groupData;
        UserData userData = getPresenter().j;
        aVar.getClass();
        MainActivity.userProfile = userData;
    }

    public void onsesignalExternalUidAndEmail(UserData userData) {
        if (userData != null) {
            y3.T(String.valueOf(userData.getId()), (String) null);
            y3.S(userData.getEmail(), (String) null);
        }
    }

    public final void refreshAndReloadStoryly() {
        Integer num;
        Integer num2;
        Integer num3;
        Pair pair;
        Integer num4;
        Integer daysSinceStarted;
        MainActivity activity = getActivity();
        if (activity != null) {
            df.c cVar = sf.a.a;
            if (sf.a.b == null) {
                synchronized (cVar) {
                    sf.a.b = new sf.a();
                }
            }
            if (activity instanceof MainActivity) {
                MainActivity mainActivity = activity;
                if (mainActivity.getCustomStoryLink() != null) {
                    String storyLyNotificationDaySinceStarted = mainActivity.getStoryLyNotificationDaySinceStarted();
                    if ((storyLyNotificationDaySinceStarted != null ? u.toIntOrNull(storyLyNotificationDaySinceStarted) : null) == null) {
                        if (this.mStoryly != null) {
                            r0 r0Var = this.binding;
                            sf.c.a(r0Var != null ? r0Var.N : null, mainActivity.getCustomStoryLink());
                        }
                        mainActivity.setCustomStoryLink(null);
                        mainActivity.setStoryLyNotificationDaySinceStarted(null);
                        return;
                    }
                    GroupData groupData = getPresenter().h;
                    String storyLyNotificationDaySinceStarted2 = mainActivity.getStoryLyNotificationDaySinceStarted();
                    Integer valueOf = storyLyNotificationDaySinceStarted2 != null ? Integer.valueOf(Integer.parseInt(storyLyNotificationDaySinceStarted2)) : null;
                    if (groupData == null || (daysSinceStarted = groupData.getDaysSinceStarted()) == null) {
                        num = null;
                    } else {
                        int intValue = daysSinceStarted.intValue() / 7;
                        int intValue2 = groupData.getDaysSinceStarted().intValue() % 7;
                        num = Integer.valueOf(intValue + (intValue2 + ((((intValue2 ^ 7) & ((-intValue2) | intValue2)) >> 31) & 7) == 0 ? 0 : 1));
                    }
                    if (valueOf != null) {
                        int intValue3 = valueOf.intValue() / 7;
                        int intValue4 = valueOf.intValue() % 7;
                        num2 = Integer.valueOf(intValue3 + (intValue4 + ((((intValue4 ^ 7) & ((-intValue4) | intValue4)) >> 31) & 7) == 0 ? 0 : 1));
                    } else {
                        num2 = null;
                    }
                    if (Intrinsics.c(num, num2)) {
                        if (this.mStoryly != null) {
                            r0 r0Var2 = this.binding;
                            sf.c.a(r0Var2 != null ? r0Var2.N : null, mainActivity.getCustomStoryLink());
                        }
                        mainActivity.setCustomStoryLink(null);
                        mainActivity.setStoryLyNotificationDaySinceStarted(null);
                        return;
                    }
                    i0 presenter = getPresenter();
                    String storyLyNotificationDaySinceStarted3 = mainActivity.getStoryLyNotificationDaySinceStarted();
                    Integer valueOf2 = storyLyNotificationDaySinceStarted3 != null ? Integer.valueOf(Integer.parseInt(storyLyNotificationDaySinceStarted3)) : null;
                    if (valueOf2 != null) {
                        int intValue5 = valueOf2.intValue() / 7;
                        int intValue6 = valueOf2.intValue() % 7;
                        num3 = Integer.valueOf(intValue5 + (intValue6 + ((((intValue6 ^ 7) & ((-intValue6) | intValue6)) >> 31) & 7) == 0 ? 0 : 1));
                    } else {
                        num3 = null;
                    }
                    List n = presenter != null ? presenter.n() : null;
                    if (n == null) {
                        n = o0.f580d;
                    }
                    Iterator it = n.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            pair = new Pair((Object) null, Boolean.FALSE);
                            break;
                        }
                        GroupData groupData2 = (GroupData) it.next();
                        Integer daysSinceStarted2 = groupData2.getDaysSinceStarted();
                        if (daysSinceStarted2 != null) {
                            int intValue7 = daysSinceStarted2.intValue() / 7;
                            int intValue8 = groupData2.getDaysSinceStarted().intValue() % 7;
                            num4 = Integer.valueOf(intValue7 + (intValue8 + ((((intValue8 ^ 7) & ((-intValue8) | intValue8)) >> 31) & 7) == 0 ? 0 : 1));
                        } else {
                            num4 = null;
                        }
                        et.d.d("newStoryFlow").c("Stroyly groupw weelk " + num4 + "  " + num3, new Object[0]);
                        if (Intrinsics.c(num4, num3)) {
                            pair = new Pair(groupData2, Boolean.TRUE);
                            break;
                        }
                    }
                    if (((Boolean) pair.e).booleanValue()) {
                        getPresenter().t((GroupData) pair.d);
                        GroupData groupData3 = (GroupData) pair.d;
                        if (groupData3 != null) {
                            getPresenter().l(groupData3, false, true, new me.h(this, 8));
                            return;
                        }
                        return;
                    }
                    if (this.mStoryly != null) {
                        r0 r0Var3 = this.binding;
                        sf.c.a(r0Var3 != null ? r0Var3.N : null, mainActivity.getCustomStoryLink());
                    }
                    mainActivity.setCustomStoryLink(null);
                    mainActivity.setStoryLyNotificationDaySinceStarted(null);
                }
            }
        }
    }

    public void sendOneSignalSubscriptionTag(String str, SubscriptionUpdateRequest subscriptionUpdateRequest) {
        Intrinsics.checkNotNullParameter(subscriptionUpdateRequest, "request");
        if (isAppInForeground()) {
            getPresenter().getClass();
            Intrinsics.checkNotNullParameter(subscriptionUpdateRequest, "request");
            String productId = subscriptionUpdateRequest.getProductId();
            subscriptionUpdateRequest.getOriginalTransactionId();
            qh.a.m(str, productId);
        }
    }

    public final void setAttributes(GroupData groupData) {
        this.groupData = groupData;
    }

    public void setChallengeEnded(DashboardResponse dashboardResponse, GroupData groupData, UserData userData) {
        Intrinsics.checkNotNullParameter(dashboardResponse, "dashboardResponse");
        Intrinsics.checkNotNullParameter(groupData, "selectedGroup");
        Intrinsics.checkNotNullParameter(userData, "user");
        r0 r0Var = this.binding;
        if (r0Var != null) {
            r0Var.Z.setText(groupData.getName());
            MaterialTextView materialTextView = r0Var.k0;
            Intrinsics.checkNotNullExpressionValue(materialTextView, "tvWeightInTimeLeft");
            fs.d.t(materialTextView);
            et.d.c("CheckTimeLeft : setChallengeEnded " + groupData.getTimeLeft() + " isActive: " + groupData.getActive(), new Object[0]);
            String firstName = userData.getFirstName();
            if (firstName == null) {
                firstName = "";
            }
            String string = getString(2131951731);
            Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.challenge_ended)");
            setChallengeResults(firstName, dashboardResponse, string);
            MaterialTextView materialTextView2 = r0Var.d0;
            Intrinsics.checkNotNullExpressionValue(materialTextView2, "setChallengeEnded$lambda$82$lambda$78");
            fs.d.x(materialTextView2);
            materialTextView2.setText(materialTextView2.getResources().getString(2131951731));
            setWeightBadge(dashboardResponse.getBadgesInfo().getWeight());
            String metrics = userData.getMetrics();
            Intrinsics.e(metrics);
            MaterialTextView materialTextView3 = r0Var.X;
            Intrinsics.checkNotNullExpressionValue(materialTextView3, "setChallengeEnded$lambda$82$lambda$79");
            fs.d.x(materialTextView3);
            DecimalFormat decimalFormat = zf.f.a;
            Context requireContext = requireContext();
            Intrinsics.checkNotNullExpressionValue(requireContext, "requireContext()");
            float initial = dashboardResponse.getWeightInfo().getInitial();
            Integer goal = groupData.getGoal();
            materialTextView3.setText(zf.f.e(requireContext, initial * ((goal != null && goal.intValue() == 0) ? 1.1f : 1.0f), metrics, false));
            MaterialTextView materialTextView4 = r0Var.S;
            Intrinsics.checkNotNullExpressionValue(materialTextView4, "setChallengeEnded$lambda$82$lambda$80");
            fs.d.x(materialTextView4);
            Context requireContext2 = requireContext();
            Intrinsics.checkNotNullExpressionValue(requireContext2, "requireContext()");
            materialTextView4.setText(zf.f.e(requireContext2, dashboardResponse.getWeightInfo().getFinal(), metrics, false));
            float f = dashboardResponse.getWeightInfo().getFinal();
            float initial2 = dashboardResponse.getWeightInfo().getInitial();
            Integer goal2 = groupData.getGoal();
            float f2 = initial2 * ((goal2 != null && goal2.intValue() == 0) ? 1.1f : 1.0f);
            RaySpeedometer raySpeedometer = r0Var.G;
            raySpeedometer.m(f, f2);
            float initial3 = dashboardResponse.getWeightInfo().getInitial();
            Integer goal3 = groupData.getGoal();
            raySpeedometer.n(0L, initial3 * ((goal3 == null || goal3.intValue() != 0) ? 1.0f : 1.1f));
            raySpeedometer.n(2000L, dashboardResponse.getWeightInfo().getCurrent());
            Context requireContext3 = requireContext();
            Intrinsics.checkNotNullExpressionValue(requireContext3, "requireContext()");
            r0Var.R.setText(zf.f.e(requireContext3, dashboardResponse.getWeightInfo().getCurrent(), metrics, false));
            MaterialTextView materialTextView5 = r0Var.U;
            Intrinsics.checkNotNullExpressionValue(materialTextView5, "tvFloorsHint");
            fs.d.t(materialTextView5);
            setFloorsBadge(dashboardResponse.getBadgesInfo().getFloors());
            r0Var.V.setText(String.valueOf(groupData.getFloors()));
            r0Var.g.setOnClickListener(null);
            MaterialTextView materialTextView6 = r0Var.g0;
            Intrinsics.checkNotNullExpressionValue(materialTextView6, "tvWaterHint");
            fs.d.t(materialTextView6);
            setWaterBadge(dashboardResponse.getBadgesInfo().getWater());
            r0Var.h0.setText(String.valueOf(groupData.getWater()));
            r0Var.p.setOnClickListener(null);
            MaterialTextView materialTextView7 = r0Var.b0;
            Intrinsics.checkNotNullExpressionValue(materialTextView7, "tvStepsHint");
            fs.d.t(materialTextView7);
            setStepsBadge(dashboardResponse.getBadgesInfo().getSteps());
            r0Var.c0.setText(String.valueOf(groupData.getSteps()));
            r0Var.l.setOnClickListener(null);
            notifyGraphAdapter();
        }
    }

    public void setChallengeNotStarted(DashboardResponse dashboardResponse, GroupData groupData) {
        Intrinsics.checkNotNullParameter(dashboardResponse, "dashboardResponse");
        Intrinsics.checkNotNullParameter(groupData, "selectedGroup");
        r0 r0Var = this.binding;
        if (r0Var != null) {
            hideWeightRecordButton();
            r0Var.g.setOnClickListener(new z1(8));
            r0Var.p.setOnClickListener(new z1(9));
            r0Var.l.setOnClickListener(new z1(10));
            r0Var.Z.setText(groupData.getName());
            et.d.c("CheckTimeLeft : setChallengeNotStarted " + groupData.getTimeLeft() + " isActive: " + groupData.getActive(), new Object[0]);
            r0Var.i0.setText(getWeekTargetFormattedText$default(this, getString(2131952343), null, 2, null));
            MaterialTextView materialTextView = r0Var.k0;
            Intrinsics.checkNotNullExpressionValue(materialTextView, "tvWeightInTimeLeft");
            fs.d.t(materialTextView);
            RaySpeedometer raySpeedometer = r0Var.G;
            raySpeedometer.m(0.0f, 1.0f);
            raySpeedometer.n(0L, 0.0f);
            r0Var.R.setText(2131952337);
            MaterialTextView materialTextView2 = r0Var.X;
            Intrinsics.checkNotNullExpressionValue(materialTextView2, "tvInitialWeight");
            fs.d.t(materialTextView2);
            MaterialTextView materialTextView3 = r0Var.S;
            Intrinsics.checkNotNullExpressionValue(materialTextView3, "tvFinalWeight");
            fs.d.t(materialTextView3);
            MaterialTextView materialTextView4 = r0Var.d0;
            Intrinsics.checkNotNullExpressionValue(materialTextView4, "tvTimeLeft");
            fs.d.t(materialTextView4);
            MaterialTextView materialTextView5 = r0Var.U;
            Intrinsics.checkNotNullExpressionValue(materialTextView5, "tvFloorsHint");
            fs.d.t(materialTextView5);
            r0Var.V.setText(String.valueOf(groupData.getFloors()));
            ConstraintLayout constraintLayout = r0Var.h;
            Intrinsics.checkNotNullExpressionValue(constraintLayout, "clFloorsMedals");
            fs.d.t(constraintLayout);
            r0Var.s.setProgress(0.0f);
            MaterialTextView materialTextView6 = r0Var.g0;
            Intrinsics.checkNotNullExpressionValue(materialTextView6, "tvWaterHint");
            fs.d.t(materialTextView6);
            r0Var.h0.setText(String.valueOf(groupData.getWater()));
            ConstraintLayout constraintLayout2 = r0Var.q;
            Intrinsics.checkNotNullExpressionValue(constraintLayout2, "clWaterMedals");
            fs.d.t(constraintLayout2);
            r0Var.u.setProgress(0.0f);
            MaterialTextView materialTextView7 = r0Var.b0;
            Intrinsics.checkNotNullExpressionValue(materialTextView7, "tvStepsHint");
            fs.d.t(materialTextView7);
            r0Var.c0.setText(String.valueOf(groupData.getSteps()));
            ConstraintLayout constraintLayout3 = r0Var.m;
            Intrinsics.checkNotNullExpressionValue(constraintLayout3, "clStepsMedals");
            fs.d.t(constraintLayout3);
            r0Var.t.setProgress(0.0f);
            MaterialTextView materialTextView8 = r0Var.j0;
            Intrinsics.checkNotNullExpressionValue(materialTextView8, "tvWeight");
            fs.d.t(materialTextView8);
            RelativeLayout relativeLayout = r0Var.K;
            Intrinsics.checkNotNullExpressionValue(relativeLayout, "rlWeight");
            fs.d.t(relativeLayout);
        }
    }

    public void setChallengeStarted(DashboardResponse dashboardResponse, GroupData groupData, UserData userData) {
        Intrinsics.checkNotNullParameter(dashboardResponse, "dashboardResponse");
        Intrinsics.checkNotNullParameter(groupData, "selectedGroup");
        Intrinsics.checkNotNullParameter(userData, "user");
        this.recordType = y.e;
        Records records = dashboardResponse.getRecords();
        if (records != null) {
            this.lastRecord = records.getWater();
            Integer water = groupData.getWater();
            if (water != null) {
                this.selectedGroup = water.intValue();
                openWaterreminderView();
            }
        }
        r0 r0Var = this.binding;
        if (r0Var != null) {
            RelativeLayout relativeLayout = r0Var.K;
            Intrinsics.checkNotNullExpressionValue(relativeLayout, "rlWeight");
            fs.d.x(relativeLayout);
            r0Var.Z.setText(groupData.getName());
            Integer timeLeft = groupData.getTimeLeft();
            int intValue = timeLeft != null ? timeLeft.intValue() : 0;
            et.d.c("CheckTimeLeft : " + intValue + " ORRRRRR " + groupData.getTimeLeft() + " isActive: " + groupData.getActive(), new Object[0]);
            MaterialTextView materialTextView = r0Var.d0;
            Intrinsics.checkNotNullExpressionValue(materialTextView, "setChallengeStarted$lambda$73$lambda$66");
            fs.d.x(materialTextView);
            materialTextView.setText(intValue == 1 ? getString(2131951876, Integer.valueOf(intValue)) : intValue > 1 ? getString(2131951879, Integer.valueOf(intValue)) : (intValue == 0 && g3.g.O(groupData)) ? getString(2131951876, 1) : (intValue == -1 && g3.g.O(groupData)) ? getString(2131951876, 1) : getString(2131951731));
            List values = dashboardResponse.getGraph().getValues();
            if (values == null || values.isEmpty()) {
                setNoWeightRecorded(groupData);
            } else {
                String metrics = userData.getMetrics();
                Intrinsics.e(metrics);
                String firstName = userData.getFirstName();
                Intrinsics.e(firstName);
                setWeightRecorded(groupData, dashboardResponse, metrics, firstName);
                notifyGraphAdapter();
                getPresenter().g = 0;
            }
            r0Var.g.setOnClickListener(new me.b(this, groupData, dashboardResponse, 0));
            r0Var.p.setOnClickListener(new me.b(this, groupData, dashboardResponse, 1));
            r0Var.l.setOnClickListener(new me.b(this, groupData, dashboardResponse, 2));
            showRecords(groupData, dashboardResponse);
            setWeightBadge(dashboardResponse.getBadgesInfo().getWeight());
        }
    }

    public void setDailyTips(String str, int i) {
        Intrinsics.checkNotNullParameter(str, "firstName");
        if (getActivity() != null) {
            DailyMessageConfig f = getPreferenceData().f();
            DailyMessageConfig i2 = getPreferenceData().i();
            String dailyMessage = i2 != null ? getDailyMessage(2130903044, i2.getTipsMessageIndex()) : f != null ? getDailyMessage(2130903044, f.getTipsMessageIndex()) : getDailyMessage(2130903044, 0);
            boolean z = !k.g() || i0.h(getPresenter(), getPresenter().h) || getPresenter().i(getPresenter().h) || zf.d.b;
            Object[] objArr = new Object[2];
            objArr[0] = str;
            if (!z) {
                dailyMessage = getString(2131952590);
                Intrinsics.checkNotNullExpressionValue(dailyMessage, "getString(\n             …e_plans\n                )");
            }
            objArr[1] = dailyMessage;
            String string = getString(2131951863, objArr);
            this.dailyTip = string;
            r0 r0Var = this.binding;
            MaterialTextView materialTextView = r0Var != null ? r0Var.e0 : null;
            if (materialTextView != null) {
                materialTextView.setText(string);
            }
            if (this.isDailyTipShown || !getPreferenceData().o()) {
                return;
            }
            showTipDialog();
        }
    }

    public void setDashboardResponse(DashboardResponse dashboardResponse) {
        Intrinsics.checkNotNullParameter(dashboardResponse, "dashboard");
        this.dashboardResponse = dashboardResponse;
        et.d.c("syncUserRecordedData: setDashboardResponse", new Object[0]);
        notifyGraphAdapter();
    }

    public void setDaysLeftToNextWeightIn(int i, boolean z) {
        String o;
        r0 r0Var = this.binding;
        if (r0Var != null) {
            MaterialTextView materialTextView = r0Var.k0;
            if (i == -1) {
                Intrinsics.checkNotNullExpressionValue(materialTextView, "tvWeightInTimeLeft");
                fs.d.t(materialTextView);
                return;
            }
            if (z) {
                o = getString(2131951873);
            } else {
                String string = getResources().getString(i == 1 ? 2131951871 : 2131951872);
                Intrinsics.checkNotNullExpressionValue(string, "resources.getString(res)");
                o = g0.b.o(new Object[]{Integer.valueOf(i)}, 1, string, "format(...)");
            }
            Intrinsics.checkNotNullExpressionValue(o, "if (isWeightInDay) {\n   …          )\n            }");
            Intrinsics.checkNotNullExpressionValue(materialTextView, "this");
            fs.d.x(materialTextView);
            Intrinsics.checkNotNullParameter(o, "<this>");
            Spanned fromHtml = Html.fromHtml(o, 0);
            Intrinsics.checkNotNullExpressionValue(fromHtml, "fromHtml(this, Html.FROM_HTML_MODE_LEGACY)");
            materialTextView.setText(fromHtml);
        }
    }

    public final void setGroupsFromMain(List<GroupData> list) {
        Intrinsics.checkNotNullParameter(list, "groups");
        et.d.c("refreshSelectedGroup: setGroupsFromMain", new Object[0]);
        if (!list.isEmpty()) {
            getPresenter().u(list);
            return;
        }
        addLogToFile("Dashboard Groups list empty");
        i0 presenter = getPresenter();
        presenter.h = null;
        presenter.i = null;
        j0 j0Var = ((ad.a) presenter).a;
        j0Var.showNoEnrolledGroups();
        presenter.o();
        j0Var.hideLoadingDialog();
    }

    public final void setItemDecoration(dg.c cVar) {
        Intrinsics.checkNotNullParameter(cVar, "<set-?>");
        this.itemDecoration = cVar;
    }

    public void setMotivationsMessage(java.lang.String r7, com.bettertogether.remote.model.response.DashboardResponse r8, com.bettertogether.remote.model.common.GroupData r9, float r10, com.bettertogether.remote.model.common.MessagesIndexes r11) {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.setMotivationsMessage(java.lang.String, com.bettertogether.remote.model.response.DashboardResponse, com.bettertogether.remote.model.common.GroupData, float, com.bettertogether.remote.model.common.MessagesIndexes):void");
    }

    public void setProUserView(boolean z) {
        et.d.d("whichIssueIsThere").c("setProChannlenge is called multiple times", new Object[0]);
        MainActivity activity = getActivity();
        if (activity != null && (activity instanceof MainActivity) && (!getPresenter().n().isEmpty())) {
            activity.loadAdd();
        }
        setViewsForProUser(z);
    }

    public void setStorylyView() {
        sf.c cVar = this.mStoryly;
        boolean z = false;
        if (cVar != null && cVar.b) {
            z = true;
        }
        if (z && cVar != null) {
            setUpStoryly();
        } else {
            initStoryly();
            setUpStoryly();
        }
    }

    public void setupBMI(float r17, java.lang.Float r18, java.lang.Float r19, rd.a r20) {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.screens.dashboard.DashboardFragment.setupBMI(float, java.lang.Float, java.lang.Float, rd.a):void");
    }

    public void shareApp(String str) {
        vl.h hVar;
        Intrinsics.checkNotNullParameter(str, "userSource");
        showLoadingDialog();
        Intrinsics.checkNotNullParameter(kh.a.N, "<this>");
        synchronized (vl.h.class) {
            al.g c = al.g.c();
            synchronized (vl.h.class) {
                hVar = (vl.h) c.b(vl.h.class);
            }
            Intrinsics.checkNotNullExpressionValue(hVar, "getInstance()");
            c1.F(hVar, new z8.r(21, str, this)).addOnSuccessListener(new a9.h(15, new me.e(this, 17))).addOnFailureListener(new v2(this, 26));
        }
        Intrinsics.checkNotNullExpressionValue(hVar, "getInstance()");
        c1.F(hVar, new z8.r(21, str, this)).addOnSuccessListener(new a9.h(15, new me.e(this, 17))).addOnFailureListener(new v2(this, 26));
    }

    public void showEnrolledGroups(boolean z, List<GroupData> list) {
        addLogToFile("showEnrolledGroups");
        r0 r0Var = this.binding;
        if (r0Var != null) {
            MaterialTextView materialTextView = r0Var.Z;
            Intrinsics.checkNotNullExpressionValue(materialTextView, "tvSelectedGroup");
            fs.d.x(materialTextView);
            MaterialTextView materialTextView2 = r0Var.W;
            Intrinsics.checkNotNullExpressionValue(materialTextView2, "tvGroupLabel");
            fs.d.x(materialTextView2);
            ConstraintLayout constraintLayout = r0Var.I;
            Intrinsics.checkNotNullExpressionValue(constraintLayout, "rlHeader");
            fs.d.x(constraintLayout);
            LinearLayoutCompat linearLayoutCompat = r0Var.d;
            Intrinsics.checkNotNullExpressionValue(linearLayoutCompat, "btnMyGroup");
            fs.d.x(linearLayoutCompat);
            if (z) {
                materialTextView.setOnClickListener(new z1(7));
                materialTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
            } else {
                materialTextView.setOnClickListener(new me.a(this, 7));
                materialTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 2131231028, 0);
            }
            LinearLayout linearLayout = r0Var.E;
            Intrinsics.checkNotNullExpressionValue(linearLayout, "llInner");
            fs.d.x(linearLayout);
            MaterialTextView materialTextView3 = r0Var.Y;
            Intrinsics.checkNotNullExpressionValue(materialTextView3, "tvMotivationMessage");
            fs.d.x(materialTextView3);
            ConstraintLayout constraintLayout2 = r0Var.k.e;
            Intrinsics.checkNotNullExpressionValue(constraintLayout2, "clNoGroups.parent");
            fs.d.t(constraintLayout2);
            setEmptyImageDirectionLayout();
        }
    }

    public void showLoadingDialog() {
        ContentLoadingProgressBar contentLoadingProgressBar;
        SwipeRefreshLayout swipeRefreshLayout;
        r0 r0Var = this.binding;
        boolean z = false;
        if (r0Var != null && (swipeRefreshLayout = r0Var.M) != null && !swipeRefreshLayout.i) {
            z = true;
        }
        if (!z || r0Var == null || (contentLoadingProgressBar = r0Var.F) == null) {
            return;
        }
        contentLoadingProgressBar.b();
    }

    public void showNoEnrolledGroups() {
        addLogToFile(rnaioAkxVmZTT.jKALaZXu);
        r0 r0Var = this.binding;
        if (r0Var != null) {
            MaterialTextView materialTextView = r0Var.Z;
            Intrinsics.checkNotNullExpressionValue(materialTextView, "tvSelectedGroup");
            fs.d.t(materialTextView);
            ConstraintLayout constraintLayout = r0Var.I;
            Intrinsics.checkNotNullExpressionValue(constraintLayout, "rlHeader");
            fs.d.t(constraintLayout);
            MaterialTextView materialTextView2 = r0Var.W;
            Intrinsics.checkNotNullExpressionValue(materialTextView2, "tvGroupLabel");
            Intrinsics.checkNotNullParameter(materialTextView2, "<this>");
            materialTextView2.setVisibility(4);
            LinearLayoutCompat linearLayoutCompat = r0Var.d;
            Intrinsics.checkNotNullExpressionValue(linearLayoutCompat, "btnMyGroup");
            Intrinsics.checkNotNullParameter(linearLayoutCompat, "<this>");
            linearLayoutCompat.setVisibility(4);
            LinearLayout linearLayout = r0Var.E;
            Intrinsics.checkNotNullExpressionValue(linearLayout, "llInner");
            fs.d.t(linearLayout);
            MaterialTextView materialTextView3 = r0Var.Y;
            Intrinsics.checkNotNullExpressionValue(materialTextView3, "tvMotivationMessage");
            fs.d.t(materialTextView3);
            ConstraintLayout constraintLayout2 = r0Var.k.e;
            Intrinsics.checkNotNullExpressionValue(constraintLayout2, "clNoGroups.parent");
            fs.d.x(constraintLayout2);
            setEmptyImageDirectionLayout();
        }
    }

    public void showRecords(GroupData groupData, DashboardResponse dashboardResponse) {
        Intrinsics.checkNotNullParameter(groupData, "selectedGroup");
        Intrinsics.checkNotNullParameter(dashboardResponse, "dashboard");
        et.d.d("DashboardFragmentCode").c(a0.g0.f("code check how many time called ", dashboardResponse.getRecords().getSteps()), new Object[0]);
        r0 r0Var = this.binding;
        if (r0Var != null) {
            startAnimations(dashboardResponse.getRecords(), groupData);
            MaterialTextView materialTextView = r0Var.U;
            Intrinsics.checkNotNullExpressionValue(materialTextView, "tvFloorsHint");
            fs.d.x(materialTextView);
            if (dashboardResponse.getRecords().getFloors() == 0) {
                materialTextView.setText(groupData.getFloors() + " " + getString(2131952008));
            } else {
                Integer floors = groupData.getFloors();
                Intrinsics.e(floors);
                if (floors.intValue() > dashboardResponse.getRecords().getFloors()) {
                    Integer floors2 = groupData.getFloors();
                    Intrinsics.e(floors2);
                    materialTextView.setText((floors2.intValue() - dashboardResponse.getRecords().getFloors()) + " " + getString(2131952008));
                } else {
                    Integer floors3 = groupData.getFloors();
                    Intrinsics.e(floors3);
                    if (floors3.intValue() <= dashboardResponse.getRecords().getFloors()) {
                        materialTextView.setText("0 " + getString(2131952008));
                    }
                }
            }
            r0Var.V.setText(String.valueOf(dashboardResponse.getRecords().getFloors()));
            setFloorsBadge(dashboardResponse.getBadgesInfo().getFloors());
            MaterialTextView materialTextView2 = r0Var.g0;
            Intrinsics.checkNotNullExpressionValue(materialTextView2, "tvWaterHint");
            fs.d.x(materialTextView2);
            if (dashboardResponse.getRecords().getWater() == 0) {
                materialTextView2.setText(groupData.getWater() + " " + getResources().getString(2131952025));
            } else {
                Integer water = groupData.getWater();
                Intrinsics.e(water);
                if (water.intValue() > dashboardResponse.getRecords().getWater()) {
                    Integer water2 = groupData.getWater();
                    Intrinsics.e(water2);
                    materialTextView2.setText((water2.intValue() - dashboardResponse.getRecords().getWater()) + " " + getResources().getString(2131952025));
                } else {
                    Integer water3 = groupData.getWater();
                    Intrinsics.e(water3);
                    if (water3.intValue() <= dashboardResponse.getRecords().getWater()) {
                        materialTextView2.setText("0 " + getResources().getString(2131952025));
                    }
                }
            }
            r0Var.h0.setText(String.valueOf(dashboardResponse.getRecords().getWater()));
            setWaterBadge(dashboardResponse.getBadgesInfo().getWater());
            MaterialTextView materialTextView3 = r0Var.b0;
            Intrinsics.checkNotNullExpressionValue(materialTextView3, "tvStepsHint");
            fs.d.x(materialTextView3);
            if (dashboardResponse.getRecords().getSteps() == 0) {
                materialTextView3.setText(groupData.getSteps() + " " + getResources().getString(2131952526));
            } else {
                Integer steps = groupData.getSteps();
                Intrinsics.e(steps);
                if (steps.intValue() > dashboardResponse.getRecords().getSteps()) {
                    Integer steps2 = groupData.getSteps();
                    Intrinsics.e(steps2);
                    materialTextView3.setText((steps2.intValue() - dashboardResponse.getRecords().getSteps()) + " " + getResources().getString(2131952526));
                } else {
                    Integer steps3 = groupData.getSteps();
                    Intrinsics.e(steps3);
                    if (steps3.intValue() <= dashboardResponse.getRecords().getSteps()) {
                        materialTextView3.setText("0 " + getResources().getString(2131952526));
                    }
                }
            }
            r0Var.c0.setText(String.valueOf(dashboardResponse.getRecords().getSteps()));
            setStepsBadge(dashboardResponse.getBadgesInfo().getSteps());
        }
    }

    public final void showTipDialog() {
        w0 supportFragmentManager;
        boolean z = true;
        this.isDailyTipShown = this.dailyTip != null;
        DateFormat dateFormat = zf.a.a;
        String f = zf.a.f(new Date().getTime());
        et.d.c(a0.g0.j("showTipDialog: daily_tip_popup_", f), new Object[0]);
        if (!k.g() || zf.d.b) {
            z = checkGroupConditions();
        } else if (!k.g() || !checkGroupConditions() || getPresenter().j()) {
            z = false;
        }
        et.d.d("TipOfTheDay").c("Tip of the day dialog is shown showPopup " + z + " " + getPreferenceData().g("daily_tip_popup_" + f) + "  " + getPreferenceData().g("daily_tip_enabled"), new Object[0]);
        if (!z || this.dailyTip == null) {
            return;
        }
        if (getPreferenceData().g("daily_tip_popup_" + f) || !getPreferenceData().g("daily_tip_enabled")) {
            return;
        }
        e0 activity = getActivity();
        if (((activity == null || (supportFragmentManager = activity.getSupportFragmentManager()) == null) ? null : supportFragmentManager.D("DailyTipsDialog")) != null) {
            return;
        }
        et.d.d("TipOfTheDay").c("Tip of the day dialog is shown", new Object[0]);
        loadImage(f);
    }

    public void showWeightRecordButton(int i, float f, float f2, String str, boolean z, String str2, Integer num, boolean z2) {
        Intrinsics.checkNotNullParameter(str, "measureType");
        r0 r0Var = this.binding;
        if (r0Var != null) {
            FloatingActionButton floatingActionButton = r0Var.v;
            Intrinsics.checkNotNullExpressionValue(floatingActionButton, "this");
            fs.d.L(floatingActionButton, z2);
            floatingActionButton.g(true);
            floatingActionButton.setOnClickListener(new fe.c(this, i, f, f2, str, str2, num, z));
        }
    }

    public final void subscriptionOneSignalTags(Purchase purchase, SubscriptionUpdateRequest subscriptionUpdateRequest) {
        if (purchase == null || subscriptionUpdateRequest == null || !zf.d.b || !isAppInForeground()) {
            return;
        }
        DateFormat dateFormat = zf.a.a;
        String f = zf.a.f(purchase.getPurchaseTime());
        String str = (String) purchase.getSkus().get(0);
        subscriptionUpdateRequest.getOriginalTransactionId();
        qh.a.m(f, str);
    }

    public void syncRecords(boolean z) {
        syncUserRecordedData$default(this, false, false, 3, null);
    }

    public void uploadSevenDaysData() {
        long dayDiff = getDayDiff();
        if (dayDiff <= 0) {
            getPresenter().k = true;
            return;
        }
        if (dayDiff > 7) {
            dayDiff = 7;
        }
        et.d.d("History Sync Api").a("sync history with last sync day difference is " + dayDiff + " and is greater Than 14 " + getPresenter().j() + " ", new Object[0]);
        if (zf.d.b || getPreferenceData().c() || !getPresenter().j()) {
            getPresenter().k = true;
            et.d.d("DataChecking").c("sync history with last sync day difference is " + dayDiff + " ", new Object[0]);
            MainActivity activity = getActivity();
            Intrinsics.f(activity, "null cannot be cast to non-null type com.bettertogether.screens.main.MainActivity");
            checkWhichAppIsConnected(activity, (int) dayDiff);
        }
    }

    public void userOneSignalTags(UserData userData) {
        if (userData == null || !isAppInForeground()) {
            return;
        }
        if (getPreferenceData().c()) {
            int id = userData.getId();
            String createdAt = userData.getCreatedAt();
            userData.getFirstName();
            userData.getBirthDate();
            qh.a.j(id, createdAt, userData.getFirstName(), userData.getGender(), userData.getSource(), getPreferenceData().c());
            return;
        }
        int id2 = userData.getId();
        String createdAt2 = userData.getCreatedAt();
        userData.getFirstName();
        userData.getBirthDate();
        qh.a.k(id2, createdAt2, userData.getFirstName(), userData.getGender(), userData.getSource());
    }

    public static final DashboardFragment newInstance(GroupData groupData) {
        Companion.getClass();
        ?? dashboardFragment = new DashboardFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable(GROUP_DATA, groupData);
        dashboardFragment.setArguments(bundle);
        return dashboardFragment;
    }

    public r0 m5getMBinding() {
        return this.binding;
    }

    public r0 m6inflateBinding(LayoutInflater layoutInflater, ViewGroup viewGroup) {
        Intrinsics.checkNotNullParameter(layoutInflater, "inflater");
        this.binding = r0.a(layoutInflater, viewGroup);
        return m5getMBinding();
    }

    public i0 providePresenter() {
        return getPresenter();
    }

    public static final DashboardFragment newInstance(GroupData groupData, boolean z) {
        Companion.getClass();
        ?? dashboardFragment = new DashboardFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable(GROUP_DATA, groupData);
        bundle.putBoolean(SHOW_JOIN_GROUP, z);
        dashboardFragment.setArguments(bundle);
        return dashboardFragment;
    }
}