├── .gitignore
├── .metadata
├── LICENSE
├── README.md
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── xuexiang
│ │ │ │ └── flutter_app_update_example
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── art
└── demo.gif
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
├── lib
├── main.dart
├── update
│ ├── entity
│ │ ├── update_entity.dart
│ │ └── update_info.dart
│ ├── update.dart
│ ├── update_parser.dart
│ └── update_prompter.dart
└── utils
│ ├── common.dart
│ ├── http.dart
│ └── toast.dart
├── pubspec.yaml
└── test
└── widget_test.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | /build/
32 |
33 | # Web related
34 | lib/generated_plugin_registrant.dart
35 |
36 | # Symbolication related
37 | app.*.symbols
38 |
39 | # Obfuscation related
40 | app.*.map.json
41 |
42 | # Exceptions to above rules.
43 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
44 |
45 | .vscode/
46 | pubspec.lock
47 |
48 | Podfile
49 | Podfile.lock
50 | Pods/
51 | .symlinks/
52 | **/Flutter/App.framework/
53 | **/Flutter/Flutter.framework/
54 | **/Flutter/Generated.xcconfig
55 | **/Flutter/flutter_assets/
56 | ServiceDefinitions.json
57 | xcuserdata/
58 | **/DerivedData/
59 |
60 | local.properties
61 | keystore.properties
62 | .gradle/
63 | gradlew
64 | gradlew.bat
65 | gradle-wrapper.jar
66 |
67 | GeneratedPluginRegistrant.h
68 | GeneratedPluginRegistrant.m
69 | GeneratedPluginRegistrant.java
70 | build/
71 |
72 | .project
73 | .classpath
74 | .settings
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 8af6b2f038c1172e61d418869363a28dffec3cb4
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction, and
10 | distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright
13 | owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all other entities
16 | that control, are controlled by, or are under common control with that entity.
17 | For the purposes of this definition, "control" means (i) the power, direct or
18 | indirect, to cause the direction or management of such entity, whether by
19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20 | outstanding shares, or (iii) beneficial ownership of such entity.
21 |
22 | "You" (or "Your") shall mean an individual or Legal Entity exercising
23 | permissions granted by this License.
24 |
25 | "Source" form shall mean the preferred form for making modifications, including
26 | but not limited to software source code, documentation source, and configuration
27 | files.
28 |
29 | "Object" form shall mean any form resulting from mechanical transformation or
30 | translation of a Source form, including but not limited to compiled object code,
31 | generated documentation, and conversions to other media types.
32 |
33 | "Work" shall mean the work of authorship, whether in Source or Object form, made
34 | available under the License, as indicated by a copyright notice that is included
35 | in or attached to the work (an example is provided in the Appendix below).
36 |
37 | "Derivative Works" shall mean any work, whether in Source or Object form, that
38 | is based on (or derived from) the Work and for which the editorial revisions,
39 | annotations, elaborations, or other modifications represent, as a whole, an
40 | original work of authorship. For the purposes of this License, Derivative Works
41 | shall not include works that remain separable from, or merely link (or bind by
42 | name) to the interfaces of, the Work and Derivative Works thereof.
43 |
44 | "Contribution" shall mean any work of authorship, including the original version
45 | of the Work and any modifications or additions to that Work or Derivative Works
46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work
47 | by the copyright owner or by an individual or Legal Entity authorized to submit
48 | on behalf of the copyright owner. For the purposes of this definition,
49 | "submitted" means any form of electronic, verbal, or written communication sent
50 | to the Licensor or its representatives, including but not limited to
51 | communication on electronic mailing lists, source code control systems, and
52 | issue tracking systems that are managed by, or on behalf of, the Licensor for
53 | the purpose of discussing and improving the Work, but excluding communication
54 | that is conspicuously marked or otherwise designated in writing by the copyright
55 | owner as "Not a Contribution."
56 |
57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58 | of whom a Contribution has been received by Licensor and subsequently
59 | incorporated within the Work.
60 |
61 | 2. Grant of Copyright License.
62 |
63 | Subject to the terms and conditions of this License, each Contributor hereby
64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
65 | irrevocable copyright license to reproduce, prepare Derivative Works of,
66 | publicly display, publicly perform, sublicense, and distribute the Work and such
67 | Derivative Works in Source or Object form.
68 |
69 | 3. Grant of Patent License.
70 |
71 | Subject to the terms and conditions of this License, each Contributor hereby
72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
73 | irrevocable (except as stated in this section) patent license to make, have
74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where
75 | such license applies only to those patent claims licensable by such Contributor
76 | that are necessarily infringed by their Contribution(s) alone or by combination
77 | of their Contribution(s) with the Work to which such Contribution(s) was
78 | submitted. If You institute patent litigation against any entity (including a
79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a
80 | Contribution incorporated within the Work constitutes direct or contributory
81 | patent infringement, then any patent licenses granted to You under this License
82 | for that Work shall terminate as of the date such litigation is filed.
83 |
84 | 4. Redistribution.
85 |
86 | You may reproduce and distribute copies of the Work or Derivative Works thereof
87 | in any medium, with or without modifications, and in Source or Object form,
88 | provided that You meet the following conditions:
89 |
90 | You must give any other recipients of the Work or Derivative Works a copy of
91 | this License; and
92 | You must cause any modified files to carry prominent notices stating that You
93 | changed the files; and
94 | You must retain, in the Source form of any Derivative Works that You distribute,
95 | all copyright, patent, trademark, and attribution notices from the Source form
96 | of the Work, excluding those notices that do not pertain to any part of the
97 | Derivative Works; and
98 | If the Work includes a "NOTICE" text file as part of its distribution, then any
99 | Derivative Works that You distribute must include a readable copy of the
100 | attribution notices contained within such NOTICE file, excluding those notices
101 | that do not pertain to any part of the Derivative Works, in at least one of the
102 | following places: within a NOTICE text file distributed as part of the
103 | Derivative Works; within the Source form or documentation, if provided along
104 | with the Derivative Works; or, within a display generated by the Derivative
105 | Works, if and wherever such third-party notices normally appear. The contents of
106 | the NOTICE file are for informational purposes only and do not modify the
107 | License. You may add Your own attribution notices within Derivative Works that
108 | You distribute, alongside or as an addendum to the NOTICE text from the Work,
109 | provided that such additional attribution notices cannot be construed as
110 | modifying the License.
111 | You may add Your own copyright statement to Your modifications and may provide
112 | additional or different license terms and conditions for use, reproduction, or
113 | distribution of Your modifications, or for any such Derivative Works as a whole,
114 | provided Your use, reproduction, and distribution of the Work otherwise complies
115 | with the conditions stated in this License.
116 |
117 | 5. Submission of Contributions.
118 |
119 | Unless You explicitly state otherwise, any Contribution intentionally submitted
120 | for inclusion in the Work by You to the Licensor shall be under the terms and
121 | conditions of this License, without any additional terms or conditions.
122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of
123 | any separate license agreement you may have executed with Licensor regarding
124 | such Contributions.
125 |
126 | 6. Trademarks.
127 |
128 | This License does not grant permission to use the trade names, trademarks,
129 | service marks, or product names of the Licensor, except as required for
130 | reasonable and customary use in describing the origin of the Work and
131 | reproducing the content of the NOTICE file.
132 |
133 | 7. Disclaimer of Warranty.
134 |
135 | Unless required by applicable law or agreed to in writing, Licensor provides the
136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
138 | including, without limitation, any warranties or conditions of TITLE,
139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
140 | solely responsible for determining the appropriateness of using or
141 | redistributing the Work and assume any risks associated with Your exercise of
142 | permissions under this License.
143 |
144 | 8. Limitation of Liability.
145 |
146 | In no event and under no legal theory, whether in tort (including negligence),
147 | contract, or otherwise, unless required by applicable law (such as deliberate
148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be
149 | liable to You for damages, including any direct, indirect, special, incidental,
150 | or consequential damages of any character arising as a result of this License or
151 | out of the use or inability to use the Work (including but not limited to
152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or
153 | any and all other commercial damages or losses), even if such Contributor has
154 | been advised of the possibility of such damages.
155 |
156 | 9. Accepting Warranty or Additional Liability.
157 |
158 | While redistributing the Work or Derivative Works thereof, You may choose to
159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or
160 | other liability obligations and/or rights consistent with this License. However,
161 | in accepting such obligations, You may act only on Your own behalf and on Your
162 | sole responsibility, not on behalf of any other Contributor, and only if You
163 | agree to indemnify, defend, and hold each Contributor harmless for any liability
164 | incurred by, or claims asserted against, such Contributor by reason of your
165 | accepting any such warranty or additional liability.
166 |
167 | END OF TERMS AND CONDITIONS
168 |
169 | APPENDIX: How to apply the Apache License to your work
170 |
171 | To apply the Apache License to your work, attach the following boilerplate
172 | notice, with the fields enclosed by brackets "{}" replaced with your own
173 | identifying information. (Don't include the brackets!) The text should be
174 | enclosed in the appropriate comment syntax for the file format. We also
175 | recommend that a file or class name and description of purpose be included on
176 | the same "printed page" as the copyright notice for easier identification within
177 | third-party archives.
178 |
179 | Copyright 2020 xuexiangjys
180 |
181 | Licensed under the Apache License, Version 2.0 (the "License");
182 | you may not use this file except in compliance with the License.
183 | You may obtain a copy of the License at
184 |
185 | http://www.apache.org/licenses/LICENSE-2.0
186 |
187 | Unless required by applicable law or agreed to in writing, software
188 | distributed under the License is distributed on an "AS IS" BASIS,
189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190 | See the License for the specific language governing permissions and
191 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # flutter_app_update_example
2 |
3 | 演示如何使用现有的flutter插件实现应用内的版本更新功能。
4 |
5 | ## 关于我
6 |
7 | [](https://github.com/xuexiangjys) [](http://blog.csdn.net/xuexiangjys) [](https://www.jianshu.com/u/6bf605575337) [](https://juejin.im/user/598feef55188257d592e56ed) [](https://www.zhihu.com/people/xuexiangjys)
8 |
9 | ---
10 |
11 | ## 演示
12 |
13 | 
14 |
15 | ## 插件使用
16 |
17 | * [flutter_update_dialog 优美的版本更新弹窗](https://pub.dev/packages/flutter_update_dialog)
18 | * [dio 非常好用的网络请求框架](https://pub.dev/packages/dio)
19 | * [package_info 获取包信息](https://pub.dev/packages/package_info)
20 | * [path_provider 获取文件路径](https://pub.dev/packages/path_provider)
21 | * [install_plugin 应用安装插件](https://pub.dev/packages/install_plugin)
22 |
23 |
24 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 28
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | lintOptions {
36 | disable 'InvalidPackage'
37 | }
38 |
39 | defaultConfig {
40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41 | applicationId "com.xuexiang.flutter_app_update_example"
42 | minSdkVersion 16
43 | targetSdkVersion 28
44 | versionCode flutterVersionCode.toInteger()
45 | versionName flutterVersionName
46 | }
47 |
48 | buildTypes {
49 | release {
50 | // TODO: Add your own signing config for the release build.
51 | // Signing with the debug keys for now, so `flutter run --release` works.
52 | signingConfig signingConfigs.debug
53 | }
54 | }
55 | }
56 |
57 | flutter {
58 | source '../..'
59 | }
60 |
61 | dependencies {
62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
63 | }
64 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
8 |
12 |
19 |
23 |
27 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
43 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/xuexiang/flutter_app_update_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.xuexiang.flutter_app_update_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.3.50'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.5.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Flutter Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | include ':app'
6 |
7 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
8 | def properties = new Properties()
9 |
10 | assert localPropertiesFile.exists()
11 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12 |
13 | def flutterSdkPath = properties.getProperty("flutter.sdk")
14 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
15 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
16 |
--------------------------------------------------------------------------------
/art/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/art/demo.gif
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
16 | DC86CA7A3F2F9A9D728B118E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAC1AD81EB496B6EB8F4FC0C /* Pods_Runner.framework */; };
17 | /* End PBXBuildFile section */
18 |
19 | /* Begin PBXCopyFilesBuildPhase section */
20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
21 | isa = PBXCopyFilesBuildPhase;
22 | buildActionMask = 2147483647;
23 | dstPath = "";
24 | dstSubfolderSpec = 10;
25 | files = (
26 | );
27 | name = "Embed Frameworks";
28 | runOnlyForDeploymentPostprocessing = 0;
29 | };
30 | /* End PBXCopyFilesBuildPhase section */
31 |
32 | /* Begin PBXFileReference section */
33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
35 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
36 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
37 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
38 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
39 | 95207D9438F280BB071304E5 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
40 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
41 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
42 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
43 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
44 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
45 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
46 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
47 | 9E1E70117B916C7D7063E948 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
48 | A78B24EA3F1DA342D2A4833B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
49 | FAC1AD81EB496B6EB8F4FC0C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
50 | /* End PBXFileReference section */
51 |
52 | /* Begin PBXFrameworksBuildPhase section */
53 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
54 | isa = PBXFrameworksBuildPhase;
55 | buildActionMask = 2147483647;
56 | files = (
57 | DC86CA7A3F2F9A9D728B118E /* Pods_Runner.framework in Frameworks */,
58 | );
59 | runOnlyForDeploymentPostprocessing = 0;
60 | };
61 | /* End PBXFrameworksBuildPhase section */
62 |
63 | /* Begin PBXGroup section */
64 | 5D922DB9417BAB3CC357A2CA /* Frameworks */ = {
65 | isa = PBXGroup;
66 | children = (
67 | FAC1AD81EB496B6EB8F4FC0C /* Pods_Runner.framework */,
68 | );
69 | name = Frameworks;
70 | sourceTree = "";
71 | };
72 | 85E7EDED323BC1B67C3B7F94 /* Pods */ = {
73 | isa = PBXGroup;
74 | children = (
75 | 95207D9438F280BB071304E5 /* Pods-Runner.debug.xcconfig */,
76 | 9E1E70117B916C7D7063E948 /* Pods-Runner.release.xcconfig */,
77 | A78B24EA3F1DA342D2A4833B /* Pods-Runner.profile.xcconfig */,
78 | );
79 | name = Pods;
80 | path = Pods;
81 | sourceTree = "";
82 | };
83 | 9740EEB11CF90186004384FC /* Flutter */ = {
84 | isa = PBXGroup;
85 | children = (
86 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
87 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
88 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
89 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
90 | );
91 | name = Flutter;
92 | sourceTree = "";
93 | };
94 | 97C146E51CF9000F007C117D = {
95 | isa = PBXGroup;
96 | children = (
97 | 9740EEB11CF90186004384FC /* Flutter */,
98 | 97C146F01CF9000F007C117D /* Runner */,
99 | 97C146EF1CF9000F007C117D /* Products */,
100 | 85E7EDED323BC1B67C3B7F94 /* Pods */,
101 | 5D922DB9417BAB3CC357A2CA /* Frameworks */,
102 | );
103 | sourceTree = "";
104 | };
105 | 97C146EF1CF9000F007C117D /* Products */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 97C146EE1CF9000F007C117D /* Runner.app */,
109 | );
110 | name = Products;
111 | sourceTree = "";
112 | };
113 | 97C146F01CF9000F007C117D /* Runner */ = {
114 | isa = PBXGroup;
115 | children = (
116 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
117 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
118 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
119 | 97C147021CF9000F007C117D /* Info.plist */,
120 | 97C146F11CF9000F007C117D /* Supporting Files */,
121 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
122 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
123 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
124 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
125 | );
126 | path = Runner;
127 | sourceTree = "";
128 | };
129 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
130 | isa = PBXGroup;
131 | children = (
132 | );
133 | name = "Supporting Files";
134 | sourceTree = "";
135 | };
136 | /* End PBXGroup section */
137 |
138 | /* Begin PBXNativeTarget section */
139 | 97C146ED1CF9000F007C117D /* Runner */ = {
140 | isa = PBXNativeTarget;
141 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
142 | buildPhases = (
143 | 6E97D8AC94C3D051928EDC6C /* [CP] Check Pods Manifest.lock */,
144 | 9740EEB61CF901F6004384FC /* Run Script */,
145 | 97C146EA1CF9000F007C117D /* Sources */,
146 | 97C146EB1CF9000F007C117D /* Frameworks */,
147 | 97C146EC1CF9000F007C117D /* Resources */,
148 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
149 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
150 | 11AE0B63B828202BB5212531 /* [CP] Embed Pods Frameworks */,
151 | );
152 | buildRules = (
153 | );
154 | dependencies = (
155 | );
156 | name = Runner;
157 | productName = Runner;
158 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
159 | productType = "com.apple.product-type.application";
160 | };
161 | /* End PBXNativeTarget section */
162 |
163 | /* Begin PBXProject section */
164 | 97C146E61CF9000F007C117D /* Project object */ = {
165 | isa = PBXProject;
166 | attributes = {
167 | LastUpgradeCheck = 1020;
168 | ORGANIZATIONNAME = "";
169 | TargetAttributes = {
170 | 97C146ED1CF9000F007C117D = {
171 | CreatedOnToolsVersion = 7.3.1;
172 | LastSwiftMigration = 1100;
173 | };
174 | };
175 | };
176 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
177 | compatibilityVersion = "Xcode 9.3";
178 | developmentRegion = en;
179 | hasScannedForEncodings = 0;
180 | knownRegions = (
181 | en,
182 | Base,
183 | );
184 | mainGroup = 97C146E51CF9000F007C117D;
185 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
186 | projectDirPath = "";
187 | projectRoot = "";
188 | targets = (
189 | 97C146ED1CF9000F007C117D /* Runner */,
190 | );
191 | };
192 | /* End PBXProject section */
193 |
194 | /* Begin PBXResourcesBuildPhase section */
195 | 97C146EC1CF9000F007C117D /* Resources */ = {
196 | isa = PBXResourcesBuildPhase;
197 | buildActionMask = 2147483647;
198 | files = (
199 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
200 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
201 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
202 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
203 | );
204 | runOnlyForDeploymentPostprocessing = 0;
205 | };
206 | /* End PBXResourcesBuildPhase section */
207 |
208 | /* Begin PBXShellScriptBuildPhase section */
209 | 11AE0B63B828202BB5212531 /* [CP] Embed Pods Frameworks */ = {
210 | isa = PBXShellScriptBuildPhase;
211 | buildActionMask = 2147483647;
212 | files = (
213 | );
214 | inputPaths = (
215 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
216 | "${PODS_ROOT}/../Flutter/Flutter.framework",
217 | "${BUILT_PRODUCTS_DIR}/install_plugin/install_plugin.framework",
218 | "${BUILT_PRODUCTS_DIR}/package_info/package_info.framework",
219 | "${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
220 | );
221 | name = "[CP] Embed Pods Frameworks";
222 | outputPaths = (
223 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
224 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/install_plugin.framework",
225 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info.framework",
226 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
227 | );
228 | runOnlyForDeploymentPostprocessing = 0;
229 | shellPath = /bin/sh;
230 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
231 | showEnvVarsInLog = 0;
232 | };
233 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
234 | isa = PBXShellScriptBuildPhase;
235 | buildActionMask = 2147483647;
236 | files = (
237 | );
238 | inputPaths = (
239 | );
240 | name = "Thin Binary";
241 | outputPaths = (
242 | );
243 | runOnlyForDeploymentPostprocessing = 0;
244 | shellPath = /bin/sh;
245 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
246 | };
247 | 6E97D8AC94C3D051928EDC6C /* [CP] Check Pods Manifest.lock */ = {
248 | isa = PBXShellScriptBuildPhase;
249 | buildActionMask = 2147483647;
250 | files = (
251 | );
252 | inputFileListPaths = (
253 | );
254 | inputPaths = (
255 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
256 | "${PODS_ROOT}/Manifest.lock",
257 | );
258 | name = "[CP] Check Pods Manifest.lock";
259 | outputFileListPaths = (
260 | );
261 | outputPaths = (
262 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
263 | );
264 | runOnlyForDeploymentPostprocessing = 0;
265 | shellPath = /bin/sh;
266 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
267 | showEnvVarsInLog = 0;
268 | };
269 | 9740EEB61CF901F6004384FC /* Run Script */ = {
270 | isa = PBXShellScriptBuildPhase;
271 | buildActionMask = 2147483647;
272 | files = (
273 | );
274 | inputPaths = (
275 | );
276 | name = "Run Script";
277 | outputPaths = (
278 | );
279 | runOnlyForDeploymentPostprocessing = 0;
280 | shellPath = /bin/sh;
281 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
282 | };
283 | /* End PBXShellScriptBuildPhase section */
284 |
285 | /* Begin PBXSourcesBuildPhase section */
286 | 97C146EA1CF9000F007C117D /* Sources */ = {
287 | isa = PBXSourcesBuildPhase;
288 | buildActionMask = 2147483647;
289 | files = (
290 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
291 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
292 | );
293 | runOnlyForDeploymentPostprocessing = 0;
294 | };
295 | /* End PBXSourcesBuildPhase section */
296 |
297 | /* Begin PBXVariantGroup section */
298 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
299 | isa = PBXVariantGroup;
300 | children = (
301 | 97C146FB1CF9000F007C117D /* Base */,
302 | );
303 | name = Main.storyboard;
304 | sourceTree = "";
305 | };
306 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
307 | isa = PBXVariantGroup;
308 | children = (
309 | 97C147001CF9000F007C117D /* Base */,
310 | );
311 | name = LaunchScreen.storyboard;
312 | sourceTree = "";
313 | };
314 | /* End PBXVariantGroup section */
315 |
316 | /* Begin XCBuildConfiguration section */
317 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
318 | isa = XCBuildConfiguration;
319 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
320 | buildSettings = {
321 | ALWAYS_SEARCH_USER_PATHS = NO;
322 | CLANG_ANALYZER_NONNULL = YES;
323 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
324 | CLANG_CXX_LIBRARY = "libc++";
325 | CLANG_ENABLE_MODULES = YES;
326 | CLANG_ENABLE_OBJC_ARC = YES;
327 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
328 | CLANG_WARN_BOOL_CONVERSION = YES;
329 | CLANG_WARN_COMMA = YES;
330 | CLANG_WARN_CONSTANT_CONVERSION = YES;
331 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
332 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
333 | CLANG_WARN_EMPTY_BODY = YES;
334 | CLANG_WARN_ENUM_CONVERSION = YES;
335 | CLANG_WARN_INFINITE_RECURSION = YES;
336 | CLANG_WARN_INT_CONVERSION = YES;
337 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
338 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
339 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
341 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
342 | CLANG_WARN_STRICT_PROTOTYPES = YES;
343 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
344 | CLANG_WARN_UNREACHABLE_CODE = YES;
345 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
346 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
347 | COPY_PHASE_STRIP = NO;
348 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
349 | ENABLE_NS_ASSERTIONS = NO;
350 | ENABLE_STRICT_OBJC_MSGSEND = YES;
351 | GCC_C_LANGUAGE_STANDARD = gnu99;
352 | GCC_NO_COMMON_BLOCKS = YES;
353 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
354 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
355 | GCC_WARN_UNDECLARED_SELECTOR = YES;
356 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
357 | GCC_WARN_UNUSED_FUNCTION = YES;
358 | GCC_WARN_UNUSED_VARIABLE = YES;
359 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
360 | MTL_ENABLE_DEBUG_INFO = NO;
361 | SDKROOT = iphoneos;
362 | SUPPORTED_PLATFORMS = iphoneos;
363 | TARGETED_DEVICE_FAMILY = "1,2";
364 | VALIDATE_PRODUCT = YES;
365 | };
366 | name = Profile;
367 | };
368 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
369 | isa = XCBuildConfiguration;
370 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
371 | buildSettings = {
372 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
373 | CLANG_ENABLE_MODULES = YES;
374 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
375 | ENABLE_BITCODE = NO;
376 | FRAMEWORK_SEARCH_PATHS = (
377 | "$(inherited)",
378 | "$(PROJECT_DIR)/Flutter",
379 | );
380 | INFOPLIST_FILE = Runner/Info.plist;
381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
382 | LIBRARY_SEARCH_PATHS = (
383 | "$(inherited)",
384 | "$(PROJECT_DIR)/Flutter",
385 | );
386 | PRODUCT_BUNDLE_IDENTIFIER = com.xuexiang.flutterAppUpdateExample;
387 | PRODUCT_NAME = "$(TARGET_NAME)";
388 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
389 | SWIFT_VERSION = 5.0;
390 | VERSIONING_SYSTEM = "apple-generic";
391 | };
392 | name = Profile;
393 | };
394 | 97C147031CF9000F007C117D /* Debug */ = {
395 | isa = XCBuildConfiguration;
396 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
397 | buildSettings = {
398 | ALWAYS_SEARCH_USER_PATHS = NO;
399 | CLANG_ANALYZER_NONNULL = YES;
400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
401 | CLANG_CXX_LIBRARY = "libc++";
402 | CLANG_ENABLE_MODULES = YES;
403 | CLANG_ENABLE_OBJC_ARC = YES;
404 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
405 | CLANG_WARN_BOOL_CONVERSION = YES;
406 | CLANG_WARN_COMMA = YES;
407 | CLANG_WARN_CONSTANT_CONVERSION = YES;
408 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
409 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
410 | CLANG_WARN_EMPTY_BODY = YES;
411 | CLANG_WARN_ENUM_CONVERSION = YES;
412 | CLANG_WARN_INFINITE_RECURSION = YES;
413 | CLANG_WARN_INT_CONVERSION = YES;
414 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
415 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
416 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
417 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
418 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
419 | CLANG_WARN_STRICT_PROTOTYPES = YES;
420 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
421 | CLANG_WARN_UNREACHABLE_CODE = YES;
422 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
423 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
424 | COPY_PHASE_STRIP = NO;
425 | DEBUG_INFORMATION_FORMAT = dwarf;
426 | ENABLE_STRICT_OBJC_MSGSEND = YES;
427 | ENABLE_TESTABILITY = YES;
428 | GCC_C_LANGUAGE_STANDARD = gnu99;
429 | GCC_DYNAMIC_NO_PIC = NO;
430 | GCC_NO_COMMON_BLOCKS = YES;
431 | GCC_OPTIMIZATION_LEVEL = 0;
432 | GCC_PREPROCESSOR_DEFINITIONS = (
433 | "DEBUG=1",
434 | "$(inherited)",
435 | );
436 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
437 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
438 | GCC_WARN_UNDECLARED_SELECTOR = YES;
439 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
440 | GCC_WARN_UNUSED_FUNCTION = YES;
441 | GCC_WARN_UNUSED_VARIABLE = YES;
442 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
443 | MTL_ENABLE_DEBUG_INFO = YES;
444 | ONLY_ACTIVE_ARCH = YES;
445 | SDKROOT = iphoneos;
446 | TARGETED_DEVICE_FAMILY = "1,2";
447 | };
448 | name = Debug;
449 | };
450 | 97C147041CF9000F007C117D /* Release */ = {
451 | isa = XCBuildConfiguration;
452 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
453 | buildSettings = {
454 | ALWAYS_SEARCH_USER_PATHS = NO;
455 | CLANG_ANALYZER_NONNULL = YES;
456 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
457 | CLANG_CXX_LIBRARY = "libc++";
458 | CLANG_ENABLE_MODULES = YES;
459 | CLANG_ENABLE_OBJC_ARC = YES;
460 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
461 | CLANG_WARN_BOOL_CONVERSION = YES;
462 | CLANG_WARN_COMMA = YES;
463 | CLANG_WARN_CONSTANT_CONVERSION = YES;
464 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
465 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
466 | CLANG_WARN_EMPTY_BODY = YES;
467 | CLANG_WARN_ENUM_CONVERSION = YES;
468 | CLANG_WARN_INFINITE_RECURSION = YES;
469 | CLANG_WARN_INT_CONVERSION = YES;
470 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
471 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
472 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
473 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
474 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
475 | CLANG_WARN_STRICT_PROTOTYPES = YES;
476 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
477 | CLANG_WARN_UNREACHABLE_CODE = YES;
478 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
479 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
480 | COPY_PHASE_STRIP = NO;
481 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
482 | ENABLE_NS_ASSERTIONS = NO;
483 | ENABLE_STRICT_OBJC_MSGSEND = YES;
484 | GCC_C_LANGUAGE_STANDARD = gnu99;
485 | GCC_NO_COMMON_BLOCKS = YES;
486 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
487 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
488 | GCC_WARN_UNDECLARED_SELECTOR = YES;
489 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
490 | GCC_WARN_UNUSED_FUNCTION = YES;
491 | GCC_WARN_UNUSED_VARIABLE = YES;
492 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
493 | MTL_ENABLE_DEBUG_INFO = NO;
494 | SDKROOT = iphoneos;
495 | SUPPORTED_PLATFORMS = iphoneos;
496 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
497 | TARGETED_DEVICE_FAMILY = "1,2";
498 | VALIDATE_PRODUCT = YES;
499 | };
500 | name = Release;
501 | };
502 | 97C147061CF9000F007C117D /* Debug */ = {
503 | isa = XCBuildConfiguration;
504 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
505 | buildSettings = {
506 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
507 | CLANG_ENABLE_MODULES = YES;
508 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
509 | ENABLE_BITCODE = NO;
510 | FRAMEWORK_SEARCH_PATHS = (
511 | "$(inherited)",
512 | "$(PROJECT_DIR)/Flutter",
513 | );
514 | INFOPLIST_FILE = Runner/Info.plist;
515 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
516 | LIBRARY_SEARCH_PATHS = (
517 | "$(inherited)",
518 | "$(PROJECT_DIR)/Flutter",
519 | );
520 | PRODUCT_BUNDLE_IDENTIFIER = com.xuexiang.flutterAppUpdateExample;
521 | PRODUCT_NAME = "$(TARGET_NAME)";
522 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
523 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
524 | SWIFT_VERSION = 5.0;
525 | VERSIONING_SYSTEM = "apple-generic";
526 | };
527 | name = Debug;
528 | };
529 | 97C147071CF9000F007C117D /* Release */ = {
530 | isa = XCBuildConfiguration;
531 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
532 | buildSettings = {
533 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
534 | CLANG_ENABLE_MODULES = YES;
535 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
536 | ENABLE_BITCODE = NO;
537 | FRAMEWORK_SEARCH_PATHS = (
538 | "$(inherited)",
539 | "$(PROJECT_DIR)/Flutter",
540 | );
541 | INFOPLIST_FILE = Runner/Info.plist;
542 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
543 | LIBRARY_SEARCH_PATHS = (
544 | "$(inherited)",
545 | "$(PROJECT_DIR)/Flutter",
546 | );
547 | PRODUCT_BUNDLE_IDENTIFIER = com.xuexiang.flutterAppUpdateExample;
548 | PRODUCT_NAME = "$(TARGET_NAME)";
549 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
550 | SWIFT_VERSION = 5.0;
551 | VERSIONING_SYSTEM = "apple-generic";
552 | };
553 | name = Release;
554 | };
555 | /* End XCBuildConfiguration section */
556 |
557 | /* Begin XCConfigurationList section */
558 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
559 | isa = XCConfigurationList;
560 | buildConfigurations = (
561 | 97C147031CF9000F007C117D /* Debug */,
562 | 97C147041CF9000F007C117D /* Release */,
563 | 249021D3217E4FDB00AE95B9 /* Profile */,
564 | );
565 | defaultConfigurationIsVisible = 0;
566 | defaultConfigurationName = Release;
567 | };
568 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
569 | isa = XCConfigurationList;
570 | buildConfigurations = (
571 | 97C147061CF9000F007C117D /* Debug */,
572 | 97C147071CF9000F007C117D /* Release */,
573 | 249021D4217E4FDB00AE95B9 /* Profile */,
574 | );
575 | defaultConfigurationIsVisible = 0;
576 | defaultConfigurationName = Release;
577 | };
578 | /* End XCConfigurationList section */
579 | };
580 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
581 | }
582 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuexiangjys/flutter_app_update_example/3e792827be0503ac83cd4d14d2ebd3d0766291aa/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_app_update_example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_app_update_example/update/update.dart';
3 |
4 | import 'utils/toast.dart';
5 |
6 | void main() {
7 | runApp(MyApp());
8 | }
9 |
10 | class MyApp extends StatelessWidget {
11 | @override
12 | Widget build(BuildContext context) {
13 | return ToastUtils.init(MaterialApp(
14 | title: 'Flutter Demo',
15 | theme: ThemeData(
16 | visualDensity: VisualDensity.adaptivePlatformDensity,
17 | ),
18 | home: MyHomePage(title: 'Update Demo'),
19 | ));
20 | }
21 | }
22 |
23 | class MyHomePage extends StatefulWidget {
24 | MyHomePage({Key key, this.title}) : super(key: key);
25 |
26 | final String title;
27 |
28 | @override
29 | _MyHomePageState createState() => _MyHomePageState();
30 | }
31 |
32 | class _MyHomePageState extends State {
33 |
34 | String _updateUrl =
35 | "https://gitee.com/xuexiangjys/XUpdate/raw/master/jsonapi/update_test.json";
36 |
37 | @override
38 | void initState() {
39 | super.initState();
40 | UpdateManager.init();
41 | }
42 |
43 | @override
44 | Widget build(BuildContext context) {
45 | return Scaffold(
46 | appBar: AppBar(
47 | title: Text(widget.title),
48 | ),
49 | body: SingleChildScrollView(
50 | padding: EdgeInsets.all(10),
51 | child:
52 | Column(crossAxisAlignment: CrossAxisAlignment.start, //文本是起始端对齐
53 | children: [
54 | ButtonBar(
55 | alignment:
56 | MainAxisAlignment.start, //布局方向,默认MainAxisAlignment.end
57 | mainAxisSize: MainAxisSize.min, //主轴大小,默认MainAxisSize.max
58 | children: [
59 | RaisedButton(
60 | child: Text('版本更新'),
61 | color: Theme.of(context).primaryColor,
62 | onPressed: checkUpdate,
63 | ),
64 | ],
65 | ),
66 | ])));
67 | }
68 |
69 | void checkUpdate() {
70 | UpdateManager.checkUpdate(context, _updateUrl);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/update/entity/update_entity.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:flutter/cupertino.dart';
4 |
5 | ///
6 | /// 版本更新信息,用于显示版本更新弹窗
7 | ///
8 | class UpdateEntity {
9 | //===========是否可以升级=============//
10 |
11 | ///是否有新版本
12 | final bool hasUpdate;
13 |
14 | ///是否强制安装:不安装无法使用app
15 | final bool isForce;
16 |
17 | ///是否可忽略该版本
18 | final bool isIgnorable;
19 |
20 | //===========升级的信息=============//
21 |
22 | ///版本号
23 | final int versionCode;
24 |
25 | ///版本名称
26 | final String versionName;
27 |
28 | ///更新内容
29 | final String updateContent;
30 |
31 | ///下载地址
32 | final String downloadUrl;
33 |
34 | ///apk的大小[KB]
35 | final int apkSize;
36 |
37 | ///apk文件的加密值(这里默认是md5值)
38 | final String apkMd5;
39 |
40 | UpdateEntity({
41 | @required this.hasUpdate,
42 | this.isForce = false,
43 | this.isIgnorable = false,
44 | @required this.versionCode,
45 | @required this.versionName,
46 | @required this.updateContent,
47 | @required this.downloadUrl,
48 | this.apkSize = 0,
49 | this.apkMd5 = '',
50 | });
51 |
52 | Map toMap() {
53 | return {
54 | 'hasUpdate': hasUpdate,
55 | 'isForce': isForce,
56 | 'isIgnorable': isIgnorable,
57 | 'versionCode': versionCode,
58 | 'versionName': versionName,
59 | 'updateContent': updateContent,
60 | 'downloadUrl': downloadUrl,
61 | 'apkSize': apkSize,
62 | 'apkMd5': apkMd5,
63 | };
64 | }
65 |
66 | static UpdateEntity fromMap(Map map) {
67 | if (map == null) return null;
68 |
69 | return UpdateEntity(
70 | hasUpdate: map['hasUpdate'],
71 | isForce: map['isForce'],
72 | isIgnorable: map['isIgnorable'],
73 | versionCode: map['versionCode']?.toInt(),
74 | versionName: map['versionName'],
75 | updateContent: map['updateContent'],
76 | downloadUrl: map['downloadUrl'],
77 | apkSize: map['apkSize']?.toInt(),
78 | apkMd5: map['apkMd5'],
79 | );
80 | }
81 |
82 | String toJson() => json.encode(toMap());
83 |
84 | static UpdateEntity fromJson(String source) => fromMap(json.decode(source));
85 |
86 | @override
87 | String toString() {
88 | return 'UpdateEntity hasUpdate: $hasUpdate, isForce: $isForce, isIgnorable: $isIgnorable, versionCode: $versionCode, versionName: $versionName, updateContent: $updateContent, downloadUrl: $downloadUrl, apkSize: $apkSize, apkMd5: $apkMd5';
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/lib/update/entity/update_info.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | /// 0:无版本更新
4 | const int NO_NEW_VERSION = 0;
5 |
6 | /// 1:有版本更新,不需要强制升级
7 | const int HAVE_NEW_VERSION = 1;
8 |
9 | /// 2:有版本更新,需要强制升级
10 | const int HAVE_NEW_VERSION_FORCED_UPLOAD = 2;
11 |
12 | ///
13 | /// 默认网络请求返回的结果格式
14 | ///
15 | class UpdateInfo {
16 | ///请求返回码
17 | final int code;
18 |
19 | ///请求错误信息
20 | final String msg;
21 |
22 | ///更新的状态
23 | final int updateStatus;
24 |
25 | ///最新版本号[根据版本号来判别是否需要升级]
26 | final int versionCode;
27 |
28 | ///最新APP版本的名称[用于展示的版本名]
29 | final String versionName;
30 |
31 | ///APP更新时间
32 | final String uploadTime;
33 |
34 | ///APP变更的内容
35 | final String modifyContent;
36 |
37 | ///下载地址
38 | final String downloadUrl;
39 |
40 | ///Apk MD5值
41 | final String apkMd5;
42 |
43 | ///Apk大小【单位:KB】
44 | final int apkSize;
45 |
46 | UpdateInfo(
47 | {this.code,
48 | this.msg,
49 | this.updateStatus,
50 | this.versionCode,
51 | this.versionName,
52 | this.uploadTime,
53 | this.modifyContent,
54 | this.downloadUrl,
55 | this.apkMd5,
56 | this.apkSize});
57 |
58 | Map toMap() {
59 | return {
60 | 'Code': code,
61 | 'Msg': msg,
62 | 'UpdateStatus': updateStatus,
63 | 'VersionCode': versionCode,
64 | 'VersionName': versionName,
65 | 'UploadTime': uploadTime,
66 | 'ModifyContent': modifyContent,
67 | 'DownloadUrl': downloadUrl,
68 | 'ApkMd5': apkMd5,
69 | 'ApkSize': apkSize,
70 | };
71 | }
72 |
73 | static UpdateInfo fromMap(Map map) {
74 | if (map == null) return null;
75 |
76 | return UpdateInfo(
77 | code: map['Code']?.toInt(),
78 | msg: map['Msg'],
79 | updateStatus: map['UpdateStatus']?.toInt(),
80 | versionCode: map['VersionCode']?.toInt(),
81 | versionName: map['VersionName'],
82 | uploadTime: map['UploadTime'],
83 | modifyContent: map['ModifyContent'],
84 | downloadUrl: map['DownloadUrl'],
85 | apkMd5: map['ApkMd5'],
86 | apkSize: map['ApkSize']?.toInt());
87 | }
88 |
89 | String toJson() => json.encode(toMap());
90 |
91 | static UpdateInfo fromJson(String source) => fromMap(json.decode(source));
92 |
93 | @override
94 | String toString() {
95 | return 'UpdateInfo Code: $code, Msg: $msg, UpdateStatus: $updateStatus, VersionCode: $versionCode, VersionName: $versionName, UploadTime: $uploadTime, ModifyContent: $modifyContent, DownloadUrl: $downloadUrl, ApkMd5: $apkMd5, ApkSize: $apkSize';
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/lib/update/update.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter_app_update_example/update/update_parser.dart';
3 | import 'package:flutter_app_update_example/update/update_prompter.dart';
4 | import 'package:flutter_app_update_example/utils/common.dart';
5 | import 'package:flutter_app_update_example/utils/toast.dart';
6 | import 'package:install_plugin/install_plugin.dart';
7 |
8 | import '../utils/http.dart';
9 |
10 | /// 版本更新管理
11 | class UpdateManager {
12 | ///全局初始化
13 | static init(
14 | {String baseUrl, int timeout = 5000, Map headers}) {
15 | HttpUtils.init(baseUrl: baseUrl, timeout: timeout, headers: headers);
16 | }
17 |
18 | static void checkUpdate(BuildContext context, String url) {
19 | HttpUtils.get(url).then((response) {
20 | UpdateParser.parseJson(response.toString()).then((value) => {
21 | UpdatePrompter(
22 | updateEntity: value,
23 | onInstall: (String filePath) {
24 | CommonUtils.installAPP(filePath);
25 | }).show(context)
26 | });
27 | }).catchError((onError) {
28 | ToastUtils.error(onError);
29 | });
30 | }
31 | }
32 |
33 | typedef InstallCallback = Function(String filePath);
34 |
--------------------------------------------------------------------------------
/lib/update/update_parser.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_app_update_example/update/entity/update_entity.dart';
2 | import 'package:flutter_app_update_example/update/entity/update_info.dart';
3 | import 'package:flutter_app_update_example/utils/common.dart';
4 | import 'package:package_info/package_info.dart';
5 |
6 | ///版本更新默认的方法
7 | class UpdateParser {
8 | /// 解析器
9 | static Future parseJson(String json) async {
10 | UpdateInfo updateInfo = UpdateInfo.fromJson(json);
11 | if (updateInfo == null || updateInfo.code != 0) {
12 | return null;
13 | }
14 |
15 | //进行二次校验
16 | bool hasUpdate = updateInfo.updateStatus != NO_NEW_VERSION;
17 | if (hasUpdate) {
18 | String versionCode = await CommonUtils.getVersionCode();
19 | //服务器返回的最新版本小于等于现在的版本,不需要更新
20 | if (updateInfo.versionCode <= int.parse(versionCode)) {
21 | hasUpdate = false;
22 | }
23 | }
24 |
25 | return UpdateEntity(
26 | hasUpdate: hasUpdate,
27 | isForce: updateInfo.updateStatus == HAVE_NEW_VERSION_FORCED_UPLOAD,
28 | versionCode: updateInfo.versionCode,
29 | versionName: updateInfo.versionName,
30 | updateContent: updateInfo.modifyContent,
31 | downloadUrl: updateInfo.downloadUrl,
32 | apkSize: updateInfo.apkSize,
33 | apkMd5: updateInfo.apkMd5);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/lib/update/update_prompter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter_app_update_example/update/update.dart';
3 | import 'package:flutter_app_update_example/utils/common.dart';
4 | import 'package:flutter_app_update_example/utils/http.dart';
5 | import 'package:flutter_app_update_example/utils/toast.dart';
6 | import 'package:flutter_update_dialog/flutter_update_dialog.dart';
7 | import 'dart:io';
8 |
9 | import 'entity/update_entity.dart';
10 |
11 | class UpdatePrompter {
12 | /// 版本更新信息
13 | final UpdateEntity updateEntity;
14 |
15 | final InstallCallback onInstall;
16 |
17 | UpdateDialog _dialog;
18 |
19 | double _progress = 0.0;
20 |
21 | File _apkFile;
22 |
23 | UpdatePrompter({@required this.updateEntity, @required this.onInstall});
24 |
25 | void show(BuildContext context) async {
26 | if (_dialog != null && _dialog.isShowing()) {
27 | return;
28 | }
29 | String title = "是否升级到${updateEntity.versionName}版本?";
30 | String updateContent = getUpdateContent();
31 | if (Platform.isAndroid) {
32 | _apkFile = await CommonUtils.getApkFileByUpdateEntity(updateEntity);
33 | }
34 | if (_apkFile != null && _apkFile.existsSync()) {
35 | _dialog = UpdateDialog.showUpdate(
36 | context,
37 | title: title,
38 | updateContent: updateContent,
39 | updateButtonText: "安装",
40 | extraHeight: 10,
41 | enableIgnore: updateEntity.isIgnorable,
42 | isForce: updateEntity.isForce,
43 | onUpdate: doInstall,
44 | );
45 | } else {
46 | _dialog = UpdateDialog.showUpdate(
47 | context,
48 | title: title,
49 | updateContent: updateContent,
50 | extraHeight: 10,
51 | enableIgnore: updateEntity.isIgnorable,
52 | isForce: updateEntity.isForce,
53 | onUpdate: onUpdate,
54 | );
55 | }
56 | }
57 |
58 | String getUpdateContent() {
59 | String targetSize =
60 | CommonUtils.getTargetSize(updateEntity.apkSize.toDouble());
61 | String updateContent = "";
62 | if (targetSize.isNotEmpty) {
63 | updateContent += "新版本大小:$targetSize\n";
64 | }
65 | updateContent += updateEntity.updateContent;
66 | return updateContent;
67 | }
68 |
69 | void onUpdate() {
70 | if (Platform.isIOS) {
71 | doInstall();
72 | return;
73 | }
74 |
75 | HttpUtils.downloadFile(updateEntity.downloadUrl, _apkFile.path,
76 | onReceiveProgress: (int count, int total) {
77 | _progress = count.toDouble() / total;
78 | if (_progress <= 1.0001) {
79 | _dialog.update(_progress);
80 | }
81 | }).then((value) {
82 | doInstall();
83 | }).catchError((value) {
84 | ToastUtils.success("下载失败!");
85 | _dialog.dismiss();
86 | });
87 | }
88 |
89 | /// 安装
90 | void doInstall() {
91 | _dialog.dismiss();
92 | onInstall.call(_apkFile != null ? _apkFile.path : updateEntity.downloadUrl);
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/lib/utils/common.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter_app_update_example/update/entity/update_entity.dart';
4 | import 'package:install_plugin/install_plugin.dart';
5 | import 'package:package_info/package_info.dart';
6 | import 'package:path_provider/path_provider.dart';
7 |
8 | class CommonUtils {
9 | CommonUtils._internal();
10 |
11 | static String getTargetSize(double kbSize) {
12 | if (kbSize <= 0) {
13 | return "";
14 | } else if (kbSize < 1024) {
15 | return "${kbSize.toStringAsFixed(1)}KB";
16 | } else if (kbSize < 1048576) {
17 | return "${(kbSize / 1024).toStringAsFixed(1)}MB";
18 | } else {
19 | return "${(kbSize / 1048576).toStringAsFixed(1)}GB";
20 | }
21 | }
22 |
23 | ///获取下载缓存路径
24 | static Future getDownloadDirPath() async {
25 | Directory directory = Platform.isAndroid
26 | ? await getExternalStorageDirectory()
27 | : await getApplicationDocumentsDirectory();
28 | return directory.path;
29 | }
30 |
31 | ///根据更新信息获取apk安装文件
32 | static Future getApkFileByUpdateEntity(
33 | UpdateEntity updateEntity) async {
34 | String appName = getApkNameByDownloadUrl(updateEntity.downloadUrl);
35 | String dirPath = await getDownloadDirPath();
36 | return File("$dirPath/${updateEntity.versionName}/$appName");
37 | }
38 |
39 | ///根据下载地址获取文件名
40 | static String getApkNameByDownloadUrl(String downloadUrl) {
41 | if (downloadUrl.isEmpty) {
42 | return "temp_${currentTimeMillis()}.apk";
43 | } else {
44 | String appName = downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1);
45 | if (!appName.endsWith(".apk")) {
46 | appName = "temp_${currentTimeMillis()}.apk";
47 | }
48 | return appName;
49 | }
50 | }
51 |
52 | static int currentTimeMillis() {
53 | return DateTime.now().millisecondsSinceEpoch;
54 | }
55 |
56 | ///获取应用包信息
57 | static Future getPackageInfo() {
58 | return PackageInfo.fromPlatform();
59 | }
60 |
61 | ///获取应用版本号
62 | static Future getVersionCode() async {
63 | PackageInfo packageInfo = await PackageInfo.fromPlatform();
64 | return packageInfo.buildNumber;
65 | }
66 |
67 | ///获取应用包名
68 | static Future getPackageName() async {
69 | PackageInfo packageInfo = await PackageInfo.fromPlatform();
70 | return packageInfo.packageName;
71 | }
72 |
73 | /// 安装apk
74 | static void installAPP(String uri) async {
75 | if (Platform.isAndroid) {
76 | String packageName = await CommonUtils.getPackageName();
77 | InstallPlugin.installApk(uri, packageName);
78 | } else {
79 | InstallPlugin.gotoAppStore(uri);
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/lib/utils/http.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:flutter_app_update_example/utils/toast.dart';
3 |
4 | /// 网络请求工具类
5 | class HttpUtils {
6 |
7 | HttpUtils._internal();
8 |
9 | static Dio sDio;
10 |
11 | ///全局初始化
12 | static init(
13 | {String baseUrl, int timeout = 5000, Map headers}) {
14 | sDio = Dio(BaseOptions(
15 | baseUrl: baseUrl,
16 | connectTimeout: timeout,
17 | sendTimeout: timeout,
18 | receiveTimeout: timeout,
19 | headers: headers));
20 | //添加拦截器
21 | sDio.interceptors
22 | .add(InterceptorsWrapper(onRequest: (RequestOptions options) {
23 | print("请求之前");
24 | return options;
25 | }, onResponse: (Response response) {
26 | print("响应之前");
27 | return response;
28 | }, onError: (DioError e) {
29 | print("错误之前");
30 | handleError(e);
31 | return e;
32 | }));
33 | }
34 |
35 | ///error统一处理
36 | static void handleError(DioError e) {
37 | switch (e.type) {
38 | case DioErrorType.CONNECT_TIMEOUT:
39 | showError("连接超时");
40 | break;
41 | case DioErrorType.SEND_TIMEOUT:
42 | showError("请求超时");
43 | break;
44 | case DioErrorType.RECEIVE_TIMEOUT:
45 | showError("响应超时");
46 | break;
47 | case DioErrorType.RESPONSE:
48 | showError("出现异常");
49 | break;
50 | case DioErrorType.CANCEL:
51 | showError("请求取消");
52 | break;
53 | default:
54 | showError("未知错误");
55 | break;
56 | }
57 | }
58 |
59 | static void showError(String error) {
60 | print(error);
61 | ToastUtils.error(error);
62 | }
63 |
64 | ///get请求
65 | static Future get(String url, [Map params]) async {
66 | Response response;
67 | if (params != null) {
68 | response = await sDio.get(url, queryParameters: params);
69 | } else {
70 | response = await sDio.get(url);
71 | }
72 | return response.data;
73 | }
74 |
75 | ///post 表单请求
76 | static Future post(String url, [Map params]) async {
77 | Response response = await sDio.post(url, queryParameters: params);
78 | return response.data;
79 | }
80 |
81 | ///post body请求
82 | static Future postJson(String url, [Map data]) async {
83 | Response response = await sDio.post(url, data: data);
84 | return response.data;
85 | }
86 |
87 | ///下载文件
88 | static Future downloadFile(String urlPath, String savePath,
89 | {ProgressCallback onReceiveProgress}) async {
90 | Response response = await sDio.download(urlPath, savePath,
91 | onReceiveProgress: onReceiveProgress,
92 | options: Options(sendTimeout: 25000, receiveTimeout: 25000));
93 | return response;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/lib/utils/toast.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:oktoast/oktoast.dart';
3 |
4 | const DEFAULT_TOAST_DURATION = Duration(seconds: 2);
5 | const DEFAULT_TOAST_COLOR = Color(0xFF424242);
6 |
7 | class ToastUtils {
8 | ToastUtils._internal();
9 |
10 | ///全局初始化Toast配置, child为MaterialApp
11 | static init(Widget child) {
12 | return OKToast(
13 | ///字体大小
14 | textStyle: TextStyle(fontSize: 16, color: Colors.white),
15 | backgroundColor: DEFAULT_TOAST_COLOR,
16 | radius: 10,
17 | dismissOtherOnShow: true,
18 | textPadding: EdgeInsets.fromLTRB(20, 10, 20, 10),
19 | child: child,
20 | duration: DEFAULT_TOAST_DURATION,
21 | );
22 | }
23 |
24 | static void toast(String msg,
25 | {Duration duration = DEFAULT_TOAST_DURATION,
26 | Color color = DEFAULT_TOAST_COLOR}) {
27 | showToast(msg, duration: duration, backgroundColor: color);
28 | }
29 |
30 | static void waring(String msg, {Duration duration = DEFAULT_TOAST_DURATION}) {
31 | showToast(msg, duration: duration, backgroundColor: Colors.yellow);
32 | }
33 |
34 | static void error(String msg, {Duration duration = DEFAULT_TOAST_DURATION}) {
35 | showToast(msg, duration: duration, backgroundColor: Colors.red);
36 | }
37 |
38 | static void success(String msg,
39 | {Duration duration = DEFAULT_TOAST_DURATION}) {
40 | showToast(msg, duration: duration, backgroundColor: Colors.lightGreen);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_app_update_example
2 | description: A new Flutter application.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: ">=2.7.0 <3.0.0"
22 |
23 | dependencies:
24 | flutter:
25 | sdk: flutter
26 |
27 | cupertino_icons: ^0.1.3
28 | flutter_update_dialog: ^0.0.1
29 | oktoast: ^2.3.2
30 | dio: ^3.0.9
31 | package_info: ^0.4.1
32 | path_provider: ^1.6.10
33 | install_plugin: ^2.0.1
34 |
35 | dev_dependencies:
36 | flutter_test:
37 | sdk: flutter
38 |
39 | flutter:
40 |
41 | uses-material-design: true
42 |
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:flutter_app_update_example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------