Skip to content

Commit

Permalink
Merge pull request #61 from 3Dpass/dev
Browse files Browse the repository at this point in the history
FEATURE: Objects explorer. Version 2.12.0+34
  • Loading branch information
L3odr0id authored Feb 25, 2024
2 parents 1452ccd + 32663c0 commit bacf3db
Show file tree
Hide file tree
Showing 93 changed files with 2,163 additions and 1,101 deletions.
46 changes: 23 additions & 23 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,38 +56,38 @@ android {
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

if (System.getenv("KEYSTORE_PATH")) {
if (System.getenv("KEYSTORE_PATH")) {
resValue "string", "app_name", "3DPass"

println "Release properties"
} else {
applicationIdSuffix '.debug'
versionNameSuffix '-DEBUG'
resValue "string", "app_name", "3DPass debug"
} else {
applicationIdSuffix '.debug'
versionNameSuffix '-DEBUG'
resValue "string", "app_name", "3DPass debug"

println "Debug properties"
}
println "Debug properties"
}
}


signingConfigs {
release {
// storeFile file('aaaaa')
// keyPassword 'aaa'
// storePassword 'aaa'
// keyAlias 'aaaa'

if (System.getenv("KEYSTORE_PATH")){
println("signingConfigs release")
// If you are reading these lines check the link:
// https://proandroiddev.com/how-to-securely-build-and-sign-your-android-app-with-github-actions-ad5323452ce
storeFile = file(System.getenv("KEYSTORE_PATH"))
storePassword System.getenv("SIGNING_STORE_PASSWORD")
keyAlias System.getenv("SIGNING_KEY_ALIAS")
keyPassword System.getenv("SIGNING_KEY_PASSWORD")
} else{
println("signingConfigs debug")
}
// keyAlias keystoreProperties['keyAlias']
// keyPassword keystoreProperties['keyPassword']
// storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
// storePassword keystoreProperties['storePassword']

// if (System.getenv("KEYSTORE_PATH")){
// println("signingConfigs release")
// // If you are reading these lines check the link:
// // https://proandroiddev.com/how-to-securely-build-and-sign-your-android-app-with-github-actions-ad5323452ce
// storeFile = file(System.getenv("KEYSTORE_PATH"))
// storePassword System.getenv("SIGNING_STORE_PASSWORD")
// keyAlias System.getenv("SIGNING_KEY_ALIAS")
// keyPassword System.getenv("SIGNING_KEY_PASSWORD")
// } else{
// println("signingConfigs debug")
// }
}
}
}
Expand Down
39 changes: 31 additions & 8 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,36 @@
"local_snapshots_with_same_hashes": "Local snapshots with same hashes:",
"file_hash_subtitle_scan_list": "Local file hash: ",
"poscan_object_title": "PoScan object",
"reset_objects_cache_plural": {
"zero": "No objects cached",
"one": "{} object cached",
"two": "{} objects cached",
"few": "{} objects cached",
"many": "{} objects cached",
"other": "{} objects cached"

"no_owned_objects_found": "No objects owned by this account found",

"@2.12.0":{
},
"bottom_label_explorer": "Explorer",
"objects_plural": {
"zero": "No objects",
"one": "{} object",
"two": "{} objects",
"few": "{} objects",
"many": "{} objects",
"other": "{} objects"
},
"reset_objects_cache_plural": "{} cached",
"objects_list_appbar_title": "{} in storage",
"no_objects": "No cached objects",
"bad_address": "Wrong address format",
"delete_snapshots_dialog_title": "Delete snapshots",
"delete_snapshots_dialog_content": "Do you want to delete {}?",
"snapshots_plural": {
"zero": "0 snapshots",
"one": "{} snapshot",
"two": "{} snapshots",
"few": "{} snapshots",
"many": "{} snapshots",
"other": "{} snapshots"
},
"no_owned_objects_found": "No objects owned by this account found"
"uploaded_object_id": "id: ",
"uploaded_object_status": "Status: ",
"uploaded_object_owner": "Owner: ",
"uploaded_object_hashes": "Object's hashes: "
}
84 changes: 84 additions & 0 deletions integration_test/scan_page_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import 'dart:io';

import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:threedpass/core/widgets/buttons/elevated_button.dart';
import 'package:threedpass/features/hashes_list/bloc/hashes_list_bloc.dart';
import 'package:threedpass/features/hashes_list/domain/entities/snapshot_create_from_file/snapshot_create_from_file.dart';
import 'package:threedpass/features/scan_page/bloc/scan_isolate_cubit.dart';
import 'package:threedpass/features/scan_page/presentation/widgets/get_object_from_file_button.dart';
import 'package:threedpass/features/settings_page/bloc/settings_page_cubit.dart';
import 'package:threedpass/router/router.gr.dart';

import './test_app.dart';

