Skip to content

Commit e64c358

Browse files
authored
Merge pull request #95 from diegotori/fix_spm_integration
Fix SPM integration
2 parents 10150ba + e29c0fc commit e64c358

File tree

13 files changed

+163
-80
lines changed

13 files changed

+163
-80
lines changed

wakelock_plus/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusMessages.g.kt

+51-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
1+
// Autogenerated from Pigeon (v25.3.0), do not edit directly.
22
// See also: https://pub.dev/packages/pigeon
33
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")
44

@@ -44,6 +44,36 @@ class WakelockPlusFlutterError (
4444
override val message: String? = null,
4545
val details: Any? = null
4646
) : Throwable()
47+
private fun deepEqualsWakelockPlusMessages(a: Any?, b: Any?): Boolean {
48+
if (a is ByteArray && b is ByteArray) {
49+
return a.contentEquals(b)
50+
}
51+
if (a is IntArray && b is IntArray) {
52+
return a.contentEquals(b)
53+
}
54+
if (a is LongArray && b is LongArray) {
55+
return a.contentEquals(b)
56+
}
57+
if (a is DoubleArray && b is DoubleArray) {
58+
return a.contentEquals(b)
59+
}
60+
if (a is Array<*> && b is Array<*>) {
61+
return a.size == b.size &&
62+
a.indices.all{ deepEqualsWakelockPlusMessages(a[it], b[it]) }
63+
}
64+
if (a is List<*> && b is List<*>) {
65+
return a.size == b.size &&
66+
a.indices.all{ deepEqualsWakelockPlusMessages(a[it], b[it]) }
67+
}
68+
if (a is Map<*, *> && b is Map<*, *>) {
69+
return a.size == b.size && a.all {
70+
(b as Map<Any?, Any?>).containsKey(it.key) &&
71+
deepEqualsWakelockPlusMessages(it.value, b[it.key])
72+
}
73+
}
74+
return a == b
75+
}
76+
4777

4878
/**
4979
* Message for toggling the wakelock on the platform side.
@@ -65,6 +95,16 @@ data class ToggleMessage (
6595
enable,
6696
)
6797
}
98+
override fun equals(other: Any?): Boolean {
99+
if (other !is ToggleMessage) {
100+
return false
101+
}
102+
if (this === other) {
103+
return true
104+
}
105+
return deepEqualsWakelockPlusMessages(toList(), other.toList()) }
106+
107+
override fun hashCode(): Int = toList().hashCode()
68108
}
69109

70110
/**
@@ -87,6 +127,16 @@ data class IsEnabledMessage (
87127
enabled,
88128
)
89129
}
130+
override fun equals(other: Any?): Boolean {
131+
if (other !is IsEnabledMessage) {
132+
return false
133+
}
134+
if (this === other) {
135+
return true
136+
}
137+
return deepEqualsWakelockPlusMessages(toList(), other.toList()) }
138+
139+
override fun hashCode(): Int = toList().hashCode()
90140
}
91141
private open class WakelockPlusMessagesPigeonCodec : StandardMessageCodec() {
92142
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {

wakelock_plus/example/ios/Podfile.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ EXTERNAL SOURCES:
2525

2626
SPEC CHECKSUMS:
2727
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
28-
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
29-
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
30-
wakelock_plus: 373cfe59b235a6dd5837d0fb88791d2f13a90d56
28+
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
29+
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
30+
wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556
3131

3232
PODFILE CHECKSUM: beab77b38961de946f08660e554f80ac174dc842
3333

34-
COCOAPODS: 1.16.1
34+
COCOAPODS: 1.16.2

wakelock_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
ignoresPersistentStateOnLaunch = "NO"
6060
debugDocumentVersioning = "YES"
6161
debugServiceExtension = "internal"
62+
enableGPUValidationMode = "1"
6263
allowLocationSimulation = "YES">
6364
<BuildableProductRunnable
6465
runnableDebuggingMode = "0">

wakelock_plus/ios/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ profile
99

1010
DerivedData/
1111
build/
12+
.build/
1213
GeneratedPluginRegistrant.h
1314
GeneratedPluginRegistrant.m
1415

wakelock_plus/ios/wakelock_plus.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Plugin that allows you to keep the device screen awake, i.e. prevent the screen
1616
s.source_files = 'wakelock_plus/Sources/wakelock_plus/**/*.{h,m}'
1717
s.public_header_files = 'wakelock_plus/Sources/wakelock_plus/include/**/*.h'
1818
s.dependency 'Flutter'
19-
s.platform = :ios, '11.0'
19+
s.platform = :ios, '12.0'
2020

2121
# Flutter.framework does not contain a i386 slice.
2222
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }

