Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit a3dbe73

Browse files
authored
[connectivity] Endorse connectivity_for_web. (#2853)
1 parent 71cc865 commit a3dbe73

File tree

8 files changed

+68
-5
lines changed

8 files changed

+68
-5
lines changed

packages/connectivity/connectivity/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.9
2+
3+
* Add support for `web` (by endorsing `connectivity_for_web` 0.3.0)
4+
15
## 0.4.8+6
26

37
* Update lower bound of dart dependency to 2.1.0.

packages/connectivity/connectivity/example/lib/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class _MyHomePageState extends State<MyHomePage> {
9191
Widget build(BuildContext context) {
9292
return Scaffold(
9393
appBar: AppBar(
94-
title: const Text('Plugin example app'),
94+
title: const Text('Connectivity example app'),
9595
),
9696
body: Center(child: Text('Connection Status: $_connectionStatus')),
9797
);
@@ -103,7 +103,7 @@ class _MyHomePageState extends State<MyHomePage> {
103103
String wifiName, wifiBSSID, wifiIP;
104104

105105
try {
106-
if (Platform.isIOS) {
106+
if (!kIsWeb && Platform.isIOS) {
107107
LocationAuthorizationStatus status =
108108
await _connectivity.getLocationServiceAuthorization();
109109
if (status == LocationAuthorizationStatus.notDetermined) {
@@ -125,7 +125,7 @@ class _MyHomePageState extends State<MyHomePage> {
125125
}
126126

127127
try {
128-
if (Platform.isIOS) {
128+
if (!kIsWeb && Platform.isIOS) {
129129
LocationAuthorizationStatus status =
130130
await _connectivity.getLocationServiceAuthorization();
131131
if (status == LocationAuthorizationStatus.notDetermined) {
Loading
Loading
Loading
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
6+
<meta name="description" content="A new Flutter project.">
7+
8+
<!-- iOS meta tags & icons -->
9+
<meta name="apple-mobile-web-app-capable" content="yes">
10+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
11+
<meta name="apple-mobile-web-app-title" content="example">
12+
<link rel="apple-touch-icon" href="icons/Icon-192.png">
13+
14+
<!-- Favicon -->
15+
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
16+
17+
<title>example</title>
18+
<link rel="manifest" href="manifest.json">
19+
</head>
20+
<body>
21+
<!-- This script installs service_worker.js to provide PWA functionality to
22+
application. For more information, see:
23+
https://developers.google.com/web/fundamentals/primers/service-workers -->
24+
<script>
25+
if ('serviceWorker' in navigator) {
26+
window.addEventListener('load', function () {
27+
navigator.serviceWorker.register('flutter_service_worker.js');
28+
});
29+
}
30+
</script>
31+
<script src="main.dart.js" type="application/javascript"></script>
32+
</body>
33+
</html>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "example",
3+
"short_name": "example",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"background_color": "#0175C2",
7+
"theme_color": "#0175C2",
8+
"description": "A new Flutter project.",
9+
"orientation": "portrait-primary",
10+
"prefer_related_applications": false,
11+
"icons": [
12+
{
13+
"src": "icons/Icon-192.png",
14+
"sizes": "192x192",
15+
"type": "image/png"
16+
},
17+
{
18+
"src": "icons/Icon-512.png",
19+
"sizes": "512x512",
20+
"type": "image/png"
21+
}
22+
]
23+
}

packages/connectivity/connectivity/pubspec.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/c
55
# 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump
66
# the version to 2.0.0.
77
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
8-
version: 0.4.8+6
8+
version: 0.4.9
99

1010
flutter:
1111
plugin:
@@ -17,13 +17,16 @@ flutter:
1717
pluginClass: FLTConnectivityPlugin
1818
macos:
1919
default_package: connectivity_macos
20+
web:
21+
default_package: connectivity_for_web
2022

2123
dependencies:
2224
flutter:
2325
sdk: flutter
24-
meta: "^1.0.5"
26+
meta: ^1.0.5
2527
connectivity_platform_interface: ^1.0.2
2628
connectivity_macos: ^0.1.0
29+
connectivity_for_web: ^0.3.0
2730

2831
dev_dependencies:
2932
flutter_test:

0 commit comments

Comments
 (0)