Skip to content

Commit af2dc38

Browse files
committed
Remove ethernet connectivity support
Eliminated handling and tests for ethernet connectivity in Parse SDK for Flutter. The code and related tests now only consider wifi, mobile, and none as valid connectivity results.
1 parent 508318f commit af2dc38

File tree

2 files changed

+4
-56
lines changed

2 files changed

+4
-56
lines changed

packages/flutter/lib/parse_server_sdk_flutter.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ class Parse extends sdk.Parse
138138
) {
139139
if (results.contains(ConnectivityResult.wifi)) {
140140
return sdk.ParseConnectivityResult.wifi;
141-
} else if (results.contains(ConnectivityResult.ethernet)) {
142-
return sdk.ParseConnectivityResult.ethernet;
143-
} else if (results.contains(ConnectivityResult.mobile)) {
141+
} else if (results.contains(ConnectivityResult.mobile)) {
144142
return sdk.ParseConnectivityResult.mobile;
145143
} else {
146144
return sdk.ParseConnectivityResult.none;

packages/flutter/test/parse_connectivity_implementation_test.dart

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,7 @@ void main() {
5555
expect(result, ParseConnectivityResult.wifi);
5656
});
5757

58-
test(
59-
'ethernet connection returns ParseConnectivityResult.ethernet',
60-
() async {
61-
mockPlatform.setConnectivity([ConnectivityResult.ethernet]);
62-
63-
final result = await Parse().checkConnectivity();
64-
65-
expect(result, ParseConnectivityResult.ethernet);
66-
},
67-
);
58+
6859

6960
test('mobile connection returns ParseConnectivityResult.mobile', () async {
7061
mockPlatform.setConnectivity([ConnectivityResult.mobile]);
@@ -93,16 +84,7 @@ void main() {
9384
expect(result, ParseConnectivityResult.wifi);
9485
});
9586

96-
test('ethernet takes priority over mobile (issue #1042 fix)', () async {
97-
mockPlatform.setConnectivity([
98-
ConnectivityResult.ethernet,
99-
ConnectivityResult.mobile,
100-
]);
101-
102-
final result = await Parse().checkConnectivity();
103-
104-
expect(result, ParseConnectivityResult.ethernet);
105-
});
87+
10688

10789
test('unsupported connection types fall back to none', () async {
10890
mockPlatform.setConnectivity([ConnectivityResult.bluetooth]);
@@ -141,21 +123,6 @@ void main() {
141123
await subscription.cancel();
142124
});
143125

144-
test('ethernet event emits ParseConnectivityResult.ethernet', () async {
145-
final completer = Completer<ParseConnectivityResult>();
146-
final subscription = Parse().connectivityStream.listen((result) {
147-
if (!completer.isCompleted) {
148-
completer.complete(result);
149-
}
150-
});
151-
152-
mockPlatform.setConnectivity([ConnectivityResult.ethernet]);
153-
154-
final result = await completer.future;
155-
expect(result, ParseConnectivityResult.ethernet);
156-
157-
await subscription.cancel();
158-
});
159126

160127
test('mobile event emits ParseConnectivityResult.mobile', () async {
161128
final completer = Completer<ParseConnectivityResult>();
@@ -189,23 +156,6 @@ void main() {
189156
await subscription.cancel();
190157
});
191158

192-
test('stream respects priority: ethernet over mobile', () async {
193-
final completer = Completer<ParseConnectivityResult>();
194-
final subscription = Parse().connectivityStream.listen((result) {
195-
if (!completer.isCompleted) {
196-
completer.complete(result);
197-
}
198-
});
199-
200-
mockPlatform.setConnectivity([
201-
ConnectivityResult.ethernet,
202-
ConnectivityResult.mobile,
203-
]);
204-
205-
final result = await completer.future;
206-
expect(result, ParseConnectivityResult.ethernet);
207-
208-
await subscription.cancel();
209-
});
159+
210160
});
211161
}

0 commit comments

Comments
 (0)