Skip to content

Commit c76315d

Browse files
committed
v2.2.0
1 parent fa5360c commit c76315d

File tree

7 files changed

+66
-13
lines changed

7 files changed

+66
-13
lines changed

.metadata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 1d9032c7e1d867f071f2277eb1673e8f9b0274e3
7+
revision: b22742018b3edf16c6cadd7b76d9db5e7f9064b5
88
channel: stable
99

1010
project_type: app

android/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ allprojects {
2121
rootProject.buildDir = '../build'
2222
subprojects {
2323
project.buildDir = "${rootProject.buildDir}/${project.name}"
24-
}
25-
subprojects {
2624
project.evaluationDependsOn(':app')
2725
}
2826

ios/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Flutter/App.framework
1818
Flutter/Flutter.framework
1919
Flutter/Flutter.podspec
2020
Flutter/Generated.xcconfig
21+
Flutter/ephemeral/
2122
Flutter/app.flx
2223
Flutter/app.zip
2324
Flutter/flutter_assets/

ios/Flutter/flutter_export_environment.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/sh
22
# This is a generated file; do not edit or check into version control.
3-
export "FLUTTER_ROOT=C:\Users\G1Joshi\fvm\versions\2.0.6"
3+
export "FLUTTER_ROOT=C:\Users\G1Joshi\fvm\versions\2.2.0"
44
export "FLUTTER_APPLICATION_PATH=D:\Coding\Project\Personal\flutter_evolution"
5+
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
56
export "FLUTTER_TARGET=lib\main.dart"
67
export "FLUTTER_BUILD_DIR=build"
78
export "SYMROOT=${SOURCE_ROOT}/../build\ios"

lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MyApp extends StatelessWidget {
2828
}
2929

3030
class MyHomePage extends StatefulWidget {
31-
MyHomePage({Key key, this.title}) : super(key: key);
31+
MyHomePage({Key? key, required this.title}) : super(key: key);
3232

3333
// This widget is the home page of your application. It is stateful, meaning
3434
// that it has a State object (defined below) that contains fields that affect

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1818
version: 1.0.0+1
1919

2020
environment:
21-
sdk: ">=2.7.0 <3.0.0"
21+
sdk: ">=2.12.0 <3.0.0"
2222

2323
dependencies:
2424
flutter:

web/index.html

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
The path provided below has to start and end with a slash "/" in order for
99
it to work correctly.
1010
11-
Fore more details:
11+
For more details:
1212
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
1313
-->
1414
<base href="/">
@@ -23,9 +23,6 @@
2323
<meta name="apple-mobile-web-app-title" content="flutter_evolution">
2424
<link rel="apple-touch-icon" href="icons/Icon-192.png">
2525

26-
<!-- Favicon -->
27-
<link rel="icon" type="image/png" href="favicon.png"/>
28-
2926
<title>flutter_evolution</title>
3027
<link rel="manifest" href="manifest.json">
3128
</head>
@@ -34,12 +31,68 @@
3431
application. For more information, see:
3532
https://developers.google.com/web/fundamentals/primers/service-workers -->
3633
<script>
34+
var serviceWorkerVersion = null;
35+
var scriptLoaded = false;
36+
function loadMainDartJs() {
37+
if (scriptLoaded) {
38+
return;
39+
}
40+
scriptLoaded = true;
41+
var scriptTag = document.createElement('script');
42+
scriptTag.src = 'main.dart.js';
43+
scriptTag.type = 'application/javascript';
44+
document.body.append(scriptTag);
45+
}
46+
3747
if ('serviceWorker' in navigator) {
38-
window.addEventListener('flutter-first-frame', function () {
39-
navigator.serviceWorker.register('flutter_service_worker.js');
48+
// Service workers are supported. Use them.
49+
window.addEventListener('load', function () {
50+
// Wait for registration to finish before dropping the <script> tag.
51+
// Otherwise, the browser will load the script multiple times,
52+
// potentially different versions.
53+
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
54+
navigator.serviceWorker.register(serviceWorkerUrl)
55+
.then((reg) => {
56+
function waitForActivation(serviceWorker) {
57+
serviceWorker.addEventListener('statechange', () => {
58+
if (serviceWorker.state == 'activated') {
59+
console.log('Installed new service worker.');
60+
loadMainDartJs();
61+
}
62+
});
63+
}
64+
if (!reg.active && (reg.installing || reg.waiting)) {
65+
// No active web worker and we have installed or are installing
66+
// one for the first time. Simply wait for it to activate.
67+
waitForActivation(reg.installing ?? reg.waiting);
68+
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
69+
// When the app updates the serviceWorkerVersion changes, so we
70+
// need to ask the service worker to update.
71+
console.log('New service worker available.');
72+
reg.update();
73+
waitForActivation(reg.installing);
74+
} else {
75+
// Existing service worker is still good.
76+
console.log('Loading app from service worker.');
77+
loadMainDartJs();
78+
}
79+
});
80+
81+
// If service worker doesn't succeed in a reasonable amount of time,
82+
// fallback to plaint <script> tag.
83+
setTimeout(() => {
84+
if (!scriptLoaded) {
85+
console.warn(
86+
'Failed to load app from service worker. Falling back to plain <script> tag.',
87+
);
88+
loadMainDartJs();
89+
}
90+
}, 4000);
4091
});
92+
} else {
93+
// Service workers not supported. Just drop the <script> tag.
94+
loadMainDartJs();
4195
}
4296
</script>
43-
<script src="main.dart.js" type="application/javascript"></script>
4497
</body>
4598
</html>

0 commit comments

Comments
 (0)