导航菜单

页面标题

页面副标题

Tasker v6.5.11 - ActivityAIChat.java 源代码

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

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


package com.joaomgcd.oldtaskercompat.aigenerator.ui;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.activity.ComponentActivity;
import androidx.compose.ui.platform.AndroidCompositionLocals_androidKt;
import androidx.core.app.ShareCompat;
import androidx.lifecycle.t;
import androidx.lifecycle.w0;
import com.joaomgcd.taskerm.action.input.GenericActionPickInput;
import com.joaomgcd.taskerm.util.s6;
import com.joaomgcd.taskerm.util.x2;
import com.joaomgcd.taskerm.util.z2;
import f5.a;
import java.io.OutputStream;
import java.util.List;
import jk.d1;
import jk.j0;
import jk.m2;
import jk.n0;
import jk.p0;
import lj.e0;
import mk.y;
import v0.m3;
import v0.n3;
import v0.q0;
import v0.v1;
import yj.k0;

public final class ActivityAIChat extends Hilt_ActivityAIChat {

    static final class a extends yj.q implements xj.p<v0.n, Integer, e0> {

        static final class C0079a extends yj.q implements xj.p<v0.n, Integer, e0> {
            final ActivityAIChat i;

            static final class C0080a extends yj.q implements xj.a<e0> {
                final ViewModelAiChat i;
                final ActivityAIChat q;

                C0080a(ViewModelAiChat viewModelAiChat, ActivityAIChat activityAIChat) {
                    super(0);
                    this.i = viewModelAiChat;
                    this.q = activityAIChat;
                }

                public final void a() {
                    C0079a.g(this.i, this.q);
                }

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

            @qj.f(c = "com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat$onCreate$1$1$2", f = "ActivityAIChat.kt", l = {143}, m = "invokeSuspend")
            static final class b extends qj.l implements xj.p<n0, oj.d<? super e0>, Object> {
                int t;
                final ViewModelAiChat u;
                final Context v;
                final ActivityAIChat w;
                final b.h<String, Uri> x;
                final v1<l> y;

                @qj.f(c = "com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat$onCreate$1$1$2$1", f = "ActivityAIChat.kt", l = {148, 165}, m = "invokeSuspend")
                static final class C0081a extends qj.l implements xj.p<i, oj.d<? super e0>, Object> {
                    int t;
                    Object u;
                    final Context v;
                    final ActivityAIChat w;
                    final ViewModelAiChat x;
                    final b.h<String, Uri> y;
                    final v1<l> z;

                    static final class C0082a extends yj.q implements xj.l<String, e0> {
                        final ViewModelAiChat i;
                        final i q;

                        C0082a(ViewModelAiChat viewModelAiChat, i iVar) {
                            super(1);
                            this.i = viewModelAiChat;
                            this.q = iVar;
                        }

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

                        public final void invoke(String str) {
                            yj.p.i(str, "it");
                            this.i.d0().d().l(str, ((k) this.q).a());
                        }
                    }

                    C0081a(Context context, ActivityAIChat activityAIChat, ViewModelAiChat viewModelAiChat, b.h<String, Uri> hVar, v1<l> v1Var, oj.d<? super C0081a> dVar) {
                        super(2, dVar);
                        this.v = context;
                        this.w = activityAIChat;
                        this.x = viewModelAiChat;
                        this.y = hVar;
                        this.z = v1Var;
                    }

                    public final oj.d<e0> k(Object obj, oj.d<?> dVar) {
                        C0081a c0081a = new C0081a(this.v, this.w, this.x, this.y, this.z, dVar);
                        c0081a.u = obj;
                        return c0081a;
                    }

