Skip to content

Commit

Permalink
chore(#636): update dependencies [wip]
Browse files Browse the repository at this point in the history
* Update packages and Android build tools
* Updates and refactors routing
* Uses Flutter's adaptive dialog
* Need to test building for both platforms and functionality
  • Loading branch information
tamslo committed Dec 19, 2023
1 parent 4355e37 commit 10f4e60
Show file tree
Hide file tree
Showing 69 changed files with 682 additions and 818 deletions.
6 changes: 3 additions & 3 deletions app/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Please also see the [contribution guide in the root folder](../CONTRIBUTING.md).
- Run `dart pub get` to fetch all dart dependencies
- Run `flutter pub get` to fetch all flutter dependencies and setup all
generated code
- Run `flutter pub run build_runner build --delete-conflicting-outputs` or
`flutter pub run build_runner watch --delete-conflicting-outputs` to
- Run `dart run build_runner build --delete-conflicting-outputs` or
`dart run build_runner watch --delete-conflicting-outputs` to
re-generate code upon file changes while developing

You should now be able to run the app by opening the debug panel on the left and
Expand All @@ -24,7 +24,7 @@ For (cleaning) generated code, you might want to add the following aliases to
your shell configuration:

```bash
alias flutter-generate='flutter pub run build_runner build --delete-conflicting-outputs'
alias flutter-generate='dart run build_runner build --delete-conflicting-outputs'
alias flutter-clean='find . -maxdepth 20 -type f \( -name "*.inject.summary" -o -name "*.inject.dart" -o -name "*.g.dart" \) -delete'
```

Expand Down
13 changes: 7 additions & 6 deletions app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
namespace 'de.hpi.pharme'

compileSdk 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "de.hpi.pharme"
applicationId 'de.hpi.pharme'
minSdkVersion 19
targetSdkVersion 33
multiDexEnabled true
Expand Down
3 changes: 1 addition & 2 deletions app/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.hpi.pharme">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
3 changes: 1 addition & 2 deletions app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.hpi.pharme">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<!-- If you wish to run the app on a local setup (i.e local lab server, annotation server,
etc.) set the parameter 'android:usesCleartextTraffic' to 'true' -->
Expand Down
3 changes: 1 addition & 2 deletions app/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.hpi.pharme">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
6 changes: 3 additions & 3 deletions app/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.6.21'
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
3 changes: 3 additions & 0 deletions app/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
4 changes: 2 additions & 2 deletions app/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
#Tue Dec 19 14:27:03 CET 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
1 change: 1 addition & 0 deletions app/generate_screenshots/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import 'dart:io';

