diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 7510b55..bb8f751 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,17 +1,25 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 09e6b1d..1706688 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,45 +1,78 @@ - - - - - - - - - - - - - - - - - - - - - + + - - - - - + + + + + + + + + + + + + + + - - + + + - + + + + + + + - + + + + + 1670005130349 + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/src/main/kotlin/space/wisnuwiry/root_detector/RootDetectorPlugin.kt b/android/src/main/kotlin/space/wisnuwiry/root_detector/RootDetectorPlugin.kt index 6b97234..168f7bf 100644 --- a/android/src/main/kotlin/space/wisnuwiry/root_detector/RootDetectorPlugin.kt +++ b/android/src/main/kotlin/space/wisnuwiry/root_detector/RootDetectorPlugin.kt @@ -1,9 +1,8 @@ package space.wisnuwiry.root_detector import android.content.Context -import androidx.annotation.NonNull +import android.os.Build import com.scottyab.rootbeer.RootBeer - import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding @@ -11,8 +10,6 @@ import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel.MethodCallHandler import io.flutter.plugin.common.MethodChannel.Result -import java.lang.IllegalArgumentException -import android.os.Build /** RootDetectorPlugin */ class RootDetectorPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { @@ -24,7 +21,7 @@ class RootDetectorPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { private lateinit var context: Context private lateinit var rootBeer: RootBeer - override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { + override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { channel = MethodChannel(flutterPluginBinding.binaryMessenger, "space.wisnuwiry/root_detector") channel.setMethodCallHandler(this) @@ -32,7 +29,7 @@ class RootDetectorPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { rootBeer = RootBeer(context) } - override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { + override fun onMethodCall(call: MethodCall, result: Result) { val ignoreSimulator = call.arguments == true if (call.method == "checkIsRooted") { @@ -46,7 +43,7 @@ class RootDetectorPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { // Get check root status in normal devices - private fun checkIsRooted(@NonNull result: Result, ignoreSimulator: Boolean) { + private fun checkIsRooted(result: Result, ignoreSimulator: Boolean) { try { val isRoot = rootBeer.isRooted if (isRoot && ignoreSimulator && isEmulator()) { @@ -55,7 +52,7 @@ class RootDetectorPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { result.success(isRoot) } } catch (e: IllegalArgumentException) { - result.error(e.message, e.message, e.stackTrace) + result.error(e.message.toString(), e.message, e.stackTrace) } } @@ -64,7 +61,7 @@ class RootDetectorPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { // - All OnePlus Devices // - Moto E // - OPPO R9m (ColorOS 3.0,Android 5.1,Android security patch January 5, 2018 ) - private fun checkIsRootedWithBusyBox(@NonNull result: Result, ignoreSimulator: Boolean) { + private fun checkIsRootedWithBusyBox(result: Result, ignoreSimulator: Boolean) { try { val isRoot = rootBeer.isRootedWithBusyBoxCheck if (isRoot && ignoreSimulator && isEmulator()) { @@ -73,11 +70,11 @@ class RootDetectorPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { result.success(isRoot) } } catch (e: IllegalArgumentException) { - result.error(e.message, e.message, e.stackTrace) + result.error(e.message.toString(), e.message, e.stackTrace) } } - override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { + override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { channel.setMethodCallHandler(null) } diff --git a/example/pubspec.lock b/example/pubspec.lock index 1179c95..0c1f429 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,28 +21,21 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" cupertino_icons: dependency: "direct main" description: @@ -56,7 +49,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -73,21 +66,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" root_detector: dependency: "direct main" description: @@ -106,7 +106,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -127,35 +127,28 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.12" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.0.0" diff --git a/pubspec.lock b/pubspec.lock index d4896e9..9cf620f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,35 +21,28 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -66,21 +59,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -92,7 +92,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -113,35 +113,28 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.12" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.0.0" diff --git a/root_detector.iml b/root_detector.iml index 429df7d..ee6be3b 100644 --- a/root_detector.iml +++ b/root_detector.iml @@ -1,5 +1,10 @@ + + + + + @@ -9,10 +14,11 @@ + + -