This commit is contained in:
Dain Nilsson 2022-09-01 08:25:07 +02:00
commit 41d6170013
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
11 changed files with 119 additions and 109 deletions

26
.metadata Normal file → Executable file
View File

@ -1,10 +1,30 @@
# This file tracks properties of this Flutter project. # This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc. # Used by Flutter tool to assess capabilities and perform upgrades etc.
# #
# This file should be version controlled and should not be manually edited. # This file should be version controlled.
version: version:
revision: 2901cd720879ba3d7ba7cbd7d447ec9e80f937b6 revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
channel: beta channel: stable
project_type: app project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
- platform: windows
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

View File

@ -86,7 +86,7 @@ class AppPage extends ConsumerWidget {
titleTextStyle: Theme.of(context).textTheme.titleLarge, titleTextStyle: Theme.of(context).textTheme.titleLarge,
actions: [ actions: [
Padding( Padding(
padding: const EdgeInsets.only(right: 6), padding: const EdgeInsets.only(right: 12),
child: DeviceButton(actions: keyActions), child: DeviceButton(actions: keyActions),
), ),
], ],

View File

@ -33,50 +33,42 @@ class DeviceButton extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return Padding( return IconButton(
padding: const EdgeInsets.only(right: 8.0), tooltip: 'More actions',
child: IconButton( icon: _CircledDeviceAvatar(radius),
tooltip: 'More actions', onPressed: () {
icon: OverflowBox( final withContext = ref.read(withContextProvider);
maxHeight: 44,
maxWidth: 44,
child: _CircledDeviceAvatar(radius),
),
onPressed: () {
final withContext = ref.read(withContextProvider);
showMenu( showMenu(
context: context, context: context,
position: const RelativeRect.fromLTRB(100, 0, 0, 0), position: const RelativeRect.fromLTRB(100, 0, 0, 0),
items: <PopupMenuEntry>[ items: <PopupMenuEntry>[
PopupMenuItem( PopupMenuItem(
padding: const EdgeInsets.only(left: 11, right: 16), padding: const EdgeInsets.only(left: 11, right: 16),
onTap: isDesktop onTap: isDesktop
? () { ? () {
// Wait for menu to close, and use the main context to open // Wait for menu to close, and use the main context to open
Timer.run(() { Timer.run(() {
withContext( withContext(
(context) async { (context) async {
await showBlurDialog( await showBlurDialog(
context: context, context: context,
builder: (context) => builder: (context) => const DevicePickerDialog(),
const DevicePickerDialog(), routeSettings:
routeSettings: const RouteSettings(name: 'device_picker'),
const RouteSettings(name: 'device_picker'), );
); },
}, );
); });
}); }
} : null,
: null, child: _SlideInWidget(radius: radius),
child: _SlideInWidget(radius: radius), ),
), if (actions.isNotEmpty) const PopupMenuDivider(),
if (actions.isNotEmpty) const PopupMenuDivider(), ...actions,
...actions, ],
], );
); },
},
),
); );
} }
} }

View File

