From 8f74b702fbbb6500476702904feb8c9dfb519e88 Mon Sep 17 00:00:00 2001 From: anush Date: Wed, 30 Aug 2023 14:44:20 +0530 Subject: [PATCH] task(SDK-3215) - Updates Logger implementation to static for HMS module --- .../com/clevertap/android/hms/CTHmsMessageHandler.java | 8 ++++---- .../com/clevertap/android/hms/CTHmsMessageService.java | 4 ++-- .../com/clevertap/android/hms/HmsNotificationParser.java | 4 ++-- .../java/com/clevertap/android/hms/HmsSdkHandler.java | 7 ++++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageHandler.java b/clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageHandler.java index c135a72d8..2c8b12c94 100644 --- a/clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageHandler.java +++ b/clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageHandler.java @@ -53,7 +53,7 @@ public boolean createNotification(Context context, final RemoteMessage remoteMes .getPushNotificationHandler().onMessageReceived(context, messageBundle, HPS.toString()); } catch (Throwable e) { e.printStackTrace(); - Logger.d(LOG_TAG, HMS_LOG_TAG + "Error Creating Notification", e); + Logger.debug(LOG_TAG, HMS_LOG_TAG + "Error Creating Notification", e); } } return isSuccess; @@ -68,11 +68,11 @@ public boolean onNewToken(Context context, final String token) { try { PushNotificationHandler.getPushNotificationHandler().onNewToken(context, token, PushType.HPS .getType()); - Logger.d(LOG_TAG, HMS_LOG_TAG + "onNewToken: " + token); + Logger.debug(LOG_TAG, HMS_LOG_TAG + "onNewToken: " + token); isSuccess = true; } catch (Throwable throwable) { // do nothing - Logger.d(LOG_TAG, HMS_LOG_TAG + "Error onNewToken: " + token, throwable); + Logger.debug(LOG_TAG, HMS_LOG_TAG + "Error onNewToken: " + token, throwable); } return isSuccess; } @@ -91,7 +91,7 @@ public void processPushAmp(final Context context, @NonNull final RemoteMessage m CleverTapAPI.processPushNotification(context, messageBundle); } } catch (Throwable t) { - Logger.d(LOG_TAG, HMS_LOG_TAG + "Error processing push amp", t); + Logger.debug(LOG_TAG, HMS_LOG_TAG + "Error processing push amp", t); } } diff --git a/clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageService.java b/clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageService.java index be893d494..efd4f858c 100644 --- a/clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageService.java +++ b/clevertap-hms/src/main/java/com/clevertap/android/hms/CTHmsMessageService.java @@ -17,14 +17,14 @@ public class CTHmsMessageService extends HmsMessageService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); - Logger.i(LOG_TAG, HMS_LOG_TAG + "onMessageReceived is called"); + Logger.info(LOG_TAG, HMS_LOG_TAG + "onMessageReceived is called"); mHandler.createNotification(getApplicationContext(), remoteMessage); } @Override public void onNewToken(String token) { super.onNewToken(token); - Logger.i(LOG_TAG, HMS_LOG_TAG + "onNewToken is called " + token); + Logger.info(LOG_TAG, HMS_LOG_TAG + "onNewToken is called " + token); mHandler.onNewToken(getApplicationContext(), token); } } \ No newline at end of file diff --git a/clevertap-hms/src/main/java/com/clevertap/android/hms/HmsNotificationParser.java b/clevertap-hms/src/main/java/com/clevertap/android/hms/HmsNotificationParser.java index 9e69d925f..ea7d6c1c0 100644 --- a/clevertap-hms/src/main/java/com/clevertap/android/hms/HmsNotificationParser.java +++ b/clevertap-hms/src/main/java/com/clevertap/android/hms/HmsNotificationParser.java @@ -19,11 +19,11 @@ public class HmsNotificationParser implements INotificationParser public Bundle toBundle(@NonNull final RemoteMessage message) { try { Bundle extras = Utils.stringToBundle(message.getData()); - Logger.d(LOG_TAG, HMS_LOG_TAG + "Found Valid Notification Message "); + Logger.debug(LOG_TAG, HMS_LOG_TAG + "Found Valid Notification Message "); return extras; } catch (Throwable e) { e.printStackTrace(); - Logger.d(LOG_TAG, HMS_LOG_TAG + "Invalid Notification Message ", e); + Logger.debug(LOG_TAG, HMS_LOG_TAG + "Invalid Notification Message ", e); } return null; } diff --git a/clevertap-hms/src/main/java/com/clevertap/android/hms/HmsSdkHandler.java b/clevertap-hms/src/main/java/com/clevertap/android/hms/HmsSdkHandler.java index 5f3a1946f..46fae0c12 100644 --- a/clevertap-hms/src/main/java/com/clevertap/android/hms/HmsSdkHandler.java +++ b/clevertap-hms/src/main/java/com/clevertap/android/hms/HmsSdkHandler.java @@ -8,6 +8,7 @@ import android.content.Context; import android.text.TextUtils; import com.clevertap.android.sdk.CleverTapInstanceConfig; +import com.clevertap.android.sdk.Logger; import com.huawei.agconnect.AGConnectOptions; import com.huawei.agconnect.AGConnectOptionsBuilder; import com.huawei.hms.aaid.HmsInstanceId; @@ -46,7 +47,7 @@ public String appId() { try { appId = options.getString(APP_ID_KEY); } catch (Throwable t) { - mConfig.log(LOG_TAG, HMS_LOG_TAG + "HMS availability check failed."); + Logger.verbose(mConfig.getAccountId(), LOG_TAG, HMS_LOG_TAG + "HMS availability check failed."); } return appId; } @@ -61,7 +62,7 @@ public boolean isSupported() { try { return HuaweiApiAvailability.getInstance().isHuaweiMobileNoticeAvailable(context) == 0; } catch (Throwable e) { - mConfig.log(LOG_TAG, HMS_LOG_TAG + "HMS is supported check failed."); + Logger.verbose(mConfig.getAccountId(), LOG_TAG, HMS_LOG_TAG + "HMS is supported check failed."); return false; } } @@ -75,7 +76,7 @@ public String onNewToken() { token = HmsInstanceId.getInstance(context).getToken(appId, HCM_SCOPE); } } catch (Throwable t) { - mConfig.log(LOG_TAG, HMS_LOG_TAG + "Error requesting HMS token", t); + Logger.verbose(mConfig.getAccountId(), LOG_TAG, HMS_LOG_TAG + "Error requesting HMS token", t); } return token; }