Skip to content

Commit

Permalink
rename fixes java
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 committed Sep 28, 2023
1 parent 0abe841 commit 5e47e88
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.customer.android.sample.java_layout.BuildConfig;
import io.customer.android.sample.java_layout.support.Optional;
import io.customer.android.sample.java_layout.utils.StringUtils;
import io.customer.messagingpush.config.NotificationClickBehavior;
import io.customer.messagingpush.config.PushClickBehavior;

/**
* Data class to hold SDK configurations. This is only required by sample app for testing purpose.
Expand All @@ -23,7 +23,7 @@ private static class Keys {
static final String TRACKING_URL = "cio_sdk_tracking_url";
static final String BQ_SECONDS_DELAY = "cio_sdk_bq_seconds_delay";
static final String BQ_MIN_TASKS = "cio_sdk_bq_min_tasks";
static final String NOTIFICATION_CLICK_BEHAVIOR = "cio_sdk_notification_click_behavior";
static final String PUSH_CLICK_BEHAVIOR = "cio_sdk_push_click_behavior";
static final String TRACK_SCREENS = "cio_sdk_track_screens";
static final String TRACK_DEVICE_ATTRIBUTES = "cio_sdk_track_device_attributes";
static final String DEBUG_MODE = "cio_sdk_debug_mode";
Expand All @@ -35,7 +35,7 @@ public static CustomerIOSDKConfig getDefaultConfigurations() {
"https://track-sdk.customer.io/",
30.0,
10,
NotificationClickBehavior.ACTIVITY_NO_FLAGS,
PushClickBehavior.ACTIVITY_NO_FLAGS,
true,
true,
true);
Expand All @@ -53,9 +53,9 @@ public static Optional<CustomerIOSDKConfig> fromMap(@NonNull Map<String, String>
String trackingURL = bundle.get(Keys.TRACKING_URL);
Double bqSecondsDelay = StringUtils.parseDouble(bundle.get(Keys.BQ_SECONDS_DELAY), defaultConfig.backgroundQueueSecondsDelay);
Integer bqMinTasks = StringUtils.parseInteger(bundle.get(Keys.BQ_MIN_TASKS), defaultConfig.backgroundQueueMinNumOfTasks);
NotificationClickBehavior notificationClickBehavior = StringUtils.parseEnum(bundle.get(Keys.NOTIFICATION_CLICK_BEHAVIOR),
defaultConfig.notificationClickBehavior,
NotificationClickBehavior.class);
PushClickBehavior notificationClickBehavior = StringUtils.parseEnum(bundle.get(Keys.PUSH_CLICK_BEHAVIOR),
defaultConfig.pushClickBehavior,
PushClickBehavior.class);
boolean screenTrackingEnabled = StringUtils.parseBoolean(bundle.get(Keys.TRACK_SCREENS), defaultConfig.screenTrackingEnabled);
boolean deviceAttributesTrackingEnabled = StringUtils.parseBoolean(bundle.get(Keys.TRACK_DEVICE_ATTRIBUTES), defaultConfig.deviceAttributesTrackingEnabled);
boolean debugModeEnabled = StringUtils.parseBoolean(bundle.get(Keys.DEBUG_MODE), defaultConfig.debugModeEnabled);
Expand All @@ -80,7 +80,7 @@ public static Map<String, String> toMap(@NonNull CustomerIOSDKConfig config) {
bundle.put(Keys.TRACKING_URL, config.trackingURL);
bundle.put(Keys.BQ_SECONDS_DELAY, StringUtils.fromDouble(config.backgroundQueueSecondsDelay));
bundle.put(Keys.BQ_MIN_TASKS, StringUtils.fromInteger(config.backgroundQueueMinNumOfTasks));
bundle.put(Keys.NOTIFICATION_CLICK_BEHAVIOR, StringUtils.fromEnum(config.notificationClickBehavior));
bundle.put(Keys.PUSH_CLICK_BEHAVIOR, StringUtils.fromEnum(config.pushClickBehavior));
bundle.put(Keys.TRACK_SCREENS, StringUtils.fromBoolean(config.screenTrackingEnabled));
bundle.put(Keys.TRACK_DEVICE_ATTRIBUTES, StringUtils.fromBoolean(config.deviceAttributesTrackingEnabled));
bundle.put(Keys.DEBUG_MODE, StringUtils.fromBoolean(config.debugModeEnabled));
Expand All @@ -98,7 +98,7 @@ public static Map<String, String> toMap(@NonNull CustomerIOSDKConfig config) {
@Nullable
private final Integer backgroundQueueMinNumOfTasks;
@Nullable
private final NotificationClickBehavior notificationClickBehavior;
private final PushClickBehavior pushClickBehavior;
@Nullable
private final Boolean screenTrackingEnabled;
@Nullable
Expand All @@ -111,7 +111,7 @@ public CustomerIOSDKConfig(@NonNull String siteId,
@Nullable String trackingURL,
@Nullable Double backgroundQueueSecondsDelay,
@Nullable Integer backgroundQueueMinNumOfTasks,
@Nullable NotificationClickBehavior notificationClickBehavior,
@Nullable PushClickBehavior pushClickBehavior,
@Nullable Boolean screenTrackingEnabled,
@Nullable Boolean deviceAttributesTrackingEnabled,
@Nullable Boolean debugModeEnabled) {
Expand All @@ -120,7 +120,7 @@ public CustomerIOSDKConfig(@NonNull String siteId,
this.trackingURL = trackingURL;
this.backgroundQueueSecondsDelay = backgroundQueueSecondsDelay;
this.backgroundQueueMinNumOfTasks = backgroundQueueMinNumOfTasks;
this.notificationClickBehavior = notificationClickBehavior;
this.pushClickBehavior = pushClickBehavior;
this.screenTrackingEnabled = screenTrackingEnabled;
this.deviceAttributesTrackingEnabled = deviceAttributesTrackingEnabled;
this.debugModeEnabled = debugModeEnabled;
Expand Down Expand Up @@ -152,8 +152,8 @@ public Integer getBackgroundQueueMinNumOfTasks() {
}

@Nullable
public NotificationClickBehavior getNotificationClickBehavior() {
return notificationClickBehavior;
public PushClickBehavior getPushClickBehavior() {
return pushClickBehavior;
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public void initializeSdk(SampleApplication application) {
// Enable optional features of the SDK by adding desired modules.
// Modify push notification configurations
MessagingPushModuleConfig.Builder pushModuleConfigBuilder = new MessagingPushModuleConfig.Builder();
if (sdkConfig.getNotificationClickBehavior() != null) {
pushModuleConfigBuilder.setNotificationClickBehavior(sdkConfig.getNotificationClickBehavior());
if (sdkConfig.getPushClickBehavior() != null) {
pushModuleConfigBuilder.setPushClickBehavior(sdkConfig.getPushClickBehavior());
}
// Enables push notification
builder.addCustomerIOModule(new ModuleMessagingPushFCM(pushModuleConfigBuilder.build()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import io.customer.android.sample.java_layout.utils.OSUtils;
import io.customer.android.sample.java_layout.utils.StringUtils;
import io.customer.android.sample.java_layout.utils.ViewUtils;
import io.customer.messagingpush.config.NotificationClickBehavior;
import io.customer.messagingpush.config.PushClickBehavior;
import io.customer.sdk.CustomerIO;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
Expand Down Expand Up @@ -120,7 +120,7 @@ private void setupViews() {
Toast.makeText(this, R.string.token_copied, Toast.LENGTH_SHORT).show();
});

NotificationClickBehavior[] pushBehaviors = NotificationClickBehavior.values();
PushClickBehavior[] pushBehaviors = PushClickBehavior.values();
String[] pushBehaviorItems = new String[pushBehaviors.length];
for (int ind = 0; ind < pushBehaviors.length; ind++) {
pushBehaviorItems[ind] = pushBehaviors[ind].toString();
Expand Down Expand Up @@ -169,9 +169,9 @@ private void updateIOWithConfig(@NonNull CustomerIOSDKConfig config) {
ViewUtils.setTextWithSelectionIfFocused(binding.apiKeyTextInput, config.getApiKey());
ViewUtils.setTextWithSelectionIfFocused(binding.bqDelayTextInput, StringUtils.fromDouble(config.getBackgroundQueueSecondsDelay()));
ViewUtils.setTextWithSelectionIfFocused(binding.bqTasksTextInput, StringUtils.fromInteger(config.getBackgroundQueueMinNumOfTasks()));
NotificationClickBehavior pushBehavior = config.getNotificationClickBehavior();
PushClickBehavior pushBehavior = config.getPushClickBehavior();
if (pushBehavior != null) {
((MaterialAutoCompleteTextView) binding.pushBehaviorTextView).setText(pushBehavior.name(), false);
binding.pushBehaviorTextView.setText(pushBehavior.name(), false);
}
binding.trackScreensSwitch.setChecked(config.screenTrackingEnabled());
binding.trackDeviceAttributesSwitch.setChecked(config.deviceAttributesTrackingEnabled());
Expand Down Expand Up @@ -216,10 +216,10 @@ private void saveSettings() {

if (isFormValid) {
binding.progressIndicator.show();
String notificationClickBehaviorSelection = binding.pushBehaviorTextView.getText().toString();
NotificationClickBehavior notificationClickBehavior = StringUtils.parseEnum(notificationClickBehaviorSelection,
String pushClickBehaviorSelection = binding.pushBehaviorTextView.getText().toString();
PushClickBehavior pushClickBehavior = StringUtils.parseEnum(pushClickBehaviorSelection,
null,
NotificationClickBehavior.class);
PushClickBehavior.class);
boolean featTrackScreens = binding.trackScreensSwitch.isChecked();
boolean featTrackDeviceAttributes = binding.trackDeviceAttributesSwitch.isChecked();
boolean featDebugMode = binding.debugModeSwitch.isChecked();
Expand All @@ -228,7 +228,7 @@ private void saveSettings() {
trackingURL,
bqSecondsDelay,
bqMinTasks,
notificationClickBehavior,
pushClickBehavior,
featTrackScreens,
featTrackDeviceAttributes,
featDebugMode);
Expand Down

0 comments on commit 5e47e88

Please sign in to comment.