Skip to content

Commit 0b97b1f

Browse files
committed
fix: remove args.dart and make windows plugins explicit
1 parent a1191de commit 0b97b1f

File tree

10 files changed

+83
-134
lines changed

10 files changed

+83
-134
lines changed

packages/dart/npt_flutter/lib/args.dart

Lines changed: 0 additions & 87 deletions
This file was deleted.

packages/dart/npt_flutter/lib/constants.dart

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import 'dart:convert' show JsonDecoder, JsonEncoder, jsonDecode, withIndent;
1+
import 'dart:convert' show jsonDecode;
22
import 'dart:io' show exit;
33

44
import 'package:flutter/material.dart';
5-
import 'package:intl/intl.dart' show Intl;
65
import 'package:npt_flutter/localization/app_localizations.dart'
76
show AppLocalizations;
87

@@ -23,12 +22,6 @@ typedef LocalizedRootMetadata = ({
2322
typedef LocalizedRootMap = Map<String, LocalizedRootMetadata>;
2423
typedef LocalizedString = Map<String, String>;
2524

26-
extension _StringUtils on String {
27-
String? get nullIfEmpty => isEmpty ? null : this;
28-
29-
String toEnvKey() => toUpperCase().replaceAll(".", "_").trim();
30-
}
31-
3225
class Constants {
3326
static const String namespace = 'noports';
3427

packages/dart/npt_flutter/lib/features/onboarding/widgets/onboarding_apkam_dialog.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class OnboardingApkamDialogState extends State<OnboardingApkamDialog> {
183183
deviceName: deviceName,
184184
otp: otp,
185185
namespaces: {
186-
Constants.namespace!: 'rw',
186+
Constants.namespace: 'rw',
187187
"sshnp": 'rw',
188188
'sshrvd': 'rw',
189189
},

packages/dart/npt_flutter/lib/features/profile/repository/profile_repository.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ProfileRepository {
1212
Future<Iterable<String>?> getProfileUuids() async {
1313
AtClient atClient = AtClientManager.getInstance().atClient;
1414

15-
String namespace = Constants.namespace ?? '';
15+
String namespace = Constants.namespace;
1616
List<AtKey> keys;
1717
try {
1818
keys = await atClient.getAtKeys(

packages/dart/npt_flutter/lib/features/settings/repository/contact_repository.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ContactsService {
1717
factory ContactsService.getInstance() {
1818
return _singleton;
1919
}
20-
final AtSignLogger _logger = AtSignLogger(Constants.namespace!);
20+
final AtSignLogger _logger = AtSignLogger(Constants.namespace);
2121

2222
AtClient? atClient;
2323
var atClientManager = AtClientManager.getInstance();

packages/dart/npt_flutter/lib/widgets/custom_text_button.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'package:at_onboarding_flutter/at_onboarding_flutter.dart';
22
import 'package:at_onboarding_flutter/at_onboarding_services.dart';
33
import 'package:flutter/material.dart';
44
import 'package:flutter_bloc/flutter_bloc.dart';
5-
import 'package:npt_flutter/constants.dart';
65
import 'package:npt_flutter/features/back_up_key/cubit/backup_key_cubit.dart';
76
import 'package:npt_flutter/features/onboarding/cubit/onboarding_cubit.dart';
87
import 'package:npt_flutter/features/onboarding/util/atsign_manager.dart';

packages/dart/npt_flutter/lib/widgets/npt_app_bar.dart

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:at_onboarding_flutter/at_onboarding_flutter.dart';
12
import 'package:flutter/material.dart';
23
import 'package:flutter_bloc/flutter_bloc.dart';
34
import 'package:flutter_svg/flutter_svg.dart';
@@ -66,8 +67,13 @@ class _NptAppBarState extends State<NptAppBar> {
6667
switchOutCurve: Curves.easeInOut,
6768
transitionBuilder: (child, animation) {
6869
final offsetAnimation = child.key == ValueKey(state)
69-
? Tween<Offset>(begin: const Offset(0, 1), end: Offset.zero).animate(animation)
70-
: Tween<Offset>(begin: const Offset(0, -1), end: Offset.zero).animate(animation);
70+
? Tween<Offset>(
71+
begin: const Offset(0, 1), end: Offset.zero)
72+
.animate(animation)
73+
: Tween<Offset>(
74+
begin: const Offset(0, -1),
75+
end: Offset.zero)
76+
.animate(animation);
7177
return SlideTransition(
7278
position: offsetAnimation,
7379
child: FadeTransition(
@@ -116,7 +122,11 @@ class _NptAppBarState extends State<NptAppBar> {
116122
),
117123
actions: [
118124
Container(
119-
padding: const EdgeInsets.only(top: Sizes.p8, bottom: Sizes.p8, left: Sizes.p8, right: Sizes.p0),
125+
padding: const EdgeInsets.only(
126+
top: Sizes.p8,
127+
bottom: Sizes.p8,
128+
left: Sizes.p8,
129+
right: Sizes.p0),
120130
decoration: BoxDecoration(
121131
color: AppColor.outlinePaddingColor,
122132
borderRadius: BorderRadius.circular(Sizes.p4),
@@ -130,7 +140,8 @@ class _NptAppBarState extends State<NptAppBar> {
130140
curve: Curves.easeInOut,
131141
opacity: 1,
132142
child: Container(
133-
padding: const EdgeInsets.symmetric(horizontal: Sizes.p8),
143+
padding:
144+
const EdgeInsets.symmetric(horizontal: Sizes.p8),
134145
decoration: BoxDecoration(
135146
color: Colors.white,
136147
borderRadius: BorderRadius.circular(Sizes.p4),
@@ -139,14 +150,16 @@ class _NptAppBarState extends State<NptAppBar> {
139150
child: Row(
140151
children: [
141152
Text(
142-
atsign != null ? '@' : '',
153+
'@',
143154
style: Theme.of(context)
144155
.textTheme
145156
.bodyLarge!
146-
.copyWith(color: AppColor.primaryColor, fontSize: Sizes.p20),
157+
.copyWith(
158+
color: AppColor.primaryColor,
159+
fontSize: Sizes.p20),
147160
),
148161
Text(
149-
atsign.replaceFirst('@', '') ?? '',
162+
atsign.withoutAt(),
150163
style: Theme.of(context).textTheme.bodyLarge,
151164
),
152165
],
@@ -162,7 +175,9 @@ class _NptAppBarState extends State<NptAppBar> {
162175
onPressed: () {},
163176
icon: PhosphorIcon(
164177
PhosphorIcons.key(),
165-
color: isAuthorization ? AppColor.primaryColor : Colors.grey,
178+
color: isAuthorization
179+
? AppColor.primaryColor
180+
: Colors.grey,
166181
),
167182
),
168183
),

packages/dart/npt_flutter/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ packages:
11261126
source: hosted
11271127
version: "4.2.3"
11281128
permission_handler_windows:
1129-
dependency: transitive
1129+
dependency: "direct main"
11301130
description:
11311131
name: permission_handler_windows
11321132
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
@@ -1286,7 +1286,7 @@ packages:
12861286
source: hosted
12871287
version: "0.2.0"
12881288
screen_retriever_windows:
1289-
dependency: transitive
1289+
dependency: "direct main"
12901290
description:
12911291
name: screen_retriever_windows
12921292
sha256: "449ee257f03ca98a57288ee526a301a430a344a161f9202b4fcc38576716fe13"

packages/dart/npt_flutter/pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ dependencies:
8585
window_manager: ^0.4.2
8686
yaml: ^3.1.2
8787
yaml_writer: ^2.0.0
88+
permission_handler_windows: any
89+
screen_retriever_windows: any
90+
8891
dev_dependencies:
8992
build_runner: ^2.4.12
9093
flutter_launcher_icons: "^0.14.1"

packages/dart/npt_flutter/windows/CMakeLists.txt

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
cmake_minimum_required(VERSION 3.14)
33
project(npt_flutter LANGUAGES CXX)
44

5+
# Ensure these includes are available to the build
6+
add_compile_options(
7+
"-I${CMAKE_CURRENT_LIST_DIR}/flutter/ephemeral/.plugin_symlinks/permission_handler_windows/windows/"
8+
"${CMAKE_CURRENT_LIST_DIR}/flutter/ephemeral/.plugin_symlinks/screen_retriever_windows/windows/"
9+
)
10+
511
# The name of the executable created for the application. Change this to change
612
# the on-disk name of your application.
713
set(BINARY_NAME "npt_flutter")
@@ -13,14 +19,14 @@ cmake_policy(VERSION 3.14...3.25)
1319
# Define build configuration option.
1420
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
1521
if(IS_MULTICONFIG)
16-
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17-
CACHE STRING "" FORCE)
22+
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE)
1823
else()
1924
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20-
set(CMAKE_BUILD_TYPE "Debug" CACHE
21-
STRING "Flutter build mode" FORCE)
22-
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23-
"Debug" "Profile" "Release")
25+
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE)
26+
set_property(
27+
CACHE CMAKE_BUILD_TYPE
28+
PROPERTY STRINGS "Debug" "Profile" "Release"
29+
)
2430
endif()
2531
endif()
2632
# Define settings for the Profile build mode.
@@ -52,12 +58,10 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
5258
# Application build; see runner/CMakeLists.txt.
5359
add_subdirectory("runner")
5460

55-
5661
# Generated plugin build rules, which manage building the plugins and adding
5762
# them to the application.
5863
include(flutter/generated_plugins.cmake)
5964

60-
6165
# === Installation ===
6266
# Support files are copied into place next to the executable, so that it can
6367
# run in place. This is done instead of making a separate bundle (as on Linux)
@@ -72,37 +76,59 @@ endif()
7276
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
7377
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
7478

75-
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
76-
COMPONENT Runtime)
79+
install(
80+
TARGETS ${BINARY_NAME}
81+
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime
82+
)
7783

78-
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
79-
COMPONENT Runtime)
84+
install(
85+
FILES "${FLUTTER_ICU_DATA_FILE}"
86+
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
87+
COMPONENT Runtime
88+
)
8089

81-
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
82-
COMPONENT Runtime)
90+
install(
91+
FILES "${FLUTTER_LIBRARY}"
92+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
93+
COMPONENT Runtime
94+
)
8395

8496
if(PLUGIN_BUNDLED_LIBRARIES)
85-
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
97+
install(
98+
FILES "${PLUGIN_BUNDLED_LIBRARIES}"
8699
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
87-
COMPONENT Runtime)
100+
COMPONENT Runtime
101+
)
88102
endif()
89103

90104
# Copy the native assets provided by the build.dart from all packages.
91105
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
92-
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
93-
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
94-
COMPONENT Runtime)
106+
install(
107+
DIRECTORY "${NATIVE_ASSETS_DIR}"
108+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
109+
COMPONENT Runtime
110+
)
95111

96112
# Fully re-copy the assets directory on each build to avoid having stale files
97113
# from a previous install.
98114
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
99-
install(CODE "
115+
install(
116+
CODE
117+
"
100118
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
101-
" COMPONENT Runtime)
102-
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
103-
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
119+
"
120+
COMPONENT Runtime
121+
)
122+
install(
123+
DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
124+
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
125+
COMPONENT Runtime
126+
)
104127

105128
# Install the AOT library on non-Debug builds only.
106-
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
129+
install(
130+
FILES "${AOT_LIBRARY}"
131+
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
107132
CONFIGURATIONS Profile;Release
108-
COMPONENT Runtime)
133+
COMPONENT Runtime
134+
)

0 commit comments

Comments
 (0)