Showing
10 changed files
with
124 additions
and
109 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.6rc33' | 5 | + PUBLISH_VERSION = '4.5.4.6rc34' |
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
| 7 | } | 7 | } |
| 8 | 8 | ... | ... |
| ... | @@ -100,7 +100,7 @@ public enum Warply { | ... | @@ -100,7 +100,7 @@ public enum Warply { |
| 100 | public static Map<WarpConstants.LocationSetting, Integer> LOCATION_SETTINGS_MAP; | 100 | public static Map<WarpConstants.LocationSetting, Integer> LOCATION_SETTINGS_MAP; |
| 101 | private static final int MINIMUM_REQUESTS_FOR_SENDING = 10; | 101 | private static final int MINIMUM_REQUESTS_FOR_SENDING = 10; |
| 102 | 102 | ||
| 103 | - public WeakReference<Context> mContext; | 103 | + public Context mContext; |
| 104 | private CallbackReceiver<ServiceRegistrationCallback> mRegistrationListener; | 104 | private CallbackReceiver<ServiceRegistrationCallback> mRegistrationListener; |
| 105 | private RequestQueue mRequestQueue; | 105 | private RequestQueue mRequestQueue; |
| 106 | 106 | ||
| ... | @@ -130,7 +130,7 @@ public enum Warply { | ... | @@ -130,7 +130,7 @@ public enum Warply { |
| 130 | @Override | 130 | @Override |
| 131 | public void onInit(Context context) { | 131 | public void onInit(Context context) { |
| 132 | if (context != null) { | 132 | if (context != null) { |
| 133 | - INSTANCE.mContext = new WeakReference<>(context.getApplicationContext()); | 133 | + INSTANCE.mContext = context.getApplicationContext(); |
| 134 | } | 134 | } |
| 135 | initInternal(context); | 135 | initInternal(context); |
| 136 | } | 136 | } |
| ... | @@ -144,14 +144,14 @@ public enum Warply { | ... | @@ -144,14 +144,14 @@ public enum Warply { |
| 144 | } | 144 | } |
| 145 | if (INSTANCE.mRequestQueue == null) | 145 | if (INSTANCE.mRequestQueue == null) |
| 146 | INSTANCE.mRequestQueue = Volley.newRequestQueue(context); | 146 | INSTANCE.mRequestQueue = Volley.newRequestQueue(context); |
| 147 | - INSTANCE.mContext = new WeakReference<>(context.getApplicationContext()); | 147 | + INSTANCE.mContext = context.getApplicationContext(); |
| 148 | - WarpConstants.DEBUG = WarplyProperty.isDebugMode(INSTANCE.mContext.get()); | 148 | + WarpConstants.DEBUG = WarplyProperty.isDebugMode(INSTANCE.mContext); |
| 149 | INSTANCE.isInitializedOrThrow(); | 149 | INSTANCE.isInitializedOrThrow(); |
| 150 | - WarpConstants.GCM_SENDER_ID = WarpUtils.getLastGCMSenderId(INSTANCE.mContext.get()); | 150 | + WarpConstants.GCM_SENDER_ID = WarpUtils.getLastGCMSenderId(INSTANCE.mContext); |
| 151 | if (!WarpUtils.getLastApplicationUUID(context).equals(WarplyProperty.getAppUuid(context))) { | 151 | if (!WarpUtils.getLastApplicationUUID(context).equals(WarplyProperty.getAppUuid(context))) { |
| 152 | resetWarplyWebId(); | 152 | resetWarplyWebId(); |
| 153 | } | 153 | } |
| 154 | - WarplyServerPreferencesManager.initiateMicroAppStatusesMap(); | 154 | + WarplyServerPreferencesManager.initiateMicroAppStatusesMap(context); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | /** | 157 | /** |
| ... | @@ -163,13 +163,13 @@ public enum Warply { | ... | @@ -163,13 +163,13 @@ public enum Warply { |
| 163 | WarpUtils.log("Warply has not been initialized, call init(Context) first"); | 163 | WarpUtils.log("Warply has not been initialized, call init(Context) first"); |
| 164 | // return; | 164 | // return; |
| 165 | } | 165 | } |
| 166 | - if (mContext != null && mContext.get() == null) { | 166 | + if (mContext != null) { |
| 167 | WarpUtils.log("Warply has not been initialized, call init(Context) first"); | 167 | WarpUtils.log("Warply has not been initialized, call init(Context) first"); |
| 168 | // return; | 168 | // return; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | - if (mContext != null && mContext.get() != null) { | 171 | + if (mContext != null) { |
| 172 | - String apiKey = WarplyProperty.getAppUuid(mContext.get()); | 172 | + String apiKey = WarplyProperty.getAppUuid(mContext); |
| 173 | if (TextUtils.isEmpty(apiKey)) { | 173 | if (TextUtils.isEmpty(apiKey)) { |
| 174 | WarpUtils.log("Warply application UUID has not been set in the Manifest"); | 174 | WarpUtils.log("Warply application UUID has not been set in the Manifest"); |
| 175 | // return; | 175 | // return; |
| ... | @@ -268,7 +268,7 @@ public enum Warply { | ... | @@ -268,7 +268,7 @@ public enum Warply { |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | private void getContextInternal(CallbackReceiver<JSONObject> receiver) { | 270 | private void getContextInternal(CallbackReceiver<JSONObject> receiver) { |
| 271 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 271 | + if (!WarpUtils.isRegisteredWarply(mContext)) { |
| 272 | if (receiver != null) | 272 | if (receiver != null) |
| 273 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); | 273 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); |
| 274 | return; | 274 | return; |
| ... | @@ -291,7 +291,7 @@ public enum Warply { | ... | @@ -291,7 +291,7 @@ public enum Warply { |
| 291 | 291 | ||
| 292 | private void getMicroappDataInternal(String microappName, | 292 | private void getMicroappDataInternal(String microappName, |
| 293 | CallbackReceiver<JSONObject> receiver) { | 293 | CallbackReceiver<JSONObject> receiver) { |
| 294 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 294 | + if (!WarpUtils.isRegisteredWarply(mContext)) { |
| 295 | if (receiver != null) | 295 | if (receiver != null) |
| 296 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); | 296 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); |
| 297 | return; | 297 | return; |
| ... | @@ -328,7 +328,7 @@ public enum Warply { | ... | @@ -328,7 +328,7 @@ public enum Warply { |
| 328 | 328 | ||
| 329 | private void postReceiveMicroappDataInternal(String microappName, | 329 | private void postReceiveMicroappDataInternal(String microappName, |
| 330 | JSONObject jObj, CallbackReceiver<JSONObject> receiver) { | 330 | JSONObject jObj, CallbackReceiver<JSONObject> receiver) { |
| 331 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 331 | + if (!WarpUtils.isRegisteredWarply(mContext)) { |
| 332 | if (receiver != null) | 332 | if (receiver != null) |
| 333 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); | 333 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); |
| 334 | return; | 334 | return; |
| ... | @@ -346,7 +346,7 @@ public enum Warply { | ... | @@ -346,7 +346,7 @@ public enum Warply { |
| 346 | 346 | ||
| 347 | private void postReceiveMicroappDataInternal(boolean hasAuthHeaders, String path, JSONObject jObj, | 347 | private void postReceiveMicroappDataInternal(boolean hasAuthHeaders, String path, JSONObject jObj, |
| 348 | CallbackReceiver<JSONObject> receiver) { | 348 | CallbackReceiver<JSONObject> receiver) { |
| 349 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 349 | + if (!WarpUtils.isRegisteredWarply(mContext)) { |
| 350 | if (receiver != null) | 350 | if (receiver != null) |
| 351 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); | 351 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); |
| 352 | return; | 352 | return; |
| ... | @@ -362,7 +362,7 @@ public enum Warply { | ... | @@ -362,7 +362,7 @@ public enum Warply { |
| 362 | 362 | ||
| 363 | private void postReceiveMicroappDataInternal(String microappName, boolean hasAuthHeaders, String path, | 363 | private void postReceiveMicroappDataInternal(String microappName, boolean hasAuthHeaders, String path, |
| 364 | JSONObject jObj, CallbackReceiver<JSONObject> receiver) { | 364 | JSONObject jObj, CallbackReceiver<JSONObject> receiver) { |
| 365 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 365 | + if (!WarpUtils.isRegisteredWarply(mContext)) { |
| 366 | if (receiver != null) | 366 | if (receiver != null) |
| 367 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); | 367 | receiver.onFailure(WarpConstants.RESULT_CODE_NOT_REGISTERED); |
| 368 | return; | 368 | return; |
| ... | @@ -410,11 +410,26 @@ public enum Warply { | ... | @@ -410,11 +410,26 @@ public enum Warply { |
| 410 | INSTANCE.postMicroappDataInternal(microappName, jObj, force); | 410 | INSTANCE.postMicroappDataInternal(microappName, jObj, force); |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | + public static void postMicroappData(Context context, String microappName, JSONObject jObj, boolean force) { | ||
| 414 | + INSTANCE.isInitializedOrThrow(); | ||
| 415 | + INSTANCE.postMicroappDataInternal(context, microappName, jObj, force); | ||
| 416 | + } | ||
| 417 | + | ||
| 413 | private void postMicroappDataInternal(String microappName, JSONObject jObj, boolean force) { | 418 | private void postMicroappDataInternal(String microappName, JSONObject jObj, boolean force) { |
| 414 | isInitializedOrThrow(); | 419 | isInitializedOrThrow(); |
| 415 | long requestsInQueueCount = 0; | 420 | long requestsInQueueCount = 0; |
| 416 | - if (jObj != null) { | 421 | + if (jObj != null && mContext != null) { |
| 417 | - requestsInQueueCount = WarplyDBHelper.getInstance(mContext.get()).addRequest( | 422 | + requestsInQueueCount = WarplyDBHelper.getInstance(mContext).addRequest( |
| 423 | + microappName, jObj.toString(), force); | ||
| 424 | + } | ||
| 425 | + tryWakingSendingTaskInternal(requestsInQueueCount); | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + private void postMicroappDataInternal(Context context, String microappName, JSONObject jObj, boolean force) { | ||
| 429 | + isInitializedOrThrow(); | ||
| 430 | + long requestsInQueueCount = 0; | ||
| 431 | + if (jObj != null && context != null) { | ||
| 432 | + requestsInQueueCount = WarplyDBHelper.getInstance(context).addRequest( | ||
| 418 | microappName, jObj.toString(), force); | 433 | microappName, jObj.toString(), force); |
| 419 | } | 434 | } |
| 420 | tryWakingSendingTaskInternal(requestsInQueueCount); | 435 | tryWakingSendingTaskInternal(requestsInQueueCount); |
| ... | @@ -429,7 +444,7 @@ public enum Warply { | ... | @@ -429,7 +444,7 @@ public enum Warply { |
| 429 | isInitializedOrThrow(); | 444 | isInitializedOrThrow(); |
| 430 | long requestsInQueueCount = 0; | 445 | long requestsInQueueCount = 0; |
| 431 | if (jObj != null) { | 446 | if (jObj != null) { |
| 432 | - requestsInQueueCount = WarplyDBHelper.getInstance(mContext.get()).addPushRequest( | 447 | + requestsInQueueCount = WarplyDBHelper.getInstance(mContext).addPushRequest( |
| 433 | microappName, jObj.toString(), force); | 448 | microappName, jObj.toString(), force); |
| 434 | } | 449 | } |
| 435 | tryWakingSendingPushTaskInternal(requestsInQueueCount, false); | 450 | tryWakingSendingPushTaskInternal(requestsInQueueCount, false); |
| ... | @@ -444,7 +459,7 @@ public enum Warply { | ... | @@ -444,7 +459,7 @@ public enum Warply { |
| 444 | isInitializedOrThrow(); | 459 | isInitializedOrThrow(); |
| 445 | long requestsInQueueCount = 0; | 460 | long requestsInQueueCount = 0; |
| 446 | if (jObj != null) { | 461 | if (jObj != null) { |
| 447 | - requestsInQueueCount = WarplyDBHelper.getInstance(mContext.get()).addPushAckRequest( | 462 | + requestsInQueueCount = WarplyDBHelper.getInstance(mContext).addPushAckRequest( |
| 448 | microappName, jObj.toString(), force); | 463 | microappName, jObj.toString(), force); |
| 449 | } | 464 | } |
| 450 | tryWakingSendingPushAckTaskInternal(requestsInQueueCount, false); | 465 | tryWakingSendingPushAckTaskInternal(requestsInQueueCount, false); |
| ... | @@ -468,7 +483,7 @@ public enum Warply { | ... | @@ -468,7 +483,7 @@ public enum Warply { |
| 468 | } | 483 | } |
| 469 | 484 | ||
| 470 | final String requestSignature = request.getSignature(); | 485 | final String requestSignature = request.getSignature(); |
| 471 | - final WarplyPreferences warplyPreferences = new WarplyPreferences(INSTANCE.mContext.get()); | 486 | + final WarplyPreferences warplyPreferences = new WarplyPreferences(INSTANCE.mContext); |
| 472 | long elapsedTimeAfterLastUpdate = System.currentTimeMillis() - warplyPreferences.getInboxLastCachedTimeStamp(requestSignature); | 487 | long elapsedTimeAfterLastUpdate = System.currentTimeMillis() - warplyPreferences.getInboxLastCachedTimeStamp(requestSignature); |
| 473 | long updateInterval = request.getCacheUpdateInterval(); | 488 | long updateInterval = request.getCacheUpdateInterval(); |
| 474 | boolean isNeedUpdateCampaignsByTimeStamp = elapsedTimeAfterLastUpdate > updateInterval; | 489 | boolean isNeedUpdateCampaignsByTimeStamp = elapsedTimeAfterLastUpdate > updateInterval; |
| ... | @@ -478,7 +493,7 @@ public enum Warply { | ... | @@ -478,7 +493,7 @@ public enum Warply { |
| 478 | || INSTANCE.mLastReceivedCampaigns.size() == 0 | 493 | || INSTANCE.mLastReceivedCampaigns.size() == 0 |
| 479 | || !INSTANCE.mLastReceivedCampaigns.getRequestSignature().equals(requestSignature)) { | 494 | || !INSTANCE.mLastReceivedCampaigns.getRequestSignature().equals(requestSignature)) { |
| 480 | 495 | ||
| 481 | - final ObjectSerializer objectSerializer = new ObjectSerializer(INSTANCE.mContext.get()); | 496 | + final ObjectSerializer objectSerializer = new ObjectSerializer(INSTANCE.mContext); |
| 482 | CampaignList campaignsCache = (CampaignList) objectSerializer.deserialize(File.separator + requestSignature); | 497 | CampaignList campaignsCache = (CampaignList) objectSerializer.deserialize(File.separator + requestSignature); |
| 483 | if (isNeedUpdateCampaignsByTimeStamp | 498 | if (isNeedUpdateCampaignsByTimeStamp |
| 484 | || campaignsCache == null | 499 | || campaignsCache == null |
| ... | @@ -671,7 +686,7 @@ public enum Warply { | ... | @@ -671,7 +686,7 @@ public enum Warply { |
| 671 | final SimpleCallbackReceiver<Boolean> callback) { | 686 | final SimpleCallbackReceiver<Boolean> callback) { |
| 672 | 687 | ||
| 673 | INSTANCE.isInitializedOrThrow(); | 688 | INSTANCE.isInitializedOrThrow(); |
| 674 | - final WarplyPreferences warplyPreferences = new WarplyPreferences(INSTANCE.mContext.get()); | 689 | + final WarplyPreferences warplyPreferences = new WarplyPreferences(INSTANCE.mContext); |
| 675 | if (warplyPreferences.getBoolean(WarpConstants.KEY_APP_VAR_UPDATE_HAS, false) | 690 | if (warplyPreferences.getBoolean(WarpConstants.KEY_APP_VAR_UPDATE_HAS, false) |
| 676 | && warplyPreferences.getInt(WarpConstants.KEY_APP_VAR_UPDATE_VERSION_CODE, 0) > | 691 | && warplyPreferences.getInt(WarpConstants.KEY_APP_VAR_UPDATE_VERSION_CODE, 0) > |
| 677 | WarplyProperty.getAppVersionCode(Warply.getWarplyContext())) { | 692 | WarplyProperty.getAppVersionCode(Warply.getWarplyContext())) { |
| ... | @@ -756,7 +771,7 @@ public enum Warply { | ... | @@ -756,7 +771,7 @@ public enum Warply { |
| 756 | 771 | ||
| 757 | private void registerWarplyInternal() { | 772 | private void registerWarplyInternal() { |
| 758 | isInitializedOrThrow(); | 773 | isInitializedOrThrow(); |
| 759 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) | 774 | + if (!WarpUtils.isRegisteredWarply(mContext)) |
| 760 | wakeRegistrationTask(); | 775 | wakeRegistrationTask(); |
| 761 | } | 776 | } |
| 762 | 777 | ||
| ... | @@ -773,7 +788,7 @@ public enum Warply { | ... | @@ -773,7 +788,7 @@ public enum Warply { |
| 773 | 788 | ||
| 774 | private void resetWarplyWebIdInternal() { | 789 | private void resetWarplyWebIdInternal() { |
| 775 | isInitializedOrThrow(); | 790 | isInitializedOrThrow(); |
| 776 | - WarpUtils.setWebId(mContext.get(), ""); | 791 | + WarpUtils.setWebId(mContext, ""); |
| 777 | if (mRegistrationListener != null) | 792 | if (mRegistrationListener != null) |
| 778 | mRegistrationListener | 793 | mRegistrationListener |
| 779 | .onSuccess(ServiceRegistrationCallback.UNREGISTERED_WARPLY); | 794 | .onSuccess(ServiceRegistrationCallback.UNREGISTERED_WARPLY); |
| ... | @@ -790,7 +805,7 @@ public enum Warply { | ... | @@ -790,7 +805,7 @@ public enum Warply { |
| 790 | } | 805 | } |
| 791 | 806 | ||
| 792 | private void setGCMEnabledInternal(boolean enabled) { | 807 | private void setGCMEnabledInternal(boolean enabled) { |
| 793 | - WarpUtils.setGCMEnabled(mContext.get(), enabled); | 808 | + WarpUtils.setGCMEnabled(mContext, enabled); |
| 794 | } | 809 | } |
| 795 | 810 | ||
| 796 | /** | 811 | /** |
| ... | @@ -809,7 +824,7 @@ public enum Warply { | ... | @@ -809,7 +824,7 @@ public enum Warply { |
| 809 | } | 824 | } |
| 810 | 825 | ||
| 811 | private Context getWarplyContextInternal() { | 826 | private Context getWarplyContextInternal() { |
| 812 | - return mContext.get(); | 827 | + return mContext; |
| 813 | } | 828 | } |
| 814 | 829 | ||
| 815 | /** | 830 | /** |
| ... | @@ -830,20 +845,20 @@ public enum Warply { | ... | @@ -830,20 +845,20 @@ public enum Warply { |
| 830 | WarpUtils.log("**************************************************"); | 845 | WarpUtils.log("**************************************************"); |
| 831 | 846 | ||
| 832 | 847 | ||
| 833 | - final WarplyDeviceInfoCollector deviceInfoCollector = new WarplyDeviceInfoCollector(mContext.get()); | 848 | + final WarplyDeviceInfoCollector deviceInfoCollector = new WarplyDeviceInfoCollector(mContext); |
| 834 | deviceInfoCollector.collectToJson(new SimpleCallbackReceiver<JSONObject>() { | 849 | deviceInfoCollector.collectToJson(new SimpleCallbackReceiver<JSONObject>() { |
| 835 | @Override | 850 | @Override |
| 836 | public void onResult(JSONObject json, int errorCode) { | 851 | public void onResult(JSONObject json, int errorCode) { |
| 837 | super.onResult(json, errorCode); | 852 | super.onResult(json, errorCode); |
| 838 | 853 | ||
| 839 | if (json != null) { | 854 | if (json != null) { |
| 840 | - if (!WarpUtils.getIsDeviceInfoSaved(mContext.get())) { | 855 | + if (!WarpUtils.getIsDeviceInfoSaved(mContext)) { |
| 841 | - WarpUtils.setIsDeviceInfoSaved(mContext.get(), true); | 856 | + WarpUtils.setIsDeviceInfoSaved(mContext, true); |
| 842 | - WarpUtils.setDeviceInfoObject(mContext.get(), json); | 857 | + WarpUtils.setDeviceInfoObject(mContext, json); |
| 843 | postMicroappData(WarpConstants.MICROAPP_DEVICE_INFO, json, true); | 858 | postMicroappData(WarpConstants.MICROAPP_DEVICE_INFO, json, true); |
| 844 | } else { | 859 | } else { |
| 845 | - if (hasDeviceInfoDifference(WarpUtils.getDeviceInfoObject(mContext.get()), json)) { | 860 | + if (hasDeviceInfoDifference(WarpUtils.getDeviceInfoObject(mContext), json)) { |
| 846 | - WarpUtils.setDeviceInfoObject(mContext.get(), json); | 861 | + WarpUtils.setDeviceInfoObject(mContext, json); |
| 847 | postMicroappData(WarpConstants.MICROAPP_DEVICE_INFO, json, true); | 862 | postMicroappData(WarpConstants.MICROAPP_DEVICE_INFO, json, true); |
| 848 | } | 863 | } |
| 849 | } | 864 | } |
| ... | @@ -894,21 +909,21 @@ public enum Warply { | ... | @@ -894,21 +909,21 @@ public enum Warply { |
| 894 | WarpUtils.log("**************************************************"); | 909 | WarpUtils.log("**************************************************"); |
| 895 | JSONObject object = new JSONObject(); | 910 | JSONObject object = new JSONObject(); |
| 896 | try { | 911 | try { |
| 897 | - PackageInfo info = mContext.get().getPackageManager().getPackageInfo(mContext.get().getApplicationContext().getPackageName(), 0); | 912 | + PackageInfo info = mContext.getPackageManager().getPackageInfo(mContext.getApplicationContext().getPackageName(), 0); |
| 898 | 913 | ||
| 899 | - if (WarpUtils.getTrackersEnabled(mContext.get())) { | 914 | + if (WarpUtils.getTrackersEnabled(mContext)) { |
| 900 | object.putOpt("app_version", info.versionName); | 915 | object.putOpt("app_version", info.versionName); |
| 901 | object.putOpt("sdk_version", WarpConstants.SDK_VERSION); | 916 | object.putOpt("sdk_version", WarpConstants.SDK_VERSION); |
| 902 | object.putOpt("app_build", info.versionCode); | 917 | object.putOpt("app_build", info.versionCode); |
| 903 | } | 918 | } |
| 904 | // object.putOpt("bundle_identifier", mContext.get().getApplicationContext().getPackageName()); | 919 | // object.putOpt("bundle_identifier", mContext.get().getApplicationContext().getPackageName()); |
| 905 | - if (!WarpUtils.getHasApplicationInfo(mContext.get())) { | 920 | + if (!WarpUtils.getHasApplicationInfo(mContext)) { |
| 906 | - WarpUtils.setHasApplicationInfo(mContext.get(), true); | 921 | + WarpUtils.setHasApplicationInfo(mContext, true); |
| 907 | - WarpUtils.setAppDataObject(mContext.get(), object); | 922 | + WarpUtils.setAppDataObject(mContext, object); |
| 908 | postMicroappData(WarpConstants.MICROAPP_APPLICATION_DATA, object, force); | 923 | postMicroappData(WarpConstants.MICROAPP_APPLICATION_DATA, object, force); |
| 909 | } else { | 924 | } else { |
| 910 | - if (hasApplicationDataDifference(WarpUtils.getAppDataObject(mContext.get()), object)) { | 925 | + if (hasApplicationDataDifference(WarpUtils.getAppDataObject(mContext), object)) { |
| 911 | - WarpUtils.setAppDataObject(mContext.get(), object); | 926 | + WarpUtils.setAppDataObject(mContext, object); |
| 912 | postMicroappData(WarpConstants.MICROAPP_APPLICATION_DATA, object, force); | 927 | postMicroappData(WarpConstants.MICROAPP_APPLICATION_DATA, object, force); |
| 913 | } | 928 | } |
| 914 | } | 929 | } |
| ... | @@ -949,8 +964,8 @@ public enum Warply { | ... | @@ -949,8 +964,8 @@ public enum Warply { |
| 949 | WarpUtils.log("************* WARPLY Info ********************"); | 964 | WarpUtils.log("************* WARPLY Info ********************"); |
| 950 | WarpUtils.log("[WARP Trace] Resetting application info"); | 965 | WarpUtils.log("[WARP Trace] Resetting application info"); |
| 951 | WarpUtils.log("**********************************************"); | 966 | WarpUtils.log("**********************************************"); |
| 952 | - WarpUtils.setLastApplicationData(mContext.get(), ""); | 967 | + WarpUtils.setLastApplicationData(mContext, ""); |
| 953 | - if (WarpUtils.getIsAPPDATAENABLED(mContext.get())) | 968 | + if (WarpUtils.getIsAPPDATAENABLED(mContext)) |
| 954 | postApplicationData(true); | 969 | postApplicationData(true); |
| 955 | } | 970 | } |
| 956 | 971 | ||
| ... | @@ -960,7 +975,7 @@ public enum Warply { | ... | @@ -960,7 +975,7 @@ public enum Warply { |
| 960 | } | 975 | } |
| 961 | 976 | ||
| 962 | private void resetDeviceInfoInternal() { | 977 | private void resetDeviceInfoInternal() { |
| 963 | - WarpUtils.setLastDeviceInfo(mContext.get(), ""); | 978 | + WarpUtils.setLastDeviceInfo(mContext, ""); |
| 964 | // postDeviceInfoData(); | 979 | // postDeviceInfoData(); |
| 965 | } | 980 | } |
| 966 | 981 | ||
| ... | @@ -970,7 +985,7 @@ public enum Warply { | ... | @@ -970,7 +985,7 @@ public enum Warply { |
| 970 | } | 985 | } |
| 971 | 986 | ||
| 972 | private void resetIsWarpedInternal() { | 987 | private void resetIsWarpedInternal() { |
| 973 | - String lastGCMSenderId = WarpUtils.getLastGCMSenderId(mContext.get()); | 988 | + String lastGCMSenderId = WarpUtils.getLastGCMSenderId(mContext); |
| 974 | if (lastGCMSenderId == null) | 989 | if (lastGCMSenderId == null) |
| 975 | return; | 990 | return; |
| 976 | if (lastGCMSenderId.equals("")) | 991 | if (lastGCMSenderId.equals("")) |
| ... | @@ -999,15 +1014,15 @@ public enum Warply { | ... | @@ -999,15 +1014,15 @@ public enum Warply { |
| 999 | if (mContext == null) { | 1014 | if (mContext == null) { |
| 1000 | return; | 1015 | return; |
| 1001 | } | 1016 | } |
| 1002 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 1017 | + if (!WarpUtils.isRegisteredWarply(mContext)) { |
| 1003 | registerWarply(); | 1018 | registerWarply(); |
| 1004 | return; | 1019 | return; |
| 1005 | } | 1020 | } |
| 1006 | - if (WarpUtils.getIsDEVICEINFOENABLED(mContext.get())) | 1021 | + if (WarpUtils.getIsDEVICEINFOENABLED(mContext)) |
| 1007 | postDeviceInfoData(); | 1022 | postDeviceInfoData(); |
| 1008 | - if (WarpUtils.getIsAPPDATAENABLED(mContext.get())) | 1023 | + if (WarpUtils.getIsAPPDATAENABLED(mContext)) |
| 1009 | postApplicationData(true); | 1024 | postApplicationData(true); |
| 1010 | - tryWakingSendingTaskInternal(WarplyDBHelper.getInstance(mContext.get()) | 1025 | + tryWakingSendingTaskInternal(WarplyDBHelper.getInstance(mContext) |
| 1011 | .getRequestsInQueueCount()); | 1026 | .getRequestsInQueueCount()); |
| 1012 | } | 1027 | } |
| 1013 | 1028 | ||
| ... | @@ -1018,7 +1033,7 @@ public enum Warply { | ... | @@ -1018,7 +1033,7 @@ public enum Warply { |
| 1018 | 1033 | ||
| 1019 | ArrayList<Long> ids = new ArrayList<>(); | 1034 | ArrayList<Long> ids = new ArrayList<>(); |
| 1020 | JSONArray jArray = new JSONArray(); | 1035 | JSONArray jArray = new JSONArray(); |
| 1021 | - Cursor c = WarplyDBHelper.getInstance(mContext.get()).getAllRequests(); | 1036 | + Cursor c = WarplyDBHelper.getInstance(mContext).getAllRequests(); |
| 1022 | while (c.moveToNext()) { | 1037 | while (c.moveToNext()) { |
| 1023 | JSONObject jObj = new JSONObject(); | 1038 | JSONObject jObj = new JSONObject(); |
| 1024 | try { | 1039 | try { |
| ... | @@ -1053,7 +1068,7 @@ public enum Warply { | ... | @@ -1053,7 +1068,7 @@ public enum Warply { |
| 1053 | 1068 | ||
| 1054 | ArrayList<Long> ids = new ArrayList<>(); | 1069 | ArrayList<Long> ids = new ArrayList<>(); |
| 1055 | JSONArray jArray = new JSONArray(); | 1070 | JSONArray jArray = new JSONArray(); |
| 1056 | - Cursor c = WarplyDBHelper.getInstance(mContext.get()).getAllPushRequests(); | 1071 | + Cursor c = WarplyDBHelper.getInstance(mContext).getAllPushRequests(); |
| 1057 | while (c.moveToNext()) { | 1072 | while (c.moveToNext()) { |
| 1058 | JSONObject jObj = new JSONObject(); | 1073 | JSONObject jObj = new JSONObject(); |
| 1059 | try { | 1074 | try { |
| ... | @@ -1084,7 +1099,7 @@ public enum Warply { | ... | @@ -1084,7 +1099,7 @@ public enum Warply { |
| 1084 | 1099 | ||
| 1085 | ArrayList<Long> ids = new ArrayList<>(); | 1100 | ArrayList<Long> ids = new ArrayList<>(); |
| 1086 | JSONArray jArray = new JSONArray(); | 1101 | JSONArray jArray = new JSONArray(); |
| 1087 | - Cursor c = WarplyDBHelper.getInstance(mContext.get()).getAllPushAckRequests(); | 1102 | + Cursor c = WarplyDBHelper.getInstance(mContext).getAllPushAckRequests(); |
| 1088 | while (c.moveToNext()) { | 1103 | while (c.moveToNext()) { |
| 1089 | JSONObject jObj = new JSONObject(); | 1104 | JSONObject jObj = new JSONObject(); |
| 1090 | try { | 1105 | try { |
| ... | @@ -1115,11 +1130,11 @@ public enum Warply { | ... | @@ -1115,11 +1130,11 @@ public enum Warply { |
| 1115 | public static void tryWakingSendingTask() { | 1130 | public static void tryWakingSendingTask() { |
| 1116 | INSTANCE.isInitializedOrThrow(); | 1131 | INSTANCE.isInitializedOrThrow(); |
| 1117 | INSTANCE.tryWakingSendingTaskInternal(WarplyDBHelper.getInstance( | 1132 | INSTANCE.tryWakingSendingTaskInternal(WarplyDBHelper.getInstance( |
| 1118 | - INSTANCE.mContext.get()).getRequestsInQueueCount()); | 1133 | + INSTANCE.mContext).getRequestsInQueueCount()); |
| 1119 | } | 1134 | } |
| 1120 | 1135 | ||
| 1121 | private void tryWakingSendingTaskInternal(long requestsInQueue) { | 1136 | private void tryWakingSendingTaskInternal(long requestsInQueue) { |
| 1122 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 1137 | + if (!WarpUtils.isRegisteredWarply(mContext)) { |
| 1123 | WarpUtils | 1138 | WarpUtils |
| 1124 | .log("************* WARPLY Registration ********************"); | 1139 | .log("************* WARPLY Registration ********************"); |
| 1125 | WarpUtils | 1140 | WarpUtils |
| ... | @@ -1132,7 +1147,7 @@ public enum Warply { | ... | @@ -1132,7 +1147,7 @@ public enum Warply { |
| 1132 | // if (WarplyDBHelper.getInstance(mContext.get()).isForceRequestsExist() | 1147 | // if (WarplyDBHelper.getInstance(mContext.get()).isForceRequestsExist() |
| 1133 | // || (requestsInQueue >= MINIMUM_REQUESTS_FOR_SENDING)) { | 1148 | // || (requestsInQueue >= MINIMUM_REQUESTS_FOR_SENDING)) { |
| 1134 | 1149 | ||
| 1135 | - if (WarplyDBHelper.getInstance(mContext.get()).isForceRequestsExist() | 1150 | + if (WarplyDBHelper.getInstance(mContext).isForceRequestsExist() |
| 1136 | || (requestsInQueue > 0)) { | 1151 | || (requestsInQueue > 0)) { |
| 1137 | 1152 | ||
| 1138 | WarpUtils.log("Waking post task!"); | 1153 | WarpUtils.log("Waking post task!"); |
| ... | @@ -1145,11 +1160,11 @@ public enum Warply { | ... | @@ -1145,11 +1160,11 @@ public enum Warply { |
| 1145 | public static void tryWakingSendingPushTask(boolean force) { | 1160 | public static void tryWakingSendingPushTask(boolean force) { |
| 1146 | INSTANCE.isInitializedOrThrow(); | 1161 | INSTANCE.isInitializedOrThrow(); |
| 1147 | INSTANCE.tryWakingSendingPushTaskInternal(WarplyDBHelper.getInstance( | 1162 | INSTANCE.tryWakingSendingPushTaskInternal(WarplyDBHelper.getInstance( |
| 1148 | - INSTANCE.mContext.get()).getPushRequestsInQueueCount(), force); | 1163 | + INSTANCE.mContext).getPushRequestsInQueueCount(), force); |
| 1149 | } | 1164 | } |
| 1150 | 1165 | ||
| 1151 | private void tryWakingSendingPushTaskInternal(long requestsInQueue, boolean force) { | 1166 | private void tryWakingSendingPushTaskInternal(long requestsInQueue, boolean force) { |
| 1152 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 1167 | + if (!WarpUtils.isRegisteredWarply(mContext)) { |
| 1153 | WarpUtils | 1168 | WarpUtils |
| 1154 | .log("************* WARPLY Registration ********************"); | 1169 | .log("************* WARPLY Registration ********************"); |
| 1155 | WarpUtils | 1170 | WarpUtils |
| ... | @@ -1170,11 +1185,11 @@ public enum Warply { | ... | @@ -1170,11 +1185,11 @@ public enum Warply { |
| 1170 | public static void tryWakingSendingPushAckTask(boolean force) { | 1185 | public static void tryWakingSendingPushAckTask(boolean force) { |
| 1171 | INSTANCE.isInitializedOrThrow(); | 1186 | INSTANCE.isInitializedOrThrow(); |
| 1172 | INSTANCE.tryWakingSendingPushAckTaskInternal(WarplyDBHelper.getInstance( | 1187 | INSTANCE.tryWakingSendingPushAckTaskInternal(WarplyDBHelper.getInstance( |
| 1173 | - INSTANCE.mContext.get()).getPushAckRequestsInQueueCount(), force); | 1188 | + INSTANCE.mContext).getPushAckRequestsInQueueCount(), force); |
| 1174 | } | 1189 | } |
| 1175 | 1190 | ||
| 1176 | private void tryWakingSendingPushAckTaskInternal(long requestsInQueue, boolean force) { | 1191 | private void tryWakingSendingPushAckTaskInternal(long requestsInQueue, boolean force) { |
| 1177 | - if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 1192 | + if (!WarpUtils.isRegisteredWarply(mContext)) { |
| 1178 | WarpUtils | 1193 | WarpUtils |
| 1179 | .log("************* WARPLY Registration ********************"); | 1194 | .log("************* WARPLY Registration ********************"); |
| 1180 | WarpUtils | 1195 | WarpUtils |
| ... | @@ -1312,8 +1327,8 @@ public enum Warply { | ... | @@ -1312,8 +1327,8 @@ public enum Warply { |
| 1312 | } | 1327 | } |
| 1313 | 1328 | ||
| 1314 | WarpUtils.log("************* WARPLY " + methodName + " Context ********************"); | 1329 | WarpUtils.log("************* WARPLY " + methodName + " Context ********************"); |
| 1315 | - WarpUtils.log("[WARP Trace] HTTP Web Id: " + WarpUtils.getWebId(mContext.get())); | 1330 | + WarpUtils.log("[WARP Trace] HTTP Web Id: " + WarpUtils.getWebId(mContext)); |
| 1316 | - WarpUtils.log("[WARP Trace] HTTP API Key: " + WarplyProperty.getAppUuid(mContext.get())); | 1331 | + WarpUtils.log("[WARP Trace] HTTP API Key: " + WarplyProperty.getAppUuid(mContext)); |
| 1317 | WarpUtils.verbose("[WARP Trace] HTTP " + methodName + " Request URL: " + url); | 1332 | WarpUtils.verbose("[WARP Trace] HTTP " + methodName + " Request URL: " + url); |
| 1318 | if (data != null) { | 1333 | if (data != null) { |
| 1319 | try { | 1334 | try { |
| ... | @@ -1389,8 +1404,8 @@ public enum Warply { | ... | @@ -1389,8 +1404,8 @@ public enum Warply { |
| 1389 | } | 1404 | } |
| 1390 | 1405 | ||
| 1391 | WarpUtils.log("************* WARPLY " + methodName + " Context ********************"); | 1406 | WarpUtils.log("************* WARPLY " + methodName + " Context ********************"); |
| 1392 | - WarpUtils.log("[WARP Trace] HTTP Web Id: " + WarpUtils.getWebId(mContext.get())); | 1407 | + WarpUtils.log("[WARP Trace] HTTP Web Id: " + WarpUtils.getWebId(mContext)); |
| 1393 | - WarpUtils.log("[WARP Trace] HTTP API Key: " + WarplyProperty.getAppUuid(mContext.get())); | 1408 | + WarpUtils.log("[WARP Trace] HTTP API Key: " + WarplyProperty.getAppUuid(mContext)); |
| 1394 | WarpUtils.verbose("[WARP Trace] HTTP " + methodName + " Request URL: " + url); | 1409 | WarpUtils.verbose("[WARP Trace] HTTP " + methodName + " Request URL: " + url); |
| 1395 | if (data != null) { | 1410 | if (data != null) { |
| 1396 | try { | 1411 | try { |
| ... | @@ -1436,8 +1451,8 @@ public enum Warply { | ... | @@ -1436,8 +1451,8 @@ public enum Warply { |
| 1436 | } | 1451 | } |
| 1437 | 1452 | ||
| 1438 | WarpUtils.log("************* WARPLY " + methodName + " Context ********************"); | 1453 | WarpUtils.log("************* WARPLY " + methodName + " Context ********************"); |
| 1439 | - WarpUtils.log("[WARP Trace] HTTP Web Id: " + WarpUtils.getWebId(mContext.get())); | 1454 | + WarpUtils.log("[WARP Trace] HTTP Web Id: " + WarpUtils.getWebId(mContext)); |
| 1440 | - WarpUtils.log("[WARP Trace] HTTP API Key: " + WarplyProperty.getAppUuid(mContext.get())); | 1455 | + WarpUtils.log("[WARP Trace] HTTP API Key: " + WarplyProperty.getAppUuid(mContext)); |
| 1441 | WarpUtils.verbose("[WARP Trace] HTTP " + methodName + " Request URL: " + url); | 1456 | WarpUtils.verbose("[WARP Trace] HTTP " + methodName + " Request URL: " + url); |
| 1442 | if (data != null) { | 1457 | if (data != null) { |
| 1443 | try { | 1458 | try { |
| ... | @@ -1469,13 +1484,13 @@ public enum Warply { | ... | @@ -1469,13 +1484,13 @@ public enum Warply { |
| 1469 | } | 1484 | } |
| 1470 | 1485 | ||
| 1471 | if (tempAnalytics != null && tempAnalytics.length() > 0) { | 1486 | if (tempAnalytics != null && tempAnalytics.length() > 0) { |
| 1472 | - String urlAnalytics = WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_ANALYTICS + WarplyProperty.getAppUuid(mContext.get()) + "/"; | 1487 | + String urlAnalytics = WarplyProperty.getBaseUrl(mContext) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_ANALYTICS + WarplyProperty.getAppUuid(mContext) + "/"; |
| 1473 | WarplyJsonArrayRequest requestAnalytics = new WarplyJsonArrayRequest(method, urlAnalytics, tempAnalytics, vt, vt); | 1488 | WarplyJsonArrayRequest requestAnalytics = new WarplyJsonArrayRequest(method, urlAnalytics, tempAnalytics, vt, vt); |
| 1474 | requestAnalytics.setTag(tag); | 1489 | requestAnalytics.setTag(tag); |
| 1475 | mRequestQueue.add(requestAnalytics); | 1490 | mRequestQueue.add(requestAnalytics); |
| 1476 | } | 1491 | } |
| 1477 | if (tempDeviceInfo != null && tempDeviceInfo.length() > 0) { | 1492 | if (tempDeviceInfo != null && tempDeviceInfo.length() > 0) { |
| 1478 | - String urlDeviceInfo = WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_DEVICE_INFO + WarplyProperty.getAppUuid(mContext.get()) + "/"; | 1493 | + String urlDeviceInfo = WarplyProperty.getBaseUrl(mContext) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_DEVICE_INFO + WarplyProperty.getAppUuid(mContext) + "/"; |
| 1479 | WarplyJsonArrayRequest requestDeviceInfo = new WarplyJsonArrayRequest(method, urlDeviceInfo, tempDeviceInfo, vt, vt); | 1494 | WarplyJsonArrayRequest requestDeviceInfo = new WarplyJsonArrayRequest(method, urlDeviceInfo, tempDeviceInfo, vt, vt); |
| 1480 | requestDeviceInfo.setTag(tag); | 1495 | requestDeviceInfo.setTag(tag); |
| 1481 | mRequestQueue.add(requestDeviceInfo); | 1496 | mRequestQueue.add(requestDeviceInfo); |
| ... | @@ -1539,10 +1554,10 @@ public enum Warply { | ... | @@ -1539,10 +1554,10 @@ public enum Warply { |
| 1539 | } | 1554 | } |
| 1540 | 1555 | ||
| 1541 | if (tempAnalytics != null && tempAnalytics.length() > 0) { | 1556 | if (tempAnalytics != null && tempAnalytics.length() > 0) { |
| 1542 | - url = WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_ANALYTICS + WarplyProperty.getAppUuid(mContext.get()) + "/"; | 1557 | + url = WarplyProperty.getBaseUrl(mContext) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_ANALYTICS + WarplyProperty.getAppUuid(mContext) + "/"; |
| 1543 | } | 1558 | } |
| 1544 | if (tempDeviceInfo != null && tempDeviceInfo.length() > 0) { | 1559 | if (tempDeviceInfo != null && tempDeviceInfo.length() > 0) { |
| 1545 | - url = WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_DEVICE_INFO + WarplyProperty.getAppUuid(mContext.get()) + "/"; | 1560 | + url = WarplyProperty.getBaseUrl(mContext) + WarpConstants.WARPLY_ASYNC + WarpConstants.WARPLY_DEVICE_INFO + WarplyProperty.getAppUuid(mContext) + "/"; |
| 1546 | } | 1561 | } |
| 1547 | if (tempOther != null && tempOther.length() > 0) { | 1562 | if (tempOther != null && tempOther.length() > 0) { |
| 1548 | url = buildWarplyRequestUrl(warplyPath); | 1563 | url = buildWarplyRequestUrl(warplyPath); |
| ... | @@ -1554,8 +1569,8 @@ public enum Warply { | ... | @@ -1554,8 +1569,8 @@ public enum Warply { |
| 1554 | private void getFromServerInternal(JSONObject data, String warplyPath, | 1569 | private void getFromServerInternal(JSONObject data, String warplyPath, |
| 1555 | CallbackReceiver<JSONObject> listener, Object tag) { | 1570 | CallbackReceiver<JSONObject> listener, Object tag) { |
| 1556 | String url = buildWarplyRequestUrl(warplyPath); | 1571 | String url = buildWarplyRequestUrl(warplyPath); |
| 1557 | - if (WarpUtils.getCurrentTimeMillis(mContext.get()) == 0 || (WarpUtils.getCurrentTimeMillis(mContext.get()) > 0) && (System.currentTimeMillis() > WarpUtils.getCurrentTimeMillis(mContext.get()) + (3600000))) { | 1572 | + if (WarpUtils.getCurrentTimeMillis(mContext) == 0 || (WarpUtils.getCurrentTimeMillis(mContext) > 0) && (System.currentTimeMillis() > WarpUtils.getCurrentTimeMillis(mContext) + (3600000))) { |
| 1558 | - WarpUtils.setCurrentTimeMillis(mContext.get(), System.currentTimeMillis()); | 1573 | + WarpUtils.setCurrentTimeMillis(mContext, System.currentTimeMillis()); |
| 1559 | requestToServerInternal(Method.GET, url, data, listener, tag); | 1574 | requestToServerInternal(Method.GET, url, data, listener, tag); |
| 1560 | } | 1575 | } |
| 1561 | } | 1576 | } |
| ... | @@ -1566,10 +1581,10 @@ public enum Warply { | ... | @@ -1566,10 +1581,10 @@ public enum Warply { |
| 1566 | } | 1581 | } |
| 1567 | 1582 | ||
| 1568 | private void registerToServerInternal() { | 1583 | private void registerToServerInternal() { |
| 1569 | - final String url = WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.BASE_URL_MOBILE + WarplyProperty.getAppUuid(mContext.get()) | 1584 | + final String url = WarplyProperty.getBaseUrl(mContext) + WarpConstants.BASE_URL_MOBILE + WarplyProperty.getAppUuid(mContext) |
| 1570 | + "/" + WarpConstants.PATH_REGISTER + "/"; | 1585 | + "/" + WarpConstants.PATH_REGISTER + "/"; |
| 1571 | 1586 | ||
| 1572 | - new WarplyDeviceInfoCollector(mContext.get()).getRegistrationParams(new SimpleCallbackReceiver<JSONObject>() { | 1587 | + new WarplyDeviceInfoCollector(mContext).getRegistrationParams(new SimpleCallbackReceiver<JSONObject>() { |
| 1573 | @Override | 1588 | @Override |
| 1574 | public void onResult(JSONObject result, int errorCode) { | 1589 | public void onResult(JSONObject result, int errorCode) { |
| 1575 | super.onResult(result, errorCode); | 1590 | super.onResult(result, errorCode); |
| ... | @@ -1579,8 +1594,8 @@ public enum Warply { | ... | @@ -1579,8 +1594,8 @@ public enum Warply { |
| 1579 | } | 1594 | } |
| 1580 | 1595 | ||
| 1581 | private String buildWarplyRequestUrl(String warplyPath) { | 1596 | private String buildWarplyRequestUrl(String warplyPath) { |
| 1582 | - StringBuilder sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.BASE_URL_MOBILE); | 1597 | + StringBuilder sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext) + WarpConstants.BASE_URL_MOBILE); |
| 1583 | - sb.append(WarplyProperty.getAppUuid(mContext.get())).append("/") | 1598 | + sb.append(WarplyProperty.getAppUuid(mContext)).append("/") |
| 1584 | .append(WarpConstants.PATH_CONTEXT).append("/"); | 1599 | .append(WarpConstants.PATH_CONTEXT).append("/"); |
| 1585 | if (warplyPath != null) | 1600 | if (warplyPath != null) |
| 1586 | sb.append("?path=").append(warplyPath); | 1601 | sb.append("?path=").append(warplyPath); |
| ... | @@ -1588,8 +1603,8 @@ public enum Warply { | ... | @@ -1588,8 +1603,8 @@ public enum Warply { |
| 1588 | } | 1603 | } |
| 1589 | 1604 | ||
| 1590 | private String buildWarplyRequestUrl(String warplyPath, boolean personalized) { | 1605 | private String buildWarplyRequestUrl(String warplyPath, boolean personalized) { |
| 1591 | - StringBuilder sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.BASE_URL_AUTH); | 1606 | + StringBuilder sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext) + WarpConstants.BASE_URL_AUTH); |
| 1592 | - sb.append(WarplyProperty.getAppUuid(mContext.get())).append("/") | 1607 | + sb.append(WarplyProperty.getAppUuid(mContext)).append("/") |
| 1593 | .append(WarpConstants.PATH_CONTEXT); | 1608 | .append(WarpConstants.PATH_CONTEXT); |
| 1594 | if (warplyPath != null) | 1609 | if (warplyPath != null) |
| 1595 | sb.append("?path=").append(warplyPath); | 1610 | sb.append("?path=").append(warplyPath); |
| ... | @@ -1599,16 +1614,16 @@ public enum Warply { | ... | @@ -1599,16 +1614,16 @@ public enum Warply { |
| 1599 | private String buildWarplyAuthRequestUrl(String warplyPath, boolean isUserPath) { | 1614 | private String buildWarplyAuthRequestUrl(String warplyPath, boolean isUserPath) { |
| 1600 | StringBuilder sb; | 1615 | StringBuilder sb; |
| 1601 | if (isUserPath) | 1616 | if (isUserPath) |
| 1602 | - sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.BASE_URL_USER_AUTH); | 1617 | + sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext) + WarpConstants.BASE_URL_USER_AUTH); |
| 1603 | else { | 1618 | else { |
| 1604 | if (warplyPath.equals("handle_image")) | 1619 | if (warplyPath.equals("handle_image")) |
| 1605 | - sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.BASE_URL_API); | 1620 | + sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext) + WarpConstants.BASE_URL_API); |
| 1606 | else if (warplyPath.equals("verify")) | 1621 | else if (warplyPath.equals("verify")) |
| 1607 | - sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext.get()) + WarplyProperty.getVerifyUrl(mContext.get())); | 1622 | + sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext) + WarplyProperty.getVerifyUrl(mContext)); |
| 1608 | else if (warplyPath.equals("cosuser")) | 1623 | else if (warplyPath.equals("cosuser")) |
| 1609 | - sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext.get()) + "/partners/oauth/" + WarplyProperty.getAppUuid(mContext.get()) + "/token"); | 1624 | + sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext) + "/partners/oauth/" + WarplyProperty.getAppUuid(mContext) + "/token"); |
| 1610 | else | 1625 | else |
| 1611 | - sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.BASE_URL_AUTH); | 1626 | + sb = new StringBuilder(WarplyProperty.getBaseUrl(mContext) + WarpConstants.BASE_URL_AUTH); |
| 1612 | } | 1627 | } |
| 1613 | 1628 | ||
| 1614 | if (warplyPath != null) { | 1629 | if (warplyPath != null) { |
| ... | @@ -1616,7 +1631,7 @@ public enum Warply { | ... | @@ -1616,7 +1631,7 @@ public enum Warply { |
| 1616 | if (warplyPath.equals("cosuser")) { | 1631 | if (warplyPath.equals("cosuser")) { |
| 1617 | return sb.toString(); | 1632 | return sb.toString(); |
| 1618 | } | 1633 | } |
| 1619 | - sb.append(WarplyProperty.getAppUuid(mContext.get())).append("/"); | 1634 | + sb.append(WarplyProperty.getAppUuid(mContext)).append("/"); |
| 1620 | if (warplyPath.equals("generate")) { | 1635 | if (warplyPath.equals("generate")) { |
| 1621 | sb.append(WarpConstants.BASE_URL_OTP); | 1636 | sb.append(WarpConstants.BASE_URL_OTP); |
| 1622 | } | 1637 | } |
| ... | @@ -1670,18 +1685,18 @@ public enum Warply { | ... | @@ -1670,18 +1685,18 @@ public enum Warply { |
| 1670 | public void onSuccess(JSONObject result) { | 1685 | public void onSuccess(JSONObject result) { |
| 1671 | result = result.optJSONObject("context"); | 1686 | result = result.optJSONObject("context"); |
| 1672 | if (result != null) { | 1687 | if (result != null) { |
| 1673 | - WarpUtils.setLastDeviceInfo(mContext.get(), ""); | 1688 | + WarpUtils.setLastDeviceInfo(mContext, ""); |
| 1674 | - WarpUtils.setLastApplicationData(mContext.get(), ""); | 1689 | + WarpUtils.setLastApplicationData(mContext, ""); |
| 1675 | - WarpUtils.setLastApplicationUUID(mContext.get(), WarplyProperty.getAppUuid(mContext.get())); | 1690 | + WarpUtils.setLastApplicationUUID(mContext, WarplyProperty.getAppUuid(mContext)); |
| 1676 | - WarplyDBHelper.getInstance(mContext.get()).deleteAllRequests(); | 1691 | + WarplyDBHelper.getInstance(mContext).deleteAllRequests(); |
| 1677 | - WarplyDBHelper.getInstance(mContext.get()).deleteAllPushRequests(); | 1692 | + WarplyDBHelper.getInstance(mContext).deleteAllPushRequests(); |
| 1678 | - WarplyDBHelper.getInstance(mContext.get()).deleteAllPushAckRequests(); | 1693 | + WarplyDBHelper.getInstance(mContext).deleteAllPushAckRequests(); |
| 1679 | String webId = result.optString("web_id", ""); | 1694 | String webId = result.optString("web_id", ""); |
| 1680 | - WarpUtils.setWebId(mContext.get(), webId); | 1695 | + WarpUtils.setWebId(mContext, webId); |
| 1681 | String apiKey = result.optString("api_key", ""); | 1696 | String apiKey = result.optString("api_key", ""); |
| 1682 | - WarpUtils.setApiKey(mContext.get(), apiKey); | 1697 | + WarpUtils.setApiKey(mContext, apiKey); |
| 1683 | WarpUtils.log("************* WARPLY Registration ********************"); | 1698 | WarpUtils.log("************* WARPLY Registration ********************"); |
| 1684 | - WarpUtils.log("[WARPLY Registration] URL: " + WarplyProperty.getBaseUrl(mContext.get())); | 1699 | + WarpUtils.log("[WARPLY Registration] URL: " + WarplyProperty.getBaseUrl(mContext)); |
| 1685 | WarpUtils.log("[WARPLY Registration] WEB_ID: " + webId); | 1700 | WarpUtils.log("[WARPLY Registration] WEB_ID: " + webId); |
| 1686 | try { | 1701 | try { |
| 1687 | WarpUtils.log("[WARPLY Registration] Response: " + result.toString(2)); | 1702 | WarpUtils.log("[WARPLY Registration] Response: " + result.toString(2)); |
| ... | @@ -1706,7 +1721,7 @@ public enum Warply { | ... | @@ -1706,7 +1721,7 @@ public enum Warply { |
| 1706 | mRegistrationListener.onFailure(errorCode); | 1721 | mRegistrationListener.onFailure(errorCode); |
| 1707 | 1722 | ||
| 1708 | if (errorCode == 3) { | 1723 | if (errorCode == 3) { |
| 1709 | - final String url = WarplyProperty.getBaseUrl(mContext.get()) + WarpConstants.BASE_URL_MOBILE + WarplyProperty.getAppUuid(mContext.get()) | 1724 | + final String url = WarplyProperty.getBaseUrl(mContext) + WarpConstants.BASE_URL_MOBILE + WarplyProperty.getAppUuid(mContext) |
| 1710 | + "/" + WarpConstants.PATH_REGISTER + "/"; | 1725 | + "/" + WarpConstants.PATH_REGISTER + "/"; |
| 1711 | requestToServerInternal(Method.GET, url, (JSONObject) null, mRegistrationCallBackReceiver, null); | 1726 | requestToServerInternal(Method.GET, url, (JSONObject) null, mRegistrationCallBackReceiver, null); |
| 1712 | } else | 1727 | } else | ... | ... |
| ... | @@ -254,8 +254,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -254,8 +254,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
| 254 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 254 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 255 | if (requestCode == 1000) { | 255 | if (requestCode == 1000) { |
| 256 | if (resultCode == RESULT_OK) { | 256 | if (resultCode == RESULT_OK) { |
| 257 | - if (!TextUtils.isEmpty(WarplyManagerHelper.getUserTag())) { | 257 | + if (!TextUtils.isEmpty(WarplyManagerHelper.getUserTag(LoyaltyWallet.this))) { |
| 258 | - mTvUserBadge.setText(WarplyManagerHelper.getUserTag()); | 258 | + mTvUserBadge.setText(WarplyManagerHelper.getUserTag(LoyaltyWallet.this)); |
| 259 | mLlQuestionnaire.setVisibility(View.GONE); | 259 | mLlQuestionnaire.setVisibility(View.GONE); |
| 260 | mLlUserBadge.setVisibility(View.VISIBLE); | 260 | mLlUserBadge.setVisibility(View.VISIBLE); |
| 261 | } else { | 261 | } else { |
| ... | @@ -489,8 +489,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -489,8 +489,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
| 489 | .into(mIvProfilePhoto); | 489 | .into(mIvProfilePhoto); |
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | - if (!TextUtils.isEmpty(WarplyManagerHelper.getUserTag())) { | 492 | + if (!TextUtils.isEmpty(WarplyManagerHelper.getUserTag(this))) { |
| 493 | - mTvUserBadge.setText(WarplyManagerHelper.getUserTag()); | 493 | + mTvUserBadge.setText(WarplyManagerHelper.getUserTag(this)); |
| 494 | mLlQuestionnaire.setVisibility(View.GONE); | 494 | mLlQuestionnaire.setVisibility(View.GONE); |
| 495 | mLlUserBadge.setVisibility(View.VISIBLE); | 495 | mLlUserBadge.setVisibility(View.VISIBLE); |
| 496 | } else { | 496 | } else { | ... | ... |
| ... | @@ -113,9 +113,9 @@ public class VolleyTransformer implements Listener<JSONObject>, ErrorListener { | ... | @@ -113,9 +113,9 @@ public class VolleyTransformer implements Listener<JSONObject>, ErrorListener { |
| 113 | return; | 113 | return; |
| 114 | WarpUtils.log("**************** WARPLY Response *****************"); | 114 | WarpUtils.log("**************** WARPLY Response *****************"); |
| 115 | WarpUtils.verbose("[WARP Trace] HTTP Web Id: " | 115 | WarpUtils.verbose("[WARP Trace] HTTP Web Id: " |
| 116 | - + WarpUtils.getWebId(Warply.INSTANCE.mContext.get())); | 116 | + + WarpUtils.getWebId(Warply.INSTANCE.mContext)); |
| 117 | WarpUtils.verbose("[WARP Trace] HTTP API Key: " | 117 | WarpUtils.verbose("[WARP Trace] HTTP API Key: " |
| 118 | - + WarplyProperty.getAppUuid(Warply.INSTANCE.mContext.get())); | 118 | + + WarplyProperty.getAppUuid(Warply.INSTANCE.mContext)); |
| 119 | if (response != null) { | 119 | if (response != null) { |
| 120 | try { | 120 | try { |
| 121 | // WarpUtils.log("[WARP Trace] Request: " + response.toString(2)); | 121 | // WarpUtils.log("[WARP Trace] Request: " + response.toString(2)); | ... | ... |
| ... | @@ -61,7 +61,7 @@ public class PrefsUtils { | ... | @@ -61,7 +61,7 @@ public class PrefsUtils { |
| 61 | ); | 61 | ); |
| 62 | 62 | ||
| 63 | return encryptedSharedPreferences; | 63 | return encryptedSharedPreferences; |
| 64 | - } catch (GeneralSecurityException | IOException e) { | 64 | + } catch (Exception e) { |
| 65 | WarpUtils.log("PrefUtils Get Encrypted Shared Preferences Error", e); | 65 | WarpUtils.log("PrefUtils Get Encrypted Shared Preferences Error", e); |
| 66 | return PreferenceManager.getDefaultSharedPreferences(context); | 66 | return PreferenceManager.getDefaultSharedPreferences(context); |
| 67 | } | 67 | } | ... | ... |
| ... | @@ -256,7 +256,7 @@ public class WarpUtils { | ... | @@ -256,7 +256,7 @@ public class WarpUtils { |
| 256 | ); | 256 | ); |
| 257 | 257 | ||
| 258 | _prefs = encryptedSharedPreferences; | 258 | _prefs = encryptedSharedPreferences; |
| 259 | - } catch (GeneralSecurityException | IOException e) { | 259 | + } catch (Exception e) { |
| 260 | WarpUtils.log("WarpUtils Get Encrypted Shared Preferences Error", e); | 260 | WarpUtils.log("WarpUtils Get Encrypted Shared Preferences Error", e); |
| 261 | _prefs = context.getSharedPreferences(PREFERENCES_NAME, | 261 | _prefs = context.getSharedPreferences(PREFERENCES_NAME, |
| 262 | Context.MODE_PRIVATE); | 262 | Context.MODE_PRIVATE); | ... | ... |
| ... | @@ -1065,8 +1065,8 @@ public class WarplyManagerHelper { | ... | @@ -1065,8 +1065,8 @@ public class WarplyManagerHelper { |
| 1065 | /** | 1065 | /** |
| 1066 | * Get user badge tag | 1066 | * Get user badge tag |
| 1067 | */ | 1067 | */ |
| 1068 | - public static String getUserTag() { | 1068 | + public static String getUserTag(Context context) { |
| 1069 | - return WarpUtils.getUserTag(Warply.getWarplyContext()); | 1069 | + return WarpUtils.getUserTag(context); |
| 1070 | } | 1070 | } |
| 1071 | 1071 | ||
| 1072 | /** | 1072 | /** | ... | ... |
| ... | @@ -39,7 +39,7 @@ public class WarplyPreferences { | ... | @@ -39,7 +39,7 @@ public class WarplyPreferences { |
| 39 | ); | 39 | ); |
| 40 | 40 | ||
| 41 | this.warplySharedPrefs = encryptedSharedPreferences; | 41 | this.warplySharedPrefs = encryptedSharedPreferences; |
| 42 | - } catch (GeneralSecurityException | IOException e) { | 42 | + } catch (Exception e) { |
| 43 | WarpUtils.log("WarplyPreferences Encrypted Shared Preferences Error", e); | 43 | WarpUtils.log("WarplyPreferences Encrypted Shared Preferences Error", e); |
| 44 | this.warplySharedPrefs = context. | 44 | this.warplySharedPrefs = context. |
| 45 | getSharedPreferences(WARPLY_SHARED_PREFS, Activity.MODE_PRIVATE); | 45 | getSharedPreferences(WARPLY_SHARED_PREFS, Activity.MODE_PRIVATE); | ... | ... |
| ... | @@ -27,12 +27,12 @@ public class WarplyProvider extends ContentProvider { | ... | @@ -27,12 +27,12 @@ public class WarplyProvider extends ContentProvider { |
| 27 | new CalligraphyConfig.Builder() | 27 | new CalligraphyConfig.Builder() |
| 28 | .setDefaultFontPath("fonts/pf_square_sans_pro_regular.ttf") | 28 | .setDefaultFontPath("fonts/pf_square_sans_pro_regular.ttf") |
| 29 | .setFontAttrId(R.attr.fontPath) | 29 | .setFontAttrId(R.attr.fontPath) |
| 30 | - .setFontMapper(new FontMapper() { | 30 | +// .setFontMapper(new FontMapper() { |
| 31 | - @Override | 31 | +// @Override |
| 32 | - public String map(String font) { | 32 | +// public String map(String font) { |
| 33 | - return font; | 33 | +// return font; |
| 34 | - } | 34 | +// } |
| 35 | - }) | 35 | +// }) |
| 36 | .build())) | 36 | .build())) |
| 37 | .build()); | 37 | .build()); |
| 38 | 38 | ... | ... |
| ... | @@ -187,7 +187,7 @@ public class WarplyAnalyticsManager { | ... | @@ -187,7 +187,7 @@ public class WarplyAnalyticsManager { |
| 187 | if (metadata != null) { | 187 | if (metadata != null) { |
| 188 | jObj.putOpt("action_metadata", metadata); | 188 | jObj.putOpt("action_metadata", metadata); |
| 189 | } | 189 | } |
| 190 | - Warply.postMicroappData(WarpConstants.MICROAPP_INAPP_ANALYTICS, jObj, force); | 190 | + Warply.postMicroappData(context, WarpConstants.MICROAPP_INAPP_ANALYTICS, jObj, force); |
| 191 | } catch (JSONException e) { | 191 | } catch (JSONException e) { |
| 192 | if (WarpConstants.DEBUG) { | 192 | if (WarpConstants.DEBUG) { |
| 193 | e.printStackTrace(); | 193 | e.printStackTrace(); | ... | ... |
-
Please register or login to post a comment