Skip to content

Commit

Permalink
Modernize the rest of the index.html files to support WASM compilat…
Browse files Browse the repository at this point in the history
…ion (flutter#7192)

Turns out there are a bunch of other `index.html` files that used a different method of Flutter initialization

flutter/flutter#151663
  • Loading branch information
Rexios80 authored Jul 25, 2024
1 parent 2c1f713 commit 19daf6f
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 178 deletions.
1 change: 0 additions & 1 deletion packages/camera/camera/example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
</head>

<body>
</script>
<script src="flutter_bootstrap.js" async></script>
</body>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,8 @@
<!-- Google Sign In configuration -->
<meta name="google-signin-client_id" content="[YOUR_OAUTH_2_CLIENT_ID_FOR_WEB]" />
<title>Google Sign In + googleapis</title>

<script>
// The value below is injected by flutter build, do not touch.
var serviceWorkerVersion = null;
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.initializeEngine().then(function(appRunner) {
appRunner.runApp();
});
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
23 changes: 1 addition & 22 deletions packages/flutter_adaptive_scaffold/example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,8 @@

<title>example</title>
<link rel="manifest" href="manifest.json">

<script>
// The value below is injected by flutter build, do not touch.
var serviceWorkerVersion = null;
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.initializeEngine().then(function(appRunner) {
appRunner.runApp();
});
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
23 changes: 1 addition & 22 deletions packages/flutter_image/example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,8 @@

<title>example</title>
<link rel="manifest" href="manifest.json">

<script>
// The value below is injected by flutter build, do not touch.
var serviceWorkerVersion = null;
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.initializeEngine().then(function(appRunner) {
appRunner.runApp();
});
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
4 changes: 4 additions & 0 deletions packages/google_identity_services_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.1+3

* Updates `README.md` to reflect modern `index.html` script tag placement.

## 0.3.1+2

* Updates web code to package `web: >=0.5.1 <2.0.0`.
Expand Down
5 changes: 1 addition & 4 deletions packages/google_identity_services_web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,14 @@ There are two ways to load the JS SDK in your app.

The most performant way is to modify your `web/index.html` file to insert a
script tag [as recommended](https://developers.google.com/identity/gsi/web/guides/client-library).
Place the `script` tag in the `<head>` of your site, next to the script tag that
loads `flutter.js`, so the browser can downloaded both in parallel:
Place the `script` tag in the `<head>` of your site:

<?code-excerpt "example/web/index-with-script-tag.html (script-tag)"?>
```html
<head>
<!-- ··· -->
<!-- Include the GSI SDK below -->
<script src="https://accounts.google.com/gsi/client" async defer></script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,12 @@
<title>Authentication Example</title>
<link rel="manifest" href="manifest.json">

<script>
// The value below is injected by flutter build, do not touch.
var serviceWorkerVersion = null;
</script>
<!--#docregion script-tag-->
<!-- Include the GSI SDK below -->
<script src="https://accounts.google.com/gsi/client" async defer></script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<!--#enddocregion script-tag-->
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.autoStart();
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
20 changes: 1 addition & 19 deletions packages/google_identity_services_web/example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,12 @@
<title>Authentication Example</title>
<link rel="manifest" href="manifest.json">

<script>
// The value below is injected by flutter build, do not touch.
var serviceWorkerVersion = null;
</script>
<!-- Trusted Types API config (disabled) -->
<!-- <meta http-equiv="Content-Security-Policy" content="trusted-types;"> -->
<!-- Load the GSI SDK -->
<!-- <script src="https://accounts.google.com/gsi/client" async defer></script> -->
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.autoStart();
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
2 changes: 1 addition & 1 deletion packages/google_identity_services_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_identity_services_web
description: A Dart JS-interop layer for Google Identity Services. Google's new sign-in SDK for Web that supports multiple types of credentials.
repository: https://github.com/flutter/packages/tree/main/packages/google_identity_services_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_identiy_services_web%22
version: 0.3.1+2
version: 0.3.1+3

environment:
sdk: ^3.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,8 @@

<!-- This API key comes from: go/flutter-maps-web-tests-api-key (GCP project: flutter-infra) -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAa9cRBkhuxGq3Xw3HPz8SPwaVOhRmm7kk&libraries=geometry"></script>

<script>
// The value below is injected by flutter build, do not touch.
const serviceWorkerVersion = null;
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.initializeEngine().then(function(appRunner) {
appRunner.runApp();
});
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
11 changes: 1 addition & 10 deletions packages/google_sign_in/google_sign_in/example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,8 @@
<meta charset="UTF-8">
<meta name="google-signin-client_id" content="your-client_id.apps.googleusercontent.com">
<title>Google Sign-in Example</title>
<script src="flutter.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
_flutter.loader.loadEntrypoint({
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.autoStart();
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,8 @@

<title>example</title>
<link rel="manifest" href="manifest.json">

<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
onEntrypointLoaded: async function(engineInitializer) {
let appRunner = await engineInitializer.initializeEngine();
appRunner.runApp();
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
23 changes: 1 addition & 22 deletions packages/two_dimensional_scrollables/example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,8 @@

<title>example</title>
<link rel="manifest" href="manifest.json">

<script>
// The value below is injected by flutter build, do not touch.
const serviceWorkerVersion = null;
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.initializeEngine().then(function(appRunner) {
appRunner.runApp();
});
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>

0 comments on commit 19daf6f

Please sign in to comment.