Panagiotis Triantafyllou

new keys

......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
.setGuid("7000001315"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta80'
PUBLISH_VERSION = '4.5.4-cosbeta81'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentActivity;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.navigation.NavigationBarView;
import java.util.ArrayList;
import java.util.HashMap;
import ly.warp.sdk.R;
......@@ -183,9 +184,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
};
private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() {
private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(CampaignList result) {
public void onSuccess(ArrayList<Campaign> result) {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
}
......
......@@ -21,6 +21,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject;
import java.util.ArrayList;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
......@@ -290,9 +292,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
}
};
private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() {
private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(CampaignList result) {
public void onSuccess(ArrayList<Campaign> result) {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
WorkManager.getInstance(CouponsetInfoActivity.this).enqueue(mywork);
// Thread.currentThread().interrupt();
......
......@@ -27,6 +27,8 @@ package ly.warp.sdk.io.callbacks;
import org.json.JSONObject;
import java.util.ArrayList;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.NewCampaign;
......@@ -38,10 +40,10 @@ import ly.warp.sdk.io.models.NewCampaignList;
public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<CampaignList> mListener;
private final CallbackReceiver<ArrayList<Campaign>> mListener;
private final String mRequestSignature;
public NewCampaignsHook(CallbackReceiver<CampaignList> listener, String requestSignature) {
public NewCampaignsHook(CallbackReceiver<ArrayList<Campaign>> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
......@@ -52,7 +54,7 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
int status = result.optInt("status", 2);
if (status == 1) {
NewCampaignList cmpList = new NewCampaignList(result, mRequestSignature);
CampaignList tempCampaigns = new CampaignList();
ArrayList<Campaign> tempCampaigns = new ArrayList<>();
for (NewCampaign newCamp : cmpList) {
Campaign camp = new Campaign();
camp.setIndexUrl(newCamp.getIndexUrl());
......
......@@ -10,9 +10,12 @@ import androidx.work.WorkerParameters;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.CouponsetInfoActivity;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.CouponsEventModel;
......@@ -55,9 +58,9 @@ public class EventCampaignCouponService extends Worker {
}
};
private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() {
private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(CampaignList result) {
public void onSuccess(ArrayList<Campaign> result) {
LoyaltyEventModel campaignsAdded = new LoyaltyEventModel();
EventBus.getDefault().post(new WarplyEventBusManager(campaignsAdded));
}
......
......@@ -8,8 +8,11 @@ import androidx.work.WorkerParameters;
import org.json.JSONObject;
import java.util.ArrayList;
import ly.warp.sdk.Warply;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.request.WarplyConsumerRequest;
......@@ -45,9 +48,9 @@ public class EventQuestionnaireService extends Worker {
}
}
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() {
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(CampaignList result) {
public void onSuccess(ArrayList<Campaign> result) {
WarpUtils.log("SUCCESS_QUESTIONNAIRE_EVENT");
}
......
......@@ -67,7 +67,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
private float[] velRing = new float[VEL_RING_SIZE];
private long lastStepTimeNs = 0;
private float oldVelocityEstimate = 0;
private double eventMeters = 0.0d;
private double eventMeters = 0.0d, pacingMeters = 0.0d;
private int sumSteps = 0;
// ===========================================================
......@@ -85,10 +85,11 @@ public class WarplyHealthService extends Service implements SensorEventListener
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
registerStepSensor();
// registerStepSensor();
WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback);
}
@RequiresApi(api = Build.VERSION_CODES.O)
// @RequiresApi(api = Build.VERSION_CODES.O)
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
......@@ -141,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
WarplyManagerHelper.mStepsWebview = 0;
WarplyManagerHelper.mMetersWebview = 0.0d;
eventMeters = 0.0d;
pacingMeters = 0.0d;
sumSteps = 0;
sendSteps();
}
......@@ -222,8 +224,8 @@ public class WarplyHealthService extends Service implements SensorEventListener
// healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022
// healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022
eventMeters = (sumSteps * 0.762);
WarpUtils.log("WIDGET_METERS: " + String.valueOf(eventMeters));
healthSteps.setMeters(eventMeters);
WarpUtils.log("WIDGET_METERS: " + String.valueOf(pacingMeters + eventMeters));
healthSteps.setMeters(pacingMeters + eventMeters);
EventBus.getDefault().post(new WarplyEventBusManager(healthSteps));
lastStepTimeNs = timeNs;
......@@ -292,4 +294,17 @@ public class WarplyHealthService extends Service implements SensorEventListener
});
}
}
private CallbackReceiver<PacingDetails> mPacingCallback = new CallbackReceiver<PacingDetails>() {
@Override
public void onSuccess(PacingDetails result) {
pacingMeters = result.getMeters().getDay().getValue();
registerStepSensor();
}
@Override
public void onFailure(int errorCode) {
}
};
}
......
......@@ -36,12 +36,13 @@ import ly.warp.sdk.utils.WarplyManagerHelper;
public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.MergedGiftsViewHolder> {
private Context mContext;
private ArrayList<MergedGifts> mMergedGifts;
private ArrayList<MergedGifts> mMergedGifts = new ArrayList<>();
private final PublishSubject<MergedGifts> onClickSubject = PublishSubject.create();
public MergedGiftsAdapter(Context mContext, ArrayList<MergedGifts> mergedgifts) {
this.mContext = mContext;
this.mMergedGifts = mergedgifts;
this.mMergedGifts.clear();
this.mMergedGifts.addAll(mergedgifts);
}
public class MergedGiftsViewHolder extends RecyclerView.ViewHolder {
......@@ -64,6 +65,11 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.
return mMergedGifts.size();
}
@Override
public long getItemId(int position) {
// return super.getItemId(position);
return Double.valueOf(Math.random()).longValue();
}
public MergedGifts getItem(int id) {
return mMergedGifts.get(id);
......
......@@ -25,12 +25,13 @@ import ly.warp.sdk.io.models.Campaign;
public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapter.MoreCampaignViewHolder> {
private Context mContext;
private ArrayList<Campaign> mCampaigns;
private ArrayList<Campaign> mCampaigns = new ArrayList<>();
private final PublishSubject<Campaign> onClickSubject = PublishSubject.create();
public MoreCampaignAdapter(Context mContext, ArrayList<Campaign> campaignList) {
this.mContext = mContext;
this.mCampaigns = campaignList;
this.mCampaigns.clear();
this.mCampaigns.addAll(campaignList);
}
public class MoreCampaignViewHolder extends RecyclerView.ViewHolder {
......@@ -67,6 +68,12 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte
}
@Override
public long getItemId(int position) {
// return super.getItemId(position);
return Double.valueOf(Math.random()).longValue();
}
@Override
public MoreCampaignViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
......
......@@ -26,12 +26,13 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAdapter.MoreContextualViewHolder> {
private Context mContext;
private ArrayList<LoyaltyContextualOfferModel> mCampaigns;
private ArrayList<LoyaltyContextualOfferModel> mCampaigns = new ArrayList<>();
private final PublishSubject<LoyaltyContextualOfferModel> onClickSubject = PublishSubject.create();
public MoreContextualAdapter(Context mContext, ArrayList<LoyaltyContextualOfferModel> campaignList) {
this.mContext = mContext;
this.mCampaigns = campaignList;
this.mCampaigns.clear();
this.mCampaigns.addAll(campaignList);
}
public class MoreContextualViewHolder extends RecyclerView.ViewHolder {
......@@ -56,6 +57,11 @@ public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAd
return mCampaigns.size();
}
@Override
public long getItemId(int position) {
// return super.getItemId(position);
return Double.valueOf(Math.random()).longValue();
}
public LoyaltyContextualOfferModel getItem(int id) {
return mCampaigns.get(id);
......
......@@ -40,7 +40,7 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_cos_loyalty_no_border"
......@@ -97,7 +97,6 @@
android:id="@+id/rv_merged_gifts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_gifts_popup"
android:layout_marginTop="4dp"
android:clipToPadding="false"
android:orientation="vertical"
......@@ -213,5 +212,5 @@
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
</RelativeLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fillViewport="true">
android:fillViewport="true"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_more_header"
......@@ -39,10 +40,9 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/cl_more_header"
android:background="@drawable/shape_cos_loyalty_no_border"
android:orientation="vertical">
......@@ -52,7 +52,7 @@
android:fillViewport="true"
android:overScrollMode="never">
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
......@@ -107,21 +107,19 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_more_items"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/ll_more_popup"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:clipToPadding="false"
android:orientation="vertical"
android:overScrollMode="never"
android:paddingTop="44dp"
android:paddingBottom="24dp"
android:overScrollMode="never"
android:visibility="gone" />
<LinearLayout
android:id="@+id/ll_research_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_more_popup"
android:orientation="vertical"
android:paddingTop="44dp"
android:visibility="gone">
......@@ -151,7 +149,6 @@
android:id="@+id/ll_exclusive_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_research_items"
android:orientation="vertical"
android:visibility="gone">
......@@ -180,7 +177,6 @@
android:id="@+id/ll_contest_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_exclusive_items"
android:orientation="vertical"
android:visibility="gone">
......@@ -209,7 +205,6 @@
android:id="@+id/ll_contextual_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_contest_items"
android:orientation="vertical"
android:visibility="gone">
......@@ -233,7 +228,7 @@
android:overScrollMode="never"
android:paddingBottom="4dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......