wakelock_plus/ios/wakelock_plus/Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let package = Package(
1717
name: "wakelock_plus",
1818
dependencies: [],
1919
resources: [
20-
.process("Resources")
20+
.process("PrivacyInfo.xcprivacy"),
2121
],
2222
cSettings: [
2323
.headerSearchPath("include/wakelock_plus")

wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/UIApplication+idleTimerLock.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by suyao on 2021/12/17.
66
//
77

8-
#import "UIApplication+idleTimerLock.h"
8+
#import "./include/wakelock_plus/UIApplication+idleTimerLock.h"
99
#import <objc/runtime.h>
1010

1111
static NSString *idleTimerLockKey = @"idleTimerLockKey";

wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/WakelockPlusPlugin.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#import "WakelockPlusPlugin.h"
2-
#import "messages.g.h"
3-
#import "UIApplication+idleTimerLock.h"
1+
#import "./include/wakelock_plus/WakelockPlusPlugin.h"
2+
#import "./include/wakelock_plus/messages.g.h"
3+
#import "./include/wakelock_plus/UIApplication+idleTimerLock.h"
44

55
@interface WakelockPlusPlugin () <WAKELOCKPLUSWakelockPlusApi>
66

wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/include/wakelock_plus/messages.g.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
1+
// Autogenerated from Pigeon (v25.3.0), do not edit directly.
22
// See also: https://pub.dev/packages/pigeon
33

44
#import <Foundation/Foundation.h>

wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/messages.g.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
1+
// Autogenerated from Pigeon (v25.3.0), do not edit directly.
22
// See also: https://pub.dev/packages/pigeon
33

44
#import "./include/wakelock_plus/messages.g.h"

wakelock_plus/pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ dependencies:
1919

2020
# Windows dependencies
2121
# win32 is compatible across v5 for Win32 only (not COM)
22-
win32: ">=5.5.1 <6.0.0"
22+
win32: ">=5.6.1 <6.0.0"
2323

2424
# Linux dependencies
25-
dbus: ^0.7.10
25+
dbus: ^0.7.11
2626
package_info_plus: ">=6.0.0 <9.0.0"
2727

2828
# Web dependencies
@@ -32,7 +32,7 @@ dev_dependencies:
3232
flutter_test:
3333
sdk: flutter
3434
flutter_lints: ^5.0.0
35-
pigeon: ^22.7.0 # dart run pigeon --input "pigeons/messages.dart"
35+
pigeon: ^25.3.0 # dart run pigeon --input "pigeons/messages.dart"
3636

3737
# For information on the generic Dart part of this file, see the
3838
# following page: https://dart.dev/tools/pub/pubspec

wakelock_plus_platform_interface/lib/messages.g.dart

+73-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
1+
// Autogenerated from Pigeon (v25.3.0), do not edit directly.
22
// See also: https://pub.dev/packages/pigeon
33
// 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
44

@@ -15,8 +15,7 @@ PlatformException _createConnectionError(String channelName) {
1515
);
1616
}
1717

18-
List<Object?> wrapResponse(
19-
{Object? result, PlatformException? error, bool empty = false}) {
18+
List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty = false}) {
2019
if (empty) {
2120
return <Object?>[];
2221
}
@@ -25,6 +24,20 @@ List<Object?> wrapResponse(
2524
}
2625
return <Object?>[error.code, error.message, error.details];
2726
}
27+
bool _deepEquals(Object? a, Object? b) {
28+
if (a is List && b is List) {
29+
return a.length == b.length &&
30+
a.indexed
31+
.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]));
32+
}
33+
if (a is Map && b is Map) {
34+
return a.length == b.length && a.entries.every((MapEntry<Object?, Object?> entry) =>
35+
(b as Map<Object?, Object?>).containsKey(entry.key) &&
36+
_deepEquals(entry.value, b[entry.key]));
37+
}
38+
return a == b;
39+
}
40+
2841

