Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(battery_plus)!: platform implementation refactor into a single package #1169

Merged
merged 29 commits into from Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e40d37c
unfederate battery_plus_linux
miquelbeltran Oct 5, 2022
d41abcc
unfederate battery_plus_macos
miquelbeltran Oct 5, 2022
5fd724f
unfederate battery_plus_web
miquelbeltran Oct 5, 2022
76604bc
unfederate battery_plus_windows
miquelbeltran Oct 5, 2022
1357c3a
Unfederate the platform interface
miquelbeltran Oct 5, 2022
b8a94a9
move all files one dir below
miquelbeltran Oct 5, 2022
8739d55
fix dependency
miquelbeltran Oct 5, 2022
ffc60c7
bump version
miquelbeltran Oct 5, 2022
281a2d6
add missing flutter_web_plugins
miquelbeltran Oct 5, 2022
20b02b7
windows naming fix
miquelbeltran Oct 5, 2022
9ca606a
Fix windows build
miquelbeltran Oct 6, 2022
27e5143
Move battery_plus_web.dart to src folder
miquelbeltran Oct 6, 2022
fee455a
remove pluginClass: none
miquelbeltran Oct 6, 2022
868a15a
moving all files to src
miquelbeltran Oct 6, 2022
32af1d3
export platform interface
miquelbeltran Oct 6, 2022
e936a4d
remove unnecessary import
miquelbeltran Oct 6, 2022
17eb4ed
cleanup
miquelbeltran Oct 6, 2022
47cc155
sort imports
miquelbeltran Oct 6, 2022
0f1dd77
move battery_plus_platform_interface.dart to root
miquelbeltran Oct 6, 2022
d622afd
export enums directly instead of the battery_plus_platform_interface
miquelbeltran Oct 6, 2022
66ef252
rename BatteryPlusWebPlugin
miquelbeltran Oct 6, 2022
92e12f9
renamed BatteryPlusLinux to BatteryPlusLinuxPlugin for consistency
miquelbeltran Oct 6, 2022
d695aaf
move battery_plus into battery_plus
miquelbeltran Oct 6, 2022
5139ab6
re-add battery_plus_platform_interface
miquelbeltran Oct 6, 2022
5d9e504
fix battery_plus dependency to the platform interface
miquelbeltran Oct 6, 2022
0a18675
typo
miquelbeltran Oct 6, 2022
1a69268
format
miquelbeltran Oct 6, 2022
6c51388
remove new line from changelog, let's try melos release process
miquelbeltran Oct 6, 2022
3395fcd
revert forcing package version
miquelbeltran Oct 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/battery_plus/battery_plus/lib/battery_plus.dart
Expand Up @@ -4,10 +4,12 @@

import 'dart:async';

import 'battery_plus_platform_interface.dart';
import 'package:battery_plus_platform_interface/battery_plus_platform_interface.dart';

export 'package:battery_plus_platform_interface/battery_plus_platform_interface.dart'
show BatteryState;

export 'src/battery_plus_linux.dart';
export 'src/enums.dart';

/// API for accessing information about the battery of the device the Flutter app is running on.
class Battery {
Expand Down Expand Up @@ -37,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.
Copy link
Member

Choose a reason for hiding this comment

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

Since we're fixing typos, iOS would be better

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't let it go, been seeing the typo the whole day 😂

Copy link
Member

Choose a reason for hiding this comment

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

That's the spirit!

Future<bool> get isInBatterySaveMode {
return _platform.isInBatterySaveMode;
}
Expand Down

This file was deleted.

@@ -1,10 +1,9 @@
import 'dart:async';

import 'package:battery_plus_platform_interface/battery_plus_platform_interface.dart';
import 'package:meta/meta.dart';
import 'package:upower/upower.dart';

import '../battery_plus_platform_interface.dart';

extension _ToBatteryState on UPowerDeviceState {
BatteryState toBatteryState() {
switch (this) {
Expand Down

This file was deleted.

Expand Up @@ -2,9 +2,9 @@ import 'dart:async';
import 'dart:html' as html show window, BatteryManager, Navigator;
import 'dart:js';
import 'dart:js_util';
import 'package:battery_plus_platform_interface/battery_plus_platform_interface.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';

import '../battery_plus_platform_interface.dart';

/// The web implementation of the BatteryPlatform of the Battery plugin.
class BatteryPlusWebPlugin extends BatteryPlatform {
Expand Down
14 changes: 0 additions & 14 deletions packages/battery_plus/battery_plus/lib/src/enums.dart

This file was deleted.

17 changes: 0 additions & 17 deletions packages/battery_plus/battery_plus/lib/src/utils.dart

This file was deleted.

3 changes: 2 additions & 1 deletion packages/battery_plus/battery_plus/pubspec.yaml
Expand Up @@ -28,16 +28,17 @@ dependencies:
sdk: flutter
flutter_web_plugins:
sdk: flutter
battery_plus_platform_interface: 1.2.1
Copy link
Member Author

Choose a reason for hiding this comment

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

as decided, the platform_interface is going to be referenced by exact version, not by "^"

meta: ^1.8.0
upower: ^0.7.0
plugin_platform_interface: ^2.1.3

dev_dependencies:
flutter_test:
sdk: flutter
async: ^2.9.0
flutter_lints: ^2.0.1
mockito: ^5.2.0
plugin_platform_interface: ^2.1.3

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down
@@ -1,5 +1,5 @@
import 'package:battery_plus/src/battery_plus_linux.dart';
import 'package:battery_plus/battery_plus_platform_interface.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';
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion packages/battery_plus/battery_plus/test/battery_test.dart
Expand Up @@ -6,7 +6,7 @@ import 'dart:async';

import 'package:async/async.dart';
import 'package:battery_plus/battery_plus.dart';
import 'package:battery_plus/battery_plus_platform_interface.dart';
import 'package:battery_plus_platform_interface/battery_plus_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

Expand Down