Skip to content

Commit 1f23910

Browse files
dependabot[bot]vbuberenmiquelbeltran
authored
chore(deps): bump web from 0.5.1 to 1.0.0 in /packages/share_plus/share_plus (#3105)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Volodymyr <v.buberenko@gmail.com> Co-authored-by: Volodymyr Buberenko <vbuberen@users.noreply.github.com> Co-authored-by: Miguel Beltran <m@beltran.work>
1 parent 36e7dd1 commit 1f23910

6 files changed

Lines changed: 31 additions & 87 deletions

File tree

packages/share_plus/share_plus/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Sharing files is not supported on Linux.
2626

2727
## Requirements
2828

29-
- Flutter >=3.3.0
30-
- Dart >=2.18.0 <4.0.0
29+
- Flutter >=3.19.0
30+
- Dart >=3.3.0 <4.0.0
3131
- iOS >=12.0
3232
- MacOS >=10.14
3333
- Android `compileSDK` 34

packages/share_plus/share_plus/example/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
/build/
3333

3434
# Web related
35-
lib/generated_plugin_registrant.dart
3635

3736
# Symbolication related
3837
app.*.symbols

packages/share_plus/share_plus/example/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ dependencies:
55
flutter:
66
sdk: flutter
77
share_plus: ^10.0.0
8-
image_picker: ^1.0.0
9-
file_selector: ^1.0.0
8+
image_picker: ^1.1.2
9+
file_selector: ^1.0.3
1010

1111
dev_dependencies:
1212
flutter_driver:
@@ -15,7 +15,7 @@ dev_dependencies:
1515
sdk: flutter
1616
integration_test:
1717
sdk: flutter
18-
flutter_lints: ^3.0.1
18+
flutter_lints: ^4.0.0
1919

2020
flutter:
2121
uses-material-design: true

packages/share_plus/share_plus/example/web/index.html

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@
3030
<link rel="manifest" href="manifest.json">
3131
</head>
3232
<body>
33-
<!-- This script installs service_worker.js to provide PWA functionality to
34-
application. For more information, see:
35-
https://developers.google.com/web/fundamentals/primers/service-workers -->
36-
<script>
37-
if ('serviceWorker' in navigator) {
38-
window.addEventListener('flutter-first-frame', function () {
39-
navigator.serviceWorker.register('flutter_service_worker.js');
40-
});
41-
}
42-
</script>
43-
<script src="main.dart.js" type="application/javascript"></script>
33+
<script src="flutter_bootstrap.js" async></script>
4434
</body>
4535
</html>

packages/share_plus/share_plus/lib/src/share_plus_web.dart

Lines changed: 18 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import 'package:mime/mime.dart' show lookupMimeType;
99
import 'package:share_plus_platform_interface/share_plus_platform_interface.dart';
1010
import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart';
1111
import 'package:url_launcher_web/url_launcher_web.dart';
12-
import 'package:web/web.dart' as web
13-
show DOMException, File, FilePropertyBag, Navigator, window;
12+
import 'package:web/web.dart';
1413

1514
/// The web implementation of [SharePlatform].
1615
class SharePlusWebPlugin extends SharePlatform {
@@ -21,20 +20,20 @@ class SharePlusWebPlugin extends SharePlatform {
2120
SharePlatform.instance = SharePlusWebPlugin(UrlLauncherPlugin());
2221
}
2322

24-
final web.Navigator _navigator;
23+
final Navigator _navigator;
2524

2625
/// A constructor that allows tests to override the window object used by the plugin.
2726
SharePlusWebPlugin(
2827
this.urlLauncher, {
29-
@visibleForTesting web.Navigator? debugNavigator,
30-
}) : _navigator = debugNavigator ?? web.window.navigator;
28+
@visibleForTesting Navigator? debugNavigator,
29+
}) : _navigator = debugNavigator ?? window.navigator;
3130

