导航菜单

页面标题

页面副标题

Tasker v6.5.11 - ShareDataConfig.java 源代码

正在查看: Tasker v6.5.11 应用的 ShareDataConfig.java JAVA 源代码文件

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


package com.joaomgcd.taskerm.datashare.export;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.SeekBar;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.joaomgcd.taskerm.datashare.export.ShareDataConfig;
import com.joaomgcd.taskerm.datashare.export.a;
import com.joaomgcd.taskerm.dialog.l;
import com.joaomgcd.taskerm.signin.a;
import com.joaomgcd.taskerm.util.ExtensionsContextKt;
import com.joaomgcd.taskerm.util.e5;
import com.joaomgcd.taskerm.util.o2;
import com.joaomgcd.taskerm.util.t6;
import com.joaomgcd.taskerm.util.x2;
import com.joaomgcd.taskerm.util.z2;
import com.joaomgcd.taskerservercommon.datashare.DataShareTag;
import com.joaomgcd.taskerservercommon.response.ResponseGetTags;
import hk.o;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import kotlin.collections.r;
import lj.e0;
import lj.k;
import net.dinglisch.android.taskerm.HTMLView;
import net.dinglisch.android.taskerm.HasArgsEdit;
import net.dinglisch.android.taskerm.MyCheckBox;
import net.dinglisch.android.taskerm.dq;
import net.dinglisch.android.taskerm.i5;
import net.dinglisch.android.taskerm.in;
import net.dinglisch.android.taskerm.r7;
import net.dinglisch.android.taskerm.tn;
import net.dinglisch.android.taskerm.to;
import net.dinglisch.android.taskerm.xi;
import pg.w0;
import we.k2;
import we.l0;
import we.v1;
import we.w1;
import we.x;
import yj.k0;
import yj.p;
import yj.q;
import yj.v;

public final class ShareDataConfig extends HasArgsEdit {
    static final fk.j<Object>[] w0 = {k0.e(new v(ShareDataConfig.class, "userAgreedToConditions", "getUserAgreedToConditions()Z", 0)), k0.e(new v(ShareDataConfig.class, "timesOpenedThisScreen", "getTimesOpenedThisScreen()I", 0))};
    public static final int x0 = 8;
    private i5 n0;
    private to o0;
    private xi p0;
    private ue.b q0;
    private final lj.j m0 = k.b(b.i);
    private final jg.f r0 = new jg.f(this, false, (String) null, "userAgreedToShareConditions", 4, (yj.h) null);
    private final jg.g s0 = new jg.g(this, 0, (String) null, "timesOpenedShareConfigScreen", 6, (yj.h) null);
    private final lj.j t0 = k.b(new a());
    private final int u0 = 99;
    private final int v0 = 100;

    static final class a extends q implements xj.a<com.joaomgcd.taskerm.datashare.export.a> {
        a() {
            super(0);
        }

        public final com.joaomgcd.taskerm.datashare.export.a invoke() {
            return a.C0210a.c(com.joaomgcd.taskerm.datashare.export.a.a, ShareDataConfig.this, false, 2, null);
        }
    }

    static final class b extends q implements xj.a<se.a> {
        public static final b i = new b();

        b() {
            super(0);
        }

        public final se.a invoke() {
            return new se.a();
        }
    }

    static final class c extends q implements xj.a<e0> {
        final GoogleSignInAccount q;

        c(GoogleSignInAccount googleSignInAccount) {
            super(0);
            this.q = googleSignInAccount;
        }

        public final void a() {
            dq.i0(ShareDataConfig.this, "Sharing as " + this.q.e(), new Object[0]);
        }

        public Object invoke() {
            a();
            return e0.a;
        }
    }

    static final class d extends q implements xj.a<Boolean> {
        d() {
            super(0);
        }

        public final Boolean invoke() {
            return Boolean.valueOf(ShareDataConfig.this.j3() >= 3);
        }
    }

