导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - SyncUserDataService.java 源代码

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

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


package com.bettertogether.syncUserData.service;

import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.IBinder;
import ce.a;
import com.bettertogether.BetterTogetherApp;
import com.bettertogether.screens.splash.SplashActivity;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.fitness.FitnessOptions;
import com.google.android.gms.fitness.data.DataType;
import et.d;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.u;
import lq.m;
import lq.n;
import lq.o;
import s6.s;
import tf.h;
import y2.v;
import y2.x;

@Metadata
public final class SyncUserDataService extends Service {

    public static final int f5060y = 0;

    public final m f5061d;

    public final m f5062e;

    public Bitmap f5063i;

    public NotificationManager f5064v;

    public final int f5065w;

    public final FitnessOptions f5066x;

    public SyncUserDataService() {
        a aVar = new a(this, 12);
        o oVar = o.f13215d;
        this.f5061d = n.a(oVar, new h(this, aVar, 3));
        this.f5062e = n.a(oVar, new h(this, null, 4));
        this.f5065w = 123;
        FitnessOptions build = FitnessOptions.builder().addDataType(DataType.TYPE_STEP_COUNT_DELTA, 0).addDataType(DataType.AGGREGATE_STEP_COUNT_DELTA, 0).addDataType(DataType.AGGREGATE_CALORIES_EXPENDED, 0).addDataType(DataType.TYPE_HYDRATION, 0).build();
        Intrinsics.checkNotNullExpressionValue(build, "builder()\n        .addDa…SS_READ)\n        .build()");
        this.f5066x = build;
    }

    public static boolean a(DataType... dataTypeArr) {
        FitnessOptions.Builder builder = FitnessOptions.builder();
        Intrinsics.checkNotNullExpressionValue(builder, "builder()");
        for (DataType dataType : dataTypeArr) {
            builder.addDataType(dataType, 0);
        }
        FitnessOptions build = builder.build();
        Intrinsics.checkNotNullExpressionValue(build, "fitnessOptionsBuilder.build()");
        BetterTogetherApp betterTogetherApp = BetterTogetherApp.d;
        return GoogleSignIn.hasPermissions(GoogleSignIn.getLastSignedInAccount(s.j()), build);
    }

    public final yf.m b() {
        return (yf.m) this.f5061d.getValue();
    }

    public final void c() {
        stopForeground(true);
        stopSelf();
        d.d("GoogleFit").a("Service Stopped", new Object[0]);
    }

    public final void d() {
        throw new UnsupportedOperationException("Method not decompiled: com.bettertogether.syncUserData.service.SyncUserDataService.d():void");
    }

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

    @Override
    public final int onStartCommand(Intent intent, int i10, int i11) {
        if ((intent != null ? intent.getAction() : null) != null && u.h(intent.getAction(), "com.bettertogether.us.stopforeground", true)) {
            stopForeground(true);
            stopSelf();
        }
        int i12 = 0;
        d.d("GoogleFit").a("onStartCommand", new Object[0]);
        Intent intent2 = new Intent(this, (Class<?>) SplashActivity.class);
        this.f5063i = BitmapFactory.decodeResource(getResources(), 2131689472);
        if (this.f5064v == null) {
            Object systemService = getSystemService("notification");
            Intrinsics.f(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
            this.f5064v = (NotificationManager) systemService;
        }
        NotificationManager notificationManager = this.f5064v;
        if (notificationManager != null) {
            notificationManager.createNotificationChannelGroup(new NotificationChannelGroup("sync_data", "Sync"));
        }
        NotificationChannel notificationChannel = new NotificationChannel("service_channel", "Service Notifications", 3);
        notificationChannel.enableLights(false);
        notificationChannel.setLockscreenVisibility(-1);
        NotificationManager notificationManager2 = this.f5064v;
        if (notificationManager2 != null) {
            notificationManager2.createNotificationChannel(notificationChannel);
        }
        v vVar = new v(0);
        x xVar = new x(this, "service_channel");
        xVar.f22145w.icon = 2131231141;
        xVar.d("Steps Syncing");
        xVar.f(16, false);
        xVar.c("Touch to open");
        xVar.f22138p = "service";
        xVar.f22145w.when = 0L;
        xVar.f22140r = z2.h.getColor(this, 2131099836);
        xVar.f22132j = 2;
        xVar.f22129g = PendingIntent.getActivity(this, 0, intent2, 201326592);
        xVar.f(2, true);
        Intrinsics.checkNotNullExpressionValue(xVar, "Builder(\n               …        .setOngoing(true)");
        vVar.d("Touch to open");
        xVar.j(vVar);
        Bitmap bitmap = this.f5063i;
        if (bitmap != null) {
            xVar.g(Bitmap.createScaledBitmap(bitmap, 128, 128, false));
        }
        try {
            startForeground(this.f5065w, xVar.a());
        } catch (Exception e10) {
            d.d("GoogleFit").a("Exception Not able to startForegroundService: " + e10, new Object[0]);
        }
        if (!u.h(intent != null ? intent.getAction() : null, "com.bettertogether.us.stopforeground", true)) {
            d.d("GoogleFit").a(og.m.i("checkUserTrialOrSubscription ", b().b.b("greater_then_fourteen", false)), new Object[0]);
            if (!b().b.b("greater_then_fourteen", false) || b().b.c()) {
                d();
            } else {
                b().c(new yf.n(this, i12));
            }
        }
        return 1;
    }
}