Showing
13 changed files
with
286 additions
and
25 deletions
| ... | @@ -12,7 +12,7 @@ | ... | @@ -12,7 +12,7 @@ |
| 12 | <!-- android:xlargeScreens="false" />--> | 12 | <!-- android:xlargeScreens="false" />--> |
| 13 | 13 | ||
| 14 | <application | 14 | <application |
| 15 | - android:name="warp.ly.android_sdk.WarplyAndroidSDKApplication" | 15 | + android:name=".WarplyAndroidSDKApplication" |
| 16 | android:allowBackup="false" | 16 | android:allowBackup="false" |
| 17 | android:exported="true" | 17 | android:exported="true" |
| 18 | android:extractNativeLibs="true" | 18 | android:extractNativeLibs="true" |
| ... | @@ -25,7 +25,7 @@ | ... | @@ -25,7 +25,7 @@ |
| 25 | android:theme="@style/AppTheme"> | 25 | android:theme="@style/AppTheme"> |
| 26 | 26 | ||
| 27 | <activity | 27 | <activity |
| 28 | - android:name="warp.ly.android_sdk.activities.SplashActivity" | 28 | + android:name=".activities.SplashActivity" |
| 29 | android:exported="true" | 29 | android:exported="true" |
| 30 | android:label="@string/app_name" | 30 | android:label="@string/app_name" |
| 31 | android:screenOrientation="portrait"> | 31 | android:screenOrientation="portrait"> |
| ... | @@ -41,8 +41,6 @@ | ... | @@ -41,8 +41,6 @@ |
| 41 | android:exported="false" | 41 | android:exported="false" |
| 42 | android:label="@string/title_activity_main" | 42 | android:label="@string/title_activity_main" |
| 43 | android:screenOrientation="portrait" /> | 43 | android:screenOrientation="portrait" /> |
| 44 | - | ||
| 45 | - | ||
| 46 | </application> | 44 | </application> |
| 47 | 45 | ||
| 48 | <!-- For Huawei Push, only if we targetSdkVersion 30, comment if we are in Google build --> | 46 | <!-- For Huawei Push, only if we targetSdkVersion 30, comment if we are in Google build --> | ... | ... |
| 1 | # {@link ly.warp.sdk.utils.WarplyProperty} | 1 | # {@link ly.warp.sdk.utils.WarplyProperty} |
| 2 | 2 | ||
| 3 | # The app uuid the warply sdk need to connect to the engage server | 3 | # The app uuid the warply sdk need to connect to the engage server |
| 4 | -Uuid=b13ade8ef743468b89a7aaa8efbfc468 | 4 | +# Epistrofi dev app uuid 4e067691826111e2998e8d972467e239 |
| 5 | +Uuid=4e067691826111e2998e8d972467e239 | ||
| 5 | 6 | ||
| 6 | # If we need to see logs in Logcat | 7 | # If we need to see logs in Logcat |
| 7 | Debug=false | 8 | Debug=false |
| ... | @@ -37,7 +38,7 @@ SendPackages=false | ... | @@ -37,7 +38,7 @@ SendPackages=false |
| 37 | #Language=el | 38 | #Language=el |
| 38 | 39 | ||
| 39 | # The merchant id for some requests | 40 | # The merchant id for some requests |
| 40 | -MerchantId=20113 | 41 | +MerchantId=59949 |
| 41 | 42 | ||
| 42 | # The login type must be one of the below: | 43 | # The login type must be one of the below: |
| 43 | # email, msisdn, username | 44 | # email, msisdn, username | ... | ... |
| ... | @@ -2,14 +2,21 @@ package warp.ly.android_sdk.activities; | ... | @@ -2,14 +2,21 @@ package warp.ly.android_sdk.activities; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | +import android.widget.Toast; | ||
| 5 | 6 | ||
| 7 | +import java.util.ArrayList; | ||
| 6 | import java.util.Timer; | 8 | import java.util.Timer; |
| 7 | import java.util.TimerTask; | 9 | import java.util.TimerTask; |
| 8 | 10 | ||
| 9 | import ly.warp.sdk.Warply; | 11 | import ly.warp.sdk.Warply; |
| 12 | +import ly.warp.sdk.activities.EurobankHomeActivity; | ||
| 13 | +import ly.warp.sdk.io.callbacks.CallbackReceiver; | ||
| 10 | import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver; | 14 | import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver; |
| 11 | import ly.warp.sdk.io.callbacks.WarplyReadyCallback; | 15 | import ly.warp.sdk.io.callbacks.WarplyReadyCallback; |
| 16 | +import ly.warp.sdk.io.models.Campaign; | ||
| 17 | +import ly.warp.sdk.io.request.WarplyGetCampaignsRequest; | ||
| 12 | import ly.warp.sdk.utils.WarplyInitializer; | 18 | import ly.warp.sdk.utils.WarplyInitializer; |
| 19 | +import ly.warp.sdk.utils.managers.WarplyManager; | ||
| 13 | import warp.ly.android_sdk.R; | 20 | import warp.ly.android_sdk.R; |
| 14 | 21 | ||
| 15 | import static warp.ly.android_sdk.utils.Constants.SENDER_ID; | 22 | import static warp.ly.android_sdk.utils.Constants.SENDER_ID; |
| ... | @@ -26,19 +33,20 @@ public class SplashActivity extends BaseActivity { | ... | @@ -26,19 +33,20 @@ public class SplashActivity extends BaseActivity { |
| 26 | mWarplyInitializer = Warply.getInitializer(this, new WarplyReadyCallback() { | 33 | mWarplyInitializer = Warply.getInitializer(this, new WarplyReadyCallback() { |
| 27 | @Override | 34 | @Override |
| 28 | public void onWarplyReady() { | 35 | public void onWarplyReady() { |
| 29 | - checkForAppUpdate(); | 36 | + showToast("Warply initialization success!"); |
| 37 | + WarplyManager.getCampaigns(new WarplyGetCampaignsRequest(), mCampaignsCallback); | ||
| 30 | } | 38 | } |
| 31 | 39 | ||
| 32 | @Override | 40 | @Override |
| 33 | public void onWarplyInitTimeOut() { | 41 | public void onWarplyInitTimeOut() { |
| 34 | showToast("Warply initialization timeout!"); | 42 | showToast("Warply initialization timeout!"); |
| 35 | - checkForAppUpdate(); | 43 | + startNextActivity(); |
| 36 | } | 44 | } |
| 37 | 45 | ||
| 38 | @Override | 46 | @Override |
| 39 | public void onWarplyPermissionsDenied() { | 47 | public void onWarplyPermissionsDenied() { |
| 40 | showToast("Warply permissions denied!"); | 48 | showToast("Warply permissions denied!"); |
| 41 | - checkForAppUpdate(); | 49 | + startNextActivity(); |
| 42 | } | 50 | } |
| 43 | }); | 51 | }); |
| 44 | } | 52 | } |
| ... | @@ -55,20 +63,7 @@ public class SplashActivity extends BaseActivity { | ... | @@ -55,20 +63,7 @@ public class SplashActivity extends BaseActivity { |
| 55 | // super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 63 | // super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 56 | // } | 64 | // } |
| 57 | 65 | ||
| 58 | - private void checkForAppUpdate() { | ||
| 59 | - | ||
| 60 | - Warply.checkForAppUpdate(SplashActivity.this, new SimpleCallbackReceiver<Boolean>() { | ||
| 61 | - @Override | ||
| 62 | - public void onResult(Boolean updateAccepted, int errorCode) { | ||
| 63 | - if (!updateAccepted) { | ||
| 64 | - startNextActivity(); | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - }); | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | private void startNextActivity() { | 66 | private void startNextActivity() { |
| 71 | - | ||
| 72 | if (!isFinishing()) { | 67 | if (!isFinishing()) { |
| 73 | long MIN_SPLASH_TIME = 2000; | 68 | long MIN_SPLASH_TIME = 2000; |
| 74 | new Timer().schedule(new TimerTask() { | 69 | new Timer().schedule(new TimerTask() { |
| ... | @@ -80,7 +75,7 @@ public class SplashActivity extends BaseActivity { | ... | @@ -80,7 +75,7 @@ public class SplashActivity extends BaseActivity { |
| 80 | public void run() { | 75 | public void run() { |
| 81 | if (!isFinishing()) { | 76 | if (!isFinishing()) { |
| 82 | startActivity(new Intent(SplashActivity.this, | 77 | startActivity(new Intent(SplashActivity.this, |
| 83 | - MainActivity.class)); | 78 | + EurobankHomeActivity.class)); |
| 84 | finish(); | 79 | finish(); |
| 85 | } | 80 | } |
| 86 | } | 81 | } |
| ... | @@ -89,4 +84,16 @@ public class SplashActivity extends BaseActivity { | ... | @@ -89,4 +84,16 @@ public class SplashActivity extends BaseActivity { |
| 89 | }, MIN_SPLASH_TIME); | 84 | }, MIN_SPLASH_TIME); |
| 90 | } | 85 | } |
| 91 | } | 86 | } |
| 87 | + | ||
| 88 | + private final CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() { | ||
| 89 | + @Override | ||
| 90 | + public void onSuccess(ArrayList<Campaign> result) { | ||
| 91 | + startNextActivity(); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @Override | ||
| 95 | + public void onFailure(int errorCode) { | ||
| 96 | + Toast.makeText(SplashActivity.this, "Campaigns Error", Toast.LENGTH_SHORT).show(); | ||
| 97 | + } | ||
| 98 | + }; | ||
| 92 | } | 99 | } | ... | ... |
| ... | @@ -4,14 +4,16 @@ | ... | @@ -4,14 +4,16 @@ |
| 4 | 4 | ||
| 5 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 5 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
| 6 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | 6 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> |
| 7 | - <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 7 | + <uses-permission |
| 8 | + android:name="android.permission.READ_PHONE_STATE" | ||
| 9 | + tools:node="remove" /> | ||
| 8 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 10 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| 9 | <uses-permission android:name="android.permission.BLUETOOTH" /> | 11 | <uses-permission android:name="android.permission.BLUETOOTH" /> |
| 10 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 12 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| 11 | <uses-permission | 13 | <uses-permission |
| 12 | android:name="android.permission.REQUEST_INSTALL_PACKAGES" | 14 | android:name="android.permission.REQUEST_INSTALL_PACKAGES" |
| 13 | tools:node="remove" /> | 15 | tools:node="remove" /> |
| 14 | - <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> | 16 | + <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> |
| 15 | 17 | ||
| 16 | <application> | 18 | <application> |
| 17 | <!-- For Huawei Push --> | 19 | <!-- For Huawei Push --> |
| ... | @@ -24,6 +26,11 @@ | ... | @@ -24,6 +26,11 @@ |
| 24 | android:value="false" /> | 26 | android:value="false" /> |
| 25 | 27 | ||
| 26 | <activity | 28 | <activity |
| 29 | + android:name="ly.warp.sdk.activities.EurobankHomeActivity" | ||
| 30 | + android:exported="false" | ||
| 31 | + android:screenOrientation="portrait" /> | ||
| 32 | + | ||
| 33 | + <activity | ||
| 27 | android:name="ly.warp.sdk.activities.WarpViewActivity" | 34 | android:name="ly.warp.sdk.activities.WarpViewActivity" |
| 28 | android:exported="false" | 35 | android:exported="false" |
| 29 | android:screenOrientation="portrait" /> | 36 | android:screenOrientation="portrait" /> | ... | ... |
| 1 | +package ly.warp.sdk.activities; | ||
| 2 | + | ||
| 3 | +import android.os.Bundle; | ||
| 4 | + | ||
| 5 | +import ly.warp.sdk.R; | ||
| 6 | + | ||
| 7 | +public class EurobankHomeActivity extends WarpBaseActivity { | ||
| 8 | + | ||
| 9 | + // =========================================================== | ||
| 10 | + // Constants | ||
| 11 | + // =========================================================== | ||
| 12 | + | ||
| 13 | + // =========================================================== | ||
| 14 | + // Fields | ||
| 15 | + // =========================================================== | ||
| 16 | + | ||
| 17 | + // =========================================================== | ||
| 18 | + // Methods for/from SuperClass/Interfaces | ||
| 19 | + // =========================================================== | ||
| 20 | + | ||
| 21 | + @Override | ||
| 22 | + public void onCreate(Bundle savedInstanceState) { | ||
| 23 | + super.onCreate(savedInstanceState); | ||
| 24 | + setContentView(R.layout.activity_eurobank_home); | ||
| 25 | + initViews(); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + protected void onResume() { | ||
| 30 | + super.onResume(); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + private void initViews() { | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + // =========================================================== | ||
| 39 | + // Methods | ||
| 40 | + // =========================================================== | ||
| 41 | + | ||
| 42 | + // =========================================================== | ||
| 43 | + // Inner and Anonymous Classes | ||
| 44 | + // =========================================================== | ||
| 45 | + | ||
| 46 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
| 3 | + * | ||
| 4 | + * Redistribution and use in source and binary forms, without modification, are | ||
| 5 | + * permitted provided that the following conditions are met: | ||
| 6 | + * | ||
| 7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
| 8 | + * this list of conditions and the following disclaimer. | ||
| 9 | + * | ||
| 10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
| 11 | + * this list of conditions and the following disclaimer in the documentation | ||
| 12 | + * and/or other materials provided with the distribution. | ||
| 13 | + * | ||
| 14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
| 15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
| 17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
| 20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
| 21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| 22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
| 23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 24 | + */ | ||
| 25 | +package ly.warp.sdk.io.callbacks; | ||
| 26 | +import android.text.TextUtils; | ||
| 27 | +import org.json.JSONObject; | ||
| 28 | +import java.util.ArrayList; | ||
| 29 | +import ly.warp.sdk.io.models.Campaign; | ||
| 30 | +import ly.warp.sdk.io.models.NewCampaign; | ||
| 31 | +import ly.warp.sdk.io.models.NewCampaignList; | ||
| 32 | +import ly.warp.sdk.utils.WarpJSONParser; | ||
| 33 | +/** | ||
| 34 | + * Created by Panagiotis Triantafyllou on 12-May-22. | ||
| 35 | + */ | ||
| 36 | +public class NewCampaignsHookDefault implements CallbackReceiver<JSONObject> { | ||
| 37 | + private final CallbackReceiver<ArrayList<Campaign>> mListener; | ||
| 38 | + private final String mRequestSignature; | ||
| 39 | + public NewCampaignsHookDefault(CallbackReceiver<ArrayList<Campaign>> listener, String requestSignature) { | ||
| 40 | + this.mListener = listener; | ||
| 41 | + this.mRequestSignature = requestSignature; | ||
| 42 | + } | ||
| 43 | + @Override | ||
| 44 | + public void onSuccess(JSONObject result) { | ||
| 45 | + if (mListener != null) { | ||
| 46 | + int status = result.optInt("status", 2); | ||
| 47 | + if (status == 1) { | ||
| 48 | + NewCampaignList cmpList = new NewCampaignList(result, mRequestSignature); | ||
| 49 | + ArrayList<Campaign> tempCampaigns = new ArrayList<>(); | ||
| 50 | + for (NewCampaign newCamp : cmpList) { | ||
| 51 | + Campaign camp = new Campaign(); | ||
| 52 | + camp.setIndexUrl(newCamp.getIndexUrl()); | ||
| 53 | + camp.setLogoUrl(newCamp.getLogoUrl()); | ||
| 54 | + camp.setMessage(newCamp.getMessage()); | ||
| 55 | + camp.setOfferCategory(newCamp.getCommunicationCategory()); | ||
| 56 | + camp.setSessionUUID(newCamp.getCommunicationUUID()); | ||
| 57 | + camp.setTitle(newCamp.getTitle()); | ||
| 58 | + camp.setSubtitle(newCamp.getSubtitle()); | ||
| 59 | + camp.setSorting(newCamp.getSorting()); | ||
| 60 | + camp.setNew(newCamp.getIsNew()); | ||
| 61 | + camp.setType(newCamp.getCampaignType()); | ||
| 62 | + try { | ||
| 63 | + camp.setExtraFields(newCamp.getExtraFields().toString()); | ||
| 64 | + if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) { | ||
| 65 | + JSONObject extraFieldsResp = WarpJSONParser.getJSONFromString(newCamp.getExtraFields().toString()); | ||
| 66 | + if (extraFieldsResp != null) { | ||
| 67 | + if (extraFieldsResp.has("Banner_title")) { | ||
| 68 | + camp.setBannerTitle(extraFieldsResp.optString("Banner_title", "")); | ||
| 69 | + } | ||
| 70 | + if (extraFieldsResp.has("Banner_img")) { | ||
| 71 | + camp.setBannerImage(extraFieldsResp.optString("Banner_img", "")); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + } else { | ||
| 75 | + camp.setBannerImage(""); | ||
| 76 | + camp.setBannerTitle(""); | ||
| 77 | + } | ||
| 78 | + } catch (NullPointerException e) { | ||
| 79 | + camp.setExtraFields(""); | ||
| 80 | + camp.setBannerImage(""); | ||
| 81 | + camp.setBannerTitle(""); | ||
| 82 | + e.printStackTrace(); | ||
| 83 | + } | ||
| 84 | + try { | ||
| 85 | + camp.setCampaignTypeSettings(newCamp.getSettings().toString()); | ||
| 86 | + } catch (NullPointerException e) { | ||
| 87 | + camp.setCampaignTypeSettings(""); | ||
| 88 | + e.printStackTrace(); | ||
| 89 | + } | ||
| 90 | + tempCampaigns.add(camp); | ||
| 91 | + } | ||
| 92 | + mListener.onSuccess(tempCampaigns); | ||
| 93 | + } else | ||
| 94 | + mListener.onFailure(status); | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + @Override | ||
| 98 | + public void onFailure(int errorCode) { | ||
| 99 | + if (mListener != null) | ||
| 100 | + mListener.onFailure(errorCode); | ||
| 101 | + } | ||
| 102 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
| 1 | +/* | ||
| 2 | + * Copyright 2010-2022 Warply Ltd. All rights reserved. | ||
| 3 | + * | ||
| 4 | + * Redistribution and use in source and binary forms, without modification, are | ||
| 5 | + * permitted provided that the following conditions are met: | ||
| 6 | + * | ||
| 7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
| 8 | + * this list of conditions and the following disclaimer. | ||
| 9 | + * | ||
| 10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
| 11 | + * this list of conditions and the following disclaimer in the documentation | ||
| 12 | + * and/or other materials provided with the distribution. | ||
| 13 | + * | ||
| 14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
| 15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
| 17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
| 20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
| 21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| 22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
| 23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 24 | + */ | ||
| 25 | + | ||
| 26 | +package ly.warp.sdk.utils; | ||
| 27 | + | ||
| 28 | +import java.util.ArrayList; | ||
| 29 | + | ||
| 30 | +import ly.warp.sdk.io.models.Campaign; | ||
| 31 | + | ||
| 32 | +public class WarplyManagerHelper { | ||
| 33 | + private static ArrayList<Campaign> mCampaignList = new ArrayList<Campaign>(); | ||
| 34 | + | ||
| 35 | + public static ArrayList<Campaign> getCampaignList() { | ||
| 36 | + return mCampaignList; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public static void setCampaignList(ArrayList<Campaign> campaignList) { | ||
| 40 | + mCampaignList.clear(); | ||
| 41 | + mCampaignList = campaignList; | ||
| 42 | + } | ||
| 43 | +} |
| ... | @@ -28,6 +28,8 @@ package ly.warp.sdk.utils.managers; | ... | @@ -28,6 +28,8 @@ package ly.warp.sdk.utils.managers; |
| 28 | import org.json.JSONException; | 28 | import org.json.JSONException; |
| 29 | import org.json.JSONObject; | 29 | import org.json.JSONObject; |
| 30 | 30 | ||
| 31 | +import java.util.ArrayList; | ||
| 32 | + | ||
| 31 | import ly.warp.sdk.Warply; | 33 | import ly.warp.sdk.Warply; |
| 32 | import ly.warp.sdk.db.WarplyDBHelper; | 34 | import ly.warp.sdk.db.WarplyDBHelper; |
| 33 | import ly.warp.sdk.io.callbacks.AddressHook; | 35 | import ly.warp.sdk.io.callbacks.AddressHook; |
| ... | @@ -40,12 +42,14 @@ import ly.warp.sdk.io.callbacks.CouponsetsHook; | ... | @@ -40,12 +42,14 @@ import ly.warp.sdk.io.callbacks.CouponsetsHook; |
| 40 | import ly.warp.sdk.io.callbacks.MerchantCategoriesHook; | 42 | import ly.warp.sdk.io.callbacks.MerchantCategoriesHook; |
| 41 | import ly.warp.sdk.io.callbacks.MerchantsHook; | 43 | import ly.warp.sdk.io.callbacks.MerchantsHook; |
| 42 | import ly.warp.sdk.io.callbacks.NewCampaignsHook; | 44 | import ly.warp.sdk.io.callbacks.NewCampaignsHook; |
| 45 | +import ly.warp.sdk.io.callbacks.NewCampaignsHookDefault; | ||
| 43 | import ly.warp.sdk.io.callbacks.PointsHook; | 46 | import ly.warp.sdk.io.callbacks.PointsHook; |
| 44 | import ly.warp.sdk.io.callbacks.ProductsHook; | 47 | import ly.warp.sdk.io.callbacks.ProductsHook; |
| 45 | import ly.warp.sdk.io.callbacks.TagsCategoriesHook; | 48 | import ly.warp.sdk.io.callbacks.TagsCategoriesHook; |
| 46 | import ly.warp.sdk.io.callbacks.TagsHook; | 49 | import ly.warp.sdk.io.callbacks.TagsHook; |
| 47 | import ly.warp.sdk.io.callbacks.TransactionsHook; | 50 | import ly.warp.sdk.io.callbacks.TransactionsHook; |
| 48 | import ly.warp.sdk.io.models.AddressList; | 51 | import ly.warp.sdk.io.models.AddressList; |
| 52 | +import ly.warp.sdk.io.models.Campaign; | ||
| 49 | import ly.warp.sdk.io.models.Card; | 53 | import ly.warp.sdk.io.models.Card; |
| 50 | import ly.warp.sdk.io.models.CardList; | 54 | import ly.warp.sdk.io.models.CardList; |
| 51 | import ly.warp.sdk.io.models.Consumer; | 55 | import ly.warp.sdk.io.models.Consumer; |
| ... | @@ -97,6 +101,7 @@ import ly.warp.sdk.io.request.WarplyValidateCouponRequest; | ... | @@ -97,6 +101,7 @@ import ly.warp.sdk.io.request.WarplyValidateCouponRequest; |
| 97 | import ly.warp.sdk.io.request.WarplyVerifyOTPRequest; | 101 | import ly.warp.sdk.io.request.WarplyVerifyOTPRequest; |
| 98 | import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; | 102 | import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; |
| 99 | import ly.warp.sdk.utils.WarpUtils; | 103 | import ly.warp.sdk.utils.WarpUtils; |
| 104 | +import ly.warp.sdk.utils.WarplyManagerHelper; | ||
| 100 | import ly.warp.sdk.utils.WarplyProperty; | 105 | import ly.warp.sdk.utils.WarplyProperty; |
| 101 | import ly.warp.sdk.utils.constants.WarpConstants; | 106 | import ly.warp.sdk.utils.constants.WarpConstants; |
| 102 | 107 | ||
| ... | @@ -1272,6 +1277,25 @@ public class WarplyManager { | ... | @@ -1272,6 +1277,25 @@ public class WarplyManager { |
| 1272 | }); | 1277 | }); |
| 1273 | } | 1278 | } |
| 1274 | 1279 | ||
| 1280 | + public static void getCampaigns(WarplyGetCampaignsRequest request, final CallbackReceiver<ArrayList<Campaign>> receiver) { | ||
| 1281 | + WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); | ||
| 1282 | + WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); | ||
| 1283 | + WarpUtils.log("**************************************************"); | ||
| 1284 | + Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHookDefault(new CallbackReceiver<ArrayList<Campaign>>() { | ||
| 1285 | + @Override | ||
| 1286 | + public void onSuccess(ArrayList<Campaign> result) { | ||
| 1287 | + WarplyManagerHelper.setCampaignList(result); | ||
| 1288 | + receiver.onSuccess(result); | ||
| 1289 | + } | ||
| 1290 | + | ||
| 1291 | + @Override | ||
| 1292 | + public void onFailure(int errorCode) { | ||
| 1293 | + receiver.onFailure(errorCode); | ||
| 1294 | + } | ||
| 1295 | + }, | ||
| 1296 | + request.getSignature())); | ||
| 1297 | + } | ||
| 1298 | + | ||
| 1275 | public static void getCampaigns(WarplyGetCampaignsRequest request, boolean auth, final CallbackReceiver<NewCampaignList> receiver) { | 1299 | public static void getCampaigns(WarplyGetCampaignsRequest request, boolean auth, final CallbackReceiver<NewCampaignList> receiver) { |
| 1276 | WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); | 1300 | WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); |
| 1277 | WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); | 1301 | WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); | ... | ... |
19.4 KB
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + <gradient | ||
| 4 | + android:angle="0" | ||
| 5 | + android:endColor="@color/blue" | ||
| 6 | + android:startColor="@color/blue_dark" | ||
| 7 | + android:type="linear" /> | ||
| 8 | +</shape> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 3 | + android:layout_width="match_parent" | ||
| 4 | + android:layout_height="match_parent" | ||
| 5 | + android:background="@color/grey"> | ||
| 6 | + | ||
| 7 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
| 8 | + android:layout_width="match_parent" | ||
| 9 | + android:layout_height="120dp" | ||
| 10 | + android:background="@drawable/background_gradient" | ||
| 11 | + android:scaleType="centerCrop"> | ||
| 12 | + | ||
| 13 | + <ImageView | ||
| 14 | + android:layout_width="180dp" | ||
| 15 | + android:layout_height="60dp" | ||
| 16 | + android:src="@drawable/logo" | ||
| 17 | + app:layout_constraintBottom_toBottomOf="parent" | ||
| 18 | + app:layout_constraintStart_toStartOf="parent" | ||
| 19 | + app:layout_constraintTop_toTopOf="parent" /> | ||
| 20 | + | ||
| 21 | + </androidx.constraintlayout.widget.ConstraintLayout> | ||
| 22 | +</RelativeLayout> |
| ... | @@ -3,4 +3,7 @@ | ... | @@ -3,4 +3,7 @@ |
| 3 | <color name="colorPrimary">#0a1a50</color> | 3 | <color name="colorPrimary">#0a1a50</color> |
| 4 | <color name="colorAccent">#044C86</color> | 4 | <color name="colorAccent">#044C86</color> |
| 5 | <color name="colorPrimaryDark">#0a1a50</color> | 5 | <color name="colorPrimaryDark">#0a1a50</color> |
| 6 | + <color name="grey">#E7EAEB</color> | ||
| 7 | + <color name="blue_dark">#081748</color> | ||
| 8 | + <color name="blue">#204EAC</color> | ||
| 6 | </resources> | 9 | </resources> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment