-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1431 from atsign-foundation/npt-flutter-onboardin…
…g-utils feat: npt flutter onboarding utils
- Loading branch information
Showing
18 changed files
with
325 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
packages/dart/npt_flutter/lib/features/onboarding/cubit/at_directory_cubit.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:npt_flutter/features/logging/models/loggable.dart'; | ||
import 'package:npt_flutter/features/logging/models/logging_bloc.dart'; | ||
|
||
class AtDirectoryCubit extends Cubit<String> { | ||
AtDirectoryCubit() : super('root.atsign.org'); | ||
class AtDirectoryCubit extends LoggingCubit<LoggableString> { | ||
AtDirectoryCubit() : super(const LoggableString('root.atsign.org')); | ||
|
||
void setRootDomain(String rootDomain) => emit(rootDomain); | ||
void setRootDomain(String rootDomain) => emit(LoggableString(rootDomain)); | ||
String getRootDomain() => (state.string); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletion
15
packages/dart/npt_flutter/lib/features/onboarding/util/pre_offboard.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:npt_flutter/app.dart'; | ||
import 'package:npt_flutter/features/features.dart'; | ||
|
||
// Hand this method the atSign you wish to offboard | ||
// Returns: a boolean, true = success, false = failed | ||
Future<bool> preSignout(String atSign) async { | ||
App.log("Resetting all application state before signout".loggable); | ||
// We need to do the following before "signing out" | ||
// - Wipe all application state | ||
// - Remove the tray icon | ||
App.navState.currentContext?.read<ProfilesRunningCubit>().stopAllAndClear(); | ||
App.navState.currentContext?.read<ProfileCacheCubit>().clear(); | ||
App.navState.currentContext?.read<ProfilesSelectedCubit>().deselectAll(); | ||
App.navState.currentContext?.read<FavoriteBloc>().clearAll(); | ||
App.navState.currentContext?.read<ProfileListBloc>().clearAll(); | ||
App.navState.currentContext?.read<SettingsBloc>().clear(); | ||
App.navState.currentContext?.read<OnboardingCubit>().offboard(); | ||
// - Reset the tray icon | ||
App.navState.currentContext?.read<TrayCubit>().initialize(); | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.