Panagiotis Triantafyllou

retrofit fixes

......@@ -100,7 +100,7 @@
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_active_coupons.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_active_gifts.xml" value="0.36666666666666664" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_active_rewards.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_base_fragment.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_base_fragment.xml" value="0.25" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_bill_payment.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_contextual.xml" value="0.36666666666666664" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/activity_coupon_gift.xml" value="0.36666666666666664" />
......@@ -133,7 +133,7 @@
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/dl_share.xml" value="0.36666666666666664" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/dlg_success.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/expired_coupon_layout.xml" value="0.36666666666666664" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/fragment_home.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/fragment_home.xml" value="0.22" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/fragment_loyalty.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/fragment_profile.xml" value="0.358695652173913" />
<entry key="..\:/Users/Warply/Documents/Warply/Android/warply_android_sdk_maven_plugin/warply_android_sdk/src/main/res/layout/gift_layout.xml" value="0.358695652173913" />
......
......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("6010139202"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, live 3000184910
.setGuid("6005892749"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc20'
PUBLISH_VERSION = '4.5.4.6rc21'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......@@ -42,6 +42,7 @@ android {
dependencies {
//------------------------------ Support -----------------------------//
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
......
......@@ -7,6 +7,7 @@ import android.os.Looper;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
......@@ -136,28 +137,27 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
// Inner and Anonymous Classes
// ===========================================================
private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
private final CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(ArrayList<Campaign> result) {
Toast.makeText(BaseFragmentActivity.this, "Campaigns Success", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Toast.makeText(BaseFragmentActivity.this, "Campaigns Error", Toast.LENGTH_SHORT).show();
}
};
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
Toast.makeText(BaseFragmentActivity.this, "Coupons Success " + String.valueOf(result.size()), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Toast.makeText(BaseFragmentActivity.this, "Coupons Error", Toast.LENGTH_SHORT).show();
}
};
......
......@@ -325,7 +325,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
String message = result.optString("msg", "");
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
runOnUiThread(() -> {
if (status == 1)
acceptSharingDialog();
......
......@@ -212,7 +212,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
showDialog(true, 1);
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
}
}).start();
......
......@@ -9,20 +9,29 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import java.util.ArrayList;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.ActiveCouponsActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.views.adapters.HomeCampaignAdapter;
public class HomeFragment extends Fragment implements View.OnClickListener {
public class HomeFragment extends Fragment implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
private RelativeLayout mOptionOne, mOptionTwo, mOptionThree;
private RecyclerView mRecyclerCampaigns;
......@@ -31,6 +40,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
private TextView mTvUsername, mTvActiveCoupons;
private ConstraintLayout mClActiveCoupons;
private ImageView mIvStepsActivity;
private SwipeRefreshLayout mSwipeRefresh;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
......@@ -40,6 +50,8 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mSwipeRefresh = view.findViewById(R.id.sw_refresh);
mSwipeRefresh.setOnRefreshListener(this);
mOptionOne = view.findViewById(R.id.info_button);
TextView mOptionOneText = mOptionOne.findViewById(R.id.option_text);
ImageView mOptionOneImage = mOptionOne.findViewById(R.id.option_icon);
......@@ -93,6 +105,13 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
}
@Override
public void onRefresh() {
WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
mSwipeRefresh.setRefreshing(false);
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.cl_coupon) {
Intent intent = new Intent(getContext(), ActiveCouponsActivity.class);
......@@ -105,4 +124,29 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
HomeFragment homeFragment = new HomeFragment();
return homeFragment;
}
private final CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(ArrayList<Campaign> result) {
Toast.makeText(getActivity(), "Campaigns Success", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Toast.makeText(getActivity(), "Campaigns Error", Toast.LENGTH_SHORT).show();
}
};
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
Toast.makeText(getActivity(), "Coupons Success " + String.valueOf(result.size()), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Toast.makeText(getActivity(), "Coupons Error", Toast.LENGTH_SHORT).show();
}
};
}
\ No newline at end of file
......
......@@ -38,7 +38,7 @@ public class EventCampaignCouponService extends Worker {
@NonNull
@Override
public Result doWork() {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
return Result.success();
......
......@@ -261,7 +261,7 @@ public class WarplyManagerHelper {
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1) {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), new CallbackReceiver<CouponList>() {
WarplyManager.getUserCouponsWithCouponsets(new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
......@@ -393,7 +393,7 @@ public class WarplyManagerHelper {
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1) {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), new CallbackReceiver<CouponList>() {
WarplyManager.getUserCouponsWithCouponsets(new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
......