2942
/// Message for toggling the wakelock on the platform side.
3043
class ToggleMessage {
@@ -34,18 +47,38 @@ class ToggleMessage {
3447

3548
bool? enable;
3649

37-
Object encode() {
50+
List<Object?> _toList() {
3851
return <Object?>[
3952
enable,
4053
];
4154
}
4255

56+
Object encode() {
57+
return _toList(); }
58+
4359
static ToggleMessage decode(Object result) {
4460
result as List<Object?>;
4561
return ToggleMessage(
4662
enable: result[0] as bool?,
4763
);
4864
}
65+
66+
@override
67+
// ignore: avoid_equals_and_hash_code_on_mutable_classes
68+
bool operator ==(Object other) {
69+
if (other is! ToggleMessage || other.runtimeType != runtimeType) {
70+
return false;
71+
}
72+
if (identical(this, other)) {
73+
return true;
74+
}
75+
return _deepEquals(encode(), other.encode());
76+
}
77+
78+
@override
79+
// ignore: avoid_equals_and_hash_code_on_mutable_classes
80+
int get hashCode => Object.hashAll(_toList())
81+
;
4982
}
5083

5184
/// Message for reporting the wakelock state from the platform side.
@@ -56,31 +89,52 @@ class IsEnabledMessage {
5689

5790
bool? enabled;
5891

59-
Object encode() {
92+
List<Object?> _toList() {
6093
return <Object?>[
6194
enabled,
6295
];
6396
}
6497

98+
Object encode() {
99+
return _toList(); }
100+
65101
static IsEnabledMessage decode(Object result) {
66102
result as List<Object?>;
67103
return IsEnabledMessage(
68104
enabled: result[0] as bool?,
69105
);
70106
}
107+
108+
@override
109+
// ignore: avoid_equals_and_hash_code_on_mutable_classes
110+
bool operator ==(Object other) {
111+
if (other is! IsEnabledMessage || other.runtimeType != runtimeType) {
112+
return false;
113+
}
114+
if (identical(this, other)) {
115+
return true;
116+
}
117+
return _deepEquals(encode(), other.encode());
118+
}
119+
120+
@override
121+
// ignore: avoid_equals_and_hash_code_on_mutable_classes
122+
int get hashCode => Object.hashAll(_toList())
123+
;
71124
}
72125

126+
73127
class _PigeonCodec extends StandardMessageCodec {
74128
const _PigeonCodec();
75129
@override
76130
void writeValue(WriteBuffer buffer, Object? value) {
77131
if (value is int) {
78132
buffer.putUint8(4);
79133
buffer.putInt64(value);
80-
} else if (value is ToggleMessage) {
134+
} else if (value is ToggleMessage) {
81135
buffer.putUint8(129);
82136
writeValue(buffer, value.encode());
83-
} else if (value is IsEnabledMessage) {
137+
} else if (value is IsEnabledMessage) {
84138
buffer.putUint8(130);
85139
writeValue(buffer, value.encode());
86140
} else {
@@ -91,9 +145,9 @@ class _PigeonCodec extends StandardMessageCodec {
91145
@override
92146
Object? readValueOfType(int type, ReadBuffer buffer) {
93147
switch (type) {
94-
case 129:
148+
case 129:
95149
return ToggleMessage.decode(readValue(buffer)!);
96-
case 130:
150+
case 130:
97151
return IsEnabledMessage.decode(readValue(buffer)!);
98152
default:
99153
return super.readValueOfType(type, buffer);
@@ -105,28 +159,25 @@ class WakelockPlusApi {
105159
/// Constructor for [WakelockPlusApi]. The [binaryMessenger] named argument is
106160
/// available for dependency injection. If it is left null, the default
107161
/// BinaryMessenger will be used which routes to the host platform.
108-
WakelockPlusApi(
109-
{BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
162+
WakelockPlusApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
110163
: pigeonVar_binaryMessenger = binaryMessenger,
111-
pigeonVar_messageChannelSuffix =
112-
messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
164+
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
113165
final BinaryMessenger? pigeonVar_binaryMessenger;
114166

115167
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
116168

117169
final String pigeonVar_messageChannelSuffix;
118170

119171
Future<void> toggle(ToggleMessage msg) async {
120-
final String pigeonVar_channelName =
121-
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle$pigeonVar_messageChannelSuffix';
122-
final BasicMessageChannel<Object?> pigeonVar_channel =
123-
BasicMessageChannel<Object?>(
172+
final String pigeonVar_channelName = 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle$pigeonVar_messageChannelSuffix';
173+
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
124174
pigeonVar_channelName,
125175
pigeonChannelCodec,
126176
binaryMessenger: pigeonVar_binaryMessenger,
127177
);
178+
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[msg]);
128179
final List<Object?>? pigeonVar_replyList =
129-
await pigeonVar_channel.send(<Object?>[msg]) as List<Object?>?;
180+
await pigeonVar_sendFuture as List<Object?>?;
130181
if (pigeonVar_replyList == null) {
131182
throw _createConnectionError(pigeonVar_channelName);
132183
} else if (pigeonVar_replyList.length > 1) {
@@ -141,16 +192,15 @@ class WakelockPlusApi {
141192
}
142193

143194
Future<IsEnabledMessage> isEnabled() async {
144-
final String pigeonVar_channelName =
145-
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled$pigeonVar_messageChannelSuffix';
146-
final BasicMessageChannel<Object?> pigeonVar_channel =
147-
BasicMessageChannel<Object?>(
195+
final String pigeonVar_channelName = 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled$pigeonVar_messageChannelSuffix';
196+
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
148197
pigeonVar_channelName,
149198
pigeonChannelCodec,
150199
binaryMessenger: pigeonVar_binaryMessenger,
151200
);
201+
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
152202
final List<Object?>? pigeonVar_replyList =
153-
await pigeonVar_channel.send(null) as List<Object?>?;
203+
await pigeonVar_sendFuture as List<Object?>?;
154204
if (pigeonVar_replyList == null) {
155205
throw _createConnectionError(pigeonVar_channelName);
156206
} else if (pigeonVar_replyList.length > 1) {

0 commit comments

Comments
 (0)