                    public final Object r(Object obj) {
                        i iVar;
                        Exception e;
                        Object c = pj.b.c();
                        int i = this.t;
                        try {
                        } catch (Throwable unused) {
                            z2.M0(x2.Q4(2131891134, this.v, new Object[0]), this.v);
                        }
                        if (i != 0) {
                            if (i == 1) {
                                lj.s.b(obj);
                                this.x.l0((String) obj);
                                return e0.a;
                            }
                            if (i != 2) {
                                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                            }
                            iVar = (i) this.u;
                            try {
                                lj.s.b(obj);
                                this.x.d0().d().l((Object) null, ((k) iVar).a());
                                this.x.d0().m().invoke(((k) iVar).a().e());
                            } catch (Exception e2) {
                                e = e2;
                                z2.M0("Error importing: " + e.getMessage(), this.v);
                                k kVar = (k) iVar;
                                this.x.d0().d().l((Object) null, kVar.a());
                                this.x.d0().m().invoke(kVar.a().e());
                                return e0.a;
                            }
                            return e0.a;
                        }
                        lj.s.b(obj);
                        i iVar2 = (i) this.u;
                        if (iVar2 instanceof o) {
                            z2.M0(((o) iVar2).a(), this.v);
                        } else if (iVar2 instanceof m) {
                            ActivityAIChat activityAIChat = this.w;
                            String c2 = ((m) iVar2).a().c();
                            String b = ((m) iVar2).a().b();
                            String a = ((m) iVar2).a().a();
                            List<String> d = ((m) iVar2).a().d();
                            this.t = 1;
                            obj = activityAIChat.M(c2, b, a, d, this);
                            if (obj == c) {
                                return c;
                            }
                            this.x.l0((String) obj);
                        } else if (iVar2 instanceof k) {
                            try {
                                ji.r<s6> w = com.joaomgcd.taskerm.datashare.export.d.w(this.w, ((k) iVar2).b(), new C0082a(this.x, iVar2));
                                this.u = iVar2;
                                this.t = 2;
                                if (se.f.g(w, this) == c) {
                                    return c;
                                }
                                iVar = iVar2;
                                this.x.d0().d().l((Object) null, ((k) iVar).a());
                                this.x.d0().m().invoke(((k) iVar).a().e());
                            } catch (Exception e3) {
                                iVar = iVar2;
                                e = e3;
                                z2.M0("Error importing: " + e.getMessage(), this.v);
                                k kVar2 = (k) iVar;
                                this.x.d0().d().l((Object) null, kVar2.a());
                                this.x.d0().m().invoke(kVar2.a().e());
                                return e0.a;
                            }
                        } else if (iVar2 instanceof l) {
                            l lVar = (l) iVar2;
                            C0079a.k(this.z, lVar);
                            this.y.a(lVar.b());
                        } else if (iVar2 instanceof j) {
                            C0079a.g(this.x, this.w);
                        }
                        return e0.a;
                    }

                    public final Object l(i iVar, oj.d<? super e0> dVar) {
                        return k(iVar, dVar).r(e0.a);
                    }
                }

                b(ViewModelAiChat viewModelAiChat, Context context, ActivityAIChat activityAIChat, b.h<String, Uri> hVar, v1<l> v1Var, oj.d<? super b> dVar) {
                    super(2, dVar);
                    this.u = viewModelAiChat;
                    this.v = context;
                    this.w = activityAIChat;
                    this.x = hVar;
                    this.y = v1Var;
                }

                public final oj.d<e0> k(Object obj, oj.d<?> dVar) {
                    return new b(this.u, this.v, this.w, this.x, this.y, dVar);
                }

                public final Object r(Object obj) {
                    Object c = pj.b.c();
                    int i = this.t;
                    if (i == 0) {
                        lj.s.b(obj);
                        y<i> g0 = this.u.g0();
                        C0081a c0081a = new C0081a(this.v, this.w, this.u, this.x, this.y, null);
                        this.t = 1;
                        if (mk.g.g(g0, c0081a, this) == c) {
                            return c;
                        }
                    } else {
                        if (i != 1) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        lj.s.b(obj);
                    }
                    return e0.a;
                }

                public final Object l(n0 n0Var, oj.d<? super e0> dVar) {
                    return k(n0Var, dVar).r(e0.a);
                }
            }

            static final class c extends yj.q implements xj.l<Uri, e0> {
                final ActivityAIChat i;
                final Context q;
                final v1<l> r;

                @qj.f(c = "com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat$onCreate$1$1$saveFileLauncher$1$1", f = "ActivityAIChat.kt", l = {104}, m = "invokeSuspend")
                static final class C0083a extends qj.l implements xj.p<n0, oj.d<? super e0>, Object> {
                    int t;
                    final Context u;
                    final Uri v;
                    final l w;
                    final ActivityAIChat x;
                    final v1<l> y;

                    @qj.f(c = "com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat$onCreate$1$1$saveFileLauncher$1$1$1", f = "ActivityAIChat.kt", l = {109}, m = "invokeSuspend")
                    static final class C0084a extends qj.l implements xj.l<oj.d<? super e0>, Object> {
                        int t;
                        final Context u;
                        final Uri v;
                        final l w;
                        final ActivityAIChat x;
                        final v1<l> y;

