Skip to content

Commit

Permalink
Merge pull request AppFlowy-IO#3140 from LucasXu0/url_protocol_in_win…
Browse files Browse the repository at this point in the history
…dows_installer
  • Loading branch information
LucasXu0 authored Aug 8, 2023
2 parents 35a47bf + 9dc209b commit e2dd179
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class SignInForm extends StatelessWidget {

@override
Widget build(BuildContext context) {
final isSubmitting = context.read<SignInBloc>().state.isSubmitting;
const indicatorMinHeight = 4.0;
return Align(
alignment: Alignment.center,
child: AuthFormContainer(
Expand Down Expand Up @@ -104,13 +106,19 @@ class SignInForm extends StatelessWidget {
const VSpace(10),
const ThirdPartySignInButtons(),
const VSpace(20),

// loading status
if (context.read<SignInBloc>().state.isSubmitting) ...[
const SizedBox(height: 8),
const LinearProgressIndicator(value: null),
const VSpace(20),
],
...isSubmitting
? [
const VSpace(indicatorMinHeight),
const LinearProgressIndicator(
value: null,
minHeight: indicatorMinHeight,
),
]
: [
const VSpace(indicatorMinHeight * 2.0)
], // add the same space when there's no loading status.
const VSpace(20)
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class _PersonalFolderHeaderState extends State<PersonalFolderHeader> {
@override
Widget build(BuildContext context) {
const iconSize = 26.0;
const textPadding = 4.0;
return MouseRegion(
onEnter: (event) => setState(() => onHover = true),
onExit: (event) => setState(() => onHover = false),
Expand All @@ -99,8 +100,10 @@ class _PersonalFolderHeaderState extends State<PersonalFolderHeader> {
FlowyTextButton(
LocaleKeys.sideBar_personal.tr(),
tooltip: LocaleKeys.sideBar_clickToHidePersonal.tr(),
constraints: const BoxConstraints(maxHeight: iconSize),
padding: const EdgeInsets.all(4),
constraints: const BoxConstraints(
minHeight: iconSize + textPadding * 2,
),
padding: const EdgeInsets.all(textPadding),
fillColor: Colors.transparent,
onPressed: widget.onPressed,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class SettingsUserView extends StatelessWidget {
// Called when the user open a historical user in the setting dialog
final VoidCallback didOpenUser;
final UserProfilePB user;

SettingsUserView(
this.user, {
required this.didLogin,
Expand All @@ -44,21 +45,22 @@ class SettingsUserView extends StatelessWidget {
create: (context) => getIt<SettingsUserViewBloc>(param1: user)
..add(const SettingsUserEvent.initial()),
child: BlocBuilder<SettingsUserViewBloc, SettingsUserState>(
builder: (context, state) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
_renderUserNameInput(context),
const VSpace(20),
_renderCurrentIcon(context),
const VSpace(20),
_renderCurrentOpenaiKey(context),
const VSpace(20),
_renderHistoricalUser(context),
const Spacer(),
_renderLoginOrLogoutButton(context, state),
const VSpace(20),
],
builder: (context, state) => SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
_renderUserNameInput(context),
const VSpace(20),
_renderCurrentIcon(context),
const VSpace(20),
_renderCurrentOpenaiKey(context),
const VSpace(20),
_renderHistoricalUser(context),
_renderLoginOrLogoutButton(context, state),
const VSpace(20),
],
),
),
),
);
Expand Down Expand Up @@ -107,20 +109,24 @@ class SettingsUserView extends StatelessWidget {
}

Widget _renderLogoutButton(BuildContext context) {
return FlowyButton(
useIntrinsicWidth: true,
text: FlowyText(
LocaleKeys.settings_menu_logout.tr(),
return Tooltip(
message: LocaleKeys.settings_user_clickToLogout.tr(),
child: FlowyButton(
margin: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 2.0),
text: FlowyText.medium(
LocaleKeys.settings_menu_logout.tr(),
fontSize: 13,
),
onTap: () async {
NavigatorAlertDialog(
title: LocaleKeys.settings_menu_logoutPrompt.tr(),
confirm: () async {
await getIt<AuthService>().signOut();
didLogout();
},
).show(context);
},
),
onTap: () async {
NavigatorAlertDialog(
title: LocaleKeys.settings_menu_logoutPrompt.tr(),
confirm: () async {
await getIt<AuthService>().signOut();
didLogout();
},
).show(context);
},
);
}

Expand Down
3 changes: 2 additions & 1 deletion frontend/resources/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@
"name": "Name",
"icon": "Icon",
"selectAnIcon": "Select an icon",
"pleaseInputYourOpenAIKey": "please input your OpenAI key"
"pleaseInputYourOpenAIKey": "please input your OpenAI key",
"clickToLogout": "Click to logout the current user"
},
"shortcuts": {
"shortcutsLabel": "Shortcuts",
Expand Down
8 changes: 7 additions & 1 deletion frontend/scripts/windows_installer/inno_setup_config.iss
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ Source: "AppFlowy\data\*";DestDir: "{app}\data\"; Flags: recursesubdirs

[Icons]
Name: "{userdesktop}\AppFlowy"; Filename: "{app}\AppFlowy.exe"
Name: "{group}\AppFlowy"; Filename: "{app}\AppFlowy.exe"
Name: "{group}\AppFlowy"; Filename: "{app}\AppFlowy.exe"

[Registry]
Root: HKCR; Subkey: "AppFlowy"; ValueType: "string"; ValueData: "URL:Custom Protocol"; Flags: uninsdeletekey
Root: HKCR; Subkey: "AppFlowy"; ValueType: "string"; ValueName: "URL Protocol"; ValueData: ""
Root: HKCR; Subkey: "AppFlowy\DefaultIcon"; ValueType: "string"; ValueData: "{app}\AppFlowy.exe,0"
Root: HKCR; Subkey: "AppFlowy\shell\open\command"; ValueType: "string"; ValueData: """{app}\AppFlowy.exe"" ""%1"""

0 comments on commit e2dd179

Please sign in to comment.