    static final class e extends q implements xj.a<e0> {
        final Bundle q;

        static final class a extends q implements xj.a<e0> {
            final ShareDataConfig i;
            final GoogleSignInAccount q;

            static final class C0209a extends q implements xj.a<e0> {
                final ShareDataConfig i;
                final Throwable q;

                C0209a(ShareDataConfig shareDataConfig, Throwable th) {
                    super(0);
                    this.i = shareDataConfig;
                    this.q = th;
                }

                public final void a() {
                    dq.b0(this.i, this.q.getMessage(), new Object[0]);
                }

                public Object invoke() {
                    a();
                    return e0.a;
                }
            }

            a(ShareDataConfig shareDataConfig, GoogleSignInAccount googleSignInAccount) {
                super(0);
                this.i = shareDataConfig;
                this.q = googleSignInAccount;
            }

            public final void a() {
                try {
                    r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Showing sharing as");
                    ShareDataConfig shareDataConfig = this.i;
                    GoogleSignInAccount googleSignInAccount = this.q;
                    p.h(googleSignInAccount, "$googleSignInAccount");
                    shareDataConfig.d3(googleSignInAccount);
                    r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Populating views");
                    this.i.o3();
                    r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Setting UI from project");
                    this.i.v3();
                    r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Setting help buttons from spec");
                    ?? r0 = this.i;
                    r0.Q1((Context) r0, r0.e3());
                    r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "oncreatedone doinmain");
                    if (this.i.l3()) {
                        return;
                    }
                    ((HasArgsEdit) this.i).A.k1(2131891299);
                } catch (Throwable th) {
                    r7.l(com.joaomgcd.taskerm.datashare.export.d.h(), "Error sharing to link doinmain", th);
                    w0.q0(new C0209a(this.i, th));
                    this.i.b3("exception in main block doinmain");
                }
            }

            public Object invoke() {
                a();
                return e0.a;
            }
        }

        static final class b extends q implements xj.a<e0> {
            final ShareDataConfig i;
            final Throwable q;

            b(ShareDataConfig shareDataConfig, Throwable th) {
                super(0);
                this.i = shareDataConfig;
                this.q = th;
            }

            public final void a() {
                dq.b0(this.i, this.q.getMessage(), new Object[0]);
            }

            public Object invoke() {
                a();
                return e0.a;
            }
        }

        e(Bundle bundle) {
            super(0);
            this.q = bundle;
        }

