Skip to content

Commit

Permalink
Dev (#113)
Browse files Browse the repository at this point in the history
* upd readme

* fixed screens

* upd screens

* upd

* upd

* upd

* upd

* upd

* upd

* upd version

* added images for nashstore

* issue-103

updated links handling

* issue-103

* issue-105

* d

* d

* d

* d

* d

* d

* в

* d

* d

* d

* d

* d

* d

* d

* d

* d

* d

* s

* d

* d

* d

* d

* d

* d

* d

* d

* d

* d

* d

* d

* r

* d

* issue-105

* issue-109

* issue-110 ci

* d
  • Loading branch information
gennadyterekhov authored Oct 10, 2023
1 parent 87200e8 commit b382254
Show file tree
Hide file tree
Showing 201 changed files with 2,979 additions and 1,336 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: subosito/flutter-action@v2.8.0
- run: flutter test
- uses: subosito/flutter-action@v2.10.0
- run: flutter pub get
- run: flutter test --platform=chrome
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

README.local.md
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ this command opens chrome window with the app in debug mode

for more commands, see [flutter documentation](https://docs.flutter.dev/get-started/test-drive?tab=terminal)

### Building

when building for a new release (substitute correct build number):
`flutter build apk --build-number=4 --build-name=4.0.0`


Install release app on device:
`flutter run --release`

### Test

[how to run integration test in browser](https://docs.flutter.dev/testing/integration-tests#running-in-a-browser)
Expand All @@ -33,9 +42,10 @@ this command runs specific integration test
`flutter drive --driver integration_test/driver.dart --target integration_test/full_test.dart --no-dds`

this command runs cpecific widget/unit test
`flutter test test/data/data_source_test.dart`

`flutter test test/layers/data/data_source_test.dart`

if there's an error because of dart:html, use this
`flutter test --platform chrome`


## Data sources
Expand Down
22 changes: 22 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,26 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Provide required visibility configuration for API level 30 and above -->
<queries>
<!-- If your app checks for SMS support -->
<!-- <intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="sms" />
</intent> -->
<!-- If your app checks for call support -->
<!-- <intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent> -->

<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="file" />
</intent>
</queries>
</manifest>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/play_stores/screens/android/ru/6.jpeg
Binary file modified assets/img/play_stores/screens/ios/ru/6.jpeg
Binary file added assets/img/teso/effects/Breach.png
Binary file added assets/img/teso/effects/Cowardice.png
Binary file added assets/img/teso/effects/Defile.png
Binary file added assets/img/teso/effects/Detection.png
Binary file added assets/img/teso/effects/Enervation.png
Binary file added assets/img/teso/effects/Entrapment.png
Binary file added assets/img/teso/effects/Fracture.png
Binary file added assets/img/teso/effects/Gradual Ravage Health.png
Binary file added assets/img/teso/effects/Heroism.png
Binary file added assets/img/teso/effects/Hindrance.png
Binary file added assets/img/teso/effects/Increase Armor.png
Binary file added assets/img/teso/effects/Increase Spell Power.png
Binary file added assets/img/teso/effects/Increase Spell Resist.png
Binary file added assets/img/teso/effects/Increase Weapon Power.png
Binary file added assets/img/teso/effects/Invisible.png
Binary file added assets/img/teso/effects/Lingering Health.png
Binary file added assets/img/teso/effects/Maim.png
Binary file added assets/img/teso/effects/Protection.png
Binary file added assets/img/teso/effects/Ravage Health.png
Binary file added assets/img/teso/effects/Ravage Magicka.png
Binary file added assets/img/teso/effects/Ravage Stamina.png
Binary file added assets/img/teso/effects/Restore Health.png
Binary file added assets/img/teso/effects/Restore Magicka.png
Binary file added assets/img/teso/effects/Restore Stamina.png
Binary file added assets/img/teso/effects/Speed.png
Binary file added assets/img/teso/effects/Spell Critical.png
Binary file added assets/img/teso/effects/Timidity.png
Binary file added assets/img/teso/effects/Uncertainty.png
Binary file added assets/img/teso/effects/Unstoppable.png
Binary file added assets/img/teso/effects/Vitality.png
Binary file added assets/img/teso/effects/Vulnerability.png
Binary file added assets/img/teso/effects/Weapon Critical.png
Binary file added assets/img/teso/ingredients/Beetle Scuttle.png
Binary file added assets/img/teso/ingredients/Blue Entoloma.png
Binary file added assets/img/teso/ingredients/Bugloss.png
Binary file added assets/img/teso/ingredients/Butterfly Wing.png
Binary file added assets/img/teso/ingredients/Chaurus Egg.png
Binary file added assets/img/teso/ingredients/Clam Gall.png
Binary file added assets/img/teso/ingredients/Columbine.png
Binary file added assets/img/teso/ingredients/Corn Flower.png
Binary file added assets/img/teso/ingredients/Crimson Nirnroot.png
Binary file added assets/img/teso/ingredients/Dragon Rheum.png
Binary file added assets/img/teso/ingredients/Dragon's Bile.png
Binary file added assets/img/teso/ingredients/Dragon's Blood.png
Binary file added assets/img/teso/ingredients/Dragonthorn.png
Binary file added assets/img/teso/ingredients/Emetic Russula.png
Binary file added assets/img/teso/ingredients/Fleshfly Larva.png
Binary file added assets/img/teso/ingredients/Imp Stool.png
Binary file added assets/img/teso/ingredients/Lady's Smock.png
Binary file added assets/img/teso/ingredients/Luminous Russula.png
Binary file added assets/img/teso/ingredients/Mountain Flower.png
Binary file added assets/img/teso/ingredients/Mudcrab Chitin.png
Binary file added assets/img/teso/ingredients/Namira's Rot.png
Binary file added assets/img/teso/ingredients/Nightshade.png
Binary file added assets/img/teso/ingredients/Nirnroot.png
Binary file added assets/img/teso/ingredients/Scrib Jelly.png
Binary file added assets/img/teso/ingredients/Spider Egg.png
Binary file added assets/img/teso/ingredients/Stinkhorn.png
Binary file added assets/img/teso/ingredients/Torchbug Thorax.png
Binary file added assets/img/teso/ingredients/Vile Coagulant.png
Binary file added assets/img/teso/ingredients/Violet Coprinus.png
Binary file added assets/img/teso/ingredients/Water Hyacinth.png
Binary file added assets/img/teso/ingredients/White Cap.png
Binary file added assets/img/teso/ingredients/Wormwood.png
58 changes: 46 additions & 12 deletions integration_test/full_test.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import 'package:flutter/material.dart';
import 'package:flutter_simple_dependency_injection/injector.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:the_elder_scrolls_alchemy_client/data/data_source.dart';
import 'package:the_elder_scrolls_alchemy_client/main.dart';
import 'package:the_elder_scrolls_alchemy_client/widgets/components/cards/effect/effect_big.dart';
import 'package:the_elder_scrolls_alchemy_client/widgets/components/cards/effect/effect_small.dart';
import 'package:the_elder_scrolls_alchemy_client/widgets/components/cards/ingredient/ingredient_big.dart';
import 'package:the_elder_scrolls_alchemy_client/widgets/components/search_field.dart';
import 'package:the_elder_scrolls_alchemy_client/app.dart';
import 'package:the_elder_scrolls_alchemy_client/di_container.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/data/resources/constant.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/presentation/widgets/components/cards/effect/effect_big.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/presentation/widgets/components/cards/effect/effect_small.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/presentation/widgets/components/cards/ingredient/ingredient_big.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/presentation/widgets/components/search_field.dart';

void main() {
final dependencyInjectionContainer = DependencyInjectionContainer().initialise(Injector());
final app = dependencyInjectionContainer.get<TheElderScrollsAlchemyClientApp>();

group('general', () {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized() as IntegrationTestWidgetsFlutterBinding;

binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;

testWidgets('Scrolling test', (tester) async {
await tester.pumpWidget(MyApp());
await tester.pumpWidget(app);

await tester.tap(find.text('Effects'));
await tester.pump();
Expand All @@ -32,7 +37,7 @@ void main() {
});

testWidgets('Test inkwell works as a link', (tester) async {
await tester.pumpWidget(MyApp());
await tester.pumpWidget(app);

await tester.tap(find.text('Effects'));
await tester.pump();
Expand All @@ -53,17 +58,24 @@ void main() {

group('home page', () {
testWidgets('Change game', (tester) async {
await tester.pumpWidget(MyApp());
await tester.pumpWidget(app);
expect(find.text('Skyrim Alchemy'), findsOneWidget);

await tester.tap(find.text('Effects'));
await tester.pump();

expect(find.text('Cure Disease'), findsOneWidget);

await tester.tap(find.byType(PopupMenuButton));
await tester.pump();
await tester.tap(find.text(DataSource.gameNameMorrowind));
await tester.tap(find.text(Constant.gameNameOblivion));
await tester.pump();
await tester.tap(find.text('Effects'));
await tester.pump();
expect(find.text('Shock Shield'), findsOneWidget);

await tester.tap(find.byType(PopupMenuButton));
await tester.pump();
await tester.tap(find.text(Constant.gameNameMorrowind));
await tester.pump();

await tester.tap(find.text('Effects'));
Expand All @@ -75,7 +87,7 @@ void main() {

group('search', () {
testWidgets('search', (tester) async {
await tester.pumpWidget(MyApp());
await tester.pumpWidget(app);
await tester.tap(find.text('Effects'));
await tester.pump();

Expand All @@ -96,4 +108,26 @@ void main() {
expect(find.byType(EffectCardSmall), findsOneWidget);
});
});

group('left panel', () {
testWidgets('items are marked as selected', (tester) async {
await tester.pumpWidget(app);
await tester.pump();

final navigationRailFinder = find.byType(NavigationRail);
expect(navigationRailFinder, findsOneWidget);
NavigationRail navigationRail = tester.firstWidget(navigationRailFinder);
expect(navigationRail.selectedIndex, 0);

await tester.tap(find.text('Effects'));
await tester.pump();

expect(navigationRail.selectedIndex, 1);

await tester.tap(find.text('Ingredients'));
await tester.pump();

expect(navigationRail.selectedIndex, 2);
});
});
}
7 changes: 7 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>sms</string>
<string>tel</string>
<string>https</string>
<string>file</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
Expand Down
90 changes: 90 additions & 0 deletions lib/app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/data/resources/constant.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/presentation/widgets/app_widget.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/state_management/app_state.dart';

class TheElderScrollsAlchemyClientApp extends StatelessWidget {
const TheElderScrollsAlchemyClientApp({Key? key}) : super(key: key);

static Future<String> getSavedGameName() async {
String? gameNameFromPreferences = await getGameNameFromPreferences();
if (gameNameFromPreferences == null) {
return Constant.fallbackGameName;
}
return gameNameFromPreferences;
}

static String getLocaleLanguageCode(BuildContext context) {
return Localizations.localeOf(context).languageCode;
}

static Future<String> getSavedLanguageCode() async {
String? languageCodeFromPreferences = await getLanguageCodeFromPreferences();
if (languageCodeFromPreferences == null) {
return Constant.fallbackLanguage;
}
return languageCodeFromPreferences;
}

static Future<String?> getLanguageCodeFromPreferences() async {
final prefs = await SharedPreferences.getInstance();
final String? languageCode = prefs.getString('languageCode');

return languageCode;
}

static Future<String?> getGameNameFromPreferences() async {
final prefs = await SharedPreferences.getInstance();
final String? gameName = prefs.getString('gameName');

return gameName;
}

AppState setStateFromUrl() {
String savedGameName = Constant.fallbackGameName;
String savedLanguage = Constant.fallbackLanguage;
TheElderScrollsAlchemyClientApp.getSavedGameName().then((value) => savedGameName = value);
TheElderScrollsAlchemyClientApp.getSavedLanguageCode().then((value) => savedLanguage = value);

String chosenTab = Constant.tabHome;
String objectName = '';

if (kIsWeb) {
final segments = Uri.base.pathSegments;

if (segments.length == 2 || segments.length == 3) {
savedGameName = segments[0];

chosenTab = segments[1];

if (segments.length > 2) {
objectName = segments[2];
}
}
}

return AppState(
gameName: savedGameName,
language: savedLanguage,
chosenTab: chosenTab,
chosenEffectName: chosenTab == Constant.tabEffects ? objectName : '',
chosenIngredientName: chosenTab == Constant.tabIngredients ? objectName : '',
urlPath: Uri.base.path,
);
}

@override
Widget build(BuildContext context) {
final state = setStateFromUrl();

final blocProvider = BlocProvider(
create: (_) => state,
child: const AppWidget(),
);

return blocProvider;
}
}
43 changes: 0 additions & 43 deletions lib/data/data_source.dart

This file was deleted.

21 changes: 21 additions & 0 deletions lib/di_container.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter_simple_dependency_injection/injector.dart';
import 'package:the_elder_scrolls_alchemy_client/app.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/business_logic/services/settings_manager.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/state_management/app_state.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/state_management/custom_navigator.dart';
import 'package:the_elder_scrolls_alchemy_client/router.dart';

class DependencyInjectionContainer {
Injector initialise(Injector injector) {
injector.map<SettingsManager>((injector) => SettingsManager(), isSingleton: true);

injector.map<AppState>((injector) => AppState(), isSingleton: true);

injector.map<TheElderScrollsAlchemyClientApp>(
(injector) => TheElderScrollsAlchemyClientApp(),
isSingleton: true,
);

return injector;
}
}
9 changes: 9 additions & 0 deletions lib/helpers/link_launcher.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:url_launcher/url_launcher.dart';

class LinkLauncher {
static Future<void> launch({required String url}) async {
if (!await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication)) {
throw Exception('Could not launch $url');
}
}
}
3 changes: 2 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ingredientWeight":"weight",
"ingredientText": "description",
"ingredientHarvestProbability":"harvest probability",
"ingredientOrigin":"origin",

"ingredientsByEffectNoIngredients" :"no ingredients",
"ingredientsByEffectInPosition": "In position",
Expand All @@ -30,6 +31,6 @@
"homePageChangeGame":"Change game",
"homePageChangeLanguage": "Change language",
"homePageDescription": "The Library of Alchemy Effects and Ingredients from 'The Elder Scrolls'.",
"homePageDataOriginDescription": "The data are taken from open sources, such as en.uesp.net .",
"homePageDataOriginDescription": "The data are taken from open sources, such as en.uesp.net, and are licensed under the Creative Commons by-sa license",
"homeNavigation":"Home"
}
3 changes: 2 additions & 1 deletion lib/l10n/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ingredientWeight":"вес",
"ingredientText": "описание",
"ingredientHarvestProbability":"вероятность сбора",
"ingredientOrigin":"источник",

"ingredientsByEffectNoIngredients" :"нет ингредиентов",
"ingredientsByEffectInPosition": "В позиции",
Expand All @@ -29,6 +30,6 @@
"homePageChangeGame":"Изменить игру",
"homePageChangeLanguage": "Изменить язык",
"homePageDescription": "Справочник алхимических эффектов и ингредиентов из 'Древних свитков'.",
"homePageDataOriginDescription": "Данные взяты из открытых источников, напр. en.uesp.net .",
"homePageDataOriginDescription": "Данные взяты из открытых источников, напр. en.uesp.net, и лицензированы Creative Commons by-sa",
"homeNavigation":"Домой"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b382254

Please sign in to comment.