Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
flutter_wakelock
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
creativecreatorormaybenot
2020-03-22 12:42:38 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2020-03-22 12:42:38 +0000
Commit
d34058c35ca8bc3656382062daa3c3852c905060
d34058c3
1 parent
5983a6a1
0.1.4+1 (#24)
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
14 deletions
.github/workflows/checks.yml
.github/workflows/publish.yml
CHANGELOG.md
android/src/main/kotlin/creativecreatorormaybenot/wakelock/WakelockPlugin.kt
pubspec.yaml
.github/workflows/checks.yml
View file @
d34058c
...
...
@@ -57,7 +57,7 @@ jobs:
-
'
stable'
-
'
beta'
-
'
dev'
fail-fast
:
tru
e
fail-fast
:
fals
e
steps
:
-
name
:
Start iOS simulator
...
...
@@ -87,12 +87,12 @@ jobs:
-
name
:
Run unit tests
run
:
flutter test
- name
:
Run integration tests on iOS
if
:
contains(matrix.device, 'iPhone')
if
:
contains(matrix.device, 'iPhone')
&& false
# Need to run locally for now.
run
:
|
cd example
flutter drive --target=test_driver/app.dart
-
name
:
Run integration tests on Android
if
:
contains(matrix.device, 'Android')
&& false
# Run these locally for now.
if
:
contains(matrix.device, 'Android')
uses
:
reactivecircus/android-emulator-runner@v2.5.0
with
:
api-level
:
29
...
...
.github/workflows/publish.yml
View file @
d34058c
...
...
@@ -29,7 +29,7 @@ jobs:
- name
:
Run unit tests
run
:
flutter test
- name
:
Run integration tests on Android
if
:
false
#
Run these
locally for now.
if
:
false
#
Need to run
locally for now.
uses
:
reactivecircus/android-emulator-runner@v2.5.0
with
:
api-level
:
29
...
...
CHANGELOG.md
View file @
d34058c
## 0.1.4+1
*
Finished migration to new Flutter plugin embedding.
*
Fixed missing activity on Android for apps using the old plugin embedding.
*
Lowered Flutter SDK version constraint to
`1.12.0`
.
## 0.1.4
*
Added assertion for
`on` in `Wakelock.toggle` to be non-null and `@required`
annotation.
...
...
android/src/main/kotlin/creativecreatorormaybenot/wakelock/WakelockPlugin.kt
View file @
d34058c
...
...
@@ -16,9 +16,11 @@ public class WakelockPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "wakelock")
channel.setMethodCallHandler(this)
setup
()
wakelock = Wakelock
()
}
private var registrar: Registrar? = null
// This static function is optional and equivalent to onAttachedToEngine. It supports the old
// pre-Flutter-1.12 Android projects. You are encouraged to continue supporting
// plugin registration via this function while apps migrate to use the new Android APIs
...
...
@@ -33,34 +35,34 @@ public class WakelockPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
fun registerWith(registrar: Registrar) {
val channel = MethodChannel(registrar.messenger(), "wakelock")
val plugin = WakelockPlugin()
plugin.registrar = registrar
plugin.wakelock = Wakelock()
channel.setMethodCallHandler(plugin)
plugin.setup()
}
}
private var wakelock: Wakelock? = null
private fun setup() {
wakelock = Wakelock()
}
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
if (registrar != null) wakelock!!.activity = registrar!!.activity()
when (call.method) {
"toggle" -> {
wakelock
?
.toggle(call.argument<Boolean>("enable")!!, result)
wakelock
!!
.toggle(call.argument<Boolean>("enable")!!, result)
}
"isEnabled" -> {
wakelock
?
.isEnabled(result)
wakelock
!!
.isEnabled(result)
}
else -> {
result.notImplemented()
}
}
if (registrar != null) wakelock!!.activity = null
}
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
channel.setMethodCallHandler(null)
wakelock = null
registrar = null
}
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
...
...
pubspec.yaml
View file @
d34058c
name
:
wakelock
description
:
This plugin allows you to keep Android and iOS devices awake, i.e. prevent the screen from sleeping by toggling the wakelock of the device on or off.
version
:
0.1.4
version
:
0.1.4
+1
homepage
:
https://github.com/creativecreatorormaybenot/wakelock
environment
:
sdk
:
"
>=2.7.0
<3.0.0"
flutter
:
"
>=1.12.
13+hotfix.8
<2.0.0"
flutter
:
"
>=1.12.
0
<2.0.0"
dependencies
:
flutter
:
...
...
Please
register
or
login
to post a comment