3231
@override
3332
Future<ShareResult> shareUri(
3433
Uri uri, {
3534
Rect? sharePositionOrigin,
3635
}) async {
37-
final data = ShareData.url(
36+
final data = ShareData(
3837
url: uri.toString(),
3938
);
4039

@@ -56,7 +55,7 @@ class SharePlusWebPlugin extends SharePlatform {
5655

5756
try {
5857
await _navigator.share(data).toDart;
59-
} on web.DOMException catch (e) {
58+
} on DOMException catch (e) {
6059
developer.log(
6160
'Failed to share uri',
6261
error: '${e.name}: ${e.message}',
@@ -76,12 +75,12 @@ class SharePlusWebPlugin extends SharePlatform {
7675
}) async {
7776
final ShareData data;
7877
if (subject != null && subject.isNotEmpty) {
79-
data = ShareData.textWithTitle(
78+
data = ShareData(
8079
title: subject,
8180
text: text,
8281
);
8382
} else {
84-
data = ShareData.text(
83+
data = ShareData(
8584
text: text,
8685
);
8786
}
@@ -130,7 +129,7 @@ class SharePlusWebPlugin extends SharePlatform {
130129

131130
// actions is success, but can't get the action name
132131
return ShareResult.unavailable;
133-
} on web.DOMException catch (e) {
132+
} on DOMException catch (e) {
134133
if (e.name case 'AbortError') {
135134
return _resultDismissed;
136135
}
@@ -160,7 +159,7 @@ class SharePlusWebPlugin extends SharePlatform {
160159
}) async {
161160
assert(
162161
fileNameOverrides == null || files.length == fileNameOverrides.length);
163-
final webFiles = <web.File>[];
162+
final webFiles = <File>[];
164163
for (var index = 0; index < files.length; index++) {
165164
final xFile = files[index];
166165
final filename = fileNameOverrides?.elementAt(index);
@@ -170,24 +169,24 @@ class SharePlusWebPlugin extends SharePlatform {
170169
final ShareData data;
171170
if (text != null && text.isNotEmpty) {
172171
if (subject != null && subject.isNotEmpty) {
173-
data = ShareData.filesWithTextAndTitle(
172+
data = ShareData(
174173
files: webFiles.toJS,
175174
text: text,
176175
title: subject,
177176
);
178177
} else {
179-
data = ShareData.filesWithText(
178+
data = ShareData(
180179
files: webFiles.toJS,
181180
text: text,
182181
);
183182
}
184183
} else if (subject != null && subject.isNotEmpty) {
185-
data = ShareData.filesWithTitle(
184+
data = ShareData(
186185
files: webFiles.toJS,
187186
title: subject,
188187
);
189188
} else {
190-
data = ShareData.files(
189+
data = ShareData(
191190
files: webFiles.toJS,
192191
);
193192
}
@@ -213,7 +212,7 @@ class SharePlusWebPlugin extends SharePlatform {
213212

214213
// actions is success, but can't get the action name
215214
return ShareResult.unavailable;
216-
} on web.DOMException catch (e) {
215+
} on DOMException catch (e) {
217216
if (e.name case 'AbortError') {
218217
return _resultDismissed;
219218
}
@@ -227,13 +226,12 @@ class SharePlusWebPlugin extends SharePlatform {
227226
}
228227
}
229228

230-
static Future<web.File> _fromXFile(XFile file, {String? nameOverride}) async {
229+
static Future<File> _fromXFile(XFile file, {String? nameOverride}) async {
231230
final bytes = await file.readAsBytes();
232-
return web.File(
231+
return File(
233232
[bytes.buffer.toJS].toJS,
234233
nameOverride ?? file.name,
235-
web.FilePropertyBag()
236-
..type = file.mimeType ?? _mimeTypeForPath(file, bytes),
234+
FilePropertyBag()..type = file.mimeType ?? _mimeTypeForPath(file, bytes),
237235
);
238236
}
239237

@@ -247,46 +245,3 @@ const _resultDismissed = ShareResult(
247245
'',
248246
ShareResultStatus.dismissed,
249247
);
250-
251-
extension on web.Navigator {
252-
/// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/canShare
253-
external bool canShare(ShareData data);
254-
255-
/// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share
256-
external JSPromise share(ShareData data);
257-
}
258-
259-
extension type ShareData._(JSObject _) implements JSObject {
260-
external factory ShareData.text({
261-
String text,
262-
});
263-
264-
external factory ShareData.textWithTitle({
265-
String text,
266-
String title,
267-
});
268-
269-
external factory ShareData.files({
270-
JSArray<web.File> files,
271-
});
272-
273-
external factory ShareData.filesWithText({
274-
JSArray<web.File> files,
275-
String text,
276-
});
277-
278-
external factory ShareData.filesWithTitle({
279-
JSArray<web.File> files,
280-
String title,
281-
});
282-
283-
external factory ShareData.filesWithTextAndTitle({
284-
JSArray<web.File> files,
285-
String text,
286-
String title,
287-
});
288-
289-
external factory ShareData.url({
290-
String url,
291-
});
292-
}

packages/share_plus/share_plus/pubspec.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ flutter:
2828
pluginClass: SharePlusWindowsPluginCApi
2929

3030
dependencies:
31-
cross_file: ^0.3.3+4
31+
cross_file: ^0.3.4+2
3232
meta: ^1.8.0
3333
mime: ^1.0.4
3434
flutter:
@@ -37,12 +37,12 @@ dependencies:
3737
sdk: flutter
3838
share_plus_platform_interface: ^5.0.0
3939
file: ">=6.1.4 <8.0.0"
40-
url_launcher_web: ^2.0.16
41-
url_launcher_windows: ^3.0.6
42-
url_launcher_linux: ^3.0.5
43-
url_launcher_platform_interface: ^2.1.2
44-
ffi: ^2.0.1
45-
web: ^0.5.0
40+
url_launcher_web: ^2.3.2
41+
url_launcher_windows: ^3.1.2
42+
url_launcher_linux: ^3.1.1
43+
url_launcher_platform_interface: ^2.3.2
44+
ffi: ^2.1.2
45+
web: ^1.0.0
4646

4747
# win32 is compatible across v4 and v5 for Win32 only (not COM)
4848
win32: ">=4.0.0 <6.0.0"

0 commit comments

Comments
 (0)