From 53802f0211a671a42601d43223cc50029f89e0ee Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Thu, 7 Sep 2023 00:27:18 +0800 Subject: [PATCH] Refactor: update variable naming --- .../NpPlatformImageProcessorPlugin.kt | 18 +++++------ .../np_platform_lock/NpPlatformLockPlugin.kt | 14 ++++----- .../np_platform_log/NpPlatformLogPlugin.kt | 10 +++---- .../NpPlatformMessageRelayPlugin.kt | 6 ++-- .../NpPlatformPermissionPlugin.kt | 30 +++++++++---------- .../NpPlatformRawImagePlugin.kt | 10 +++---- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/np_platform_image_processor/android/src/main/kotlin/com/nkming/nc_photos/np_platform_image_processor/NpPlatformImageProcessorPlugin.kt b/np_platform_image_processor/android/src/main/kotlin/com/nkming/nc_photos/np_platform_image_processor/NpPlatformImageProcessorPlugin.kt index 9a23b7a9..a6cad118 100644 --- a/np_platform_image_processor/android/src/main/kotlin/com/nkming/nc_photos/np_platform_image_processor/NpPlatformImageProcessorPlugin.kt +++ b/np_platform_image_processor/android/src/main/kotlin/com/nkming/nc_photos/np_platform_image_processor/NpPlatformImageProcessorPlugin.kt @@ -19,28 +19,28 @@ class NpPlatformImageProcessorPlugin : FlutterPlugin { override fun onAttachedToEngine( @NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding ) { - val imageProcessorHandler = ImageProcessorChannelHandler( + val handler = ImageProcessorChannelHandler( flutterPluginBinding.applicationContext ) - imageProcessorEventChannel = EventChannel( + eventChannel = EventChannel( flutterPluginBinding.binaryMessenger, ImageProcessorChannelHandler.EVENT_CHANNEL ) - imageProcessorEventChannel.setStreamHandler(imageProcessorHandler) - imageProcessorMethodChannel = MethodChannel( + eventChannel.setStreamHandler(handler) + methodChannel = MethodChannel( flutterPluginBinding.binaryMessenger, ImageProcessorChannelHandler.METHOD_CHANNEL ) - imageProcessorMethodChannel.setMethodCallHandler(imageProcessorHandler) + methodChannel.setMethodCallHandler(handler) } override fun onDetachedFromEngine( @NonNull binding: FlutterPlugin.FlutterPluginBinding ) { - imageProcessorEventChannel.setStreamHandler(null) - imageProcessorMethodChannel.setMethodCallHandler(null) + eventChannel.setStreamHandler(null) + methodChannel.setMethodCallHandler(null) } - private lateinit var imageProcessorMethodChannel: MethodChannel - private lateinit var imageProcessorEventChannel: EventChannel + private lateinit var methodChannel: MethodChannel + private lateinit var eventChannel: EventChannel } diff --git a/np_platform_lock/android/src/main/kotlin/com/nkming/nc_photos/np_platform_lock/NpPlatformLockPlugin.kt b/np_platform_lock/android/src/main/kotlin/com/nkming/nc_photos/np_platform_lock/NpPlatformLockPlugin.kt index fcbd78ce..2feb49e0 100644 --- a/np_platform_lock/android/src/main/kotlin/com/nkming/nc_photos/np_platform_lock/NpPlatformLockPlugin.kt +++ b/np_platform_lock/android/src/main/kotlin/com/nkming/nc_photos/np_platform_lock/NpPlatformLockPlugin.kt @@ -8,20 +8,20 @@ class NpPlatformLockPlugin : FlutterPlugin { override fun onAttachedToEngine( @NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding ) { - lockChannelHandler = LockChannelHandler() - lockChannel = MethodChannel( + handler = LockChannelHandler() + methodChannel = MethodChannel( flutterPluginBinding.binaryMessenger, LockChannelHandler.CHANNEL ) - lockChannel.setMethodCallHandler(lockChannelHandler) + methodChannel.setMethodCallHandler(handler) } override fun onDetachedFromEngine( @NonNull binding: FlutterPlugin.FlutterPluginBinding ) { - lockChannelHandler.dismiss() - lockChannel.setMethodCallHandler(null) + handler.dismiss() + methodChannel.setMethodCallHandler(null) } - private lateinit var lockChannel: MethodChannel - private lateinit var lockChannelHandler: LockChannelHandler + private lateinit var methodChannel: MethodChannel + private lateinit var handler: LockChannelHandler } diff --git a/np_platform_log/android/src/main/kotlin/com/nkming/nc_photos/np_platform_log/NpPlatformLogPlugin.kt b/np_platform_log/android/src/main/kotlin/com/nkming/nc_photos/np_platform_log/NpPlatformLogPlugin.kt index bde6551e..09a2a993 100644 --- a/np_platform_log/android/src/main/kotlin/com/nkming/nc_photos/np_platform_log/NpPlatformLogPlugin.kt +++ b/np_platform_log/android/src/main/kotlin/com/nkming/nc_photos/np_platform_log/NpPlatformLogPlugin.kt @@ -8,19 +8,19 @@ class NpPlatformLogPlugin : FlutterPlugin { override fun onAttachedToEngine( @NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding ) { - val logcatChannelHandler = LogcatChannelHandler() - logcatMethodChannel = MethodChannel( + val handler = LogcatChannelHandler() + methodChannel = MethodChannel( flutterPluginBinding.binaryMessenger, LogcatChannelHandler.METHOD_CHANNEL ) - logcatMethodChannel.setMethodCallHandler(logcatChannelHandler) + methodChannel.setMethodCallHandler(handler) } override fun onDetachedFromEngine( @NonNull binding: FlutterPlugin.FlutterPluginBinding ) { - logcatMethodChannel.setMethodCallHandler(null) + methodChannel.setMethodCallHandler(null) } - private lateinit var logcatMethodChannel: MethodChannel + private lateinit var methodChannel: MethodChannel } diff --git a/np_platform_message_relay/android/src/main/kotlin/com/nkming/nc_photos/np_platform_message_relay/NpPlatformMessageRelayPlugin.kt b/np_platform_message_relay/android/src/main/kotlin/com/nkming/nc_photos/np_platform_message_relay/NpPlatformMessageRelayPlugin.kt index 7b381616..2b5105fd 100644 --- a/np_platform_message_relay/android/src/main/kotlin/com/nkming/nc_photos/np_platform_message_relay/NpPlatformMessageRelayPlugin.kt +++ b/np_platform_message_relay/android/src/main/kotlin/com/nkming/nc_photos/np_platform_message_relay/NpPlatformMessageRelayPlugin.kt @@ -9,17 +9,17 @@ class NpPlatformMessageRelayPlugin : FlutterPlugin { override fun onAttachedToEngine( @NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding ) { - val messageRelayHandler = MessageRelayChannelHandler() + val handler = MessageRelayChannelHandler() eventChannel = EventChannel( flutterPluginBinding.binaryMessenger, MessageRelayChannelHandler.EVENT_CHANNEL ) - eventChannel.setStreamHandler(messageRelayHandler) + eventChannel.setStreamHandler(handler) methodChannel = MethodChannel( flutterPluginBinding.binaryMessenger, MessageRelayChannelHandler.METHOD_CHANNEL ) - methodChannel.setMethodCallHandler(messageRelayHandler) + methodChannel.setMethodCallHandler(handler) } override fun onDetachedFromEngine( diff --git a/np_platform_permission/android/src/main/kotlin/com/nkming/nc_photos/np_platform_permission/NpPlatformPermissionPlugin.kt b/np_platform_permission/android/src/main/kotlin/com/nkming/nc_photos/np_platform_permission/NpPlatformPermissionPlugin.kt index 27b3e05a..b3575dca 100644 --- a/np_platform_permission/android/src/main/kotlin/com/nkming/nc_photos/np_platform_permission/NpPlatformPermissionPlugin.kt +++ b/np_platform_permission/android/src/main/kotlin/com/nkming/nc_photos/np_platform_permission/NpPlatformPermissionPlugin.kt @@ -19,29 +19,29 @@ class NpPlatformPermissionPlugin : FlutterPlugin, ActivityAware, override fun onAttachedToEngine( @NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding ) { - permissionChannelHandler = + handler = PermissionChannelHandler(flutterPluginBinding.applicationContext) - permissionChannel = EventChannel( + eventChannel = EventChannel( flutterPluginBinding.binaryMessenger, PermissionChannelHandler.EVENT_CHANNEL ) - permissionChannel.setStreamHandler(permissionChannelHandler) - permissionMethodChannel = MethodChannel( + eventChannel.setStreamHandler(handler) + methodChannel = MethodChannel( flutterPluginBinding.binaryMessenger, PermissionChannelHandler.METHOD_CHANNEL ) - permissionMethodChannel.setMethodCallHandler(permissionChannelHandler) + methodChannel.setMethodCallHandler(handler) } override fun onDetachedFromEngine( @NonNull binding: FlutterPlugin.FlutterPluginBinding ) { - permissionChannel.setStreamHandler(null) - permissionMethodChannel.setMethodCallHandler(null) + eventChannel.setStreamHandler(null) + methodChannel.setMethodCallHandler(null) } override fun onAttachedToActivity(binding: ActivityPluginBinding) { - permissionChannelHandler.onAttachedToActivity(binding) + handler.onAttachedToActivity(binding) pluginBinding = binding binding.addRequestPermissionsResultListener(this) } @@ -49,18 +49,18 @@ class NpPlatformPermissionPlugin : FlutterPlugin, ActivityAware, override fun onReattachedToActivityForConfigChanges( binding: ActivityPluginBinding ) { - permissionChannelHandler.onReattachedToActivityForConfigChanges(binding) + handler.onReattachedToActivityForConfigChanges(binding) pluginBinding = binding binding.addRequestPermissionsResultListener(this) } override fun onDetachedFromActivity() { - permissionChannelHandler.onDetachedFromActivity() + handler.onDetachedFromActivity() pluginBinding?.removeRequestPermissionsResultListener(this) } override fun onDetachedFromActivityForConfigChanges() { - permissionChannelHandler.onDetachedFromActivityForConfigChanges() + handler.onDetachedFromActivityForConfigChanges() pluginBinding?.removeRequestPermissionsResultListener(this) } @@ -70,7 +70,7 @@ class NpPlatformPermissionPlugin : FlutterPlugin, ActivityAware, return try { when (requestCode) { PermissionUtil.REQUEST_CODE -> { - permissionChannelHandler.onRequestPermissionsResult( + handler.onRequestPermissionsResult( requestCode, permissions, grantResults ) } @@ -87,7 +87,7 @@ class NpPlatformPermissionPlugin : FlutterPlugin, ActivityAware, private var pluginBinding: ActivityPluginBinding? = null - private lateinit var permissionChannel: EventChannel - private lateinit var permissionMethodChannel: MethodChannel - private lateinit var permissionChannelHandler: PermissionChannelHandler + private lateinit var eventChannel: EventChannel + private lateinit var methodChannel: MethodChannel + private lateinit var handler: PermissionChannelHandler } diff --git a/np_platform_raw_image/android/src/main/kotlin/com/nkming/nc_photos/np_platform_raw_image/NpPlatformRawImagePlugin.kt b/np_platform_raw_image/android/src/main/kotlin/com/nkming/nc_photos/np_platform_raw_image/NpPlatformRawImagePlugin.kt index 37dd21cd..c02e1f15 100644 --- a/np_platform_raw_image/android/src/main/kotlin/com/nkming/nc_photos/np_platform_raw_image/NpPlatformRawImagePlugin.kt +++ b/np_platform_raw_image/android/src/main/kotlin/com/nkming/nc_photos/np_platform_raw_image/NpPlatformRawImagePlugin.kt @@ -8,20 +8,20 @@ class NpPlatformRawImagePlugin : FlutterPlugin { override fun onAttachedToEngine( @NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding ) { - val imageLoaderChannelHandler = + val handler = ImageLoaderChannelHandler(flutterPluginBinding.applicationContext) - imageLoaderMethodChannel = MethodChannel( + methodChannel = MethodChannel( flutterPluginBinding.binaryMessenger, ImageLoaderChannelHandler.METHOD_CHANNEL ) - imageLoaderMethodChannel.setMethodCallHandler(imageLoaderChannelHandler) + methodChannel.setMethodCallHandler(handler) } override fun onDetachedFromEngine( @NonNull binding: FlutterPlugin.FlutterPluginBinding ) { - imageLoaderMethodChannel.setMethodCallHandler(null) + methodChannel.setMethodCallHandler(null) } - private lateinit var imageLoaderMethodChannel: MethodChannel + private lateinit var methodChannel: MethodChannel }