Skip to content

Commit

Permalink
SnapModel: plug renaming (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Oct 2, 2022
1 parent 4e67384 commit 01e81f0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/store_app/common/snap_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ class SnapModel extends SafeChangeNotifier {

_snapChangesSub = _snapService.snapChangesInserted.listen((_) async {
await _loadSnapChangeInProgress();
await loadPlugsAndConnections();
await _loadPlugs();
if (!snapChangeInProgress) {
_localSnap = await _findLocalSnap(huskSnapName);
}

notifyListeners();
});

await loadPlugsAndConnections();
await _loadPlugs();
notifyListeners();
}

Expand Down Expand Up @@ -269,7 +269,7 @@ class SnapModel extends SafeChangeNotifier {

/// Helper getter for showing permissions
bool get showPermissions =>
snapIsInstalled && strict && plugs != null && plugs!.isNotEmpty;
snapIsInstalled && strict && _plugs != null && _plugs!.isNotEmpty;

/// Asks the [SnapService] if a [SnapDChange] for this snap is in progress
Future<void> _loadSnapChangeInProgress() async => snapChangeInProgress =
Expand All @@ -287,7 +287,7 @@ class SnapModel extends SafeChangeNotifier {
channelToBeInstalled,
doneMessage,
);
await loadPlugsAndConnections();
await _loadPlugs();
notifyListeners();
}

Expand All @@ -307,16 +307,16 @@ class SnapModel extends SafeChangeNotifier {
channel: channelToBeInstalled,
confinement: selectableChannels[channelToBeInstalled]!.confinement,
);
await loadPlugsAndConnections();
await _loadPlugs();
notifyListeners();
}

Map<SnapPlug, bool>? plugs;

Future<void> loadPlugsAndConnections() async {
Map<SnapPlug, bool>? _plugs;
Map<SnapPlug, bool>? get plugs => _plugs;
Future<void> _loadPlugs() async {
if (_localSnap == null) return;
plugs?.clear();
plugs = await _snapService.loadPlugs(_localSnap!);
_plugs?.clear();
_plugs = await _snapService.loadPlugs(_localSnap!);
notifyListeners();
}

Expand Down

0 comments on commit 01e81f0

Please sign in to comment.