void main() {
// config();
final app = TestApp.instance;

group('Example test', () {
testWidgets('MyWidget has a title and message', (tester) async {
print('aaaaaaa1');
// Initial pump
await tester.pumpWidget(app);
print('aaaaaaa2');

final filePath = '${Directory.current.path}/resources/3dpass-487203.obj';
// final Uri basedir = (goldenFileComparator. as LocalFileComparator).basedir;
// matchesGoldenFile(key)
// print(basedir.path);

// final file = await rootBundle.load(filePath);
// print(file.lengthInBytes);

var dir = Directory.current;
while (!await dir
.list()
.any((entity) => entity.path.endsWith('pubspec.yaml'))) {
dir = dir.parent;
}

print(dir.absolute);
print(Directory.current.listSync(recursive: true));
print(filePath);
print(File(filePath).existsSync());
// for (var i in tester.allElements) {
// print(i.widget.runtimeType);
// }
final BuildContext context = tester.element(find.byType(SizedBox));

final snapFactory = SnapshotFileFactory(
showLoader: () {},
hashesListBloc: BlocProvider.of<HashesListBloc>(context),
scanSettings:
BlocProvider.of<SettingsConfigCubit>(context).state.scanSettings,
// objectsDirectory: getIt<ObjectsDirectory>(),
scanIsolateCubit: BlocProvider.of<ScanIsolateCubit>(context),
// recievePort: recievePort,
);

final pair = await snapFactory.createSnapshotFromFile(
pickedFilePath: filePath,
relativePath: filePath,
);

await context.router.push(
PreviewRouteWrapper(
hashObject: pair.left,
snapshot: pair.right,
createNewAnyway: true,
),
);

print('aaaaaaa3');

await tester.pumpAndSettle();

print('aaaaaaa4');
});
});
}
26 changes: 26 additions & 0 deletions integration_test/test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:threedpass/features/wallet_screen/assets_page/widgets/balance_card/locked_balance_card.dart';
import 'package:threedpass/main.dart';

import '../test/test_config.dart';

// import 'test_config.dart';
import './scan_page_test.dart' as scan_page;
// import 'utils/assets_formatting.dart' as assets_formating;

/// Test all
void main() {
config();

// assets_formating.main();

scan_page.main();

// Prepare to widget-testing
// setUpAll(() async {
// SharedPreferences.setMockInitialValues({});
// await service_locator.setup();
// });
}
18 changes: 18 additions & 0 deletions integration_test/test_app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/widgets.dart';
import 'package:threedpass/main.dart';

class TestApp {
TestApp._();

static final Widget instance = EasyLocalization(
supportedLocales: const [
Locale('en'),
Locale('es'),
Locale('sr'),
],
path: 'assets/translations',
fallbackLocale: const Locale('en'),
child: ThreeDApp(),
);
}
15 changes: 15 additions & 0 deletions integration_test/test_config.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:threedpass/core/persistence/hive_setup.dart' as hive_setup;
import 'package:threedpass/setup.dart' as di_setup;

Future<void> config() async {
setUpAll(() async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

await hive_setup.hiveSetup();
await di_setup.setup();
await EasyLocalization.ensureInitialized();
});
}
2 changes: 1 addition & 1 deletion lib/core/theme/d3p_card_theme.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';

class D3pCardTheme {
static Radius get radius => const Radius.circular(4.0);
static const Radius radius = Radius.circular(4.0);
}
2 changes: 2 additions & 0 deletions lib/core/utils/formatters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'package:easy_localization/easy_localization.dart';

class Fmt {
static DateFormat basicDateFormat = DateFormat('yyyy-MM-dd HH:mm:ss');
static DateFormat shortDateFormat = DateFormat('yyyy-MM-dd HH:mm');
static DateFormat transferDateFormat = DateFormat('kk:mm – dd-MM-yyyy');

static String shorterAddress(final String? addr, {final int pad = 6}) {
if (addr == null || addr.isEmpty) {
Expand Down
12 changes: 1 addition & 11 deletions lib/core/utils/show_text_snackbar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io';

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
Expand All @@ -14,14 +12,6 @@ class FastSnackBar {
final BuildContext context;

void show() {
if (Platform.isIOS) {
Fluttertoast.showToast(msg: textCode.tr());
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(textCode.tr()),
),
);
}
Fluttertoast.showToast(msg: textCode.tr());
}
}
35 changes: 35 additions & 0 deletions lib/core/widgets/appbars/title_n_button_appbar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
import 'package:threedpass/core/theme/d3p_appbar_theme.dart';

class TitleNButtonAppBar extends PlatformAppBar {
TitleNButtonAppBar({
required final String titleText,
required final Widget trailingAction,
final bool translateAppbar = true,
super.key,
}) : super(
automaticallyImplyLeading: false,
backgroundColor: const D3pAppBarTheme().backgroundColor,
cupertino: (final context, final platform) =>
CupertinoNavigationBarData(padding: EdgeInsetsDirectional.zero),
material: (final context, final platform) => MaterialAppBarData(
titleSpacing: 0,
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(left: 16),
child: Text(
translateAppbar ? titleText.tr() : titleText,
textAlign: TextAlign.start,
style: const TextStyle(color: Colors.white),
),
),
trailingAction,
],
),
);
}
6 changes: 6 additions & 0 deletions lib/core/widgets/buttons/clickable_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ class ClickableCard extends StatelessWidget {
const ClickableCard({
required this.child,
required this.onTap,
this.side,
this.radius,
super.key,
});

final void Function()? onTap;
final Widget child;
final BorderSide? side;
final Radius? radius;

@override
Widget build(final BuildContext context) {
return D3pCard(
side: side,
// radius: radius,
child: InkWell(
onTap: onTap,
child: Padding(
Expand Down
Loading

0 comments on commit bacf3db

Please sign in to comment.