Skip to content

Commit be05f1f

Browse files
committed
- Fix shocker name overflow in non grouped control page
- Removed 'No shockers selected' text from devices page as it just looks weird (if you even see it) - Fixed crash which could occurr when opening the app with the shares page last opened - Fixed padding slightly on desktop and mobile to be dynamic
1 parent 12f36ab commit be05f1f

10 files changed

Lines changed: 36 additions & 27 deletions

File tree

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
**Changelog:**
22
- Added incoming invites to top of devices page
3-
- Fixed reference from 'shocker' page to 'devices' page in invite accepted dialog
3+
- Fixed reference from 'shocker' page to 'devices' page in invite accepted dialog
4+
- Fix shocker name overflow in non grouped control page
5+
- Removed 'No shockers selected' text from devices page as it just looks weird (if you even see it)
6+
- Fixed crash which could occurr when opening the app with the shares page last opened
7+
- Fixed padding slightly on desktop and mobile to be dynamic

lib/screens/shockers/grouped/grouped_shocker_selector.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class GroupedShockerSelectorState extends State<GroupedShockerSelector> {
110110
return children[index];
111111
},
112112
itemCount: children.length,
113+
padding: EdgeInsets.all(0),
113114
),
114115
));
115116
}

lib/screens/shockers/grouped/grouped_shockers.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,10 @@ class _GroupedShockerScreenState extends State<GroupedShockerScreen> {
181181
child: Flex(
182182
direction: Axis.vertical,
183183
children: [
184-
InineInviteManager(reloadMethod: () => setState(() {
184+
SafeArea(child: SizedBox.shrink()),
185+
ConstrainedContainer(child: InineInviteManager(reloadMethod: () => setState(() {
185186

186-
}),),
187+
}),)),
187188
GroupedShockerSelector(onChanged: onRebuild, onlyLive: liveEnabled),
188189
if (AlarmListManager.getInstance().selectedShockers.isNotEmpty)
189190
ConstrainedContainer(
@@ -332,7 +333,7 @@ class _GroupedShockerScreenState extends State<GroupedShockerScreen> {
332333
),
333334
)
334335
else
335-
Text("No shockers selected", style: t.textTheme.headlineMedium)
336+
SizedBox.shrink()
336337
],
337338
));
338339
}

lib/screens/shockers/individual/shockers.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,10 @@ class ShockerScreenState extends State<ShockerScreen> {
365365
child: Column(
366366
children: [
367367
Expanded(child: SingleChildScrollView(child: Column(children: [
368-
InineInviteManager(reloadMethod: () => setState(() {
368+
SafeArea(child: SizedBox.shrink()),
369+
ConstrainedContainer(child: InineInviteManager(reloadMethod: () => setState(() {
369370

370-
}),),
371-
Padding(padding: PredefinedSpacing.paddingLarge()),
372-
Text(
373-
'All devices',
374-
style: t.textTheme.headlineMedium,
375-
textAlign: TextAlign.center,
376-
),
371+
}),)),
377372
if (groupedShockers.isEmpty)
378373
Text(
379374
"No shockers found",

lib/screens/shockers/shocker_item.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,10 @@ class ShockerItemState extends State<ShockerItem>
324324
widget.onRebuild();
325325
},
326326
),
327-
Text(
327+
Expanded(child: Text(
328328
widget.shocker.name,
329329
overflow: TextOverflow.ellipsis,
330-
),
330+
),)
331331
],
332332
)),
333333
Row(

lib/screens/user_shares/invites_screen.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ class _InlineInviteManagerState extends State<InineInviteManager> {
214214
ThemeData t = Theme.of(context);
215215
return Column(
216216
children: [
217-
Padding(padding: PredefinedSpacing.paddingLarge()),
218217
Text("Incoming invites", style: t.textTheme.headlineSmall,),
219218
...incoming.map((x) => InviteItem(
220219
invite: x,

lib/screens/user_shares/user_share_screen.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ class _UserShareScreen extends State<UserShareScreen> {
8787
return ConstrainedContainer(
8888
child: Column(
8989
children: [
90-
Padding(padding: PredefinedSpacing.paddingLarge()),
91-
SegmentedButton<int>(
90+
SafeArea(child: SizedBox.shrink()),
91+
SegmentedButton<int>(
9292
segments: [
9393
ButtonSegment(value: 0, label: Text("Share links")),
9494
ButtonSegment(value: 1, label: Text("Shared")),

lib/screens/user_shares/user_shares_screen.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ class UserSharesScreen extends StatefulWidget {
3232

3333
class _UserSharesScreen extends State<UserSharesScreen> {
3434
bool initialLoading = false;
35+
bool error = false;
3536

3637
Future loadShares() async {
37-
await AlarmListManager.getInstance().updateUserShares();
38+
this.error = false;
39+
bool success = await AlarmListManager.getInstance().updateUserShares();
3840
if (!mounted) return;
3941
setState(() {
4042
initialLoading = false;
43+
this.error = !success;
4144
});
4245
}
4346

@@ -85,7 +88,7 @@ class _UserSharesScreen extends State<UserSharesScreen> {
8588
: DesktopMobileRefreshIndicator(
8689
onRefresh: loadShares,
8790
child: ConstrainedContainer(
88-
child: ListView(children: shareEntries),
91+
child: ListView(children: error ? [Text("An error occured while loading the shares. Please try again", style: t.textTheme.headlineSmall, textAlign: TextAlign.center,)] : shareEntries),
8992
));
9093
}
9194
}

lib/services/alarm_list_manager.dart

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,15 +1156,21 @@ class AlarmListManager {
11561156
return error;
11571157
}
11581158

1159-
Future<void> updateUserShares() async {
1159+
Future<bool> updateUserShares() async {
11601160
OpenShockUserShares shares = OpenShockUserShares();
11611161
OpenShockClient client = OpenShockClient();
1162-
for (Token token in getTokens()) {
1163-
ErrorContainer<OpenShockUserShares> s = await client.getShares(token);
1164-
if(s.value == null) continue;
1165-
shares.incoming.addAll(s.value!.incoming);
1166-
shares.outgoing.addAll(s.value!.outgoing);
1162+
// Duct tape fix for loading shares before shockers are present
1163+
try {
1164+
for (Token token in getTokens()) {
1165+
ErrorContainer<OpenShockUserShares> s = await client.getShares(token);
1166+
if(s.value == null) continue;
1167+
shares.incoming.addAll(s.value!.incoming);
1168+
shares.outgoing.addAll(s.value!.outgoing);
1169+
}
1170+
userShares = shares;
1171+
return true;
1172+
} catch(e) {
1173+
return false;
11671174
}
1168-
userShares = shares;
11691175
}
11701176
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1616
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
1717
# In Windows, build-name is used as the major, minor, and patch parts
1818
# of the product and file versions while build-number is used as the build suffix.
19-
version: 0.4.0+44
19+
version: 0.4.1+45
2020
environment:
2121
sdk: ^3.6.0
2222
flutter: ">=3.29.2"

0 commit comments

Comments
 (0)