                        @qj.f(c = "com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat$onCreate$1$1$saveFileLauncher$1$1$1$2", f = "ActivityAIChat.kt", l = {}, m = "invokeSuspend")
                        static final class C0085a extends qj.l implements xj.l<oj.d<? super e0>, Object> {
                            int t;
                            final Context u;
                            final Uri v;
                            final ActivityAIChat w;

                            C0085a(Context context, Uri uri, ActivityAIChat activityAIChat, oj.d<? super C0085a> dVar) {
                                super(1, dVar);
                                this.u = context;
                                this.v = uri;
                                this.w = activityAIChat;
                            }

                            public final Object r(Object obj) {
                                pj.b.c();
                                if (this.t != 0) {
                                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                                }
                                lj.s.b(obj);
                                Intent addFlags = new ShareCompat.IntentBuilder(this.u).setType("text/plain").setStream(this.v).setSubject(this.w.getString(2131890715)).getIntent().addFlags(1);
                                yj.p.h(addFlags, "addFlags(...)");
                                this.u.startActivity(Intent.createChooser(addFlags, this.w.getString(2131890559)));
                                return e0.a;
                            }

                            public final oj.d<e0> u(oj.d<?> dVar) {
                                return new C0085a(this.u, this.v, this.w, dVar);
                            }

                            public final Object invoke(oj.d<? super e0> dVar) {
                                return u(dVar).r(e0.a);
                            }
                        }

                        C0084a(Context context, Uri uri, l lVar, ActivityAIChat activityAIChat, v1<l> v1Var, oj.d<? super C0084a> dVar) {
                            super(1, dVar);
                            this.u = context;
                            this.v = uri;
                            this.w = lVar;
                            this.x = activityAIChat;
                            this.y = v1Var;
                        }

                        public final Object r(Object obj) {
                            Object c = pj.b.c();
                            int i = this.t;
                            if (i == 0) {
                                lj.s.b(obj);
                                OutputStream openOutputStream = this.u.getContentResolver().openOutputStream(this.v);
                                if (openOutputStream != null) {
                                    try {
                                        byte[] bytes = this.w.a().getBytes(hk.d.b);
                                        yj.p.h(bytes, "getBytes(...)");
                                        openOutputStream.write(bytes);
                                        e0 e0Var = e0.a;
                                        vj.b.a(openOutputStream, (Throwable) null);
                                    } finally {
                                    }
                                }
                                ActivityAIChat activityAIChat = this.x;
                                Context context = this.u;
                                v1<l> v1Var = this.y;
                                m2 c2 = d1.c();
                                C0085a c0085a = new C0085a(this.u, this.v, this.x, null);
                                this.t = 1;
                                if (C0083a.x(activityAIChat, context, v1Var, c2, c0085a, this) == c) {
                                    return c;
                                }
                            } else {
                                if (i != 1) {
                                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                                }
                                lj.s.b(obj);
                            }
                            return e0.a;
                        }

                        public final oj.d<e0> u(oj.d<?> dVar) {
                            return new C0084a(this.u, this.v, this.w, this.x, this.y, dVar);
                        }

                        public final Object invoke(oj.d<? super e0> dVar) {
                            return u(dVar).r(e0.a);
                        }
                    }

                    @qj.f(c = "com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat$onCreate$1$1$saveFileLauncher$1$1$runSafely$2", f = "ActivityAIChat.kt", l = {91, 97, 97, 97}, m = "invokeSuspend")
                    static final class b extends qj.l implements xj.p<n0, oj.d<? super e0>, Object> {
                        Object t;
                        int u;
                        final xj.l<oj.d<? super e0>, Object> v;
                        final ActivityAIChat w;
                        final Context x;
                        final v1<l> y;

                        @qj.f(c = "com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat$onCreate$1$1$saveFileLauncher$1$1$runSafely$2$1", f = "ActivityAIChat.kt", l = {}, m = "invokeSuspend")
                        static final class C0086a extends qj.l implements xj.p<n0, oj.d<? super e0>, Object> {
                            int t;
                            final v1<l> u;

                            C0086a(v1<l> v1Var, oj.d<? super C0086a> dVar) {
                                super(2, dVar);
                                this.u = v1Var;
                            }

                            public final oj.d<e0> k(Object obj, oj.d<?> dVar) {
                                return new C0086a(this.u, dVar);
                            }

                            public final Object r(Object obj) {
                                pj.b.c();
                                if (this.t != 0) {
                                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                                }
                                lj.s.b(obj);
                                C0079a.k(this.u, null);
                                return e0.a;
                            }

