Skip to content

Commit

Permalink
feat: add required time params (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
arifBurakDemiray authored Sep 27, 2023
1 parent e01ae5e commit f6627fc
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ly.count.sdk.java.internal;

import java.util.concurrent.Future;

import ly.count.sdk.java.User;

/**
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -246,10 +252,7 @@ public static Future<Boolean> 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);
Expand Down

0 comments on commit f6627fc

Please sign in to comment.