Showing
5 changed files
with
104 additions
and
2 deletions
| ... | @@ -11,7 +11,7 @@ Debug=true | ... | @@ -11,7 +11,7 @@ Debug=true | 
| 11 | # Production or Development environment of the engage server | 11 | # Production or Development environment of the engage server | 
| 12 | # Production: https://engage.warp.ly | 12 | # Production: https://engage.warp.ly | 
| 13 | # Development: https://engage-stage.warp.ly | 13 | # Development: https://engage-stage.warp.ly | 
| 14 | -BaseURL=https://engage.warp.ly | 14 | +BaseURL=https://engage-stage.warp.ly | 
| 15 | 15 | ||
| 16 | # For Verify Ticket request | 16 | # For Verify Ticket request | 
| 17 | VerifyURL=/partners/cosmote/verify | 17 | VerifyURL=/partners/cosmote/verify | ... | ... | 
| ... | @@ -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.6rc2' | 5 | + PUBLISH_VERSION = '4.5.4.6rc3' | 
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 
| 7 | } | 7 | } | 
| 8 | 8 | ... | ... | 
| 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 | + | ||
| 26 | +package ly.warp.sdk.io.callbacks; | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +public interface RetrofitInterface { | ||
| 30 | +// @GET("/api/session/{sessionUuid}") | ||
| 31 | +// Call<ResponseBody> getSingleCampaign(@Path("sessionUuid") String sessionUuid); | ||
| 32 | +} | 
| ... | @@ -115,6 +115,7 @@ public class HurlStack implements HttpStack { | ... | @@ -115,6 +115,7 @@ public class HurlStack implements HttpStack { | 
| 115 | } | 115 | } | 
| 116 | URL parsedUrl = new URL(url); | 116 | URL parsedUrl = new URL(url); | 
| 117 | HttpURLConnection connection = openConnection(parsedUrl, request); | 117 | HttpURLConnection connection = openConnection(parsedUrl, request); | 
| 118 | + connection.setInstanceFollowRedirects(false); | ||
| 118 | for (String headerName : map.keySet()) { | 119 | for (String headerName : map.keySet()) { | 
| 119 | connection.addRequestProperty(headerName, map.get(headerName)); | 120 | connection.addRequestProperty(headerName, map.get(headerName)); | 
| 120 | } | 121 | } | ... | ... | 
| ... | @@ -25,6 +25,8 @@ | ... | @@ -25,6 +25,8 @@ | 
| 25 | 25 | ||
| 26 | package ly.warp.sdk.utils.managers; | 26 | package ly.warp.sdk.utils.managers; | 
| 27 | 27 | ||
| 28 | +import static java.lang.Boolean.FALSE; | ||
| 29 | + | ||
| 28 | import android.app.ActivityManager; | 30 | import android.app.ActivityManager; | 
| 29 | import android.app.AlarmManager; | 31 | import android.app.AlarmManager; | 
| 30 | import android.app.PendingIntent; | 32 | import android.app.PendingIntent; | 
| ... | @@ -64,6 +66,7 @@ import ly.warp.sdk.io.callbacks.NewCampaignsHook; | ... | @@ -64,6 +66,7 @@ import ly.warp.sdk.io.callbacks.NewCampaignsHook; | 
| 64 | import ly.warp.sdk.io.callbacks.PacingDetailsHook; | 66 | import ly.warp.sdk.io.callbacks.PacingDetailsHook; | 
| 65 | import ly.warp.sdk.io.callbacks.PointsHook; | 67 | import ly.warp.sdk.io.callbacks.PointsHook; | 
| 66 | import ly.warp.sdk.io.callbacks.ProductsHook; | 68 | import ly.warp.sdk.io.callbacks.ProductsHook; | 
| 69 | +import ly.warp.sdk.io.callbacks.RetrofitInterface; | ||
| 67 | import ly.warp.sdk.io.callbacks.SharingHook; | 70 | import ly.warp.sdk.io.callbacks.SharingHook; | 
| 68 | import ly.warp.sdk.io.callbacks.TagsCategoriesHook; | 71 | import ly.warp.sdk.io.callbacks.TagsCategoriesHook; | 
| 69 | import ly.warp.sdk.io.callbacks.TagsHook; | 72 | import ly.warp.sdk.io.callbacks.TagsHook; | 
| ... | @@ -2860,6 +2863,72 @@ public class WarplyManager { | ... | @@ -2860,6 +2863,72 @@ public class WarplyManager { | 
| 2860 | }, null); | 2863 | }, null); | 
| 2861 | } | 2864 | } | 
| 2862 | 2865 | ||
| 2866 | + public static void makeGetRequest(String url) { | ||
| 2867 | +// Always run it in a new Thread, not in the main | ||
| 2868 | +// new Thread(() -> { | ||
| 2869 | +// makeGetRequest(session_uuid); | ||
| 2870 | +// }).start(); | ||
| 2871 | + | ||
| 2872 | +// Also add those two dependencies | ||
| 2873 | +// api 'com.squareup.retrofit2:retrofit:2.9.0' | ||
| 2874 | +// api 'com.squareup.okhttp3:okhttp:4.10.0' | ||
| 2875 | + | ||
| 2876 | +// And uncomment the code inside RetrofitInterface.java | ||
| 2877 | + | ||
| 2878 | +// OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); | ||
| 2879 | +// httpClient.followRedirects(FALSE) | ||
| 2880 | +// .followSslRedirects(FALSE); | ||
| 2881 | +// | ||
| 2882 | +// Retrofit retrofit = new Retrofit.Builder() | ||
| 2883 | +// .baseUrl(WarplyProperty.getBaseUrl(Warply.getWarplyContext())) | ||
| 2884 | +// .client(httpClient.build()) | ||
| 2885 | +// .build(); | ||
| 2886 | +// | ||
| 2887 | +// RetrofitInterface service = retrofit.create(RetrofitInterface.class); | ||
| 2888 | +// Call<ResponseBody> respo = service.getSingleCampaign(url); | ||
| 2889 | +// respo.enqueue(new Callback<ResponseBody>() { | ||
| 2890 | +// @Override | ||
| 2891 | +// public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { | ||
| 2892 | +// LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2893 | +// dynatraceEvent.setEventName("custom_success_read_campaign_loyalty"); | ||
| 2894 | +// EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2895 | +// | ||
| 2896 | +// getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<ArrayList<Campaign>>() { | ||
| 2897 | +// @Override | ||
| 2898 | +// public void onSuccess(ArrayList<Campaign> result) { | ||
| 2899 | +// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | ||
| 2900 | +// WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); | ||
| 2901 | +// } | ||
| 2902 | +// | ||
| 2903 | +// @Override | ||
| 2904 | +// public void onFailure(int errorCode) { | ||
| 2905 | +// | ||
| 2906 | +// } | ||
| 2907 | +// }); | ||
| 2908 | +// } | ||
| 2909 | +// | ||
| 2910 | +// @Override | ||
| 2911 | +// public void onFailure(Call<ResponseBody> call, Throwable t) { | ||
| 2912 | +// LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); | ||
| 2913 | +// dynatraceEvent.setEventName("custom_success_read_campaign_loyalty"); | ||
| 2914 | +// EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); | ||
| 2915 | +// | ||
| 2916 | +// getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<ArrayList<Campaign>>() { | ||
| 2917 | +// @Override | ||
| 2918 | +// public void onSuccess(ArrayList<Campaign> result) { | ||
| 2919 | +// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | ||
| 2920 | +// WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); | ||
| 2921 | +// } | ||
| 2922 | +// | ||
| 2923 | +// @Override | ||
| 2924 | +// public void onFailure(int errorCode) { | ||
| 2925 | +// | ||
| 2926 | +// } | ||
| 2927 | +// }); | ||
| 2928 | +// } | ||
| 2929 | +// }); | ||
| 2930 | + } | ||
| 2931 | + | ||
| 2863 | private static boolean isMyServiceRunning(Class<?> serviceClass) { | 2932 | private static boolean isMyServiceRunning(Class<?> serviceClass) { | 
| 2864 | ActivityManager manager = (ActivityManager) Warply.getWarplyContext().getSystemService(Context.ACTIVITY_SERVICE); | 2933 | ActivityManager manager = (ActivityManager) Warply.getWarplyContext().getSystemService(Context.ACTIVITY_SERVICE); | 
| 2865 | for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { | 2934 | for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { | ... | ... | 
- 
Please register or login to post a comment