@ -173,7 +173,7 @@ class AccountDialog extends ConsumerWidget with AccountMixin {
), ),
], ],
), ),
actionsPadding: const EdgeInsets.only(top: 10.0, right: -16.0), actionsPadding: const EdgeInsets.symmetric(vertical: 10.0),
actions: [ actions: [
Center( Center(
child: FittedBox( child: FittedBox(

View File

@ -1,11 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:yubico_authenticator/app/state.dart';
import 'package:yubico_authenticator/cancellation_exception.dart';
import '../../app/message.dart'; import '../../app/message.dart';
import '../../app/shortcuts.dart'; import '../../app/shortcuts.dart';
import '../../app/state.dart'; import '../../app/state.dart';
import '../../cancellation_exception.dart';
import '../../widgets/menu_list_tile.dart'; import '../../widgets/menu_list_tile.dart';
import '../models.dart'; import '../models.dart';
import '../state.dart'; import '../state.dart';
@ -81,7 +80,8 @@ class AccountView extends ConsumerWidget with AccountMixin {
ref, ref,
) )
: getCode(ref); : getCode(ref);
await withContext((context) async => copyToClipboard(context, code)); await withContext(
(context) async => copyToClipboard(context, code));
}, },
); );
} on CancellationException catch (_) { } on CancellationException catch (_) {

View File

@ -41,12 +41,12 @@ class AppTheme {
), ),
elevatedButtonTheme: ElevatedButtonThemeData( elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
onPrimary: Colors.white, foregroundColor: Colors.white,
primary: primaryBlue, backgroundColor: primaryBlue,
)), )),
outlinedButtonTheme: OutlinedButtonThemeData( outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
primary: Colors.grey.shade800, backgroundColor: Colors.grey.shade800,
side: BorderSide(width: 1, color: Colors.grey.shade400), side: BorderSide(width: 1, color: Colors.grey.shade400),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
@ -127,12 +127,12 @@ class AppTheme {
), ),
elevatedButtonTheme: ElevatedButtonThemeData( elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
onPrimary: Colors.black, foregroundColor: Colors.black,
primary: primaryGreen, backgroundColor: primaryGreen,
)), )),
outlinedButtonTheme: OutlinedButtonThemeData( outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
primary: Colors.white70, foregroundColor: Colors.white70,
side: const BorderSide(width: 1, color: Colors.white12), side: const BorderSide(width: 1, color: Colors.white12),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
@ -193,7 +193,7 @@ class AppTheme {
static ButtonStyle primaryOutlinedButtonStyle(BuildContext context) => static ButtonStyle primaryOutlinedButtonStyle(BuildContext context) =>
OutlinedButton.styleFrom( OutlinedButton.styleFrom(
primary: Theme.of(context).colorScheme.onPrimary, foregroundColor: Theme.of(context).colorScheme.onPrimary,
backgroundColor: Theme.of(context).colorScheme.primary, backgroundColor: Theme.of(context).colorScheme.primary,
side: side:
BorderSide(width: 1, color: Theme.of(context).colorScheme.primary), BorderSide(width: 1, color: Theme.of(context).colorScheme.primary),

View File

@ -35,7 +35,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898 desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38 screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
shared_preferences_macos: a64dc611287ed6cbe28fd1297898db1336975727 shared_preferences_macos: a64dc611287ed6cbe28fd1297898db1336975727
url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3

View File

@ -21,7 +21,7 @@ packages:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.11" version: "3.3.0"
args: args:
dependency: transitive dependency: transitive
description: description:
@ -35,7 +35,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.8.2" version: "2.9.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -105,14 +105,7 @@ packages:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:
@ -126,7 +119,7 @@ packages:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
code_builder: code_builder:
dependency: transitive dependency: transitive
description: description:
@ -161,7 +154,7 @@ packages:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.0.2"
dart_style: dart_style:
dependency: transitive dependency: transitive
description: description:
@ -182,7 +175,7 @@ packages:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
@ -357,21 +350,21 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.11" version: "0.12.12"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4" version: "0.1.5"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.8.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -392,7 +385,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -572,7 +565,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.2" version: "1.9.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -607,28 +600,28 @@ packages:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
sync_http: sync_http:
dependency: transitive dependency: transitive
description: description:
name: sync_http name: sync_http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.3.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.9" version: "0.4.12"
timing: timing:
dependency: transitive dependency: transitive
description: description:
@ -642,7 +635,7 @@ packages:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
url_launcher: url_launcher:
dependency: "direct main" dependency: "direct main"
description: description:
@ -712,7 +705,7 @@ packages:
name: vm_service name: vm_service
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.2.2" version: "9.0.0"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:

View File

@ -90,22 +90,6 @@ def update_pubspec(buf):
buf, buf,
) )
# Windows Runner.rc
def update_runner_rc(buf):
buf = sub1(
rf'#define VERSION_AS_STRING "{version_pattern}"',
f'#define VERSION_AS_STRING "{version}"',
buf,
)
version_as_number = short_version.replace(".", ",")
buf = sub1(
r"#define VERSION_AS_NUMBER \d+,\d+,\d+",
f"#define VERSION_AS_NUMBER {version_as_number}",
buf,
)
return buf
# Helper version_info # Helper version_info
def update_helper_version(buf): def update_helper_version(buf):
version_tuple = repr(tuple(int(d) for d in short_version.split(".")) + (0,)) version_tuple = repr(tuple(int(d) for d in short_version.split(".")) + (0,))
@ -140,6 +124,5 @@ def update_release_win(buf):
) )
update_file("pubspec.yaml", update_pubspec) update_file("pubspec.yaml", update_pubspec)
update_file("windows/runner/Runner.rc", update_runner_rc)
update_file("helper/version_info.txt", update_helper_version) update_file("helper/version_info.txt", update_helper_version)
update_file("resources/win/release-win.ps1", update_release_win) update_file("resources/win/release-win.ps1", update_release_win)

26
windows/runner/CMakeLists.txt Normal file → Executable file
View File

@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.14)
project(runner LANGUAGES CXX) project(runner LANGUAGES CXX)
# Define the application target. To change its name, change BINARY_NAME in the
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
# work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME} WIN32 add_executable(${BINARY_NAME} WIN32
"flutter_window.cpp" "flutter_window.cpp"
"main.cpp" "main.cpp"
@ -10,12 +15,29 @@ add_executable(${BINARY_NAME} WIN32
"Runner.rc" "Runner.rc"
"runner.exe.manifest" "runner.exe.manifest"
) )
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME}) apply_standard_settings(${BINARY_NAME})
# Add preprocessor definitions for the build version.
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
# Disable Windows macros that collide with C++ standard library functions.
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
# Add dependency libraries and include directories. Add any application-specific
# dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble) add_dependencies(${BINARY_NAME} flutter_assemble)
# This can probably be done in a cleaner way. # Add helper. This can probably be done in a cleaner way.
file(COPY "../../build/windows/helper" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/Release") file(COPY "../../build/windows/helper" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/Release")
file(COPY "../../build/windows/helper" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/Debug") file(COPY "../../build/windows/helper" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/Debug")

14
windows/runner/Runner.rc Normal file → Executable file
View File

@ -60,16 +60,16 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
// Version // Version
// //
#ifdef FLUTTER_BUILD_NUMBER #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#else #else
#define VERSION_AS_NUMBER 6,0,0 #define VERSION_AS_NUMBER 1,0,0,0
#endif #endif
#ifdef FLUTTER_BUILD_NAME #if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME #define VERSION_AS_STRING FLUTTER_VERSION
#else #else
#define VERSION_AS_STRING "6.0.0-dev.0" #define VERSION_AS_STRING "1.0.0"
#endif #endif
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
@ -93,7 +93,7 @@ BEGIN
VALUE "FileDescription", "Yubico Authenticator" "\0" VALUE "FileDescription", "Yubico Authenticator" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "authenticator" "\0" VALUE "InternalName", "authenticator" "\0"
VALUE "LegalCopyright", "Copyright (C) 2021 Yubico. All rights reserved." "\0" VALUE "LegalCopyright", "Copyright (C) 2022 Yubico. All rights reserved." "\0"
VALUE "OriginalFilename", "authenticator.exe" "\0" VALUE "OriginalFilename", "authenticator.exe" "\0"
VALUE "ProductName", "Yubico Authenticator" "\0" VALUE "ProductName", "Yubico Authenticator" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0"