Skip to content

Commit

Permalink
update version v0.3.7+1
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyme committed Dec 9, 2021
1 parent 7fb14b0 commit 32410f0
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 36 deletions.
1 change: 1 addition & 0 deletions example/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand Down
1 change: 1 addition & 0 deletions example/lib/generated/intl/messages_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand Down
34 changes: 1 addition & 33 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:r_upgrade/r_upgrade.dart';

import 'generated/l10n.dart';

const version = 1;
Expand Down Expand Up @@ -556,7 +555,7 @@ class _MyAppState extends State<MyApp> {
child: Text(
snapshot.data!.status ==
DownloadStatus.STATUS_RUNNING
? getSpeech(snapshot.data!.speed!)
? snapshot.data!.getSpeedString()
: getStatus(snapshot.data!.status),
style: TextStyle(
color: Colors.white,
Expand Down Expand Up @@ -637,37 +636,6 @@ class _MyAppState extends State<MyApp> {
}
return '';
}

// Future<bool> canReadStorage() async {
// if (Platform.isIOS) return true;
// var status = await PermissionHandler()
// .checkPermissionStatus(PermissionGroup.storage);
// if (status != PermissionStatus.granted) {
// var future = await PermissionHandler()
// .requestPermissions([PermissionGroup.storage]);
// for (final item in future.entries) {
// if (item.value != PermissionStatus.granted) {
// return false;
// }
// }
// } else {
// return true;
// }
// return true;
// }

String getSpeech(double speech) {
String unit = 'kb/s';
String result = speech.toStringAsFixed(2);
if (speech > 1024 * 1024) {
unit = 'gb/s';
result = (speech / (1024 * 1024)).toStringAsFixed(2);
} else if (speech > 1024) {
unit = 'mb/s';
result = (speech / 1024).toStringAsFixed(2);
}
return '$result$unit';
}
}

class CircleDownloadWidget extends StatelessWidget {
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.3.6"
version: "0.3.7"
sky_engine:
dependency: transitive
description: flutter
Expand Down
1 change: 0 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dev_dependencies:

r_upgrade:
path: ../

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

Expand Down
14 changes: 14 additions & 0 deletions lib/r_upgrade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,20 @@ class DownloadInfo {
String toString() {
return 'DownloadInfo{total: $maxLength, address: $path, planTime: $planTime, progress: $currentLength, percent: $percent, id: $id, speed: $speed, status: $status}';
}

String getSpeedString() {
double _speed = speed ?? 0;
String unit = 'kb/s';
String result = _speed.toStringAsFixed(2);
if (_speed > 1024 * 1024) {
unit = 'gb/s';
result = (_speed / (1024 * 1024)).toStringAsFixed(2);
} else if (_speed > 1024) {
unit = 'mb/s';
result = (_speed / 1024).toStringAsFixed(2);
}
return '$result$unit';
}
}

///
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: r_upgrade
description: A plugin for upgrade and install application ,Support Android and IOS.
version: 0.3.7
version: 0.3.7+1
homepage: https://github.com/rhymelph/r_upgrade

environment:
Expand Down

0 comments on commit 32410f0

Please sign in to comment.