diff --git a/lib/application/main/main_bloc.dart b/lib/application/main/main_bloc.dart index 6dbc1654e..0d95f8c6f 100644 --- a/lib/application/main/main_bloc.dart +++ b/lib/application/main/main_bloc.dart @@ -9,6 +9,7 @@ import 'package:genshindb/domain/services/genshin_service.dart'; import 'package:genshindb/domain/services/locale_service.dart'; import 'package:genshindb/domain/services/logging_service.dart'; import 'package:genshindb/domain/services/settings_service.dart'; +import 'package:genshindb/domain/services/telemetry_service.dart'; import 'package:package_info/package_info.dart'; import '../bloc.dart'; @@ -22,6 +23,7 @@ class MainBloc extends Bloc { final GenshinService _genshinService; final SettingsService _settingsService; final LocaleService _localeService; + final TelemetryService _telemetryService; final CharactersBloc _charactersBloc; final WeaponsBloc _weaponsBloc; @@ -33,6 +35,7 @@ class MainBloc extends Bloc { this._genshinService, this._settingsService, this._localeService, + this._telemetryService, this._charactersBloc, this._weaponsBloc, this._homeBloc, @@ -85,6 +88,8 @@ class MainBloc extends Bloc { final packageInfo = await PackageInfo.fromPlatform(); final settings = _settingsService.appSettings; + await _telemetryService.trackInit(settings); + if (init) { await Future.delayed(const Duration(milliseconds: 600)); } diff --git a/lib/domain/services/telemetry_service.dart b/lib/domain/services/telemetry_service.dart index 32cb407cc..3744b0c28 100644 --- a/lib/domain/services/telemetry_service.dart +++ b/lib/domain/services/telemetry_service.dart @@ -1,3 +1,5 @@ +import 'package:genshindb/domain/models/models.dart'; + abstract class TelemetryService { Future initTelemetry(); @@ -25,4 +27,6 @@ abstract class TelemetryService { Future trackCalculatorItemAscMaterialLoaded(String item); Future trackTierListOpened(); + + Future trackInit(AppSettings settings); } diff --git a/lib/infrastructure/device_info_service.dart b/lib/infrastructure/device_info_service.dart index c25c38c46..474d1b914 100644 --- a/lib/infrastructure/device_info_service.dart +++ b/lib/infrastructure/device_info_service.dart @@ -13,11 +13,11 @@ class DeviceInfoServiceImpl implements DeviceInfoService { final deviceInfo = DeviceInfoPlugin(); final androidInfo = await deviceInfo.androidInfo; _deviceInfo = { - 'model': androidInfo.model, - 'os': '${androidInfo.version.sdkInt}', + 'Model': androidInfo.model, + 'OsVersion': '${androidInfo.version.sdkInt}', }; } catch (ex) { - _deviceInfo = {'model': 'N/A', 'os': 'N/A'}; + _deviceInfo = {'Model': 'N/A', 'OsVersion': 'N/A'}; } } } diff --git a/lib/infrastructure/telemetry/telemetry_service.dart b/lib/infrastructure/telemetry/telemetry_service.dart index be14f260e..fc781d760 100644 --- a/lib/infrastructure/telemetry/telemetry_service.dart +++ b/lib/infrastructure/telemetry/telemetry_service.dart @@ -1,3 +1,5 @@ +import 'package:enum_to_string/enum_to_string.dart'; +import 'package:genshindb/domain/models/models.dart'; import 'package:genshindb/domain/services/device_info_service.dart'; import 'package:genshindb/domain/services/telemetry_service.dart'; import 'package:genshindb/infrastructure/telemetry/flutter_appcenter_bundle.dart'; @@ -82,4 +84,13 @@ class TelemetryServiceImpl implements TelemetryService { Future trackTierListOpened() async { await trackEventAsync('TierList-Opened'); } + + @override + Future trackInit(AppSettings settings) async { + await trackEventAsync('Init', { + 'Theme': EnumToString.convertToString(settings.appTheme), + 'AccentColor': EnumToString.convertToString(settings.accentColor), + 'Language': EnumToString.convertToString(settings.appLanguage), + }); + } } diff --git a/lib/main.dart b/lib/main.dart index 3efaf38cf..7e53fd363 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -98,11 +98,13 @@ class MyApp extends StatelessWidget { final genshinService = getIt(); final settingsService = getIt(); final localeService = getIt(); + final telemetryService = getIt(); return MainBloc( loggingService, genshinService, settingsService, localeService, + telemetryService, ctx.read(), ctx.read(), ctx.read(), diff --git a/lib/presentation/artifacts/widgets/artifact_card.dart b/lib/presentation/artifacts/widgets/artifact_card.dart index 69e9b7228..409b59fe1 100644 --- a/lib/presentation/artifacts/widgets/artifact_card.dart +++ b/lib/presentation/artifacts/widgets/artifact_card.dart @@ -20,6 +20,7 @@ class ArtifactCard extends StatelessWidget { final double imgWidth; final double imgHeight; final bool withoutDetails; + final bool withElevation; const ArtifactCard({ Key key, @@ -30,6 +31,7 @@ class ArtifactCard extends StatelessWidget { @required this.bonus, this.imgWidth = 140, this.imgHeight = 120, + this.withElevation = true, }) : withoutDetails = false, super(key: key); @@ -43,6 +45,7 @@ class ArtifactCard extends StatelessWidget { imgHeight = 60, bonus = const [], withoutDetails = true, + withElevation = false, super(key: key); @override @@ -52,7 +55,7 @@ class ArtifactCard extends StatelessWidget { onTap: () => _gotoDetailPage(context), child: GradientCard( shape: Styles.mainCardShape, - elevation: Styles.cardTenElevation, + elevation: withElevation ? Styles.cardTenElevation : 0, gradient: rarity.getRarityGradient(), child: Padding( padding: Styles.edgeInsetAll5, diff --git a/lib/presentation/characters/widgets/character_ascension_materials.dart b/lib/presentation/characters/widgets/character_ascension_materials.dart index 01f8caf51..427b059db 100644 --- a/lib/presentation/characters/widgets/character_ascension_materials.dart +++ b/lib/presentation/characters/widgets/character_ascension_materials.dart @@ -16,8 +16,8 @@ class CharacterAscensionMaterials extends StatelessWidget { final widgets = images .map( (e) => FadeInImage( - height: 20, - width: 20, + height: 25, + width: 25, placeholder: MemoryImage(kTransparentImage), image: AssetImage(e), ), diff --git a/lib/presentation/shared/gradient_card.dart b/lib/presentation/shared/gradient_card.dart index a887ac1f4..1843c1e47 100644 --- a/lib/presentation/shared/gradient_card.dart +++ b/lib/presentation/shared/gradient_card.dart @@ -33,7 +33,7 @@ class GradientCard extends StatelessWidget { child: Material( type: MaterialType.card, color: Colors.transparent, - shadowColor: shadowColor ?? Colors.transparent, + // shadowColor: shadowColor ?? Colors.transparent, elevation: elevation ?? 0, shape: shape ?? const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))), clipBehavior: clipBehavior, diff --git a/lib/presentation/shared/styles.dart b/lib/presentation/shared/styles.dart index f0b099d81..013290a72 100644 --- a/lib/presentation/shared/styles.dart +++ b/lib/presentation/shared/styles.dart @@ -11,8 +11,7 @@ class Styles { topRight: Radius.circular(10), ), ); - static final RoundedRectangleBorder floatingCardShape = - RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)); + static final RoundedRectangleBorder floatingCardShape = RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)); static const double cardThreeElevation = 3; static const double cardTenElevation = 10; diff --git a/lib/presentation/weapons/widgets/weapon_card.dart b/lib/presentation/weapons/widgets/weapon_card.dart index 9865dcc1c..26c400be2 100644 --- a/lib/presentation/weapons/widgets/weapon_card.dart +++ b/lib/presentation/weapons/widgets/weapon_card.dart @@ -28,6 +28,7 @@ class WeaponCard extends StatelessWidget { final double imgHeight; final bool withoutDetails; final bool isInSelectionMode; + final bool withElevation; const WeaponCard({ Key key, @@ -42,6 +43,7 @@ class WeaponCard extends StatelessWidget { this.imgWidth = 160, this.imgHeight = 140, this.isInSelectionMode = false, + this.withElevation = true, }) : withoutDetails = false, super(key: key); @@ -59,6 +61,7 @@ class WeaponCard extends StatelessWidget { subStatValue = null, withoutDetails = true, isInSelectionMode = false, + withElevation = false, super(key: key); @override @@ -69,7 +72,7 @@ class WeaponCard extends StatelessWidget { onTap: () => _gotoWeaponPage(context), child: GradientCard( shape: Styles.mainCardShape, - elevation: Styles.cardTenElevation, + elevation: withElevation ? Styles.cardTenElevation : 0, gradient: rarity.getRarityGradient(), child: Padding( padding: Styles.edgeInsetAll5, diff --git a/pubspec.lock b/pubspec.lock index f73f4e017..21824e0c6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -232,6 +232,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.1" + enum_to_string: + dependency: "direct main" + description: + name: enum_to_string + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.14" fake_async: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 9bb3e0050..24a20d2fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.7+25 +version: 1.0.7+26 environment: sdk: ">=2.10.4 <3.0.0" @@ -25,6 +25,7 @@ dependencies: data_connection_checker: ^0.3.4 device_info: ^1.0.0 dog: ^1.3.1 + enum_to_string: ^1.0.14 flutter: sdk: flutter flutter_bloc: ^6.1.1