Showing
5 changed files
with
52 additions
and
2 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-cosbeta73a' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta73' | 
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 
| 7 | } | 7 | } | 
| 8 | 8 | ... | ... | 
| ... | @@ -50,6 +50,7 @@ import androidx.work.WorkManager; | ... | @@ -50,6 +50,7 @@ import androidx.work.WorkManager; | 
| 50 | 50 | ||
| 51 | import org.greenrobot.eventbus.EventBus; | 51 | import org.greenrobot.eventbus.EventBus; | 
| 52 | import org.greenrobot.eventbus.Subscribe; | 52 | import org.greenrobot.eventbus.Subscribe; | 
| 53 | +import org.json.JSONException; | ||
| 53 | import org.json.JSONObject; | 54 | import org.json.JSONObject; | 
| 54 | 55 | ||
| 55 | import java.security.SecureRandom; | 56 | import java.security.SecureRandom; | 
| ... | @@ -60,6 +61,7 @@ import java.util.concurrent.ThreadLocalRandom; | ... | @@ -60,6 +61,7 @@ import java.util.concurrent.ThreadLocalRandom; | 
| 60 | import java.util.concurrent.TimeUnit; | 61 | import java.util.concurrent.TimeUnit; | 
| 61 | 62 | ||
| 62 | import ly.warp.sdk.Warply; | 63 | import ly.warp.sdk.Warply; | 
| 64 | +import ly.warp.sdk.db.WarplyDBHelper; | ||
| 63 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 65 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 
| 64 | import ly.warp.sdk.io.models.CouponList; | 66 | import ly.warp.sdk.io.models.CouponList; | 
| 65 | import ly.warp.sdk.io.request.PacingCalculateRequest; | 67 | import ly.warp.sdk.io.request.PacingCalculateRequest; | 
| ... | @@ -86,7 +88,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -86,7 +88,7 @@ public class WarpViewActivity extends WarpBaseActivity { | 
| 86 | // =========================================================== | 88 | // =========================================================== | 
| 87 | 89 | ||
| 88 | private WarpView mWarpView; | 90 | private WarpView mWarpView; | 
| 89 | - private static Handler metersHandler = new Handler(); | 91 | + private static Handler metersHandler; | 
| 90 | 92 | ||
| 91 | // =========================================================== | 93 | // =========================================================== | 
| 92 | // Methods for/from SuperClass/Interfaces | 94 | // Methods for/from SuperClass/Interfaces | 
| ... | @@ -95,6 +97,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -95,6 +97,7 @@ public class WarpViewActivity extends WarpBaseActivity { | 
| 95 | @Override | 97 | @Override | 
| 96 | public void onCreate(Bundle savedInstanceState) { | 98 | public void onCreate(Bundle savedInstanceState) { | 
| 97 | super.onCreate(savedInstanceState); | 99 | super.onCreate(savedInstanceState); | 
| 100 | + metersHandler = new Handler(); | ||
| 98 | WarplySessionManager.onCreateActivity(this); | 101 | WarplySessionManager.onCreateActivity(this); | 
| 99 | initViews(); | 102 | initViews(); | 
| 100 | Warply.getInitializer(this).init(); | 103 | Warply.getInitializer(this).init(); | 
| ... | @@ -223,6 +226,22 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -223,6 +226,22 @@ public class WarpViewActivity extends WarpBaseActivity { | 
| 223 | // user viewed campaign through notification | 226 | // user viewed campaign through notification | 
| 224 | if (intent.hasExtra("source") && intent.getStringExtra("source"). | 227 | if (intent.hasExtra("source") && intent.getStringExtra("source"). | 
| 225 | equalsIgnoreCase("from_notification_status")) { | 228 | equalsIgnoreCase("from_notification_status")) { | 
| 229 | + JSONObject params = new JSONObject(); | ||
| 230 | + try { | ||
| 231 | + params.putOpt("web_id", WarpUtils.getWebId(Warply.getWarplyContext())); | ||
| 232 | + params.putOpt("app_uuid", WarplyProperty.getAppUuid(Warply.getWarplyContext())); | ||
| 233 | + params.putOpt("api_key", WarpUtils.getApiKey(Warply.getWarplyContext())); | ||
| 234 | + params.putOpt("session_uuid", sessionUUID); | ||
| 235 | + params.putOpt("access_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")); | ||
| 236 | + params.putOpt("refresh_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token")); | ||
| 237 | + params.putOpt("client_id", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id")); | ||
| 238 | + params.putOpt("client_secret", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret")); | ||
| 239 | + } catch (JSONException e) { | ||
| 240 | + e.printStackTrace(); | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + WarpUtils.setWebviewParams(Warply.getWarplyContext(), params); | ||
| 244 | + | ||
| 226 | setUpPushEvents(sessionUUID); | 245 | setUpPushEvents(sessionUUID); | 
| 227 | } | 246 | } | 
| 228 | 247 | ... | ... | 
| ... | @@ -73,6 +73,7 @@ import ly.warp.sdk.io.models.PushCampaign; | ... | @@ -73,6 +73,7 @@ import ly.warp.sdk.io.models.PushCampaign; | 
| 73 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | 73 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | 
| 74 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; | 74 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; | 
| 75 | import ly.warp.sdk.io.request.CosmoteSharingRequest; | 75 | import ly.warp.sdk.io.request.CosmoteSharingRequest; | 
| 76 | +import ly.warp.sdk.io.request.WarplyConsumerRequest; | ||
| 76 | import ly.warp.sdk.io.request.WarplyEditConsumerRequest; | 77 | import ly.warp.sdk.io.request.WarplyEditConsumerRequest; | 
| 77 | import ly.warp.sdk.io.request.WarplyIntegrationRequest; | 78 | import ly.warp.sdk.io.request.WarplyIntegrationRequest; | 
| 78 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | 79 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | 
| ... | @@ -962,6 +963,35 @@ public class WarplyManagerHelper { | ... | @@ -962,6 +963,35 @@ public class WarplyManagerHelper { | 
| 962 | @Override | 963 | @Override | 
| 963 | public void onSuccess(JSONObject result) { | 964 | public void onSuccess(JSONObject result) { | 
| 964 | WarpUtils.log("EDIT CONSUMER SUCCESS"); | 965 | WarpUtils.log("EDIT CONSUMER SUCCESS"); | 
| 966 | + WarplyManager.getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { | ||
| 967 | + @Override | ||
| 968 | + public void onSuccess(Consumer result) { | ||
| 969 | + WarplyManagerHelper.setConsumerInternal(result); | ||
| 970 | + | ||
| 971 | + if (result != null) { | ||
| 972 | + JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | ||
| 973 | + if (profMetadata != null && profMetadata.has("nonTelco")) { | ||
| 974 | + WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco")); | ||
| 975 | + } else { | ||
| 976 | + WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false); | ||
| 977 | + } | ||
| 978 | + } | ||
| 979 | + | ||
| 980 | + if (result != null) { | ||
| 981 | + JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | ||
| 982 | + if (profMetadata != null) { | ||
| 983 | + if (profMetadata.has("badge")) { | ||
| 984 | + WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge")); | ||
| 985 | + } | ||
| 986 | + } | ||
| 987 | + } | ||
| 988 | + } | ||
| 989 | + | ||
| 990 | + @Override | ||
| 991 | + public void onFailure(int errorCode) { | ||
| 992 | + | ||
| 993 | + } | ||
| 994 | + }); | ||
| 965 | } | 995 | } | 
| 966 | 996 | ||
| 967 | @Override | 997 | @Override | ... | ... | 
- 
Please register or login to post a comment
 
 
