Skip to content

code-cleanup#2

Open
LeventYADIRGA wants to merge 1 commit intosalesforce-marketingcloud:masterfrom
LeventYADIRGA:code-cleanup
Open

code-cleanup#2
LeventYADIRGA wants to merge 1 commit intosalesforce-marketingcloud:masterfrom
LeventYADIRGA:code-cleanup

Conversation

@LeventYADIRGA
Copy link

  1. ViewSwitcher Orientation Feature:
    Change: Removed orientation property from ViewSwitcher.
    Reason: This property was unused and caused confusion, so it was removed to simplify the code.

  2. showSnackbar Function:
    Change: Changed the access level of showSnackbar from internal to protected.
    Reason: The function was only accessible to classes within the same module when it was internal. However, this function can only be used by subclasses of the SdkFragment class. Making it protected ensures that the function can only be accessed by subclasses of SdkFragment.

  3. InboxViewer Class Lifecycle Functions:
    Change: Super calls were made first in the onResume, onDestroy, and onViewCreated functions.
    Reason: This change ensures that the class is protected from unexpected behavior by performing the default actions of the lifecycle functions first, and also increases overall compatibility.

  4. Inbox Class Date Format:
    Change: Proposed that the date format in the Inbox class be set according to locale.
    Reason: It is suggested that the date format be determined according to the user's locale to improve the user experience. This way, users can view dates in a format that they are more familiar with.

}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

override fun onResume() {
webView.onResume()
super.onResume()
webView.onResume()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

override fun onDestroy() {
webView.destroy()
super.onDestroy()
webView.destroy()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one, however, is not correct. The application's onDestroy might rely on something that is torn down in the super class. Google's recommendation is to call super first when creating/starting things, but last when pausing/stopping things.

android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair.

companion object {
val DATE_FORMAT: DateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.ENGLISH)
}
private val dateFormat: DateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair.

}

internal fun String.showSnackbar(length: Int = Snackbar.LENGTH_SHORT) {
protected fun String.showSnackbar(length: Int = Snackbar.LENGTH_SHORT) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants