导航菜单

页面标题

页面副标题

OVO v3.139.0 - LiveChatFloatingWidgetService.java 源代码

正在查看: OVO v3.139.0 应用的 LiveChatFloatingWidgetService.java JAVA 源代码文件

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


package ovo.id.user.helpcenter.presentation.widget;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import android.view.GestureDetector;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import kotlin.Metadata;
import o.i.abc;
import o.i.akb;
import o.i.b7c;
import o.i.gle;
import o.i.gq4;
import o.i.hc6;
import o.i.im8;
import o.i.od2;
import o.i.oye;
import o.i.p1c;
import o.i.pvm;
import o.i.pzg;
import o.i.ua8;
import o.i.vk7;
import o.i.vuc;
import o.i.xn2;
import o.i.zu5;
import ovo.id.user.helpcenter.presentation.activity.LiveChatActivity;
import vkey.android.vos.VosWrapper;
import zendesk.chat.Chat;
import zendesk.chat.ChatInfo;
import zendesk.chat.ChatProvider;
import zendesk.chat.Providers;

@Metadata(d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003:\u0002\n\u000bB\u0007¢\u0006\u0004\b\b\u0010\tJ\u0012\u0010\u0007\u001a\u00020\u00062\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016¨\u0006\f"}, d2 = {"Lovo/id/user/helpcenter/presentation/widget/LiveChatFloatingWidgetService;", "Landroid/app/Service;", "Landroid/view/View$OnTouchListener;", "Landroid/view/View$OnClickListener;", "Landroid/view/View;", "v", "Lo/i/p1g;", "onClick", "<init>", "()V", "a", "b", "helpcenter-ui_release"}, k = 1, mv = {1, 8, 0})
public final class LiveChatFloatingWidgetService extends Service implements View.OnTouchListener, View.OnClickListener {
    public static final a k = new a();
    public static boolean l;
    public akb a;
    public final oye b = im8.b(c.b);
    public final oye c = im8.b(new d());
    public final oye d = im8.b(new f());
    public WindowManager e;
    public View f;
    public int g;
    public int h;
    public float i;
    public float j;

    public static final class a {
        public static void b(Context context) {
            vk7.f(context, "context");
            context.stopService(new Intent(context, (Class<?>) LiveChatFloatingWidgetService.class));
            LiveChatFloatingWidgetService.l = false;
        }

        public final synchronized boolean a() {
            return LiveChatFloatingWidgetService.l;
        }
    }

    public final class b extends GestureDetector.SimpleOnGestureListener {
        @Override
        public final boolean onSingleTapUp(MotionEvent motionEvent) {
            vk7.f(motionEvent, "e");
            return true;
        }
    }

    public static final class c extends ua8 implements zu5<ChatProvider> {
        public static final c b = new c();

        public c() {
            super(0);
        }

        public final Object invoke() {
            Providers providers = Chat.INSTANCE.providers();
            if (providers != null) {
                return providers.chatProvider();
            }
            return null;
        }
    }

    public static final class d extends ua8 implements zu5<GestureDetector> {
        public d() {
            super(0);
        }

        public final Object invoke() {
            return new GestureDetector(LiveChatFloatingWidgetService.this, new b());
        }
    }

    public static final class e extends pzg<ChatInfo> {
        public e() {
        }

        public final void onError(gq4 gq4Var) {
            LiveChatFloatingWidgetService liveChatFloatingWidgetService = LiveChatFloatingWidgetService.this;
            akb akbVar = liveChatFloatingWidgetService.a;
            if (akbVar == null) {
                vk7.m("preferenceManager");
                throw null;
            }
            akbVar.b(vuc.a(gle.class)).w(false);
            LiveChatFloatingWidgetService.l = false;
            liveChatFloatingWidgetService.stopSelf();
        }

        public final void onSuccess(Object obj) {
            View rootView;
            ChatInfo chatInfo = (ChatInfo) obj;
            LiveChatFloatingWidgetService liveChatFloatingWidgetService = LiveChatFloatingWidgetService.this;
            akb akbVar = liveChatFloatingWidgetService.a;
            if (akbVar == null) {
                vk7.m("preferenceManager");
                throw null;
            }
            boolean z = false;
            akbVar.b(vuc.a(gle.class)).w(chatInfo != null ? chatInfo.isChatting() : false);
            a aVar = LiveChatFloatingWidgetService.k;
            LiveChatFloatingWidgetService.l = chatInfo != null ? chatInfo.isChatting() : false;
            if (chatInfo != null && chatInfo.isChatting()) {
                z = true;
            }
            if (!z) {
                liveChatFloatingWidgetService.stopSelf();
                return;
            }
            try {
                View inflate = LayoutInflater.from(new od2(liveChatFloatingWidgetService, abc.Theme_AppTheme)).inflate(b7c.view_live_chat_floating_widget, (ViewGroup) null);
                liveChatFloatingWidgetService.f = inflate;
                if (inflate != null && (rootView = inflate.getRootView()) != null) {
                    rootView.setOnTouchListener(liveChatFloatingWidgetService);
                    rootView.setOnClickListener(liveChatFloatingWidgetService);
                }
                Object systemService = liveChatFloatingWidgetService.getSystemService("window");
                vk7.d(systemService, "null cannot be cast to non-null type android.view.WindowManager");
                WindowManager windowManager = (WindowManager) systemService;
                liveChatFloatingWidgetService.e = windowManager;
                windowManager.addView(liveChatFloatingWidgetService.f, liveChatFloatingWidgetService.a());
            } catch (Exception unused) {
            }
        }
    }

    public static final class f extends ua8 implements zu5<WindowManager.LayoutParams> {
        public f() {
            super(0);
        }

        public final Object invoke() {
            a aVar = LiveChatFloatingWidgetService.k;
            LiveChatFloatingWidgetService liveChatFloatingWidgetService = LiveChatFloatingWidgetService.this;
            liveChatFloatingWidgetService.getClass();
            WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(-2, -2, Build.VERSION.SDK_INT < 26 ? 2002 : 2038, 8, -3);
            layoutParams.gravity = 8388693;
            layoutParams.y = liveChatFloatingWidgetService.getResources().getDimensionPixelSize(p1c.spacing_ravier_64);
            return layoutParams;
        }
    }

    public final WindowManager.LayoutParams a() {
        return (WindowManager.LayoutParams) this.d.getValue();
    }

    @Override
    public final IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onClick(View view) {
        Intent intent = new Intent(this, (Class<?>) LiveChatActivity.class);
        intent.addFlags(VosWrapper.Callback.CODE_INJECTION_CHECK_ID);
        startActivity(intent);
    }

    @Override
    public final void onCreate() {
        super.onCreate();
        xn2 xn2Var = hc6.a;
        if (xn2Var == null) {
            vk7.m("helpCenterComponent");
            throw null;
        }
        akb H = xn2Var.a.H();
        pvm.p(H);
        this.a = H;
        ChatProvider chatProvider = (ChatProvider) this.b.getValue();
        if (chatProvider != null) {
            chatProvider.getChatInfo(new e());
        }
    }

    @Override
    public final void onDestroy() {
        try {
            View view = this.f;
            if ((view != null ? view.getWindowToken() : null) != null) {
                Object systemService = getSystemService("window");
                vk7.d(systemService, "null cannot be cast to non-null type android.view.WindowManager");
                WindowManager windowManager = (WindowManager) systemService;
                this.e = windowManager;
                windowManager.removeView(this.f);
            }
        } catch (Exception unused) {
        }
        super.onDestroy();
    }

    @Override
    public final boolean onTouch(View view, MotionEvent motionEvent) {
        vk7.f(motionEvent, "event");
        if (!((GestureDetector) this.c.getValue()).onTouchEvent(motionEvent)) {
            int action = motionEvent.getAction();
            if (action == 0) {
                this.g = a().x;
                this.h = a().y;
                this.i = motionEvent.getRawX();
                this.j = motionEvent.getRawY();
            } else {
                if (action != 2) {
                    return false;
                }
                a().x = this.g - ((int) (motionEvent.getRawX() - this.i));
                a().y = this.h - ((int) (motionEvent.getRawY() - this.j));
                WindowManager windowManager = this.e;
                if (windowManager != null) {
                    windowManager.updateViewLayout(this.f, a());
                }
            }
        } else if (view != null) {
            view.performClick();
        }
        return true;
    }
}