From 143204bf0ef722ad73aae970ce6230425475c958 Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Sat, 8 Oct 2022 16:56:19 +0200 Subject: [PATCH] refactor(battery_plus)!: platform implementation refactor into a single package (#1169) * unfederate battery_plus_linux * unfederate battery_plus_macos * unfederate battery_plus_web * unfederate battery_plus_windows * Unfederate the platform interface * move all files one dir below * fix dependency * bump version * add missing flutter_web_plugins * windows naming fix * Fix windows build * Move battery_plus_web.dart to src folder * remove pluginClass: none * moving all files to src * export platform interface * remove unnecessary import * cleanup * sort imports * move battery_plus_platform_interface.dart to root * export enums directly instead of the battery_plus_platform_interface * rename BatteryPlusWebPlugin * renamed BatteryPlusLinux to BatteryPlusLinuxPlugin for consistency * move battery_plus into battery_plus * re-add battery_plus_platform_interface * fix battery_plus dependency to the platform interface * typo * format * remove new line from changelog, let's try melos release process * revert forcing package version BREAKING CHANGE: battery_plus plugin architecture changed --- .../macos/Runner.xcodeproj/project.pbxproj | 77 +++++++++++++++---- .../contents.xcworkspacedata | 3 + .../battery_plus/example/pubspec.yaml | 12 --- .../battery_plus/lib/battery_plus.dart | 5 +- .../lib/src/battery_plus_linux.dart | 4 +- .../lib/src}/battery_plus_web.dart | 6 +- .../Classes/BatteryPlusChargingHandler.swift | 28 +++---- .../Classes/BatteryPlusMacosPlugin.swift | 0 .../battery_plus/macos/battery_plus.podspec | 23 +++--- .../battery_plus/battery_plus/pubspec.yaml | 22 +++--- .../test/battery_plus_linux_test.dart | 14 ++-- .../test/battery_plus_linux_test.mocks.dart | 0 .../windows/.gitignore | 0 .../windows/CMakeLists.txt | 4 +- .../windows/battery_plus_plugin.cpp} | 4 +- .../battery_plus_windows_plugin.h | 4 +- .../include/battery_plus}/system_battery.h | 0 .../windows/system_battery.cpp | 2 +- .../battery_plus_linux/.gitignore | 74 ------------------ .../battery_plus/battery_plus_linux/.metadata | 10 --- .../battery_plus_linux/CHANGELOG.md | 48 ------------ .../battery_plus/battery_plus_linux/LICENSE | 27 ------- .../battery_plus/battery_plus_linux/README.md | 12 --- .../lib/battery_plus_linux.dart | 4 - .../battery_plus_linux/pubspec.yaml | 31 -------- .../battery_plus_macos/.gitignore | 7 -- .../battery_plus/battery_plus_macos/.metadata | 10 --- .../battery_plus_macos/CHANGELOG.md | 31 -------- .../battery_plus/battery_plus_macos/LICENSE | 27 ------- .../battery_plus/battery_plus_macos/README.md | 12 --- .../lib/battery_plus_macos.dart | 3 - .../macos/battery_plus_macos.podspec | 22 ------ .../battery_plus_macos/pubspec.yaml | 24 ------ .../battery_plus/battery_plus_web/.gitignore | 47 ----------- .../battery_plus/battery_plus_web/.metadata | 10 --- .../battery_plus_web/CHANGELOG.md | 35 --------- .../battery_plus/battery_plus_web/LICENSE | 27 ------- .../battery_plus/battery_plus_web/README.md | 12 --- .../battery_plus_web/pubspec.yaml | 23 ------ .../battery_plus_windows/CHANGELOG.md | 39 ---------- .../battery_plus/battery_plus_windows/LICENSE | 27 ------- .../battery_plus_windows/README.md | 12 --- .../lib/battery_plus_windows.dart | 3 - .../battery_plus_windows/pubspec.yaml | 24 ------ 44 files changed, 125 insertions(+), 684 deletions(-) rename packages/battery_plus/{battery_plus_linux => battery_plus}/lib/src/battery_plus_linux.dart (95%) rename packages/battery_plus/{battery_plus_web/lib => battery_plus/lib/src}/battery_plus_web.dart (93%) rename packages/battery_plus/{battery_plus_macos => battery_plus}/macos/Classes/BatteryPlusChargingHandler.swift (96%) rename packages/battery_plus/{battery_plus_macos => battery_plus}/macos/Classes/BatteryPlusMacosPlugin.swift (100%) rename packages/battery_plus/{battery_plus_linux => battery_plus}/test/battery_plus_linux_test.dart (84%) rename packages/battery_plus/{battery_plus_linux => battery_plus}/test/battery_plus_linux_test.mocks.dart (100%) rename packages/battery_plus/{battery_plus_windows => battery_plus}/windows/.gitignore (100%) rename packages/battery_plus/{battery_plus_windows => battery_plus}/windows/CMakeLists.txt (88%) rename packages/battery_plus/{battery_plus_windows/windows/battery_plus_windows_plugin.cpp => battery_plus/windows/battery_plus_plugin.cpp} (97%) rename packages/battery_plus/{battery_plus_windows/windows/include/battery_plus_windows => battery_plus/windows/include/battery_plus}/battery_plus_windows_plugin.h (80%) rename packages/battery_plus/{battery_plus_windows/windows/include/battery_plus_windows => battery_plus/windows/include/battery_plus}/system_battery.h (100%) rename packages/battery_plus/{battery_plus_windows => battery_plus}/windows/system_battery.cpp (98%) delete mode 100644 packages/battery_plus/battery_plus_linux/.gitignore delete mode 100644 packages/battery_plus/battery_plus_linux/.metadata delete mode 100644 packages/battery_plus/battery_plus_linux/CHANGELOG.md delete mode 100644 packages/battery_plus/battery_plus_linux/LICENSE delete mode 100644 packages/battery_plus/battery_plus_linux/README.md delete mode 100644 packages/battery_plus/battery_plus_linux/lib/battery_plus_linux.dart delete mode 100644 packages/battery_plus/battery_plus_linux/pubspec.yaml delete mode 100644 packages/battery_plus/battery_plus_macos/.gitignore delete mode 100644 packages/battery_plus/battery_plus_macos/.metadata delete mode 100644 packages/battery_plus/battery_plus_macos/CHANGELOG.md delete mode 100644 packages/battery_plus/battery_plus_macos/LICENSE delete mode 100644 packages/battery_plus/battery_plus_macos/README.md delete mode 100644 packages/battery_plus/battery_plus_macos/lib/battery_plus_macos.dart delete mode 100644 packages/battery_plus/battery_plus_macos/macos/battery_plus_macos.podspec delete mode 100644 packages/battery_plus/battery_plus_macos/pubspec.yaml delete mode 100644 packages/battery_plus/battery_plus_web/.gitignore delete mode 100644 packages/battery_plus/battery_plus_web/.metadata delete mode 100644 packages/battery_plus/battery_plus_web/CHANGELOG.md delete mode 100644 packages/battery_plus/battery_plus_web/LICENSE delete mode 100644 packages/battery_plus/battery_plus_web/README.md delete mode 100644 packages/battery_plus/battery_plus_web/pubspec.yaml delete mode 100644 packages/battery_plus/battery_plus_windows/CHANGELOG.md delete mode 100644 packages/battery_plus/battery_plus_windows/LICENSE delete mode 100644 packages/battery_plus/battery_plus_windows/README.md delete mode 100644 packages/battery_plus/battery_plus_windows/lib/battery_plus_windows.dart delete mode 100644 packages/battery_plus/battery_plus_windows/pubspec.yaml diff --git a/packages/battery_plus/battery_plus/example/macos/Runner.xcodeproj/project.pbxproj b/packages/battery_plus/battery_plus/example/macos/Runner.xcodeproj/project.pbxproj index 5fb492c8ed..d999fe7879 100644 --- a/packages/battery_plus/battery_plus/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/battery_plus/battery_plus/example/macos/Runner.xcodeproj/project.pbxproj @@ -26,10 +26,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; }; - 33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; }; - D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EB30D1BDD1652B1637007EB4 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CFC44BEB0C124E4CD00CAA07 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -49,8 +46,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */, - 33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */, ); name = "Bundle Framework"; runOnlyForDeploymentPostprocessing = 0; @@ -58,9 +53,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 06F31FBE7F0395D04EA40A20 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -69,13 +65,14 @@ 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; - 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FlutterMacOS.framework; path = Flutter/ephemeral/FlutterMacOS.framework; sourceTree = SOURCE_ROOT; }; 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 4AFA7DCBB075C90D95997775 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 7DE20167D4C93662FF106CF0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; }; + CFC44BEB0C124E4CD00CAA07 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -83,8 +80,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D73912F022F37F9E000D13A0 /* App.framework in Frameworks */, - 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */, + EB30D1BDD1652B1637007EB4 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -109,6 +105,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + C2CC9754B893E4B0EC9D75D7 /* Pods */, ); sourceTree = ""; }; @@ -138,8 +135,6 @@ 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, - D73912EF22F37F9E000D13A0 /* App.framework */, - 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */, ); path = Flutter; sourceTree = ""; @@ -157,9 +152,21 @@ path = Runner; sourceTree = ""; }; + C2CC9754B893E4B0EC9D75D7 /* Pods */ = { + isa = PBXGroup; + children = ( + 06F31FBE7F0395D04EA40A20 /* Pods-Runner.debug.xcconfig */, + 4AFA7DCBB075C90D95997775 /* Pods-Runner.release.xcconfig */, + 7DE20167D4C93662FF106CF0 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + CFC44BEB0C124E4CD00CAA07 /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -171,11 +178,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 6B992185E66A6A4A21EB5C39 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + 9F05A0CF161FB9CAF4897EAB /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -260,7 +269,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename\n"; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; }; 33CC111E2044C6BF0003C045 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -282,6 +291,46 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + 6B992185E66A6A4A21EB5C39 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 9F05A0CF161FB9CAF4897EAB /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/battery_plus/battery_plus.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/battery_plus.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/packages/battery_plus/battery_plus/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/packages/battery_plus/battery_plus/example/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16ed..21a3cc14c7 100644 --- a/packages/battery_plus/battery_plus/example/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/packages/battery_plus/battery_plus/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/packages/battery_plus/battery_plus/example/pubspec.yaml b/packages/battery_plus/battery_plus/example/pubspec.yaml index 6b9c7e11bc..fd1bf2fea5 100644 --- a/packages/battery_plus/battery_plus/example/pubspec.yaml +++ b/packages/battery_plus/battery_plus/example/pubspec.yaml @@ -10,18 +10,6 @@ dependencies: battery_plus: path: ../ -dependency_overrides: - battery_plus_linux: - path: ../../battery_plus_linux - battery_plus_macos: - path: ../../battery_plus_macos - battery_plus_platform_interface: - path: ../../battery_plus_platform_interface - battery_plus_web: - path: ../../battery_plus_web - battery_plus_windows: - path: ../../battery_plus_windows - dev_dependencies: flutter_driver: sdk: flutter diff --git a/packages/battery_plus/battery_plus/lib/battery_plus.dart b/packages/battery_plus/battery_plus/lib/battery_plus.dart index 0d08e0434e..0ffaff6a61 100644 --- a/packages/battery_plus/battery_plus/lib/battery_plus.dart +++ b/packages/battery_plus/battery_plus/lib/battery_plus.dart @@ -6,10 +6,11 @@ import 'dart:async'; import 'package:battery_plus_platform_interface/battery_plus_platform_interface.dart'; -// Export enums from the platform_interface so plugin users can use them directly. export 'package:battery_plus_platform_interface/battery_plus_platform_interface.dart' show BatteryState; +export 'src/battery_plus_linux.dart'; + /// API for accessing information about the battery of the device the Flutter app is running on. class Battery { /// Constructs a singleton instance of [Battery]. @@ -38,7 +39,7 @@ class Battery { /// check if device is on battery save mode /// - /// Currently only impemented on Android, IOS and Windows. + /// Currently only implemented on Android, iOS and Windows. Future get isInBatterySaveMode { return _platform.isInBatterySaveMode; } diff --git a/packages/battery_plus/battery_plus_linux/lib/src/battery_plus_linux.dart b/packages/battery_plus/battery_plus/lib/src/battery_plus_linux.dart similarity index 95% rename from packages/battery_plus/battery_plus_linux/lib/src/battery_plus_linux.dart rename to packages/battery_plus/battery_plus/lib/src/battery_plus_linux.dart index a67445df5d..4ae617932c 100644 --- a/packages/battery_plus/battery_plus_linux/lib/src/battery_plus_linux.dart +++ b/packages/battery_plus/battery_plus/lib/src/battery_plus_linux.dart @@ -24,10 +24,10 @@ extension _ToBatteryState on UPowerDeviceState { typedef UPowerClientFactory = UPowerClient Function(); /// The Linux implementation of BatteryPlatform. -class BatteryPlusLinux extends BatteryPlatform { +class BatteryPlusLinuxPlugin extends BatteryPlatform { /// Register this dart class as the platform implementation for linux static void registerWith() { - BatteryPlatform.instance = BatteryPlusLinux(); + BatteryPlatform.instance = BatteryPlusLinuxPlugin(); } /// Returns the current battery level in percent. diff --git a/packages/battery_plus/battery_plus_web/lib/battery_plus_web.dart b/packages/battery_plus/battery_plus/lib/src/battery_plus_web.dart similarity index 93% rename from packages/battery_plus/battery_plus_web/lib/battery_plus_web.dart rename to packages/battery_plus/battery_plus/lib/src/battery_plus_web.dart index 82ed6bad55..3780a280ff 100644 --- a/packages/battery_plus/battery_plus_web/lib/battery_plus_web.dart +++ b/packages/battery_plus/battery_plus/lib/src/battery_plus_web.dart @@ -6,9 +6,9 @@ import 'package:battery_plus_platform_interface/battery_plus_platform_interface. import 'package:flutter_web_plugins/flutter_web_plugins.dart'; /// The web implementation of the BatteryPlatform of the Battery plugin. -class BatteryPlusPlugin extends BatteryPlatform { +class BatteryPlusWebPlugin extends BatteryPlatform { /// Constructs a BatteryPlusPlugin. - BatteryPlusPlugin(html.Navigator navigator) + BatteryPlusWebPlugin(html.Navigator navigator) : _getBattery = navigator.getBattery; /// A check to determine if this version of the plugin can be used. @@ -20,7 +20,7 @@ class BatteryPlusPlugin extends BatteryPlatform { /// Factory method that initializes the Battery plugin platform with an instance /// of the plugin for the web. static void registerWith(Registrar registrar) { - BatteryPlatform.instance = BatteryPlusPlugin(html.window.navigator); + BatteryPlatform.instance = BatteryPlusWebPlugin(html.window.navigator); } /// Returns the current battery level in percent. diff --git a/packages/battery_plus/battery_plus_macos/macos/Classes/BatteryPlusChargingHandler.swift b/packages/battery_plus/battery_plus/macos/Classes/BatteryPlusChargingHandler.swift similarity index 96% rename from packages/battery_plus/battery_plus_macos/macos/Classes/BatteryPlusChargingHandler.swift rename to packages/battery_plus/battery_plus/macos/Classes/BatteryPlusChargingHandler.swift index b95bf76cf7..75df1928d7 100644 --- a/packages/battery_plus/battery_plus_macos/macos/Classes/BatteryPlusChargingHandler.swift +++ b/packages/battery_plus/battery_plus/macos/Classes/BatteryPlusChargingHandler.swift @@ -1,6 +1,6 @@ // // BatteryPlusChargingHandler.swift -// battery_plus_macos +// battery_plus // // Created by Neevash Ramdial on 08/09/2020. // @@ -8,35 +8,35 @@ import Foundation import FlutterMacOS class BatteryPlusChargingHandler: NSObject, FlutterStreamHandler { - + private var context: Int = 0 - + private var source: CFRunLoopSource? private var runLoop: CFRunLoop? private var eventSink: FlutterEventSink? - + func onListen(withArguments arguments: Any?, eventSink event: @escaping FlutterEventSink) -> FlutterError? { self.eventSink = event start() return nil } - + func onCancel(withArguments arguments: Any?) -> FlutterError? { stop() self.eventSink = nil return nil } - + func start() { // If there is an added loop, we remove it before adding a new one. stop() - + // Gets the initial battery status let initialStatus = getBatteryStatus() if let sink = self.eventSink { sink(initialStatus) } - + // Registers a run loop which is notified when the battery status changes let context = UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque()) source = IOPSNotificationCreateRunLoopSource({ (context) in @@ -47,35 +47,35 @@ class BatteryPlusChargingHandler: NSObject, FlutterStreamHandler { sink(status) } }, context).takeUnretainedValue() - + // Adds loop to source runLoop = RunLoop.current.getCFRunLoop() CFRunLoopAddSource(runLoop, source, .defaultMode) } - + func stop() { guard let runLoop = runLoop, let source = source else { return } CFRunLoopRemoveSource(runLoop, source, .defaultMode) } - + func getBatteryStatus()-> String { let powerSourceSnapshot = IOPSCopyPowerSourcesInfo().takeRetainedValue() let sources = IOPSCopyPowerSourcesList(powerSourceSnapshot).takeRetainedValue() as [CFTypeRef] - + // Desktops do not have battery sources and are always charging. if sources.isEmpty { return "charging" } let description = IOPSGetPowerSourceDescription(powerSourceSnapshot, sources[0]).takeUnretainedValue() as! [String: AnyObject] - + if let currentCapacity = description[kIOPSCurrentCapacityKey] as? Int { if currentCapacity >= 95 { return "full" } } - + // Returns nil when battery is discharging if let isCharging = (description[kIOPSPowerSourceStateKey] as? String) { if isCharging == kIOPSACPowerValue { diff --git a/packages/battery_plus/battery_plus_macos/macos/Classes/BatteryPlusMacosPlugin.swift b/packages/battery_plus/battery_plus/macos/Classes/BatteryPlusMacosPlugin.swift similarity index 100% rename from packages/battery_plus/battery_plus_macos/macos/Classes/BatteryPlusMacosPlugin.swift rename to packages/battery_plus/battery_plus/macos/Classes/BatteryPlusMacosPlugin.swift diff --git a/packages/battery_plus/battery_plus/macos/battery_plus.podspec b/packages/battery_plus/battery_plus/macos/battery_plus.podspec index 2efa3f7513..a60c11a034 100644 --- a/packages/battery_plus/battery_plus/macos/battery_plus.podspec +++ b/packages/battery_plus/battery_plus/macos/battery_plus.podspec @@ -1,21 +1,22 @@ # -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# Run `pod lib lint battery_plus_macos.podspec' to validate before publishing. # Pod::Spec.new do |s| s.name = 'battery_plus' s.version = '0.0.1' - s.summary = 'No-op implementation of the macos battery_plus to avoid build issues on macos' + s.summary = 'Flutter Battery Plus' s.description = <<-DESC - No-op implementation of the battery_plus plugin to avoid build issues on macos. -https://github.com/flutter/flutter/issues/46618 - DESC - s.homepage = 'https://github.com/fluttercommunity/plus_plugins/tree/master/packages/battery_plus' +A Flutter plugin for accessing information about the battery state(full, charging, discharging). + DESC + s.homepage = 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/battery_plus' s.license = { :file => '../LICENSE' } s.author = { 'Flutter Community' => 'authors@fluttercommunity.dev' } - s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' + s.source = { :path => 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/battery_plus' } + s.source_files = 'Classes/**/*' + s.dependency 'FlutterMacOS' - s.platform = :osx - s.osx.deployment_target = '10.11' + s.platform = :osx, '10.11' + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + s.swift_version = '5.0' end diff --git a/packages/battery_plus/battery_plus/pubspec.yaml b/packages/battery_plus/battery_plus/pubspec.yaml index 18752aee4d..1595f71258 100644 --- a/packages/battery_plus/battery_plus/pubspec.yaml +++ b/packages/battery_plus/battery_plus/pubspec.yaml @@ -14,31 +14,31 @@ flutter: ios: pluginClass: FLTBatteryPlusPlugin linux: - default_package: battery_plus_linux + dartPluginClass: BatteryPlusLinuxPlugin macos: - default_package: battery_plus_macos + pluginClass: BatteryPlusMacosPlugin web: - default_package: battery_plus_web + pluginClass: BatteryPlusWebPlugin + fileName: src/battery_plus_web.dart windows: - default_package: battery_plus_windows + pluginClass: BatteryPlusWindowsPlugin dependencies: flutter: sdk: flutter - meta: ^1.8.0 - + flutter_web_plugins: + sdk: flutter battery_plus_platform_interface: ^1.2.1 - battery_plus_linux: ^1.2.0 - battery_plus_macos: ^1.1.1 - battery_plus_web: ^1.1.0 - battery_plus_windows: ^1.1.3 + meta: ^1.8.0 + upower: ^0.7.0 dev_dependencies: flutter_test: sdk: flutter async: ^2.9.0 - plugin_platform_interface: ^2.1.3 flutter_lints: ^2.0.1 + mockito: ^5.2.0 + plugin_platform_interface: ^2.1.3 environment: sdk: ">=2.12.0 <3.0.0" diff --git a/packages/battery_plus/battery_plus_linux/test/battery_plus_linux_test.dart b/packages/battery_plus/battery_plus/test/battery_plus_linux_test.dart similarity index 84% rename from packages/battery_plus/battery_plus_linux/test/battery_plus_linux_test.dart rename to packages/battery_plus/battery_plus/test/battery_plus_linux_test.dart index 57b163a6bc..f8246a74f2 100644 --- a/packages/battery_plus/battery_plus_linux/test/battery_plus_linux_test.dart +++ b/packages/battery_plus/battery_plus/test/battery_plus_linux_test.dart @@ -1,8 +1,8 @@ -import 'package:battery_plus_linux/src/battery_plus_linux.dart'; +import 'package:battery_plus/src/battery_plus_linux.dart'; import 'package:battery_plus_platform_interface/battery_plus_platform_interface.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:flutter_test/flutter_test.dart'; import 'package:upower/upower.dart'; import 'battery_plus_linux_test.mocks.dart'; @@ -10,11 +10,11 @@ import 'battery_plus_linux_test.mocks.dart'; @GenerateMocks([UPowerClient, UPowerDevice]) void main() { test('registered instance', () { - BatteryPlusLinux.registerWith(); - expect(BatteryPlatform.instance, isA()); + BatteryPlusLinuxPlugin.registerWith(); + expect(BatteryPlatform.instance, isA()); }); test('battery level', () async { - final battery = BatteryPlusLinux(); + final battery = BatteryPlusLinuxPlugin(); battery.createClient = () { return createMockClient(percentage: 56.78); }; @@ -22,7 +22,7 @@ void main() { }); test('battery state', () async { - final battery = BatteryPlusLinux(); + final battery = BatteryPlusLinuxPlugin(); battery.createClient = () { return createMockClient(state: UPowerDeviceState.charging); }; @@ -30,7 +30,7 @@ void main() { }); test('battery state changes', () { - final battery = BatteryPlusLinux(); + final battery = BatteryPlusLinuxPlugin(); battery.createClient = () { final client = createMockClient(state: UPowerDeviceState.charging); final device = client.displayDevice; diff --git a/packages/battery_plus/battery_plus_linux/test/battery_plus_linux_test.mocks.dart b/packages/battery_plus/battery_plus/test/battery_plus_linux_test.mocks.dart similarity index 100% rename from packages/battery_plus/battery_plus_linux/test/battery_plus_linux_test.mocks.dart rename to packages/battery_plus/battery_plus/test/battery_plus_linux_test.mocks.dart diff --git a/packages/battery_plus/battery_plus_windows/windows/.gitignore b/packages/battery_plus/battery_plus/windows/.gitignore similarity index 100% rename from packages/battery_plus/battery_plus_windows/windows/.gitignore rename to packages/battery_plus/battery_plus/windows/.gitignore diff --git a/packages/battery_plus/battery_plus_windows/windows/CMakeLists.txt b/packages/battery_plus/battery_plus/windows/CMakeLists.txt similarity index 88% rename from packages/battery_plus/battery_plus_windows/windows/CMakeLists.txt rename to packages/battery_plus/battery_plus/windows/CMakeLists.txt index b954c0843e..b8f1d4096a 100644 --- a/packages/battery_plus/battery_plus_windows/windows/CMakeLists.txt +++ b/packages/battery_plus/battery_plus/windows/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.15) -set(PROJECT_NAME "battery_plus_windows") +set(PROJECT_NAME "battery_plus") project(${PROJECT_NAME} LANGUAGES CXX) set(PLUGIN_NAME "${PROJECT_NAME}_plugin") @@ -17,7 +17,7 @@ target_include_directories(${PLUGIN_NAME} INTERFACE target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) # List of absolute paths to libraries that should be bundled with the plugin -set(battery_plus_windows_bundled_libraries +set(battery_plus_bundled_libraries "" PARENT_SCOPE ) diff --git a/packages/battery_plus/battery_plus_windows/windows/battery_plus_windows_plugin.cpp b/packages/battery_plus/battery_plus/windows/battery_plus_plugin.cpp similarity index 97% rename from packages/battery_plus/battery_plus_windows/windows/battery_plus_windows_plugin.cpp rename to packages/battery_plus/battery_plus/windows/battery_plus_plugin.cpp index 0711a69c5e..868e584710 100644 --- a/packages/battery_plus/battery_plus_windows/windows/battery_plus_windows_plugin.cpp +++ b/packages/battery_plus/battery_plus/windows/battery_plus_plugin.cpp @@ -1,4 +1,4 @@ -#include "include/battery_plus_windows/battery_plus_windows_plugin.h" +#include "include/battery_plus/battery_plus_windows_plugin.h" #include #include @@ -11,7 +11,7 @@ #include #include -#include "include/battery_plus_windows/system_battery.h" +#include "include/battery_plus/system_battery.h" namespace { diff --git a/packages/battery_plus/battery_plus_windows/windows/include/battery_plus_windows/battery_plus_windows_plugin.h b/packages/battery_plus/battery_plus/windows/include/battery_plus/battery_plus_windows_plugin.h similarity index 80% rename from packages/battery_plus/battery_plus_windows/windows/include/battery_plus_windows/battery_plus_windows_plugin.h rename to packages/battery_plus/battery_plus/windows/include/battery_plus/battery_plus_windows_plugin.h index 3616cbcbab..9d8d922670 100644 --- a/packages/battery_plus/battery_plus_windows/windows/include/battery_plus_windows/battery_plus_windows_plugin.h +++ b/packages/battery_plus/battery_plus/windows/include/battery_plus/battery_plus_windows_plugin.h @@ -1,5 +1,5 @@ -#ifndef FLUTTER_PLUGIN_BATTERY_PLUS_WINDOWS_PLUGIN_H_ -#define FLUTTER_PLUGIN_BATTERY_PLUS_WINDOWS_PLUGIN_H_ +#ifndef FLUTTER_PLUGIN_BATTERY_PLUS_PLUGIN_H_ +#define FLUTTER_PLUGIN_BATTERY_PLUS_PLUGIN_H_ #include diff --git a/packages/battery_plus/battery_plus_windows/windows/include/battery_plus_windows/system_battery.h b/packages/battery_plus/battery_plus/windows/include/battery_plus/system_battery.h similarity index 100% rename from packages/battery_plus/battery_plus_windows/windows/include/battery_plus_windows/system_battery.h rename to packages/battery_plus/battery_plus/windows/include/battery_plus/system_battery.h diff --git a/packages/battery_plus/battery_plus_windows/windows/system_battery.cpp b/packages/battery_plus/battery_plus/windows/system_battery.cpp similarity index 98% rename from packages/battery_plus/battery_plus_windows/windows/system_battery.cpp rename to packages/battery_plus/battery_plus/windows/system_battery.cpp index 767c4849bd..b769196bea 100644 --- a/packages/battery_plus/battery_plus_windows/windows/system_battery.cpp +++ b/packages/battery_plus/battery_plus/windows/system_battery.cpp @@ -1,4 +1,4 @@ -#include "include/battery_plus_windows/system_battery.h" +#include "include/battery_plus/system_battery.h" #include diff --git a/packages/battery_plus/battery_plus_linux/.gitignore b/packages/battery_plus/battery_plus_linux/.gitignore deleted file mode 100644 index 1985397a2c..0000000000 --- a/packages/battery_plus/battery_plus_linux/.gitignore +++ /dev/null @@ -1,74 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -build/ - -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java - -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Flutter.podspec -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/Flutter/flutter_export_environment.sh -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* - -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 diff --git a/packages/battery_plus/battery_plus_linux/.metadata b/packages/battery_plus/battery_plus_linux/.metadata deleted file mode 100644 index 6b9d686e29..0000000000 --- a/packages/battery_plus/battery_plus_linux/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 34541c30735bc1086335e13d69a7e0acdc0538c5 - channel: master - -project_type: package diff --git a/packages/battery_plus/battery_plus_linux/CHANGELOG.md b/packages/battery_plus/battery_plus_linux/CHANGELOG.md deleted file mode 100644 index 58d77fd0ea..0000000000 --- a/packages/battery_plus/battery_plus_linux/CHANGELOG.md +++ /dev/null @@ -1,48 +0,0 @@ -## 1.2.0 - -- Port to upower.dart - -## 1.1.2 - -- Update dbus to 0.7.5 -- Update flutter_lints to 2.0.1 - -## 1.1.1 - -- Update dbus to 0.7.1 - -## 1.1.0 - -- Add batteryState getter - -## 1.0.4 - -- Update Flutter dependencies - -## 1.0.3 - -- Upgrade battery_plus_platform_interface dependency - -## 1.0.2 - -- Upgrade D-Bus package dependency - -## 1.0.1 - -- Improve documentation - -## 1.0.0 - -- Migrated to null safety. - -## 0.2.1 - -- Address pub score - -## 0.2.0 - -- Added "unknown" battery state for batteryless systems. - -## 0.1.0 - -- Initial Linux support. diff --git a/packages/battery_plus/battery_plus_linux/LICENSE b/packages/battery_plus/battery_plus_linux/LICENSE deleted file mode 100644 index 0c91662b3f..0000000000 --- a/packages/battery_plus/battery_plus_linux/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/battery_plus/battery_plus_linux/README.md b/packages/battery_plus/battery_plus_linux/README.md deleted file mode 100644 index 91445b0845..0000000000 --- a/packages/battery_plus/battery_plus_linux/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Battery Plus Linux - -[![Flutter Community: battery_plus_linux](https://fluttercommunity.dev/_github/header/battery_plus_linux)](https://github.com/fluttercommunity/community) - -[![pub package](https://img.shields.io/pub/v/battery_plus_linux.svg)](https://pub.dev/packages/battery_plus_linux) - -The Linux implementation of [`battery_plus`](https://pub.dev/packages/battery_plus). - -## Usage - -This package is already included as part of the `battery_plus` package dependency, and will -be included when using `battery_plus` as normal. diff --git a/packages/battery_plus/battery_plus_linux/lib/battery_plus_linux.dart b/packages/battery_plus/battery_plus_linux/lib/battery_plus_linux.dart deleted file mode 100644 index ef92387e89..0000000000 --- a/packages/battery_plus/battery_plus_linux/lib/battery_plus_linux.dart +++ /dev/null @@ -1,4 +0,0 @@ -/// The Linux implementation of `battery_plus`. -library battery_plus_linux; - -export 'src/battery_plus_linux.dart'; diff --git a/packages/battery_plus/battery_plus_linux/pubspec.yaml b/packages/battery_plus/battery_plus_linux/pubspec.yaml deleted file mode 100644 index a86d6a0ac3..0000000000 --- a/packages/battery_plus/battery_plus_linux/pubspec.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: battery_plus_linux -description: Linux implementation of the battery_plus plugin -homepage: https://plus.fluttercommunity.dev/ -repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/ -version: 1.2.0 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" - -dependencies: - flutter: - sdk: flutter - battery_plus_platform_interface: ^1.2.0 - meta: ^1.7.0 - upower: ^0.7.0 - -dev_dependencies: - flutter_test: - sdk: flutter - flutter_lints: ^2.0.1 - build_runner: ^2.1.11 - mockito: ^5.2.0 - -flutter: - plugin: - implements: battery_plus - platforms: - linux: - dartPluginClass: BatteryPlusLinux - pluginClass: none diff --git a/packages/battery_plus/battery_plus_macos/.gitignore b/packages/battery_plus/battery_plus_macos/.gitignore deleted file mode 100644 index e9dc58d3d6..0000000000 --- a/packages/battery_plus/battery_plus_macos/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store -.dart_tool/ - -.packages -.pub/ - -build/ diff --git a/packages/battery_plus/battery_plus_macos/.metadata b/packages/battery_plus/battery_plus_macos/.metadata deleted file mode 100644 index f66d8e501e..0000000000 --- a/packages/battery_plus/battery_plus_macos/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: cad4d1333eb70e66fe8e993b10fa09306a48269d - channel: master - -project_type: plugin diff --git a/packages/battery_plus/battery_plus_macos/CHANGELOG.md b/packages/battery_plus/battery_plus_macos/CHANGELOG.md deleted file mode 100644 index 5b84991d8b..0000000000 --- a/packages/battery_plus/battery_plus_macos/CHANGELOG.md +++ /dev/null @@ -1,31 +0,0 @@ -## 1.1.1 - -- Fix crash on Apple Mac mini - -## 1.1.0 - -- Add batteryState getter - -## 1.0.2 - -- Upgrade battery_plus_platform_interface dependency - -## 1.0.1 - -- Improve documentation - -## 1.0.0 - -- Migrated to null safety. - -## 0.2.1 - -- Address pub score - -## 0.2.0 - -- Added "unknown" battery state for batteryless systems. - -## 0.1.0 - -- Initial macOS release. diff --git a/packages/battery_plus/battery_plus_macos/LICENSE b/packages/battery_plus/battery_plus_macos/LICENSE deleted file mode 100644 index 0c91662b3f..0000000000 --- a/packages/battery_plus/battery_plus_macos/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/battery_plus/battery_plus_macos/README.md b/packages/battery_plus/battery_plus_macos/README.md deleted file mode 100644 index de54ca606b..0000000000 --- a/packages/battery_plus/battery_plus_macos/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Battery Plus macOS - -[![Flutter Community: battery_plus_macos](https://fluttercommunity.dev/_github/header/battery_plus_macos)](https://github.com/fluttercommunity/community) - -[![pub package](https://img.shields.io/pub/v/battery_plus_macos.svg)](https://pub.dev/packages/battery_plus_macos) - -The macOS implementation of [`battery_plus`](https://pub.dev/packages/battery_plus). - -## Usage - -This package is already included as part of the `battery_plus` package dependency, and will -be included when using `battery_plus` as normal. diff --git a/packages/battery_plus/battery_plus_macos/lib/battery_plus_macos.dart b/packages/battery_plus/battery_plus_macos/lib/battery_plus_macos.dart deleted file mode 100644 index efdd4c6d2e..0000000000 --- a/packages/battery_plus/battery_plus_macos/lib/battery_plus_macos.dart +++ /dev/null @@ -1,3 +0,0 @@ -// The battery_plus_platform_interface defaults to MethodChannelBattery -// as its instance, which is all the macOS implementation needs. This file -// is here to silence warnings when publishing to pub. diff --git a/packages/battery_plus/battery_plus_macos/macos/battery_plus_macos.podspec b/packages/battery_plus/battery_plus_macos/macos/battery_plus_macos.podspec deleted file mode 100644 index 86e36d69a0..0000000000 --- a/packages/battery_plus/battery_plus_macos/macos/battery_plus_macos.podspec +++ /dev/null @@ -1,22 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint battery_plus_macos.podspec' to validate before publishing. -# -Pod::Spec.new do |s| - s.name = 'battery_plus_macos' - s.version = '0.0.1' - s.summary = 'Flutter Battery Plus' - s.description = <<-DESC -A Flutter plugin for accessing information about the battery state(full, charging, discharging). - DESC - s.homepage = 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/battery_plus_macos' - s.license = { :file => '../LICENSE' } - s.author = { 'Flutter Community' => 'authors@fluttercommunity.dev' } - s.source = { :path => 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/battery_plus_macos' } - s.source_files = 'Classes/**/*' - s.dependency 'FlutterMacOS' - - s.platform = :osx, '10.11' - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } - s.swift_version = '5.0' -end diff --git a/packages/battery_plus/battery_plus_macos/pubspec.yaml b/packages/battery_plus/battery_plus_macos/pubspec.yaml deleted file mode 100644 index 986aff43d3..0000000000 --- a/packages/battery_plus/battery_plus_macos/pubspec.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: battery_plus_macos -description: An implementation for the macos platform of the Flutter `battery_plus` plugin. -homepage: https://plus.fluttercommunity.dev/ -repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/ -version: 1.1.1 - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" - -dependencies: - battery_plus_platform_interface: ^1.2.0 - flutter: - sdk: flutter - -dev_dependencies: - flutter_test: - sdk: flutter - -flutter: - plugin: - platforms: - macos: - pluginClass: BatteryPlusMacosPlugin diff --git a/packages/battery_plus/battery_plus_web/.gitignore b/packages/battery_plus/battery_plus_web/.gitignore deleted file mode 100644 index 88ce490e47..0000000000 --- a/packages/battery_plus/battery_plus_web/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -.DS_Store -.atom/ -.idea/ -.vscode/ - -.packages -.pub/ -.dart_tool/ -pubspec.lock -flutter_export_environment.sh - -examples/all_plugins/pubspec.yaml - -Podfile -Podfile.lock -Pods/ -.symlinks/ -**/Flutter/App.framework/ -**/Flutter/ephemeral/ -**/Flutter/Flutter.framework/ -**/Flutter/Generated.xcconfig -**/Flutter/flutter_assets/ - -ServiceDefinitions.json -xcuserdata/ -**/DerivedData/ - -local.properties -keystore.properties -.gradle/ -gradlew -gradlew.bat -gradle-wrapper.jar -.flutter-plugins-dependencies -*.iml - -generated_plugin_registrant.dart -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m -GeneratedPluginRegistrant.java -GeneratedPluginRegistrant.swift -build/ -.flutter-plugins - -.project -.classpath -.settings diff --git a/packages/battery_plus/battery_plus_web/.metadata b/packages/battery_plus/battery_plus_web/.metadata deleted file mode 100644 index 51d042aadc..0000000000 --- a/packages/battery_plus/battery_plus_web/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 81a45ec2e5f80fa71d5135f1702ce540558b416d - channel: beta - -project_type: package diff --git a/packages/battery_plus/battery_plus_web/CHANGELOG.md b/packages/battery_plus/battery_plus_web/CHANGELOG.md deleted file mode 100644 index ebaa02b014..0000000000 --- a/packages/battery_plus/battery_plus_web/CHANGELOG.md +++ /dev/null @@ -1,35 +0,0 @@ -## 1.1.0 - -- Add batteryState getter - -## 1.0.2 - -- Upgrade battery_plus_platform_interface dependency - -## 1.0.1 - -- Improve documentation - -## 1.0.0 - -- Migrated to null safety - -## 0.3.1 - -- Address pub score - -## 0.3.0 - -- Added "unknown" battery state for batteryless systems. - -## 0.2.0 - -- Rename method channel to avoid conflicts - -## 0.1.0 - -- Transfer to plus-plugins monorepo - -## 0.0.1 - -- initial release. diff --git a/packages/battery_plus/battery_plus_web/LICENSE b/packages/battery_plus/battery_plus_web/LICENSE deleted file mode 100644 index c89293372c..0000000000 --- a/packages/battery_plus/battery_plus_web/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/battery_plus/battery_plus_web/README.md b/packages/battery_plus/battery_plus_web/README.md deleted file mode 100644 index 77d12d0602..0000000000 --- a/packages/battery_plus/battery_plus_web/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Battery Plus Web - -[![Flutter Community: battery_plus_web](https://fluttercommunity.dev/_github/header/battery_plus_web)](https://github.com/fluttercommunity/community) - -[![pub package](https://img.shields.io/pub/v/battery_plus_web.svg)](https://pub.dev/packages/battery_plus_web) - -The Web implementation of [`battery_plus`](https://pub.dev/packages/battery_plus). - -## Usage - -This package is already included as part of the `battery_plus` package dependency, and will -be included when using `battery_plus` as normal. diff --git a/packages/battery_plus/battery_plus_web/pubspec.yaml b/packages/battery_plus/battery_plus_web/pubspec.yaml deleted file mode 100644 index 6dd2f7ea69..0000000000 --- a/packages/battery_plus/battery_plus_web/pubspec.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: battery_plus_web -description: An implementation for the web platform of the Flutter `battery_plus` plugin. -version: 1.1.0 -homepage: https://plus.fluttercommunity.dev/ -repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/ - -flutter: - plugin: - platforms: - web: - pluginClass: BatteryPlusPlugin - fileName: battery_plus_web.dart - -dependencies: - battery_plus_platform_interface: ^1.2.0 - flutter_web_plugins: - sdk: flutter - flutter: - sdk: flutter - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" diff --git a/packages/battery_plus/battery_plus_windows/CHANGELOG.md b/packages/battery_plus/battery_plus_windows/CHANGELOG.md deleted file mode 100644 index 4b8afe39c6..0000000000 --- a/packages/battery_plus/battery_plus_windows/CHANGELOG.md +++ /dev/null @@ -1,39 +0,0 @@ -## 1.1.3 - -- Reapply the changes in 1.1.1 (no compile issues in this package). - -## 1.1.2 - -- Revert changes in 1.1.1 due to compile issues - -## 1.1.1 - -- Fixes a crash when adding a listener to a destroyed channel - -## 1.1.0 - -- Add batteryState getter - -## 1.0.2 - -- Upgrade battery_plus_platform_interface dependency - -## 1.0.1 - -- Improve documentation - -## 1.0.0 - -- Migrated to null safety - -## 0.2.1 - -- Address pub score - -## 0.2.0 - -- Added "unknown" battery state for batteryless systems. - -## 0.1.0 - -- Initial Windows support. diff --git a/packages/battery_plus/battery_plus_windows/LICENSE b/packages/battery_plus/battery_plus_windows/LICENSE deleted file mode 100644 index 0c91662b3f..0000000000 --- a/packages/battery_plus/battery_plus_windows/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/battery_plus/battery_plus_windows/README.md b/packages/battery_plus/battery_plus_windows/README.md deleted file mode 100644 index 72f6fc77dd..0000000000 --- a/packages/battery_plus/battery_plus_windows/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Battery Plus Windows - -[![Flutter Community: battery_plus_windows](https://fluttercommunity.dev/_github/header/battery_plus_windows)](https://github.com/fluttercommunity/community) - -[![pub package](https://img.shields.io/pub/v/battery_plus_windows.svg)](https://pub.dev/packages/battery_plus_windows) - -The Windows implementation of [`battery_plus`](https://pub.dev/packages/battery_plus). - -## Usage - -This package is already included as part of the `battery_plus` package dependency, and will -be included when using `battery_plus` as normal. diff --git a/packages/battery_plus/battery_plus_windows/lib/battery_plus_windows.dart b/packages/battery_plus/battery_plus_windows/lib/battery_plus_windows.dart deleted file mode 100644 index 1d7a9b5ddb..0000000000 --- a/packages/battery_plus/battery_plus_windows/lib/battery_plus_windows.dart +++ /dev/null @@ -1,3 +0,0 @@ -// The battery_plus_platform_interface defaults to MethodChannelBattery -// as its instance, which is all the Windows implementation needs. This file -// is here to silence warnings when publishing to pub. diff --git a/packages/battery_plus/battery_plus_windows/pubspec.yaml b/packages/battery_plus/battery_plus_windows/pubspec.yaml deleted file mode 100644 index 89b0f9c6ec..0000000000 --- a/packages/battery_plus/battery_plus_windows/pubspec.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: battery_plus_windows -description: Windows implementation of the battery_plus plugin -version: 1.1.3 -homepage: https://plus.fluttercommunity.dev/ -repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/ - -environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" - -dependencies: - battery_plus_platform_interface: ^1.2.0 - flutter: - sdk: flutter - -dev_dependencies: - flutter_test: - sdk: flutter - -flutter: - plugin: - platforms: - windows: - pluginClass: BatteryPlusWindowsPlugin