Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Autogenerated from Pigeon (v21.2.0), do not edit directly.
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")


import android.util.Log
import io.flutter.plugin.common.BasicMessageChannel
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.MessageCodec
import io.flutter.plugin.common.StandardMethodCodec
import io.flutter.plugin.common.StandardMessageCodec
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer
Expand Down Expand Up @@ -86,7 +88,7 @@ data class IsEnabledMessage (
)
}
}
private object WakelockPlusMessagesPigeonCodec : StandardMessageCodec() {
private open class WakelockPlusMessagesPigeonCodec : StandardMessageCodec() {
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
return when (type) {
129.toByte() -> {
Expand Down Expand Up @@ -125,7 +127,7 @@ interface WakelockPlusApi {
companion object {
/** The codec used by WakelockPlusApi. */
val codec: MessageCodec<Any?> by lazy {
WakelockPlusMessagesPigeonCodec
WakelockPlusMessagesPigeonCodec()
}
/** Sets up an instance of `WakelockPlusApi` to handle messages through the `binaryMessenger`. */
@JvmOverloads
Expand Down
6 changes: 3 additions & 3 deletions wakelock_plus/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
wakelock_plus: 373cfe59b235a6dd5837d0fb88791d2f13a90d56

PODFILE CHECKSUM: beab77b38961de946f08660e554f80ac174dc842

COCOAPODS: 1.15.2
COCOAPODS: 1.16.1
10 changes: 5 additions & 5 deletions wakelock_plus/ios/Classes/WakelockPlusPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#import "messages.g.h"
#import "UIApplication+idleTimerLock.h"

@interface WakelockPlusPlugin () <FLTWakelockPlusApi>
@interface WakelockPlusPlugin () <WAKELOCKPLUSWakelockPlusApi>

@property (nonatomic, assign) BOOL enable;

Expand All @@ -11,10 +11,10 @@ @interface WakelockPlusPlugin () <FLTWakelockPlusApi>
@implementation WakelockPlusPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
WakelockPlusPlugin* instance = [[WakelockPlusPlugin alloc] init];
SetUpFLTWakelockPlusApi(registrar.messenger, instance);
SetUpWAKELOCKPLUSWakelockPlusApi(registrar.messenger, instance);
}

- (void)toggleMsg:(FLTToggleMessage*)input error:(FlutterError**)error {
- (void)toggleMsg:(WAKELOCKPLUSToggleMessage*)input error:(FlutterError**)error {
BOOL enable = [input.enable boolValue];
if (!enable) {
[[UIApplication sharedApplication] lock_idleTimerlockEnable:enable];//should disable first
Expand All @@ -34,9 +34,9 @@ - (void)setIdleTimerDisabled:(BOOL)enable {
}


- (FLTIsEnabledMessage*)isEnabledWithError:(FlutterError* __autoreleasing *)error {
- (WAKELOCKPLUSIsEnabledMessage*)isEnabledWithError:(FlutterError* __autoreleasing *)error {
NSNumber *enabled = [NSNumber numberWithBool:[[UIApplication sharedApplication] isIdleTimerDisabled]];
FLTIsEnabledMessage* result = [[FLTIsEnabledMessage alloc] init];
WAKELOCKPLUSIsEnabledMessage* result = [[WAKELOCKPLUSIsEnabledMessage alloc] init];
result.enabled = enabled;
return result;
}
Expand Down
22 changes: 11 additions & 11 deletions wakelock_plus/ios/Classes/messages.g.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Autogenerated from Pigeon (v21.2.0), do not edit directly.
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import <Foundation/Foundation.h>
Expand All @@ -10,32 +10,32 @@

NS_ASSUME_NONNULL_BEGIN

@class FLTToggleMessage;
@class FLTIsEnabledMessage;
@class WAKELOCKPLUSToggleMessage;
@class WAKELOCKPLUSIsEnabledMessage;

/// Message for toggling the wakelock on the platform side.
@interface FLTToggleMessage : NSObject
@interface WAKELOCKPLUSToggleMessage : NSObject
+ (instancetype)makeWithEnable:(nullable NSNumber *)enable;
@property(nonatomic, strong, nullable) NSNumber * enable;
@end

/// Message for reporting the wakelock state from the platform side.
@interface FLTIsEnabledMessage : NSObject
@interface WAKELOCKPLUSIsEnabledMessage : NSObject
+ (instancetype)makeWithEnabled:(nullable NSNumber *)enabled;
@property(nonatomic, strong, nullable) NSNumber * enabled;
@end

/// The codec used by all APIs.
NSObject<FlutterMessageCodec> *FLTGetMessagesCodec(void);
NSObject<FlutterMessageCodec> *WAKELOCKPLUSGetMessagesCodec(void);

@protocol FLTWakelockPlusApi
- (void)toggleMsg:(FLTToggleMessage *)msg error:(FlutterError *_Nullable *_Nonnull)error;
@protocol WAKELOCKPLUSWakelockPlusApi
- (void)toggleMsg:(WAKELOCKPLUSToggleMessage *)msg error:(FlutterError *_Nullable *_Nonnull)error;
/// @return `nil` only when `error != nil`.
- (nullable FLTIsEnabledMessage *)isEnabledWithError:(FlutterError *_Nullable *_Nonnull)error;
- (nullable WAKELOCKPLUSIsEnabledMessage *)isEnabledWithError:(FlutterError *_Nullable *_Nonnull)error;
@end

extern void SetUpFLTWakelockPlusApi(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FLTWakelockPlusApi> *_Nullable api);
extern void SetUpWAKELOCKPLUSWakelockPlusApi(id<FlutterBinaryMessenger> binaryMessenger, NSObject<WAKELOCKPLUSWakelockPlusApi> *_Nullable api);

extern void SetUpFLTWakelockPlusApiWithSuffix(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FLTWakelockPlusApi> *_Nullable api, NSString *messageChannelSuffix);
extern void SetUpWAKELOCKPLUSWakelockPlusApiWithSuffix(id<FlutterBinaryMessenger> binaryMessenger, NSObject<WAKELOCKPLUSWakelockPlusApi> *_Nullable api, NSString *messageChannelSuffix);

NS_ASSUME_NONNULL_END
84 changes: 42 additions & 42 deletions wakelock_plus/ios/Classes/messages.g.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Autogenerated from Pigeon (v21.2.0), do not edit directly.
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import "messages.g.h"
Expand Down Expand Up @@ -27,31 +27,31 @@ static id GetNullableObjectAtIndex(NSArray<id> *array, NSInteger key) {
return (result == [NSNull null]) ? nil : result;
}

@interface FLTToggleMessage ()
+ (FLTToggleMessage *)fromList:(NSArray<id> *)list;
+ (nullable FLTToggleMessage *)nullableFromList:(NSArray<id> *)list;
@interface WAKELOCKPLUSToggleMessage ()
+ (WAKELOCKPLUSToggleMessage *)fromList:(NSArray<id> *)list;
+ (nullable WAKELOCKPLUSToggleMessage *)nullableFromList:(NSArray<id> *)list;
- (NSArray<id> *)toList;
@end

@interface FLTIsEnabledMessage ()
+ (FLTIsEnabledMessage *)fromList:(NSArray<id> *)list;
+ (nullable FLTIsEnabledMessage *)nullableFromList:(NSArray<id> *)list;
@interface WAKELOCKPLUSIsEnabledMessage ()
+ (WAKELOCKPLUSIsEnabledMessage *)fromList:(NSArray<id> *)list;
+ (nullable WAKELOCKPLUSIsEnabledMessage *)nullableFromList:(NSArray<id> *)list;
- (NSArray<id> *)toList;
@end

@implementation FLTToggleMessage
@implementation WAKELOCKPLUSToggleMessage
+ (instancetype)makeWithEnable:(nullable NSNumber *)enable {
FLTToggleMessage* pigeonResult = [[FLTToggleMessage alloc] init];
WAKELOCKPLUSToggleMessage* pigeonResult = [[WAKELOCKPLUSToggleMessage alloc] init];
pigeonResult.enable = enable;
return pigeonResult;
}
+ (FLTToggleMessage *)fromList:(NSArray<id> *)list {
FLTToggleMessage *pigeonResult = [[FLTToggleMessage alloc] init];
+ (WAKELOCKPLUSToggleMessage *)fromList:(NSArray<id> *)list {
WAKELOCKPLUSToggleMessage *pigeonResult = [[WAKELOCKPLUSToggleMessage alloc] init];
pigeonResult.enable = GetNullableObjectAtIndex(list, 0);
return pigeonResult;
}
+ (nullable FLTToggleMessage *)nullableFromList:(NSArray<id> *)list {
return (list) ? [FLTToggleMessage fromList:list] : nil;
+ (nullable WAKELOCKPLUSToggleMessage *)nullableFromList:(NSArray<id> *)list {
return (list) ? [WAKELOCKPLUSToggleMessage fromList:list] : nil;
}
- (NSArray<id> *)toList {
return @[
Expand All @@ -60,19 +60,19 @@ + (nullable FLTToggleMessage *)nullableFromList:(NSArray<id> *)list {
}
@end

@implementation FLTIsEnabledMessage
@implementation WAKELOCKPLUSIsEnabledMessage
+ (instancetype)makeWithEnabled:(nullable NSNumber *)enabled {
FLTIsEnabledMessage* pigeonResult = [[FLTIsEnabledMessage alloc] init];
WAKELOCKPLUSIsEnabledMessage* pigeonResult = [[WAKELOCKPLUSIsEnabledMessage alloc] init];
pigeonResult.enabled = enabled;
return pigeonResult;
}
+ (FLTIsEnabledMessage *)fromList:(NSArray<id> *)list {
FLTIsEnabledMessage *pigeonResult = [[FLTIsEnabledMessage alloc] init];
+ (WAKELOCKPLUSIsEnabledMessage *)fromList:(NSArray<id> *)list {
WAKELOCKPLUSIsEnabledMessage *pigeonResult = [[WAKELOCKPLUSIsEnabledMessage alloc] init];
pigeonResult.enabled = GetNullableObjectAtIndex(list, 0);
return pigeonResult;
}
+ (nullable FLTIsEnabledMessage *)nullableFromList:(NSArray<id> *)list {
return (list) ? [FLTIsEnabledMessage fromList:list] : nil;
+ (nullable WAKELOCKPLUSIsEnabledMessage *)nullableFromList:(NSArray<id> *)list {
return (list) ? [WAKELOCKPLUSIsEnabledMessage fromList:list] : nil;
}
- (NSArray<id> *)toList {
return @[
Expand All @@ -81,29 +81,29 @@ + (nullable FLTIsEnabledMessage *)nullableFromList:(NSArray<id> *)list {
}
@end

@interface FLTMessagesPigeonCodecReader : FlutterStandardReader
@interface WAKELOCKPLUSMessagesPigeonCodecReader : FlutterStandardReader
@end
@implementation FLTMessagesPigeonCodecReader
@implementation WAKELOCKPLUSMessagesPigeonCodecReader
- (nullable id)readValueOfType:(UInt8)type {
switch (type) {
case 129:
return [FLTToggleMessage fromList:[self readValue]];
return [WAKELOCKPLUSToggleMessage fromList:[self readValue]];
case 130:
return [FLTIsEnabledMessage fromList:[self readValue]];
return [WAKELOCKPLUSIsEnabledMessage fromList:[self readValue]];
default:
return [super readValueOfType:type];
}
}
@end

@interface FLTMessagesPigeonCodecWriter : FlutterStandardWriter
@interface WAKELOCKPLUSMessagesPigeonCodecWriter : FlutterStandardWriter
@end
@implementation FLTMessagesPigeonCodecWriter
@implementation WAKELOCKPLUSMessagesPigeonCodecWriter
- (void)writeValue:(id)value {
if ([value isKindOfClass:[FLTToggleMessage class]]) {
if ([value isKindOfClass:[WAKELOCKPLUSToggleMessage class]]) {
[self writeByte:129];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FLTIsEnabledMessage class]]) {
} else if ([value isKindOfClass:[WAKELOCKPLUSIsEnabledMessage class]]) {
[self writeByte:130];
[self writeValue:[value toList]];
} else {
Expand All @@ -112,43 +112,43 @@ - (void)writeValue:(id)value {
}
@end

@interface FLTMessagesPigeonCodecReaderWriter : FlutterStandardReaderWriter
@interface WAKELOCKPLUSMessagesPigeonCodecReaderWriter : FlutterStandardReaderWriter
@end
@implementation FLTMessagesPigeonCodecReaderWriter
@implementation WAKELOCKPLUSMessagesPigeonCodecReaderWriter
- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data {
return [[FLTMessagesPigeonCodecWriter alloc] initWithData:data];
return [[WAKELOCKPLUSMessagesPigeonCodecWriter alloc] initWithData:data];
}
- (FlutterStandardReader *)readerWithData:(NSData *)data {
return [[FLTMessagesPigeonCodecReader alloc] initWithData:data];
return [[WAKELOCKPLUSMessagesPigeonCodecReader alloc] initWithData:data];
}
@end

NSObject<FlutterMessageCodec> *FLTGetMessagesCodec(void) {
NSObject<FlutterMessageCodec> *WAKELOCKPLUSGetMessagesCodec(void) {
static FlutterStandardMessageCodec *sSharedObject = nil;
static dispatch_once_t sPred = 0;
dispatch_once(&sPred, ^{
FLTMessagesPigeonCodecReaderWriter *readerWriter = [[FLTMessagesPigeonCodecReaderWriter alloc] init];
WAKELOCKPLUSMessagesPigeonCodecReaderWriter *readerWriter = [[WAKELOCKPLUSMessagesPigeonCodecReaderWriter alloc] init];
sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter];
});
return sSharedObject;
}
void SetUpFLTWakelockPlusApi(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FLTWakelockPlusApi> *api) {
SetUpFLTWakelockPlusApiWithSuffix(binaryMessenger, api, @"");
void SetUpWAKELOCKPLUSWakelockPlusApi(id<FlutterBinaryMessenger> binaryMessenger, NSObject<WAKELOCKPLUSWakelockPlusApi> *api) {
SetUpWAKELOCKPLUSWakelockPlusApiWithSuffix(binaryMessenger, api, @"");
}

void SetUpFLTWakelockPlusApiWithSuffix(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FLTWakelockPlusApi> *api, NSString *messageChannelSuffix) {
void SetUpWAKELOCKPLUSWakelockPlusApiWithSuffix(id<FlutterBinaryMessenger> binaryMessenger, NSObject<WAKELOCKPLUSWakelockPlusApi> *api, NSString *messageChannelSuffix) {
messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @"";
{
FlutterBasicMessageChannel *channel =
[[FlutterBasicMessageChannel alloc]
initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle", messageChannelSuffix]
binaryMessenger:binaryMessenger
codec:FLTGetMessagesCodec()];
codec:WAKELOCKPLUSGetMessagesCodec()];
if (api) {
NSCAssert([api respondsToSelector:@selector(toggleMsg:error:)], @"FLTWakelockPlusApi api (%@) doesn't respond to @selector(toggleMsg:error:)", api);
NSCAssert([api respondsToSelector:@selector(toggleMsg:error:)], @"WAKELOCKPLUSWakelockPlusApi api (%@) doesn't respond to @selector(toggleMsg:error:)", api);
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
NSArray<id> *args = message;
FLTToggleMessage *arg_msg = GetNullableObjectAtIndex(args, 0);
WAKELOCKPLUSToggleMessage *arg_msg = GetNullableObjectAtIndex(args, 0);
FlutterError *error;
[api toggleMsg:arg_msg error:&error];
callback(wrapResult(nil, error));
Expand All @@ -162,12 +162,12 @@ void SetUpFLTWakelockPlusApiWithSuffix(id<FlutterBinaryMessenger> binaryMessenge
[[FlutterBasicMessageChannel alloc]
initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled", messageChannelSuffix]
binaryMessenger:binaryMessenger
codec:FLTGetMessagesCodec()];
codec:WAKELOCKPLUSGetMessagesCodec()];
if (api) {
NSCAssert([api respondsToSelector:@selector(isEnabledWithError:)], @"FLTWakelockPlusApi api (%@) doesn't respond to @selector(isEnabledWithError:)", api);
NSCAssert([api respondsToSelector:@selector(isEnabledWithError:)], @"WAKELOCKPLUSWakelockPlusApi api (%@) doesn't respond to @selector(isEnabledWithError:)", api);
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
FlutterError *error;
FLTIsEnabledMessage *output = [api isEnabledWithError:&error];
WAKELOCKPLUSIsEnabledMessage *output = [api isEnabledWithError:&error];
callback(wrapResult(output, error));
}];
} else {
Expand Down
2 changes: 1 addition & 1 deletion wakelock_plus/lib/src/web_impl/import_js_library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ HTMLScriptElement _createScriptTag(String library) {
return script;
}

/// Injects a bunch of libraries in the <head> and returns a
/// Injects a bunch of libraries in the `<head>` and returns a
/// Future that resolves when all load.
Future<void> _importJSLibraries(List<String> libraries) {
final loading = <Future<void>>[];
Expand Down
2 changes: 1 addition & 1 deletion wakelock_plus/lib/src/web_impl/js_wakelock.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@JS('Wakelock')
library wakelock.js;
library;

import 'dart:js_interop';

Expand Down
2 changes: 1 addition & 1 deletion wakelock_plus/pigeons/messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class IsEnabledMessage {
objcHeaderOut: 'ios/Classes/messages.g.h',
objcSourceOut: 'ios/Classes/messages.g.m',
objcOptions: ObjcOptions(
prefix: 'FLT',
prefix: 'WAKELOCKPLUS',
),
kotlinOptions: KotlinOptions(errorClassName: "WakelockPlusFlutterError"),
kotlinOut:
Expand Down
4 changes: 2 additions & 2 deletions wakelock_plus/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.2
pigeon: ^21.2.0 # dart run pigeon --input "pigeons/messages.dart"
flutter_lints: ^5.0.0
pigeon: ^22.7.0 # dart run pigeon --input "pigeons/messages.dart"

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
2 changes: 1 addition & 1 deletion wakelock_plus/test/wakelock_plus_web_plugin_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@TestOn('browser')
library wakelock_plus_library_plugin_test;
library;

import 'package:flutter_test/flutter_test.dart';
import 'package:wakelock_plus/src/wakelock_plus_web_plugin.dart';
Expand Down
7 changes: 5 additions & 2 deletions wakelock_plus_platform_interface/lib/messages.g.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Autogenerated from Pigeon (v21.2.0), do not edit directly.
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers

Expand Down Expand Up @@ -74,7 +74,10 @@ class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
if (value is ToggleMessage) {
if (value is int) {
buffer.putUint8(4);
buffer.putInt64(value);
} else if (value is ToggleMessage) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
} else if (value is IsEnabledMessage) {
Expand Down
2 changes: 1 addition & 1 deletion wakelock_plus_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ dev_dependencies:
flutter_test:
sdk: flutter

flutter_lints: ^4.0.0
flutter_lints: ^5.0.0
Loading
Loading