Skip to content

Commit

Permalink
Version bump & version check fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrot committed Nov 3, 2021
1 parent 631aa2c commit 79e0053
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
Binary file modified build/windows/runner/Release/data/app.so
Binary file not shown.
Binary file modified build/windows/runner/Release/wsl2distromanager.exe
Binary file not shown.
11 changes: 7 additions & 4 deletions lib/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ class Instances {

class App {
/// Returns an int of the string
int versionToInt(String version) {
return int.tryParse(
version.toString().replaceAll('v', '').replaceAll('.', '')) ??
double versionToDouble(String version) {
return double.tryParse(version
.toString()
.replaceAll('v', '')
.replaceAll('.', '')
.replaceAll('+', '.')) ??
-1;
}

Expand All @@ -34,7 +37,7 @@ class App {
// TODO: change version to PackageInfo once it works with Windows
/* PackageInfo packageInfo = await PackageInfo.fromPlatform();
String version = packageInfo.buildNumber; */
if (versionToInt(tagName) > versionToInt(version)) {
if (versionToDouble(tagName) > versionToDouble(version)) {
return latest['assets'][0]['browser_download_url'];
}
}
Expand Down
17 changes: 15 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import 'api.dart';
import 'distro_list_component.dart';
import 'distro_create_component.dart';

String currentVersion = "v0.5.1";
// TODO: Update on release
const String currentVersion = "v0.5.2+1";

const String windowsStoreUrl =
'https://www.microsoft.com/store/productId/9NWS9K95NMJB';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -109,7 +113,16 @@ class _MyHomePageState extends State<MyHomePage> {
: throw 'Could not launch URL';
},
child: const Text("Download now",
style: TextStyle(fontSize: 12.0)))
style: TextStyle(fontSize: 12.0))),
const Text('or check the'),
TextButton(
onPressed: () async {
await canLaunch(windowsStoreUrl)
? await launch(windowsStoreUrl)
: throw 'Could not launch URL';
},
child: const Text("Windows Store",
style: TextStyle(fontSize: 12.0))),
],
));
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.5.2 # Current version
version: 0.5.2+1 # Current version

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit 79e0053

Please sign in to comment.