                            public final Object l(n0 n0Var, oj.d<? super e0> dVar) {
                                return k(n0Var, dVar).r(e0.a);
                            }
                        }

                        b(xj.l<? super oj.d<? super e0>, ? extends Object> lVar, ActivityAIChat activityAIChat, Context context, v1<l> v1Var, oj.d<? super b> dVar) {
                            super(2, dVar);
                            this.v = lVar;
                            this.w = activityAIChat;
                            this.x = context;
                            this.y = v1Var;
                        }

                        public final oj.d<e0> k(Object obj, oj.d<?> dVar) {
                            return new b(this.v, this.w, this.x, this.y, dVar);
                        }

                        public final Object r(Object obj) {
                            int i = 1;
                            Object c = pj.b.c();
                            int i2 = this.u;
                            try {
                            } catch (Throwable th) {
                                try {
                                    th.printStackTrace();
                                    ComponentActivity componentActivity = this.w;
                                    Object[] objArr = new Object[i];
                                    objArr[0] = th.getMessage();
                                    z2.M0(componentActivity.getString(2131887739, objArr), this.x);
                                    m2 c2 = d1.c();
                                    C0086a c0086a = new C0086a(this.y, null);
                                    this.u = 3;
                                    if (jk.i.g(c2, c0086a, this) == c) {
                                        return c;
                                    }
                                } catch (Throwable th2) {
                                    m2 c3 = d1.c();
                                    C0086a c0086a2 = new C0086a(this.y, null);
                                    this.t = th2;
                                    this.u = 4;
                                    if (jk.i.g(c3, c0086a2, this) == c) {
                                        return c;
                                    }
                                    throw th2;
                                }
                            }
                            if (i2 == 0) {
                                lj.s.b(obj);
                                xj.l<oj.d<? super e0>, Object> lVar = this.v;
                                this.u = 1;
                                if (lVar.invoke(this) == c) {
                                    return c;
                                }
                            } else {
                                if (i2 != 1) {
                                    if (i2 == 2 || i2 == 3) {
                                        lj.s.b(obj);
                                        return e0.a;
                                    }
                                    if (i2 != 4) {
                                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                                    }
                                    Throwable th3 = (Throwable) this.t;
                                    lj.s.b(obj);
                                    throw th3;
                                }
                                lj.s.b(obj);
                            }
                            m2 c4 = d1.c();
                            i = new C0086a(this.y, null);
                            this.u = 2;
                            if (jk.i.g(c4, (xj.p) i, this) == c) {
                                return c;
                            }
                            return e0.a;
                        }

                        public final Object l(n0 n0Var, oj.d<? super e0> dVar) {
                            return k(n0Var, dVar).r(e0.a);
                        }
                    }

                    C0083a(Context context, Uri uri, l lVar, ActivityAIChat activityAIChat, v1<l> v1Var, oj.d<? super C0083a> dVar) {
                        super(2, dVar);
                        this.u = context;
                        this.v = uri;
                        this.w = lVar;
                        this.x = activityAIChat;
                        this.y = v1Var;
                    }

                    public static final Object x(ActivityAIChat activityAIChat, Context context, v1<l> v1Var, oj.g gVar, xj.l<? super oj.d<? super e0>, ? extends Object> lVar, oj.d<? super e0> dVar) {
                        Object g = jk.i.g(gVar, new b(lVar, activityAIChat, context, v1Var, null), dVar);
                        return g == pj.b.c() ? g : e0.a;
                    }

                    public final oj.d<e0> k(Object obj, oj.d<?> dVar) {
                        return new C0083a(this.u, this.v, this.w, this.x, this.y, dVar);
                    }

                    public final Object r(Object obj) {
                        Object c = pj.b.c();
                        int i = this.t;
                        if (i == 0) {
                            lj.s.b(obj);
                            ActivityAIChat activityAIChat = this.x;
                            Context context = this.u;
                            v1<l> v1Var = this.y;
                            j0 b2 = d1.b();
                            C0084a c0084a = new C0084a(this.u, this.v, this.w, this.x, this.y, null);
                            this.t = 1;
                            if (x(activityAIChat, context, v1Var, b2, c0084a, this) == c) {
                                return c;
                            }
                        } else {
                            if (i != 1) {
                                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                            }
                            lj.s.b(obj);
                        }
                        return e0.a;
                    }

