Showing
8 changed files
with
180 additions
and
79 deletions
... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
2 | 2 | ||
3 | ext { | 3 | ext { |
4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
5 | - PUBLISH_VERSION = '4.5.4.6rc68' | 5 | + PUBLISH_VERSION = '4.5.4.6rc69' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -224,7 +224,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -224,7 +224,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
224 | mIvBarcode.setVisibility(View.GONE); | 224 | mIvBarcode.setVisibility(View.GONE); |
225 | 225 | ||
226 | if (mIsUnified) { | 226 | if (mIsUnified) { |
227 | - mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getInnerText(), HtmlCompat.FROM_HTML_MODE_COMPACT)); | 227 | + mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getName(), HtmlCompat.FROM_HTML_MODE_COMPACT)); |
228 | } else { | 228 | } else { |
229 | mTvCouponCode.setText(mCoupon.getCoupon()); | 229 | mTvCouponCode.setText(mCoupon.getCoupon()); |
230 | mTvCouponTitle.setText(mCoupon.getName()); | 230 | mTvCouponTitle.setText(mCoupon.getName()); | ... | ... |
... | @@ -7,8 +7,6 @@ import android.content.Intent; | ... | @@ -7,8 +7,6 @@ import android.content.Intent; |
7 | import android.content.pm.PackageManager; | 7 | import android.content.pm.PackageManager; |
8 | import android.net.Uri; | 8 | import android.net.Uri; |
9 | import android.os.Bundle; | 9 | import android.os.Bundle; |
10 | -import android.os.Handler; | ||
11 | -import android.os.Looper; | ||
12 | import android.text.TextUtils; | 10 | import android.text.TextUtils; |
13 | import android.util.Log; | 11 | import android.util.Log; |
14 | import android.view.View; | 12 | import android.view.View; |
... | @@ -36,11 +34,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog; | ... | @@ -36,11 +34,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog; |
36 | import com.google.maps.android.clustering.Cluster; | 34 | import com.google.maps.android.clustering.Cluster; |
37 | import com.google.maps.android.clustering.ClusterManager; | 35 | import com.google.maps.android.clustering.ClusterManager; |
38 | 36 | ||
39 | -import org.json.JSONArray; | ||
40 | - | ||
41 | import java.util.ArrayList; | 37 | import java.util.ArrayList; |
42 | -import java.util.concurrent.ExecutorService; | ||
43 | -import java.util.concurrent.Executors; | ||
44 | 38 | ||
45 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 39 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; |
46 | import ly.warp.sdk.R; | 40 | import ly.warp.sdk.R; |
... | @@ -48,7 +42,6 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; | ... | @@ -48,7 +42,6 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; |
48 | import ly.warp.sdk.io.models.Couponset; | 42 | import ly.warp.sdk.io.models.Couponset; |
49 | import ly.warp.sdk.io.models.Merchant; | 43 | import ly.warp.sdk.io.models.Merchant; |
50 | import ly.warp.sdk.io.models.MerchantList; | 44 | import ly.warp.sdk.io.models.MerchantList; |
51 | -import ly.warp.sdk.io.request.WarplyMerchantsRequest; | ||
52 | import ly.warp.sdk.utils.WarplyManagerHelper; | 45 | import ly.warp.sdk.utils.WarplyManagerHelper; |
53 | import ly.warp.sdk.utils.WarplyProperty; | 46 | import ly.warp.sdk.utils.WarplyProperty; |
54 | import ly.warp.sdk.utils.constants.WarpConstants; | 47 | import ly.warp.sdk.utils.constants.WarpConstants; |
... | @@ -187,15 +180,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe | ... | @@ -187,15 +180,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe |
187 | if (mCouponset != null) { | 180 | if (mCouponset != null) { |
188 | ArrayList<String> uuids = new ArrayList<>(); | 181 | ArrayList<String> uuids = new ArrayList<>(); |
189 | uuids.add(mCouponset.getMerchantUuid()); | 182 | uuids.add(mCouponset.getMerchantUuid()); |
190 | - new Thread(() -> { | 183 | + WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback); |
191 | - if (!Thread.currentThread().isInterrupted()) { | ||
192 | - WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest() | ||
193 | - .setIsMultilingual(true) | ||
194 | - .setParentUuids(uuids) | ||
195 | - , mMerchantsCallback); | ||
196 | - } | ||
197 | - Thread.currentThread().interrupt(); | ||
198 | - }).start(); | ||
199 | } else { | 184 | } else { |
200 | ArrayList<String> catuuids = new ArrayList<>(); | 185 | ArrayList<String> catuuids = new ArrayList<>(); |
201 | catuuids.add(WarplyProperty.getAppUuid(this).equals("0086a2088301440792091b9f814c2267") ? "2a6adade35f1484994a3d4c8f006b909" : "adcace6cab6049c7b7271bc85bc2b26d"); | 186 | catuuids.add(WarplyProperty.getAppUuid(this).equals("0086a2088301440792091b9f814c2267") ? "2a6adade35f1484994a3d4c8f006b909" : "adcace6cab6049c7b7271bc85bc2b26d"); |
... | @@ -229,7 +214,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe | ... | @@ -229,7 +214,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe |
229 | dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); | 214 | dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); |
230 | 215 | ||
231 | TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title); | 216 | TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title); |
232 | - pinTitle.setText(merch.getAdminName()); | 217 | + pinTitle.setText(mMerchantParent != null ? mMerchantParent.getAdminName() : merch.getAdminName()); |
233 | 218 | ||
234 | ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo); | 219 | ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo); |
235 | if (!TextUtils.isEmpty(merch.getImgPreview())) { | 220 | if (!TextUtils.isEmpty(merch.getImgPreview())) { |
... | @@ -312,10 +297,14 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe | ... | @@ -312,10 +297,14 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe |
312 | private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() { | 297 | private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() { |
313 | @Override | 298 | @Override |
314 | public void onSuccess(MerchantList result) { | 299 | public void onSuccess(MerchantList result) { |
300 | + if (result.size() == 0) { | ||
301 | + showNoShopsAvailableDialog(); | ||
302 | + return; | ||
303 | + } | ||
304 | + | ||
315 | mMerchantList.clear(); | 305 | mMerchantList.clear(); |
316 | mMerchantList.addAll(result); | 306 | mMerchantList.addAll(result); |
317 | 307 | ||
318 | - new Handler(Looper.getMainLooper()).post(() -> { | ||
319 | // if (mClusterManager != null) { | 308 | // if (mClusterManager != null) { |
320 | // mMap.clear(); | 309 | // mMap.clear(); |
321 | // mClusterManager.clearItems(); | 310 | // mClusterManager.clearItems(); |
... | @@ -325,26 +314,27 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe | ... | @@ -325,26 +314,27 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe |
325 | // mClusterManager.cluster(); | 314 | // mClusterManager.cluster(); |
326 | // } | 315 | // } |
327 | 316 | ||
328 | - int nonNullCoords = 0; | 317 | + int nonNullCoords = 0; |
329 | - for (Merchant merchCoords : result) { | 318 | + for (Merchant merchCoords : result) { |
330 | - if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) { | 319 | + if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) { |
331 | - nonNullCoords++; | 320 | + nonNullCoords++; |
332 | - } | 321 | + } else { |
322 | + mMerchantParent = merchCoords; | ||
333 | } | 323 | } |
324 | + } | ||
334 | 325 | ||
335 | - if (result.size() == 0 || nonNullCoords == 0) { | 326 | + if (nonNullCoords == 0) { |
336 | - showNoShopsAvailableDialog(); | 327 | + showNoShopsAvailableDialog(); |
337 | - return; | 328 | + return; |
338 | - } | 329 | + } |
339 | 330 | ||
340 | - for (Merchant merch : result) { | 331 | + for (Merchant merch : result) { |
341 | - mMap.addMarker(new MarkerOptions() | 332 | + mMap.addMarker(new MarkerOptions() |
342 | - .position(new LatLng(merch.getLatitude(), merch.getLongitude())) | 333 | + .position(new LatLng(merch.getLatitude(), merch.getLongitude())) |
343 | - .anchor(0.5f, 0.5f) | 334 | + .anchor(0.5f, 0.5f) |
344 | - .title(merch.getTitle()) | 335 | + .title(merch.getTitle()) |
345 | - .snippet(merch.getUuid())); | 336 | + .snippet(merch.getUuid())); |
346 | - } | 337 | + } |
347 | - }); | ||
348 | } | 338 | } |
349 | 339 | ||
350 | @Override | 340 | @Override | ... | ... |
... | @@ -7,8 +7,6 @@ import android.content.Intent; | ... | @@ -7,8 +7,6 @@ import android.content.Intent; |
7 | import android.content.pm.PackageManager; | 7 | import android.content.pm.PackageManager; |
8 | import android.net.Uri; | 8 | import android.net.Uri; |
9 | import android.os.Bundle; | 9 | import android.os.Bundle; |
10 | -import android.os.Handler; | ||
11 | -import android.os.Looper; | ||
12 | import android.text.TextUtils; | 10 | import android.text.TextUtils; |
13 | import android.util.Log; | 11 | import android.util.Log; |
14 | import android.view.View; | 12 | import android.view.View; |
... | @@ -43,7 +41,6 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; | ... | @@ -43,7 +41,6 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; |
43 | import ly.warp.sdk.io.models.Couponset; | 41 | import ly.warp.sdk.io.models.Couponset; |
44 | import ly.warp.sdk.io.models.Merchant; | 42 | import ly.warp.sdk.io.models.Merchant; |
45 | import ly.warp.sdk.io.models.MerchantList; | 43 | import ly.warp.sdk.io.models.MerchantList; |
46 | -import ly.warp.sdk.io.request.WarplyMerchantsRequest; | ||
47 | import ly.warp.sdk.utils.WarplyManagerHelper; | 44 | import ly.warp.sdk.utils.WarplyManagerHelper; |
48 | import ly.warp.sdk.utils.WarplyProperty; | 45 | import ly.warp.sdk.utils.WarplyProperty; |
49 | import ly.warp.sdk.utils.constants.WarpConstants; | 46 | import ly.warp.sdk.utils.constants.WarpConstants; |
... | @@ -184,15 +181,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic | ... | @@ -184,15 +181,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic |
184 | if (mCouponset != null) { | 181 | if (mCouponset != null) { |
185 | ArrayList<String> uuids = new ArrayList<>(); | 182 | ArrayList<String> uuids = new ArrayList<>(); |
186 | uuids.add(mCouponset.getMerchantUuid()); | 183 | uuids.add(mCouponset.getMerchantUuid()); |
187 | - new Thread(() -> { | 184 | + WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback); |
188 | - if (!Thread.currentThread().isInterrupted()) { | ||
189 | - WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest() | ||
190 | - .setIsMultilingual(true) | ||
191 | - .setParentUuids(uuids) | ||
192 | - , mMerchantsCallback); | ||
193 | - } | ||
194 | - Thread.currentThread().interrupt(); | ||
195 | - }).start(); | ||
196 | } else { | 185 | } else { |
197 | ArrayList<String> catuuids = new ArrayList<>(); | 186 | ArrayList<String> catuuids = new ArrayList<>(); |
198 | catuuids.add(WarplyProperty.getAppUuid(this).equals("0086a2088301440792091b9f814c2267") ? "2a6adade35f1484994a3d4c8f006b909" : "adcace6cab6049c7b7271bc85bc2b26d"); | 187 | catuuids.add(WarplyProperty.getAppUuid(this).equals("0086a2088301440792091b9f814c2267") ? "2a6adade35f1484994a3d4c8f006b909" : "adcace6cab6049c7b7271bc85bc2b26d"); |
... | @@ -226,7 +215,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic | ... | @@ -226,7 +215,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic |
226 | dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); | 215 | dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); |
227 | 216 | ||
228 | TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title); | 217 | TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title); |
229 | - pinTitle.setText(merch.getAdminName()); | 218 | + pinTitle.setText(mMerchantParent != null ? mMerchantParent.getAdminName() : merch.getAdminName()); |
230 | 219 | ||
231 | ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo); | 220 | ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo); |
232 | if (!TextUtils.isEmpty(merch.getImgPreview())) { | 221 | if (!TextUtils.isEmpty(merch.getImgPreview())) { |
... | @@ -325,10 +314,14 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic | ... | @@ -325,10 +314,14 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic |
325 | private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() { | 314 | private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() { |
326 | @Override | 315 | @Override |
327 | public void onSuccess(MerchantList result) { | 316 | public void onSuccess(MerchantList result) { |
317 | + if (result.size() == 0) { | ||
318 | + showNoShopsAvailableDialog(); | ||
319 | + return; | ||
320 | + } | ||
321 | + | ||
328 | mMerchantList.clear(); | 322 | mMerchantList.clear(); |
329 | mMerchantList.addAll(result); | 323 | mMerchantList.addAll(result); |
330 | 324 | ||
331 | - new Handler(Looper.getMainLooper()).post(() -> { | ||
332 | // if (mClusterManager != null) { | 325 | // if (mClusterManager != null) { |
333 | // mMap.clear(); | 326 | // mMap.clear(); |
334 | // mClusterManager.clearItems(); | 327 | // mClusterManager.clearItems(); |
... | @@ -338,27 +331,28 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic | ... | @@ -338,27 +331,28 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic |
338 | // mClusterManager.cluster(); | 331 | // mClusterManager.cluster(); |
339 | // } | 332 | // } |
340 | 333 | ||
341 | - int nonNullCoords = 0; | 334 | + int nonNullCoords = 0; |
342 | - for (Merchant merchCoords : result) { | 335 | + for (Merchant merchCoords : result) { |
343 | - if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) { | 336 | + if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) { |
344 | - nonNullCoords++; | 337 | + nonNullCoords++; |
345 | - } | 338 | + } else { |
339 | + mMerchantParent = merchCoords; | ||
346 | } | 340 | } |
341 | + } | ||
347 | 342 | ||
348 | - if (result.size() == 0 || nonNullCoords == 0) { | 343 | + if (nonNullCoords == 0) { |
349 | - showNoShopsAvailableDialog(); | 344 | + showNoShopsAvailableDialog(); |
350 | - return; | 345 | + return; |
351 | - } | 346 | + } |
352 | 347 | ||
353 | - for (Merchant merch : result) { | 348 | + for (Merchant merch : result) { |
354 | - mMap.addMarker(new MarkerOptions() | 349 | + mMap.addMarker(new MarkerOptions() |
355 | - .position(new LatLng(merch.getLatitude(), merch.getLongitude())) | 350 | + .position(new LatLng(merch.getLatitude(), merch.getLongitude())) |
356 | - .anchor(0.5f, 0.5f) | 351 | + .anchor(0.5f, 0.5f) |
357 | - .title(merch.getTitle()) | 352 | + .title(merch.getTitle()) |
358 | - .snippet(merch.getUuid()) | 353 | + .snippet(merch.getUuid()) |
359 | - .clusterable(true)); | 354 | + .clusterable(true)); |
360 | - } | 355 | + } |
361 | - }); | ||
362 | } | 356 | } |
363 | 357 | ||
364 | @Override | 358 | @Override | ... | ... |
... | @@ -2136,6 +2136,76 @@ public class WarplyManager { | ... | @@ -2136,6 +2136,76 @@ public class WarplyManager { |
2136 | }); | 2136 | }); |
2137 | } | 2137 | } |
2138 | 2138 | ||
2139 | + public static void getMerchantsMultilingual(boolean isParent, ArrayList<String> parentuuids, final CallbackReceiver<MerchantList> receiver) { | ||
2140 | + WarpUtils.log("************* WARPLY Merchants Request ********************"); | ||
2141 | + WarpUtils.log("[WARP Trace] WARPLY Merchants Request is active"); | ||
2142 | + WarpUtils.log("**************************************************"); | ||
2143 | + | ||
2144 | + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class); | ||
2145 | + | ||
2146 | + getMerchantsRetro(service, true, parentuuids, new Callback<ResponseBody>() { | ||
2147 | + @Override | ||
2148 | + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> responseMerchants) { | ||
2149 | + if (responseMerchants.code() == 200 && responseMerchants.body() != null) { | ||
2150 | + JSONObject jobjMerchantsResponse = null; | ||
2151 | + try { | ||
2152 | + jobjMerchantsResponse = new JSONObject(responseMerchants.body().string()); | ||
2153 | + } catch (Exception e) { | ||
2154 | + e.printStackTrace(); | ||
2155 | + } | ||
2156 | + | ||
2157 | + if (jobjMerchantsResponse != null && jobjMerchantsResponse.has("status") && jobjMerchantsResponse.optString("status", "2").equals("1")) { | ||
2158 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
2159 | + dynatraceEvent.setEventName("custom_success_shops_loyalty"); | ||
2160 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
2161 | + | ||
2162 | + JSONArray jMerchantsBody = null; | ||
2163 | + try { | ||
2164 | + jMerchantsBody = jobjMerchantsResponse.optJSONObject("context").optJSONObject("MAPP_SHOPS").optJSONArray("result"); | ||
2165 | + } catch (Exception e) { | ||
2166 | + e.printStackTrace(); | ||
2167 | + } | ||
2168 | + | ||
2169 | + if (jMerchantsBody != null) { | ||
2170 | + MerchantList mMerchantList = new MerchantList(); | ||
2171 | + | ||
2172 | + final ExecutorService executorShops = Executors.newFixedThreadPool(1); | ||
2173 | + JSONArray finalMerchantsJBody = jMerchantsBody; | ||
2174 | + executorShops.submit(() -> { | ||
2175 | + for (int i = 0; i < finalMerchantsJBody.length(); ++i) { | ||
2176 | + mMerchantList.add(new Merchant(finalMerchantsJBody.optJSONObject(i))); | ||
2177 | + } | ||
2178 | + new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(mMerchantList)); | ||
2179 | + executorShops.shutdownNow(); | ||
2180 | + }); | ||
2181 | + } | ||
2182 | + } else { | ||
2183 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
2184 | + dynatraceEvent.setEventName("custom_error_shops_loyalty"); | ||
2185 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
2186 | + | ||
2187 | + receiver.onFailure(2); | ||
2188 | + } | ||
2189 | + } else { | ||
2190 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
2191 | + dynatraceEvent.setEventName("custom_error_shops_loyalty"); | ||
2192 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
2193 | + | ||
2194 | + receiver.onFailure(responseMerchants.code()); | ||
2195 | + } | ||
2196 | + } | ||
2197 | + | ||
2198 | + @Override | ||
2199 | + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) { | ||
2200 | + LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
2201 | + dynatraceEvent.setEventName("custom_error_shops_loyalty"); | ||
2202 | + EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
2203 | + | ||
2204 | + receiver.onFailure(2); | ||
2205 | + } | ||
2206 | + }); | ||
2207 | + } | ||
2208 | + | ||
2139 | public static void getUserCouponsWithCouponsets(final CallbackReceiver<CouponList> receiver) { | 2209 | public static void getUserCouponsWithCouponsets(final CallbackReceiver<CouponList> receiver) { |
2140 | WarpUtils.log("************* WARPLY User Coupons Request ********************"); | 2210 | WarpUtils.log("************* WARPLY User Coupons Request ********************"); |
2141 | WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); | 2211 | WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); |
... | @@ -2537,6 +2607,49 @@ public class WarplyManager { | ... | @@ -2537,6 +2607,49 @@ public class WarplyManager { |
2537 | }); | 2607 | }); |
2538 | } | 2608 | } |
2539 | 2609 | ||
2610 | + private static void getMerchantsRetro(ApiService service, boolean isParent, ArrayList<String> parentuuids, Callback<ResponseBody> callback) { | ||
2611 | + String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); | ||
2612 | + String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); | ||
2613 | + String webId = WarpUtils.getWebId(Warply.getWarplyContext()); | ||
2614 | + | ||
2615 | + Map<String, Object> jsonParamsShops = new ArrayMap<>(); | ||
2616 | + Map<String, Object> jsonParams = new ArrayMap<>(); | ||
2617 | + jsonParams.put("action", "retrieve_multilingual"); | ||
2618 | + jsonParams.put("categories", new JSONArray()); | ||
2619 | + jsonParams.put("active", true); | ||
2620 | + jsonParams.put("location", null); | ||
2621 | + jsonParams.put("parent_uuids", new JSONArray(parentuuids)); | ||
2622 | + jsonParams.put("tags", null); | ||
2623 | + jsonParams.put("default_shown", null); | ||
2624 | + jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext())); | ||
2625 | + | ||
2626 | + jsonParamsShops.put("shops", jsonParams); | ||
2627 | + RequestBody merchantsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsShops)).toString()); | ||
2628 | + | ||
2629 | + Call<ResponseBody> merchantsCall = service.getMerchants( | ||
2630 | + WarplyProperty.getAppUuid(Warply.getWarplyContext()), | ||
2631 | + merchantsRequest, | ||
2632 | + timeStamp, | ||
2633 | + "android:" + Warply.getWarplyContext().getPackageName(), | ||
2634 | + new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(), | ||
2635 | + "mobile", | ||
2636 | + webId, | ||
2637 | + WarpUtils.produceSignature(apiKey + timeStamp) | ||
2638 | + ); | ||
2639 | + | ||
2640 | + merchantsCall.enqueue(new Callback<ResponseBody>() { | ||
2641 | + @Override | ||
2642 | + public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) { | ||
2643 | + callback.onResponse(call, response); | ||
2644 | + } | ||
2645 | + | ||
2646 | + @Override | ||
2647 | + public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) { | ||
2648 | + callback.onFailure(call, t); | ||
2649 | + } | ||
2650 | + }); | ||
2651 | + } | ||
2652 | + | ||
2540 | private static void getUserCouponsRetro(ApiService service, Callback<ResponseBody> callback) { | 2653 | private static void getUserCouponsRetro(ApiService service, Callback<ResponseBody> callback) { |
2541 | String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); | 2654 | String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString(); |
2542 | String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); | 2655 | String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext()); | ... | ... |
... | @@ -84,6 +84,7 @@ import java.util.Map; | ... | @@ -84,6 +84,7 @@ import java.util.Map; |
84 | 84 | ||
85 | import ly.warp.sdk.R; | 85 | import ly.warp.sdk.R; |
86 | import ly.warp.sdk.Warply; | 86 | import ly.warp.sdk.Warply; |
87 | +import ly.warp.sdk.activities.LoyaltyWallet; | ||
87 | import ly.warp.sdk.activities.WarpViewActivity; | 88 | import ly.warp.sdk.activities.WarpViewActivity; |
88 | import ly.warp.sdk.db.WarplyDBHelper; | 89 | import ly.warp.sdk.db.WarplyDBHelper; |
89 | import ly.warp.sdk.io.models.CouponEventModel; | 90 | import ly.warp.sdk.io.models.CouponEventModel; |
... | @@ -480,6 +481,9 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { | ... | @@ -480,6 +481,9 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { |
480 | } | 481 | } |
481 | } else if (parts[1].equals("couponRetrieved")) { | 482 | } else if (parts[1].equals("couponRetrieved")) { |
482 | EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); | 483 | EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); |
484 | + } else if (parts[1].equals("loyaltyWallet")) { | ||
485 | + Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), LoyaltyWallet.class); | ||
486 | + getContext().startActivity(intent); | ||
483 | } else if (parts[1].equals("ccmsRetrieved")) { | 487 | } else if (parts[1].equals("ccmsRetrieved")) { |
484 | WarplyCCMSEnabledModel ccmsEnabled = new WarplyCCMSEnabledModel(); | 488 | WarplyCCMSEnabledModel ccmsEnabled = new WarplyCCMSEnabledModel(); |
485 | ccmsEnabled.setActivated(true); | 489 | ccmsEnabled.setActivated(true); | ... | ... |
... | @@ -435,8 +435,8 @@ | ... | @@ -435,8 +435,8 @@ |
435 | android:layout_marginHorizontal="16dp" | 435 | android:layout_marginHorizontal="16dp" |
436 | android:layout_marginBottom="10dp" | 436 | android:layout_marginBottom="10dp" |
437 | android:text="@string/cos_market_title" | 437 | android:text="@string/cos_market_title" |
438 | - android:textColor="@color/cos_light_black" | 438 | + android:textColor="@color/cos_light_blue" |
439 | - android:textSize="20sp" /> | 439 | + android:textSize="19sp" /> |
440 | 440 | ||
441 | <androidx.recyclerview.widget.RecyclerView | 441 | <androidx.recyclerview.widget.RecyclerView |
442 | android:id="@+id/rv_market_coupons" | 442 | android:id="@+id/rv_market_coupons" |
... | @@ -572,8 +572,8 @@ | ... | @@ -572,8 +572,8 @@ |
572 | android:layout_marginHorizontal="16dp" | 572 | android:layout_marginHorizontal="16dp" |
573 | android:layout_marginBottom="10dp" | 573 | android:layout_marginBottom="10dp" |
574 | android:text="@string/cos_gifts_title" | 574 | android:text="@string/cos_gifts_title" |
575 | - android:textColor="@color/cos_light_black" | 575 | + android:textColor="@color/cos_light_blue" |
576 | - android:textSize="20sp" /> | 576 | + android:textSize="19sp" /> |
577 | 577 | ||
578 | <androidx.recyclerview.widget.RecyclerView | 578 | <androidx.recyclerview.widget.RecyclerView |
579 | android:id="@+id/rv_active_coupons" | 579 | android:id="@+id/rv_active_coupons" | ... | ... |
... | @@ -16,8 +16,8 @@ | ... | @@ -16,8 +16,8 @@ |
16 | <string name="cos_profile_title">My Rewards</string> | 16 | <string name="cos_profile_title">My Rewards</string> |
17 | <string name="cos_deals_title">Deals for You</string> | 17 | <string name="cos_deals_title">Deals for You</string> |
18 | <string name="cos_profile_more">Δες περισσότερα</string> | 18 | <string name="cos_profile_more">Δες περισσότερα</string> |
19 | - <string name="cos_gifts_title">GIFTS for YOU</string> | 19 | + <string name="cos_gifts_title">GIFTS FOR YOU</string> |
20 | - <string name="cos_more_title">MORE for YOU</string> | 20 | + <string name="cos_more_title">MORE FOR YOU</string> |
21 | <string name="menu_home">Αρχική</string> | 21 | <string name="menu_home">Αρχική</string> |
22 | <string name="menu_explore">Ανακάλυψε</string> | 22 | <string name="menu_explore">Ανακάλυψε</string> |
23 | <string name="menu_shop">Shop</string> | 23 | <string name="menu_shop">Shop</string> |
... | @@ -73,8 +73,8 @@ | ... | @@ -73,8 +73,8 @@ |
73 | <string name="cos_gift_it">Δώρισέ το</string> | 73 | <string name="cos_gift_it">Δώρισέ το</string> |
74 | <string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string> | 74 | <string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string> |
75 | <string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string> | 75 | <string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string> |
76 | - <string name="cos_deals_win_title">Έχεις κερδίσει %1$s€ με το\nGIFTS for YOU!</string> | 76 | + <string name="cos_deals_win_title">Έχεις κερδίσει %1$s€ με το\nGIFTS FOR YOU!</string> |
77 | - <string name="cos_deals_win_title_cos">Έχεις κερδίσει %1$s€ με το\nDEALS for YOU!</string> | 77 | + <string name="cos_deals_win_title_cos">Έχεις κερδίσει %1$s€ με το\nDEALS FOR YOU!</string> |
78 | <string name="cos_mygifts">Τα δώρα μου</string> | 78 | <string name="cos_mygifts">Τα δώρα μου</string> |
79 | <string name="cos_gifts_banner_title">Δώρα:</string> | 79 | <string name="cos_gifts_banner_title">Δώρα:</string> |
80 | <string name="cos_see_more">Δες περισσότερα</string> | 80 | <string name="cos_see_more">Δες περισσότερα</string> |
... | @@ -151,7 +151,7 @@ | ... | @@ -151,7 +151,7 @@ |
151 | <string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string> | 151 | <string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string> |
152 | <string name="cos_dlg_no_shops_positive">Δες το eshop</string> | 152 | <string name="cos_dlg_no_shops_positive">Δες το eshop</string> |
153 | <string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string> | 153 | <string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string> |
154 | - <string name="cos_market_title">SuperMarket Deals</string> | 154 | + <string name="cos_market_title">SUPERMARKET DEALS</string> |
155 | <string name="cos_rewards_title2">COSMOTE Επιβράβευση</string> | 155 | <string name="cos_rewards_title2">COSMOTE Επιβράβευση</string> |
156 | <string name="cos_market_item_title">COSMOTE\nSuperMarket\nDeals</string> | 156 | <string name="cos_market_item_title">COSMOTE\nSuperMarket\nDeals</string> |
157 | <string name="cos_market_active_coupons">έχεις %1$s ενεργά κουπόνια</string> | 157 | <string name="cos_market_active_coupons">έχεις %1$s ενεργά κουπόνια</string> |
... | @@ -169,7 +169,7 @@ | ... | @@ -169,7 +169,7 @@ |
169 | <string name="cos_coupon_date_limit">Ισχύει έως </string> | 169 | <string name="cos_coupon_date_limit">Ισχύει έως </string> |
170 | <string name="cos_coupon_date_limit2">%1$s</string> | 170 | <string name="cos_coupon_date_limit2">%1$s</string> |
171 | <string name="cos_for_you_all">Μέχρι τώρα έχεις κερδίσει %1$s€ στο For You!</string> | 171 | <string name="cos_for_you_all">Μέχρι τώρα έχεις κερδίσει %1$s€ στο For You!</string> |
172 | - <string name="cos_supermarket_win">Έχεις κερδίσει %1$s€ με τα\nSuperMarket Deals!</string> | 172 | + <string name="cos_supermarket_win">Έχεις κερδίσει %1$s€ με τα\nSUPERMARKET DEALS!</string> |
173 | <string name="cos_supermarket_history">Μέχρι τώρα έχεις κερδίσει %1$s€ σε προσφορές από %2$s κουπόνια!</string> | 173 | <string name="cos_supermarket_history">Μέχρι τώρα έχεις κερδίσει %1$s€ σε προσφορές από %2$s κουπόνια!</string> |
174 | <string name="lbl_cosmote_webview_permission_title">COSMOTE</string> | 174 | <string name="lbl_cosmote_webview_permission_title">COSMOTE</string> |
175 | <string name="lbl_cosmote_webview_permission_message">Το COSMOTE ζητάει πρόσβαση στην τοποθεσία σας.</string> | 175 | <string name="lbl_cosmote_webview_permission_message">Το COSMOTE ζητάει πρόσβαση στην τοποθεσία σας.</string> | ... | ... |
-
Please register or login to post a comment