From f3b0f5b66afd97be39253203891cad7fec8a6eb8 Mon Sep 17 00:00:00 2001 From: Barry Li Date: Mon, 21 Mar 2016 14:38:18 -0700 Subject: [PATCH] ANDROID-604 Rename internal Log class to ApptentiveLog --- .../apptentive/android/sdk/Apptentive.java | 115 +++++++++--------- .../android/sdk/ApptentiveInternal.java | 26 ++-- .../sdk/{Log.java => ApptentiveLog.java} | 4 +- .../apptentive/android/sdk/ViewActivity.java | 11 +- .../android/sdk/comm/ApptentiveClient.java | 52 ++++---- .../lifecycle/ActivityLifecycleManager.java | 24 ++-- .../android/sdk/model/AppRelease.java | 12 +- .../android/sdk/model/AppReleaseFactory.java | 4 +- .../android/sdk/model/CodePointStore.java | 8 +- .../android/sdk/model/Configuration.java | 8 +- .../android/sdk/model/ConversationItem.java | 8 +- .../sdk/model/ConversationTokenRequest.java | 8 +- .../android/sdk/model/CustomData.java | 4 +- .../apptentive/android/sdk/model/Device.java | 52 ++++---- .../android/sdk/model/DeviceFactory.java | 4 +- .../apptentive/android/sdk/model/Event.java | 12 +- .../android/sdk/model/EventFactory.java | 4 +- .../android/sdk/model/ExtendedData.java | 6 +- .../sdk/model/LocationExtendedData.java | 4 +- .../apptentive/android/sdk/model/Payload.java | 6 +- .../android/sdk/model/PayloadFactory.java | 4 +- .../apptentive/android/sdk/model/Person.java | 24 ++-- .../android/sdk/model/PersonFactory.java | 4 +- .../com/apptentive/android/sdk/model/Sdk.java | 16 +-- .../android/sdk/model/SdkFactory.java | 4 +- .../android/sdk/model/SurveyResponse.java | 4 +- .../android/sdk/model/TimeExtendedData.java | 4 +- .../android/sdk/module/ActivityContent.java | 4 +- .../module/engagement/EngagementModule.java | 8 +- .../interaction/InteractionManager.java | 18 +-- .../interaction/model/Interaction.java | 4 +- .../model/InteractionCriteria.java | 10 +- .../interaction/model/Interactions.java | 4 +- .../model/InteractionsPayload.java | 6 +- .../engagement/interaction/model/Targets.java | 4 +- .../model/TextModalInteraction.java | 1 - .../interaction/model/common/Action.java | 4 +- .../interaction/model/common/Actions.java | 4 +- .../view/AppStoreRatingInteractionView.java | 6 +- .../interaction/view/InteractionView.java | 4 +- .../view/NavigateToLinkInteractionView.java | 6 +- .../view/TextModalInteractionView.java | 6 +- .../view/UpgradeMessageInteractionView.java | 4 +- .../view/survey/SurveyInteractionView.java | 4 +- .../module/engagement/logic/ClauseParser.java | 8 +- .../engagement/logic/ConditionalClause.java | 8 +- .../engagement/logic/ConditionalOperator.java | 6 +- .../engagement/logic/ConditionalTest.java | 4 +- .../module/engagement/logic/FieldManager.java | 4 +- .../engagement/logic/LogicalClause.java | 28 ++--- .../module/messagecenter/MessageManager.java | 17 ++- .../messagecenter/MessagePollingWorker.java | 11 +- .../model/ApptentiveMessage.java | 20 +-- .../messagecenter/model/CompoundMessage.java | 8 +- .../messagecenter/model/MessageFactory.java | 4 +- .../view/ApptentiveAvatarView.java | 8 +- .../messagecenter/view/MessageAdapter.java | 12 +- .../view/MessageCenterActivityContent.java | 18 +-- .../sdk/module/metric/MetricModule.java | 8 +- .../rating/impl/GooglePlayRatingProvider.java | 6 +- .../sdk/storage/AppReleaseManager.java | 6 +- .../sdk/storage/ApptentiveDatabase.java | 54 ++++---- .../android/sdk/storage/DeviceManager.java | 4 +- .../sdk/storage/PayloadSendWorker.java | 26 ++-- .../android/sdk/storage/PersonManager.java | 4 +- .../android/sdk/storage/SdkManager.java | 4 +- .../sdk/storage/VersionHistoryStore.java | 4 +- .../android/sdk/util/ActivityUtil.java | 8 +- .../android/sdk/util/JsonDiffer.java | 10 +- .../android/sdk/util/Reflection.java | 6 +- .../com/apptentive/android/sdk/util/Util.java | 22 ++-- .../image/ApptentiveAttachmentLoader.java | 54 ++++---- .../sdk/util/image/ImageGridViewAdapter.java | 6 +- .../android/sdk/util/image/ImageUtil.java | 18 +-- .../util/task/ApptentiveDownloaderTask.java | 20 +-- .../example/push/MyGcmListenerService.java | 8 +- .../push/RegistrationIntentService.java | 4 +- .../ApptentiveInstrumentationTestCase.java | 4 +- .../android/sdk/tests/misc/RandomTests.java | 8 +- .../tests/model/DateTimeComparisonTest.java | 8 +- .../android/sdk/tests/model/EventTests.java | 8 +- .../sdk/tests/model/ExtendedDataTests.java | 8 +- .../sdk/tests/model/ObjectDiffingTests.java | 10 +- .../tests/model/VersionComparisonTest.java | 6 +- .../engagement/CriteriaParsingTest.java | 8 +- .../engagement/DataObjectQueryTest.java | 9 +- .../tests/module/engagement/EventTest.java | 8 +- .../module/engagement/InteractionTest.java | 84 ++++++------- .../NavigateToLinkInteractionTest.java | 16 ++- .../engagement/SurveyInteractionTest.java | 6 +- .../engagement/TextModalInteractionTest.java | 6 +- .../CodePointAndInteractionStoreTest.java | 78 ++++++------ .../engagement/criteria/CornerCases.java | 14 +-- .../engagement/criteria/DefaultValues.java | 8 +- .../engagement/criteria/OperatorTests.java | 48 ++++---- .../criteria/WhitespaceTrimmingTest.java | 8 +- .../sdk/tests/push/TestPushNotifications.java | 9 +- .../android/sdk/tests/util/FileUtil.java | 8 +- 98 files changed, 655 insertions(+), 664 deletions(-) rename apptentive/src/com/apptentive/android/sdk/{Log.java => ApptentiveLog.java} (98%) diff --git a/apptentive/src/com/apptentive/android/sdk/Apptentive.java b/apptentive/src/com/apptentive/android/sdk/Apptentive.java index a71f2631f..fa0483a53 100755 --- a/apptentive/src/com/apptentive/android/sdk/Apptentive.java +++ b/apptentive/src/com/apptentive/android/sdk/Apptentive.java @@ -8,7 +8,6 @@ import android.app.Activity; import android.app.AlertDialog; -import android.app.Application; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -84,7 +83,7 @@ public static void onStart(Activity activity) { runningActivities++; MessageManager.setCurrentForgroundActivity(activity); } catch (Exception e) { - Log.w("Error starting Apptentive Activity.", e); + ApptentiveLog.w("Error starting Apptentive Activity.", e); MetricModule.sendError(activity.getApplicationContext(), e, null, null); } } @@ -99,7 +98,7 @@ public static void onStop(Activity activity) { ActivityLifecycleManager.activityStopped(activity); runningActivities--; if (runningActivities < 0) { - Log.e("Incorrect number of running Activities encountered. Resetting to 0. Did you make sure to call Apptentive.onStart() and Apptentive.onStop() in all your Activities?"); + ApptentiveLog.e("Incorrect number of running Activities encountered. Resetting to 0. Did you make sure to call Apptentive.onStart() and Apptentive.onStop() in all your Activities?"); runningActivities = 0; } // If there are no running activities, wake the thread so it can stop immediately and gracefully. @@ -109,7 +108,7 @@ public static void onStop(Activity activity) { } MessageManager.setCurrentForgroundActivity(null); } catch (Exception e) { - Log.w("Error stopping Apptentive Activity.", e); + ApptentiveLog.w("Error stopping Apptentive Activity.", e); MetricModule.sendError(activity.getApplicationContext(), e, null, null); } } @@ -188,7 +187,7 @@ public static void setCustomDeviceData(Context context, Map cust } DeviceManager.storeCustomDeviceData(context, customData); } catch (JSONException e) { - Log.w("Unable to set custom device data.", e); + ApptentiveLog.w("Unable to set custom device data.", e); } } @@ -267,7 +266,7 @@ public static void removeCustomDeviceData(Context context, String key) { * @deprecated */ public static void setCustomPersonData(Context context, Map customPersonData) { - Log.w("Setting custom person data: %s", customPersonData.toString()); + ApptentiveLog.w("Setting custom person data: %s", customPersonData.toString()); try { CustomData customData = new CustomData(); for (String key : customPersonData.keySet()) { @@ -275,7 +274,7 @@ public static void setCustomPersonData(Context context, Map cust } PersonManager.storeCustomPersonData(context, customData); } catch (JSONException e) { - Log.e("Unable to set custom person data.", e); + ApptentiveLog.e("Unable to set custom person data.", e); } } @@ -371,11 +370,11 @@ private static void addIntegration(Context context, String integration, Map c try { return ApptentiveInternal.showMessageCenterInternal(activity, customData); } catch (Exception e) { - Log.w("Error starting Apptentive Activity.", e); + ApptentiveLog.w("Error starting Apptentive Activity.", e); MetricModule.sendError(activity.getApplicationContext(), e, null, null); } return false; @@ -707,7 +706,7 @@ public static void sendAttachmentText(Context context, String text) { message.setAssociatedFiles(context, null); MessageManager.sendMessage(context.getApplicationContext(), message); } catch (Exception e) { - Log.w("Error sending attachment text.", e); + ApptentiveLog.w("Error sending attachment text.", e); MetricModule.sendError(context, e, null, null); } } @@ -765,7 +764,7 @@ public static void sendAttachmentFile(Context context, String uri) { MessageManager.sendMessage(context.getApplicationContext(), message); } catch (Exception e) { - Log.w("Error sending attachment file.", e); + ApptentiveLog.w("Error sending attachment file.", e); MetricModule.sendError(context, e, null, null); } } @@ -830,7 +829,7 @@ public static void sendAttachmentFile(Context context, InputStream is, String mi MessageManager.sendMessage(context.getApplicationContext(), message); } catch (Exception e) { - Log.w("Error sending attachment file.", e); + ApptentiveLog.w("Error sending attachment file.", e); MetricModule.sendError(context, e, null, null); } } @@ -959,32 +958,32 @@ private static void init(Activity activity) { if (metaData != null) { if (apiKey == null) { apiKey = metaData.getString(Constants.MANIFEST_KEY_APPTENTIVE_API_KEY); - Log.d("Saving API key for the first time: %s", apiKey); + ApptentiveLog.d("Saving API key for the first time: %s", apiKey); prefs.edit().putString(Constants.PREF_KEY_API_KEY, apiKey).apply(); } else { - Log.d("Using cached API Key: %s", apiKey); + ApptentiveLog.d("Using cached API Key: %s", apiKey); } logLevelOverride = metaData.getString(Constants.MANIFEST_KEY_APPTENTIVE_LOG_LEVEL); apptentiveDebug = metaData.getBoolean(Constants.MANIFEST_KEY_APPTENTIVE_DEBUG); ApptentiveClient.useStagingServer = metaData.getBoolean(Constants.MANIFEST_KEY_USE_STAGING_SERVER); } if (apptentiveDebug) { - Log.i("Apptentive debug logging set to VERBOSE."); - ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); + ApptentiveLog.i("Apptentive debug logging set to VERBOSE."); + ApptentiveInternal.setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); } else if (logLevelOverride != null) { - Log.i("Overriding log level: %s", logLevelOverride); - ApptentiveInternal.setMinimumLogLevel(Log.Level.parse(logLevelOverride)); + ApptentiveLog.i("Overriding log level: %s", logLevelOverride); + ApptentiveInternal.setMinimumLogLevel(ApptentiveLog.Level.parse(logLevelOverride)); } else { GlobalInfo.isAppDebuggable = (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; if (GlobalInfo.isAppDebuggable) { - ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); + ApptentiveInternal.setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); } } } catch (Exception e) { - Log.e("Unexpected error while reading application info.", e); + ApptentiveLog.e("Unexpected error while reading application info.", e); } - Log.i("Debug mode enabled? %b", GlobalInfo.isAppDebuggable); + ApptentiveLog.i("Debug mode enabled? %b", GlobalInfo.isAppDebuggable); // If we are in debug mode, but no api key is found, throw an exception. Otherwise, just assert log. We don't want to crash a production app. String errorString = "No Apptentive api key specified. Please make sure you have specified your api key in your AndroidManifest.xml"; @@ -998,11 +997,11 @@ private static void init(Activity activity) { alertDialog.setCanceledOnTouchOutside(false); alertDialog.show(); } - Log.e(errorString); + ApptentiveLog.e(errorString); } GlobalInfo.apiKey = apiKey; - Log.i("API Key: %s", GlobalInfo.apiKey); + ApptentiveLog.i("API Key: %s", GlobalInfo.apiKey); // Grab app info we need to access later on. GlobalInfo.appPackage = appContext.getPackageName(); @@ -1048,9 +1047,9 @@ private static void init(Activity activity) { } GlobalInfo.initialized = true; - Log.v("Done initializing..."); + ApptentiveLog.v("Done initializing..."); } else { - Log.v("Already initialized..."); + ApptentiveLog.v("Already initialized..."); } // Initialize the Conversation Token, or fetch if needed. Fetch config it the token is available. @@ -1066,23 +1065,23 @@ private static void init(Activity activity) { syncSdk(appContext); syncPerson(appContext); - Log.d("Default Locale: %s", Locale.getDefault().toString()); - Log.d("Conversation id: %s", appContext.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE).getString(Constants.PREF_KEY_CONVERSATION_ID, "null")); + ApptentiveLog.d("Default Locale: %s", Locale.getDefault().toString()); + ApptentiveLog.d("Conversation id: %s", appContext.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE).getString(Constants.PREF_KEY_CONVERSATION_ID, "null")); } private static void onAppVersionChanged(Context context, Integer previousVersionCode, Integer currentVersionCode, String previousVersionName, String currentVersionName) { - Log.i("App version changed: Name: %s => %s, Code: %d => %d", previousVersionName, currentVersionName, previousVersionCode, currentVersionCode); + ApptentiveLog.i("App version changed: Name: %s => %s, Code: %d => %d", previousVersionName, currentVersionName, previousVersionCode, currentVersionCode); VersionHistoryStore.updateVersionHistory(context, currentVersionCode, currentVersionName); AppRelease appRelease = AppReleaseManager.storeAppReleaseAndReturnDiff(context); if (appRelease != null) { - Log.d("App release was updated."); + ApptentiveLog.d("App release was updated."); ApptentiveDatabase.getInstance(context).addPayload(appRelease); } invalidateCaches(context); } private static void onSdkVersionChanged(Context context, String previousSdkVersion, String currentSdkVersion) { - Log.i("Sdk version changed: %s => %s", previousSdkVersion, currentSdkVersion); + ApptentiveLog.i("Sdk version changed: %s => %s", previousSdkVersion, currentSdkVersion); context.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE).edit().putString(Constants.PREF_KEY_LAST_SEEN_SDK_VERSION, currentSdkVersion).apply(); invalidateCaches(context); } @@ -1109,7 +1108,7 @@ public void run() { Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable throwable) { - Log.w("Caught UncaughtException in thread \"%s\"", throwable, thread.getName()); + ApptentiveLog.w("Caught UncaughtException in thread \"%s\"", throwable, thread.getName()); MetricModule.sendError(context.getApplicationContext(), throwable, null, null); } }; @@ -1134,23 +1133,23 @@ private static void fetchConversationToken(Context context) { // TODO: Allow host app to send a user id, if available. ApptentiveHttpResponse response = ApptentiveClient.getConversationToken(context, request); if (response == null) { - Log.w("Got null response fetching ConversationToken."); + ApptentiveLog.w("Got null response fetching ConversationToken."); return; } if (response.isSuccessful()) { try { JSONObject root = new JSONObject(response.getContent()); String conversationToken = root.getString("token"); - Log.d("ConversationToken: " + conversationToken); + ApptentiveLog.d("ConversationToken: " + conversationToken); String conversationId = root.getString("id"); - Log.d("New Conversation id: %s", conversationId); + ApptentiveLog.d("New Conversation id: %s", conversationId); if (conversationToken != null && !conversationToken.equals("")) { GlobalInfo.setConversationToken(context, conversationToken); GlobalInfo.setConversationId(context, conversationId); } String personId = root.getString("person_id"); - Log.d("PersonId: " + personId); + ApptentiveLog.d("PersonId: " + personId); if (personId != null && !personId.equals("")) { GlobalInfo.setPersonId(context, personId); } @@ -1158,7 +1157,7 @@ private static void fetchConversationToken(Context context) { asyncFetchAppConfiguration(context); InteractionManager.asyncFetchAndStoreInteractions(context); } catch (JSONException e) { - Log.e("Error parsing ConversationToken response json.", e); + ApptentiveLog.e("Error parsing ConversationToken response json.", e); } } } @@ -1171,7 +1170,7 @@ private static void fetchAppConfiguration(Context context) { // Don't get the app configuration unless forced, or the cache has expired. if (force || Configuration.load(context).hasConfigurationCacheExpired()) { - Log.i("Fetching new Configuration."); + ApptentiveLog.i("Fetching new Configuration."); ApptentiveHttpResponse response = ApptentiveClient.getAppConfiguration(context); try { Map headers = response.getHeaders(); @@ -1181,16 +1180,16 @@ private static void fetchAppConfiguration(Context context) { if (cacheSeconds == null) { cacheSeconds = Constants.CONFIG_DEFAULT_APP_CONFIG_EXPIRATION_DURATION_SECONDS; } - Log.d("Caching configuration for %d seconds.", cacheSeconds); + ApptentiveLog.d("Caching configuration for %d seconds.", cacheSeconds); Configuration config = new Configuration(response.getContent()); config.setConfigurationCacheExpirationMillis(System.currentTimeMillis() + cacheSeconds * 1000); config.save(context); } } catch (JSONException e) { - Log.e("Error parsing app configuration from server.", e); + ApptentiveLog.e("Error parsing app configuration from server.", e); } } else { - Log.v("Using cached Configuration."); + ApptentiveLog.v("Using cached Configuration."); } } @@ -1203,7 +1202,7 @@ public void run() { Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable throwable) { - Log.e("Caught UncaughtException in thread \"%s\"", throwable, thread.getName()); + ApptentiveLog.e("Caught UncaughtException in thread \"%s\"", throwable, thread.getName()); MetricModule.sendError(context.getApplicationContext(), throwable, null, null); } }; @@ -1220,11 +1219,11 @@ public void uncaughtException(Thread thread, Throwable throwable) { private static void syncDevice(Context context) { Device deviceInfo = DeviceManager.storeDeviceAndReturnDiff(context); if (deviceInfo != null) { - Log.d("Device info was updated."); - Log.v(deviceInfo.toString()); + ApptentiveLog.d("Device info was updated."); + ApptentiveLog.v(deviceInfo.toString()); ApptentiveDatabase.getInstance(context).addPayload(deviceInfo); } else { - Log.d("Device info was not updated."); + ApptentiveLog.d("Device info was not updated."); } } @@ -1236,11 +1235,11 @@ private static void syncDevice(Context context) { private static void syncSdk(Context context) { Sdk sdk = SdkManager.storeSdkAndReturnDiff(context); if (sdk != null) { - Log.d("Sdk was updated."); - Log.v(sdk.toString()); + ApptentiveLog.d("Sdk was updated."); + ApptentiveLog.v(sdk.toString()); ApptentiveDatabase.getInstance(context).addPayload(sdk); } else { - Log.d("Sdk was not updated."); + ApptentiveLog.d("Sdk was not updated."); } } @@ -1252,11 +1251,11 @@ private static void syncSdk(Context context) { private static void syncPerson(Context context) { Person person = PersonManager.storePersonAndReturnDiff(context); if (person != null) { - Log.d("Person was updated."); - Log.v(person.toString()); + ApptentiveLog.d("Person was updated."); + ApptentiveLog.v(person.toString()); ApptentiveDatabase.getInstance(context).addPayload(person); } else { - Log.d("Person was not updated."); + ApptentiveLog.d("Person was not updated."); } } @@ -1306,7 +1305,7 @@ public void setVersion(String version) { put(KEY_TYPE, TYPE); put(TYPE, version); } catch (JSONException e) { - Log.e("Error creating Apptentive.Version.", e); + ApptentiveLog.e("Error creating Apptentive.Version.", e); } } @@ -1370,7 +1369,7 @@ public void setDateTime(double dateTime) { put(KEY_TYPE, TYPE); put(SEC, dateTime); } catch (JSONException e) { - Log.e("Error creating Apptentive.DateTime.", e); + ApptentiveLog.e("Error creating Apptentive.DateTime.", e); } } diff --git a/apptentive/src/com/apptentive/android/sdk/ApptentiveInternal.java b/apptentive/src/com/apptentive/android/sdk/ApptentiveInternal.java index d4fc56f64..dcfb52faf 100644 --- a/apptentive/src/com/apptentive/android/sdk/ApptentiveInternal.java +++ b/apptentive/src/com/apptentive/android/sdk/ApptentiveInternal.java @@ -55,7 +55,7 @@ public static PushAction parse(String name) { try { return PushAction.valueOf(name); } catch (IllegalArgumentException e) { - Log.d("Error parsing unknown PushAction: " + name); + ApptentiveLog.d("Error parsing unknown PushAction: " + name); } return unknown; } @@ -100,17 +100,17 @@ public static OnSurveyFinishedListener getOnSurveyFinishedListener() { } /** - * Pass in a log level to override the default, which is {@link Log.Level#INFO} + * Pass in a log level to override the default, which is {@link ApptentiveLog.Level#INFO} * */ - public static void setMinimumLogLevel(Log.Level level) { - Log.overrideLogLevel(level); + public static void setMinimumLogLevel(ApptentiveLog.Level level) { + ApptentiveLog.overrideLogLevel(level); } private static String pushCallbackActivityName; public static void setPushCallbackActivity(Class activity) { pushCallbackActivityName = activity.getName(); - Log.d("Setting push callback activity name to %s", pushCallbackActivityName); + ApptentiveLog.d("Setting push callback activity name to %s", pushCallbackActivityName); } public static String getPushCallbackActivityName() { @@ -127,20 +127,20 @@ public static String getPushCallbackActivityName() { static String getApptentivePushNotificationData(Intent intent) { String apptentive = null; if (intent != null) { - Log.v("Got an Intent."); + ApptentiveLog.v("Got an Intent."); // Parse if (intent.hasExtra(PARSE_PUSH_EXTRA_KEY)) { String parseStringExtra = intent.getStringExtra(PARSE_PUSH_EXTRA_KEY); - Log.v("Got a Parse Push."); + ApptentiveLog.v("Got a Parse Push."); try { JSONObject parseJson = new JSONObject(parseStringExtra); apptentive = parseJson.optString(APPTENTIVE_PUSH_EXTRA_KEY, null); } catch (JSONException e) { - Log.e("Corrupt Parse String Extra: %s", parseStringExtra); + ApptentiveLog.e("Corrupt Parse String Extra: %s", parseStringExtra); } } else { // Straight GCM / SNS - Log.v("Got a non-Parse push."); + ApptentiveLog.v("Got a non-Parse push."); apptentive = intent.getStringExtra(APPTENTIVE_PUSH_EXTRA_KEY); } } @@ -156,7 +156,7 @@ static String getApptentivePushNotificationData(Bundle pushBundle) { static boolean setPendingPushNotification(Context context, String apptentivePushData) { if (apptentivePushData != null) { - Log.d("Saving Apptentive push notification data."); + ApptentiveLog.d("Saving Apptentive push notification data."); SharedPreferences prefs = context.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE); prefs.edit().putString(Constants.PREF_KEY_PENDING_PUSH_NOTIFICATION, apptentivePushData).commit(); MessageManager.startMessagePreFetchTask(context); @@ -181,7 +181,7 @@ public static boolean showMessageCenterInternal(Activity activity, Map headers = new HashMap(); @@ -181,28 +181,28 @@ private static ApptentiveHttpResponse performHttpRequest(Context appContext, Str ret.setHeaders(headers); // Read the response, if available - Log.d("HTTP %d: %s", connection.getResponseCode(), connection.getResponseMessage()); + ApptentiveLog.d("HTTP %d: %s", connection.getResponseCode(), connection.getResponseMessage()); if (responseCode >= 200 && responseCode < 300) { ret.setContent(getResponse(connection, ret.isZipped())); - Log.v("Response: %s", ret.getContent()); + ApptentiveLog.v("Response: %s", ret.getContent()); } else { ret.setContent(getErrorResponse(connection, ret.isZipped())); - Log.w("Response: %s", ret.getContent()); + ApptentiveLog.w("Response: %s", ret.getContent()); } } catch (IllegalArgumentException e) { - Log.w("Error communicating with server.", e); + ApptentiveLog.w("Error communicating with server.", e); } catch (SocketTimeoutException e) { - Log.w("Timeout communicating with server.", e); + ApptentiveLog.w("Timeout communicating with server.", e); } catch (final MalformedURLException e) { - Log.w("MalformedUrlException", e); + ApptentiveLog.w("MalformedUrlException", e); } catch (final IOException e) { - Log.w("IOException", e); + ApptentiveLog.w("IOException", e); // Read the error response. try { ret.setContent(getErrorResponse(connection, ret.isZipped())); - Log.w("Response: " + ret.getContent()); + ApptentiveLog.w("Response: " + ret.getContent()); } catch (IOException ex) { - Log.w("Can't read error stream.", ex); + ApptentiveLog.w("Can't read error stream.", ex); } } return ret; @@ -210,7 +210,7 @@ private static ApptentiveHttpResponse performHttpRequest(Context appContext, Str private static void sendPostPutRequest(final HttpURLConnection connection, final String requestMethod, String body) throws IOException { - Log.d("%s body: %s", requestMethod, body); + ApptentiveLog.d("%s body: %s", requestMethod, body); connection.setRequestMethod(requestMethod); connection.setDoInput(true); @@ -234,12 +234,12 @@ private static void sendPostPutRequest(final HttpURLConnection connection, final private static ApptentiveHttpResponse performMultipartFilePost(Context appContext, String oauthToken, String uri, String postBody, List associatedFiles) { uri = getEndpointBase(appContext) + uri; - Log.d("Performing multipart POST to %s", uri); - Log.d("Multipart POST body: %s", postBody); + ApptentiveLog.d("Performing multipart POST to %s", uri); + ApptentiveLog.d("Multipart POST body: %s", postBody); ApptentiveHttpResponse ret = new ApptentiveHttpResponse(); if (!Util.isNetworkConnectionPresent(appContext)) { - Log.d("Network unavailable."); + ApptentiveLog.d("Network unavailable."); return ret; } @@ -336,7 +336,7 @@ private static ApptentiveHttpResponse performMultipartFilePost(Context appContex bytesRead = fis.read(buffer, 0, bufferSize); } } catch (IOException e) { - Log.d("Error writing file bytes to HTTP connection.", e); + ApptentiveLog.d("Error writing file bytes to HTTP connection.", e); ret.setBadPayload(true); throw e; } finally { @@ -370,20 +370,20 @@ private static ApptentiveHttpResponse performMultipartFilePost(Context appContex Util.ensureClosed(nbaos); } - Log.d("HTTP %d: %s", connection.getResponseCode(), connection.getResponseMessage()); - Log.v("Response: %s", ret.getContent()); + ApptentiveLog.d("HTTP %d: %s", connection.getResponseCode(), connection.getResponseMessage()); + ApptentiveLog.v("Response: %s", ret.getContent()); } catch (FileNotFoundException e) { - Log.e("Error getting file to upload.", e); + ApptentiveLog.e("Error getting file to upload.", e); } catch (MalformedURLException e) { - Log.e("Error constructing url for file upload.", e); + ApptentiveLog.e("Error constructing url for file upload.", e); } catch (SocketTimeoutException e) { - Log.w("Timeout communicating with server."); + ApptentiveLog.w("Timeout communicating with server."); } catch (IOException e) { - Log.e("Error executing file upload.", e); + ApptentiveLog.e("Error executing file upload.", e); try { ret.setContent(getErrorResponse(connection, ret.isZipped())); } catch (IOException ex) { - Log.w("Can't read error stream.", ex); + ApptentiveLog.w("Can't read error stream.", ex); } } finally { Util.ensureClosed(os); diff --git a/apptentive/src/com/apptentive/android/sdk/lifecycle/ActivityLifecycleManager.java b/apptentive/src/com/apptentive/android/sdk/lifecycle/ActivityLifecycleManager.java index 1c2f769d1..38c88b6ce 100644 --- a/apptentive/src/com/apptentive/android/sdk/lifecycle/ActivityLifecycleManager.java +++ b/apptentive/src/com/apptentive/android/sdk/lifecycle/ActivityLifecycleManager.java @@ -9,7 +9,7 @@ import android.app.Activity; import android.content.Context; import com.apptentive.android.sdk.ApptentiveInternal; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.SessionEvent; import com.apptentive.android.sdk.model.Event; import com.apptentive.android.sdk.module.engagement.EngagementModule; @@ -64,7 +64,7 @@ private static void sendEvent(Activity activity, SessionEvent event) { } private static void sendEvent(Activity activity, SessionEvent event, boolean crash) { - Log.d("Sending " + event.getDebugString()); + ApptentiveLog.d("Sending " + event.getDebugString()); switch (event.getAction()) { case START: if (!crash) { @@ -102,14 +102,14 @@ public static void activityStarted(Activity activity) { // Due to the nature of the Activity Lifecycle, onStart() of the next Activity may be called before or after // the onStart() of the current previous Activity. This complicated the detection. This is the distilled logic. if (pairs == 0 && starts == 0) { - Log.v("First start."); + ApptentiveLog.v("First start."); addEvents(start); sendEvent(activity, start); } else if (pairs == 0 && starts == 1) { - Log.v("Continuation Start. (1)"); + ApptentiveLog.v("Continuation Start. (1)"); addEvents(start); } else if (pairs == 0 && starts == 2) { - Log.i("Starting new session after crash. (1)"); + ApptentiveLog.i("Starting new session after crash. (1)"); removeAllEvents(); sendEvent(activity, lastStart != null ? lastStart : start, true); addEvents(lastStart, start); @@ -118,26 +118,26 @@ public static void activityStarted(Activity activity) { boolean expired = expiration < start.getTime(); addEvents(start); if (expired) { - Log.d("Session expired. Starting new session."); + ApptentiveLog.d("Session expired. Starting new session."); sendEvent(activity, lastStop); sendEvent(activity, start); } else { - Log.v("Continuation Start. (2)"); + ApptentiveLog.v("Continuation Start. (2)"); } } else if (pairs == 1 && starts == 2) { - Log.v("Continuation start. (3)"); + ApptentiveLog.v("Continuation start. (3)"); addEvents(start); } else if (pairs == 1 && starts == 3) { - Log.i("Starting new session after crash. (2)"); + ApptentiveLog.i("Starting new session after crash. (2)"); sendEvent(activity, lastStart != null ? lastStart : start, true); // Reconstruct Queue. removeAllEvents(); addEvents(lastStart, start); } else { - Log.w("ERROR: Unexpected state in LifecycleManager: " + getQueueAsString()); + ApptentiveLog.w("ERROR: Unexpected state in LifecycleManager: " + getQueueAsString()); } } catch (Exception e) { - Log.e("Error while handling activity start.", e); + ApptentiveLog.e("Error while handling activity start.", e); } } @@ -149,7 +149,7 @@ public static void activityStopped(Activity activity) { init(activity); addEvents(new SessionEvent(new Date().getTime(), SessionEvent.Action.STOP, activity.toString())); } catch (Exception e) { - Log.e("Error while handling activity stop.", e); + ApptentiveLog.e("Error while handling activity stop.", e); } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/AppRelease.java b/apptentive/src/com/apptentive/android/sdk/model/AppRelease.java index becd4adfe..69c38b438 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/AppRelease.java +++ b/apptentive/src/com/apptentive/android/sdk/model/AppRelease.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; /** @@ -47,7 +47,7 @@ public void setVersion(String version) { try { put(KEY_VERSION, version); } catch (JSONException e) { - Log.w("Error adding %s to AppRelease.", KEY_VERSION); + ApptentiveLog.w("Error adding %s to AppRelease.", KEY_VERSION); } } @@ -66,7 +66,7 @@ public void setBuildNumber(String buildNumber) { try { put(KEY_BUILD_NUMBER, buildNumber); } catch (JSONException e) { - Log.w("Error adding %s to AppRelease.", KEY_BUILD_NUMBER); + ApptentiveLog.w("Error adding %s to AppRelease.", KEY_BUILD_NUMBER); } } @@ -85,7 +85,7 @@ public void setIdentifier(String identifier) { try { put(KEY_IDENTIFIER, identifier); } catch (JSONException e) { - Log.w("Error adding %s to AppRelease.", KEY_IDENTIFIER); + ApptentiveLog.w("Error adding %s to AppRelease.", KEY_IDENTIFIER); } } @@ -104,7 +104,7 @@ public void setTargetSdkVersion(String targetSdkVersion) { try { put(KEY_TARGET_SDK_VERSION, targetSdkVersion); } catch (JSONException e) { - Log.w("Error adding %s to AppRelease.", KEY_TARGET_SDK_VERSION); + ApptentiveLog.w("Error adding %s to AppRelease.", KEY_TARGET_SDK_VERSION); } } @@ -123,7 +123,7 @@ public void setAppStore(String appStore) { try { put(KEY_APP_STORE, appStore); } catch (JSONException e) { - Log.w("Error adding %s to AppRelease.", KEY_APP_STORE); + ApptentiveLog.w("Error adding %s to AppRelease.", KEY_APP_STORE); } } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/AppReleaseFactory.java b/apptentive/src/com/apptentive/android/sdk/model/AppReleaseFactory.java index 39320c904..ad447e7ed 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/AppReleaseFactory.java +++ b/apptentive/src/com/apptentive/android/sdk/model/AppReleaseFactory.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; /** @@ -17,7 +17,7 @@ public static AppRelease fromJson(String json) { try { return new AppRelease(json); } catch (JSONException e) { - Log.v("Error parsing json as AppRelease: %s", e, json); + ApptentiveLog.v("Error parsing json as AppRelease: %s", e, json); } catch (IllegalArgumentException e) { // Unknown unknown #rumsfeld } diff --git a/apptentive/src/com/apptentive/android/sdk/model/CodePointStore.java b/apptentive/src/com/apptentive/android/sdk/model/CodePointStore.java index 084050120..3e2185d74 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/CodePointStore.java +++ b/apptentive/src/com/apptentive/android/sdk/model/CodePointStore.java @@ -8,7 +8,7 @@ import android.content.Context; import android.content.SharedPreferences; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Constants; import com.apptentive.android.sdk.util.Util; import org.json.JSONException; @@ -95,7 +95,7 @@ private static CodePointStore load(SharedPreferences prefs) { return new CodePointStore(json); } } catch (JSONException e) { - Log.e("Error loading CodePointStore from SharedPreferences.", e); + ApptentiveLog.e("Error loading CodePointStore from SharedPreferences.", e); } return new CodePointStore(); } @@ -185,7 +185,7 @@ public static synchronized void storeRecord(Context context, boolean isInteracti save(context); } catch (JSONException e) { - Log.w("Unable to store code point %s.", e, fullCodePoint); + ApptentiveLog.w("Unable to store code point %s.", e, fullCodePoint); } } } @@ -203,7 +203,7 @@ public static JSONObject getRecord(Context context, boolean interaction, String } } } catch (JSONException e) { - Log.w("Error loading code point record for \"%s\"", name); + ApptentiveLog.w("Error loading code point record for \"%s\"", name); } return null; } diff --git a/apptentive/src/com/apptentive/android/sdk/model/Configuration.java b/apptentive/src/com/apptentive/android/sdk/model/Configuration.java index 7c100d105..a6bd9fb71 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/Configuration.java +++ b/apptentive/src/com/apptentive/android/sdk/model/Configuration.java @@ -12,7 +12,7 @@ import android.content.pm.PackageManager; import android.os.Bundle; import com.apptentive.android.sdk.GlobalInfo; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Constants; import org.json.JSONException; import org.json.JSONObject; @@ -61,7 +61,7 @@ public static Configuration load(SharedPreferences prefs) { return new Configuration(json); } } catch (JSONException e) { - Log.e("Error loading Configuration from SharedPreferences.", e); + ApptentiveLog.e("Error loading Configuration from SharedPreferences.", e); } return new Configuration(); } @@ -166,7 +166,7 @@ public boolean isHideBranding(Context context) { Bundle metaData = ai.metaData; return metaData.getBoolean(Constants.MANIFEST_KEY_INITIALLY_HIDE_BRANDING, Constants.CONFIG_DEFAULT_HIDE_BRANDING); } catch (Exception e) { - Log.w("Unexpected error while reading %s manifest setting.", e, Constants.MANIFEST_KEY_INITIALLY_HIDE_BRANDING); + ApptentiveLog.w("Unexpected error while reading %s manifest setting.", e, Constants.MANIFEST_KEY_INITIALLY_HIDE_BRANDING); } return Constants.CONFIG_DEFAULT_HIDE_BRANDING; @@ -187,7 +187,7 @@ public void setConfigurationCacheExpirationMillis(long configurationCacheExpirat try { put(KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS, configurationCacheExpirationMillis); } catch (JSONException e) { - Log.w("Error adding %s to Configuration.", KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS); + ApptentiveLog.w("Error adding %s to Configuration.", KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS); } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/ConversationItem.java b/apptentive/src/com/apptentive/android/sdk/model/ConversationItem.java index a391b9971..b8e4ad766 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/ConversationItem.java +++ b/apptentive/src/com/apptentive/android/sdk/model/ConversationItem.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Util; import org.json.JSONException; @@ -41,7 +41,7 @@ public void setNonce(String nonce) { try { put(KEY_NONCE, nonce); } catch (JSONException e) { - Log.e("Exception setting ConversationItem's %s field.", e, KEY_NONCE); + ApptentiveLog.e("Exception setting ConversationItem's %s field.", e, KEY_NONCE); } } @@ -69,7 +69,7 @@ public void setClientCreatedAt(Double clientCreatedAt) { try { put(KEY_CLIENT_CREATED_AT, clientCreatedAt); } catch (JSONException e) { - Log.e("Exception setting ConversationItem's %s field.", e, KEY_CLIENT_CREATED_AT); + ApptentiveLog.e("Exception setting ConversationItem's %s field.", e, KEY_CLIENT_CREATED_AT); } } @@ -80,7 +80,7 @@ public void setClientCreatedAtUtcOffset(int clientCreatedAtUtcOffset) { try { put(KEY_CLIENT_CREATED_AT_UTC_OFFSET, clientCreatedAtUtcOffset); } catch (JSONException e) { - Log.e("Exception setting ConversationItem's %s field.", e, KEY_CLIENT_CREATED_AT_UTC_OFFSET); + ApptentiveLog.e("Exception setting ConversationItem's %s field.", e, KEY_CLIENT_CREATED_AT_UTC_OFFSET); } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/ConversationTokenRequest.java b/apptentive/src/com/apptentive/android/sdk/model/ConversationTokenRequest.java index f65f9da20..25aed331a 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/ConversationTokenRequest.java +++ b/apptentive/src/com/apptentive/android/sdk/model/ConversationTokenRequest.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; import org.json.JSONObject; @@ -23,7 +23,7 @@ public void setDevice(Device device) { try { put(Device.KEY, device); } catch (JSONException e) { - Log.e("Error adding %s to ConversationTokenRequest", Device.KEY); + ApptentiveLog.e("Error adding %s to ConversationTokenRequest", Device.KEY); } } @@ -31,7 +31,7 @@ public void setSdk(Sdk sdk) { try { put(Sdk.KEY, sdk); } catch (JSONException e) { - Log.e("Error adding %s to ConversationTokenRequest", Sdk.KEY); + ApptentiveLog.e("Error adding %s to ConversationTokenRequest", Sdk.KEY); } } @@ -39,7 +39,7 @@ public void setPerson(Person person) { try { put(Person.KEY, person); } catch (JSONException e) { - Log.e("Error adding %s to ConversationTokenRequest", Person.KEY); + ApptentiveLog.e("Error adding %s to ConversationTokenRequest", Person.KEY); } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/CustomData.java b/apptentive/src/com/apptentive/android/sdk/model/CustomData.java index 0c9858f71..675b87923 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/CustomData.java +++ b/apptentive/src/com/apptentive/android/sdk/model/CustomData.java @@ -1,6 +1,6 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; import org.json.JSONObject; @@ -54,7 +54,7 @@ public boolean equals(Object o) { rightMap.put(key, right.getString(key)); } } catch (JSONException e) { - Log.e("Error comparing two device data entries: \"%s\" AND \"%s\"", left.toString(), right.toString()); + ApptentiveLog.e("Error comparing two device data entries: \"%s\" AND \"%s\"", left.toString(), right.toString()); } return leftMap.equals(rightMap); } diff --git a/apptentive/src/com/apptentive/android/sdk/model/Device.java b/apptentive/src/com/apptentive/android/sdk/model/Device.java index 507f198e3..ed2ce03ec 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/Device.java +++ b/apptentive/src/com/apptentive/android/sdk/model/Device.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; /** @@ -70,7 +70,7 @@ public void setUuid(String uuid) { try { put(KEY_UUID, uuid); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_UUID); + ApptentiveLog.w("Error adding %s to Device.", KEY_UUID); } } @@ -89,7 +89,7 @@ public void setOsName(String osName) { try { put(KEY_OS_NAME, osName); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_OS_NAME); + ApptentiveLog.w("Error adding %s to Device.", KEY_OS_NAME); } } @@ -108,7 +108,7 @@ public void setOsVersion(String osVersion) { try { put(KEY_OS_VERSION, osVersion); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_OS_VERSION); + ApptentiveLog.w("Error adding %s to Device.", KEY_OS_VERSION); } } @@ -127,7 +127,7 @@ public void setOsBuild(String osBuild) { try { put(KEY_OS_BUILD, osBuild); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_OS_BUILD); + ApptentiveLog.w("Error adding %s to Device.", KEY_OS_BUILD); } } @@ -146,7 +146,7 @@ public void setOsApiLevel(String osApiLevel) { try { put(KEY_OS_API_LEVEL, osApiLevel); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_OS_API_LEVEL); + ApptentiveLog.w("Error adding %s to Device.", KEY_OS_API_LEVEL); } } @@ -165,7 +165,7 @@ public void setManufacturer(String manufacturer) { try { put(KEY_MANUFACTURER, manufacturer); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_MANUFACTURER); + ApptentiveLog.w("Error adding %s to Device.", KEY_MANUFACTURER); } } @@ -184,7 +184,7 @@ public void setModel(String model) { try { put(KEY_MODEL, model); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_MODEL); + ApptentiveLog.w("Error adding %s to Device.", KEY_MODEL); } } @@ -203,7 +203,7 @@ public void setBoard(String board) { try { put(KEY_BOARD, board); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_BOARD); + ApptentiveLog.w("Error adding %s to Device.", KEY_BOARD); } } @@ -222,7 +222,7 @@ public void setProduct(String product) { try { put(KEY_PRODUCT, product); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_PRODUCT); + ApptentiveLog.w("Error adding %s to Device.", KEY_PRODUCT); } } @@ -241,7 +241,7 @@ public void setBrand(String brand) { try { put(KEY_BRAND, brand); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_BRAND); + ApptentiveLog.w("Error adding %s to Device.", KEY_BRAND); } } @@ -260,7 +260,7 @@ public void setCpu(String cpu) { try { put(KEY_CPU, cpu); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_CPU); + ApptentiveLog.w("Error adding %s to Device.", KEY_CPU); } } @@ -279,7 +279,7 @@ public void setDevice(String device) { try { put(KEY_DEVICE, device); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_DEVICE); + ApptentiveLog.w("Error adding %s to Device.", KEY_DEVICE); } } @@ -298,7 +298,7 @@ public void setCarrier(String carrier) { try { put(KEY_CARRIER, carrier); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_CARRIER); + ApptentiveLog.w("Error adding %s to Device.", KEY_CARRIER); } } @@ -317,7 +317,7 @@ public void setCurrentCarrier(String currentCarrier) { try { put(KEY_CURRENT_CARRIER, currentCarrier); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_CURRENT_CARRIER); + ApptentiveLog.w("Error adding %s to Device.", KEY_CURRENT_CARRIER); } } @@ -336,7 +336,7 @@ public void setNetworkType(String networkType) { try { put(KEY_NETWORK_TYPE, networkType); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_NETWORK_TYPE); + ApptentiveLog.w("Error adding %s to Device.", KEY_NETWORK_TYPE); } } @@ -355,7 +355,7 @@ public void setBuildType(String buildType) { try { put(KEY_BUILD_TYPE, buildType); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_BUILD_TYPE); + ApptentiveLog.w("Error adding %s to Device.", KEY_BUILD_TYPE); } } @@ -374,7 +374,7 @@ public void setBuildId(String buildId) { try { put(KEY_BUILD_ID, buildId); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_BUILD_ID); + ApptentiveLog.w("Error adding %s to Device.", KEY_BUILD_ID); } } @@ -393,7 +393,7 @@ public void setBootloaderVersion(String bootloaderVersion) { try { put(KEY_BOOTLOADER_VERSION, bootloaderVersion); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_BOOTLOADER_VERSION); + ApptentiveLog.w("Error adding %s to Device.", KEY_BOOTLOADER_VERSION); } } @@ -412,7 +412,7 @@ public void setRadioVersion(String radioVersion) { try { put(KEY_RADIO_VERSION, radioVersion); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_RADIO_VERSION); + ApptentiveLog.w("Error adding %s to Device.", KEY_RADIO_VERSION); } } @@ -432,7 +432,7 @@ public void setCustomData(CustomData customData) { try { put(KEY_CUSTOM_DATA, customData); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_CUSTOM_DATA); + ApptentiveLog.w("Error adding %s to Device.", KEY_CUSTOM_DATA); } } @@ -452,7 +452,7 @@ public void setIntegrationConfig(CustomData integrationConfig) { try { put(KEY_INTEGRATION_CONFIG, integrationConfig); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_INTEGRATION_CONFIG); + ApptentiveLog.w("Error adding %s to Device.", KEY_INTEGRATION_CONFIG); } } @@ -471,7 +471,7 @@ public void setLocaleCountryCode(String localeCountryCode) { try { put(KEY_LOCALE_COUNTRY_CODE, localeCountryCode); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_LOCALE_COUNTRY_CODE); + ApptentiveLog.w("Error adding %s to Device.", KEY_LOCALE_COUNTRY_CODE); } } @@ -490,7 +490,7 @@ public void setLocaleLanguageCode(String localeLanguageCode) { try { put(KEY_LOCALE_LANGUAGE_CODE, localeLanguageCode); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_LOCALE_LANGUAGE_CODE); + ApptentiveLog.w("Error adding %s to Device.", KEY_LOCALE_LANGUAGE_CODE); } } @@ -509,7 +509,7 @@ public void setLocaleRaw(String localeRaw) { try { put(KEY_LOCALE_RAW, localeRaw); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_LOCALE_RAW); + ApptentiveLog.w("Error adding %s to Device.", KEY_LOCALE_RAW); } } @@ -528,7 +528,7 @@ public void setUtcOffset(String utcOffset) { try { put(KEY_UTC_OFFSET, utcOffset); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_UTC_OFFSET); + ApptentiveLog.w("Error adding %s to Device.", KEY_UTC_OFFSET); } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/DeviceFactory.java b/apptentive/src/com/apptentive/android/sdk/model/DeviceFactory.java index fc2cdcfc5..5bec3ca79 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/DeviceFactory.java +++ b/apptentive/src/com/apptentive/android/sdk/model/DeviceFactory.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; /** @@ -17,7 +17,7 @@ public static Device fromJson(String json) { try { return new Device(json); } catch (JSONException e) { - Log.v("Error parsing json as Device: %s", e, json); + ApptentiveLog.v("Error parsing json as Device: %s", e, json); } catch (IllegalArgumentException e) { // Unknown unknown #rumsfeld } diff --git a/apptentive/src/com/apptentive/android/sdk/model/Event.java b/apptentive/src/com/apptentive/android/sdk/model/Event.java index c30de3774..3f8c63c3e 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/Event.java +++ b/apptentive/src/com/apptentive/android/sdk/model/Event.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; import org.json.JSONObject; @@ -37,7 +37,7 @@ public Event(String label, JSONObject data) { put(KEY_DATA, data); } } catch (JSONException e) { - Log.e("Unable to construct Event.", e); + ApptentiveLog.e("Unable to construct Event.", e); } } @@ -53,7 +53,7 @@ public Event(String label, Map data) { put(KEY_DATA, dataObject); } } catch (JSONException e) { - Log.e("Unable to construct Event.", e); + ApptentiveLog.e("Unable to construct Event.", e); } } @@ -81,7 +81,7 @@ public Event(String label, String interactionId, String data, Map customData) { try { ret.put(key, value); } catch (Exception e) { - Log.w("Error adding custom data to Event: \"%s\" = \"%s\"", key, value.toString(), e); + ApptentiveLog.w("Error adding custom data to Event: \"%s\" = \"%s\"", key, value.toString(), e); } } } @@ -128,7 +128,7 @@ public void putData(Map data) { dataObject.put(key, data.get(key)); } } catch (JSONException e) { - Log.e("Unable to add data to Event.", e); + ApptentiveLog.e("Unable to add data to Event.", e); } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/EventFactory.java b/apptentive/src/com/apptentive/android/sdk/model/EventFactory.java index 7934dbf55..027640327 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/EventFactory.java +++ b/apptentive/src/com/apptentive/android/sdk/model/EventFactory.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; /** @@ -17,7 +17,7 @@ public static Event fromJson(String json) { try { return new Event(json); } catch (JSONException e) { - Log.v("Error parsing json as Event: %s", e, json); + ApptentiveLog.v("Error parsing json as Event: %s", e, json); } catch (IllegalArgumentException e) { // Unknown unknown #rumsfeld } diff --git a/apptentive/src/com/apptentive/android/sdk/model/ExtendedData.java b/apptentive/src/com/apptentive/android/sdk/model/ExtendedData.java index 19a3c0341..754ab77e5 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/ExtendedData.java +++ b/apptentive/src/com/apptentive/android/sdk/model/ExtendedData.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; import org.json.JSONObject; @@ -40,7 +40,7 @@ protected void setVersion(int version) { try { put(KEY_VERSION, version); } catch (JSONException e) { - Log.w("Error adding %s to ExtendedData.", KEY_VERSION, e); + ApptentiveLog.w("Error adding %s to ExtendedData.", KEY_VERSION, e); } return; } @@ -57,7 +57,7 @@ public static Type parse(String type) { try { return Type.valueOf(type); } catch (IllegalArgumentException e) { - Log.v("Error parsing unknown ExtendedData.BaseType: " + type); + ApptentiveLog.v("Error parsing unknown ExtendedData.BaseType: " + type); } return unknown; } diff --git a/apptentive/src/com/apptentive/android/sdk/model/LocationExtendedData.java b/apptentive/src/com/apptentive/android/sdk/model/LocationExtendedData.java index a4a839489..1274830e8 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/LocationExtendedData.java +++ b/apptentive/src/com/apptentive/android/sdk/model/LocationExtendedData.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONArray; import org.json.JSONException; @@ -41,7 +41,7 @@ public void setCoordinates(double longitude, double latitude) { coordinates.put(0, longitude); coordinates.put(1, latitude); } catch (JSONException e) { - Log.w("Error adding %s to LocationExtendedData.", KEY_COORDINATES, e); + ApptentiveLog.w("Error adding %s to LocationExtendedData.", KEY_COORDINATES, e); } } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/Payload.java b/apptentive/src/com/apptentive/android/sdk/model/Payload.java index c0358a434..b17e6bb50 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/Payload.java +++ b/apptentive/src/com/apptentive/android/sdk/model/Payload.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; import org.json.JSONObject; @@ -43,7 +43,7 @@ public String marshallForSending() { try { wrapper.put(getBaseType().name(), this); } catch (JSONException e) { - Log.w("Error wrapping Payload in JSONObject.", e); + ApptentiveLog.w("Error wrapping Payload in JSONObject.", e); return null; } return wrapper.toString(); @@ -80,7 +80,7 @@ public static BaseType parse(String type) { try { return BaseType.valueOf(type); } catch (IllegalArgumentException e) { - Log.v("Error parsing unknown Payload.BaseType: " + type); + ApptentiveLog.v("Error parsing unknown Payload.BaseType: " + type); } return unknown; } diff --git a/apptentive/src/com/apptentive/android/sdk/model/PayloadFactory.java b/apptentive/src/com/apptentive/android/sdk/model/PayloadFactory.java index e97ba2bd1..1bd30cf11 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/PayloadFactory.java +++ b/apptentive/src/com/apptentive/android/sdk/model/PayloadFactory.java @@ -8,7 +8,7 @@ import android.content.Context; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.messagecenter.model.MessageFactory; import org.json.JSONException; @@ -39,7 +39,7 @@ public static Payload fromJson(Context appContext, String json, Payload.BaseType // Ignore } case unknown: - Log.v("Ignoring unknown RecordType."); + ApptentiveLog.v("Ignoring unknown RecordType."); break; default: break; diff --git a/apptentive/src/com/apptentive/android/sdk/model/Person.java b/apptentive/src/com/apptentive/android/sdk/model/Person.java index 5919719ed..1872e45d8 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/Person.java +++ b/apptentive/src/com/apptentive/android/sdk/model/Person.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; /** @@ -55,7 +55,7 @@ public void setId(String id) { try { put(KEY_ID, id); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_ID + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_ID + " of " + KEY); } } @@ -74,7 +74,7 @@ public void setEmail(String email) { try { put(KEY_EMAIL, email); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_EMAIL + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_EMAIL + " of " + KEY); } } @@ -93,7 +93,7 @@ public void setName(String name) { try { put(KEY_NAME, name); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_NAME + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_NAME + " of " + KEY); } } @@ -112,7 +112,7 @@ public void setFacebookId(String facebookId) { try { put(KEY_FACEBOOK_ID, facebookId); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_FACEBOOK_ID + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_FACEBOOK_ID + " of " + KEY); } } @@ -131,7 +131,7 @@ public void setPhoneNumber(String phoneNumber) { try { put(KEY_PHONE_NUMBER, phoneNumber); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_PHONE_NUMBER + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_PHONE_NUMBER + " of " + KEY); } } @@ -150,7 +150,7 @@ public void setStreet(String street) { try { put(KEY_STREET, street); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_STREET + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_STREET + " of " + KEY); } } @@ -169,7 +169,7 @@ public void setCity(String city) { try { put(KEY_CITY, city); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_CITY + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_CITY + " of " + KEY); } } @@ -188,7 +188,7 @@ public void setZip(String zip) { try { put(KEY_ZIP, zip); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_ZIP + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_ZIP + " of " + KEY); } } @@ -207,7 +207,7 @@ public void setCountry(String country) { try { put(KEY_COUNTRY, country); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_COUNTRY + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_COUNTRY + " of " + KEY); } } @@ -226,7 +226,7 @@ public void setBirthday(String birthday) { try { put(KEY_BIRTHDAY, birthday); } catch (JSONException e) { - Log.e("Unable to set field " + KEY_BIRTHDAY + " of " + KEY); + ApptentiveLog.e("Unable to set field " + KEY_BIRTHDAY + " of " + KEY); } } @@ -246,7 +246,7 @@ public void setCustomData(CustomData customData) { try { put(KEY_CUSTOM_DATA, customData); } catch (JSONException e) { - Log.w("Error adding %s to Device.", KEY_CUSTOM_DATA); + ApptentiveLog.w("Error adding %s to Device.", KEY_CUSTOM_DATA); } } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/PersonFactory.java b/apptentive/src/com/apptentive/android/sdk/model/PersonFactory.java index cb83fba1b..5d58eb3e6 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/PersonFactory.java +++ b/apptentive/src/com/apptentive/android/sdk/model/PersonFactory.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; /** @@ -17,7 +17,7 @@ public static Person fromJson(String json) { try { return new Person(json); } catch (JSONException e) { - Log.v("Error parsing json as Person: %s", e, json); + ApptentiveLog.v("Error parsing json as Person: %s", e, json); } catch (IllegalArgumentException e) { // Unknown unknown #rumsfeld } diff --git a/apptentive/src/com/apptentive/android/sdk/model/Sdk.java b/apptentive/src/com/apptentive/android/sdk/model/Sdk.java index e6b31b7c7..929fe5f46 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/Sdk.java +++ b/apptentive/src/com/apptentive/android/sdk/model/Sdk.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; /** @@ -51,7 +51,7 @@ public void setVersion(String version) { try { put(KEY_VERSION, version); } catch (JSONException e) { - Log.w("Error adding %s to Sdk.", KEY_VERSION); + ApptentiveLog.w("Error adding %s to Sdk.", KEY_VERSION); } } @@ -70,7 +70,7 @@ public void setProgrammingLanguage(String programmingLanguage) { try { put(KEY_PROGRAMMING_LANGUAGE, programmingLanguage); } catch (JSONException e) { - Log.w("Error adding %s to Sdk.", KEY_PROGRAMMING_LANGUAGE); + ApptentiveLog.w("Error adding %s to Sdk.", KEY_PROGRAMMING_LANGUAGE); } } @@ -89,7 +89,7 @@ public void setAuthorName(String authorName) { try { put(KEY_AUTHOR_NAME, authorName); } catch (JSONException e) { - Log.w("Error adding %s to Sdk.", KEY_AUTHOR_NAME); + ApptentiveLog.w("Error adding %s to Sdk.", KEY_AUTHOR_NAME); } } @@ -108,7 +108,7 @@ public void setAuthorEmail(String authorEmail) { try { put(KEY_AUTHOR_EMAIL, authorEmail); } catch (JSONException e) { - Log.w("Error adding %s to Sdk.", KEY_AUTHOR_EMAIL); + ApptentiveLog.w("Error adding %s to Sdk.", KEY_AUTHOR_EMAIL); } } @@ -127,7 +127,7 @@ public void setPlatform(String platform) { try { put(KEY_PLATFORM, platform); } catch (JSONException e) { - Log.w("Error adding %s to Sdk.", KEY_PLATFORM); + ApptentiveLog.w("Error adding %s to Sdk.", KEY_PLATFORM); } } @@ -146,7 +146,7 @@ public void setDistribution(String distribution) { try { put(KEY_DISTRIBUTION, distribution); } catch (JSONException e) { - Log.w("Error adding %s to Sdk.", KEY_DISTRIBUTION); + ApptentiveLog.w("Error adding %s to Sdk.", KEY_DISTRIBUTION); } } @@ -165,7 +165,7 @@ public void setDistributionVersion(String distributionVersion) { try { put(KEY_DISTRIBUTION_VERSION, distributionVersion); } catch (JSONException e) { - Log.w("Error adding %s to Sdk.", KEY_DISTRIBUTION_VERSION); + ApptentiveLog.w("Error adding %s to Sdk.", KEY_DISTRIBUTION_VERSION); } } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/SdkFactory.java b/apptentive/src/com/apptentive/android/sdk/model/SdkFactory.java index 99b46feba..f2aa02f7f 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/SdkFactory.java +++ b/apptentive/src/com/apptentive/android/sdk/model/SdkFactory.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; /** @@ -17,7 +17,7 @@ public static Sdk fromJson(String json) { try { return new Sdk(json); } catch (JSONException e) { - Log.v("Error parsing json as Sdk: %s", e, json); + ApptentiveLog.v("Error parsing json as Sdk: %s", e, json); } catch (IllegalArgumentException e) { // Unknown unknown #rumsfeld } diff --git a/apptentive/src/com/apptentive/android/sdk/model/SurveyResponse.java b/apptentive/src/com/apptentive/android/sdk/model/SurveyResponse.java index 9dfb709e3..c077425bd 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/SurveyResponse.java +++ b/apptentive/src/com/apptentive/android/sdk/model/SurveyResponse.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.interaction.model.survey.Question; import com.apptentive.android.sdk.module.engagement.interaction.model.SurveyInteraction; import com.apptentive.android.sdk.module.engagement.interaction.model.survey.SurveyState; @@ -52,7 +52,7 @@ public SurveyResponse(SurveyInteraction definition, SurveyState surveyState) { } } } catch (JSONException e) { - Log.e("Unable to construct survey payload.", e); + ApptentiveLog.e("Unable to construct survey payload.", e); } } diff --git a/apptentive/src/com/apptentive/android/sdk/model/TimeExtendedData.java b/apptentive/src/com/apptentive/android/sdk/model/TimeExtendedData.java index 43187acb5..2f98759d2 100644 --- a/apptentive/src/com/apptentive/android/sdk/model/TimeExtendedData.java +++ b/apptentive/src/com/apptentive/android/sdk/model/TimeExtendedData.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; import java.util.Date; @@ -66,7 +66,7 @@ protected void setTimestamp(double dateInSeconds) { try { put(KEY_TIMESTAMP, dateInSeconds); } catch (JSONException e) { - Log.w("Error adding %s to TimeExtendedData.", KEY_TIMESTAMP, e); + ApptentiveLog.w("Error adding %s to TimeExtendedData.", KEY_TIMESTAMP, e); } } } diff --git a/apptentive/src/com/apptentive/android/sdk/module/ActivityContent.java b/apptentive/src/com/apptentive/android/sdk/module/ActivityContent.java index 9091f97b7..254df5131 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/ActivityContent.java +++ b/apptentive/src/com/apptentive/android/sdk/module/ActivityContent.java @@ -11,7 +11,7 @@ import android.os.Bundle; import android.support.annotation.NonNull; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; /** * @author Sky Kelsey @@ -77,7 +77,7 @@ public static Type parse(String type) { return Type.valueOf(type); } } catch (IllegalArgumentException e) { - Log.v("Error parsing unknown ActivityContent.Type: " + type); + ApptentiveLog.v("Error parsing unknown ActivityContent.Type: " + type); } return unknown; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/EngagementModule.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/EngagementModule.java index 01f29b9ab..d968998fe 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/EngagementModule.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/EngagementModule.java @@ -9,7 +9,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.ViewActivity; import com.apptentive.android.sdk.model.CodePointStore; import com.apptentive.android.sdk.model.Event; @@ -46,7 +46,7 @@ public static synchronized boolean engageInternal(Activity activity, Interaction public static synchronized boolean engage(Activity activity, String vendor, String interaction, String interactionId, String eventName, String data, Map customData, ExtendedData... extendedData) { try { String eventLabel = generateEventLabel(vendor, interaction, eventName); - Log.d("engage(%s)", eventLabel); + ApptentiveLog.d("engage(%s)", eventLabel); CodePointStore.storeCodePointForCurrentAppVersion(activity.getApplicationContext(), eventLabel); EventManager.sendEvent(activity.getApplicationContext(), new Event(eventLabel, interactionId, data, customData, extendedData)); @@ -64,13 +64,13 @@ public static boolean doEngage(Activity activity, String eventLabel) { launchInteraction(activity, interaction); return true; } - Log.d("No interaction to show."); + ApptentiveLog.d("No interaction to show."); return false; } public static void launchInteraction(Activity activity, Interaction interaction) { if (interaction != null) { - Log.i("Launching interaction: %s", interaction.getType().toString()); + ApptentiveLog.i("Launching interaction: %s", interaction.getType().toString()); Intent intent = new Intent(); intent.setClass(activity, ViewActivity.class); intent.putExtra(ActivityContent.KEY, ActivityContent.Type.INTERACTION.toString()); diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/InteractionManager.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/InteractionManager.java index 572a9fd13..bfdba2f55 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/InteractionManager.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/InteractionManager.java @@ -10,7 +10,7 @@ import android.content.SharedPreferences; import com.apptentive.android.sdk.GlobalInfo; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.comm.ApptentiveClient; import com.apptentive.android.sdk.comm.ApptentiveHttpResponse; import com.apptentive.android.sdk.module.engagement.interaction.model.Interactions; @@ -62,14 +62,14 @@ public static Interaction getApplicableInteraction(Context context, String event public static void asyncFetchAndStoreInteractions(final Context context) { if (!isPollForInteractions(context)) { - Log.v("Interaction polling is disabled."); + ApptentiveLog.v("Interaction polling is disabled."); return; } boolean force = GlobalInfo.isAppDebuggable; if (force || hasCacheExpired(context)) { - Log.i("Fetching new Interactions."); + ApptentiveLog.i("Fetching new Interactions."); Thread thread = new Thread() { public void run() { fetchAndStoreInteractions(context); @@ -78,7 +78,7 @@ public void run() { Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable throwable) { - Log.w("UncaughtException in InteractionManager.", throwable); + ApptentiveLog.w("UncaughtException in InteractionManager.", throwable); MetricModule.sendError(context.getApplicationContext(), throwable, null, null); } }; @@ -86,7 +86,7 @@ public void uncaughtException(Thread thread, Throwable throwable) { thread.setName("Apptentive-FetchInteractions"); thread.start(); } else { - Log.v("Using cached Interactions."); + ApptentiveLog.v("Using cached Interactions."); } } @@ -131,10 +131,10 @@ public static void storeInteractionsPayloadString(Context context, String intera saveInteractions(context); saveTargets(context); } else { - Log.e("Unable to save payloads."); + ApptentiveLog.e("Unable to save payloads."); } } catch (JSONException e) { - Log.w("Invalid InteractionsPayload received."); + ApptentiveLog.w("Invalid InteractionsPayload received."); } } @@ -158,7 +158,7 @@ private static Interactions loadInteractions(Context context) { try { return new Interactions(interactionsString); } catch (JSONException e) { - Log.w("Exception creating Interactions object.", e); + ApptentiveLog.w("Exception creating Interactions object.", e); } } return null; @@ -176,7 +176,7 @@ private static Targets loadTargets(Context context) { try { return new Targets(targetsString); } catch (JSONException e) { - Log.w("Exception creating Targets object.", e); + ApptentiveLog.w("Exception creating Targets object.", e); } } return null; diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Interaction.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Interaction.java index f70f9e523..d6f71589f 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Interaction.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Interaction.java @@ -9,7 +9,7 @@ import android.app.Activity; import android.content.Context; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.EngagementModule; import org.json.JSONException; @@ -109,7 +109,7 @@ public static Type parse(String type) { try { return Type.valueOf(type); } catch (IllegalArgumentException e) { - Log.v("Error parsing unknown Interaction.Type: " + type); + ApptentiveLog.v("Error parsing unknown Interaction.Type: " + type); } return unknown; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/InteractionCriteria.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/InteractionCriteria.java index a97906e31..17e619c62 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/InteractionCriteria.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/InteractionCriteria.java @@ -8,7 +8,7 @@ import android.content.Context; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.logic.Clause; import com.apptentive.android.sdk.module.engagement.logic.ClauseParser; @@ -28,17 +28,17 @@ public InteractionCriteria(String json) throws JSONException { public boolean isMet(Context context) { try { Clause rootClause = ClauseParser.parse(json); - Log.i("Evaluating Criteria"); + ApptentiveLog.i("Evaluating Criteria"); boolean ret = false; if (rootClause != null) { ret = rootClause.evaluate(context); } - Log.i("- => %b", ret); + ApptentiveLog.i("- => %b", ret); return ret; } catch (JSONException e) { - Log.w("Error parsing and running InteractionCriteria predicate logic.", e); + ApptentiveLog.w("Error parsing and running InteractionCriteria predicate logic.", e); } catch (Exception e) { - Log.w("Error parsing and running InteractionCriteria predicate logic.", e); + ApptentiveLog.w("Error parsing and running InteractionCriteria predicate logic.", e); } return false; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Interactions.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Interactions.java index 920ea2d78..9fd659c3d 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Interactions.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Interactions.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.module.engagement.interaction.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; import org.json.JSONObject; @@ -35,7 +35,7 @@ public Interaction getInteraction(String id) { return Interaction.Factory.parseInteraction(getJSONObject(id).toString()); } } catch (JSONException e) { - Log.w("Exception parsing interactions array.", e); + ApptentiveLog.w("Exception parsing interactions array.", e); } return null; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/InteractionsPayload.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/InteractionsPayload.java index 948732e20..fc29d14e1 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/InteractionsPayload.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/InteractionsPayload.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.module.engagement.interaction.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -44,7 +44,7 @@ public Interactions getInteractions() { } } } catch (JSONException e) { - Log.w("Unable to load Interactions from InteractionsPayload.", e); + ApptentiveLog.w("Unable to load Interactions from InteractionsPayload.", e); } return null; } @@ -56,7 +56,7 @@ public Targets getTargets() { return new Targets(targets.toString()); } } catch (JSONException e) { - Log.w("Unable to load Targets from InteractionsPayload.", e); + ApptentiveLog.w("Unable to load Targets from InteractionsPayload.", e); } return null; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Targets.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Targets.java index c066cc036..9831b17d5 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Targets.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/Targets.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.module.engagement.interaction.model; import android.content.Context; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -40,7 +40,7 @@ public String getApplicableInteraction(Context context, String eventLabel) { } } } - Log.v("No runnable Interactions for EventLabel: %s", eventLabel); + ApptentiveLog.v("No runnable Interactions for EventLabel: %s", eventLabel); return null; } } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/TextModalInteraction.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/TextModalInteraction.java index 8281529dc..d0e8602b4 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/TextModalInteraction.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/TextModalInteraction.java @@ -6,7 +6,6 @@ package com.apptentive.android.sdk.module.engagement.interaction.model; -import com.apptentive.android.sdk.Log; import com.apptentive.android.sdk.module.engagement.interaction.model.common.Actions; import org.json.JSONException; diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/common/Action.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/common/Action.java index 1ecc4dece..4c213aba7 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/common/Action.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/common/Action.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.module.engagement.interaction.model.common; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; import org.json.JSONObject; @@ -43,7 +43,7 @@ public static Type parse(String name) { try { return Type.valueOf(name); } catch (IllegalArgumentException e) { - Log.v("Error parsing unknown Action.Type: " + name); + ApptentiveLog.v("Error parsing unknown Action.Type: " + name); } return unknown; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/common/Actions.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/common/Actions.java index 991f7bb1d..6212b3245 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/common/Actions.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/model/common/Actions.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.module.engagement.interaction.model.common; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONArray; import org.json.JSONException; @@ -31,7 +31,7 @@ public List getAsList() { } } } catch (JSONException e) { - Log.w("Exception parsing interactions array.", e); + ApptentiveLog.w("Exception parsing interactions array.", e); } return ret; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/AppStoreRatingInteractionView.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/AppStoreRatingInteractionView.java index 835ec7c74..eedb12fec 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/AppStoreRatingInteractionView.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/AppStoreRatingInteractionView.java @@ -12,7 +12,7 @@ import android.content.DialogInterface; import android.os.Bundle; import com.apptentive.android.sdk.ApptentiveInternal; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.model.Configuration; import com.apptentive.android.sdk.module.engagement.interaction.model.AppStoreRatingInteraction; @@ -66,7 +66,7 @@ public void doOnCreate(Activity activity, Bundle savedInstanceState) { } catch (InsufficientRatingArgumentsException e) { // TODO: Log a message to apptentive to let the developer know that their custom rating provider puked? showingDialog = true; - Log.e(e.getMessage()); + ApptentiveLog.e(e.getMessage()); displayError(activity, activity.getString(R.string.apptentive_rating_error)); } finally { if (!showingDialog) { @@ -81,7 +81,7 @@ public boolean onBackPressed(Activity activity) { } private void displayError(final Activity activity, String message) { - Log.e(message); + ApptentiveLog.e(message); final AlertDialog alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle(activity.getString(R.string.apptentive_oops)); alertDialog.setMessage(message); diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/InteractionView.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/InteractionView.java index 3f2a997c8..323f6241f 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/InteractionView.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/InteractionView.java @@ -9,7 +9,7 @@ import android.app.Activity; import android.os.Bundle; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.ActivityContent; import com.apptentive.android.sdk.module.engagement.interaction.model.Interaction; @@ -29,7 +29,7 @@ public InteractionView(T interaction) { } public void onCreate(final Activity activity, Bundle savedInstanceState) { - Log.d("Showing interaction."); + ApptentiveLog.d("Showing interaction."); if (savedInstanceState != null) { hasLaunched = savedInstanceState.getBoolean(HAS_LAUNCHED); } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/NavigateToLinkInteractionView.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/NavigateToLinkInteractionView.java index f1b3d2035..f45632808 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/NavigateToLinkInteractionView.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/NavigateToLinkInteractionView.java @@ -11,7 +11,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.EngagementModule; import com.apptentive.android.sdk.module.engagement.interaction.model.NavigateToLinkInteraction; import com.apptentive.android.sdk.util.Util; @@ -52,7 +52,7 @@ public void doOnCreate(Activity activity, Bundle savedInteraction) { success = true; } } catch (ActivityNotFoundException e) { - Log.w("NavigateToLink Error: ", e); + ApptentiveLog.w("NavigateToLink Error: ", e); } finally { JSONObject data = new JSONObject(); try { @@ -60,7 +60,7 @@ public void doOnCreate(Activity activity, Bundle savedInteraction) { data.put(NavigateToLinkInteraction.KEY_TARGET, interaction.getTarget().lowercaseName()); data.put(NavigateToLinkInteraction.EVENT_KEY_SUCCESS, success); } catch (JSONException e) { - Log.e("Error creating Event data object.", e); + ApptentiveLog.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, NavigateToLinkInteraction.EVENT_NAME_NAVIGATE, data.toString()); // Always finish this Activity. diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/TextModalInteractionView.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/TextModalInteractionView.java index 654964a04..d986bdd98 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/TextModalInteractionView.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/TextModalInteractionView.java @@ -12,7 +12,7 @@ import android.widget.LinearLayout; import android.widget.TextView; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.module.engagement.EngagementModule; import com.apptentive.android.sdk.module.engagement.interaction.InteractionManager; @@ -108,7 +108,7 @@ public void onClick(View view) { data.put(Action.KEY_LABEL, buttonAction.getLabel()); data.put(TextModalInteraction.EVENT_KEY_ACTION_POSITION, position); } catch (JSONException e) { - Log.e("Error creating Event data object.", e); + ApptentiveLog.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, TextModalInteraction.EVENT_NAME_DISMISS, data.toString()); activity.finish(); @@ -144,7 +144,7 @@ public void onClick(View view) { data.put(TextModalInteraction.EVENT_KEY_ACTION_POSITION, position); data.put(TextModalInteraction.EVENT_KEY_INVOKED_INTERACTION_ID, invokedInteraction == null ? JSONObject.NULL : invokedInteraction.getId()); } catch (JSONException e) { - Log.e("Error creating Event data object.", e); + ApptentiveLog.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, TextModalInteraction.EVENT_NAME_INTERACTION, data.toString()); diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/UpgradeMessageInteractionView.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/UpgradeMessageInteractionView.java index 563cbca21..8fad0673f 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/UpgradeMessageInteractionView.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/UpgradeMessageInteractionView.java @@ -15,7 +15,7 @@ import android.view.View; import android.webkit.WebView; import android.widget.ImageView; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.model.Configuration; import com.apptentive.android.sdk.module.engagement.EngagementModule; @@ -68,7 +68,7 @@ private Drawable getIconDrawableResourceId(Activity activity) { PackageInfo pi = pm.getPackageInfo(activity.getPackageName(), 0); return activity.getResources().getDrawable(pi.applicationInfo.icon); } catch (Exception e) { - Log.e("Error loading app icon.", e); + ApptentiveLog.e("Error loading app icon.", e); } return null; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/survey/SurveyInteractionView.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/survey/SurveyInteractionView.java index 3372134ac..1bad7ca0f 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/survey/SurveyInteractionView.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/interaction/view/survey/SurveyInteractionView.java @@ -16,7 +16,7 @@ import android.widget.TextView; import com.apptentive.android.sdk.ApptentiveInternal; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.model.Configuration; import com.apptentive.android.sdk.model.SurveyResponse; @@ -112,7 +112,7 @@ public void onDismiss(DialogInterface dialogInterface) { EngagementModule.engageInternal(activity, interaction, EVENT_SUBMIT); ApptentiveDatabase.getInstance(activity).addPayload(new SurveyResponse(interaction, surveyState)); - Log.d("Survey Submitted."); + ApptentiveLog.d("Survey Submitted."); callListener(true); cleanup(); diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ClauseParser.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ClauseParser.java index bfbbc9b65..e335c085f 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ClauseParser.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ClauseParser.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.module.engagement.logic; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Util; import org.json.JSONException; @@ -22,14 +22,14 @@ public class ClauseParser { private static final String KEY_COMPLEX_TYPE = "_type"; public static Clause parse(String json) throws JSONException { - Log.v("+ Parsing Interaction Criteria."); + ApptentiveLog.v("+ Parsing Interaction Criteria."); if (json == null) { - Log.e("+ Interaction Criteria is null."); + ApptentiveLog.e("+ Interaction Criteria is null."); return null; } JSONObject root = new JSONObject(json); Clause ret = ClauseParser.parse(null, root); - Log.v("+ Finished parsing Interaction Criteria."); + ApptentiveLog.v("+ Finished parsing Interaction Criteria."); return ret; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java index b0567e8d7..6ae4968c8 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalClause.java @@ -8,7 +8,7 @@ import android.content.Context; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Util; import org.json.JSONObject; @@ -31,7 +31,7 @@ public ConditionalClause(String field, Object inputValue) { this.fieldName = field.trim(); conditionalTests = new ArrayList(); - Log.v(" + ConditionalClause for query: \"%s\"", fieldName); + ApptentiveLog.v(" + ConditionalClause for query: \"%s\"", fieldName); if (inputValue instanceof JSONObject && !isComplexType((JSONObject) inputValue)) { conditionalTests = getConditions((JSONObject) inputValue); } else { @@ -65,10 +65,10 @@ private boolean isComplexType(JSONObject jsonObject) { */ @Override public boolean evaluate(Context context) { - Log.v(" - %s", fieldName); + ApptentiveLog.v(" - %s", fieldName); Comparable fieldValue = FieldManager.getValue(context, fieldName); for (ConditionalTest test : conditionalTests) { - Log.v(" - %s %s %s?", Util.classToString(fieldValue), test.operator, Util.classToString(test.parameter)); + ApptentiveLog.v(" - %s %s %s?", Util.classToString(fieldValue), test.operator, Util.classToString(test.parameter)); if (!test.operator.apply(fieldValue, test.parameter)) { return false; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalOperator.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalOperator.java index 741c482ac..d4b7f1f0f 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalOperator.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalOperator.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.module.engagement.logic; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Util; import java.math.BigDecimal; @@ -151,7 +151,7 @@ public boolean apply(Comparable first, Comparable second) { Double offset = ((BigDecimal) second).doubleValue(); Double currentTime = Util.currentTimeSeconds(); Apptentive.DateTime offsetDateTime = new Apptentive.DateTime(currentTime + offset); - Log.v(" - %s?", Util.classToString(offsetDateTime)); + ApptentiveLog.v(" - %s?", Util.classToString(offsetDateTime)); return ((Apptentive.DateTime) first).compareTo(offsetDateTime) < 0; } }, @@ -168,7 +168,7 @@ public boolean apply(Comparable first, Comparable second) { Double offset = ((BigDecimal) second).doubleValue(); Double currentTime = Util.currentTimeSeconds(); Apptentive.DateTime offsetDateTime = new Apptentive.DateTime(currentTime + offset); - Log.v(" - %s?", Util.classToString(offsetDateTime)); + ApptentiveLog.v(" - %s?", Util.classToString(offsetDateTime)); return ((Apptentive.DateTime) first).compareTo(offsetDateTime) > 0; } }, diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalTest.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalTest.java index 0ad681119..47efcd872 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalTest.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/ConditionalTest.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.module.engagement.logic; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Util; /** @@ -18,7 +18,7 @@ public class ConditionalTest { public Comparable parameter; public ConditionalTest(ConditionalOperator operator, Object parameter) { - Log.v(" + ConditionalTest: %s: %s", operator.name(), Util.classToString(parameter)); + ApptentiveLog.v(" + ConditionalTest: %s: %s", operator.name(), Util.classToString(parameter)); this.operator = operator; if (parameter != null && !(parameter instanceof Comparable)) { throw new IllegalArgumentException(String.format("Encountered non-Comparable parameter: %s", Util.classToString(parameter))); diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/FieldManager.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/FieldManager.java index 7dcd7b66b..1d5fc4aea 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/FieldManager.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/FieldManager.java @@ -9,7 +9,7 @@ import android.content.Context; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.CodePointStore; import com.apptentive.android.sdk.model.CustomData; import com.apptentive.android.sdk.model.Device; @@ -239,7 +239,7 @@ public static QueryPart parse(String name) { try { return QueryPart.valueOf(name); } catch (IllegalArgumentException e) { - Log.d(String.format("Unrecognized QueryPart: \"%s\". Defaulting to \"unknown\"", name), e); + ApptentiveLog.d(String.format("Unrecognized QueryPart: \"%s\". Defaulting to \"unknown\"", name), e); } } return other; diff --git a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/LogicalClause.java b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/LogicalClause.java index 7742ff1f3..1a49a51a5 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/LogicalClause.java +++ b/apptentive/src/com/apptentive/android/sdk/module/engagement/logic/LogicalClause.java @@ -8,7 +8,7 @@ import android.content.Context; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONArray; import org.json.JSONException; @@ -31,7 +31,7 @@ protected LogicalClause(String key, Object value) throws JSONException { operatorName = key.trim(); operator = LogicalOperator.parse(operatorName); children = new ArrayList(); - Log.v(" + LogicalClause of type \"%s\"", operatorName); + ApptentiveLog.v(" + LogicalClause of type \"%s\"", operatorName); if (value instanceof JSONArray) { JSONArray jsonArray = (JSONArray) value; for (int i = 0; i < jsonArray.length(); i++) { @@ -50,34 +50,34 @@ protected LogicalClause(String key, Object value) throws JSONException { } } } else { - Log.w("Unrecognized LogicalClause: %s", value.toString()); + ApptentiveLog.w("Unrecognized LogicalClause: %s", value.toString()); } } @Override public boolean evaluate(Context context) { - Log.v(" - <%s>", operator.name()); + ApptentiveLog.v(" - <%s>", operator.name()); if (operator == LogicalOperator.$and) { for (Clause clause : children) { boolean ret = clause.evaluate(context); - Log.v(" - => %b", ret); + ApptentiveLog.v(" - => %b", ret); if (!ret) { - Log.v(" - ", operator.name()); + ApptentiveLog.v(" - ", operator.name()); return false; } } - Log.v(" - ", operator.name()); + ApptentiveLog.v(" - ", operator.name()); return true; } else if (operator == LogicalOperator.$or) { for (Clause clause : children) { boolean ret = clause.evaluate(context); - Log.v(" - => %b", ret); + ApptentiveLog.v(" - => %b", ret); if (ret) { - Log.v(" - ", operator.name()); + ApptentiveLog.v(" - ", operator.name()); return true; } } - Log.v(" - => false", operator.name()); + ApptentiveLog.v(" - => false", operator.name()); return false; } else if (operator == LogicalOperator.$not) { if (children.size() != 1) { @@ -85,13 +85,13 @@ public boolean evaluate(Context context) { } Clause clause = children.get(0); boolean ret = clause.evaluate(context); - Log.v(" - => %b", ret); - Log.v(" - ", operator.name()); + ApptentiveLog.v(" - => %b", ret); + ApptentiveLog.v(" - ", operator.name()); return !ret; } else { // Unsupported - Log.v("Unsupported operation: \"%s\" => false", operatorName); - Log.v(" - ", operator.name()); + ApptentiveLog.v("Unsupported operation: \"%s\" => false", operatorName); + ApptentiveLog.v(" - ", operator.name()); return false; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/MessageManager.java b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/MessageManager.java index ca45fcfd7..dd23f0762 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/MessageManager.java +++ b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/MessageManager.java @@ -16,11 +16,10 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; -import android.text.TextUtils; import com.apptentive.android.sdk.Apptentive; import com.apptentive.android.sdk.GlobalInfo; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.ViewActivity; import com.apptentive.android.sdk.comm.ApptentiveClient; @@ -147,11 +146,11 @@ public static synchronized boolean fetchAndStoreMessages(Context appContext, boo // Fetch the messages. String lastId = getMessageStore(appContext).getLastReceivedMessageId(); List messagesToSave = fetchMessages(appContext, lastId); - Log.d("Fetching messages after last id: " + lastId); + ApptentiveLog.d("Fetching messages after last id: " + lastId); CompoundMessage messageOnToast = null; if (messagesToSave != null && messagesToSave.size() > 0) { - Log.d("Messages retrieved."); + ApptentiveLog.d("Messages retrieved."); // Also get the count of incoming unread messages. int incomingUnreadMessages = 0; // Mark messages from server where sender is the app user as read. @@ -211,12 +210,12 @@ public static void sendMessage(Context context, ApptentiveMessage apptentiveMess * This doesn't need to be run during normal program execution. Testing only. */ public static void deleteAllMessages(Context context) { - Log.e("Deleting all messages."); + ApptentiveLog.e("Deleting all messages."); getMessageStore(context).deleteAllMessages(); } private static List fetchMessages(Context appContext, String afterId) { - Log.d("Fetching messages newer than: " + afterId); + ApptentiveLog.d("Fetching messages newer than: " + afterId); ApptentiveHttpResponse response = ApptentiveClient.getMessages(appContext, null, afterId, null); List ret = new ArrayList(); @@ -226,9 +225,9 @@ private static List fetchMessages(Context appContext, String try { ret = parseMessagesString(appContext, response.getContent()); } catch (JSONException e) { - Log.e("Error parsing messages JSON.", e); + ApptentiveLog.e("Error parsing messages JSON.", e); } catch (Exception e) { - Log.e("Unexpected error parsing messages JSON.", e); + ApptentiveLog.e("Unexpected error parsing messages JSON.", e); } return ret; } @@ -301,7 +300,7 @@ public static void onSentMessage(Context context, ApptentiveMessage apptentiveMe apptentiveMessage.setId(responseJson.getString(ApptentiveMessage.KEY_ID)); apptentiveMessage.setCreatedAt(responseJson.getDouble(ApptentiveMessage.KEY_CREATED_AT)); } catch (JSONException e) { - Log.e("Error parsing sent apptentiveMessage response.", e); + ApptentiveLog.e("Error parsing sent apptentiveMessage response.", e); } getMessageStore(context).updateMessage(apptentiveMessage); diff --git a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/MessagePollingWorker.java b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/MessagePollingWorker.java index bd4e243e7..14f47d725 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/MessagePollingWorker.java +++ b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/MessagePollingWorker.java @@ -9,10 +9,9 @@ import android.content.Context; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.Configuration; import com.apptentive.android.sdk.module.metric.MetricModule; -import com.apptentive.android.sdk.util.Util; import java.lang.ref.WeakReference; import java.util.concurrent.atomic.AtomicBoolean; @@ -71,7 +70,7 @@ public MessagePollingThread(Context context) { public void run() { try { - Log.v("Started %s", toString()); + ApptentiveLog.v("Started %s", toString()); while (appInForeground.get()) { if (contextRef.get() == null) { @@ -84,7 +83,7 @@ public void run() { } long pollingInterval = messageCenterInForeground.get() ? foregroundPollingInterval : backgroundPollingInterval; if (Apptentive.canShowMessageCenter(contextRef.get())) { - Log.v("Checking server for new messages every %d seconds", pollingInterval / 1000); + ApptentiveLog.v("Checking server for new messages every %d seconds", pollingInterval / 1000); MessageManager.fetchAndStoreMessages(contextRef.get(), messageCenterInForeground.get(), conf.isMessageCenterNotificationPopupEnabled()); } MessagePollingWorker.goToSleep(pollingInterval); @@ -92,7 +91,7 @@ public void run() { } finally { threadRunning.set(false); sPollingThread = null; - Log.v("Stopping MessagePollingThread."); + ApptentiveLog.v("Stopping MessagePollingThread."); } } } @@ -106,7 +105,7 @@ private static void goToSleep(long millis) { } private static void wakeUp() { - Log.v("Waking MessagePollingThread."); + ApptentiveLog.v("Waking MessagePollingThread."); MessagePollingThread thread = getAndSetMessagePollingThread(true, false, null); if (thread != null && thread.isAlive()) { thread.interrupt(); diff --git a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/ApptentiveMessage.java b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/ApptentiveMessage.java index 2765dd2d9..03f1e3cba 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/ApptentiveMessage.java +++ b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/ApptentiveMessage.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.module.messagecenter.model; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.ConversationItem; import org.json.JSONException; @@ -61,7 +61,7 @@ public void setId(String id) { try { put(KEY_ID, id); } catch (JSONException e) { - Log.e("Exception setting ApptentiveMessage's %s field.", e, KEY_ID); + ApptentiveLog.e("Exception setting ApptentiveMessage's %s field.", e, KEY_ID); } } @@ -89,7 +89,7 @@ public void setCreatedAt(Double createdAt) { try { put(KEY_CREATED_AT, createdAt); } catch (JSONException e) { - Log.e("Exception setting ApptentiveMessage's %s field.", e, KEY_CREATED_AT); + ApptentiveLog.e("Exception setting ApptentiveMessage's %s field.", e, KEY_CREATED_AT); } } @@ -109,7 +109,7 @@ protected void setType(Type type) { try { put(KEY_TYPE, type.name()); } catch (JSONException e) { - Log.e("Exception setting ApptentiveMessage's %s field.", e, KEY_TYPE); + ApptentiveLog.e("Exception setting ApptentiveMessage's %s field.", e, KEY_TYPE); } } @@ -126,7 +126,7 @@ public void setHidden(boolean hidden) { try { put(KEY_HIDDEN, hidden); } catch (JSONException e) { - Log.e("Exception setting ApptentiveMessage's %s field.", e, KEY_HIDDEN); + ApptentiveLog.e("Exception setting ApptentiveMessage's %s field.", e, KEY_HIDDEN); } } @@ -144,7 +144,7 @@ public void setCustomData(Map customData) { } put(KEY_CUSTOM_DATA, customDataJson); } catch (JSONException e) { - Log.e("Exception setting ApptentiveMessage's %s field.", e, KEY_CUSTOM_DATA); + ApptentiveLog.e("Exception setting ApptentiveMessage's %s field.", e, KEY_CUSTOM_DATA); } } @@ -193,7 +193,7 @@ public void setSenderId(String senderId) { } sender.put(KEY_SENDER_ID, senderId); } catch (JSONException e) { - Log.e("Exception setting ApptentiveMessage's %s field.", e, KEY_SENDER_ID); + ApptentiveLog.e("Exception setting ApptentiveMessage's %s field.", e, KEY_SENDER_ID); } } @@ -240,7 +240,7 @@ public void setAutomated(boolean isAutomated) { try { put(KEY_AUTOMATED, isAutomated); } catch (JSONException e) { - Log.e("Exception setting ApptentiveMessage's %s field.", e, KEY_AUTOMATED); + ApptentiveLog.e("Exception setting ApptentiveMessage's %s field.", e, KEY_AUTOMATED); } } @@ -275,7 +275,7 @@ public static Type parse(String rawType) { try { return Type.valueOf(rawType); } catch (IllegalArgumentException e) { - Log.v("Error parsing unknown ApptentiveMessage.Type: " + rawType); + ApptentiveLog.v("Error parsing unknown ApptentiveMessage.Type: " + rawType); } return unknown; } @@ -291,7 +291,7 @@ public static State parse(String state) { try { return State.valueOf(state); } catch (IllegalArgumentException e) { - Log.v("Error parsing unknown ApptentiveMessage.State: " + state); + ApptentiveLog.v("Error parsing unknown ApptentiveMessage.State: " + state); } return unknown; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/CompoundMessage.java b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/CompoundMessage.java index cfa85493d..e23a97e68 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/CompoundMessage.java +++ b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/CompoundMessage.java @@ -8,7 +8,7 @@ import android.content.Context; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.StoredFile; import com.apptentive.android.sdk.storage.ApptentiveDatabase; import com.apptentive.android.sdk.util.image.ImageItem; @@ -94,7 +94,7 @@ public void setBody(String body) { try { put(KEY_BODY, body); } catch (JSONException e) { - Log.e("Unable to set message body."); + ApptentiveLog.e("Unable to set message body."); } } @@ -111,7 +111,7 @@ public void setTitle(String title) { try { put(KEY_TITLE, title); } catch (JSONException e) { - Log.e("Unable to set title."); + ApptentiveLog.e("Unable to set title."); } } @@ -128,7 +128,7 @@ public void setTextOnly(boolean bVal) { try { put(KEY_TEXT_ONLY, bVal); } catch (JSONException e) { - Log.e("Unable to set file filePath."); + ApptentiveLog.e("Unable to set file filePath."); } } diff --git a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/MessageFactory.java b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/MessageFactory.java index 134079756..406046e8a 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/MessageFactory.java +++ b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/model/MessageFactory.java @@ -10,7 +10,7 @@ import android.text.TextUtils; import com.apptentive.android.sdk.GlobalInfo; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; import org.json.JSONObject; @@ -52,7 +52,7 @@ public static ApptentiveMessage fromJson(Context appContext, String json) { break; } } catch (JSONException e) { - Log.v("Error parsing json as Message: %s", e, json); + ApptentiveLog.v("Error parsing json as Message: %s", e, json); } catch (IllegalArgumentException e) { // Exception treated as unknown type } diff --git a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/ApptentiveAvatarView.java b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/ApptentiveAvatarView.java index 2aac1e3b1..999bb2078 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/ApptentiveAvatarView.java +++ b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/ApptentiveAvatarView.java @@ -17,7 +17,7 @@ import android.util.AttributeSet; import android.widget.ImageView; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.module.metric.MetricModule; @@ -150,7 +150,7 @@ private Bitmap getBitmapFromDrawable(Drawable d) { d.draw(canvas); return b; } catch (OutOfMemoryError e) { - Log.w("Error creating bitmap.", e); + ApptentiveLog.w("Error creating bitmap.", e); return null; } } @@ -222,7 +222,7 @@ public void run() { URL url = new URL(urlString); bitmap = BitmapFactory.decodeStream(url.openStream()); } catch (IOException e) { - Log.d("Error opening avatar from URL: \"%s\"", e, urlString); + ApptentiveLog.d("Error opening avatar from URL: \"%s\"", e, urlString); } if (bitmap != null) { final Bitmap finalBitmap = bitmap; @@ -237,7 +237,7 @@ public void run() { Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable throwable) { - Log.w("UncaughtException in AvatarView.", throwable); + ApptentiveLog.w("UncaughtException in AvatarView.", throwable); MetricModule.sendError(getContext().getApplicationContext(), throwable, null, null); } }; diff --git a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/MessageAdapter.java b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/MessageAdapter.java index 2c83c41d6..98b04fc94 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/MessageAdapter.java +++ b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/MessageAdapter.java @@ -24,7 +24,7 @@ import android.widget.EditText; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.model.*; import com.apptentive.android.sdk.module.engagement.EngagementModule; @@ -256,7 +256,7 @@ public View getView(final int position, View convertView, ViewGroup parent) { break; default: view = null; - Log.i("Unrecognized type: %d", type); + ApptentiveLog.i("Unrecognized type: %d", type); break; } if (view != null) { @@ -644,7 +644,7 @@ private Point getBitmapDimensions(StoredFile storedFile) { float scale = ImageUtil.calculateBitmapScaleFactor(options.outWidth, options.outHeight, maxImageWidth, maxImageHeight); ret = new Point((int) (scale * options.outWidth), (int) (scale * options.outHeight)); } catch (Exception e) { - Log.e("Error opening stored file.", e); + ApptentiveLog.e("Error opening stored file.", e); } finally { Util.ensureClosed(fis); } @@ -752,14 +752,14 @@ protected Bitmap doInBackground(String... paths) { maxImageHeight = maxImageHeight > MAX_IMAGE_DISPLAY_HEIGHT ? MAX_IMAGE_DISPLAY_HEIGHT : maxImageHeight; // Loading image from File Store. Pass 0 for orientation because images have been rotated when stored imageBitmap = ImageUtil.createScaledBitmapFromLocalImageSource(activityContext, paths[0], maxImageWidth, maxImageHeight, null, 0); - Log.v("Loaded bitmap and re-sized to: %d x %d", imageBitmap.getWidth(), imageBitmap.getHeight()); + ApptentiveLog.v("Loaded bitmap and re-sized to: %d x %d", imageBitmap.getWidth(), imageBitmap.getHeight()); } catch (Exception e) { - Log.e("Error opening stored image.", e); + ApptentiveLog.e("Error opening stored image.", e); } catch (OutOfMemoryError e) { // It's generally not a good idea to catch an OutOfMemoryException. But in this case, the OutOfMemoryException // had to result from allocating a bitmap, so the system should be in a good state. // TODO: Log an event to the server so we know an OutOfMemoryException occurred. - Log.e("Ran out of memory opening image.", e); + ApptentiveLog.e("Ran out of memory opening image.", e); } return imageBitmap; } diff --git a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/MessageCenterActivityContent.java b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/MessageCenterActivityContent.java index e76fe99ef..2be06cc17 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/MessageCenterActivityContent.java +++ b/apptentive/src/com/apptentive/android/sdk/module/messagecenter/view/MessageCenterActivityContent.java @@ -36,7 +36,7 @@ import com.apptentive.android.sdk.Apptentive; import com.apptentive.android.sdk.ApptentiveInternal; import com.apptentive.android.sdk.ApptentiveInternalActivity; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.comm.ApptentiveHttpResponse; @@ -510,7 +510,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case Constants.REQUEST_CODE_PHOTO_FROM_SYSTEM_PICKER: { if (data == null) { - Log.d("no image is picked"); + ApptentiveLog.d("no image is picked"); return; } imagePickerLaunched = false; @@ -582,12 +582,12 @@ private void clearPendingMessageCenterPushNotification() { } switch (action) { case pmc: - Log.i("Clearing pending Message Center push notification."); + ApptentiveLog.i("Clearing pending Message Center push notification."); prefs.edit().remove(Constants.PREF_KEY_PENDING_PUSH_NOTIFICATION).commit(); break; } } catch (JSONException e) { - Log.w("Error parsing JSON from push notification.", e); + ApptentiveLog.w("Error parsing JSON from push notification.", e); MetricModule.sendError(viewActivity.getApplicationContext(), e, "Parsing Push notification", pushData); } } @@ -812,20 +812,20 @@ public void removeImageFromComposer(final int position) { public void openNonImageAttachment(final ImageItem image) { if (image == null) { - Log.d("No attachment argument."); + ApptentiveLog.d("No attachment argument."); return; } try { Util.openFileAttachment(viewActivity, image.originalPath, image.localCachePath, image.mimeType); } catch (Exception e) { - Log.e("Error loading attachment", e); + ApptentiveLog.e("Error loading attachment", e); } } public void showAttachmentDialog(final ImageItem image) { if (image == null) { - Log.d("No attachment argument."); + ApptentiveLog.d("No attachment argument."); return; } @@ -834,7 +834,7 @@ public void showAttachmentDialog(final ImageItem image) { AttachmentPreviewDialog dialog = AttachmentPreviewDialog.newInstance(image); dialog.show(((ApptentiveInternalActivity) viewActivity).getSupportFragmentManager(), "preview_dialog"); } catch (Exception e) { - Log.e("Error loading attachment preview.", e); + ApptentiveLog.e("Error loading attachment preview.", e); } } @@ -1289,7 +1289,7 @@ public void onAttachImage() { } catch (Exception e) { e.printStackTrace(); imagePickerLaunched = false; - Log.d("can't launch image picker"); + ApptentiveLog.d("can't launch image picker"); } } diff --git a/apptentive/src/com/apptentive/android/sdk/module/metric/MetricModule.java b/apptentive/src/com/apptentive/android/sdk/module/metric/MetricModule.java index 73b50e561..aecca70dd 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/metric/MetricModule.java +++ b/apptentive/src/com/apptentive/android/sdk/module/metric/MetricModule.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.module.metric; import android.content.Context; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.Configuration; import com.apptentive.android.sdk.model.Event; import com.apptentive.android.sdk.model.EventManager; @@ -34,7 +34,7 @@ public static void sendMetric(Context context, Event.EventLabel type, String tri public static void sendMetric(Context context, Event.EventLabel type, String trigger, Map data) { Configuration config = Configuration.load(context); if (config.isMetricsEnabled()) { - Log.v("Sending Metric: %s, trigger: %s, data: %s", type.getLabelName(), trigger, data != null ? data.toString() : "null"); + ApptentiveLog.v("Sending Metric: %s, trigger: %s, data: %s", type.getLabelName(), trigger, data != null ? data.toString() : "null"); Event event = new Event(type.getLabelName(), trigger); event.putData(data); EventManager.sendEvent(context, event); @@ -68,14 +68,14 @@ public static void sendError(Context context, Throwable throwable, String descri } Configuration config = Configuration.load(context); if (config.isMetricsEnabled()) { - Log.v("Sending Error Metric: %s, data: %s", type.getLabelName(), data.toString()); + ApptentiveLog.v("Sending Error Metric: %s, data: %s", type.getLabelName(), data.toString()); Event event = new Event(type.getLabelName(), data); EventManager.sendEvent(context, event); } } catch (Exception e) { // Since this is the last place in Apptentive code we can catch exceptions, we must catch all other Exceptions to // prevent the app from crashing. - Log.w("Error creating Error Metric. Nothing we can do but log this.", e); + ApptentiveLog.w("Error creating Error Metric. Nothing we can do but log this.", e); } } } diff --git a/apptentive/src/com/apptentive/android/sdk/module/rating/impl/GooglePlayRatingProvider.java b/apptentive/src/com/apptentive/android/sdk/module/rating/impl/GooglePlayRatingProvider.java index 284c499b8..8fbe5f632 100644 --- a/apptentive/src/com/apptentive/android/sdk/module/rating/impl/GooglePlayRatingProvider.java +++ b/apptentive/src/com/apptentive/android/sdk/module/rating/impl/GooglePlayRatingProvider.java @@ -12,7 +12,7 @@ import android.content.Intent; import android.net.Uri; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.module.rating.IRatingProvider; import com.apptentive.android.sdk.module.rating.InsufficientRatingArgumentsException; @@ -21,11 +21,11 @@ public class GooglePlayRatingProvider implements IRatingProvider { public void startRating(Context context, Map args) throws InsufficientRatingArgumentsException { if (!args.containsKey("package")) { String packageName = context.getPackageName(); - Log.w("Rating provider args did not contain package name. Adding default package: \"%s\"", packageName); + ApptentiveLog.w("Rating provider args did not contain package name. Adding default package: \"%s\"", packageName); args.put("package", packageName); } Uri uri = Uri.parse("market://details?id=" + args.get("package")); - Log.i("Opening app store for rating with URI: \"%s\"", uri); + ApptentiveLog.i("Opening app store for rating with URI: \"%s\"", uri); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); diff --git a/apptentive/src/com/apptentive/android/sdk/storage/AppReleaseManager.java b/apptentive/src/com/apptentive/android/sdk/storage/AppReleaseManager.java index 2a604582a..1403bd51e 100644 --- a/apptentive/src/com/apptentive/android/sdk/storage/AppReleaseManager.java +++ b/apptentive/src/com/apptentive/android/sdk/storage/AppReleaseManager.java @@ -10,7 +10,7 @@ import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.AppRelease; import com.apptentive.android.sdk.util.Constants; import com.apptentive.android.sdk.util.JsonDiffer; @@ -32,7 +32,7 @@ public static AppRelease storeAppReleaseAndReturnDiff(Context context) { storeAppRelease(context, current); return new AppRelease(diff.toString()); } catch (JSONException e) { - Log.e("Error casting to AppRelease.", e); + ApptentiveLog.e("Error casting to AppRelease.", e); } } return null; @@ -49,7 +49,7 @@ private static AppRelease generateCurrentAppRelease(Context context) { appRelease.setTargetSdkVersion(String.valueOf(packageInfo.applicationInfo.targetSdkVersion)); appRelease.setAppStore(Util.getInstallerPackageName(context)); } catch (PackageManager.NameNotFoundException e) { - Log.e("Can't load PackageInfo.", e); + ApptentiveLog.e("Can't load PackageInfo.", e); } return appRelease; } diff --git a/apptentive/src/com/apptentive/android/sdk/storage/ApptentiveDatabase.java b/apptentive/src/com/apptentive/android/sdk/storage/ApptentiveDatabase.java index d900b27a7..2da3c672e 100644 --- a/apptentive/src/com/apptentive/android/sdk/storage/ApptentiveDatabase.java +++ b/apptentive/src/com/apptentive/android/sdk/storage/ApptentiveDatabase.java @@ -14,7 +14,7 @@ import android.database.sqlite.SQLiteOpenHelper; import android.text.TextUtils; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.*; import com.apptentive.android.sdk.module.messagecenter.model.ApptentiveMessage; import com.apptentive.android.sdk.module.messagecenter.model.CompoundMessage; @@ -149,7 +149,7 @@ public static void ensureClosed(SQLiteDatabase db) { db.close(); } } catch (Exception e) { - Log.w("Error closing SQLite database.", e); + ApptentiveLog.w("Error closing SQLite database.", e); } } @@ -159,7 +159,7 @@ public static void ensureClosed(Cursor cursor) { cursor.close(); } } catch (Exception e) { - Log.w("Error closing SQLite cursor.", e); + ApptentiveLog.w("Error closing SQLite cursor.", e); } } @@ -174,7 +174,7 @@ private ApptentiveDatabase(Context context) { */ @Override public void onCreate(SQLiteDatabase db) { - Log.d("ApptentiveDatabase.onCreate(db)"); + ApptentiveLog.d("ApptentiveDatabase.onCreate(db)"); db.execSQL(TABLE_CREATE_PAYLOAD); db.execSQL(TABLE_CREATE_MESSAGE); db.execSQL(TABLE_CREATE_FILESTORE); @@ -187,7 +187,7 @@ public void onCreate(SQLiteDatabase db) { */ @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - Log.d("ApptentiveDatabase.onUpgrade(db, %d, %d)", oldVersion, newVersion); + ApptentiveLog.d("ApptentiveDatabase.onUpgrade(db, %d, %d)", oldVersion, newVersion); switch (oldVersion) { case 1: if (newVersion == 2) { @@ -217,7 +217,7 @@ public synchronized void addPayload(Payload... payloads) { db.setTransactionSuccessful(); db.endTransaction(); } catch (SQLException sqe) { - Log.e("addPayload EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("addPayload EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(db); } @@ -230,7 +230,7 @@ public synchronized void deletePayload(Payload payload) { db = getWritableDatabase(); db.delete(TABLE_PAYLOAD, PAYLOAD_KEY_DB_ID + " = ?", new String[]{Long.toString(payload.getDatabaseId())}); } catch (SQLException sqe) { - Log.e("deletePayload EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("deletePayload EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(db); } @@ -243,7 +243,7 @@ public synchronized void deleteAllPayloads() { db = getWritableDatabase(); db.delete(TABLE_PAYLOAD, "", null); } catch (SQLException sqe) { - Log.e("deleteAllPayloads EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("deleteAllPayloads EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(db); } @@ -268,7 +268,7 @@ public synchronized Payload getOldestUnsentPayload(Context appContext) { } return payload; } catch (SQLException sqe) { - Log.e("getOldestUnsentPayload EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("getOldestUnsentPayload EXCEPTION: " + sqe.getMessage()); return null; } finally { ensureClosed(cursor); @@ -320,7 +320,7 @@ public synchronized void addOrUpdateMessages(ApptentiveMessage... apptentiveMess } } } catch (SQLException sqe) { - Log.e("addOrUpdateMessages EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("addOrUpdateMessages EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(db); } @@ -343,7 +343,7 @@ public synchronized void updateMessage(ApptentiveMessage apptentiveMessage) { db.update(TABLE_MESSAGE, values, MESSAGE_KEY_NONCE + " = ?", new String[]{apptentiveMessage.getNonce()}); db.setTransactionSuccessful(); } catch (SQLException sqe) { - Log.e("updateMessage EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("updateMessage EXCEPTION: " + sqe.getMessage()); } finally { if (db != null) { db.endTransaction(); @@ -364,7 +364,7 @@ public synchronized List getAllMessages(Context appContext) { String json = cursor.getString(6); ApptentiveMessage apptentiveMessage = MessageFactory.fromJson(appContext, json); if (apptentiveMessage == null) { - Log.e("Error parsing Record json from database: %s", json); + ApptentiveLog.e("Error parsing Record json from database: %s", json); continue; } apptentiveMessage.setDatabaseId(cursor.getLong(0)); @@ -374,7 +374,7 @@ public synchronized List getAllMessages(Context appContext) { } while (cursor.moveToNext()); } } catch (SQLException sqe) { - Log.e("getAllMessages EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("getAllMessages EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(cursor); ensureClosed(db); @@ -393,7 +393,7 @@ public synchronized String getLastReceivedMessageId() { ret = cursor.getString(0); } } catch (SQLException sqe) { - Log.e("getLastReceivedMessageId EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("getLastReceivedMessageId EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(cursor); ensureClosed(db); @@ -409,7 +409,7 @@ public synchronized int getUnreadMessageCount() { cursor = db.rawQuery(QUERY_MESSAGE_UNREAD, null); return cursor.getCount(); } catch (SQLException sqe) { - Log.e("getUnreadMessageCount EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("getUnreadMessageCount EXCEPTION: " + sqe.getMessage()); return 0; } finally { ensureClosed(cursor); @@ -423,7 +423,7 @@ public synchronized void deleteAllMessages() { db = getWritableDatabase(); db.delete(TABLE_MESSAGE, "", null); } catch (SQLException sqe) { - Log.e("deleteAllMessages EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("deleteAllMessages EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(db); } @@ -434,9 +434,9 @@ public synchronized void deleteMessage(String nonce) { try { db = getWritableDatabase(); int deleted = db.delete(TABLE_MESSAGE, MESSAGE_KEY_NONCE + " = ?", new String[]{nonce}); - Log.d("Deleted %d messages.", deleted); + ApptentiveLog.d("Deleted %d messages.", deleted); } catch (SQLException sqe) { - Log.e("deleteMessage EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("deleteMessage EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(db); } @@ -477,7 +477,7 @@ public synchronized void migrateToCompoundMessage(SQLiteDatabase db) { } while (cursor.moveToNext()); } } catch (SQLException sqe) { - Log.e("migrateToCompoundMessage EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("migrateToCompoundMessage EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(cursor); } @@ -519,12 +519,12 @@ public synchronized void migrateToCompoundMessage(SQLiteDatabase db) { db.update(TABLE_MESSAGE, messageValues, MESSAGE_KEY_DB_ID + " = ?", new String[]{databaseId}); } } catch (JSONException e) { - Log.v("Error parsing json as Message: %s", e, json); + ApptentiveLog.v("Error parsing json as Message: %s", e, json); } } while (cursor.moveToNext()); } } catch (SQLException sqe) { - Log.e("migrateToCompoundMessage EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("migrateToCompoundMessage EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(cursor); } @@ -568,12 +568,12 @@ public synchronized void migrateToCompoundMessage(SQLiteDatabase db) { db.update(TABLE_PAYLOAD, messageValues, PAYLOAD_KEY_DB_ID + " = ?", new String[]{databaseId}); } } catch (JSONException e) { - Log.v("Error parsing json as Message: %s", e, json); + ApptentiveLog.v("Error parsing json as Message: %s", e, json); } } while (cursor.moveToNext()); } } catch (SQLException sqe) { - Log.e("migrateToCompoundMessage EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("migrateToCompoundMessage EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(cursor); } @@ -584,9 +584,9 @@ public synchronized void deleteAssociatedFiles(String messageNonce) { try { db = getWritableDatabase(); int deleted = db.delete(TABLE_COMPOUND_MESSSAGE_FILESTORE, COMPOUND_FILESTORE_KEY_MESSAGE_NONCE + " = ?", new String[]{messageNonce}); - Log.d("Deleted %d stored files.", deleted); + ApptentiveLog.d("Deleted %d stored files.", deleted); } catch (SQLException sqe) { - Log.e("deleteAssociatedFiles EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("deleteAssociatedFiles EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(db); } @@ -613,7 +613,7 @@ public synchronized List getAssociatedFiles(String nonce) { } while (cursor.moveToNext()); } } catch (SQLException sqe) { - Log.e("getAssociatedFiles EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("getAssociatedFiles EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(cursor); ensureClosed(db); @@ -651,7 +651,7 @@ public synchronized boolean addCompoundMessageFiles(List associatedF db.setTransactionSuccessful(); db.endTransaction(); } catch (SQLException sqe) { - Log.e("addCompoundMessageFiles EXCEPTION: " + sqe.getMessage()); + ApptentiveLog.e("addCompoundMessageFiles EXCEPTION: " + sqe.getMessage()); } finally { ensureClosed(db); return ret != -1; diff --git a/apptentive/src/com/apptentive/android/sdk/storage/DeviceManager.java b/apptentive/src/com/apptentive/android/sdk/storage/DeviceManager.java index 4f8c1b319..ec777f2a3 100644 --- a/apptentive/src/com/apptentive/android/sdk/storage/DeviceManager.java +++ b/apptentive/src/com/apptentive/android/sdk/storage/DeviceManager.java @@ -11,7 +11,7 @@ import android.os.Build; import android.telephony.TelephonyManager; import com.apptentive.android.sdk.GlobalInfo; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.CustomData; import com.apptentive.android.sdk.model.Device; import com.apptentive.android.sdk.util.Constants; @@ -51,7 +51,7 @@ public static Device storeDeviceAndReturnDiff(Context context) { storeDevice(context, current); return new Device(diff.toString()); } catch (JSONException e) { - Log.e("Error casting to Device.", e); + ApptentiveLog.e("Error casting to Device.", e); } } return null; diff --git a/apptentive/src/com/apptentive/android/sdk/storage/PayloadSendWorker.java b/apptentive/src/com/apptentive/android/sdk/storage/PayloadSendWorker.java index 089e0b8af..234bb90f5 100644 --- a/apptentive/src/com/apptentive/android/sdk/storage/PayloadSendWorker.java +++ b/apptentive/src/com/apptentive/android/sdk/storage/PayloadSendWorker.java @@ -8,7 +8,7 @@ import android.content.Context; import com.apptentive.android.sdk.GlobalInfo; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.comm.ApptentiveClient; import com.apptentive.android.sdk.comm.ApptentiveHttpResponse; import com.apptentive.android.sdk.model.*; @@ -75,7 +75,7 @@ public PayloadSendThread(Context appContext) { public void run() { try { - Log.v("Started %s", toString()); + ApptentiveLog.v("Started %s", toString()); while (appInForeground.get()) { if (contextRef.get() == null) { @@ -85,24 +85,24 @@ public void run() { PayloadSendThread thread = getAndSetPayloadSendThread(true, false, null); if (thread != null && thread != PayloadSendThread.this) { - Log.i("something wrong"); + ApptentiveLog.i("something wrong"); return; } PayloadStore db = getPayloadStore(contextRef.get()); if (Util.isEmpty(GlobalInfo.getConversationToken(contextRef.get()))) { - Log.i("No conversation token yet."); + ApptentiveLog.i("No conversation token yet."); MessageManager.onPauseSending(MessageManager.SEND_PAUSE_REASON_SERVER); goToSleep(NO_TOKEN_SLEEP); continue; } if (!Util.isNetworkConnectionPresent(contextRef.get())) { - Log.d("Can't send payloads. No network connection."); + ApptentiveLog.d("Can't send payloads. No network connection."); MessageManager.onPauseSending(MessageManager.SEND_PAUSE_REASON_NETWORK); goToSleep(NO_CONNECTION_SLEEP_TIME); continue; } - Log.v("Checking for payloads to send."); + ApptentiveLog.v("Checking for payloads to send."); Payload payload; payload = db.getOldestUnsentPayload(contextRef.get()); if (payload == null) { @@ -110,7 +110,7 @@ public void run() { goToSleep(EMPTY_QUEUE_SLEEP_TIME); continue; } - Log.d("Got a payload to send: %s:%d", payload.getBaseType(), payload.getDatabaseId()); + ApptentiveLog.d("Got a payload to send: %s:%d", payload.getBaseType(), payload.getDatabaseId()); ApptentiveHttpResponse response = null; @@ -141,7 +141,7 @@ public void run() { response = ApptentiveClient.postSurvey(contextRef.get(), (SurveyResponse) payload); break; default: - Log.e("Didn't send unknown Payload BaseType: " + payload.getBaseType()); + ApptentiveLog.e("Didn't send unknown Payload BaseType: " + payload.getBaseType()); db.deletePayload(payload); break; } @@ -149,14 +149,14 @@ public void run() { // Each Payload type is handled by the appropriate handler, but if sent correctly, or failed permanently to send, it should be removed from the queue. if (response != null) { if (response.isSuccessful()) { - Log.d("Payload submission successful. Removing from send queue."); + ApptentiveLog.d("Payload submission successful. Removing from send queue."); db.deletePayload(payload); } else if (response.isRejectedPermanently() || response.isBadPayload()) { - Log.d("Payload rejected. Removing from send queue."); - Log.v("Rejected json:", payload.toString()); + ApptentiveLog.d("Payload rejected. Removing from send queue."); + ApptentiveLog.v("Rejected json:", payload.toString()); db.deletePayload(payload); } else if (response.isRejectedTemporarily()) { - Log.d("Unable to send JSON. Leaving in queue."); + ApptentiveLog.d("Unable to send JSON. Leaving in queue."); if (response.isException()) { MessageManager.onPauseSending(MessageManager.SEND_PAUSE_REASON_SERVER); goToSleep(NO_CONNECTION_SLEEP_TIME); @@ -167,7 +167,7 @@ public void run() { } } } finally { - Log.v("Stopping PayloadSendThread."); + ApptentiveLog.v("Stopping PayloadSendThread."); threadRunning.set(false); } } diff --git a/apptentive/src/com/apptentive/android/sdk/storage/PersonManager.java b/apptentive/src/com/apptentive/android/sdk/storage/PersonManager.java index 164dbc9a3..cb636a183 100644 --- a/apptentive/src/com/apptentive/android/sdk/storage/PersonManager.java +++ b/apptentive/src/com/apptentive/android/sdk/storage/PersonManager.java @@ -9,7 +9,7 @@ import android.content.Context; import android.content.SharedPreferences; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.CustomData; import com.apptentive.android.sdk.model.Person; import com.apptentive.android.sdk.util.Constants; @@ -41,7 +41,7 @@ public static Person storePersonAndReturnDiff(Context context) { storePerson(context, current); return new Person(diff.toString()); } catch (JSONException e) { - Log.e("Error casting to Person.", e); + ApptentiveLog.e("Error casting to Person.", e); } } diff --git a/apptentive/src/com/apptentive/android/sdk/storage/SdkManager.java b/apptentive/src/com/apptentive/android/sdk/storage/SdkManager.java index 51f50ff5b..630172bf5 100644 --- a/apptentive/src/com/apptentive/android/sdk/storage/SdkManager.java +++ b/apptentive/src/com/apptentive/android/sdk/storage/SdkManager.java @@ -8,7 +8,7 @@ import android.content.Context; import android.content.SharedPreferences; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.Sdk; import com.apptentive.android.sdk.util.Constants; import com.apptentive.android.sdk.util.JsonDiffer; @@ -30,7 +30,7 @@ public static Sdk storeSdkAndReturnDiff(Context context) { storeSdk(context, current); return new Sdk(diff.toString()); } catch (JSONException e) { - Log.e("Error casting to Sdk.", e); + ApptentiveLog.e("Error casting to Sdk.", e); } } return null; diff --git a/apptentive/src/com/apptentive/android/sdk/storage/VersionHistoryStore.java b/apptentive/src/com/apptentive/android/sdk/storage/VersionHistoryStore.java index 77442c660..1531ba9f4 100644 --- a/apptentive/src/com/apptentive/android/sdk/storage/VersionHistoryStore.java +++ b/apptentive/src/com/apptentive/android/sdk/storage/VersionHistoryStore.java @@ -10,7 +10,7 @@ import android.content.SharedPreferences; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Constants; import com.apptentive.android.sdk.util.Util; @@ -37,7 +37,7 @@ public static void updateVersionHistory(Context context, Integer newVersionCode, } public static void updateVersionHistory(Context context, Integer newVersionCode, String newVersionName, double date) { - Log.d("Updating version info: %d, %s @%f", newVersionCode, newVersionName, date); + ApptentiveLog.d("Updating version info: %d, %s @%f", newVersionCode, newVersionName, date); List versionHistory = getVersionHistory(context); boolean alreadySawVersionCode = false; boolean alreadySawVersionName = false; diff --git a/apptentive/src/com/apptentive/android/sdk/util/ActivityUtil.java b/apptentive/src/com/apptentive/android/sdk/util/ActivityUtil.java index 0fddfd8ef..1042a7a65 100644 --- a/apptentive/src/com/apptentive/android/sdk/util/ActivityUtil.java +++ b/apptentive/src/com/apptentive/android/sdk/util/ActivityUtil.java @@ -14,7 +14,7 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import com.apptentive.android.sdk.GlobalInfo; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import java.util.List; @@ -47,7 +47,7 @@ public static boolean isApplicationBroughtToBackground(final Activity activity) if (GlobalInfo.isAppDebuggable) { throw e; } else { - Log.e("Missing required permission: \"android.permission.GET_TASKS\".", e); + ApptentiveLog.e("Missing required permission: \"android.permission.GET_TASKS\".", e); } return false; } @@ -61,7 +61,7 @@ public static boolean isApplicationBroughtToBackground(final Activity activity) } } } catch (PackageManager.NameNotFoundException e) { - Log.e("Package name not found: %s", e, activity.getPackageName()); + ApptentiveLog.e("Package name not found: %s", e, activity.getPackageName()); return false; // Never happens. } } @@ -104,7 +104,7 @@ public static Class getActivityClassFromName(String classNam cls = null; } if(cls == null) { - Log.e("Class %s does not exist.", className); + ApptentiveLog.e("Class %s does not exist.", className); } return cls; } diff --git a/apptentive/src/com/apptentive/android/sdk/util/JsonDiffer.java b/apptentive/src/com/apptentive/android/sdk/util/JsonDiffer.java index 5d45b65e3..ac8162788 100644 --- a/apptentive/src/com/apptentive/android/sdk/util/JsonDiffer.java +++ b/apptentive/src/com/apptentive/android/sdk/util/JsonDiffer.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.util; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -59,7 +59,7 @@ public static JSONObject getDiff(JSONObject original, JSONObject updated) { // Do nothing. } } catch (JSONException e) { - Log.w("Error diffing object with key %s", e, key); + ApptentiveLog.w("Error diffing object with key %s", e, key); } finally { it.remove(); } @@ -80,7 +80,7 @@ public static JSONObject getDiff(JSONObject original, JSONObject updated) { if (ret.length() == 0) { ret = null; } - Log.v("Generated diff: %s", ret); + ApptentiveLog.v("Generated diff: %s", ret); return ret; } @@ -105,7 +105,7 @@ public static boolean areObjectsEqual(Object left, Object right) { return false; } } catch (JSONException e) { - Log.w("Error comparing JSONObjects", e); + ApptentiveLog.w("Error comparing JSONObjects", e); return false; } } @@ -123,7 +123,7 @@ public static boolean areObjectsEqual(Object left, Object right) { } } } catch (JSONException e) { - Log.e("", e); + ApptentiveLog.e("", e); return false; } return true; diff --git a/apptentive/src/com/apptentive/android/sdk/util/Reflection.java b/apptentive/src/com/apptentive/android/sdk/util/Reflection.java index 7dc4e208e..7e0b766fc 100644 --- a/apptentive/src/com/apptentive/android/sdk/util/Reflection.java +++ b/apptentive/src/com/apptentive/android/sdk/util/Reflection.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.util; import android.os.Build; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import java.lang.reflect.Method; @@ -59,11 +59,11 @@ public static String getRadioVersion(){ Method method = Build.class.getMethod("getRadioVersion"); Object invoked = method.invoke(null); String ret = invoked.toString(); - Log.v("Build.getRadioVersion() = %s", ret); + ApptentiveLog.v("Build.getRadioVersion() = %s", ret); return ret; } catch(Exception e) { try{ - Log.v("Build.RADIO = %s", (String)Build.class.getField("RADIO").get(null)); + ApptentiveLog.v("Build.RADIO = %s", (String)Build.class.getField("RADIO").get(null)); return (String)Build.class.getField("RADIO").get(null); } catch(Exception f) { return null; diff --git a/apptentive/src/com/apptentive/android/sdk/util/Util.java b/apptentive/src/com/apptentive/android/sdk/util/Util.java index 03d95fd8f..7f79e4e69 100644 --- a/apptentive/src/com/apptentive/android/sdk/util/Util.java +++ b/apptentive/src/com/apptentive/android/sdk/util/Util.java @@ -35,7 +35,7 @@ import android.widget.ListAdapter; import android.widget.ListView; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.StoredFile; import java.io.*; @@ -83,7 +83,7 @@ public static Date parseIso8601Date(final String iso8601DateString) { s = start + millis + end; } } catch (Exception e) { - Log.e("Error parsing date: " + iso8601DateString, e); + ApptentiveLog.e("Error parsing date: " + iso8601DateString, e); return new Date(); } // Parse, accounting for millis, if provided. @@ -94,7 +94,7 @@ public static Date parseIso8601Date(final String iso8601DateString) { return new SimpleDateFormat(PSEUDO_ISO8601_DATE_FORMAT).parse(s); } } catch (ParseException e) { - Log.e("Exception parsing date: " + s, e); + ApptentiveLog.e("Exception parsing date: " + s, e); } // Return null as default. Nothing we can do but log it. @@ -194,7 +194,7 @@ public static void printDebugInfo(Context context) { // Galaxy Nexus: Port: PX=720x1184 DP=360x592, Land: PX=1196x720 DP=598x360 // Nexus 7: Port: PX=800x1205 DP=601x905, Land: PX=1280x736 DP=962x553 Point point = Util.getScreenSize(context); - Log.e("Screen size: PX=%dx%d DP=%dx%d", point.x, point.y, Util.pixelsToDips(context, point.x), Util.pixelsToDips(context, point.y)); + ApptentiveLog.e("Screen size: PX=%dx%d DP=%dx%d", point.x, point.y, Util.pixelsToDips(context, point.x), Util.pixelsToDips(context, point.y)); } public static boolean isEmpty(CharSequence charSequence) { @@ -218,7 +218,7 @@ public static Integer parseCacheControlHeader(String cacheControlHeader) { Integer ret = Integer.parseInt(expiration); return ret; } catch (NumberFormatException e) { - Log.e("Error parsing cache expiration as number: %s", e, expiration); + ApptentiveLog.e("Error parsing cache expiration as number: %s", e, expiration); } } } @@ -281,7 +281,7 @@ public static String getAppVersionName(Context context) { PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); return packageInfo.versionName; } catch (PackageManager.NameNotFoundException e) { - Log.e("Error getting app version name.", e); + ApptentiveLog.e("Error getting app version name.", e); } return null; } @@ -292,7 +292,7 @@ public static int getAppVersionCode(Context context) { PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); return packageInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { - Log.e("Error getting app version code.", e); + ApptentiveLog.e("Error getting app version code.", e); } return -1; } @@ -352,7 +352,7 @@ public static Integer getMajorOsVersion() { return Integer.parseInt(parts[0]); } } catch (Exception e) { - Log.w("Error getting major OS version", e); + ApptentiveLog.w("Error getting major OS version", e); } return -1; } @@ -702,7 +702,7 @@ && hasPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { context.startActivity(intent); return true; } catch (ActivityNotFoundException e) { - Log.e("Activity not found to open attachment: ", e); + ApptentiveLog.e("Activity not found to open attachment: ", e); } } } else { @@ -817,9 +817,9 @@ public static StoredFile createLocalStoredFile(InputStream is, String sourceUrl, while ((count = is.read(buf, 0, 2048)) != -1) { cos.write(buf, 0, count); } - Log.d("File saved, size = " + (cos.getBytesWritten() / 1024) + "k"); + ApptentiveLog.d("File saved, size = " + (cos.getBytesWritten() / 1024) + "k"); } catch (IOException e) { - Log.e("Error creating local copy of file attachment."); + ApptentiveLog.e("Error creating local copy of file attachment."); return null; } finally { Util.ensureClosed(cos); diff --git a/apptentive/src/com/apptentive/android/sdk/util/image/ApptentiveAttachmentLoader.java b/apptentive/src/com/apptentive/android/sdk/util/image/ApptentiveAttachmentLoader.java index a08dae9ad..ff0393109 100644 --- a/apptentive/src/com/apptentive/android/sdk/util/image/ApptentiveAttachmentLoader.java +++ b/apptentive/src/com/apptentive/android/sdk/util/image/ApptentiveAttachmentLoader.java @@ -21,7 +21,7 @@ import android.widget.ImageView; import com.apptentive.android.sdk.GlobalInfo; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import com.apptentive.android.sdk.util.cache.ImageMemoryCache; import com.apptentive.android.sdk.util.task.ApptentiveDownloaderTask; @@ -163,15 +163,15 @@ public LoaderCallback getLoaderCallback() { public void load() { ImageView imageView = mImageViewRef.get(); if (imageView != null) { - Log.d("ApptentiveAttachmentLoader load requested:" + uri); - Log.d("ApptentiveAttachmentLoader load requested on:" + imageView.toString() ); + ApptentiveLog.d("ApptentiveAttachmentLoader load requested:" + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader load requested on:" + imageView.toString() ); // Handle the duplicate requests on the same grid item view LoaderRequest oldLoaderRequest = (LoaderRequest) imageView.getTag(DRAWABLE_DOWNLOAD_TAG); if (oldLoaderRequest != null) { // If old request on the same view also loads from the same source, cancel the current one if (oldLoaderRequest.getUrl().equals(uri)) { - Log.d("ApptentiveAttachmentLoader load new request denied:" + uri ); + ApptentiveLog.d("ApptentiveAttachmentLoader load new request denied:" + uri ); return; } // If old request on the same view loads from different source, cancel the old one @@ -179,7 +179,7 @@ public void load() { } if (TextUtils.isEmpty(uri)) { - Log.d("ApptentiveAttachmentLoader loadDrawable(clear)"); + ApptentiveLog.d("ApptentiveAttachmentLoader loadDrawable(clear)"); loadDrawable(null); imageView.setTag(DRAWABLE_DOWNLOAD_TAG, null); return; @@ -190,7 +190,7 @@ public void load() { if (cachedBitmap != null) { mWasDownloaded = false; - Log.d("ApptentiveAttachmentLoader loadDrawable(found in cache)"); + ApptentiveLog.d("ApptentiveAttachmentLoader loadDrawable(found in cache)"); loadDrawable(cachedBitmap); imageView.setTag(DRAWABLE_DOWNLOAD_TAG, null); } else { @@ -218,7 +218,7 @@ public void doDownload() { if (imageView != null && imageView.getTag(DRAWABLE_DOWNLOAD_TAG) == this && URLUtil.isNetworkUrl(uri)) { mDrawableDownloaderTask = new ApptentiveDownloaderTask(imageView, this); try { - Log.d("ApptentiveAttachmentLoader doDownload: " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader doDownload: " + uri); // Conversation token is needed if the download url is an redrect link from an Apptentive endpoint String conversationToken = GlobalInfo.getConversationToken(imageView.getContext().getApplicationContext()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { @@ -254,7 +254,7 @@ private boolean isBeingDownloaded() { @SuppressLint("NewApi") private void loadImageFromDisk(ImageView imageView) { if (imageView != null && !mIsCancelled) { - Log.d("ApptentiveAttachmentLoader loadImageFromDisk: " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader loadImageFromDisk: " + uri); mDrawableLoaderTask = new ApptentiveDrawableLoaderTask(imageView.getContext(), imageView, this); try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { @@ -275,7 +275,7 @@ private void loadAttachmentFromDisk(ImageView imageView) { } private void cancel() { - Log.d("ApptentiveAttachmentLoader cancel requested for: " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader cancel requested for: " + uri); mIsCancelled = true; ArrayList duplicates = duplicateDownloads.get(uri); @@ -376,7 +376,7 @@ private void loadDrawable(Bitmap d) { } private void loadDrawable(Bitmap d, boolean animate) { - Log.d("ApptentiveAttachmentLoader loadDrawable"); + ApptentiveLog.d("ApptentiveAttachmentLoader loadDrawable"); ImageView imageView = getImageView(); if (imageView != null) { if (loadingTaskCallback != null) { @@ -388,7 +388,7 @@ private void loadDrawable(Bitmap d, boolean animate) { // called when the download starts @Override public void onDownloadStart() { - Log.d("ApptentiveAttachmentLoader onDownloadStarted"); + ApptentiveLog.d("ApptentiveAttachmentLoader onDownloadStarted"); ImageView imageView = getImageView(); if (imageView != null) { if (loadingTaskCallback != null) { @@ -400,7 +400,7 @@ public void onDownloadStart() { // called when the download is in progress @Override public void onProgress(int progress) { - Log.d("ApptentiveAttachmentLoader onProgress: " + progress); + ApptentiveLog.d("ApptentiveAttachmentLoader onProgress: " + progress); ImageView imageView = getImageView(); if (imageView != null) { if (loadingTaskCallback != null) { @@ -411,7 +411,7 @@ public void onProgress(int progress) { ArrayList duplicates = duplicateDownloads.get(uri); if (duplicates != null) { for (LoaderRequest dup : duplicates) { - Log.d("ApptentiveAttachmentLoader onProgress (dup): " + progress); + ApptentiveLog.d("ApptentiveAttachmentLoader onProgress (dup): " + progress); // update the progress on the duplicate downloads if (dup != null && dup.getImageView() != null && dup.getImageView().getTag(DRAWABLE_DOWNLOAD_TAG) == dup) { @@ -424,7 +424,7 @@ public void onProgress(int progress) { // called when the download has completed @Override public void onDownloadComplete() { - Log.d("ApptentiveAttachmentLoader onDownloadComplete: " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader onDownloadComplete: " + uri); runningDownLoaderRequests.remove(this); filesBeingDownloaded.remove(diskCacheFilePath); @@ -445,7 +445,7 @@ public void onDownloadComplete() { ArrayList duplicates = duplicateDownloads.get(uri); if (duplicates != null) { for (LoaderRequest dup : duplicates) { - Log.d("ApptentiveAttachmentLoader onDownloadComplete (dup): " + dup.uri); + ApptentiveLog.d("ApptentiveAttachmentLoader onDownloadComplete (dup): " + dup.uri); // load the image. if (dup != null && dup.getImageView() != null && dup.getImageView().getTag(DRAWABLE_DOWNLOAD_TAG) == dup) { @@ -471,7 +471,7 @@ public void onDownloadComplete() { // called if there is an error with the download @Override public void onDownloadError() { - Log.d("ApptentiveAttachmentLoader onDownloadError: " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader onDownloadError: " + uri); runningDownLoaderRequests.remove(this); filesBeingDownloaded.remove(diskCacheFilePath); ImageView imageView = getImageView(); @@ -495,7 +495,7 @@ public void onDownloadError() { duplicateDownloads.remove(uri); } for (LoaderRequest dup : duplicates) { - Log.d("ApptentiveAttachmentLoader onDownloadError (dup): " + dup.uri); + ApptentiveLog.d("ApptentiveAttachmentLoader onDownloadError (dup): " + dup.uri); // load the image. if (dup != null && dup.getImageView() != null && dup.getImageView().getTag(DRAWABLE_DOWNLOAD_TAG) == dup) { @@ -521,7 +521,7 @@ public void onDownloadError() { @Override public void onDownloadCancel() { mIsCancelled = true; - Log.d("ApptentiveAttachmentLoader onDownloadCancel: " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader onDownloadCancel: " + uri); runningDownLoaderRequests.remove(this); filesBeingDownloaded.remove(diskCacheFilePath); @@ -556,7 +556,7 @@ public void onDownloadCancel() { if (!queuedDownLoaderRequests.isEmpty()) { LoaderRequest d = queuedDownLoaderRequests.remove(0); - Log.d("ApptentiveAttachmentLoader starting DL of: " + d.getUrl()); + ApptentiveLog.d("ApptentiveAttachmentLoader starting DL of: " + d.getUrl()); d.doDownload(); } } @@ -564,7 +564,7 @@ public void onDownloadCancel() { // called if the file is not found on the file system @Override public void notFound() { - Log.d("ApptentiveAttachmentLoader notFound: " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader notFound: " + uri); if (mIsCancelled) { return; } @@ -592,7 +592,7 @@ public void notFound() { int downloadIndex = indexOfDownloadWithDifferentURL(); while (queuedIndex != -1) { queuedDownLoaderRequests.remove(queuedIndex); - Log.d("ApptentiveAttachmentLoader notFound(Removing): " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader notFound(Removing): " + uri); queuedIndex = indexOfQueuedDownloadWithDifferentURL(); } if (downloadIndex != -1) { @@ -600,16 +600,16 @@ public void notFound() { ApptentiveDownloaderTask downloadTask = runningLoaderRequest.getDrawableDownloaderTask(); if (downloadTask != null) { downloadTask.cancel(true); - Log.d("ApptentiveAttachmentLoader notFound(Cancelling): " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader notFound(Cancelling): " + uri); } } if (!(isBeingDownloaded() || isQueuedForDownload())) { if (runningDownLoaderRequests.size() >= maxDownloads) { - Log.d("ApptentiveAttachmentLoader notFound(Queuing): " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader notFound(Queuing): " + uri); queuedDownLoaderRequests.add(this); } else { - Log.d("ApptentiveAttachmentLoader notFound(Downloading): " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader notFound(Downloading): " + uri); doDownload(); } } @@ -621,7 +621,7 @@ public void loadBitmap(Bitmap b) { bitmapMemoryCache.addObjectToCache(ImageMemoryCache.generateMemoryCacheEntryKey(uri, imageViewWidth, imageViewHeight), b); ImageView imageView = getImageView(); if (imageView != null && this == imageView.getTag(DRAWABLE_DOWNLOAD_TAG)) { - Log.d("ApptentiveAttachmentLoader loadDrawable(add to cache)"); + ApptentiveLog.d("ApptentiveAttachmentLoader loadDrawable(add to cache)"); loadDrawable(b); imageView.setTag(DRAWABLE_DOWNLOAD_TAG, null); } @@ -630,7 +630,7 @@ public void loadBitmap(Bitmap b) { @Override public void onLoadError() { - Log.d("ApptentiveAttachmentLoader onLoadError: " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader onLoadError: " + uri); ImageView imageView = getImageView(); if (imageView != null && this == imageView.getTag(DRAWABLE_DOWNLOAD_TAG)) { @@ -645,7 +645,7 @@ public void onLoadError() { @Override public void onLoadCancelled() { - Log.d("ApptentiveAttachmentLoader onLoadCancelled: " + uri); + ApptentiveLog.d("ApptentiveAttachmentLoader onLoadCancelled: " + uri); ImageView imageView = getImageView(); if (imageView != null && this == imageView.getTag(DRAWABLE_DOWNLOAD_TAG)) { imageView.setTag(DRAWABLE_DOWNLOAD_TAG, null); diff --git a/apptentive/src/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java b/apptentive/src/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java index 7e7697f82..90f4b6e88 100644 --- a/apptentive/src/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java +++ b/apptentive/src/com/apptentive/android/sdk/util/image/ImageGridViewAdapter.java @@ -20,7 +20,7 @@ import android.widget.ProgressBar; import android.widget.TextView; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.R; import java.io.File; @@ -460,7 +460,7 @@ public void onLoaded(ImageView view, int pos, Bitmap d) { } image.setImageResource(R.drawable.apptentive_generic_file_thumbnail); if (downloadItems.contains(data.originalPath)) { - Log.d("ApptentiveAttachmentLoader onLoaded callback"); + ApptentiveLog.d("ApptentiveAttachmentLoader onLoaded callback"); downloadItems.remove(data.originalPath); Util.openFileAttachment(view.getContext(), data.originalPath, data.localCachePath, data.mimeType); } @@ -494,7 +494,7 @@ public void onDownloadProgress(int progress) { } else if (progress >= 0) { progressBarDownload.setVisibility(View.VISIBLE); progressBarDownload.setProgress(progress); - Log.d("ApptentiveAttachmentLoader progress callback: " + progress); + ApptentiveLog.d("ApptentiveAttachmentLoader progress callback: " + progress); } } } diff --git a/apptentive/src/com/apptentive/android/sdk/util/image/ImageUtil.java b/apptentive/src/com/apptentive/android/sdk/util/image/ImageUtil.java index 46e1ebe42..92a719e2d 100644 --- a/apptentive/src/com/apptentive/android/sdk/util/image/ImageUtil.java +++ b/apptentive/src/com/apptentive/android/sdk/util/image/ImageUtil.java @@ -17,7 +17,7 @@ import android.text.TextUtils; import android.webkit.URLUtil; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.messagecenter.view.ApptentiveAvatarView; import com.apptentive.android.sdk.util.CountingOutputStream; import com.apptentive.android.sdk.util.Util; @@ -121,14 +121,14 @@ private static Bitmap createLightweightScaledBitmap(Context context, String file height = decodeBoundsOptions.outHeight; } - Log.v("Original bitmap dimensions: %d x %d", width, height); + ApptentiveLog.v("Original bitmap dimensions: %d x %d", width, height); int sampleRatio = Math.min(width / minShrunkWidth, height / minShrunkHeight); if (sampleRatio >= 2) { options.inSampleSize = sampleRatio; } options.inScaled = false; options.inJustDecodeBounds = false; - Log.v("Bitmap sample size = %d", options.inSampleSize); + ApptentiveLog.v("Bitmap sample size = %d", options.inSampleSize); Bitmap retImg = null; if (bCreateFromUri && context != null) { @@ -146,7 +146,7 @@ private static Bitmap createLightweightScaledBitmap(Context context, String file } - Log.d("Sampled bitmap size = %d X %d", options.outWidth, options.outHeight); + ApptentiveLog.d("Sampled bitmap size = %d X %d", options.outWidth, options.outHeight); if ((orientation != 0 && orientation != -1) && retImg != null) { Matrix matrix = new Matrix(); @@ -228,13 +228,13 @@ public synchronized static Bitmap createScaledBitmapFromLocalImageSource(Context if (ratio < 1.0f) { // Don't blow up small images, only shrink bigger ones. int newWidth = (int) (ratio * width); int newHeight = (int) (ratio * height); - Log.v("Scaling image further down to %d x %d", newWidth, newHeight); + ApptentiveLog.v("Scaling image further down to %d x %d", newWidth, newHeight); try { outBitmap = Bitmap.createScaledBitmap(tempBitmap, newWidth, newHeight, true); } catch (IllegalArgumentException e) { throw new NullPointerException("Failed to create scaled bitmap"); } - Log.d("Final bitmap dimensions: %d x %d", outBitmap.getWidth(), outBitmap.getHeight()); + ApptentiveLog.d("Final bitmap dimensions: %d x %d", outBitmap.getWidth(), outBitmap.getHeight()); tempBitmap.recycle(); } return outBitmap; @@ -285,14 +285,14 @@ public static boolean createScaledDownImageCacheFile(Context context, String sou // TODO: Is JPEG what we want here? smaller.compress(Bitmap.CompressFormat.JPEG, 95, cos); cos.flush(); - Log.d("Bitmap saved, size = " + (cos.getBytesWritten() / 1024) + "k"); + ApptentiveLog.d("Bitmap saved, size = " + (cos.getBytesWritten() / 1024) + "k"); smaller.recycle(); System.gc(); } catch (FileNotFoundException e) { - Log.e("File not found while storing image.", e); + ApptentiveLog.e("File not found while storing image.", e); return false; } catch (Exception e) { - Log.a("Error storing image.", e); + ApptentiveLog.a("Error storing image.", e); return false; } finally { Util.ensureClosed(cos); diff --git a/apptentive/src/com/apptentive/android/sdk/util/task/ApptentiveDownloaderTask.java b/apptentive/src/com/apptentive/android/sdk/util/task/ApptentiveDownloaderTask.java index 16d5d7559..99aa81d7e 100644 --- a/apptentive/src/com/apptentive/android/sdk/util/task/ApptentiveDownloaderTask.java +++ b/apptentive/src/com/apptentive/android/sdk/util/task/ApptentiveDownloaderTask.java @@ -23,7 +23,7 @@ import android.os.AsyncTask; import android.widget.ImageView; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.comm.ApptentiveClient; import com.apptentive.android.sdk.comm.ApptentiveHttpResponse; import com.apptentive.android.sdk.util.Util; @@ -68,7 +68,7 @@ protected ApptentiveHttpResponse doInBackground(Object... params) { try { finished = downloadBitmap((String) params[0], (String) params[1], (String) params[2]); } catch (Exception e) { - Log.d("Error downloading bitmap", e); + ApptentiveLog.d("Error downloading bitmap", e); } return finished; } @@ -82,7 +82,7 @@ protected void onCancelled() { @Override protected void onCancelled(ApptentiveHttpResponse response) { - Log.d("ApptentiveDownloaderTask onCancelled, response code: " + ((response != null) ? response.getCode() : "")); + ApptentiveLog.d("ApptentiveDownloaderTask onCancelled, response code: " + ((response != null) ? response.getCode() : "")); download = false; listener.onDownloadCancel(); } @@ -93,7 +93,7 @@ protected void onPostExecute(ApptentiveHttpResponse response) { if (isCancelled()) { response.setCode(-1); } - Log.d("ApptentiveDownloaderTask onPostExecute, response code: " + response.getCode()); + ApptentiveLog.d("ApptentiveDownloaderTask onPostExecute, response code: " + response.getCode()); if (response.isSuccessful()) { listener.onDownloadComplete(); @@ -170,7 +170,7 @@ private ApptentiveHttpResponse downloadBitmap(String urlstr, String destFilePath ret.setCode(responseCode); ret.setReason(connection.getResponseMessage()); - Log.d("Response Status Line: " + connection.getResponseMessage()); + ApptentiveLog.d("Response Status Line: " + connection.getResponseMessage()); // Get the Http response header values Map headers = new HashMap(); @@ -226,18 +226,18 @@ private ApptentiveHttpResponse downloadBitmap(String urlstr, String destFilePath } } } catch (IllegalArgumentException e) { - Log.w("Error communicating with server.", e); + ApptentiveLog.w("Error communicating with server.", e); } catch (SocketTimeoutException e) { - Log.w("Timeout communicating with server.", e); + ApptentiveLog.w("Timeout communicating with server.", e); } catch (final MalformedURLException e) { - Log.w("ClientProtocolException", e); + ApptentiveLog.w("ClientProtocolException", e); } catch (final IOException e) { - Log.w("ClientProtocolException", e); + ApptentiveLog.w("ClientProtocolException", e); // Read the error response. try { ret.setContent(ApptentiveClient.getErrorResponse(connection, ret.isZipped())); } catch (IOException ex) { - Log.w("Can't read error stream.", ex); + ApptentiveLog.w("Can't read error stream.", ex); } } diff --git a/samples/apptentive-example/src/com/apptentive/android/example/push/MyGcmListenerService.java b/samples/apptentive-example/src/com/apptentive/android/example/push/MyGcmListenerService.java index edbd25a7f..aa464651b 100644 --- a/samples/apptentive-example/src/com/apptentive/android/example/push/MyGcmListenerService.java +++ b/samples/apptentive-example/src/com/apptentive/android/example/push/MyGcmListenerService.java @@ -18,7 +18,7 @@ import com.apptentive.android.example.ExampleActivity; import com.apptentive.android.example.R; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.google.android.gms.gcm.GcmListenerService; /** @@ -29,9 +29,9 @@ public class MyGcmListenerService extends GcmListenerService { public void onMessageReceived(String from, Bundle data) { String title = data.getString("gcm.notification.title"); String body = data.getString("gcm.notification.body"); - Log.e("From: " + from); - Log.e("Title: " + title); - Log.e("Body: " + body); + ApptentiveLog.e("From: " + from); + ApptentiveLog.e("Title: " + title); + ApptentiveLog.e("Body: " + body); Intent intent = new Intent(this, ExampleActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); diff --git a/samples/apptentive-example/src/com/apptentive/android/example/push/RegistrationIntentService.java b/samples/apptentive-example/src/com/apptentive/android/example/push/RegistrationIntentService.java index 75fe079a9..328b31c04 100644 --- a/samples/apptentive-example/src/com/apptentive/android/example/push/RegistrationIntentService.java +++ b/samples/apptentive-example/src/com/apptentive/android/example/push/RegistrationIntentService.java @@ -11,7 +11,7 @@ import com.apptentive.android.example.R; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.google.android.gms.gcm.GoogleCloudMessaging; import com.google.android.gms.iid.InstanceID; @@ -35,7 +35,7 @@ protected void onHandleIntent(Intent intent) { String token = instanceID.getToken(getString(R.string.gcm_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); Apptentive.setPushNotificationIntegration(getApplicationContext(), Apptentive.PUSH_PROVIDER_APPTENTIVE, token); } catch (IOException e) { - Log.e("Unable to get instanceId token.", e); + ApptentiveLog.e("Unable to get instanceId token.", e); } } } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/ApptentiveInstrumentationTestCase.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/ApptentiveInstrumentationTestCase.java index 2b9244244..853767c7e 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/ApptentiveInstrumentationTestCase.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/ApptentiveInstrumentationTestCase.java @@ -11,7 +11,7 @@ import android.test.InstrumentationTestCase; import com.apptentive.android.sdk.ApptentiveInternal; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.CodePointStore; import com.apptentive.android.sdk.module.engagement.interaction.InteractionManager; import com.apptentive.android.sdk.tests.util.FileUtil; @@ -25,7 +25,7 @@ public class ApptentiveInstrumentationTestCase extends InstrumentationTestCase { protected Context targetContext; static { - ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); + ApptentiveInternal.setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); } protected Context getTestContext() { diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/misc/RandomTests.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/misc/RandomTests.java index 496358dfa..6e472e279 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/misc/RandomTests.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/misc/RandomTests.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.tests.misc; import android.test.AndroidTestCase; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Util; import java.util.HashMap; @@ -20,14 +20,14 @@ public class RandomTests extends AndroidTestCase { public void testGetMajorOsVersion() { - Log.e("Running test: testGetMajorOsVersion()\n\n"); + ApptentiveLog.e("Running test: testGetMajorOsVersion()\n\n"); Integer osVersion = Util.getMajorOsVersion(); - Log.e("OS version: %d", osVersion); + ApptentiveLog.e("OS version: %d", osVersion); assertNotNull(osVersion); } public void testParseWebColorAsAndroidColor() { - Log.e("testParseWebColorAsAndroidColor()"); + ApptentiveLog.e("testParseWebColorAsAndroidColor()"); Map data = new HashMap(){{ put("#AABBCCDD", 0xDDAABBCC); put("#FFFFFFFF", 0xFFFFFFFF); diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/DateTimeComparisonTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/DateTimeComparisonTest.java index c946c2bc6..c76bb1a0e 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/DateTimeComparisonTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/DateTimeComparisonTest.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.tests.model; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; import com.apptentive.android.sdk.tests.util.FileUtil; @@ -35,7 +35,7 @@ public class DateTimeComparisonTest extends ApptentiveInstrumentationTestCase { } public void testDateTimeComparison() { - Log.e("Running test: testDateTimeComparison()\n\n"); + ApptentiveLog.e("Running test: testDateTimeComparison()\n\n"); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "testDateTimeComparison.json"); try { @@ -48,7 +48,7 @@ public void testDateTimeComparison() { String operator = experiment.getString(1); int expected = operatorLookup.get(operator); - Log.e("Comparing [\"%s\" %s \"%s\"]", left, operator, right); + ApptentiveLog.e("Comparing [\"%s\" %s \"%s\"]", left, operator, right); Apptentive.DateTime leftDateTime = new Apptentive.DateTime(left); Apptentive.DateTime rightDateTime = new Apptentive.DateTime(right); @@ -57,7 +57,7 @@ public void testDateTimeComparison() { assertEquals(String.format("Comparison of [\"%s\" %s \"%s\"] failed", left, operator, right), expected, actual); } } catch (JSONException e) { - Log.e("Error loading experiment results.", e); + ApptentiveLog.e("Error loading experiment results.", e); } } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/EventTests.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/EventTests.java index de68e1cc6..ec3ccc132 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/EventTests.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/EventTests.java @@ -12,7 +12,7 @@ import com.apptentive.android.sdk.model.TimeExtendedData; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; import com.apptentive.android.sdk.tests.util.FileUtil; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.JsonDiffer; import com.apptentive.android.sdk.util.Util; import org.json.JSONException; @@ -29,7 +29,7 @@ public class EventTests extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "model" + File.separator; public void testExtendedDataEvents() { - Log.e("testExtendedDataEvents()"); + ApptentiveLog.e("testExtendedDataEvents()"); try { Event expected = new Event(FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testExtendedDataEvents.json")); // Change the expected output to use the same timezone as the test machine. @@ -53,7 +53,7 @@ public void testExtendedDataEvents() { CommerceExtendedData.Item item = new CommerceExtendedData.Item(22222222, "Item Name", "Category", 20, 5.0d, "USD"); commerce.addItem(item); } catch (JSONException e) { - Log.e("Error: ", e); + ApptentiveLog.e("Error: ", e); } assertNotNull(commerce); @@ -67,7 +67,7 @@ public void testExtendedDataEvents() { actual.setNonce("4579c403-e8c5-4e6b-8826-f3d61e6ebb98"); boolean equal = JsonDiffer.areObjectsEqual(expected, actual); - Log.e("Events are equal: %b", equal); + ApptentiveLog.e("Events are equal: %b", equal); assertTrue(equal); } catch (JSONException e) { throw new RuntimeException(e); diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/ExtendedDataTests.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/ExtendedDataTests.java index 9a02c2b89..490b77241 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/ExtendedDataTests.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/ExtendedDataTests.java @@ -10,7 +10,7 @@ import com.apptentive.android.sdk.model.LocationExtendedData; import com.apptentive.android.sdk.model.TimeExtendedData; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.tests.util.FileUtil; import org.json.JSONException; import org.json.JSONObject; @@ -26,7 +26,7 @@ public class ExtendedDataTests extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "model" + File.separator; public void testCommerceExtendedData() { - Log.e("testCommerceExtendedData()"); + ApptentiveLog.e("testCommerceExtendedData()"); try { JSONObject expected = new CommerceExtendedData(FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testCommerceExtendedData.json")); @@ -47,7 +47,7 @@ public void testCommerceExtendedData() { } public void testLocationExtendedData() { - Log.e("testLocationExtendedData()"); + ApptentiveLog.e("testLocationExtendedData()"); try { JSONObject expected = new LocationExtendedData(FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testLocationExtendedData.json")); @@ -60,7 +60,7 @@ public void testLocationExtendedData() { } public void testTimeExtendedData() { - Log.e("testTimeExtendedData()"); + ApptentiveLog.e("testTimeExtendedData()"); try { JSONObject expected = new TimeExtendedData(FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testTimeExtendedData.json")); diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/ObjectDiffingTests.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/ObjectDiffingTests.java index c762690cc..05361a1a2 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/ObjectDiffingTests.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/ObjectDiffingTests.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.tests.model; import android.test.InstrumentationTestCase; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.tests.util.FileUtil; import com.apptentive.android.sdk.util.JsonDiffer; import org.json.JSONException; @@ -26,7 +26,7 @@ public class ObjectDiffingTests extends InstrumentationTestCase { * Tests to make sure that objects that differ are calculated correctly. */ public void testDeviceDiffing1() { - Log.e("testDeviceDiffing1()"); + ApptentiveLog.e("testDeviceDiffing1()"); try { JSONObject original = new JSONObject(FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testJsonDiffing.1.old.json")); JSONObject updated = new JSONObject(FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testJsonDiffing.1.new.json")); @@ -34,7 +34,7 @@ public void testDeviceDiffing1() { JSONObject result = JsonDiffer.getDiff(original, updated); - Log.e("result: %s", result); + ApptentiveLog.e("result: %s", result); boolean equal = JsonDiffer.areObjectsEqual(result, expected); assertTrue(equal); @@ -47,14 +47,14 @@ public void testDeviceDiffing1() { * Tests to make sure that objects that are the same return a null diff. */ public void testDeviceDiffing2() { - Log.e("testDeviceDiffing2()"); + ApptentiveLog.e("testDeviceDiffing2()"); try { JSONObject original = new JSONObject(FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testJsonDiffing.2.old.json")); JSONObject updated = new JSONObject(FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testJsonDiffing.2.new.json")); JSONObject result = JsonDiffer.getDiff(original, updated); - Log.e("result: %s", result); + ApptentiveLog.e("result: %s", result); assertNull(result); } catch (JSONException e) { diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/VersionComparisonTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/VersionComparisonTest.java index a0c615fdc..9e90099c4 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/VersionComparisonTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/model/VersionComparisonTest.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.tests.model; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; import com.apptentive.android.sdk.tests.util.FileUtil; @@ -35,7 +35,7 @@ public class VersionComparisonTest extends ApptentiveInstrumentationTestCase { } public void testBasicVersionComparison() { - Log.e("Running test: testBasicVersionComparison()\n\n"); + ApptentiveLog.e("Running test: testBasicVersionComparison()\n\n"); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "testBasicVersionComparison.json"); try { @@ -73,7 +73,7 @@ public void testBasicVersionComparison() { assertEquals(String.format("Comparison of [\"%s\" %s \"%s\"] failed", left, operator, right), expected, actual); } } catch (JSONException e) { - Log.e("Error loading experiment results.", e); + ApptentiveLog.e("Error loading experiment results.", e); } } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/CriteriaParsingTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/CriteriaParsingTest.java index ca88b559e..880c3081f 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/CriteriaParsingTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/CriteriaParsingTest.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.tests.module.engagement; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.logic.Clause; import com.apptentive.android.sdk.module.engagement.logic.ClauseParser; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; @@ -23,7 +23,7 @@ public class CriteriaParsingTest extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "engagement" + File.separator + "criteria" + File.separator; public void testPredicateParsing() throws JSONException { - Log.e("Running test: testPredicateParsing()\n\n"); + ApptentiveLog.e("Running test: testPredicateParsing()\n\n"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "testPredicateParsing.json"); @@ -32,9 +32,9 @@ public void testPredicateParsing() throws JSONException { Clause criteria = ClauseParser.parse(json); assertNotNull("Criteria was null, but it shouldn't be.", criteria); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNotNull(e); } - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/DataObjectQueryTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/DataObjectQueryTest.java index 5bed9b603..2e4579e12 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/DataObjectQueryTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/DataObjectQueryTest.java @@ -9,11 +9,10 @@ import com.apptentive.android.sdk.Apptentive; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; import com.apptentive.android.sdk.tests.util.FileUtil; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.CodePointStore; import com.apptentive.android.sdk.module.engagement.interaction.InteractionManager; import com.apptentive.android.sdk.module.engagement.interaction.model.Interaction; -import com.apptentive.android.sdk.storage.AppReleaseManager; import com.apptentive.android.sdk.storage.DeviceManager; import com.apptentive.android.sdk.storage.PersonManager; import com.apptentive.android.sdk.storage.SdkManager; @@ -26,7 +25,7 @@ public class DataObjectQueryTest extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "engagement/payloads/"; public void testQueriesAgainstPerson() { - Log.e("Running test: testQueriesAgainstPerson()\n\n"); + ApptentiveLog.e("Running test: testQueriesAgainstPerson()\n\n"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testQueriesAgainstPerson.json"); @@ -71,7 +70,7 @@ public void testQueriesAgainstPerson() { } public void testQueriesAgainstDevice() { - Log.e("Running test: testQueriesAgainstDevice()\n\n"); + ApptentiveLog.e("Running test: testQueriesAgainstDevice()\n\n"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testQueriesAgainstDevice.json"); @@ -103,7 +102,7 @@ public void testQueriesAgainstDevice() { } public void testQueriesAgainstSdk() { - Log.e("Running test: testQueriesAgainstSdk()\n\n"); + ApptentiveLog.e("Running test: testQueriesAgainstSdk()\n\n"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testQueriesAgainstSdk.json"); diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/EventTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/EventTest.java index 6fbfa533e..748d5adad 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/EventTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/EventTest.java @@ -8,7 +8,7 @@ import com.apptentive.android.sdk.module.engagement.EngagementModule; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.tests.util.FileUtil; import com.apptentive.android.sdk.util.Util; @@ -24,7 +24,7 @@ public class EventTest extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "engagement" + File.separator; public void testEventLabelCreation() { - Log.e("Running test: testEventLabelCreation()\n\n"); + ApptentiveLog.e("Running test: testEventLabelCreation()\n\n"); BufferedReader reader = null; try { @@ -41,11 +41,11 @@ public void testEventLabelCreation() { String eventName = reader.readLine(); String expected = reader.readLine(); String result = EngagementModule.generateEventLabel(vendor, interaction, eventName); - Log.i(".\nexpected: %s\nresult: %s", expected, result); + ApptentiveLog.i(".\nexpected: %s\nresult: %s", expected, result); assertTrue(result.equals(expected)); } } catch (IOException e) { - Log.e("Error reading asset.", e); + ApptentiveLog.e("Error reading asset.", e); throw new RuntimeException(e); } finally { Util.ensureClosed(reader); diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/InteractionTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/InteractionTest.java index d36986b0d..3552c18a3 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/InteractionTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/InteractionTest.java @@ -11,7 +11,7 @@ import com.apptentive.android.sdk.ApptentiveInternal; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; import com.apptentive.android.sdk.tests.util.FileUtil; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.CodePointStore; import com.apptentive.android.sdk.module.engagement.interaction.model.Interaction; import com.apptentive.android.sdk.module.engagement.interaction.model.Interactions; @@ -31,7 +31,7 @@ public class InteractionTest extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "engagement" + File.separator; public void testInteractionInvocationStorage() { - Log.e("Running test: testInteractionInvocationStorage()\n\n"); + ApptentiveLog.e("Running test: testInteractionInvocationStorage()\n\n"); resetDevice(); final String testInteraction = "test.interaction"; CodePointStore.storeRecord(getTargetContext(), true, testInteraction, "1.0", 1); @@ -78,11 +78,11 @@ public void testInteractionInvocationStorage() { Double lastInvoke = CodePointStore.getLastInvoke(getTargetContext(), true, testInteraction); assertFalse(lastInvoke.equals(0d)); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testCriteriaTimeAtInstall() { - Log.e("Running test: testCriteriaTimeAtInstall()\n\n"); + ApptentiveLog.e("Running test: testCriteriaTimeAtInstall()\n\n"); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "payloads/testCriteriaTimeAtInstall.json"); @@ -151,11 +151,11 @@ public void testCriteriaTimeAtInstall() { assertNotNull(interaction); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testCriteriaApplicationVersion() { - Log.e("Running test: testCriteriaApplicationVersion()\n\n"); + ApptentiveLog.e("Running test: testCriteriaApplicationVersion()\n\n"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "payloads/testCriteriaApplicationVersion.json"); @@ -178,13 +178,13 @@ public void testCriteriaApplicationVersion() { interaction = InteractionManager.getApplicableInteraction(getTargetContext(), "app.launch"); assertNull(interaction); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testCriteriaProcessingPerformance() { - Log.e("Running test: testCriteriaProcessingPerformance()"); + ApptentiveLog.e("Running test: testCriteriaProcessingPerformance()"); if (isRunningOnEmulator()) { - Log.e("Running on emulator. Skipping test."); + ApptentiveLog.e("Running on emulator. Skipping test."); return; } resetDevice(); @@ -210,14 +210,14 @@ public void testCriteriaProcessingPerformance() { double average = (double) duration / iterations; double limit = 7d; String message = String.format("Finished %d iterations in %,dms, average of %.2fms per run, limit was %.2fms", iterations, duration, average, limit); - Log.e(message); + ApptentiveLog.e(message); assertTrue(message, average < limit); } public void testInteractionSelectionPerformance() { - Log.e("Running test: testInteractionSelectionPerformance()"); + ApptentiveLog.e("Running test: testInteractionSelectionPerformance()"); if (isRunningOnEmulator()) { - Log.e("Running on emulator. Skipping test."); + ApptentiveLog.e("Running on emulator. Skipping test."); return; } resetDevice(); @@ -243,14 +243,14 @@ public void testInteractionSelectionPerformance() { double average = (double) duration / iterations; double limit = 7d; String message = String.format("Finished %d iterations in %,dms, average of %.2fms per run, limit was %.2fms", iterations, duration, average, limit); - Log.e(message); + ApptentiveLog.e(message); assertTrue(message, average < limit); } public void testInteractionStorageAndSelectionPerformance() { - Log.e("Running test: testInteractionStorageAndSelectionPerformance()"); + ApptentiveLog.e("Running test: testInteractionStorageAndSelectionPerformance()"); if (isRunningOnEmulator()) { - Log.e("Running on emulator. Skipping test."); + ApptentiveLog.e("Running on emulator. Skipping test."); return; } resetDevice(); @@ -278,12 +278,12 @@ public void testInteractionStorageAndSelectionPerformance() { double average = (double) duration / iterations; double limit = 50d; String message = String.format("Finished %d iterations in %,dms, average of %.2fms per run, limit was %.2fms", iterations, duration, average, limit); - Log.e(message); + ApptentiveLog.e(message); assertTrue(message, average < limit); } public void testSavingCodePointAndCheckingForApplicableInteraction() { - Log.e("Running test: testSavingCodePointAndCheckingForApplicableInteraction()"); + ApptentiveLog.e("Running test: testSavingCodePointAndCheckingForApplicableInteraction()"); resetDevice(); final int iterations = 100; @@ -299,12 +299,12 @@ public void testSavingCodePointAndCheckingForApplicableInteraction() { double average = (double) duration / iterations; double limit = 20d; String message = String.format("Finished %d iterations in %,dms, average of %.2fms per run, limit was %.2fms", iterations, duration, average, limit); - Log.e(message); + ApptentiveLog.e(message); assertTrue(message, average < limit); } public void testSelectionWithInteractionIdUsedInCriteria() { - Log.e("Running test: testSelectionWithInteractionIdUsedInCriteria()"); + ApptentiveLog.e("Running test: testSelectionWithInteractionIdUsedInCriteria()"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "payloads/testSelectionWithInteractionIdUsedInCriteria.json"); @@ -323,7 +323,7 @@ public void testSelectionWithInteractionIdUsedInCriteria() { } public void testInteractionPriority() { - Log.e("Running test: testInteractionPriority()"); + ApptentiveLog.e("Running test: testInteractionPriority()"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "payloads/testInteractionPriority.json"); @@ -350,7 +350,7 @@ public void testInteractionPriority() { } public void testMissingNullEmptyCriteria() { - Log.e("Running test: testMissingNullEmptyCriteria()"); + ApptentiveLog.e("Running test: testMissingNullEmptyCriteria()"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "payloads/testMissingNullEmptyCriteria.json"); @@ -368,7 +368,7 @@ public void testMissingNullEmptyCriteria() { } public void testCorruptedJson() { - Log.e("Running test: testCorruptedJson()"); + ApptentiveLog.e("Running test: testCorruptedJson()"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "payloads/testCorruptedJson.json"); @@ -379,7 +379,7 @@ public void testCorruptedJson() { } public void testActualUpgradeMessage() { - Log.e("Running test: testActualUpgradeMessage()"); + ApptentiveLog.e("Running test: testActualUpgradeMessage()"); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "payloads/testActualUpgradeMessage.json"); Interaction interaction; @@ -387,7 +387,7 @@ public void testActualUpgradeMessage() { // Test version targeted UpgradeMessage // Saw this build too long ago. - Log.e("ONE"); + ApptentiveLog.e("ONE"); resetDevice(); InteractionManager.storeInteractionsPayloadString(getTargetContext(), json); VersionHistoryStore.updateVersionHistory(getTargetContext(), 3, "1.0", Util.currentTimeSeconds() - 1000000); @@ -395,14 +395,14 @@ public void testActualUpgradeMessage() { assertNull(InteractionManager.getApplicableInteraction(getTargetContext(), "event_label")); // Haven't upgraded - Log.e("TWO"); + ApptentiveLog.e("TWO"); resetDevice(); InteractionManager.storeInteractionsPayloadString(getTargetContext(), json); VersionHistoryStore.updateVersionHistory(getTargetContext(), Util.getAppVersionCode(getTargetContext()), Util.getAppVersionName(getTargetContext()), Util.currentTimeSeconds() - 499500); assertNull(InteractionManager.getApplicableInteraction(getTargetContext(), "event_label")); // Just right - Log.e("THREE"); + ApptentiveLog.e("THREE"); resetDevice(); InteractionManager.storeInteractionsPayloadString(getTargetContext(), json); VersionHistoryStore.updateVersionHistory(getTargetContext(), 3, "1.0", Util.currentTimeSeconds() - 1000000); @@ -410,7 +410,7 @@ public void testActualUpgradeMessage() { assertNotNull(InteractionManager.getApplicableInteraction(getTargetContext(), "event_label")); // Already shown - Log.e("FOUR"); + ApptentiveLog.e("FOUR"); interaction = InteractionManager.getApplicableInteraction(getTargetContext(), "event_label"); CodePointStore.storeInteractionForCurrentAppVersion(getTargetContext(), interaction.getId()); assertNull(InteractionManager.getApplicableInteraction(getTargetContext(), "event_label")); @@ -420,7 +420,7 @@ public void testActualUpgradeMessage() { * Update this when the Rating Flow group of interactions changes, or with different permutations of that flow. */ public void testRealRatingInteractions() { - Log.e("Running test: testRealRatingInteractions()"); + ApptentiveLog.e("Running test: testRealRatingInteractions()"); Context targetContext = getTargetContext(); @@ -431,21 +431,21 @@ public void testRealRatingInteractions() { // Conditions not yet met. resetDevice(); - Log.e("ONE"); + ApptentiveLog.e("ONE"); InteractionManager.storeInteractionsPayloadString(targetContext, json); VersionHistoryStore.updateVersionHistory(targetContext, 3, "1.0", Util.currentTimeSeconds() - 100000); assertNull(InteractionManager.getApplicableInteraction(targetContext, "by.build")); // Conditions partially met. resetDevice(); - Log.e("TWO"); + ApptentiveLog.e("TWO"); InteractionManager.storeInteractionsPayloadString(targetContext, json); VersionHistoryStore.updateVersionHistory(targetContext, 3, "1.0", Util.currentTimeSeconds() - 500000); assertNull(InteractionManager.getApplicableInteraction(targetContext, "local#app#init")); // Conditions partially met the other way. resetDevice(); - Log.e("THREE"); + ApptentiveLog.e("THREE"); InteractionManager.storeInteractionsPayloadString(targetContext, json); CodePointStore.storeCodePointForCurrentAppVersion(targetContext, "local#app#init"); CodePointStore.storeCodePointForCurrentAppVersion(targetContext, "local#app#init"); @@ -454,7 +454,7 @@ public void testRealRatingInteractions() { // Conditions almost met. resetDevice(); - Log.e("FOUR"); + ApptentiveLog.e("FOUR"); InteractionManager.storeInteractionsPayloadString(targetContext, json); VersionHistoryStore.updateVersionHistory(targetContext, 3, "1.0", Util.currentTimeSeconds() - 430000); CodePointStore.storeCodePointForCurrentAppVersion(targetContext, "local#app#init"); @@ -464,7 +464,7 @@ public void testRealRatingInteractions() { // Conditions met barely. resetDevice(); - Log.e("FIVE"); + ApptentiveLog.e("FIVE"); InteractionManager.storeInteractionsPayloadString(targetContext, json); VersionHistoryStore.updateVersionHistory(targetContext, 3, "1.0", Util.currentTimeSeconds() - 432000); CodePointStore.storeCodePointForCurrentAppVersion(targetContext, "local#app#init"); @@ -477,14 +477,14 @@ public void testRealRatingInteractions() { // Conditions are always met. resetDevice(); - Log.e("SIX"); + ApptentiveLog.e("SIX"); InteractionManager.storeInteractionsPayloadString(targetContext, json); assertNotNull(InteractionManager.getApplicableInteraction(targetContext, "com.apptentive#EnjoymentDialog#yes")); // Re-prompt isn't ready yet. { resetDevice(); - Log.e("SEVEN"); + ApptentiveLog.e("SEVEN"); InteractionManager.storeInteractionsPayloadString(targetContext, json); Interaction ratingDialogInteraction = InteractionManager.getApplicableInteraction(targetContext, "com.apptentive#EnjoymentDialog#yes"); assertNotNull(ratingDialogInteraction); @@ -496,7 +496,7 @@ public void testRealRatingInteractions() { // Re-prompt isn't ready yet. { resetDevice(); - Log.e("EIGHT"); + ApptentiveLog.e("EIGHT"); InteractionManager.storeInteractionsPayloadString(targetContext, json); Interaction ratingDialogInteraction = InteractionManager.getApplicableInteraction(targetContext, "com.apptentive#EnjoymentDialog#yes"); assertNotNull(ratingDialogInteraction); @@ -508,7 +508,7 @@ public void testRealRatingInteractions() { // Re-prompt is ready. { resetDevice(); - Log.e("NINE"); + ApptentiveLog.e("NINE"); InteractionManager.storeInteractionsPayloadString(targetContext, json); Interaction ratingDialogInteraction = InteractionManager.getApplicableInteraction(targetContext, "com.apptentive#EnjoymentDialog#yes"); assertNotNull(ratingDialogInteraction); @@ -520,7 +520,7 @@ public void testRealRatingInteractions() { // Don't re-prompt, since we've already rated. { resetDevice(); - Log.e("TEN"); + ApptentiveLog.e("TEN"); InteractionManager.storeInteractionsPayloadString(targetContext, json); Interaction ratingDialogInteraction = InteractionManager.getApplicableInteraction(targetContext, "com.apptentive#EnjoymentDialog#yes"); assertNotNull(ratingDialogInteraction); @@ -533,7 +533,7 @@ public void testRealRatingInteractions() { // Don't re-prompt, since we've declined to rate. { resetDevice(); - Log.e("ELEVEN"); + ApptentiveLog.e("ELEVEN"); InteractionManager.storeInteractionsPayloadString(targetContext, json); Interaction ratingDialogInteraction = InteractionManager.getApplicableInteraction(targetContext, "com.apptentive#EnjoymentDialog#yes"); assertNotNull(ratingDialogInteraction); @@ -547,17 +547,17 @@ public void testRealRatingInteractions() { { resetDevice(); - Log.e("TWELVE"); + ApptentiveLog.e("TWELVE"); InteractionManager.storeInteractionsPayloadString(targetContext, json); assertNotNull(InteractionManager.getApplicableInteraction(targetContext, "com.apptentive#EnjoymentDialog#no")); } } public void testCanShowInteraction() { - Log.e("Running test: testCanShowInteraction()\n\n"); + ApptentiveLog.e("Running test: testCanShowInteraction()\n\n"); resetDevice(); - ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); + ApptentiveInternal.setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "payloads/testCanShowInteraction.json"); InteractionManager.storeInteractionsPayloadString(getTargetContext(), json); diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/NavigateToLinkInteractionTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/NavigateToLinkInteractionTest.java index b27a35f8c..69292f714 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/NavigateToLinkInteractionTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/NavigateToLinkInteractionTest.java @@ -7,14 +7,12 @@ package com.apptentive.android.sdk.tests.module.engagement; import com.apptentive.android.sdk.ApptentiveInternal; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.interaction.model.Interaction; import com.apptentive.android.sdk.module.engagement.interaction.model.NavigateToLinkInteraction; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; import com.apptentive.android.sdk.tests.util.FileUtil; -import java.util.List; - /** * @author Sky Kelsey */ @@ -23,9 +21,9 @@ public class NavigateToLinkInteractionTest extends ApptentiveInstrumentationTest private static final String TEST_DATA_DIR = "engagement/interactions"; public void testNavigateToLinkInteractionNew() { - Log.e("Running test: testNavigateToLinkInteractionNew()\n\n"); + ApptentiveLog.e("Running test: testNavigateToLinkInteractionNew()\n\n"); - ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); + ApptentiveInternal.setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "/testNavigateToLinkInteractionNew.json"); Interaction interaction = Interaction.Factory.parseInteraction(json); @@ -39,9 +37,9 @@ public void testNavigateToLinkInteractionNew() { } public void testNavigateToLinkInteractionSelf() { - Log.e("Running test: testNavigateToLinkInteractionSelf()\n\n"); + ApptentiveLog.e("Running test: testNavigateToLinkInteractionSelf()\n\n"); - ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); + ApptentiveInternal.setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "/testNavigateToLinkInteractionSelf.json"); Interaction interaction = Interaction.Factory.parseInteraction(json); @@ -55,9 +53,9 @@ public void testNavigateToLinkInteractionSelf() { } public void testNavigateToLinkInteractionMissing() { - Log.e("Running test: testNavigateToLinkInteractionNew()\n\n"); + ApptentiveLog.e("Running test: testNavigateToLinkInteractionNew()\n\n"); - ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); + ApptentiveInternal.setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "/testNavigateToLinkInteractionMissing.json"); Interaction interaction = Interaction.Factory.parseInteraction(json); diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/SurveyInteractionTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/SurveyInteractionTest.java index 528133fec..0cf880c6f 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/SurveyInteractionTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/SurveyInteractionTest.java @@ -8,7 +8,7 @@ import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; import com.apptentive.android.sdk.tests.util.FileUtil; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.interaction.model.Interaction; import com.apptentive.android.sdk.module.engagement.interaction.model.SurveyInteraction; @@ -22,13 +22,13 @@ public class SurveyInteractionTest extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "engagement" + File.separator; public void testSurveyParsing() { - Log.e("Running test: testSurveyParsing()\n\n"); + ApptentiveLog.e("Running test: testSurveyParsing()\n\n"); String json = FileUtil.loadTextAssetAsString(getInstrumentation().getContext(), TEST_DATA_DIR + "testSurveyParsing.json"); Interaction survey = null; try { survey = new SurveyInteraction(json); } catch (Exception e) { - Log.e("Error loading survey.", e); + ApptentiveLog.e("Error loading survey.", e); } assertNotNull(survey); } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/TextModalInteractionTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/TextModalInteractionTest.java index 80e4672b7..44008ecec 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/TextModalInteractionTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/TextModalInteractionTest.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.tests.module.engagement; import com.apptentive.android.sdk.ApptentiveInternal; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.interaction.model.Interaction; import com.apptentive.android.sdk.module.engagement.interaction.model.TextModalInteraction; import com.apptentive.android.sdk.module.engagement.interaction.model.common.Action; @@ -24,9 +24,9 @@ public class TextModalInteractionTest extends ApptentiveInstrumentationTestCase private static final String TEST_DATA_DIR = "engagement/interactions"; public void testTextModalInteraction() { - Log.e("Running test: testTextModalInteraction()\n\n"); + ApptentiveLog.e("Running test: testTextModalInteraction()\n\n"); - ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); + ApptentiveInternal.setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "/testTextModalInteraction.json"); Interaction interaction = Interaction.Factory.parseInteraction(json); diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/CodePointAndInteractionStoreTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/CodePointAndInteractionStoreTest.java index 0323b457f..13ef0808f 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/CodePointAndInteractionStoreTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/CodePointAndInteractionStoreTest.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.tests.module.engagement.criteria; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.model.CodePointStore; import com.apptentive.android.sdk.module.engagement.interaction.InteractionManager; import com.apptentive.android.sdk.module.engagement.interaction.model.InteractionCriteria; @@ -26,7 +26,7 @@ public class CodePointAndInteractionStoreTest extends ApptentiveInstrumentationT * Tests for a specific code point running. Tests all condition types. */ public void testCodePointInvokesTotal() { - Log.e("Running test: testCodePointInvokesTotal()\n\n"); + ApptentiveLog.e("Running test: testCodePointInvokesTotal()\n\n"); resetDevice(); String json = loadFileAssetAsString(TEST_DIR + "testCodePointInvokesTotal.json"); @@ -35,7 +35,7 @@ public void testCodePointInvokesTotal() { InteractionCriteria criteria = new InteractionCriteria(json); // 0 - $gt - Log.e("Test $gt"); + ApptentiveLog.e("Test $gt"); assertFalse(criteria.isMet(getTargetContext())); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "test.code.point"); assertFalse(criteria.isMet(getTargetContext())); @@ -46,7 +46,7 @@ public void testCodePointInvokesTotal() { // 1 - $gte resetDevice(); - Log.e("Test $gte"); + ApptentiveLog.e("Test $gte"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); assertFalse(criteria.isMet(getTargetContext())); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "test.code.point"); @@ -58,7 +58,7 @@ public void testCodePointInvokesTotal() { // 2 - $ne resetDevice(); - Log.e("Test $ne"); + ApptentiveLog.e("Test $ne"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); assertTrue(criteria.isMet(getTargetContext())); @@ -71,7 +71,7 @@ public void testCodePointInvokesTotal() { // 3 - $eq resetDevice(); - Log.e("Test $eq"); + ApptentiveLog.e("Test $eq"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -85,7 +85,7 @@ public void testCodePointInvokesTotal() { // 4 - : resetDevice(); - Log.e("Test :"); + ApptentiveLog.e("Test :"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -100,7 +100,7 @@ public void testCodePointInvokesTotal() { // 5 - $lte resetDevice(); - Log.e("Test $lte"); + ApptentiveLog.e("Test $lte"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -116,7 +116,7 @@ public void testCodePointInvokesTotal() { // 6 - $lt resetDevice(); - Log.e("Test $lt"); + ApptentiveLog.e("Test $lt"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -131,17 +131,17 @@ public void testCodePointInvokesTotal() { CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "test.code.point"); assertFalse(criteria.isMet(getTargetContext())); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNull(e); } - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } /** * Tests for a specific code point running. Tests all condition types. */ public void testCodePointInvokesVersion() { - Log.e("Running test: testCodePointInvokesVersion()\n\n"); + ApptentiveLog.e("Running test: testCodePointInvokesVersion()\n\n"); String json = loadFileAssetAsString(TEST_DIR + "testCodePointInvokesVersion.json"); @@ -150,7 +150,7 @@ public void testCodePointInvokesVersion() { // 0 - $gt resetDevice(); - Log.e("Test $gt"); + ApptentiveLog.e("Test $gt"); CodePointStore.storeRecord(getTargetContext(), false, "test.code.point", "1.1", 3); CodePointStore.storeRecord(getTargetContext(), false, "test.code.point", "1.1", 3); CodePointStore.storeRecord(getTargetContext(), false, "test.code.point", "1.1", 3); @@ -165,7 +165,7 @@ public void testCodePointInvokesVersion() { // 1 - $gte resetDevice(); - Log.e("Test $gte"); + ApptentiveLog.e("Test $gte"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); assertFalse(criteria.isMet(getTargetContext())); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "test.code.point"); @@ -177,7 +177,7 @@ public void testCodePointInvokesVersion() { // 2 - $ne resetDevice(); - Log.e("Test $ne"); + ApptentiveLog.e("Test $ne"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); assertTrue(criteria.isMet(getTargetContext())); @@ -190,7 +190,7 @@ public void testCodePointInvokesVersion() { // 3 - $eq resetDevice(); - Log.e("Test $eq"); + ApptentiveLog.e("Test $eq"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -205,7 +205,7 @@ public void testCodePointInvokesVersion() { // 4 - : resetDevice(); InteractionManager.storeInteractionsPayloadString(getTargetContext(), json); - Log.e("Test :"); + ApptentiveLog.e("Test :"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -221,7 +221,7 @@ public void testCodePointInvokesVersion() { // 5 - $lte resetDevice(); InteractionManager.storeInteractionsPayloadString(getTargetContext(), json); - Log.e("Test $lte"); + ApptentiveLog.e("Test $lte"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -238,7 +238,7 @@ public void testCodePointInvokesVersion() { // 6 - $lt resetDevice(); InteractionManager.storeInteractionsPayloadString(getTargetContext(), json); - Log.e("Test $lt"); + ApptentiveLog.e("Test $lt"); CodePointStore.storeRecord(getTargetContext(), false, "test.code.point", "1.1", 3); CodePointStore.storeRecord(getTargetContext(), false, "test.code.point", "1.1", 3); CodePointStore.storeRecord(getTargetContext(), false, "test.code.point", "1.1", 3); @@ -258,17 +258,17 @@ public void testCodePointInvokesVersion() { assertFalse(criteria.isMet(getTargetContext())); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNull(e); } - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } /** * Tests for a specific code point running. Tests all condition types. */ public void testCodePointLastInvokedAt() { - Log.e("Running test: testCodePointLastInvokedAt()\n\n"); + ApptentiveLog.e("Running test: testCodePointLastInvokedAt()\n\n"); String json = loadFileAssetAsString(TEST_DIR + "testCodePointLastInvokedAt.json"); @@ -277,7 +277,7 @@ public void testCodePointLastInvokedAt() { // 0 - $after resetDevice(); - Log.e("Test $after"); + ApptentiveLog.e("Test $after"); assertFalse(criteria.isMet(getTargetContext())); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "test.code.point"); assertTrue(criteria.isMet(getTargetContext())); @@ -289,7 +289,7 @@ public void testCodePointLastInvokedAt() { // 1 - $ne resetDevice(); - Log.e("Test $ne"); + ApptentiveLog.e("Test $ne"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); assertFalse(criteria.isMet(getTargetContext())); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "test.code.point"); @@ -300,7 +300,7 @@ public void testCodePointLastInvokedAt() { // 2 - $eq // There's no easy way to test this unless we contrive the times. resetDevice(); - Log.e("Test $eq"); + ApptentiveLog.e("Test $eq"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); assertFalse(criteria.isMet(getTargetContext())); @@ -312,7 +312,7 @@ public void testCodePointLastInvokedAt() { // 3 - : // Ditto resetDevice(); - Log.e("Test :"); + ApptentiveLog.e("Test :"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -325,7 +325,7 @@ public void testCodePointLastInvokedAt() { // 4 - $before resetDevice(); - Log.e("Test $before"); + ApptentiveLog.e("Test $before"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -338,17 +338,17 @@ public void testCodePointLastInvokedAt() { assertTrue(criteria.isMet(getTargetContext())); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNull(e); } - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } /** * Tests for a specific code point running. Tests all condition types. */ public void testInteractionInvokesTotal() { - Log.e("Running test: testInteractionInvokesTotal()\n\n"); + ApptentiveLog.e("Running test: testInteractionInvokesTotal()\n\n"); resetDevice(); String appVersionName = Util.getAppVersionName(getTargetContext()); int appVersionCode = Util.getAppVersionCode(getTargetContext()); @@ -359,7 +359,7 @@ public void testInteractionInvokesTotal() { InteractionCriteria criteria = new InteractionCriteria(json); // 0 - $gt - Log.e("Test $gt"); + ApptentiveLog.e("Test $gt"); assertFalse(criteria.isMet(getTargetContext())); CodePointStore.storeRecord(getTargetContext(), true, "test.interaction", appVersionName, appVersionCode); assertFalse(criteria.isMet(getTargetContext())); @@ -370,7 +370,7 @@ public void testInteractionInvokesTotal() { // 1 - $gte resetDevice(); - Log.e("Test $gte"); + ApptentiveLog.e("Test $gte"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); assertFalse(criteria.isMet(getTargetContext())); CodePointStore.storeRecord(getTargetContext(), true, "test.interaction", appVersionName, appVersionCode); @@ -382,7 +382,7 @@ public void testInteractionInvokesTotal() { // 2 - $ne resetDevice(); - Log.e("Test $ne"); + ApptentiveLog.e("Test $ne"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); assertTrue(criteria.isMet(getTargetContext())); @@ -395,7 +395,7 @@ public void testInteractionInvokesTotal() { // 3 - $eq resetDevice(); - Log.e("Test $eq"); + ApptentiveLog.e("Test $eq"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -409,7 +409,7 @@ public void testInteractionInvokesTotal() { // 4 - : resetDevice(); - Log.e("Test :"); + ApptentiveLog.e("Test :"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -424,7 +424,7 @@ public void testInteractionInvokesTotal() { // 5 - $lte resetDevice(); - Log.e("Test $lte"); + ApptentiveLog.e("Test $lte"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -440,7 +440,7 @@ public void testInteractionInvokesTotal() { // 6 - $lt resetDevice(); - Log.e("Test $lt"); + ApptentiveLog.e("Test $lt"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); CodePointStore.storeCodePointForCurrentAppVersion(getTargetContext(), "switch.code.point"); @@ -456,9 +456,9 @@ public void testInteractionInvokesTotal() { assertFalse(criteria.isMet(getTargetContext())); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNull(e); } - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/CornerCases.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/CornerCases.java index b2d26dea2..9b8638982 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/CornerCases.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/CornerCases.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.tests.module.engagement.criteria; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.logic.Clause; import com.apptentive.android.sdk.module.engagement.logic.ClauseParser; import com.apptentive.android.sdk.storage.DeviceManager; @@ -25,7 +25,7 @@ public class CornerCases extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "engagement" + File.separator + "criteria" + File.separator; public void testCornerCasesThatShouldBeTrue() throws JSONException { - Log.e("Running test: testCornerCasesThatShouldBeTrue()\n\n"); + ApptentiveLog.e("Running test: testCornerCasesThatShouldBeTrue()\n\n"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "testCornerCasesThatShouldBeTrue.json"); @@ -37,14 +37,14 @@ public void testCornerCasesThatShouldBeTrue() throws JSONException { boolean result = criteria.evaluate(getTargetContext()); assertTrue(result); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNull(e); } - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testCornerCasesThatShouldBeFalse() throws JSONException { - Log.e("Running test: testCornerCasesThatShouldBeFalse()\n\n"); + ApptentiveLog.e("Running test: testCornerCasesThatShouldBeFalse()\n\n"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "testCornerCasesThatShouldBeFalse.json"); @@ -56,10 +56,10 @@ public void testCornerCasesThatShouldBeFalse() throws JSONException { boolean result = criteria.evaluate(getTargetContext()); assertTrue(result); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNull(e); } - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/DefaultValues.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/DefaultValues.java index 11a17c2b4..2639b6a4e 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/DefaultValues.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/DefaultValues.java @@ -6,7 +6,7 @@ package com.apptentive.android.sdk.tests.module.engagement.criteria; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.logic.Clause; import com.apptentive.android.sdk.module.engagement.logic.ClauseParser; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; @@ -23,7 +23,7 @@ public class DefaultValues extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "engagement" + File.separator + "criteria" + File.separator; public void testDefaultValues() throws JSONException { - Log.e("Running test: testDefaultValues()\n\n"); + ApptentiveLog.e("Running test: testDefaultValues()\n\n"); resetDevice(); String json = FileUtil.loadTextAssetAsString(getTestContext(), TEST_DATA_DIR + "testDefaultValues.json"); @@ -34,9 +34,9 @@ public void testDefaultValues() throws JSONException { boolean result = criteria.evaluate(getTargetContext()); assertTrue(result); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNull(e); } - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/OperatorTests.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/OperatorTests.java index 83f26a7b6..bfb232cc3 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/OperatorTests.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/OperatorTests.java @@ -11,7 +11,7 @@ import com.apptentive.android.sdk.module.engagement.interaction.model.InteractionCriteria; import com.apptentive.android.sdk.storage.DeviceManager; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import org.json.JSONException; @@ -25,69 +25,69 @@ public class OperatorTests extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "engagement" + File.separator + "criteria" + File.separator; public void testOperatorExists() { - Log.e("Running test: testOperatorExists()\n\n"); + ApptentiveLog.e("Running test: testOperatorExists()\n\n"); doTest("testOperatorExists.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorNot() { - Log.e("Running test: testOperatorNot()\n\n"); + ApptentiveLog.e("Running test: testOperatorNot()\n\n"); doTest("testOperatorNot.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorLessThan() { - Log.e("Running test: testOperatorLessThan()\n\n"); + ApptentiveLog.e("Running test: testOperatorLessThan()\n\n"); doTest("testOperatorLessThan.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorLessThanOrEqual() { - Log.e("Running test: testOperatorLessThanOrEqual()\n\n"); + ApptentiveLog.e("Running test: testOperatorLessThanOrEqual()\n\n"); doTest("testOperatorLessThanOrEqual.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorGreaterThanOrEqual() { - Log.e("Running test: testOperatorGreaterThanOrEqual()\n\n"); + ApptentiveLog.e("Running test: testOperatorGreaterThanOrEqual()\n\n"); doTest("testOperatorGreaterThanOrEqual.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorGreaterThan() { - Log.e("Running test: testOperatorGreaterThan()\n\n"); + ApptentiveLog.e("Running test: testOperatorGreaterThan()\n\n"); doTest("testOperatorGreaterThan.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorContains() { - Log.e("Running test: testOperatorContains()\n\n"); + ApptentiveLog.e("Running test: testOperatorContains()\n\n"); doTest("testOperatorContains.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorStartsWith() { - Log.e("Running test: testOperatorStartsWith()\n\n"); + ApptentiveLog.e("Running test: testOperatorStartsWith()\n\n"); doTest("testOperatorStartsWith.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorEndsWith() { - Log.e("Running test: testOperatorEndsWith()\n\n"); + ApptentiveLog.e("Running test: testOperatorEndsWith()\n\n"); doTest("testOperatorEndsWith.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorBefore() { - Log.e("Running test: testOperatorBefore()\n\n"); + ApptentiveLog.e("Running test: testOperatorBefore()\n\n"); doTest("testOperatorBefore.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } public void testOperatorAfter() { - Log.e("Running test: testOperatorAfter()\n\n"); + ApptentiveLog.e("Running test: testOperatorAfter()\n\n"); doTest("testOperatorAfter.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } private void doTest(String testFile) { @@ -109,7 +109,7 @@ private void doTest(String testFile) { InteractionCriteria criteria = new InteractionCriteria(json); assertTrue(criteria.isMet(getTargetContext())); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNull(e); } } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/WhitespaceTrimmingTest.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/WhitespaceTrimmingTest.java index 6a5be41c8..73e58f4db 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/WhitespaceTrimmingTest.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/module/engagement/criteria/WhitespaceTrimmingTest.java @@ -7,7 +7,7 @@ package com.apptentive.android.sdk.tests.module.engagement.criteria; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.module.engagement.interaction.model.InteractionCriteria; import com.apptentive.android.sdk.storage.DeviceManager; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; @@ -24,9 +24,9 @@ public class WhitespaceTrimmingTest extends ApptentiveInstrumentationTestCase { private static final String TEST_DATA_DIR = "engagement" + File.separator + "criteria" + File.separator; public void testWhitespaceTrimming() { - Log.e("Running test: testWhitespaceTrimming()\n\n"); + ApptentiveLog.e("Running test: testWhitespaceTrimming()\n\n"); doTest("testWhitespaceTrimming.json"); - Log.e("Finished test."); + ApptentiveLog.e("Finished test."); } private void doTest(String testFile) { @@ -38,7 +38,7 @@ private void doTest(String testFile) { InteractionCriteria criteria = new InteractionCriteria(json); assertTrue(criteria.isMet(getTargetContext())); } catch (JSONException e) { - Log.e("Error parsing test JSON.", e); + ApptentiveLog.e("Error parsing test JSON.", e); assertNull(e); } } diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/push/TestPushNotifications.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/push/TestPushNotifications.java index de1a6198f..9ec83a30f 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/push/TestPushNotifications.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/push/TestPushNotifications.java @@ -6,11 +6,10 @@ package com.apptentive.android.sdk.tests.push; -import android.app.Activity; import android.content.Intent; import android.os.Bundle; import com.apptentive.android.sdk.Apptentive; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.tests.ApptentiveInstrumentationTestCase; import org.json.JSONException; import org.json.JSONObject; @@ -21,7 +20,7 @@ public class TestPushNotifications extends ApptentiveInstrumentationTestCase { public void testUrbanAirshipPushNotificationIdentification() { - Log.e("Running test: testUrbanAirshipPushNotificationIdentification()\n\n"); + ApptentiveLog.e("Running test: testUrbanAirshipPushNotificationIdentification()\n\n"); // Null bundle push { @@ -61,7 +60,7 @@ public void testUrbanAirshipPushNotificationIdentification() { } public void testParsePushNotificationIdentification() { - Log.e("Running test: testParsePushNotificationIdentification()\n\n"); + ApptentiveLog.e("Running test: testParsePushNotificationIdentification()\n\n"); // Null Intent { @@ -120,7 +119,7 @@ public void testParsePushNotificationIdentification() { } public void testAwsSnsPushNotificationIdentification() { - Log.e("Running test: testAwsSnsPushNotificationIdentification()\n\n"); + ApptentiveLog.e("Running test: testAwsSnsPushNotificationIdentification()\n\n"); // Null Intent { diff --git a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/util/FileUtil.java b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/util/FileUtil.java index e40415a51..ee7101ba7 100644 --- a/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/util/FileUtil.java +++ b/tests/test-app/src/androidTest/java/com/apptentive/android/sdk/tests/util/FileUtil.java @@ -8,7 +8,7 @@ import android.content.Context; import android.content.res.AssetManager; -import com.apptentive.android.sdk.Log; +import com.apptentive.android.sdk.ApptentiveLog; import com.apptentive.android.sdk.util.Util; import java.io.*; @@ -32,7 +32,7 @@ public static String loadRawTextResourceAsString(Context context, int resourceId } return builder.toString(); } catch (IOException e) { - Log.e("Error reading from raw resource with ID \"%d\"", e, resourceId); + ApptentiveLog.e("Error reading from raw resource with ID \"%d\"", e, resourceId); } finally { Util.ensureClosed(reader); } @@ -53,7 +53,7 @@ public static String loadTextAssetAsString(Context context, String path) { } return builder.toString(); } catch (IOException e) { - Log.e("Error reading from file \"%s\"", e, path); + ApptentiveLog.e("Error reading from file \"%s\"", e, path); } finally { Util.ensureClosed(reader); } @@ -66,7 +66,7 @@ public static BufferedReader openBufferedReaderFromFileAsset(Context context, St try { reader = new BufferedReader(new InputStreamReader(assetManager.open(path))); } catch (IOException e) { - Log.e("Error opening Reader from asset path \"%s\"", path); + ApptentiveLog.e("Error opening Reader from asset path \"%s\"", path); } return reader; }