Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/598 #108

Merged
merged 2 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:at_client_mobile/at_client_mobile.dart';
import 'package:at_contacts_group_flutter/screens/group_contact_view/group_contact_view.dart';
import 'package:at_contacts_group_flutter/services/group_service.dart';
import 'package:atsign_atmosphere_pro/dekstop_services/desktop_image_picker.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/custom_toast.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/triple_dot_loading.dart';
Expand Down Expand Up @@ -201,6 +202,13 @@ class _WelcomeScreenHomeState extends State<WelcomeScreenHome> {
showContacts: true,
isDesktop: true,
contactSelectedHistory: _welcomeScreenProvider.selectedContacts,
onContactsTap: (_list) {
Provider.of<WelcomeScreenProvider>(
NavService.navKey.currentContext!,
listen: false)
.updateSelectedContacts(_list, notifyListeners: false);
_welcomeScreenProvider.isSelectionItemChanged = true;
},
selectedList: (_list) {
Provider.of<WelcomeScreenProvider>(
NavService.navKey.currentContext!,
Expand Down Expand Up @@ -303,6 +311,8 @@ class _WelcomeScreenHomeState extends State<WelcomeScreenHome> {
} else {
var file = await desktopImagePicker();
if (file != null) {
GroupService().selectedGroupContacts = [];
GroupService().selectedContactsSink.add([]);
_filePickerProvider.selectedFiles = file;
_welcomeScreenProvider.isSelectionItemChanged = true;
_currentScreen = CurrentScreen.SelectedItems;
Expand Down
10 changes: 7 additions & 3 deletions lib/screens/common_widgets/error_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ class _ErrorScreenState extends State<ErrorScreen> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(ImageConstants.emptyGroup),
Text(
widget.title,
style: CustomTextStyles.greyText16,
Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
widget.title,
style: CustomTextStyles.greyText16,
textAlign: TextAlign.center,
),
),
],
),
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/welcome_screen/welcome_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:atsign_atmosphere_pro/view_models/welcome_screen_view_model.dart
import 'package:flutter/material.dart';
import 'package:new_version/new_version.dart';
import 'package:provider/provider.dart';
import '../../utils/text_strings.dart';
import '../common_widgets/side_bar.dart';
import '../../view_models/file_transfer_provider.dart';
import 'package:http/http.dart' as http;
Expand Down Expand Up @@ -168,7 +169,7 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
return _bottomSheetWidgetOptions[_selectedBottomNavigationIndex];
} else {
return ErrorScreen(
'You are not connected to internet.',
TextStrings.noInternet,
);
}
}),
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/text_strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ class TextStrings {
'Please select at least one @sign to reset';
static const String resetWarningText =
'Warning: This action cannot be undone!';

static const String noInternet =
'Offline. Please check your internet connection and try again.';
static const uploaded = 'Uploaded';
static const reUploadFileMsg = 'Do you want to re-upload file ?';
static const uploadFile = 'Please upload file first.';
Expand Down
15 changes: 11 additions & 4 deletions lib/view_models/welcome_screen_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ class WelcomeScreenProvider extends BaseModel {
}
}

updateSelectedContacts(List<GroupContactsModel?> updatedList) {
updateSelectedContacts(List<GroupContactsModel?> updatedList,
{bool notifyListeners = true}) {
try {
groupName = null;
selectedContacts = [];
setStatus(updateContacts, Status.Loading);
if (notifyListeners) {
setStatus(updateContacts, Status.Loading);
}

for (var _obj in updatedList) {
if (_obj?.contact != null) {
Expand All @@ -51,9 +54,13 @@ class WelcomeScreenProvider extends BaseModel {

hasSelectedContactsChanged = true;
scrollToBottom = true; // to scroll welcome screen to the bottom
setStatus(updateContacts, Status.Done);
if (notifyListeners) {
setStatus(updateContacts, Status.Done);
}
} catch (error) {
setError(updateContacts, error.toString());
if (notifyListeners) {
setError(updateContacts, error.toString());
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dependency_overrides:
at_contacts_flutter:
git:
url: [email protected]:atsign-foundation/at_widgets.git
ref: fix/missing-fontweight
ref: feat/598
path: at_contacts_flutter
at_common_flutter:
git:
Expand All @@ -99,7 +99,7 @@ dependency_overrides:
at_contacts_group_flutter:
git:
url: [email protected]:atsign-foundation/at_widgets.git
ref: fix/missing-fontweight
ref: feat/598
path: at_contacts_group_flutter

dev_dependencies:
Expand Down