diff --git a/CHANGELOG.md b/CHANGELOG.md index bee7b283..b443f8fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,3 +29,8 @@ Theres so many improvements over our old app - heres the headlines - Added warnings for outdated gear to Custom Actions and Joystick - UI/UX changes to selecting actions for triggers to reduce confusion - Fix bug where trigger doesn't activate after accepting permission + +### V 1.0.3 + +- Changed trigger select button to be more visible +- Reload actions when glowtip is found \ No newline at end of file diff --git a/lib/Frontend/pages/actions.dart b/lib/Frontend/pages/actions.dart index ef3e3029..6b0191bd 100644 --- a/lib/Frontend/pages/actions.dart +++ b/lib/Frontend/pages/actions.dart @@ -49,88 +49,93 @@ class _ActionPageBuilderState extends ConsumerState { return MultiValueListenableBuilder( valueListenables: knownDevices.isEmpty ? [ValueNotifier(ConnectivityState.disconnected)] : knownDevices.values.map((e) => e.deviceConnectionState).toList(), builder: (BuildContext context, List values, Widget? child) { - Map> actionsCatMap = ref.read(getAvailableActionsProvider); - List catList = actionsCatMap.keys.toList(); - return AnimatedCrossFade( - firstChild: const Home(), - secondChild: MultiListenableBuilder( - builder: (BuildContext context, Widget? child) { - return ListView( - shrinkWrap: true, - children: [ - AnimatedCrossFade( - firstChild: PageInfoCard( - text: actionsFavoriteTip(), - ), - secondChild: GridView.builder( + return MultiValueListenableBuilder( + builder: (context, values, child) { + Map> actionsCatMap = ref.read(getAvailableActionsProvider); + List catList = actionsCatMap.keys.toList(); + return AnimatedCrossFade( + firstChild: const Home(), + secondChild: MultiListenableBuilder( + builder: (BuildContext context, Widget? child) { + return ListView( + shrinkWrap: true, + children: [ + AnimatedCrossFade( + firstChild: PageInfoCard( + text: actionsFavoriteTip(), + ), + secondChild: GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: largerCards ? 250 : 125), + itemCount: actionsCatMap.values.flattened + .where( + (element) => ref.watch(favoriteActionsProvider).any((favorite) => favorite.actionUUID == element.uuid), + ) + .length, + itemBuilder: (BuildContext context, int index) { + BaseAction baseAction = actionsCatMap.values.flattened + .where( + (element) => ref.watch(favoriteActionsProvider).any((favorite) => favorite.actionUUID == element.uuid), + ) + .toList()[index]; + return getActionCard(index, knownDevices, baseAction, largerCards); + }, + ), + crossFadeState: actionsCatMap.values.flattened.where((element) => ref.read(favoriteActionsProvider.notifier).contains(element)).isEmpty ? CrossFadeState.showFirst : CrossFadeState.showSecond, + duration: animationTransitionDuration), + ListView.builder( shrinkWrap: true, + itemCount: catList.length, physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: largerCards ? 250 : 125), - itemCount: actionsCatMap.values.flattened - .where( - (element) => ref.watch(favoriteActionsProvider).any((favorite) => favorite.actionUUID == element.uuid), - ) - .length, - itemBuilder: (BuildContext context, int index) { - BaseAction baseAction = actionsCatMap.values.flattened - .where( - (element) => ref.watch(favoriteActionsProvider).any((favorite) => favorite.actionUUID == element.uuid), - ) - .toList()[index]; - return getActionCard(index, knownDevices, baseAction, largerCards); - }, - ), - crossFadeState: actionsCatMap.values.flattened.where((element) => ref.read(favoriteActionsProvider.notifier).contains(element)).isEmpty ? CrossFadeState.showFirst : CrossFadeState.showSecond, - duration: animationTransitionDuration), - ListView.builder( - shrinkWrap: true, - itemCount: catList.length, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (BuildContext context, int categoryIndex) { - List actionsForCat = actionsCatMap.values.toList()[categoryIndex].toList(); - return FadeIn( - delay: Duration(milliseconds: 100 * categoryIndex), - child: ListView( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - children: [ - Center( - child: Text( - catList[categoryIndex].friendly, - style: Theme.of(context).textTheme.titleLarge, - ), - ), - GridView.builder( - gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: largerCards ? 250 : 125), + itemBuilder: (BuildContext context, int categoryIndex) { + List actionsForCat = actionsCatMap.values.toList()[categoryIndex].toList(); + return FadeIn( + delay: Duration(milliseconds: 100 * categoryIndex), + child: ListView( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, - itemCount: actionsForCat.length, - itemBuilder: (BuildContext context, int actionIndex) { - return MultiValueListenableBuilder( - valueListenables: knownDevices.values - .where( - (element) => actionsForCat[actionIndex].deviceCategory.contains(element.baseDeviceDefinition.deviceType), - ) - .map((e) => e.deviceState) - .toList(), - builder: (BuildContext context, List values, Widget? child) { - return getActionCard(actionIndex, knownDevices, actionsForCat[actionIndex], largerCards); + children: [ + Center( + child: Text( + catList[categoryIndex].friendly, + style: Theme.of(context).textTheme.titleLarge, + ), + ), + GridView.builder( + gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: largerCards ? 250 : 125), + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: actionsForCat.length, + itemBuilder: (BuildContext context, int actionIndex) { + return MultiValueListenableBuilder( + valueListenables: knownDevices.values + .where( + (element) => actionsForCat[actionIndex].deviceCategory.contains(element.baseDeviceDefinition.deviceType), + ) + .map((e) => e.deviceState) + .toList(), + builder: (BuildContext context, List values, Widget? child) { + return getActionCard(actionIndex, knownDevices, actionsForCat[actionIndex], largerCards); + }, + ); }, - ); - }, - ) - ], - ), - ); - }, - ), - ], - ); - }, - notifiers: knownDevices.isNotEmpty ? knownDevices.values.map((e) => e.baseStoredDevice).toList() : [ChangeNotifier()], - ), - crossFadeState: actionsCatMap.isNotEmpty ? CrossFadeState.showSecond : CrossFadeState.showFirst, - duration: animationTransitionDuration, + ) + ], + ), + ); + }, + ), + ], + ); + }, + notifiers: knownDevices.isNotEmpty ? knownDevices.values.map((e) => e.baseStoredDevice).toList() : [ChangeNotifier()], + ), + crossFadeState: actionsCatMap.isNotEmpty ? CrossFadeState.showSecond : CrossFadeState.showFirst, + duration: animationTransitionDuration, + ); + }, + valueListenables: knownDevices.isEmpty ? [ValueNotifier(false)] : knownDevices.values.map((e) => e.hasGlowtip).toList(), ); }, );