Skip to content

Commit

Permalink
Refactor attachBaseContext for Null Safety and Clean Code (#3769)
Browse files Browse the repository at this point in the history
Simplified the attachBaseContext function by removing redundant let block and ensuring null safety with concise null handling. This refactor improves readability and ensures that null cases are handled directly.
  • Loading branch information
CodeWithTamim authored Oct 25, 2024
1 parent fc132f7 commit 5f8ea93
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/BaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ abstract class BaseActivity : AppCompatActivity() {

@RequiresApi(Build.VERSION_CODES.N)
override fun attachBaseContext(newBase: Context?) {
val context = newBase?.let {
MyContextWrapper.wrap(newBase, Utils.getLocale())
}
super.attachBaseContext(context)
super.attachBaseContext(MyContextWrapper.wrap(newBase ?: return, Utils.getLocale()))
}
}

0 comments on commit 5f8ea93

Please sign in to comment.