Compare commits
11 Commits
v2.0.1
...
f6a48140b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
f6a48140b4
|
|||
|
cd79cf4449
|
|||
|
1aadd9c368
|
|||
|
febc0a8f43
|
|||
|
fd5e714074
|
|||
|
c108859899
|
|||
|
b3083d37c3
|
|||
|
521c1e94c0
|
|||
|
31a45bc4c3
|
|||
|
b6944d1dbb
|
|||
|
32ef2c5023
|
BIN
data/appicon_1.1.xcf
Normal file
@@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
HASH=$(shell git rev-parse HEAD)
|
||||
VERS=$(shell cat pubspec.yaml | grep -oP '(?<=version: ).*' | sed 's/[\s]*//' | tr -d '\n') # lazy evaluated!
|
||||
VERS=$(shell cat pubspec.yaml | grep -oP '(?<=version: ).*' | sed 's/[\s]*//' | tr -d '\n' | tr -d '') # lazy evaluated!
|
||||
|
||||
java:
|
||||
sudo archlinux-java set java-17-openjdk
|
||||
@@ -21,7 +21,7 @@ run-web: java gen
|
||||
run-android: java gen
|
||||
ping -c1 10.10.10.177
|
||||
adb connect 10.10.10.177:5555
|
||||
flutter pub run build_runner build
|
||||
dart run build_runner build
|
||||
_JAVA_OPTIONS="" flutter run -d 10.10.10.177:5555
|
||||
|
||||
install-release: java gen
|
||||
|
||||
@@ -34,7 +34,7 @@ if (keystorePropertiesFile.exists()) {
|
||||
android {
|
||||
namespace "com.blackforestbytes.simplecloudnotifier"
|
||||
compileSdkVersion flutter.compileSdkVersion
|
||||
ndkVersion "27.0.12077973" // should be `flutter.ndkVersion` - but some plugins need 27, even though flutter still has the default value of 26 (flutter 3.29 | 2025-04-12)
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
coreLibraryDesugaringEnabled true
|
||||
|
||||
@@ -54,6 +54,20 @@ class MessageFilter {
|
||||
});
|
||||
}
|
||||
|
||||
class SubscriptionFilter {
|
||||
static final SubscriptionFilter ALL = SubscriptionFilter('both', 'all', 'all');
|
||||
static final SubscriptionFilter OWNED_INACTIVE = SubscriptionFilter('outgoing', 'unconfirmed', 'false');
|
||||
static final SubscriptionFilter OWNED_ACTIVE = SubscriptionFilter('outgoing', 'confirmed', 'false');
|
||||
static final SubscriptionFilter EXTERNAL_ALL = SubscriptionFilter('outgoing', 'all', 'true');
|
||||
static final SubscriptionFilter INCOMING_ALL = SubscriptionFilter('incoming', 'all', 'true');
|
||||
|
||||
final String direction; // 'outgoing' | 'incoming' | 'both'
|
||||
final String confirmation; // 'confirmed' | 'unconfirmed' | 'all'
|
||||
final String external; // 'true' | 'false' | 'all'
|
||||
|
||||
SubscriptionFilter(this.direction, this.confirmation, this.external) {}
|
||||
}
|
||||
|
||||
class APIClient {
|
||||
static const String _base = 'https://simplecloudnotifier.de';
|
||||
static const String _prefix = '/api/v2';
|
||||
@@ -123,7 +137,7 @@ class APIClient {
|
||||
|
||||
RequestLog.addRequestAPIError(name, t0, method, uri, req.body, req.headers, responseStatusCode, responseBody, responseHeaders, apierr);
|
||||
Toaster.error("Error", apierr.message);
|
||||
throw APIException(responseStatusCode, apierr.error, apierr.errhighlight, apierr.message);
|
||||
throw APIException(responseStatusCode, apierr.error, apierr.errhighlight, apierr.message, true);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -345,15 +359,15 @@ class APIClient {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<List<Subscription>> getSubscriptionList(TokenSource auth) async {
|
||||
static Future<List<Subscription>> getSubscriptionList(TokenSource auth, SubscriptionFilter filter) async {
|
||||
return await _request(
|
||||
name: 'getSubscriptionList',
|
||||
method: 'GET',
|
||||
relURL: 'users/${auth.getUserID()}/subscriptions',
|
||||
query: {
|
||||
'direction': ['both'],
|
||||
'confirmation': ['all'],
|
||||
'external': ['all'],
|
||||
'direction': [filter.direction],
|
||||
'confirmation': [filter.confirmation],
|
||||
'external': [filter.external],
|
||||
},
|
||||
fn: (json) => Subscription.fromJsonArray(json['subscriptions'] as List<dynamic>),
|
||||
authToken: auth.getToken(),
|
||||
|
||||
@@ -3,8 +3,9 @@ class APIException implements Exception {
|
||||
final int error;
|
||||
final int errHighlight;
|
||||
final String message;
|
||||
final bool toastShown;
|
||||
|
||||
APIException(this.httpStatus, this.error, this.errHighlight, this.message);
|
||||
APIException(this.httpStatus, this.error, this.errHighlight, this.message, this.toastShown);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
@@ -2,50 +2,104 @@ import 'package:flutter/material.dart';
|
||||
|
||||
enum BadgeMode { error, warn, info }
|
||||
|
||||
class BadgeDisplay extends StatelessWidget {
|
||||
class BadgeDisplay extends StatefulWidget {
|
||||
final String text;
|
||||
final BadgeMode mode;
|
||||
final IconData? icon;
|
||||
final TextAlign textAlign;
|
||||
final bool closable;
|
||||
final EdgeInsets extraPadding;
|
||||
final bool hidden;
|
||||
|
||||
const BadgeDisplay({
|
||||
Key? key,
|
||||
required this.text,
|
||||
required this.mode,
|
||||
required this.icon,
|
||||
this.textAlign = TextAlign.center,
|
||||
this.closable = false,
|
||||
this.extraPadding = EdgeInsets.zero,
|
||||
this.hidden = false,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<BadgeDisplay> createState() => _BadgeDisplayState();
|
||||
}
|
||||
|
||||
class _BadgeDisplayState extends State<BadgeDisplay> {
|
||||
bool _isVisible = true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!_isVisible || widget.hidden) return const SizedBox.shrink();
|
||||
|
||||
var col = Colors.grey;
|
||||
var colFG = Colors.black;
|
||||
|
||||
if (mode == BadgeMode.error) col = Colors.red;
|
||||
if (mode == BadgeMode.warn) col = Colors.orange;
|
||||
if (mode == BadgeMode.info) col = Colors.blue;
|
||||
if (widget.mode == BadgeMode.error) col = Colors.red;
|
||||
if (widget.mode == BadgeMode.warn) col = Colors.orange;
|
||||
if (widget.mode == BadgeMode.info) col = Colors.blue;
|
||||
|
||||
if (mode == BadgeMode.error) colFG = Colors.red[900]!;
|
||||
if (mode == BadgeMode.warn) colFG = Colors.black;
|
||||
if (mode == BadgeMode.info) colFG = Colors.black;
|
||||
if (widget.mode == BadgeMode.error) colFG = Colors.red[900]!;
|
||||
if (widget.mode == BadgeMode.warn) colFG = Colors.black;
|
||||
if (widget.mode == BadgeMode.info) colFG = Colors.black;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(8, 2, 8, 2),
|
||||
decoration: BoxDecoration(
|
||||
color: col[100],
|
||||
border: Border.all(color: col[300]!),
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
),
|
||||
child: Row(
|
||||
margin: widget.extraPadding,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
if (icon != null) Icon(icon!, color: colFG, size: 16.0),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: colFG, fontSize: 14.0),
|
||||
// The badge itself
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(8, 2, widget.closable ? 16 : 8, 2),
|
||||
decoration: BoxDecoration(
|
||||
color: col[100],
|
||||
border: Border.all(color: col[300]!),
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (widget.icon != null) Icon(widget.icon!, color: colFG, size: 16.0),
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.text,
|
||||
textAlign: widget.textAlign,
|
||||
style: TextStyle(color: colFG, fontSize: 14.0),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
if (widget.closable) _buildCloseButton(context, colFG),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Positioned _buildCloseButton(BuildContext context, Color colFG) {
|
||||
return Positioned(
|
||||
top: 4,
|
||||
right: 4,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_isVisible = false;
|
||||
});
|
||||
},
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(2),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 14,
|
||||
color: colFG,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
47
flutter/lib/components/filter_chips/filter_chips.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FilterChips<T extends Enum> extends StatelessWidget {
|
||||
final List<(T, String)> options;
|
||||
final T value;
|
||||
final void Function(T)? onChanged;
|
||||
|
||||
const FilterChips({
|
||||
Key? key,
|
||||
required this.options,
|
||||
required this.value,
|
||||
required this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
for (var opt in options) _buildChiplet(context, opt.$1, opt.$2),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildChiplet(BuildContext context, T optValue, String optText) {
|
||||
final isSelected = optValue == value;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 2, 4, 2),
|
||||
child: InputChip(
|
||||
label: Text(
|
||||
optText,
|
||||
style: isSelected ? TextStyle(color: Theme.of(context).colorScheme.onPrimary) : null,
|
||||
),
|
||||
visualDensity: VisualDensity(horizontal: -4, vertical: -4),
|
||||
isEnabled: true,
|
||||
selected: true,
|
||||
showCheckmark: false,
|
||||
onPressed: () {
|
||||
if (!isSelected) onChanged?.call(optValue);
|
||||
},
|
||||
selectedColor: isSelected ? Theme.of(context).colorScheme.primary : null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -20,20 +20,30 @@ class SCNNavLayout extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SCNNavLayoutState extends State<SCNNavLayout> {
|
||||
int _selectedIndex = 0; // 4 == FAB
|
||||
static const INDEX_MESSAGES = 0;
|
||||
static const INDEX_CHANNELS = 1;
|
||||
static const INDEX_ACCOUNT = 2;
|
||||
static const INDEX_CONFIG = 3;
|
||||
static const INDEX_SEND = 4; // FAB
|
||||
|
||||
int _selectedIndex = INDEX_MESSAGES;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
final userAcc = Provider.of<AppAuth>(context, listen: false);
|
||||
if (!userAcc.isAuth()) _selectedIndex = 2;
|
||||
if (!userAcc.isAuth()) _selectedIndex = INDEX_ACCOUNT;
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
final userAcc = Provider.of<AppAuth>(context, listen: false);
|
||||
if (!userAcc.isAuth()) {
|
||||
|
||||
if (!userAcc.isAuth() && [INDEX_MESSAGES, INDEX_CHANNELS, INDEX_SEND].contains(index)) {
|
||||
Toaster.info("Not logged in", "Please login or create a new account first");
|
||||
setState(() {
|
||||
_selectedIndex = INDEX_ACCOUNT;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,7 +60,7 @@ class _SCNNavLayoutState extends State<SCNNavLayout> {
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_selectedIndex = 4;
|
||||
_selectedIndex = INDEX_SEND;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,17 +69,17 @@ class _SCNNavLayoutState extends State<SCNNavLayout> {
|
||||
return Scaffold(
|
||||
appBar: SCNAppBar(
|
||||
title: null,
|
||||
showSearch: _selectedIndex == 0,
|
||||
showSearch: _selectedIndex == INDEX_MESSAGES,
|
||||
showShare: false,
|
||||
showThemeSwitch: true,
|
||||
),
|
||||
body: IndexedStack(
|
||||
children: [
|
||||
ExcludeFocus(excluding: _selectedIndex != 0, child: MessageListPage(isVisiblePage: _selectedIndex == 0)),
|
||||
ExcludeFocus(excluding: _selectedIndex != 1, child: ChannelRootPage(isVisiblePage: _selectedIndex == 1)),
|
||||
ExcludeFocus(excluding: _selectedIndex != 2, child: AccountRootPage(isVisiblePage: _selectedIndex == 2)),
|
||||
ExcludeFocus(excluding: _selectedIndex != 3, child: SettingsRootPage(isVisiblePage: _selectedIndex == 3)),
|
||||
ExcludeFocus(excluding: _selectedIndex != 4, child: SendRootPage(isVisiblePage: _selectedIndex == 4)),
|
||||
ExcludeFocus(excluding: _selectedIndex != INDEX_MESSAGES, child: MessageListPage(isVisiblePage: _selectedIndex == INDEX_MESSAGES)),
|
||||
ExcludeFocus(excluding: _selectedIndex != INDEX_CHANNELS, child: ChannelRootPage(isVisiblePage: _selectedIndex == INDEX_CHANNELS)),
|
||||
ExcludeFocus(excluding: _selectedIndex != INDEX_ACCOUNT, child: AccountRootPage(isVisiblePage: _selectedIndex == INDEX_ACCOUNT)),
|
||||
ExcludeFocus(excluding: _selectedIndex != INDEX_CONFIG, child: SettingsRootPage(isVisiblePage: _selectedIndex == INDEX_CONFIG)),
|
||||
ExcludeFocus(excluding: _selectedIndex != INDEX_SEND, child: SendRootPage(isVisiblePage: _selectedIndex == INDEX_SEND)),
|
||||
],
|
||||
index: _selectedIndex,
|
||||
),
|
||||
|
||||
@@ -32,7 +32,7 @@ class _FilterModalPriorityState extends State<FilterModalPriority> {
|
||||
return AlertDialog(
|
||||
title: const Text('Priority'),
|
||||
content: Container(
|
||||
width: 0,
|
||||
width: 9000,
|
||||
height: 200,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
|
||||
@@ -167,11 +167,13 @@ class _SCNAppState extends State<SCNApp> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_purchaseSubscription = InAppPurchase.instance.purchaseStream.listen(
|
||||
purchaseUpdated,
|
||||
onDone: () => _purchaseSubscription?.cancel(),
|
||||
onError: purchaseError,
|
||||
);
|
||||
if (Globals().clientType == 'IOS' || Globals().clientType == 'ANDROID') {
|
||||
_purchaseSubscription = InAppPurchase.instance.purchaseStream.listen(
|
||||
purchaseUpdated,
|
||||
onDone: () => _purchaseSubscription?.cancel(),
|
||||
onError: purchaseError,
|
||||
);
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/api/api_exception.dart';
|
||||
import 'package:simplecloudnotifier/components/error_display/error_display.dart';
|
||||
import 'package:simplecloudnotifier/models/user.dart';
|
||||
import 'package:simplecloudnotifier/pages/account/login.dart';
|
||||
import 'package:simplecloudnotifier/pages/account/show_token_modal.dart';
|
||||
import 'package:simplecloudnotifier/pages/channel_list/channel_list_extended.dart';
|
||||
import 'package:simplecloudnotifier/pages/client_list/client_list.dart';
|
||||
import 'package:simplecloudnotifier/pages/filtered_message_view/filtered_message_view.dart';
|
||||
@@ -115,7 +117,7 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
|
||||
_futureSubscriptionCount = ImmediateFuture.ofFuture(() async {
|
||||
if (!userAcc.isAuth()) throw new Exception('not logged in');
|
||||
final subs = await APIClient.getSubscriptionList(userAcc);
|
||||
final subs = await APIClient.getSubscriptionList(userAcc, SubscriptionFilter.ALL);
|
||||
return subs.length;
|
||||
}());
|
||||
|
||||
@@ -151,7 +153,7 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
// refresh all data and then replace teh futures used in build()
|
||||
|
||||
final channelsAll = await APIClient.getChannelList(userAcc, ChannelSelector.all);
|
||||
final subs = await APIClient.getSubscriptionList(userAcc);
|
||||
final subs = await APIClient.getSubscriptionList(userAcc, SubscriptionFilter.ALL);
|
||||
final clients = await APIClient.getClientList(userAcc);
|
||||
final keys = await APIClient.getKeyTokenList(userAcc);
|
||||
final senderNames = await APIClient.getSenderNameList(userAcc);
|
||||
@@ -165,6 +167,9 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
_futureSenderNamesCount = ImmediateFuture.ofValue(senderNames.length);
|
||||
_futureUser = ImmediateFuture.ofValue(user);
|
||||
});
|
||||
} on APIException catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to refresh account data: ' + exc.toString(), trace: trace);
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to refresh account data');
|
||||
} catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to refresh account data: ' + exc.toString(), trace: trace);
|
||||
Toaster.error("Error", 'Failed to refresh account data');
|
||||
@@ -268,7 +273,20 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
_buildHeader(context, user),
|
||||
const SizedBox(height: 16),
|
||||
Text(user.username ?? user.userID, overflow: TextOverflow.ellipsis, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20)),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
if (acc.tokenSend != null || acc.tokenAdmin != null)
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UI.button(
|
||||
text: 'UserID & Token kopieren',
|
||||
onPressed: () => _showTokenModal(context, acc),
|
||||
icon: FontAwesomeIcons.copy,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
..._buildCards(context, user),
|
||||
SizedBox(height: 16),
|
||||
_buildFooter(context, user),
|
||||
@@ -403,7 +421,13 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: "All Messages", filter: MessageFilter(senderUserID: [user.userID])));
|
||||
Navi.push(
|
||||
context,
|
||||
() => FilteredMessageViewPage(
|
||||
title: "All Messages",
|
||||
alertText: "All messages sent from your account",
|
||||
filter: MessageFilter(senderUserID: [user.userID]),
|
||||
));
|
||||
},
|
||||
),
|
||||
];
|
||||
@@ -456,18 +480,20 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UI.button(
|
||||
text: 'Logout',
|
||||
onPressed: _logout,
|
||||
color: Colors.orange,
|
||||
)),
|
||||
child: UI.button(
|
||||
text: 'Logout',
|
||||
onPressed: _logout,
|
||||
color: Colors.orange,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: UI.button(
|
||||
text: 'Delete Account',
|
||||
onPressed: _deleteAccount,
|
||||
color: Colors.red,
|
||||
)),
|
||||
child: UI.button(
|
||||
text: 'Delete Account',
|
||||
onPressed: _deleteAccount,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -507,9 +533,17 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
|
||||
await acc.save();
|
||||
Toaster.success("Success", 'Successfully Created a new account');
|
||||
} catch (exc, trace) {
|
||||
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => ShowTokenModal(account: acc, isAfterRegister: true),
|
||||
);
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to create user account');
|
||||
ApplicationLog.error('Failed to create user account: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to create user account');
|
||||
ApplicationLog.error('Failed to create user account: ' + exc.toString(), trace: trace);
|
||||
} finally {
|
||||
setState(() => loading = false);
|
||||
}
|
||||
@@ -553,6 +587,9 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
//TODO clear messages/channels/etc in open views
|
||||
acc.clear();
|
||||
await acc.save();
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to delete user');
|
||||
ApplicationLog.error('Failed to delete user: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to delete user');
|
||||
ApplicationLog.error('Failed to delete user: ' + exc.toString(), trace: trace);
|
||||
@@ -580,6 +617,9 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
Toaster.success("Success", 'Username changed');
|
||||
|
||||
_backgroundRefresh();
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to update username');
|
||||
ApplicationLog.error('Failed to update username: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to update username');
|
||||
ApplicationLog.error('Failed to update username: ' + exc.toString(), trace: trace);
|
||||
@@ -717,4 +757,11 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
||||
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
void _showTokenModal(BuildContext context, AppAuth acc) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => ShowTokenModal(account: acc, isAfterRegister: false),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/api/api_exception.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/state/globals.dart';
|
||||
@@ -162,9 +163,12 @@ class _AccountLoginPageState extends State<AccountLoginPage> {
|
||||
|
||||
Toaster.success("Login", "Successfully logged in");
|
||||
Navi.popToRoot(context);
|
||||
} catch (exc, trace) {
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to verify token');
|
||||
ApplicationLog.error('Failed to verify token: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to verify token');
|
||||
ApplicationLog.error('Failed to verify token: ' + exc.toString(), trace: trace);
|
||||
} finally {
|
||||
setState(() => loading = false);
|
||||
}
|
||||
|
||||
84
flutter/lib/pages/account/show_token_modal.dart
Normal file
@@ -0,0 +1,84 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||
import 'package:simplecloudnotifier/utils/toaster.dart';
|
||||
import 'package:simplecloudnotifier/utils/ui.dart';
|
||||
|
||||
class ShowTokenModal extends StatelessWidget {
|
||||
final AppAuth account;
|
||||
final bool isAfterRegister;
|
||||
|
||||
const ShowTokenModal({Key? key, required this.account, required this.isAfterRegister}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var alertText = "Use your UserID and Send-Token to send messages to your account.\n\nThe Admin-Token should not be shared.";
|
||||
if (this.isAfterRegister) {
|
||||
alertText = "These are your UserID and tokens.\n\nBackup your Admin-Token safely.\n\nUse UserId & Send-Token to send yourself messages.";
|
||||
}
|
||||
|
||||
return AlertDialog(
|
||||
title: const Text('UserID & Token'),
|
||||
content: Container(
|
||||
width: 9000,
|
||||
height: 450,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
BadgeDisplay(
|
||||
text: alertText,
|
||||
icon: null,
|
||||
mode: BadgeMode.info,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (this.account.userID != null)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'UserID',
|
||||
values: [this.account.userID!],
|
||||
iconActions: [(FontAwesomeIcons.copy, null, () => _copy('UserID', this.account.userID!))],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
if (this.account.tokenSend != null)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidKey,
|
||||
title: 'Send-Token',
|
||||
values: [this.account.tokenSend!],
|
||||
iconActions: [(FontAwesomeIcons.copy, null, () => _copy('Send-Token', this.account.tokenSend!))],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
if (this.account.tokenSend != null)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidKey,
|
||||
title: 'Admin-Token',
|
||||
values: [this.account.tokenAdmin!],
|
||||
iconActions: [(FontAwesomeIcons.copy, null, () => _copy('Admin-Token', this.account.tokenAdmin!))],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('Close'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _copy(String txt, String v) {
|
||||
Clipboard.setData(new ClipboardData(text: v));
|
||||
Toaster.info("Clipboard", 'Copied ${txt} to Clipboard');
|
||||
print('================= [CLIPBOARD] =================\n${v}\n================= [/CLIPBOARD] =================');
|
||||
}
|
||||
}
|
||||
@@ -144,28 +144,7 @@ class _ChannelRootPageState extends State<ChannelRootPage> with RouteAware {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, ChannelWithSubscription>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<ChannelWithSubscription>(
|
||||
itemBuilder: (context, item, index) => ChannelListItem(
|
||||
channel: item.channel,
|
||||
subscription: item.subscription,
|
||||
mode: ChannelListItemMode.Messages,
|
||||
onChannelListReloadTrigger: _enqueueReload,
|
||||
onSubscriptionChanged: (channelID, subscription) {
|
||||
setState(() {
|
||||
final idx = _pagingController.itemList?.indexWhere((p) => p.channel.channelID == channelID);
|
||||
if (idx != null && idx >= 0) _pagingController.itemList![idx] = ChannelWithSubscription(channel: _pagingController.itemList![idx].channel, subscription: subscription);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: _buildList(context),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
heroTag: 'fab_channel_list_qr',
|
||||
onPressed: () {
|
||||
@@ -176,6 +155,31 @@ class _ChannelRootPageState extends State<ChannelRootPage> with RouteAware {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildList(BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, ChannelWithSubscription>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<ChannelWithSubscription>(
|
||||
itemBuilder: (context, item, index) => ChannelListItem(
|
||||
channel: item.channel,
|
||||
subscription: item.subscription,
|
||||
mode: ChannelListItemMode.Messages,
|
||||
onChannelListReloadTrigger: _enqueueReload,
|
||||
onSubscriptionChanged: (channelID, subscription) {
|
||||
setState(() {
|
||||
final idx = _pagingController.itemList?.indexWhere((p) => p.channel.channelID == channelID);
|
||||
if (idx != null && idx >= 0) _pagingController.itemList![idx] = ChannelWithSubscription(channel: _pagingController.itemList![idx].channel, subscription: subscription);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _enqueueReload() {
|
||||
_reloadEnqueued = true;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/channel.dart';
|
||||
import 'package:simplecloudnotifier/pages/channel_scanner/channel_scanner.dart';
|
||||
import 'package:simplecloudnotifier/state/app_bar_state.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||
import 'package:simplecloudnotifier/pages/channel_list/channel_list_item.dart';
|
||||
@@ -121,27 +123,21 @@ class _ChannelListExtendedPageState extends State<ChannelListExtendedPage> with
|
||||
showShare: false,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, ChannelWithSubscription>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<ChannelWithSubscription>(
|
||||
itemBuilder: (context, item, index) => ChannelListItem(
|
||||
channel: item.channel,
|
||||
subscription: item.subscription,
|
||||
mode: ChannelListItemMode.Extended,
|
||||
onChannelListReloadTrigger: _enqueueReload,
|
||||
onSubscriptionChanged: (channelID, subscription) {
|
||||
setState(() {
|
||||
final idx = _pagingController.itemList?.indexWhere((p) => p.channel.channelID == channelID);
|
||||
if (idx != null && idx >= 0) _pagingController.itemList![idx] = ChannelWithSubscription(channel: _pagingController.itemList![idx].channel, subscription: subscription);
|
||||
});
|
||||
},
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
BadgeDisplay(
|
||||
text: "All channels accessible from this account\n(Your own channels and subscribed channels)",
|
||||
icon: null,
|
||||
mode: BadgeMode.info,
|
||||
textAlign: TextAlign.left,
|
||||
closable: true,
|
||||
extraPadding: EdgeInsets.fromLTRB(0, 0, 0, 16),
|
||||
hidden: !AppSettings().showInfoAlerts,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _buildList(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
@@ -154,6 +150,31 @@ class _ChannelListExtendedPageState extends State<ChannelListExtendedPage> with
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildList(BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, ChannelWithSubscription>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<ChannelWithSubscription>(
|
||||
itemBuilder: (context, item, index) => ChannelListItem(
|
||||
channel: item.channel,
|
||||
subscription: item.subscription,
|
||||
mode: ChannelListItemMode.Extended,
|
||||
onChannelListReloadTrigger: _enqueueReload,
|
||||
onSubscriptionChanged: (channelID, subscription) {
|
||||
setState(() {
|
||||
final idx = _pagingController.itemList?.indexWhere((p) => p.channel.channelID == channelID);
|
||||
if (idx != null && idx >= 0) _pagingController.itemList![idx] = ChannelWithSubscription(channel: _pagingController.itemList![idx].channel, subscription: subscription);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _enqueueReload() {
|
||||
_reloadEnqueued = true;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/api/api_exception.dart';
|
||||
import 'package:simplecloudnotifier/models/channel.dart';
|
||||
import 'package:simplecloudnotifier/models/scn_message.dart';
|
||||
import 'package:simplecloudnotifier/models/subscription.dart';
|
||||
@@ -220,6 +221,9 @@ class _ChannelListItemState extends State<ChannelListItem> {
|
||||
} else {
|
||||
Toaster.success("Success", 'Requested widget.subscription to channel');
|
||||
}
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
@@ -238,6 +242,9 @@ class _ChannelListItemState extends State<ChannelListItem> {
|
||||
widget.onSubscriptionChanged.call(sub.channelID, null);
|
||||
|
||||
Toaster.success("Success", 'Unsubscribed from channel');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
@@ -256,6 +263,9 @@ class _ChannelListItemState extends State<ChannelListItem> {
|
||||
widget.onSubscriptionChanged.call(sub.channelID, newSub);
|
||||
|
||||
Toaster.success("Success", 'Unsubscribed from channel');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
@@ -274,6 +284,9 @@ class _ChannelListItemState extends State<ChannelListItem> {
|
||||
widget.onSubscriptionChanged.call(sub.channelID, newSub);
|
||||
|
||||
Toaster.success("Success", 'Subscribed to channel');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
|
||||
@@ -3,11 +3,13 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/scan_result.dart';
|
||||
import 'package:simplecloudnotifier/pages/channel_scanner/channel_scanner_result_channelsubscribe.dart';
|
||||
import 'package:simplecloudnotifier/pages/channel_scanner/channel_scanner_result_channelview.dart';
|
||||
import 'package:simplecloudnotifier/pages/channel_scanner/channel_scanner_result_messagesend.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/utils/ui.dart';
|
||||
|
||||
class ChannelScannerPage extends StatefulWidget {
|
||||
@@ -40,6 +42,16 @@ class _ChannelScannerPageState extends State<ChannelScannerPage> {
|
||||
padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 16),
|
||||
BadgeDisplay(
|
||||
text: "Scan the QR Code of an account to send messages to this account,\nor the QR Code of an channel to request a subscription to this channel.",
|
||||
icon: null,
|
||||
mode: BadgeMode.info,
|
||||
textAlign: TextAlign.left,
|
||||
closable: true,
|
||||
extraPadding: EdgeInsets.fromLTRB(0, 0, 0, 16),
|
||||
hidden: !AppSettings().showInfoAlerts,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
if (scanResult == null) ...[
|
||||
Center(
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/api/api_exception.dart';
|
||||
import 'package:simplecloudnotifier/components/error_display/error_display.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/channel.dart';
|
||||
@@ -14,6 +15,7 @@ import 'package:simplecloudnotifier/pages/filtered_message_view/filtered_message
|
||||
import 'package:simplecloudnotifier/pages/subscription_view/subscription_view.dart';
|
||||
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||
import 'package:simplecloudnotifier/state/app_bar_state.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/types/immediate_future.dart';
|
||||
import 'package:simplecloudnotifier/utils/dialogs.dart';
|
||||
@@ -181,18 +183,20 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
children: [
|
||||
_buildQRCode(context),
|
||||
SizedBox(height: 8),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'ChannelID',
|
||||
values: [channel.channelID],
|
||||
),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidInputNumeric,
|
||||
title: 'InternalName',
|
||||
values: [channel.internalName],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'ChannelID',
|
||||
values: [channel.channelID],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidInputNumeric,
|
||||
title: 'InternalName',
|
||||
values: [channel.internalName],
|
||||
),
|
||||
_buildDisplayNameCard(context, true),
|
||||
_buildDescriptionNameCard(context, true),
|
||||
UI.metaCard(
|
||||
@@ -283,18 +287,20 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(height: 8),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'ChannelID',
|
||||
values: [channel.channelID],
|
||||
),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidInputNumeric,
|
||||
title: 'InternalName',
|
||||
values: [channel.internalName],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'ChannelID',
|
||||
values: [channel.channelID],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidInputNumeric,
|
||||
title: 'InternalName',
|
||||
values: [channel.internalName],
|
||||
),
|
||||
_buildDisplayNameCard(context, false),
|
||||
_buildDescriptionNameCard(context, false),
|
||||
subCard,
|
||||
@@ -305,7 +311,7 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
icon: FontAwesomeIcons.solidEnvelope,
|
||||
title: 'Messages',
|
||||
values: [channel.messagesSent.toString()],
|
||||
mainAction: (subscription != null && subscription!.confirmed) ? () => Navi.push(context, () => FilteredMessageViewPage(title: channel.displayName, filter: MessageFilter(channelIDs: [channel.channelID]))) : null,
|
||||
mainAction: (subscription != null && subscription!.confirmed) ? () => Navi.push(context, () => FilteredMessageViewPage(title: channel.displayName, alertText: null, filter: MessageFilter(channelIDs: [channel.channelID]))) : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -344,12 +350,20 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
future: _futureOwner.future,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Owner',
|
||||
values: [channelPreview!.ownerUserID + (isOwned ? ' (you)' : ''), if (snapshot.data?.username != null) snapshot.data!.username!],
|
||||
);
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Owner',
|
||||
values: [channelPreview!.ownerUserID + (isOwned ? ' (you)' : ''), if (snapshot.data?.username != null) snapshot.data!.username!],
|
||||
);
|
||||
else
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Owner',
|
||||
values: [(snapshot.data?.username ?? channelPreview!.ownerUserID) + (isOwned ? ' (you)' : '')],
|
||||
);
|
||||
} else {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
@@ -537,6 +551,9 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
});
|
||||
|
||||
widget.needsReload?.call();
|
||||
} on APIException catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to save DisplayName: ' + exc.toString(), trace: trace);
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to save DisplayName');
|
||||
} catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to save DisplayName: ' + exc.toString(), trace: trace);
|
||||
Toaster.error("Error", 'Failed to save DisplayName');
|
||||
@@ -569,9 +586,12 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
});
|
||||
|
||||
widget.needsReload?.call();
|
||||
} on APIException catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to save DescriptionName: ' + exc.toString(), trace: trace);
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to save description');
|
||||
} catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to save DescriptionName: ' + exc.toString(), trace: trace);
|
||||
Toaster.error("Error", 'Failed to save DescriptionName');
|
||||
Toaster.error("Error", 'Failed to save description');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,6 +609,9 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
} else {
|
||||
Toaster.success("Success", 'Requested subscription to channel');
|
||||
}
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
@@ -612,6 +635,9 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
await _initStateAsync(false);
|
||||
|
||||
Toaster.success("Success", 'Unsubscribed from channel');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
@@ -630,6 +656,9 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
await _initStateAsync(false);
|
||||
|
||||
Toaster.success("Success", 'Unsubscribed from channel');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
@@ -648,6 +677,9 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
await _initStateAsync(false);
|
||||
|
||||
Toaster.success("Success", 'Subscribed to channel');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
@@ -664,6 +696,9 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
await _initStateAsync(false);
|
||||
|
||||
Toaster.success("Success", 'Subscription succesfully revoked');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to revoke subscription');
|
||||
ApplicationLog.error('Failed to revoke subscription: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to revoke subscription');
|
||||
ApplicationLog.error('Failed to revoke subscription: ' + exc.toString(), trace: trace);
|
||||
@@ -680,6 +715,9 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
await _initStateAsync(false);
|
||||
|
||||
Toaster.success("Success", 'Subscription succesfully confirmed');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to confirm subscription');
|
||||
ApplicationLog.error('Failed to confirm subscription: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to confirm subscription');
|
||||
ApplicationLog.error('Failed to confirm subscription: ' + exc.toString(), trace: trace);
|
||||
@@ -696,6 +734,9 @@ class _ChannelViewPageState extends State<ChannelViewPage> {
|
||||
await _initStateAsync(false);
|
||||
|
||||
Toaster.success("Success", 'Subscription request succesfully denied');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to deny subscription');
|
||||
ApplicationLog.error('Failed to deny subscription: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to deny subscription');
|
||||
ApplicationLog.error('Failed to deny subscription: ' + exc.toString(), trace: trace);
|
||||
|
||||
@@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/client.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||
import 'package:simplecloudnotifier/pages/client_list/client_list_item.dart';
|
||||
@@ -69,16 +71,35 @@ class _ClientListPageState extends State<ClientListPage> {
|
||||
showShare: false,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, Client>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<Client>(
|
||||
itemBuilder: (context, item, index) => ClientListItem(item: item),
|
||||
child: Column(
|
||||
children: [
|
||||
BadgeDisplay(
|
||||
text: "All clients connected with this account",
|
||||
icon: null,
|
||||
mode: BadgeMode.info,
|
||||
textAlign: TextAlign.left,
|
||||
closable: true,
|
||||
extraPadding: EdgeInsets.fromLTRB(0, 0, 0, 16),
|
||||
hidden: !AppSettings().showInfoAlerts,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _buildList(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildList(BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, Client>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<Client>(
|
||||
itemBuilder: (context, item, index) => ClientListItem(item: item),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/channel.dart';
|
||||
import 'package:simplecloudnotifier/models/scn_message.dart';
|
||||
@@ -17,11 +18,13 @@ class FilteredMessageViewPage extends StatefulWidget {
|
||||
const FilteredMessageViewPage({
|
||||
required this.title,
|
||||
required this.filter,
|
||||
required this.alertText,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final MessageFilter filter;
|
||||
final String? alertText;
|
||||
|
||||
@override
|
||||
State<FilteredMessageViewPage> createState() => _FilteredMessageViewPageState();
|
||||
@@ -87,31 +90,52 @@ class _FilteredMessageViewPageState extends State<FilteredMessageViewPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget child = _buildMessageList(context);
|
||||
|
||||
if (widget.alertText != null) {
|
||||
child = Column(
|
||||
children: [
|
||||
BadgeDisplay(
|
||||
text: widget.alertText!,
|
||||
icon: null,
|
||||
mode: BadgeMode.info,
|
||||
textAlign: TextAlign.left,
|
||||
closable: true,
|
||||
extraPadding: EdgeInsets.fromLTRB(0, 0, 0, 16),
|
||||
hidden: !AppSettings().showInfoAlerts,
|
||||
),
|
||||
Expanded(
|
||||
child: child,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return SCNScaffold(
|
||||
title: this.widget.title,
|
||||
showSearch: false,
|
||||
showShare: false,
|
||||
child: _buildMessageList(context),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMessageList(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<String, SCNMessage>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<SCNMessage>(
|
||||
itemBuilder: (context, item, index) => MessageListItem(
|
||||
message: item,
|
||||
allChannels: _channels ?? {},
|
||||
onPressed: () {
|
||||
Navi.push(context, () => MessageViewPage(messageID: item.messageID, preloadedData: (item,)));
|
||||
},
|
||||
),
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<String, SCNMessage>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<SCNMessage>(
|
||||
itemBuilder: (context, item, index) => MessageListItem(
|
||||
message: item,
|
||||
allChannels: _channels ?? {},
|
||||
onPressed: () {
|
||||
Navi.push(context, () => MessageViewPage(messageID: item.messageID, preloadedData: (item,)));
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -52,7 +52,7 @@ class _KeyTokenCreateDialogState extends State<KeyTokenCreateDialog> {
|
||||
return AlertDialog(
|
||||
title: const Text('Create new key'),
|
||||
content: Container(
|
||||
width: 0,
|
||||
width: 9000,
|
||||
height: 400,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'package:flutter/services.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||
import 'package:simplecloudnotifier/models/keytoken.dart';
|
||||
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/utils/toaster.dart';
|
||||
import 'package:simplecloudnotifier/utils/ui.dart';
|
||||
|
||||
@@ -18,21 +20,38 @@ class KeyTokenCreatedModal extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final acc = AppAuth();
|
||||
|
||||
return AlertDialog(
|
||||
title: const Text('A new key was created'),
|
||||
content: Container(
|
||||
width: 0,
|
||||
width: 9000,
|
||||
height: 350,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'KeyTokenID',
|
||||
values: [keytoken.keytokenID],
|
||||
const BadgeDisplay(
|
||||
text: "Please copy and save the token now, it cannot be retrieved later.",
|
||||
icon: null,
|
||||
mode: BadgeMode.warn,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (acc.userID != null)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'UserID',
|
||||
values: [acc.userID!],
|
||||
iconActions: [(FontAwesomeIcons.copy, null, () => _copy(acc.userID!))],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'KeyTokenID',
|
||||
values: [keytoken.keytokenID],
|
||||
),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidInputText,
|
||||
@@ -45,19 +64,12 @@ class KeyTokenCreatedModal extends StatelessWidget {
|
||||
title: 'Permissions',
|
||||
values: _formatPermissions(keytoken.permissions),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const BadgeDisplay(
|
||||
text: "Please copy and save the token now, it cannot be retrieved later.",
|
||||
icon: null,
|
||||
mode: BadgeMode.warn,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidKey,
|
||||
title: 'Token',
|
||||
values: [tokenValue.substring(0, 12) + '...'],
|
||||
iconActions: [(FontAwesomeIcons.copy, null, _copy)],
|
||||
values: [tokenValue],
|
||||
iconActions: [(FontAwesomeIcons.copy, null, () => _copy(tokenValue))],
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -89,9 +101,9 @@ class KeyTokenCreatedModal extends StatelessWidget {
|
||||
return result;
|
||||
}
|
||||
|
||||
void _copy() {
|
||||
Clipboard.setData(new ClipboardData(text: tokenValue));
|
||||
void _copy(String v) {
|
||||
Clipboard.setData(new ClipboardData(text: v));
|
||||
Toaster.info("Clipboard", 'Copied text to Clipboard');
|
||||
print('================= [CLIPBOARD] =================\n${tokenValue}\n================= [/CLIPBOARD] =================');
|
||||
print('================= [CLIPBOARD] =================\n${v}\n================= [/CLIPBOARD] =================');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/keytoken.dart';
|
||||
import 'package:simplecloudnotifier/pages/keytoken_list/keytoken_create_modal.dart';
|
||||
import 'package:simplecloudnotifier/pages/keytoken_list/keytoken_created_modal.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||
import 'package:simplecloudnotifier/pages/keytoken_list/keytoken_list_item.dart';
|
||||
@@ -72,16 +74,21 @@ class _KeyTokenListPageState extends State<KeyTokenListPage> {
|
||||
showShare: false,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, KeyToken>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<KeyToken>(
|
||||
itemBuilder: (context, item, index) => KeyTokenListItem(item: item, needsReload: _fullRefresh),
|
||||
child: Column(
|
||||
children: [
|
||||
BadgeDisplay(
|
||||
text: "These are your keys.\nKeys can be used to send messages and access your account.\n\nKeys can have different sets of permissions, the Admin-Key has full-access to your account",
|
||||
icon: null,
|
||||
mode: BadgeMode.info,
|
||||
textAlign: TextAlign.left,
|
||||
closable: true,
|
||||
extraPadding: EdgeInsets.fromLTRB(0, 0, 0, 16),
|
||||
hidden: !AppSettings().showInfoAlerts,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _buildList(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
@@ -97,6 +104,20 @@ class _KeyTokenListPageState extends State<KeyTokenListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildList(BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, KeyToken>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<KeyToken>(
|
||||
itemBuilder: (context, item, index) => KeyTokenListItem(item: item, needsReload: _fullRefresh),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _created(KeyToken token, String tokValue) {
|
||||
setState(() {
|
||||
_pagingController.itemList?.insert(0, token);
|
||||
|
||||
@@ -78,7 +78,7 @@ class KeyTokenListItem extends StatelessWidget {
|
||||
SizedBox(width: 4),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: item.name, filter: MessageFilter(usedKeys: [item.keytokenID])));
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: item.name, alertText: 'All message sent with the key \'${item.name}\'', filter: MessageFilter(usedKeys: [item.keytokenID])));
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
@@ -40,7 +40,7 @@ class _EditKeyTokenChannelsDialogState extends State<EditKeyTokenChannelsDialog>
|
||||
return AlertDialog(
|
||||
title: const Text('Channels'),
|
||||
content: Container(
|
||||
width: 0,
|
||||
width: 9000,
|
||||
height: 400,
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@@ -33,7 +33,7 @@ class _EditKeyTokenPermissionsDialogState extends State<EditKeyTokenPermissionsD
|
||||
return AlertDialog(
|
||||
title: const Text('Permissions'),
|
||||
content: Container(
|
||||
width: 0,
|
||||
width: 9000,
|
||||
height: 400,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/api/api_exception.dart';
|
||||
import 'package:simplecloudnotifier/components/error_display/error_display.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/channel.dart';
|
||||
@@ -200,16 +201,17 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(height: 8),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'KeyTokenID',
|
||||
values: [
|
||||
keytoken.keytokenID,
|
||||
if (keytokenUserAccAdmin?.keytokenID == keytoken.keytokenID) '(Currently used as Admin-Token)',
|
||||
if (keytokenUserAccSend?.keytokenID == keytoken.keytokenID) '(Currently used as Send-Token)',
|
||||
],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'KeyTokenID',
|
||||
values: [
|
||||
keytoken.keytokenID,
|
||||
if (keytokenUserAccAdmin?.keytokenID == keytoken.keytokenID) '(Currently used as Admin-Token)',
|
||||
if (keytokenUserAccSend?.keytokenID == keytoken.keytokenID) '(Currently used as Send-Token)',
|
||||
],
|
||||
),
|
||||
_buildNameCard(context, true),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
@@ -230,7 +232,7 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
|
||||
title: 'Messages',
|
||||
values: [keytoken.messagesSent.toString()],
|
||||
mainAction: () {
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: keytoken.name, filter: MessageFilter(usedKeys: [keytoken.keytokenID])));
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: keytoken.name, alertText: 'All message sent with the key \'${keytoken.name}\'', filter: MessageFilter(usedKeys: [keytoken.keytokenID])));
|
||||
},
|
||||
),
|
||||
..._buildPermissionCard(context, true, keytoken.toPreview()),
|
||||
@@ -249,12 +251,13 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(height: 8),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'KeyTokenID',
|
||||
values: [keytoken.keytokenID],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'KeyTokenID',
|
||||
values: [keytoken.keytokenID],
|
||||
),
|
||||
_buildNameCard(context, false),
|
||||
_buildOwnerCard(context, false),
|
||||
..._buildPermissionCard(context, false, keytoken),
|
||||
@@ -269,12 +272,20 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
|
||||
future: _futureOwner.future,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Owner',
|
||||
values: [keytokenPreview!.ownerUserID + (isOwned ? ' (you)' : ''), if (snapshot.data?.username != null) snapshot.data!.username!],
|
||||
);
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Owner',
|
||||
values: [keytokenPreview!.ownerUserID + (isOwned ? ' (you)' : ''), if (snapshot.data?.username != null) snapshot.data!.username!],
|
||||
);
|
||||
else
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Owner',
|
||||
values: [(snapshot.data?.username ?? keytokenPreview!.ownerUserID) + (isOwned ? ' (you)' : '')],
|
||||
);
|
||||
} else {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
@@ -543,6 +554,9 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
|
||||
Toaster.info('Logout', 'Successfully deleted the key');
|
||||
|
||||
Navi.pop(context);
|
||||
} on APIException catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to delete key: ' + exc.toString(), trace: trace);
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to delete key');
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to delete key');
|
||||
ApplicationLog.error('Failed to delete key: ' + exc.toString(), trace: trace);
|
||||
@@ -563,6 +577,9 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
|
||||
Toaster.info("Success", "Key updated");
|
||||
|
||||
widget.needsReload?.call();
|
||||
} on APIException catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to update key: ' + exc.toString(), trace: trace);
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to update key');
|
||||
} catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to update key: ' + exc.toString(), trace: trace);
|
||||
Toaster.error("Error", 'Failed to update key');
|
||||
@@ -583,6 +600,9 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
|
||||
Toaster.info("Success", "Key updated");
|
||||
|
||||
widget.needsReload?.call();
|
||||
} on APIException catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to update key: ' + exc.toString(), trace: trace);
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to update key');
|
||||
} catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to update key: ' + exc.toString(), trace: trace);
|
||||
Toaster.error("Error", 'Failed to update key');
|
||||
@@ -603,6 +623,9 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
|
||||
Toaster.info("Success", "Key updated");
|
||||
|
||||
widget.needsReload?.call();
|
||||
} on APIException catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to update key: ' + exc.toString(), trace: trace);
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to update key');
|
||||
} catch (exc, trace) {
|
||||
ApplicationLog.error('Failed to update key: ' + exc.toString(), trace: trace);
|
||||
Toaster.error("Error", 'Failed to update key');
|
||||
|
||||
@@ -141,6 +141,8 @@ class _MessageViewPageState extends State<MessageViewPage> {
|
||||
Widget _buildMessageView(BuildContext context, SCNMessage message, ChannelPreview? channel, KeyTokenPreview? token, UserPreview? user) {
|
||||
final userAccUserID = context.select<AppAuth, String?>((v) => v.userID);
|
||||
|
||||
var cfg = AppSettings();
|
||||
|
||||
final child = Padding(
|
||||
padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),
|
||||
child: Column(
|
||||
@@ -150,6 +152,13 @@ class _MessageViewPageState extends State<MessageViewPage> {
|
||||
SizedBox(height: 8),
|
||||
if (message.content != null) ..._buildMessageContent(context, message),
|
||||
SizedBox(height: 8),
|
||||
if (cfg.showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'MessageID',
|
||||
values: [message.messageID, if (message.userMessageID != null) message.userMessageID!],
|
||||
),
|
||||
if (message.senderName != null)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
@@ -157,33 +166,42 @@ class _MessageViewPageState extends State<MessageViewPage> {
|
||||
title: 'Sender',
|
||||
values: [message.senderName!],
|
||||
mainAction: () => {
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: message.senderName!, filter: MessageFilter(senderNames: [message.senderName!])))
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: message.senderName!, alertText: 'All message sent from \'${message.senderName!}\'', filter: MessageFilter(senderNames: [message.senderName!])))
|
||||
},
|
||||
),
|
||||
if (cfg.showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidGearCode,
|
||||
title: 'KeyToken',
|
||||
values: [message.usedKeyID, token?.name ?? '...'],
|
||||
mainAction: () {
|
||||
if (message.senderUserID == userAccUserID) {
|
||||
Navi.push(context, () => KeyTokenViewPage(keytokenID: message.usedKeyID, preloadedData: null, needsReload: null));
|
||||
} else {
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: token?.name ?? message.usedKeyID, alertText: 'All message sent with the specified key', filter: MessageFilter(usedKeys: [message.usedKeyID])));
|
||||
}
|
||||
},
|
||||
),
|
||||
if (!cfg.showExtendedAttributes && token != null)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidGearCode,
|
||||
title: 'KeyToken',
|
||||
values: [token.name],
|
||||
mainAction: () {
|
||||
if (message.senderUserID == userAccUserID) {
|
||||
Navi.push(context, () => KeyTokenViewPage(keytokenID: message.usedKeyID, preloadedData: null, needsReload: null));
|
||||
} else {
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: token.name, alertText: 'All message sent with key \'${token.name}\'', filter: MessageFilter(usedKeys: [message.usedKeyID])));
|
||||
}
|
||||
},
|
||||
),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidGearCode,
|
||||
title: 'KeyToken',
|
||||
values: [message.usedKeyID, token?.name ?? '...'],
|
||||
mainAction: () {
|
||||
if (message.senderUserID == userAccUserID) {
|
||||
Navi.push(context, () => KeyTokenViewPage(keytokenID: message.usedKeyID, preloadedData: null, needsReload: null));
|
||||
} else {
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: token?.name ?? message.usedKeyID, filter: MessageFilter(usedKeys: [message.usedKeyID])));
|
||||
}
|
||||
},
|
||||
),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'MessageID',
|
||||
values: [message.messageID, message.userMessageID ?? ''],
|
||||
),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidSnake,
|
||||
title: 'Channel',
|
||||
values: [message.channelID, channel?.displayName ?? message.channelInternalName],
|
||||
values: [if (cfg.showExtendedAttributes) message.channelID, channel?.displayName ?? message.channelInternalName],
|
||||
mainAction: (channel != null)
|
||||
? () {
|
||||
Navi.push(context, () => ChannelViewPage(channelID: channel.channelID, preloadedData: null, needsReload: null));
|
||||
@@ -196,19 +214,28 @@ class _MessageViewPageState extends State<MessageViewPage> {
|
||||
title: 'Timestamp',
|
||||
values: [message.timestamp],
|
||||
),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'User',
|
||||
values: [user?.userID ?? message.senderUserID, user?.username ?? ''],
|
||||
mainAction: () => Navi.push(context, () => FilteredMessageViewPage(title: user?.username ?? message.senderUserID, filter: MessageFilter(senderUserID: [message.senderUserID]))),
|
||||
),
|
||||
if (cfg.showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'User',
|
||||
values: [user?.userID ?? message.senderUserID, if (user?.username != null) user?.username ?? ''],
|
||||
mainAction: () => Navi.push(context, () => FilteredMessageViewPage(title: user?.username ?? message.senderUserID, alertText: 'All message sent by the specified account', filter: MessageFilter(senderUserID: [message.senderUserID]))),
|
||||
),
|
||||
if (!cfg.showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'User',
|
||||
values: [user?.username ?? user?.userID ?? message.senderUserID],
|
||||
mainAction: () => Navi.push(context, () => FilteredMessageViewPage(title: user?.username ?? message.senderUserID, alertText: 'All message sent by the specified account', filter: MessageFilter(senderUserID: [message.senderUserID]))),
|
||||
),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidBolt,
|
||||
title: 'Priority',
|
||||
values: [_prettyPrintPriority(message.priority)],
|
||||
mainAction: () => Navi.push(context, () => FilteredMessageViewPage(title: "Priority ${message.priority}", filter: MessageFilter(priority: [message.priority]))),
|
||||
mainAction: () => Navi.push(context, () => FilteredMessageViewPage(title: "Priority ${message.priority}", alertText: 'All message sent with priority ' + _prettyPrintPriority(message.priority), filter: MessageFilter(priority: [message.priority]))),
|
||||
),
|
||||
if (message.senderUserID == userAccUserID)
|
||||
UI.button(
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/api/api_exception.dart';
|
||||
import 'package:simplecloudnotifier/components/error_display/error_display.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/state/globals.dart';
|
||||
@@ -289,6 +290,9 @@ class _SendRootPageState extends State<SendRootPage> {
|
||||
_msgTitle.clear();
|
||||
_msgContent.clear();
|
||||
});
|
||||
} on APIException catch (e, stackTrace) {
|
||||
if (!e.toastShown) Toaster.error("Error", 'Failed to send message: ${e.toString()}');
|
||||
ApplicationLog.error('Failed to send message', trace: stackTrace);
|
||||
} catch (e, stackTrace) {
|
||||
Toaster.error("Error", 'Failed to send message: ${e.toString()}');
|
||||
ApplicationLog.error('Failed to send message', trace: stackTrace);
|
||||
@@ -308,6 +312,9 @@ class _SendRootPageState extends State<SendRootPage> {
|
||||
_msgTitle.clear();
|
||||
_msgContent.clear();
|
||||
});
|
||||
} on APIException catch (e, stackTrace) {
|
||||
if (!e.toastShown) Toaster.error("Error", 'Failed to send message: ${e.toString()}');
|
||||
ApplicationLog.error('Failed to send message', trace: stackTrace);
|
||||
} catch (e, stackTrace) {
|
||||
Toaster.error("Error", 'Failed to send message: ${e.toString()}');
|
||||
ApplicationLog.error('Failed to send message', trace: stackTrace);
|
||||
|
||||
@@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/sender_name_statistics.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||
import 'package:simplecloudnotifier/pages/sender_list/sender_list_item.dart';
|
||||
@@ -69,16 +71,35 @@ class _SenderListPageState extends State<SenderListPage> {
|
||||
showShare: false,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, SenderNameStatistics>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<SenderNameStatistics>(
|
||||
itemBuilder: (context, item, index) => SenderListItem(item: item),
|
||||
child: Column(
|
||||
children: [
|
||||
BadgeDisplay(
|
||||
text: "All sender used to send messages to this account",
|
||||
icon: null,
|
||||
mode: BadgeMode.info,
|
||||
textAlign: TextAlign.left,
|
||||
closable: true,
|
||||
extraPadding: EdgeInsets.fromLTRB(0, 0, 0, 16),
|
||||
hidden: !AppSettings().showInfoAlerts,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _buildList(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildList(BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, SenderNameStatistics>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<SenderNameStatistics>(
|
||||
itemBuilder: (context, item, index) => SenderListItem(item: item),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -30,7 +30,7 @@ class SenderListItem extends StatelessWidget {
|
||||
color: Theme.of(context).cardTheme.color,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: item.name, filter: MessageFilter(senderNames: [item.name])));
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: item.name, alertText: 'All message sent from \'${item.name!}\'', filter: MessageFilter(senderNames: [item.name])));
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -71,7 +71,7 @@ class SenderListItem extends StatelessWidget {
|
||||
SizedBox(width: 4),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: item.name, filter: MessageFilter(senderNames: [item.name])));
|
||||
Navi.push(context, () => FilteredMessageViewPage(title: item.name, alertText: 'All message sent from \'${item.name!}\'', filter: MessageFilter(senderNames: [item.name])));
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
@@ -146,6 +146,18 @@ class _SettingsRootPageState extends State<SettingsRootPage> {
|
||||
title: Text('Refresh messages on app resume'),
|
||||
onToggle: (value) => AppSettings().update((p) => p.alwaysBackgroundRefreshMessageListOnLifecycleResume = !p.alwaysBackgroundRefreshMessageListOnLifecycleResume),
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
initialValue: cfg.showInfoAlerts,
|
||||
leading: Icon(FontAwesomeIcons.solidCircleInfo),
|
||||
title: Text('Show various helpful info boxes'),
|
||||
onToggle: (value) => AppSettings().update((p) => p.showInfoAlerts = !p.showInfoAlerts),
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
initialValue: cfg.showExtendedAttributes,
|
||||
leading: Icon(FontAwesomeIcons.solidSheetPlastic),
|
||||
title: Text('Show all attributes of entities'),
|
||||
onToggle: (value) => AppSettings().update((p) => p.showExtendedAttributes = !p.showExtendedAttributes),
|
||||
),
|
||||
],
|
||||
),
|
||||
SettingsSection(
|
||||
|
||||
@@ -2,15 +2,41 @@ import 'package:flutter/material.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||
import 'package:simplecloudnotifier/components/filter_chips/filter_chips.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/channel.dart';
|
||||
import 'package:simplecloudnotifier/models/subscription.dart';
|
||||
import 'package:simplecloudnotifier/models/user.dart';
|
||||
import 'package:simplecloudnotifier/state/app_settings.dart';
|
||||
import 'package:simplecloudnotifier/state/application_log.dart';
|
||||
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||
import 'package:simplecloudnotifier/pages/subscription_list/subscription_list_item.dart';
|
||||
import 'package:simplecloudnotifier/state/scn_data_cache.dart';
|
||||
|
||||
enum SubscriptionListFilter {
|
||||
ALL,
|
||||
INACTIVE,
|
||||
OWN,
|
||||
EXTERNAL,
|
||||
INCOMING;
|
||||
|
||||
SubscriptionFilter toAPIFilter() {
|
||||
switch (this) {
|
||||
case ALL:
|
||||
return SubscriptionFilter.ALL;
|
||||
case INACTIVE:
|
||||
return SubscriptionFilter.OWNED_INACTIVE;
|
||||
case OWN:
|
||||
return SubscriptionFilter.OWNED_ACTIVE;
|
||||
case EXTERNAL:
|
||||
return SubscriptionFilter.EXTERNAL_ALL;
|
||||
case INCOMING:
|
||||
return SubscriptionFilter.INCOMING_ALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SubscriptionListPage extends StatefulWidget {
|
||||
const SubscriptionListPage({super.key});
|
||||
|
||||
@@ -24,6 +50,8 @@ class _SubscriptionListPageState extends State<SubscriptionListPage> {
|
||||
final userCache = Map<String, UserPreview>();
|
||||
final channelCache = Map<String, ChannelPreview>();
|
||||
|
||||
SubscriptionListFilter filter = SubscriptionListFilter.ALL;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -58,7 +86,7 @@ class _SubscriptionListPageState extends State<SubscriptionListPage> {
|
||||
}
|
||||
|
||||
try {
|
||||
final items = (await APIClient.getSubscriptionList(acc)).toList();
|
||||
final items = (await APIClient.getSubscriptionList(acc, filter.toAPIFilter())).toList();
|
||||
|
||||
items.sort((a, b) => -1 * a.timestampCreated.compareTo(b.timestampCreated));
|
||||
|
||||
@@ -93,16 +121,51 @@ class _SubscriptionListPageState extends State<SubscriptionListPage> {
|
||||
showShare: false,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, Subscription>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<Subscription>(
|
||||
itemBuilder: (context, item, index) => SubscriptionListItem(item: item, userCache: userCache, channelCache: channelCache, needsReload: fullRefresh),
|
||||
child: Column(
|
||||
children: [
|
||||
BadgeDisplay(
|
||||
text: "These are subscriptions to individual Channels\n\nThey contain to your own channels, subscriptions to foreign channels and subscriptions of other users to your channels (active and requested).",
|
||||
icon: null,
|
||||
mode: BadgeMode.info,
|
||||
textAlign: TextAlign.left,
|
||||
closable: true,
|
||||
extraPadding: EdgeInsets.fromLTRB(0, 0, 0, 16),
|
||||
hidden: !AppSettings().showInfoAlerts,
|
||||
),
|
||||
),
|
||||
FilterChips<SubscriptionListFilter>(
|
||||
options: [
|
||||
(SubscriptionListFilter.ALL, 'All'),
|
||||
(SubscriptionListFilter.OWN, 'Own'),
|
||||
(SubscriptionListFilter.EXTERNAL, 'External'),
|
||||
(SubscriptionListFilter.INCOMING, 'Incoming'),
|
||||
(SubscriptionListFilter.INACTIVE, 'Inactive'),
|
||||
],
|
||||
value: filter,
|
||||
onChanged: (newFilter) {
|
||||
setState(() {
|
||||
filter = newFilter;
|
||||
_pagingController.refresh();
|
||||
});
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: _buildList(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildList(BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () => Future.sync(
|
||||
() => _pagingController.refresh(),
|
||||
),
|
||||
child: PagedListView<int, Subscription>(
|
||||
pagingController: _pagingController,
|
||||
builderDelegate: PagedChildBuilderDelegate<Subscription>(
|
||||
itemBuilder: (context, item, index) => SubscriptionListItem(item: item, userCache: userCache, channelCache: channelCache, needsReload: fullRefresh),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||
import 'package:simplecloudnotifier/api/api_exception.dart';
|
||||
import 'package:simplecloudnotifier/components/error_display/error_display.dart';
|
||||
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
|
||||
import 'package:simplecloudnotifier/models/channel.dart';
|
||||
@@ -168,12 +169,13 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(height: 8),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'SubscriptionID',
|
||||
values: [subscription.subscriptionID],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'SubscriptionID',
|
||||
values: [subscription.subscriptionID],
|
||||
),
|
||||
_buildChannelOwnerCard(context, subscription),
|
||||
_buildSubscriberCard(context, subscription),
|
||||
_buildChannelCard(context, subscription),
|
||||
@@ -201,12 +203,13 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(height: 8),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'SubscriptionID',
|
||||
values: [subscription.subscriptionID],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'SubscriptionID',
|
||||
values: [subscription.subscriptionID],
|
||||
),
|
||||
_buildChannelOwnerCard(context, subscription),
|
||||
_buildSubscriberCard(context, subscription),
|
||||
_buildChannelCard(context, subscription),
|
||||
@@ -236,12 +239,13 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(height: 8),
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'SubscriptionID',
|
||||
values: [subscription.subscriptionID],
|
||||
),
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidIdCardClip,
|
||||
title: 'SubscriptionID',
|
||||
values: [subscription.subscriptionID],
|
||||
),
|
||||
_buildChannelOwnerCard(context, subscription),
|
||||
_buildSubscriberCard(context, subscription),
|
||||
_buildChannelCard(context, subscription),
|
||||
@@ -271,12 +275,20 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
future: _futureChannelOwner.future,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Channel Owner',
|
||||
values: [subscription.channelOwnerUserID + (isSelf ? ' (you)' : ''), if (snapshot.data?.username != null) snapshot.data!.username!],
|
||||
);
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Channel Owner',
|
||||
values: [subscription.channelOwnerUserID + (isSelf ? ' (you)' : ''), if (snapshot.data?.username != null) snapshot.data!.username!],
|
||||
);
|
||||
else
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Channel Owner',
|
||||
values: [(snapshot.data?.username ?? subscription.channelOwnerUserID) + (isSelf ? ' (you)' : '')],
|
||||
);
|
||||
} else {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
@@ -298,12 +310,20 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
future: _futureSubscriber.future,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Subscriber',
|
||||
values: [subscription.subscriberUserID + (isSelf ? ' (you)' : ''), if (snapshot.data?.username != null) snapshot.data!.username!],
|
||||
);
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Subscriber',
|
||||
values: [subscription.subscriberUserID + (isSelf ? ' (you)' : ''), if (snapshot.data?.username != null) snapshot.data!.username!],
|
||||
);
|
||||
else
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidUser,
|
||||
title: 'Subscriber',
|
||||
values: [(snapshot.data?.username ?? subscription.subscriberUserID) + (isSelf ? ' (you)' : '')],
|
||||
);
|
||||
} else {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
@@ -321,13 +341,22 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
future: _futureChannel.future,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidSnake,
|
||||
title: 'Channel',
|
||||
values: [subscription.channelID, snapshot.data!.displayName],
|
||||
mainAction: () => Navi.push(context, () => ChannelViewPage(channelID: subscription.channelID, preloadedData: null, needsReload: null)),
|
||||
);
|
||||
if (AppSettings().showExtendedAttributes)
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidSnake,
|
||||
title: 'Channel',
|
||||
values: [subscription.channelID, snapshot.data!.displayName],
|
||||
mainAction: () => Navi.push(context, () => ChannelViewPage(channelID: subscription.channelID, preloadedData: null, needsReload: null)),
|
||||
);
|
||||
else
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
icon: FontAwesomeIcons.solidSnake,
|
||||
title: 'Channel',
|
||||
values: [snapshot.data!.displayName],
|
||||
mainAction: () => Navi.push(context, () => ChannelViewPage(channelID: subscription.channelID, preloadedData: null, needsReload: null)),
|
||||
);
|
||||
} else {
|
||||
return UI.metaCard(
|
||||
context: context,
|
||||
@@ -407,6 +436,9 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
await _initStateAsync(false);
|
||||
|
||||
Toaster.success("Success", 'Subscription succesfully confirmed');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to confirm subscription');
|
||||
ApplicationLog.error('Failed to confirm subscription: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to confirm subscription');
|
||||
ApplicationLog.error('Failed to confirm subscription: ' + exc.toString(), trace: trace);
|
||||
@@ -429,6 +461,9 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
|
||||
Toaster.success("Success", 'Unsubscribed from channel');
|
||||
Navi.pop(context);
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
@@ -447,6 +482,9 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
await _initStateAsync(false);
|
||||
|
||||
Toaster.success("Success", 'Unsubscribed from channel');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to unsubscribe from channel');
|
||||
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
|
||||
@@ -465,6 +503,9 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
|
||||
await _initStateAsync(false);
|
||||
|
||||
Toaster.success("Success", 'Subscribed to channel');
|
||||
} on APIException catch (exc, trace) {
|
||||
if (!exc.toastShown) Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
} catch (exc, trace) {
|
||||
Toaster.error("Error", 'Failed to subscribe to channel');
|
||||
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
|
||||
|
||||
@@ -56,6 +56,8 @@ class AppSettings extends ChangeNotifier {
|
||||
bool alwaysBackgroundRefreshMessageListOnLifecycleResume = true;
|
||||
AppSettingsDateFormat dateFormat = AppSettingsDateFormat.ISO;
|
||||
int messagePreviewLength = 3;
|
||||
bool showInfoAlerts = true;
|
||||
bool showExtendedAttributes = false;
|
||||
|
||||
AppNotificationSettings notification0 = AppNotificationSettings();
|
||||
AppNotificationSettings notification1 = AppNotificationSettings();
|
||||
@@ -80,6 +82,8 @@ class AppSettings extends ChangeNotifier {
|
||||
alwaysBackgroundRefreshMessageListOnLifecycleResume = true;
|
||||
dateFormat = AppSettingsDateFormat.ISO;
|
||||
messagePreviewLength = 3;
|
||||
showInfoAlerts = true;
|
||||
showExtendedAttributes = true;
|
||||
|
||||
notification0 = AppNotificationSettings();
|
||||
notification1 = AppNotificationSettings();
|
||||
@@ -97,6 +101,8 @@ class AppSettings extends ChangeNotifier {
|
||||
alwaysBackgroundRefreshMessageListOnLifecycleResume = Globals().sharedPrefs.getBool('settings.alwaysBackgroundRefreshMessageListOnLifecycleResume') ?? alwaysBackgroundRefreshMessageListOnLifecycleResume;
|
||||
dateFormat = AppSettingsDateFormat.parse(Globals().sharedPrefs.getString('settings.dateFormat')) ?? dateFormat;
|
||||
messagePreviewLength = Globals().sharedPrefs.getInt('settings.messagePreviewLength') ?? messagePreviewLength;
|
||||
showInfoAlerts = Globals().sharedPrefs.getBool('settings.showInfoAlerts') ?? showInfoAlerts;
|
||||
showInfoAlerts = Globals().sharedPrefs.getBool('settings.showExtendedAttributes') ?? showExtendedAttributes;
|
||||
|
||||
notification0 = AppNotificationSettings.load(Globals().sharedPrefs, 'settings.notification0');
|
||||
notification1 = AppNotificationSettings.load(Globals().sharedPrefs, 'settings.notification1');
|
||||
@@ -112,6 +118,8 @@ class AppSettings extends ChangeNotifier {
|
||||
await Globals().sharedPrefs.setBool('settings.alwaysBackgroundRefreshMessageListOnLifecycleResume', alwaysBackgroundRefreshMessageListOnLifecycleResume);
|
||||
await Globals().sharedPrefs.setString('settings.dateFormat', dateFormat.key);
|
||||
await Globals().sharedPrefs.setInt('settings.messagePreviewLength', messagePreviewLength);
|
||||
await Globals().sharedPrefs.setBool('settings.showInfoAlerts', showInfoAlerts);
|
||||
await Globals().sharedPrefs.setBool('settings.showExtendedAttributes', showExtendedAttributes);
|
||||
|
||||
await notification0.save(Globals().sharedPrefs, 'settings.notification0');
|
||||
await notification1.save(Globals().sharedPrefs, 'settings.notification1');
|
||||
|
||||
@@ -5,10 +5,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: _fe_analyzer_shared
|
||||
sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab"
|
||||
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "76.0.0"
|
||||
version: "67.0.0"
|
||||
_flutterfire_internals:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -17,11 +17,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.54"
|
||||
_macros:
|
||||
dependency: transitive
|
||||
description: dart
|
||||
source: sdk
|
||||
version: "0.3.3"
|
||||
action_slider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -34,10 +29,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e"
|
||||
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.11.0"
|
||||
version: "6.4.1"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -90,10 +85,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build
|
||||
sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0
|
||||
sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.2"
|
||||
version: "2.4.1"
|
||||
build_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -114,26 +109,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_resolvers
|
||||
sha256: b9e4fda21d846e192628e7a4f6deda6888c36b5b69ba02ff291a01fd529140f0
|
||||
sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.4"
|
||||
version: "2.4.2"
|
||||
build_runner:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_runner
|
||||
sha256: "058fe9dce1de7d69c4b84fada934df3e0153dd000758c4d65964d0166779aa99"
|
||||
sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.15"
|
||||
version: "2.4.13"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_runner_core
|
||||
sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021"
|
||||
sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.0.0"
|
||||
version: "7.3.2"
|
||||
built_collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -234,10 +229,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
sha256: "7306ab8a2359a48d22310ad823521d723acfed60ee1f7e37388e8986853b6820"
|
||||
sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.8"
|
||||
version: "2.3.6"
|
||||
dbus:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -282,10 +277,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
|
||||
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
version: "1.3.3"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -616,26 +611,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
|
||||
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.8"
|
||||
version: "11.0.2"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
|
||||
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.9"
|
||||
version: "3.0.10"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_testing
|
||||
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
|
||||
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "3.0.2"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -652,14 +647,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
macros:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: macros
|
||||
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.3-main.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -984,10 +971,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925"
|
||||
sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "2.0.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -1077,10 +1064,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
|
||||
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.4"
|
||||
version: "0.7.6"
|
||||
timezone:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1189,10 +1176,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
version: "2.2.0"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1282,5 +1269,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.1.3"
|
||||
sdks:
|
||||
dart: ">=3.7.0 <4.0.0"
|
||||
dart: ">=3.9.0 <4.0.0"
|
||||
flutter: ">=3.27.0"
|
||||
|
||||
@@ -2,10 +2,10 @@ name: simplecloudnotifier
|
||||
description: "Receive push messages"
|
||||
publish_to: 'none'
|
||||
|
||||
version: 2.0.1+492
|
||||
version: 2.1.0+502
|
||||
|
||||
environment:
|
||||
sdk: '>=3.2.6 <4.0.0'
|
||||
sdk: '>=3.9.0 <4.0.0'
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
||||
2
scnserver/.gitignore
vendored
@@ -18,6 +18,8 @@ identifier.sqlite
|
||||
|
||||
.idea/dataSources.xml
|
||||
|
||||
.idea/copilot*
|
||||
|
||||
.swaggobin
|
||||
|
||||
scn_send.sh
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"blackforestbytes.com/simplecloudnotifier/api/apierr"
|
||||
"blackforestbytes.com/simplecloudnotifier/api/ginresp"
|
||||
ct "blackforestbytes.com/simplecloudnotifier/db/cursortoken"
|
||||
"blackforestbytes.com/simplecloudnotifier/logic"
|
||||
"blackforestbytes.com/simplecloudnotifier/models"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/ginext"
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/mathext"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ListChannels swaggerdoc
|
||||
@@ -487,7 +488,7 @@ func (h APIHandler) ListChannelMessages(pctx ginext.PreContext) ginext.HTTPRespo
|
||||
// @Failure 404 {object} ginresp.apiError "channel not found"
|
||||
// @Failure 500 {object} ginresp.apiError "internal server error"
|
||||
//
|
||||
// @Router /api/v2/users/{uid}/channels/{cid} [PATCH]
|
||||
// @Router /api/v2/users/{uid}/channels/{cid} [DELETE]
|
||||
func (h APIHandler) DeleteChannel(pctx ginext.PreContext) ginext.HTTPResponse {
|
||||
type uri struct {
|
||||
UserID models.UserID `uri:"uid" binding:"entityid"`
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"blackforestbytes.com/simplecloudnotifier/api/apierr"
|
||||
"blackforestbytes.com/simplecloudnotifier/api/ginresp"
|
||||
"blackforestbytes.com/simplecloudnotifier/logic"
|
||||
"blackforestbytes.com/simplecloudnotifier/models"
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/ginext"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ListUserSenderNames swaggerdoc
|
||||
@@ -23,7 +24,7 @@ import (
|
||||
// @Failure 404 {object} ginresp.apiError "message not found"
|
||||
// @Failure 500 {object} ginresp.apiError "internal server error"
|
||||
//
|
||||
// @Router /api/v2/users/{uid}/keys [GET]
|
||||
// @Router /api/v2/users/{uid}/sender-names [GET]
|
||||
func (h APIHandler) ListUserSenderNames(pctx ginext.PreContext) ginext.HTTPResponse {
|
||||
type uri struct {
|
||||
UserID models.UserID `uri:"uid" binding:"entityid"`
|
||||
|
||||
@@ -1656,7 +1656,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"delete": {
|
||||
"tags": [
|
||||
"API-v2"
|
||||
],
|
||||
@@ -1710,6 +1710,85 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"tags": [
|
||||
"API-v2"
|
||||
],
|
||||
"summary": "(Partially) update a channel",
|
||||
"operationId": "api-channels-update",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "UserID",
|
||||
"name": "uid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "ChannelID",
|
||||
"name": "cid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Send `true` to create a new subscribe_key",
|
||||
"name": "subscribe_key",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Send `true` to create a new send_key",
|
||||
"name": "send_key",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Change the cahnnel display-name (only chnages to lowercase/uppercase are allowed - internal_name must stay the same)",
|
||||
"name": "display_name",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ChannelWithSubscription"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "supplied values/parameters cannot be parsed / are invalid",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "user is not authorized / has missing permissions",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "channel not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/users/{uid}/channels/{cid}/messages": {
|
||||
@@ -2122,11 +2201,12 @@
|
||||
},
|
||||
"/api/v2/users/{uid}/keys": {
|
||||
"get": {
|
||||
"description": "The request must be done with an ADMIN key, the returned keys are without their token.",
|
||||
"tags": [
|
||||
"API-v2"
|
||||
],
|
||||
"summary": "List sender-names (of allthe messages of this user)",
|
||||
"operationId": "api-usersendernames-list",
|
||||
"summary": "List keys of the user",
|
||||
"operationId": "api-tokenkeys-list",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@@ -2461,6 +2541,56 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/users/{uid}/sender-names": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"API-v2"
|
||||
],
|
||||
"summary": "List sender-names (of allthe messages of this user)",
|
||||
"operationId": "api-usersendernames-list",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "UserID",
|
||||
"name": "uid",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handler.ListUserKeys.response"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "supplied values/parameters cannot be parsed / are invalid",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "user is not authorized / has missing permissions",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "message not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ginresp.apiError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v2/users/{uid}/subscriptions": {
|
||||
"get": {
|
||||
"description": "The possible values for 'direction' are:\n- \"outgoing\" Subscriptions with the user as subscriber (= subscriptions he can use to read channels)\n- \"incoming\" Subscriptions to channels of this user (= incoming subscriptions and subscription requests)\n- \"both\" Combines \"outgoing\" and \"incoming\" (default)\n\nThe possible values for 'confirmation' are:\n- \"confirmed\" Confirmed (active) subscriptions\n- \"unconfirmed\" Unconfirmed (pending) subscriptions\n- \"all\" Combines \"confirmed\" and \"unconfirmed\" (default)\n\nThe possible values for 'external' are:\n- \"true\" Subscriptions with subscriber_user_id != channel_owner_user_id (subscriptions from other users)\n- \"false\" Subscriptions with subscriber_user_id == channel_owner_user_id (subscriptions from this user to his own channels)\n- \"all\" Combines \"external\" and \"internal\" (default)\n\nThe `subscriber_user_id` parameter can be used to additionally filter the subscriber_user_id (return subscribtions from a specific user)\n\nThe `channel_owner_user_id` parameter can be used to additionally filter the channel_owner_user_id (return subscribtions to a specific user)",
|
||||
|
||||
@@ -1954,6 +1954,43 @@ paths:
|
||||
tags:
|
||||
- API-v2
|
||||
/api/v2/users/{uid}/channels/{cid}:
|
||||
delete:
|
||||
operationId: api-channels-delete
|
||||
parameters:
|
||||
- description: UserID
|
||||
in: path
|
||||
name: uid
|
||||
required: true
|
||||
type: string
|
||||
- description: ChannelID
|
||||
in: path
|
||||
name: cid
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Channel'
|
||||
"400":
|
||||
description: supplied values/parameters cannot be parsed / are invalid
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"401":
|
||||
description: user is not authorized / has missing permissions
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"404":
|
||||
description: channel not found
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"500":
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
summary: delete a channel (including all messages, subscriptions, etc)
|
||||
tags:
|
||||
- API-v2
|
||||
get:
|
||||
operationId: api-channels-get
|
||||
parameters:
|
||||
@@ -1992,7 +2029,7 @@ paths:
|
||||
tags:
|
||||
- API-v2
|
||||
patch:
|
||||
operationId: api-channels-delete
|
||||
operationId: api-channels-update
|
||||
parameters:
|
||||
- description: UserID
|
||||
in: path
|
||||
@@ -2004,11 +2041,27 @@ paths:
|
||||
name: cid
|
||||
required: true
|
||||
type: string
|
||||
- description: Send `true` to create a new subscribe_key
|
||||
in: body
|
||||
name: subscribe_key
|
||||
schema:
|
||||
type: string
|
||||
- description: Send `true` to create a new send_key
|
||||
in: body
|
||||
name: send_key
|
||||
schema:
|
||||
type: string
|
||||
- description: Change the cahnnel display-name (only chnages to lowercase/uppercase
|
||||
are allowed - internal_name must stay the same)
|
||||
in: body
|
||||
name: display_name
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Channel'
|
||||
$ref: '#/definitions/models.ChannelWithSubscription'
|
||||
"400":
|
||||
description: supplied values/parameters cannot be parsed / are invalid
|
||||
schema:
|
||||
@@ -2025,7 +2078,7 @@ paths:
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
summary: delete a channel (including all messages, subscriptions, etc)
|
||||
summary: (Partially) update a channel
|
||||
tags:
|
||||
- API-v2
|
||||
/api/v2/users/{uid}/channels/{cid}/messages:
|
||||
@@ -2305,7 +2358,9 @@ paths:
|
||||
- API-v2
|
||||
/api/v2/users/{uid}/keys:
|
||||
get:
|
||||
operationId: api-usersendernames-list
|
||||
description: The request must be done with an ADMIN key, the returned keys are
|
||||
without their token.
|
||||
operationId: api-tokenkeys-list
|
||||
parameters:
|
||||
- description: UserID
|
||||
in: path
|
||||
@@ -2333,7 +2388,7 @@ paths:
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
summary: List sender-names (of allthe messages of this user)
|
||||
summary: List keys of the user
|
||||
tags:
|
||||
- API-v2
|
||||
post:
|
||||
@@ -2533,6 +2588,39 @@ paths:
|
||||
summary: Get the key currently used by this request
|
||||
tags:
|
||||
- API-v2
|
||||
/api/v2/users/{uid}/sender-names:
|
||||
get:
|
||||
operationId: api-usersendernames-list
|
||||
parameters:
|
||||
- description: UserID
|
||||
in: path
|
||||
name: uid
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/handler.ListUserKeys.response'
|
||||
"400":
|
||||
description: supplied values/parameters cannot be parsed / are invalid
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"401":
|
||||
description: user is not authorized / has missing permissions
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"404":
|
||||
description: message not found
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
"500":
|
||||
description: internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ginresp.apiError'
|
||||
summary: List sender-names (of allthe messages of this user)
|
||||
tags:
|
||||
- API-v2
|
||||
/api/v2/users/{uid}/subscriptions:
|
||||
get:
|
||||
description: |-
|
||||
|
||||
BIN
store/appicon_2.0.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
store/appicon_2.0_512x.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 77 KiB |
BIN
store/screenshot_4.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
store/screenshot_old_1.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
store/screenshot_old_2.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
store/screenshot_old_3.png
Normal file
|
After Width: | Height: | Size: 55 KiB |