forked from flutter-tizen/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wakelock] Refactor and simplify the implementation (flutter-tizen#583)
- Loading branch information
Showing
7 changed files
with
89 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2023 Samsung Electronics Co., Ltd. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:flutter/services.dart'; | ||
import 'package:wakelock_platform_interface/wakelock_platform_interface.dart'; | ||
|
||
const MethodChannel _channel = MethodChannel('tizen/wakelock_plugin'); | ||
|
||
/// A Tizen implementation of [WakelockPlatformInterface]. | ||
class WakelockTizen extends WakelockPlatformInterface { | ||
/// Registers this class as the default platform implementation. | ||
static void register() { | ||
WakelockPlatformInterface.instance = WakelockTizen(); | ||
} | ||
|
||
@override | ||
Future<void> toggle({required bool enable}) async { | ||
await _channel.invokeMethod<void>('toggle', enable); | ||
} | ||
|
||
@override | ||
Future<bool> get enabled async => | ||
await _channel.invokeMethod<bool>('isEnabled') ?? false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters