Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/accessibility fixes #70

Merged
merged 12 commits into from
Nov 17, 2024
9 changes: 8 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ android {

signingConfigs {
release {
storeFile file(System.getenv("AVM_KEYSTORE_FILE"))
def keystorePath = System.getenv("AVM_KEYSTORE_FILE")
if (keystorePath != null) {
storeFile file(keystorePath)
}
storePassword System.getenv("AVM_KEYSTORE_PASSWORD")
keyAlias System.getenv("AVM_KEY_ALIAS")
keyPassword System.getenv("AVM_KEY_PASSWORD")
Expand All @@ -70,6 +73,10 @@ android {
release {
signingConfig signingConfigs.release
}

debug {
// no signing config for debug builds
}
}
}

Expand Down
1 change: 1 addition & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions:
19 changes: 13 additions & 6 deletions lib/bloc/present_signed_document_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';

import '../app_service.dart';
import '../data/document_signing_type.dart';
import '../file_extensions.dart';
import '../file_system_entity_extensions.dart';
import '../ui/screens/present_signed_document_screen.dart';
Expand All @@ -31,11 +32,17 @@ class PresentSignedDocumentCubit extends Cubit<PresentSignedDocumentState> {

final SignDocumentResponseBody signedDocument;

PresentSignedDocumentCubit({
required AppService appService,
@factoryParam required this.signedDocument,
}) : _appService = appService,
super(const PresentSignedDocumentInitialState());
PresentSignedDocumentCubit(
{required AppService appService,
@factoryParam required this.signedDocument,
@factoryParam required DocumentSigningType signingType})
: _appService = appService,
super(
signingType == DocumentSigningType.local
? const PresentSignedDocumentInitialState()
// Remote documents are not saved locally, so we go directly to success state
: const PresentSignedRemoteDocumentSuccessState(),
);

/// Saves [signedDocument] into public directory.
Future<void> saveDocument() async {
Expand Down Expand Up @@ -67,7 +74,7 @@ class PresentSignedDocumentCubit extends Cubit<PresentSignedDocumentState> {
Future<File> getShareableFile() async {
final state = this.state;

if (state is PresentSignedDocumentSuccessState) {
if (state is PresentSignedLocalDocumentSuccessState) {
final file = state.file;

if (await file.exists()) {
Expand Down
19 changes: 15 additions & 4 deletions lib/bloc/present_signed_document_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ sealed class PresentSignedDocumentState {
return PresentSignedDocumentErrorState(error);
}

PresentSignedDocumentSuccessState toSuccess(File file) {
return PresentSignedDocumentSuccessState(file);
PresentSignedLocalDocumentSuccessState toSuccess(File file) {
return PresentSignedLocalDocumentSuccessState(file);
}

@override
Expand Down Expand Up @@ -44,13 +44,24 @@ class PresentSignedDocumentErrorState extends PresentSignedDocumentState {
}
}

class PresentSignedDocumentSuccessState extends PresentSignedDocumentState {
class PresentSignedLocalDocumentSuccessState
extends PresentSignedDocumentState {
final File file;

const PresentSignedDocumentSuccessState(this.file);
const PresentSignedLocalDocumentSuccessState(this.file);

@override
String toString() {
return "$runtimeType(file: $file)";
}
}

class PresentSignedRemoteDocumentSuccessState
extends PresentSignedDocumentState {
const PresentSignedRemoteDocumentSuccessState();

@override
String toString() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tento override uz netreba, nakolko je zdedeny z parent PresentSignedDocumentState type.
Len tie, co maju daco navyse by to mali overridovat.

return "$runtimeType()";
}
}
62 changes: 32 additions & 30 deletions lib/di.config.dart

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

42 changes: 42 additions & 0 deletions lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,48 @@ abstract class AppLocalizations {
/// **'Podpísať iným certifikátom'**
String get buttonSignWithDifferentCertificateLabel;

/// No description provided for @buttonMenuLabelSemantics.
///
/// In sk, this message translates to:
/// **'Otvoriť menu'**
String get buttonMenuLabelSemantics;

/// No description provided for @qrCodeScannerTorchOnSemantics.
///
/// In sk, this message translates to:
/// **'Zapnúť blesk'**
String get qrCodeScannerTorchOnSemantics;

/// No description provided for @qrCodeScannerTorchOffSemantics.
///
/// In sk, this message translates to:
/// **'Vypnúť blesk'**
String get qrCodeScannerTorchOffSemantics;

/// No description provided for @qrCodeScannerBackSemantics.
///
/// In sk, this message translates to:
/// **'Späť'**
String get qrCodeScannerBackSemantics;

/// No description provided for @qrCodeScannerOpenSemantics.
///
/// In sk, this message translates to:
/// **'Podpísať vzdialený dokument pomocou QR kódu'**
String get qrCodeScannerOpenSemantics;

/// No description provided for @shareDocumentPreviewSemantics.
///
/// In sk, this message translates to:
/// **'Zdieľať náhľad dokumentu'**
String get shareDocumentPreviewSemantics;

/// No description provided for @previewDocumentSemantics.
///
/// In sk, this message translates to:
/// **'Náhľad dokumentu'**
String get previewDocumentSemantics;

/// No description provided for @deepLinkParseErrorMessage.
///
/// In sk, this message translates to:
Expand Down
21 changes: 21 additions & 0 deletions lib/l10n/app_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get buttonSignWithDifferentCertificateLabel => 'Podpísať iným certifikátom';

@override
String get buttonMenuLabelSemantics => 'Otvoriť menu';

@override
String get qrCodeScannerTorchOnSemantics => 'Zapnúť blesk';

@override
String get qrCodeScannerTorchOffSemantics => 'Vypnúť blesk';

@override
String get qrCodeScannerBackSemantics => 'Späť';

@override
String get qrCodeScannerOpenSemantics => 'Podpísať vzdialený dokument pomocou QR kódu';

@override
String get shareDocumentPreviewSemantics => 'Zdieľať náhľad dokumentu';

@override
String get previewDocumentSemantics => 'Náhľad dokumentu';

@override
String deepLinkParseErrorMessage(Object error) {
return 'Nepodporovaný alebo nesprávny odkaz:\n$error';
Expand Down
7 changes: 7 additions & 0 deletions lib/l10n/app_sk.arb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
"buttonSelectCertificateLabel": "Vybrať certifikát",
"buttonSignWithCertificateLabel": "Podpísať ako {subject}",
"buttonSignWithDifferentCertificateLabel": "Podpísať iným certifikátom",
"buttonMenuLabelSemantics": "Otvoriť menu",
"qrCodeScannerTorchOnSemantics": "Zapnúť blesk",
"qrCodeScannerTorchOffSemantics": "Vypnúť blesk",
"qrCodeScannerBackSemantics": "Späť",
"qrCodeScannerOpenSemantics": "Podpísať vzdialený dokument pomocou QR kódu",
"shareDocumentPreviewSemantics": "Zdieľať náhľad dokumentu",
"previewDocumentSemantics": "Náhľad dokumentu",

"deepLinkParseErrorMessage": "Nepodporovaný alebo nesprávny odkaz:\n{error}",
"stepIndicatorText": "Krok {stepNumber} z {totalSteps}",
Expand Down
11 changes: 7 additions & 4 deletions lib/ui/screens/about_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ class _Body extends StatelessWidget {

final child = Column(
children: [
Text(
strings.appName,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headlineLarge,
Semantics(
header: true,
child: Text(
strings.appName,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headlineLarge,
),
),
const SizedBox(height: 16),
const AppVersionText(),
Expand Down
28 changes: 17 additions & 11 deletions lib/ui/screens/main_menu_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ class MainMenuScreen extends StatelessWidget {
const Spacer(flex: 1),
Padding(
padding: const EdgeInsets.only(bottom: 20),
child: Text(
strings.menuTitle,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
letterSpacing: 0.15,
child: Semantics(
header: true,
child: Text(
strings.menuTitle,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
letterSpacing: 0.15,
),
),
),
),
Expand Down Expand Up @@ -157,11 +160,14 @@ class _MenuItem extends StatelessWidget {

return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: InkWell(
onTap: onPressed,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: text,
child: Semantics(
button: true,
child: InkWell(
onTap: onPressed,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: text,
),
),
),
);
Expand Down
Loading