                    public final Object l(n0 n0Var, oj.d<? super e0> dVar) {
                        return k(n0Var, dVar).r(e0.a);
                    }
                }

                c(ActivityAIChat activityAIChat, Context context, v1<l> v1Var) {
                    super(1);
                    this.i = activityAIChat;
                    this.q = context;
                    this.r = v1Var;
                }

                public final void a(Uri uri) {
                    l i = C0079a.i(this.r);
                    if (uri != null && i != null) {
                        jk.i.d(t.a(this.i), d1.b(), (p0) null, new C0083a(this.q, uri, i, this.i, this.r, null), 2, (Object) null);
                    } else {
                        z2.M0(this.i.getString(2131890254), this.q);
                        C0079a.k(this.r, null);
                    }
                }

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

            C0079a(ActivityAIChat activityAIChat) {
                super(2);
                this.i = activityAIChat;
            }

            public static final void g(ViewModelAiChat viewModelAiChat, ActivityAIChat activityAIChat) {
                viewModelAiChat.d0().k().invoke();
                activityAIChat.setResult(-1);
                activityAIChat.finish();
            }

            public static final l i(v1<l> v1Var) {
                return (l) v1Var.getValue();
            }

            public static final void k(v1<l> v1Var, l lVar) {
                v1Var.setValue(lVar);
            }

            public final void f(v0.n nVar, int i) {
                if ((i & 11) == 2 && nVar.w()) {
                    nVar.C();
                    return;
                }
                if (v0.q.J()) {
                    v0.q.S(-2055123869, i, -1, "com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat.onCreate.<anonymous>.<anonymous> (ActivityAIChat.kt:73)");
                }
                Context context = (Context) nVar.n(AndroidCompositionLocals_androidKt.g());
                nVar.f(1729797275);
                androidx.lifecycle.j a = g5.a.a.a(nVar, 6);
                if (a == null) {
                    throw new IllegalStateException("No ViewModelStoreOwner was provided via LocalViewModelStoreOwner");
                }
                ViewModelAiChat b2 = g5.c.b(k0.b(ViewModelAiChat.class), a, (String) null, (w0.c) null, a instanceof androidx.lifecycle.j ? a.h() : a.a.b, nVar, 0, 0);
                nVar.R();
                ViewModelAiChat viewModelAiChat = b2;
                nVar.V(1701799679);
                Object g = nVar.g();
                if (g == v0.n.a.a()) {
                    g = n3.j((Object) null, (m3) null, 2, (Object) null);
                    nVar.M(g);
                }
                v1 v1Var = (v1) g;
                nVar.L();
                b.h a2 = b.c.a(new e.b("text/plain"), new c(this.i, context, v1Var), nVar, 8);
                b.d.a(false, new C0080a(viewModelAiChat, this.i), nVar, 0, 1);
                q0.f(viewModelAiChat, new b(viewModelAiChat, context, this.i, a2, v1Var, null), nVar, 72);
                e.j(viewModelAiChat, nVar, 8);
                if (v0.q.J()) {
                    v0.q.R();
                }
            }

            public Object l(Object obj, Object obj2) {
                f((v0.n) obj, ((Number) obj2).intValue());
                return e0.a;
            }
        }

        a() {
            super(2);
        }

        public final void a(v0.n nVar, int i) {
            if ((i & 11) == 2 && nVar.w()) {
                nVar.C();
                return;
            }
            if (v0.q.J()) {
                v0.q.S(1635130669, i, -1, "com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat.onCreate.<anonymous> (ActivityAIChat.kt:72)");
            }
            md.e.a(false, false, d1.c.e(-2055123869, true, new C0079a(ActivityAIChat.this), nVar, 54), nVar, 384, 3);
            if (v0.q.J()) {
                v0.q.R();
            }
        }

        public Object l(Object obj, Object obj2) {
            a((v0.n) obj, ((Number) obj2).intValue());
            return e0.a;
        }
    }

    public final Object M(String str, String str2, String str3, List<String> list, oj.d<? super String> dVar) {
        ji.r b;
        b = GenericActionPickInput.Companion.b(this, str, (r18 & 4) != 0 ? null : str2, (r18 & 8) != 0 ? null : str3, (r18 & 16) != 0 ? null : null, (r18 & 32) != 0 ? false : false, (r18 & 64) != 0 ? null : null);
        return se.f.g(b, dVar);
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        b.e.b(this, (v0.s) null, d1.c.c(1635130669, true, new a()), 1, (Object) null);
    }
}