Skip to content

Commit

Permalink
version and app constants
Browse files Browse the repository at this point in the history
  • Loading branch information
herzhenr committed Aug 20, 2023
1 parent 199aefc commit dc667a9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class AppConstants {
static const add = Icon(Icons.add);
static const sort = Icon(Icons.sort);

// Home Ping Timeouts and Intervals for scanning
static const homePingTimeout = 1;
static const homePingInterval = 12;

// Wake Up Dialog Elements
static const errorMessageColor = Colors.red;
static const successMessageColor = Colors.green;
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ class _HomePageState extends State<HomePage> {
/// of the devices and update the ui accordingly
void _pingDevices() {
checkAllDevicesStatus();
_pingDevicesTimer = Timer.periodic(const Duration(seconds: 16), (timer) {
_pingDevicesTimer = Timer.periodic(
const Duration(seconds: AppConstants.homePingInterval), (timer) {
checkAllDevicesStatus();
});
}
Expand Down
3 changes: 2 additions & 1 deletion lib/services/network.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:dart_ping/dart_ping.dart';
import 'package:simple_wake_on_lan/constants.dart';
import 'dart:io';
import 'package:wake_on_lan/wake_on_lan.dart';
import 'data.dart';
Expand All @@ -17,7 +18,7 @@ Stream<NetworkDevice> findDevicesInNetwork(
step ips away from the current as long as this ip is still within the subnet */
void pingDevice(int index) async {
final address = '$networkPrefix.$index';
final ping = Ping(address, count: 1, timeout: 1);
final ping = Ping(address, count: 1, timeout: AppConstants.homePingTimeout);

// Wait for the current ping to complete
await for (final response in ping.stream) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.0+27
version: 1.2.0+28

environment:
sdk: '>=3.0.0'
Expand Down

0 comments on commit dc667a9

Please sign in to comment.