        public final void a() {
            Bundle bundle;
            try {
                if (!ShareDataConfig.this.k3()) {
                    if (!((l0) com.joaomgcd.taskerm.dialog.a.p0(new we.c(ShareDataConfig.this, "disclaimer_share.html", HTMLView.g.i)).f()).o()) {
                        throw new ug.b("User didn't accept conditions to share");
                    }
                    ShareDataConfig.this.z3(true);
                }
                GoogleSignInAccount googleSignInAccount = (GoogleSignInAccount) a.a.z(com.joaomgcd.taskerm.signin.a.a, ShareDataConfig.this, false, (ug.a) null, 6, (Object) null).f();
                l e = l.a.e(l.c, ShareDataConfig.this, 2131888404, false, 4, null);
                try {
                    ?? r5 = ShareDataConfig.this;
                    to Z1 = to.Z1((Context) r5);
                    ?? r72 = ShareDataConfig.this;
                    Bundle bundle2 = this.q;
                    r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Loading data from cache file");
                    try {
                        Z1.l1((Context) r72, "ShareLink", com.joaomgcd.taskerm.datashare.export.d.g(), true);
                        r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Loaded data from cache file");
                        try {
                            if (bundle2 == null) {
                                r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Loading extra data from intent");
                                bundle = r72.getIntent().getBundleExtra(com.joaomgcd.taskerm.datashare.export.d.e());
                            } else {
                                r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Loading extra data from icicle");
                                bundle = bundle2.getBundle(com.joaomgcd.taskerm.datashare.export.d.e());
                            }
                        } catch (Exception e2) {
                            r7.H(com.joaomgcd.taskerm.datashare.export.d.h(), "Can't get extra data for share", e2);
                            bundle = null;
                        }
                        if (bundle != null) {
                            ((ShareDataConfig) r72).n0 = to.k1((Context) r72, bundle);
                            i5 i5Var = ((ShareDataConfig) r72).n0;
                            ((ShareDataConfig) r72).q0 = i5Var != null ? i5Var.l0() : null;
                            xi xiVar = ((ShareDataConfig) r72).n0;
                            if (xiVar != null && (xiVar instanceof xi)) {
                                Set Q1 = Z1.Q1();
                                p.h(Q1, "getMacroIDSet(...)");
                                for (Integer num : (Integer[]) Q1.toArray(new Integer[0])) {
                                    if (!xiVar.K().contains(num)) {
                                        p.f(num);
                                        Z1.g1(num.intValue());
                                    }
                                }
                            }
                        }
                        ((ShareDataConfig) r5).o0 = Z1;
                        ShareDataConfig shareDataConfig = ShareDataConfig.this;
                        to toVar = shareDataConfig.o0;
                        shareDataConfig.p0 = toVar != null ? toVar.w(0) : null;
                        xi xiVar2 = ShareDataConfig.this.p0;
                        if (xiVar2 != null) {
                            i5 i5Var2 = ShareDataConfig.this.n0;
                            xiVar2.q0(i5Var2 != null ? i5Var2.getName() : null);
                        }
                        l.e(e, null, 1, null);
                        ShareDataConfig.this.c3();
                        w0.q0(new a(ShareDataConfig.this, googleSignInAccount));
                    } catch (Throwable th) {
                        r7.l(com.joaomgcd.taskerm.datashare.export.d.h(), "Couldn't load data from cache file", th);
                        o2.i(th, (Context) r72);
                        r72.b3("Couldn't load data from cache file");
                        l.e(e, null, 1, null);
                        return;
                    }
                } catch (Throwable th2) {
                    l.e(e, null, 1, null);
                    throw th2;
                }
            } catch (Throwable th3) {
                r7.l(com.joaomgcd.taskerm.datashare.export.d.h(), "Error sharing to link", th3);
                w0.q0(new b(ShareDataConfig.this, th3));
                ShareDataConfig.this.b3("exception in main block");
            }
            r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "oncreatedone doinbackground");
        }

        public Object invoke() {
            a();
            return e0.a;
        }
    }

    static final class f extends q implements xj.a<e0> {
        f() {
            super(0);
        }

        public final void a() {
            try {
                GoogleSignInAccount googleSignInAccount = (GoogleSignInAccount) a.a.z(com.joaomgcd.taskerm.signin.a.a, ShareDataConfig.this, false, (ug.a) null, 4, (Object) null).f();
                ShareDataConfig shareDataConfig = ShareDataConfig.this;
                p.f(googleSignInAccount);
                shareDataConfig.d3(googleSignInAccount);
            } catch (Exception e) {
                w0.X0(ShareDataConfig.this, e);
            }
        }

        public Object invoke() {
            a();
            return e0.a;
        }
    }

    static final class g extends q implements xj.a<List<? extends String>> {
        final List<String> q;

        public static final class a<T> implements Comparator {
            final List i;

            public a(List list) {
                this.i = list;
            }

            @Override
            public final int compare(T t, T t2) {
                return nj.a.d(Boolean.valueOf(!g.c((String) t, this.i)), Boolean.valueOf(!g.c((String) t2, this.i)));
            }
        }

        static final class b extends q implements xj.l<String, we.k0> {
            final List<String> i;

            b(List<String> list) {
                super(1);
                this.i = list;
            }

            public final we.k0 invoke(String str) {
                p.i(str, "it");
                return new we.k0(str, null, g.c(str, this.i), 2, null);
            }
        }

        g(List<String> list) {
            super(0);
            this.q = list;
        }

        public static final boolean c(String str, List<String> list) {
            return list.contains(str);
        }

        public final List<String> invoke() {
            List tags;
            List<String> c;
            l e = l.a.e(l.c, ShareDataConfig.this, 2131888070, false, 4, null);
            ResponseGetTags responseGetTags = (ResponseGetTags) ShareDataConfig.this.f3().e().f();
            if (responseGetTags != null && (tags = responseGetTags.getTags()) != null) {
                ArrayList arrayList = new ArrayList();
                Iterator it = tags.iterator();
                while (it.hasNext()) {
                    String id2 = ((DataShareTag) it.next()).getId();
                    if (id2 != null) {
                        arrayList.add(id2);
                    }
                }
                List F0 = r.F0(arrayList, new a(this.q));
                if (F0 != null) {
                    l.e(e, null, 1, null);
                    k2 k2Var = (k2) x.n(new we.h(ShareDataConfig.this, x2.H4(2131889995, ShareDataConfig.this), F0, false, new b(this.q), null, x2.G4(2131886867, ShareDataConfig.this), null, null, null, Boolean.TRUE, 3, null, null, null, null, 62368, null)).f();
                    if (k2Var == null || (c = k2Var.c()) == null) {
                        throw new RuntimeException("Didn't select any tags");
                    }
                    if (c.size() <= 3) {
                        return c;
                    }
                    throw new RuntimeException("Too many tags selected. Maximum is 3");
                }
            }
            throw new RuntimeException("Couldn't get tags from server");
        }
    }

    static final class h extends q implements xj.l<List<? extends String>, e0> {
        h() {
            super(1);
        }

        public final void a(List<String> list) {
            p.i(list, "it");
            ShareDataConfig.this.t3(4, r.m0(list, ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (xj.l) null, 62, (Object) null));
        }

        public Object invoke(Object obj) {
            a((List) obj);
            return e0.a;
        }
    }

    static final class i extends q implements xj.l<w1<tn>, e0> {
        i() {
            super(1);
        }

        public final void a(w1<tn> w1Var) {
            p.i(w1Var, "it");
            tn c = w1Var.c();
            if (c == null) {
                return;
            }
            ShareDataConfig.this.t3(1, c.getName());
        }

        public Object invoke(Object obj) {
            a((w1) obj);
            return e0.a;
        }
    }

    static final class j extends q implements xj.l<tn, we.k0> {
        public static final j i = new j();

        j() {
            super(1);
        }

        public final we.k0 invoke(tn tnVar) {
            String name = tnVar.getName();
            p.h(name, "getName(...)");
            return new we.k0(name, tnVar.getIcon(), false, 4, null);
        }
    }

    private final void A3() {
        to toVar = this.o0;
        ArrayList K = toVar != null ? toVar.K(-2, tn.f.r) : null;
        if (K == null) {
            return;
        }
        w0.F1(x.C(new v1((Activity) this, 2131890732, (List) K, true, (xj.l) j.i, (Integer) null, (xj.l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.q) null, (com.joaomgcd.taskerm.util.q) null, (com.joaomgcd.taskerm.util.q) null, (Boolean) null, (Boolean) null, 65504, (yj.h) null)), this, new i());
    }

    public final void b3(String str) {
        setResult(0);
        r7.k(com.joaomgcd.taskerm.datashare.export.d.h(), "Cancelling export and finishing: " + str);
        finish();
    }

    public final void c3() {
        u3(j3() + 1);
    }

    public final void d3(GoogleSignInAccount googleSignInAccount) {
        w0.q0(new c(googleSignInAccount));
    }

    public final in e3() {
        return new in(6, new Object[]{1, 2131889560, "t:5", 0, -1, 2131887207, 1, 2131889716, "m:1:?", 0, -1, 2131887220, 3, 2131886912, "", 0, 0, 2131887223, 3, 2131889869, "", 0, 0, 2131887222, 1, 2131889995, "t:1:?", 0, -1, 2131887224});
    }

    private final ue.b h3() {
        String[] strArr;
        List A0;
        if (!z0(this, e3())) {
            return null;
        }
        String m1 = dq.m1(((HasArgsEdit) this).v[0]);
        String m12 = dq.m1(((HasArgsEdit) this).v[1]);
        CompoundButton compoundButton = ((HasArgsEdit) this).U[2];
        Boolean valueOf = compoundButton != null ? Boolean.valueOf(compoundButton.isChecked()) : null;
        CompoundButton compoundButton2 = ((HasArgsEdit) this).U[3];
        Boolean valueOf2 = compoundButton2 != null ? Boolean.valueOf(compoundButton2.isChecked()) : null;
        String i3 = i3(4);
        if (i3 == null || (A0 = o.A0(i3, new String[]{","}, false, 0, 6, (Object) null)) == null) {
            strArr = null;
        } else {
            ArrayList arrayList = new ArrayList();
            Iterator it = A0.iterator();
            while (it.hasNext()) {
                String F = z2.F(o.Z0((String) it.next()).toString());
                if (F != null) {
                    arrayList.add(F);
                }
            }
            strArr = (String[]) arrayList.toArray(new String[0]);
        }
        if (!p.d(valueOf2, Boolean.TRUE) || (strArr != null && strArr.length != 0)) {
            return new ue.b(m1, m12, valueOf, valueOf2, strArr);
        }
        qf.j jVar = ((HasArgsEdit) this).A;
        p.h(jVar, "helperHasArgsRx");
        com.joaomgcd.taskerm.helper.i.c0(jVar, com.joaomgcd.taskerm.dialog.a.d1(this, 2131889869, 2131890165), (xj.l) null, 2, (Object) null);
        return null;
    }

    private final String i3(int i2) {
        return dq.m1(((HasArgsEdit) this).v[i2]);
    }

    public final int j3() {
        return ((Number) this.s0.d(this, w0[1])).intValue();
    }

    public final boolean k3() {
        return ((Boolean) this.r0.d(this, w0[0])).booleanValue();
    }

    public final boolean l3() {
        qf.j jVar = ((HasArgsEdit) this).A;
        p.h(jVar, "helperHasArgsRx");
        return com.joaomgcd.taskerm.helper.e.h1(jVar, 2131890949, new d(), new Runnable() {
            @Override
            public final void run() {
                ShareDataConfig.m3(ShareDataConfig.this);
            }
        }, (String) null, Boolean.TRUE, 8, (Object) null);
    }

    public static final void m3(ShareDataConfig shareDataConfig) {
        p.i(shareDataConfig, "this$0");
        shareDataConfig.n3();
    }

    private final void n3() {
        ExtensionsContextKt.q(this, "https://youtu.be/ZxXFowle29I", false, false, false, 14, (Object) null);
    }

    public final void o3() {
        x1(findViewById(2131296767));
        t1(e3().i(), 66603);
        ((HasArgsEdit) this).U[3].setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                ShareDataConfig.p3(ShareDataConfig.this, compoundButton, z);
            }
        });
    }

    public static final void p3(ShareDataConfig shareDataConfig, CompoundButton compoundButton, boolean z) {
        p.i(shareDataConfig, "this$0");
        ((HasArgsEdit) shareDataConfig).v[4].setHint(!z ? x2.Q4(2131891213, shareDataConfig, new Object[0]) : "");
        if (z) {
            qf.j jVar = ((HasArgsEdit) shareDataConfig).A;
            p.h(jVar, "helperHasArgsRx");
            com.joaomgcd.taskerm.helper.i.U(jVar, com.joaomgcd.taskerm.dialog.a.g3(shareDataConfig, 2131890165), (oi.d) null, 2, (Object) null);
        }
    }

    private final ji.r<List<String>> r3(List<String> list) {
        return w0.K0(new g(list));
    }

    private final void s3(ue.b bVar) {
        setResult(-1, new Intent().putExtra(com.joaomgcd.taskerm.datashare.export.d.f(), bVar.U(0).c0()));
    }

    public final void t3(int i2, String str) {
        if (str != null) {
            dq.W2(((HasArgsEdit) this).v[i2], str);
        }
    }

    private final void u3(int i2) {
        this.s0.f(this, w0[1], Integer.valueOf(i2));
    }

    public final void v3() {
        throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.taskerm.datashare.export.ShareDataConfig.v3():void");
    }

    public static final void w3(ShareDataConfig shareDataConfig, View view) {
        p.i(shareDataConfig, "this$0");
        shareDataConfig.A3();
    }

    public static final void x3(ShareDataConfig shareDataConfig, View view) {
        List l;
        p.i(shareDataConfig, "this$0");
        String i3 = shareDataConfig.i3(4);
        if (i3 == null || (l = o.A0(i3, new String[]{","}, false, 0, 6, (Object) null)) == null) {
            l = r.l();
        }
        w0.F1(w0.j1(shareDataConfig.r3(l)), shareDataConfig, shareDataConfig.new h());
    }

    private static final e0 y3(int i2, ShareDataConfig shareDataConfig, Boolean bool) {
        MyCheckBox myCheckBox = ((HasArgsEdit) shareDataConfig).U[i2];
        if (myCheckBox == null) {
            return null;
        }
        myCheckBox.setCheckedNoSignal(bool != null ? bool.booleanValue() : false);
        return e0.a;
    }

    public final void z3(boolean z) {
        this.r0.f(this, w0[0], Boolean.valueOf(z));
    }

    public void U1(int i2) {
        v3();
    }

    public final com.joaomgcd.taskerm.datashare.export.a f3() {
        return (com.joaomgcd.taskerm.datashare.export.a) this.t0.getValue();
    }

    public void g(e5 e5Var, t6 t6Var) {
        p.i(e5Var, "permissions");
        p.i(t6Var, "result");
    }

    public Void O0() {
        return null;
    }

    public void onBackPressed() {
        q3();
    }

    public void onClick(View view) {
    }

    @SuppressLint({"MissingSuperCall"})
    public void onCreate(Bundle bundle) {
        super.p1(bundle, 2131492909);
        r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Started share link activity");
        w0.m0(new e(bundle));
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        p.i(menu, "menu");
        boolean r1 = super.r1(menu, 2131888880, -1);
        menu.add(0, this.u0, 0, x2.Q4(2131890024, this, new Object[0]));
        menu.add(0, this.v0, 0, x2.Q4(2131889496, this, new Object[0]));
        return r1;
    }

    public void onDestroy() {
        super.onDestroy();
        r7.f(com.joaomgcd.taskerm.datashare.export.d.h(), "Destroyed");
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        p.i(menuItem, "item");
        if (menuItem.getItemId() == 6) {
            finish();
            return true;
        }
        if (menuItem.getItemId() == 16908332) {
            q3();
            return true;
        }
        if (menuItem.getItemId() == this.v0) {
            w0.m0(new f());
            return true;
        }
        if (menuItem.getItemId() != this.u0) {
            return s1(menuItem, (String) null, "sharecreation.html");
        }
        n3();
        return true;
    }

    public void onProgressChanged(SeekBar seekBar, int i2, boolean z) {
    }

    public void onStartTrackingTouch(SeekBar seekBar) {
    }

    public void onStopTrackingTouch(SeekBar seekBar) {
    }

    public final void q3() {
        ue.b h3 = h3();
        if (h3 == null) {
            return;
        }
        s3(h3);
        finish();
    }
}