import 'package:app/app.dart';
import 'package:app/common/module.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/generate_screenshots/test_driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:integration_test/integration_test_driver_extended.dart';
Future<void> main() async {
try {
await integrationDriver(
onScreenshot: (screenshotName, screenshotBytes) async {
onScreenshot: (screenshotName, screenshotBytes, [_]) async {
final image =
await File(
'../docs/screenshots/$screenshotName.png'
Expand Down
4 changes: 2 additions & 2 deletions app/integration_test/drugs_test.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// ignore_for_file: cast_nullable_to_non_nullable

import 'package:app/common/module.dart';
import 'package:app/common/pages/drug/widgets/module.dart';
import 'package:app/search/module.dart';
import 'package:app/drug/module.dart';
import 'package:app/drug/widgets/disclaimer.dart';
import 'package:bloc_test/bloc_test.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/integration_test/faq_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
final faqWidget = MaterialApp.router(
routeInformationParser: appRouter.defaultRouteParser(),
routerDelegate: appRouter.delegate(
initialDeepLink: 'main/faq',
deepLinkBuilder: (_) => DeepLink.path('main/faq'),
),
localizationsDelegates: [
AppLocalizations.delegate,
Expand Down
12 changes: 6 additions & 6 deletions app/integration_test/login_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import 'package:integration_test/integration_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:provider/provider.dart';

class MockLoginCubit extends MockCubit<LoginPageState>
implements LoginPageCubit {}
class MockLoginCubit extends MockCubit<LoginState>
implements LoginCubit {}

void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand All @@ -20,7 +20,7 @@ void main() {
group('integration tests for the login page', () {
testWidgets('test loading state', (tester) async {
when(() => mockLoginCubit.state).thenReturn(
LoginPageState.loadingUserData(),
LoginState.loadingUserData(),
);

await tester.pumpWidget(
Expand All @@ -44,7 +44,7 @@ void main() {

testWidgets('test error state', (tester) async {
when(() => mockLoginCubit.state).thenReturn(
LoginPageState.error('Some error'),
LoginState.error('Some error'),
);

await tester.pumpWidget(
Expand All @@ -70,7 +70,7 @@ void main() {

testWidgets('test loaded state', (tester) async {
when(() => mockLoginCubit.state).thenReturn(
LoginPageState.loadedUserData(),
LoginState.loadedUserData(),
);

await tester.pumpWidget(
Expand All @@ -97,7 +97,7 @@ void main() {

testWidgets('test initial state', (tester) async {
when(() => mockLoginCubit.state).thenReturn(
LoginPageState.initial(),
LoginState.initial(),
);

await tester.pumpWidget(
Expand Down
2 changes: 1 addition & 1 deletion app/integration_test/main_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {
child: MaterialApp.router(
routeInformationParser: appRouter.defaultRouteParser(),
routerDelegate: appRouter.delegate(
initialDeepLink: 'main',
deepLinkBuilder: (_) => DeepLink.path('main'),
),
localizationsDelegates: [
AppLocalizations.delegate,
Expand Down
2 changes: 1 addition & 1 deletion app/integration_test/onboarding_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:app/common/module.dart';
import 'package:app/onboarding/pages/onboarding.dart';
import 'package:app/onboarding/module.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
Expand Down
6 changes: 3 additions & 3 deletions app/integration_test/settings_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void main() {
debugShowCheckedModeBanner: false,
routeInformationParser: appRouter.defaultRouteParser(),
routerDelegate: appRouter.delegate(
initialDeepLink: 'main/settings',
deepLinkBuilder: (_) => DeepLink.path('main/settings'),
),
localizationsDelegates: [
AppLocalizations.delegate,
Expand Down Expand Up @@ -65,7 +65,7 @@ void main() {
findsOneWidget,
);

context.router.navigateBack();
context.router.back();
await tester.pumpAndSettle();

// test privacy policy
Expand All @@ -77,7 +77,7 @@ void main() {
findsOneWidget,
);

context.router.navigateBack();
context.router.back();
await tester.pumpAndSettle();

// test terms and conditions
Expand Down
40 changes: 21 additions & 19 deletions app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@ PODS:
- device_info_plus (0.0.1):
- Flutter
- Flutter (1.0.0)
- flutter_secure_storage (3.3.1):
- flutter_secure_storage (6.0.0):
- Flutter
- flutter_share (0.0.1):
- Flutter
- flutter_web_auth (0.4.1):
- flutter_web_auth (0.5.0):
- Flutter
- integration_test (0.0.1):
- Flutter
- package_info_plus (0.4.5):
- Flutter
- path_provider_ios (0.0.1):
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- printing (1.0.0):
- Flutter
- sensors_plus (0.0.1):
- Flutter
- shared_preferences_ios (0.0.1):
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter

Expand All @@ -31,10 +33,10 @@ DEPENDENCIES:
- flutter_web_auth (from `.symlinks/plugins/flutter_web_auth/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- printing (from `.symlinks/plugins/printing/ios`)
- sensors_plus (from `.symlinks/plugins/sensors_plus/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

EXTERNAL SOURCES:
Expand All @@ -52,30 +54,30 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/integration_test/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
printing:
:path: ".symlinks/plugins/printing/ios"
sensors_plus:
:path: ".symlinks/plugins/sensors_plus/ios"
shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
flutter_share: 4be0208963c60b537e6255ed2ce1faae61cd9ac2
flutter_web_auth: 09a0abd245f1a07a3ff4dcf1247a048d89ee12a9
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
printing: eafa00acb682c0ca029d4d98d0798f55a1e27102
flutter_web_auth: c25208760459cec375a3c39f6a8759165ca0fa4d
integration_test: 13825b8a9334a850581300559b8839134b124670
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
printing: 233e1b73bd1f4a05615548e9b5a324c98588640b
sensors_plus: 5717760720f7e6acd96fdbd75b7428f5ad755ec2
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

Expand Down
3 changes: 2 additions & 1 deletion app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -226,6 +226,7 @@
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
23 changes: 13 additions & 10 deletions app/lib/common/widgets/app.dart → app/lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'package:flutter_localizations/flutter_localizations.dart';

import '../models/metadata.dart';
import '../module.dart' hide MetaData;
import 'common/module.dart';

class PharMeApp extends StatelessWidget {
factory PharMeApp() => _instance;

PharMeApp._({Key? key}) : super(key: key);
PharMeApp._();

static final _instance = PharMeApp._();
static GlobalKey<NavigatorState> get navigatorKey =>
Expand All @@ -24,13 +23,17 @@ class PharMeApp extends StatelessWidget {
debugShowCheckedModeBanner: false,
routeInformationParser: _appRouter.defaultRouteParser(),
routerDelegate: _appRouter.delegate(
initialDeepLink: !_isLoggedIn
? 'login'
: !_onboardingDone
? 'onboarding'
: !_initialDrugSelectionDone
? 'drugselection'
: 'main',
deepLinkBuilder: (deepLink) {
late String path;
path = !_isLoggedIn
? 'login'
: !_onboardingDone
? 'onboarding'
: !_initialDrugSelectionDone
? 'drugselection'
: 'main';
return DeepLink.path(path);
},
),
theme: PharMeTheme.light,
localizationsDelegates: [
Expand Down
Loading

0 comments on commit 10f4e60

Please sign in to comment.