mirror of
https://gitlab.com/mysocialportal/relatica
synced 2024-10-18 10:03:31 +00:00
Merge branch 'main' into focus-mode
This commit is contained in:
commit
9b79e19bac
30 changed files with 339 additions and 329 deletions
|
@ -1,5 +1,4 @@
|
|||
import 'package:color_blindness/color_blindness.dart';
|
||||
import 'package:color_blindness/color_blindness_color_scheme.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ class _VideoPlayerLibAvControlState extends State<VideoPlayerLibAvControl> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
videoPlayerController = VideoPlayerController.network(widget.videoUrl);
|
||||
videoPlayerController =
|
||||
VideoPlayerController.networkUrl(Uri.parse(widget.videoUrl));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -70,7 +71,7 @@ class _VideoPlayerLibAvControlState extends State<VideoPlayerLibAvControl> {
|
|||
videoWidth = scaling * size.width;
|
||||
videoHeight = scaling * size.height;
|
||||
}
|
||||
print('Video Width: $videoWidth, Video Height: $videoHeight');
|
||||
|
||||
return GestureDetector(
|
||||
onTap: toggleVideoPlay,
|
||||
child: Column(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../models/connection.dart';
|
||||
|
@ -9,8 +8,6 @@ import '../../utils/active_profile_selector.dart';
|
|||
import '../image_control.dart';
|
||||
|
||||
class MentionAutocompleteOptions extends StatelessWidget {
|
||||
static final _logger = Logger('$MentionAutocompleteOptions');
|
||||
|
||||
const MentionAutocompleteOptions({
|
||||
super.key,
|
||||
required this.id,
|
||||
|
|
|
@ -38,11 +38,15 @@ class NotificationControl extends StatelessWidget {
|
|||
}
|
||||
final loadedPost = await manager.refreshStatusChain(notification.iid);
|
||||
if (loadedPost.isSuccess) {
|
||||
context.push('/post/view/${loadedPost.value.id}/${notification.iid}');
|
||||
if (context.mounted) {
|
||||
context.push('/post/view/${loadedPost.value.id}/${notification.iid}');
|
||||
}
|
||||
return;
|
||||
}
|
||||
buildSnackbar(
|
||||
context, 'Error getting data for notification: ${loadedPost.error}');
|
||||
if (context.mounted) {
|
||||
buildSnackbar(
|
||||
context, 'Error getting data for notification: ${loadedPost.error}');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'package:relatica/controls/padding.dart';
|
|||
import 'package:relatica/globals.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
|
||||
import '../../models/TimelineIdentifiers.dart';
|
||||
import '../../models/timeline_identifiers.dart';
|
||||
import '../../services/network_status_service.dart';
|
||||
import '../../services/setting_service.dart';
|
||||
import '../../services/timeline_manager.dart';
|
||||
|
|
|
@ -8,7 +8,6 @@ import 'package:result_monad/result_monad.dart';
|
|||
|
||||
import '../friendica_client/paged_response.dart';
|
||||
import '../globals.dart';
|
||||
import '../models/TimelineIdentifiers.dart';
|
||||
import '../models/auth/profile.dart';
|
||||
import '../models/circle_data.dart';
|
||||
import '../models/connection.dart';
|
||||
|
@ -22,6 +21,7 @@ import '../models/media_attachment_uploads/image_types_enum.dart';
|
|||
import '../models/search_results.dart';
|
||||
import '../models/search_types.dart';
|
||||
import '../models/timeline_entry.dart';
|
||||
import '../models/timeline_identifiers.dart';
|
||||
import '../models/user_notification.dart';
|
||||
import '../models/visibility.dart';
|
||||
import '../serializers/friendica/direct_message_friendica_extensions.dart';
|
||||
|
|
|
@ -39,7 +39,6 @@ void main() async {
|
|||
getIt.registerSingleton<LogService>(logService);
|
||||
|
||||
// await dotenv.load(fileName: '.env');
|
||||
const enablePreview = false;
|
||||
Logger.root.level = Level.OFF;
|
||||
Logger.root.onRecord.listen((event) {
|
||||
logService.add(event);
|
||||
|
@ -105,7 +104,6 @@ class _AppState extends fr.ConsumerState<App> {
|
|||
return AnimatedBuilder(
|
||||
builder: (context, child) {
|
||||
Logger.root.level = settingsService.logLevel;
|
||||
print('Log level: ${settingsService.logLevel}');
|
||||
return Portal(
|
||||
child: MultiProvider(
|
||||
providers: [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:result_monad/src/result_monad_base.dart';
|
||||
import 'package:result_monad/result_monad.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import '../exec_error.dart';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'TimelineIdentifiers.dart';
|
||||
import 'entry_tree_item.dart';
|
||||
import 'timeline_identifiers.dart';
|
||||
|
||||
const defaultLowestId = 9223372036854775807;
|
||||
const defaultHighestId = 0;
|
||||
|
|
|
@ -54,7 +54,9 @@ class _CircleAddUsersScreenState extends State<CircleAddUsersScreen> {
|
|||
onSuccess: (_) => 'Added $messageBase',
|
||||
onError: (error) => 'Error adding $messageBase: $error',
|
||||
);
|
||||
buildSnackbar(context, message);
|
||||
if (mounted) {
|
||||
buildSnackbar(context, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,9 @@ class _CircleEditorScreenState extends State<CircleEditorScreen> {
|
|||
onSuccess: (_) => 'Removed $messageBase',
|
||||
onError: (error) => 'Error removing $messageBase: $error',
|
||||
);
|
||||
buildSnackbar(context, message);
|
||||
if (mounted) {
|
||||
buildSnackbar(context, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ class _EditorScreenState extends State<EditorScreen> {
|
|||
return;
|
||||
}
|
||||
|
||||
if (mounted && context.canPop()) {
|
||||
if (context.mounted && context.canPop()) {
|
||||
context.pop();
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ class _EditorScreenState extends State<EditorScreen> {
|
|||
return;
|
||||
}
|
||||
|
||||
if (mounted && context.canPop()) {
|
||||
if (context.mounted && context.canPop()) {
|
||||
context.pop();
|
||||
}
|
||||
}
|
||||
|
@ -254,51 +254,49 @@ class _EditorScreenState extends State<EditorScreen> {
|
|||
} else {
|
||||
final mainBody = Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (isComment && parentEntry != null)
|
||||
buildCommentPreview(context, parentEntry!),
|
||||
TextFormField(
|
||||
readOnly: isSubmitting,
|
||||
enabled: !isSubmitting && canSpoilerText,
|
||||
controller: spoilerController,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
decoration: InputDecoration(
|
||||
labelText: canSpoilerText
|
||||
? '$statusType Spoiler Text (optional)'
|
||||
: 'Your server doesnt support $statusType Spoiler Text',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: const BorderSide(),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (isComment && parentEntry != null)
|
||||
buildCommentPreview(context, parentEntry!),
|
||||
TextFormField(
|
||||
readOnly: isSubmitting,
|
||||
enabled: !isSubmitting && canSpoilerText,
|
||||
controller: spoilerController,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
decoration: InputDecoration(
|
||||
labelText: canSpoilerText
|
||||
? '$statusType Spoiler Text (optional)'
|
||||
: 'Your server doesnt support $statusType Spoiler Text',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: const BorderSide(),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
buildVisibilitySelector(context),
|
||||
const VerticalPadding(),
|
||||
buildContentField(context),
|
||||
CharacterCountWidget(
|
||||
contentController: contentController,
|
||||
linkPreviewController: linkPreviewController,
|
||||
),
|
||||
const VerticalPadding(),
|
||||
buildLinkWithPreview(context),
|
||||
const VerticalPadding(),
|
||||
GallerySelectorControl(
|
||||
entries: existingMediaItems,
|
||||
visibilityFilter: visibility,
|
||||
),
|
||||
const VerticalPadding(),
|
||||
MediaUploadsControl(
|
||||
entryMediaItems: newMediaItems,
|
||||
),
|
||||
buildButtonBar(context, manager),
|
||||
],
|
||||
),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
buildVisibilitySelector(context),
|
||||
const VerticalPadding(),
|
||||
buildContentField(context),
|
||||
CharacterCountWidget(
|
||||
contentController: contentController,
|
||||
linkPreviewController: linkPreviewController,
|
||||
),
|
||||
const VerticalPadding(),
|
||||
buildLinkWithPreview(context),
|
||||
const VerticalPadding(),
|
||||
GallerySelectorControl(
|
||||
entries: existingMediaItems,
|
||||
visibilityFilter: visibility,
|
||||
),
|
||||
const VerticalPadding(),
|
||||
MediaUploadsControl(
|
||||
entryMediaItems: newMediaItems,
|
||||
),
|
||||
buildButtonBar(context, manager),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -133,10 +133,12 @@ class _FilterEditorScreenState extends State<FilterEditorScreen> {
|
|||
}
|
||||
|
||||
if (filteredAuthors.contains(newConnection)) {
|
||||
buildSnackbar(
|
||||
context,
|
||||
'Already filtering on ${newConnection.handle}',
|
||||
);
|
||||
if (context.mounted) {
|
||||
buildSnackbar(
|
||||
context,
|
||||
'Already filtering on ${newConnection.handle}',
|
||||
);
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
filteredAuthors.add(newConnection);
|
||||
|
|
|
@ -13,7 +13,7 @@ import '../controls/responsive_max_width.dart';
|
|||
import '../controls/standard_app_drawer.dart';
|
||||
import '../controls/timeline/timeline_panel.dart';
|
||||
import '../globals.dart';
|
||||
import '../models/TimelineIdentifiers.dart';
|
||||
import '../models/timeline_identifiers.dart';
|
||||
import '../services/auth_service.dart';
|
||||
import '../services/network_status_service.dart';
|
||||
import '../services/timeline_manager.dart';
|
||||
|
|
|
@ -106,7 +106,7 @@ class _ImageEditorScreenState extends State<ImageEditorScreen> {
|
|||
context,
|
||||
'Cancel changes?',
|
||||
);
|
||||
if (ok == true && mounted) {
|
||||
if (ok == true && context.mounted) {
|
||||
context.pop();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -67,7 +67,7 @@ class _MediaViewerScreenState extends State<MediaViewerScreen> {
|
|||
final bytesResult =
|
||||
await RemoteFileClient(getIt<AccountsService>().currentProfile)
|
||||
.getFileBytes(attachment.uri);
|
||||
if (bytesResult.isFailure && mounted) {
|
||||
if (bytesResult.isFailure && context.mounted) {
|
||||
buildSnackbar(context,
|
||||
'Error getting full size version of file: ${bytesResult.error}');
|
||||
return;
|
||||
|
@ -75,10 +75,13 @@ class _MediaViewerScreenState extends State<MediaViewerScreen> {
|
|||
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
final saveResult = await ImageGallerySaver.saveImage(bytesResult.value);
|
||||
if (saveResult['isSuccess']) {
|
||||
buildSnackbar(context, 'Image saved to gallery');
|
||||
} else {
|
||||
buildSnackbar(context, 'Unable to save to gallery, check permissions');
|
||||
if (context.mounted) {
|
||||
if (saveResult['isSuccess']) {
|
||||
buildSnackbar(context, 'Image saved to gallery');
|
||||
} else {
|
||||
buildSnackbar(
|
||||
context, 'Unable to save to gallery, check permissions');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final location = await FilePicker.platform.saveFile(
|
||||
|
|
|
@ -168,7 +168,9 @@ class NotificationsScreen extends StatelessWidget {
|
|||
final message = (await manager.markAllAsRead()).fold(
|
||||
onSuccess: (_) => 'Marked all notifications as read',
|
||||
onError: (error) => 'Error marking notifications: $error');
|
||||
buildSnackbar(context, message);
|
||||
if (context.mounted) {
|
||||
buildSnackbar(context, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,13 +62,11 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||
}
|
||||
|
||||
Future<void> updateSearchResults(Profile profile, {bool reset = true}) async {
|
||||
print('Starting update');
|
||||
if (reset) {
|
||||
nextPage = PagingData(limit: limit);
|
||||
searchResult = SearchResults.empty();
|
||||
}
|
||||
|
||||
print('Search $searchType on ${searchTextController.text}');
|
||||
final result = await SearchClient(profile)
|
||||
.search(searchType, searchTextController.text, nextPage);
|
||||
result.match(
|
||||
|
@ -80,12 +78,9 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||
onError: (error) =>
|
||||
buildSnackbar(context, 'Error getting search result: $error'),
|
||||
);
|
||||
|
||||
print('Ending update');
|
||||
}
|
||||
|
||||
clearSearchResults() {
|
||||
print('Clearing results');
|
||||
setState(() {
|
||||
searchResult = SearchResults.empty();
|
||||
searchTextController.text = '';
|
||||
|
@ -329,7 +324,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||
await cm.fullRefresh(connection);
|
||||
}
|
||||
});
|
||||
if (context.mounted) {
|
||||
if (mounted) {
|
||||
context.pushNamed(ScreenPaths.userProfile,
|
||||
pathParameters: {'id': connection.id});
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ class NetworkCapabilitiesWidget extends StatelessWidget {
|
|||
}
|
||||
|
||||
return ListTile(
|
||||
title: Row(
|
||||
title: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Network Capabilities'),
|
||||
|
@ -230,7 +230,7 @@ class NetworkCapabilitiesWidget extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
subtitle: DataTable(
|
||||
columns: [
|
||||
columns: const [
|
||||
DataColumn(label: Text('Network')),
|
||||
DataColumn(label: Text('React')),
|
||||
DataColumn(label: Text('Reshare')),
|
||||
|
|
|
@ -61,8 +61,7 @@ class _SignInScreenState extends State<SignInScreen> {
|
|||
void _updateSignInButtonStatus() {
|
||||
setState(() {
|
||||
signInButtonEnabled = switch (oauthType) {
|
||||
usernamePasswordType =>
|
||||
serverNameController.text.isNotEmpty &&
|
||||
usernamePasswordType => serverNameController.text.isNotEmpty &&
|
||||
usernameController.text.isNotEmpty &&
|
||||
passwordController.text.isNotEmpty,
|
||||
oauthType => serverNameController.text.isNotEmpty,
|
||||
|
@ -141,249 +140,258 @@ class _SignInScreenState extends State<SignInScreen> {
|
|||
child: Form(
|
||||
key: formKey,
|
||||
child: Center(
|
||||
child: ListView(
|
||||
children: [
|
||||
Center(
|
||||
child: DropdownButton<String>(
|
||||
value: authType,
|
||||
items: authTypes
|
||||
.map(
|
||||
(a) => DropdownMenuItem(value: a, child: Text(a)))
|
||||
.toList(),
|
||||
onChanged: existingAccount
|
||||
? null
|
||||
: (value) {
|
||||
if (existingAccount) {
|
||||
buildSnackbar(context,
|
||||
"Can't change the type on an existing account");
|
||||
return;
|
||||
}
|
||||
authType = value!;
|
||||
setState(() {});
|
||||
}),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
TextFormField(
|
||||
autocorrect: false,
|
||||
readOnly: existingAccount,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
controller: serverNameController,
|
||||
validator: (value) =>
|
||||
isFQDN(value ?? '') ? null : 'Not a valid server name',
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Server Name (friendica.example.com)',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme
|
||||
.of(context)
|
||||
.colorScheme
|
||||
.surface,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
labelText: 'Server Name',
|
||||
),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
if (!showUsernameAndPasswordFields) ...[
|
||||
Text(
|
||||
existingAccount
|
||||
? 'Configured to sign in as user ${existingProfile
|
||||
?.handle}'
|
||||
: 'Relatica will open the requested Friendica site in a web browser where you will be asked to authorize this client.',
|
||||
softWrap: true,
|
||||
child: AutofillGroup(
|
||||
child: ListView(
|
||||
children: [
|
||||
Center(
|
||||
child: DropdownButton<String>(
|
||||
value: authType,
|
||||
items: authTypes
|
||||
.map((a) =>
|
||||
DropdownMenuItem(value: a, child: Text(a)))
|
||||
.toList(),
|
||||
onChanged: existingAccount
|
||||
? null
|
||||
: (value) {
|
||||
if (existingAccount) {
|
||||
buildSnackbar(context,
|
||||
"Can't change the type on an existing account");
|
||||
return;
|
||||
}
|
||||
authType = value!;
|
||||
setState(() {});
|
||||
}),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
],
|
||||
if (showUsernameAndPasswordFields) ...[
|
||||
TextFormField(
|
||||
autocorrect: false,
|
||||
readOnly: existingAccount,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
controller: usernameController,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
validator: (value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
controller: serverNameController,
|
||||
validator: (value) =>
|
||||
isFQDN(value ?? '') ? null : 'Not a valid server name',
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Server Name (friendica.example.com)',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
labelText: 'Server Name',
|
||||
),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
if (!showUsernameAndPasswordFields) ...[
|
||||
Text(
|
||||
existingAccount
|
||||
? 'Configured to sign in as user ${existingProfile?.handle}'
|
||||
: 'Relatica will open the requested Friendica site in a web browser where you will be asked to authorize this client.',
|
||||
softWrap: true,
|
||||
),
|
||||
const VerticalPadding(),
|
||||
],
|
||||
if (showUsernameAndPasswordFields) ...[
|
||||
TextFormField(
|
||||
readOnly: existingAccount,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
autofillHints: const [AutofillHints.username],
|
||||
controller: usernameController,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
validator: (value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (value.contains('@')) {
|
||||
return isEmail(value)
|
||||
if (value.contains('@')) {
|
||||
final properFormat = isEmail(value);
|
||||
if (!properFormat) {
|
||||
return 'Not a valid Friendica Account Address';
|
||||
}
|
||||
final elements = value.split('@');
|
||||
if (elements.last != serverNameController.text) {
|
||||
return 'Server name must match above field.\nUsername should be the *Friendica* username.\nThis is not the email address of the account.';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return isAlphanumeric(value.replaceAll('-', ''))
|
||||
? null
|
||||
: 'Not a valid Friendica Account Address';
|
||||
}
|
||||
|
||||
return isAlphanumeric(value.replaceAll('-', ''))
|
||||
? null
|
||||
: 'Username should be alpha-numeric';
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.alternate_email),
|
||||
hintText: 'Username (user@example.com)',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme
|
||||
.of(context)
|
||||
.colorScheme
|
||||
.surface,
|
||||
: 'Username should be alpha-numeric';
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.alternate_email),
|
||||
hintText:
|
||||
'Your username on the server (not email address)',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
labelText: 'Username',
|
||||
),
|
||||
labelText: 'Username',
|
||||
),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
TextFormField(
|
||||
readOnly: existingAccount,
|
||||
obscureText: hidePassword,
|
||||
controller: passwordController,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Password field cannot be empty';
|
||||
}
|
||||
const VerticalPadding(),
|
||||
TextFormField(
|
||||
readOnly: existingAccount,
|
||||
obscureText: hidePassword,
|
||||
controller: passwordController,
|
||||
autofillHints: const [AutofillHints.password],
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Password field cannot be empty';
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.password),
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
hidePassword = !hidePassword;
|
||||
});
|
||||
},
|
||||
icon: hidePassword
|
||||
? const Icon(Icons.remove_red_eye_outlined)
|
||||
: const Icon(Icons.remove_red_eye),
|
||||
),
|
||||
hintText: 'Password',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme
|
||||
.of(context)
|
||||
.colorScheme
|
||||
.surface,
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.password),
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
hidePassword = !hidePassword;
|
||||
});
|
||||
},
|
||||
icon: hidePassword
|
||||
? const Icon(Icons.remove_red_eye_outlined)
|
||||
: const Icon(Icons.remove_red_eye),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
hintText: 'Password',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
labelText: 'Password',
|
||||
),
|
||||
labelText: 'Password',
|
||||
),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
],
|
||||
signInButtonEnabled
|
||||
? ElevatedButton(
|
||||
onPressed: () async => await _signIn(context),
|
||||
child: const Text('Signin'),
|
||||
)
|
||||
: const SizedBox(),
|
||||
const VerticalPadding(),
|
||||
Text(
|
||||
'Logged out:',
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
loggedOutProfiles.isEmpty
|
||||
? const Text(
|
||||
'No logged out profiles',
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
width: 0.5,
|
||||
)),
|
||||
child: Column(
|
||||
children: loggedOutProfiles.map((p) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
setCredentials(context, p);
|
||||
setState(() {});
|
||||
},
|
||||
title: Text(p.handle),
|
||||
subtitle: Text(p.credentials is BasicCredentials
|
||||
? usernamePasswordType
|
||||
: oauthType),
|
||||
trailing: ElevatedButton(
|
||||
onPressed: () async {
|
||||
final confirm = await showYesNoDialog(
|
||||
context,
|
||||
'Remove login information from app?');
|
||||
if (confirm ?? false) {
|
||||
await service.removeProfile(p);
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: const Text('Remove'),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
Text(
|
||||
'Logged in:',
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
loggedInProfiles.isEmpty
|
||||
? const Text(
|
||||
'No logged in profiles',
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
width: 0.5,
|
||||
)),
|
||||
child: Column(
|
||||
children: loggedInProfiles.map((p) {
|
||||
final active = service.loggedIn
|
||||
? p.id == service.currentProfile.id
|
||||
: false;
|
||||
return ListTile(
|
||||
onTap: () async {
|
||||
setCredentials(context, p);
|
||||
setState(() {});
|
||||
},
|
||||
title: Text(
|
||||
p.handle,
|
||||
style: active
|
||||
? const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontStyle: FontStyle.italic)
|
||||
: null,
|
||||
),
|
||||
subtitle: Text(
|
||||
p.credentials is BasicCredentials
|
||||
? usernamePasswordType
|
||||
: oauthType,
|
||||
style: active
|
||||
? const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontStyle: FontStyle.italic)
|
||||
: null,
|
||||
),
|
||||
trailing: ElevatedButton(
|
||||
onPressed: () async {
|
||||
final confirm = await showYesNoDialog(
|
||||
context, 'Log out account?');
|
||||
if (confirm == true) {
|
||||
await getIt<AccountsService>().signOut(p);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
child: const Text('Sign out'),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
final confirm = await showYesNoDialog(context,
|
||||
'Are you sure you want to logout and delete *all* accounts? This cannot be undone.') ??
|
||||
false;
|
||||
if (!confirm) {
|
||||
return;
|
||||
}
|
||||
|
||||
await getIt<AccountsService>().clearAllProfiles();
|
||||
},
|
||||
child: const Text('Clear All')),
|
||||
],
|
||||
signInButtonEnabled
|
||||
? ElevatedButton(
|
||||
onPressed: () async => await _signIn(context),
|
||||
child: const Text('Signin'),
|
||||
)
|
||||
: const SizedBox(),
|
||||
const VerticalPadding(),
|
||||
Text(
|
||||
'Logged out:',
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
.headlineSmall,
|
||||
),
|
||||
loggedOutProfiles.isEmpty
|
||||
? const Text(
|
||||
'No logged out profiles',
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
width: 0.5,
|
||||
)),
|
||||
child: Column(
|
||||
children: loggedOutProfiles.map((p) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
setCredentials(context, p);
|
||||
setState(() {});
|
||||
},
|
||||
title: Text(p.handle),
|
||||
subtitle: Text(p.credentials is BasicCredentials
|
||||
? usernamePasswordType
|
||||
: oauthType),
|
||||
trailing: ElevatedButton(
|
||||
onPressed: () async {
|
||||
final confirm = await showYesNoDialog(context,
|
||||
'Remove login information from app?');
|
||||
if (confirm ?? false) {
|
||||
await service.removeProfile(p);
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: const Text('Remove'),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
const VerticalPadding(),
|
||||
Text(
|
||||
'Logged in:',
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
.headlineSmall,
|
||||
),
|
||||
loggedInProfiles.isEmpty
|
||||
? const Text(
|
||||
'No logged in profiles',
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
width: 0.5,
|
||||
)),
|
||||
child: Column(
|
||||
children: loggedInProfiles.map((p) {
|
||||
final active = service.loggedIn
|
||||
? p.id == service.currentProfile.id
|
||||
: false;
|
||||
return ListTile(
|
||||
onTap: () async {
|
||||
setCredentials(context, p);
|
||||
setState(() {});
|
||||
},
|
||||
title: Text(
|
||||
p.handle,
|
||||
style: active
|
||||
? const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontStyle: FontStyle.italic)
|
||||
: null,
|
||||
),
|
||||
subtitle: Text(
|
||||
p.credentials is BasicCredentials
|
||||
? usernamePasswordType
|
||||
: oauthType,
|
||||
style: active
|
||||
? const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontStyle: FontStyle.italic)
|
||||
: null,
|
||||
),
|
||||
trailing: ElevatedButton(
|
||||
onPressed: () async {
|
||||
final confirm = await showYesNoDialog(
|
||||
context, 'Log out account?');
|
||||
if (confirm == true) {
|
||||
await getIt<AccountsService>().signOut(p);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
child: const Text('Sign out'),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -405,8 +413,9 @@ class _SignInScreenState extends State<SignInScreen> {
|
|||
} else {
|
||||
switch (authType) {
|
||||
case usernamePasswordType:
|
||||
final username = usernameController.text.split('@').first;
|
||||
creds = BasicCredentials(
|
||||
username: usernameController.text,
|
||||
username: username,
|
||||
password: passwordController.text,
|
||||
serverName: serverNameController.text);
|
||||
break;
|
||||
|
@ -428,16 +437,16 @@ class _SignInScreenState extends State<SignInScreen> {
|
|||
creds,
|
||||
withNotification: false,
|
||||
);
|
||||
if (mounted && result.isFailure) {
|
||||
if (context.mounted && result.isFailure) {
|
||||
buildSnackbar(context, 'Error signing in: ${result.error}');
|
||||
return;
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
if (context.mounted) {
|
||||
buildSnackbar(context, 'Account signed in...');
|
||||
}
|
||||
await getIt<AccountsService>().setActiveProfile(result.value);
|
||||
if (mounted) {
|
||||
if (context.mounted) {
|
||||
context.goNamed(ScreenPaths.timelines);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import '../controls/linear_status_indicator.dart';
|
|||
import '../controls/standard_appbar.dart';
|
||||
import '../controls/timeline/timeline_panel.dart';
|
||||
import '../globals.dart';
|
||||
import '../models/TimelineIdentifiers.dart';
|
||||
import '../models/timeline_identifiers.dart';
|
||||
import '../services/network_status_service.dart';
|
||||
import '../services/timeline_manager.dart';
|
||||
import '../utils/active_profile_selector.dart';
|
||||
|
|
|
@ -189,7 +189,7 @@ class _UserProfileScreenState extends State<UserProfileScreen> {
|
|||
} else {
|
||||
await manager.removeUserFromCircle(g, profile);
|
||||
}
|
||||
if (mounted) {
|
||||
if (context.mounted) {
|
||||
buildSnackbar(context, "User's Circles Updated");
|
||||
}
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
Result<List<CircleData>, ExecError> getCirclesForUser(String id) {
|
||||
final result = circlesRepo.getCirclesForUser(id);
|
||||
if (result.isSuccess) {
|
||||
print("Circles for user $id: $result");
|
||||
_logger.finer("Circles for user $id: $result");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@ import 'package:result_monad/result_monad.dart';
|
|||
import '../friendica_client/friendica_client.dart';
|
||||
import '../friendica_client/paging_data.dart';
|
||||
import '../globals.dart';
|
||||
import '../models/TimelineIdentifiers.dart';
|
||||
import '../models/auth/profile.dart';
|
||||
import '../models/entry_tree_item.dart';
|
||||
import '../models/exec_error.dart';
|
||||
import '../models/image_entry.dart';
|
||||
import '../models/media_attachment_uploads/new_entry_media_items.dart';
|
||||
import '../models/timeline_entry.dart';
|
||||
import '../models/timeline_identifiers.dart';
|
||||
import '../models/visibility.dart';
|
||||
import '../utils/active_profile_selector.dart';
|
||||
import 'media_upload_attachment_helper.dart';
|
||||
|
|
|
@ -80,8 +80,9 @@ class NotificationsManager extends ChangeNotifier {
|
|||
|
||||
first = false;
|
||||
result.match(
|
||||
onSuccess: (nd) => print('Got ${nd.data.length} notifications'),
|
||||
onError: (e) => debugPrint('Error getting notification: $e'));
|
||||
onSuccess: (nd) =>
|
||||
_logger.fine('Got ${nd.data.length} notifications'),
|
||||
onError: (e) => _logger.severe('Error getting notification: $e'));
|
||||
final response = result.getValueOrElse(() => PagedResponse([]));
|
||||
response.data
|
||||
.where((n) =>
|
||||
|
|
|
@ -4,7 +4,6 @@ import 'package:result_monad/result_monad.dart';
|
|||
|
||||
import '../data/interfaces/circles_repo_intf.dart';
|
||||
import '../friendica_client/friendica_client.dart';
|
||||
import '../models/TimelineIdentifiers.dart';
|
||||
import '../models/auth/profile.dart';
|
||||
import '../models/circle_data.dart';
|
||||
import '../models/entry_tree_item.dart';
|
||||
|
@ -13,6 +12,7 @@ import '../models/image_entry.dart';
|
|||
import '../models/media_attachment_uploads/new_entry_media_items.dart';
|
||||
import '../models/timeline.dart';
|
||||
import '../models/timeline_entry.dart';
|
||||
import '../models/timeline_identifiers.dart';
|
||||
import '../models/visibility.dart';
|
||||
import 'entry_manager_service.dart';
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ import '../models/entry_tree_item.dart';
|
|||
import '../models/flattened_tree_item.dart';
|
||||
|
||||
extension FlatteningExtensions on EntryTreeItem {
|
||||
static const BaseLevel = 0;
|
||||
static const baseLevel = 0;
|
||||
|
||||
List<FlattenedTreeItem> flatten(
|
||||
{int level = BaseLevel, bool topLevelOnly = false}) {
|
||||
{int level = baseLevel, bool topLevelOnly = false}) {
|
||||
final items = <FlattenedTreeItem>[];
|
||||
final myEntry = FlattenedTreeItem(
|
||||
timelineEntry: entry,
|
||||
|
@ -23,7 +23,7 @@ extension FlatteningExtensions on EntryTreeItem {
|
|||
c1.entry.creationTimestamp.compareTo(c2.entry.creationTimestamp));
|
||||
for (final child in sortedChildren) {
|
||||
int childLevel = level + 1;
|
||||
if (child.entry.authorId == entry.authorId && level != BaseLevel) {
|
||||
if (child.entry.authorId == entry.authorId && level != baseLevel) {
|
||||
childLevel = level;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,7 @@ void _updateSwapTagLinks(Node node, List<String> tags) {
|
|||
if (hasExpectedTag) {
|
||||
final profile = getIt<AccountsService>().currentProfile;
|
||||
final newTagUrl = generateTagUrlFromProfile(profile, tag);
|
||||
print(node.attributes['href']);
|
||||
node.attributes['href'] = newTagUrl.toString();
|
||||
print(node.attributes['href']);
|
||||
}
|
||||
}
|
||||
for (var n in node.nodes) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:collection/collection.dart' show MapEquality;
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:result_monad/result_monad.dart';
|
||||
|
@ -149,7 +149,6 @@ class _ExpiringRequestCache {
|
|||
response,
|
||||
);
|
||||
|
||||
print('Adding cached response for $type => $url');
|
||||
_responses[cacheEntry] = cacheEntry;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue