From f6627fcabb4363d28d80f661f1c93449661d6d88 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray <57103426+arifBurakDemiray@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:12:05 +0300 Subject: [PATCH] feat: add required time params (#81) --- .../ly/count/sdk/java/internal/ModuleRequests.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sdk-java/src/main/java/ly/count/sdk/java/internal/ModuleRequests.java b/sdk-java/src/main/java/ly/count/sdk/java/internal/ModuleRequests.java index d83af81c7..6931ba2b6 100644 --- a/sdk-java/src/main/java/ly/count/sdk/java/internal/ModuleRequests.java +++ b/sdk-java/src/main/java/ly/count/sdk/java/internal/ModuleRequests.java @@ -1,7 +1,6 @@ package ly.count.sdk.java.internal; import java.util.concurrent.Future; - import ly.count.sdk.java.User; /** @@ -181,6 +180,13 @@ public static void injectParams(CtxCore ctx, ParamsInjector injector) { } } + static void addRequiredTimeParams(Request request) { + request.params.add("timestamp", Device.dev.uniqueTimestamp()) + .add("tz", Device.dev.getTimezoneOffset()) + .add("hour", Device.dev.currentHour()) + .add("dow", Device.dev.currentDayOfWeek()); + } + static Request addRequired(InternalConfig config, Request request) { if (request.isEmpty()) { @@ -246,10 +252,7 @@ public static Future pushAsync(final CtxCore ctx, final Request request return null; } - request.params.add("timestamp", Device.dev.uniqueTimestamp()) - .add("tz", Device.dev.getTimezoneOffset()) - .add("hour", Device.dev.currentHour()) - .add("dow", Device.dev.currentDayOfWeek()); + addRequiredTimeParams(request); return Storage.pushAsync(ctx, request, param -> { SDKCore.instance.onRequest(ctx, request);