Skip to content

Commit

Permalink
add acount deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
maheshj01 committed Jan 3, 2024
1 parent b441d47 commit 0ef2e7d
Show file tree
Hide file tree
Showing 19 changed files with 633 additions and 415 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ doc/api/
.buildlog/
.history
.svn/
.env

# IntelliJ related
*.iml
Expand Down
18 changes: 18 additions & 0 deletions ios/Flutter/Flutter.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# This podspec is NOT to be published. It is only used as a local source!
# This is a generated file; do not edit or check into version control.
#

Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'A UI toolkit for beautiful and fast apps.'
s.homepage = 'https://flutter.dev'
s.license = { :type => 'BSD' }
s.author = { 'Flutter Dev Team' => '[email protected]' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '11.0'
# Framework linking is handled by Flutter tooling, not CocoaPods.
# Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
s.vendored_frameworks = 'path/to/nothing'
end
11 changes: 5 additions & 6 deletions lib/base_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import 'package:url_launcher/url_launcher.dart';
import 'package:vocabhub/constants/constants.dart';
import 'package:vocabhub/models/user.dart';
import 'package:vocabhub/navbar/navbar.dart';
import 'package:vocabhub/navbar/profile/about.dart';
import 'package:vocabhub/navbar/profile/settings.dart';
import 'package:vocabhub/navbar/profile/edit.dart';
import 'package:vocabhub/navbar/search/search_view.dart';
import 'package:vocabhub/pages/addword.dart';
import 'package:vocabhub/pages/login.dart';
Expand Down Expand Up @@ -117,7 +116,7 @@ class _AdaptiveLayoutState extends ConsumerState<AdaptiveLayout> {
WidgetsBinding.instance.addPostFrameCallback((_) {
NavbarNotifier.showSnackBar(context, message,
actionLabel: action,
bottom: kNavbarHeight * 1.2,
bottom: 50,
onActionPressed: onActionPressed,
duration: persist ? Duration(days: 1) : Duration(seconds: 3), onClosed: () {
if (mounted) {
Expand Down Expand Up @@ -170,9 +169,8 @@ class _AdaptiveLayoutState extends ConsumerState<AdaptiveLayout> {
if (user!.isLoggedIn) {
_routes.addAll({
3: {
UserProfile.route: UserProfile(),
SettingsPage.route: SettingsPage(),
AboutVocabhub.route: AboutVocabhub(),
UserProfileNavigator.route: UserProfileNavigator(),
EditProfile.route: EditProfile(),
}
});
if (items.length < 4) {
Expand Down Expand Up @@ -244,6 +242,7 @@ class _AdaptiveLayoutState extends ConsumerState<AdaptiveLayout> {
return isExiting;
}
},
shouldPopToBaseRoute: true,
isDesktop: !SizeUtils.isMobile,
// destinationAnimationCurve: Curves.fastOutSlowIn,
destinationAnimationDuration: SizeUtils.isDesktop ? 0 : 0,
Expand Down
2 changes: 2 additions & 0 deletions lib/constants/const.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ class Constants {
static const NOTE_COLUMN = 'notes';
static const STATE_COLUMN = 'state';
static const CREATED_AT_COLUMN = 'created_at';
static const UPDATED_AT_COLUMN = 'updated_at';

/// USER TABLE COLUMNS
static const USERID_COLUMN = 'id';
static const USER_NAME_COLUMN = 'name';
static const USER_EMAIL_COLUMN = 'email';
static const USERNAME_COLUMN = 'username';
static const DELETED_COLUMN = 'deleted';
static const USER_BOOKMARKS_COLUMN = 'bookmarks';
static const USER_CREATED_AT_COLUMN = 'created_at';
static const USER_LOGGEDIN_COLUMN = 'isLoggedIn';
Expand Down
10 changes: 10 additions & 0 deletions lib/constants/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,13 @@ String onDeviceCollectionsString =

String onDeviceCollectionsString2 =
"Note The collections are retained on your device and will not be synced.";

String userNameConstraints =
'Username should contain letters, numbers and underscores with minimum 3 characters';

String accountDeleted = 'This account is deleted. Please contact support at';

String registration_Failed = 'failed to register new user';

String accountActivationEmail =
'mailto:${Constants.FEEDBACK_EMAIL_TO}?subject=Sign In Failure&body=Hi, I am facing issues while signing in. Please help me out.';
11 changes: 7 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import 'package:vocabhub/controller/auth_controller.dart';
import 'package:vocabhub/controller/collections_controller.dart';
import 'package:vocabhub/controller/controllers.dart';
import 'package:vocabhub/models/user.dart';
import 'package:vocabhub/navbar/profile/about.dart';
import 'package:vocabhub/navbar/profile/report.dart';
import 'package:vocabhub/navbar/profile/settings.dart';
import 'package:vocabhub/navbar/profile/webview.dart';
import 'package:vocabhub/pages/notifications/notifications.dart';
import 'package:vocabhub/pages/splashscreen.dart';
Expand All @@ -40,10 +43,7 @@ final appProvider =
showFAB: true,
hasUpdate: false,
)));
// final appThemeProvider = StateNotifierProvider<VocabThemeNotifier, VocabThemeController>(
// (ref) => VocabThemeNotifier(ref));

// same as above comment
final appThemeProvider =
StateNotifierProvider<VocabThemeNotifier, VocabThemeController>(VocabThemeNotifier.new);

Expand Down Expand Up @@ -166,7 +166,6 @@ class _VocabAppState extends ConsumerState<VocabApp> {
dashboardController.disposeService();
exploreController.disposeService();
// pushNotificationService.disposeService();

super.dispose();
}

Expand Down Expand Up @@ -217,6 +216,10 @@ class _VocabAppState extends ConsumerState<VocabApp> {
title: Constants.PRIVACY_POLICY_TITLE,
url: Constants.PRIVACY_POLICY,
),
ReportABug.route: (context) => ReportABug(),
AboutVocabhub.route: (context) => AboutVocabhub(),
SettingsPage.route: (context) => SettingsPage(),
ViewBugReports.route: (context) => ViewBugReports(),
},
themeMode: appThemeController.isDark ? ThemeMode.dark : ThemeMode.light,
home: SplashScreen(),
Expand Down
18 changes: 18 additions & 0 deletions lib/models/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class UserModel extends ChangeNotifier {
String username;
// push notification token
String token;
bool isDeleted;
DateTime? created_at;
DateTime? updated_at;

UserModel({
this.name = '',
Expand All @@ -29,6 +31,8 @@ class UserModel extends ChangeNotifier {
this.token = '',
this.username = '',
this.created_at,
this.updated_at,
this.isDeleted = false,
this.isLoggedIn = false,
});

Expand All @@ -45,7 +49,9 @@ class UserModel extends ChangeNotifier {
isAdmin: w.isAdmin,
username: w.username,
token: w.token,
isDeleted: w.isDeleted,
created_at: w.created_at,
updated_at: w.updated_at,
isLoggedIn: w.isLoggedIn,
);
}
Expand All @@ -61,6 +67,8 @@ class UserModel extends ChangeNotifier {
String? username,
String? token,
DateTime? created_at,
DateTime? updated_at,
bool? isDeleted,
List<Word>? bookmarks,
}) {
return UserModel(
Expand All @@ -72,7 +80,9 @@ class UserModel extends ChangeNotifier {
isAdmin: isAdmin ?? this.isAdmin,
username: username ?? this.username,
token: token ?? this.token,
isDeleted: isDeleted ?? this.isDeleted,
created_at: created_at ?? this.created_at,
updated_at: updated_at ?? this.updated_at,
isLoggedIn: isLoggedIn ?? this.isLoggedIn,
);
}
Expand All @@ -85,9 +95,11 @@ class UserModel extends ChangeNotifier {
idToken: '',
accessToken: '',
created_at: DateTime.now(),
updated_at: DateTime.now(),
username: '',
token: '',
isAdmin: false,
isDeleted: false,
isLoggedIn: false);
}

Expand Down Expand Up @@ -132,6 +144,11 @@ class UserModel extends ChangeNotifier {
notifyListeners();
}

set setIsDeleted(bool m) {
isDeleted = m;
notifyListeners();
}

UserModel get user => this;

// updates local state and also stores in local storage
Expand All @@ -146,6 +163,7 @@ class UserModel extends ChangeNotifier {
this.token = user.token;
this.created_at = user.created_at;
this.isLoggedIn = user.isLoggedIn;
this.isDeleted = user.isDeleted;
authController.setUser(this);
notifyListeners();
}
Expand Down
12 changes: 7 additions & 5 deletions lib/models/user.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0ef2e7d

Please sign in to comment.