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

Sessions #20

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
344 changes: 340 additions & 4 deletions packages/catalog/pubspec.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion packages/cave/lib/cave.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library cave;
library;

export 'themes/themes.dart';
export 'widgets/widgets.dart';
Expand All @@ -12,3 +12,5 @@ export 'package:flutter_secure_storage/flutter_secure_storage.dart';
export 'utils/utils.dart';
export 'package:shared_preferences/shared_preferences.dart';
export 'package:shimmer/shimmer.dart';
export 'package:cached_network_image/cached_network_image.dart';
export 'package:qr_flutter/qr_flutter.dart';
2 changes: 0 additions & 2 deletions packages/cave/lib/utils/exceptions/base_exception.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import 'package:cave/cave.dart';
import 'client_exception.dart';
import 'empty_exception.dart';

base class Devfest2024Exception implements Exception {
const Devfest2024Exception();
Expand Down
1 change: 0 additions & 1 deletion packages/cave/lib/utils/network/data_transformer.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:cave/cave.dart';
import 'package:flutter/foundation.dart';
import '../exceptions/exceptions.dart';

typedef Devfest2024ExceptionOr<T> = Either<Devfest2024Exception, T>;
typedef FutureDevfest2024ExceptionOr<T> = Future<Devfest2024ExceptionOr<T>>;
Expand Down
12 changes: 12 additions & 0 deletions packages/cave/lib/utils/services/local_storage_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,23 @@ final class ConferenceAppStorageService {
iOptions: _getIosOptions(),
);

SharedPreferencesAsync get _sharedPreferencesInstance =>
SharedPreferencesAsync();

Future<void> setUserToken(String token) async {
return await _securedStorageInstance.write(key: 'user-token', value: token);
}

Future<String> get userToken async {
return await _securedStorageInstance.read(key: 'user-token') ?? '';
}

Future<void> setIsFirstLaunch(bool isFirstLaunch) async {
return await _sharedPreferencesInstance.setBool(
'is-first-launch', isFirstLaunch);
}

Future<bool> get isFirstLaunch async {
return await _sharedPreferencesInstance.getBool('is-first-launch') ?? true;
}
}
2 changes: 2 additions & 0 deletions packages/cave/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ dependencies:
flutter_secure_storage: ^9.2.2
shared_preferences: ^2.3.2
shimmer: ^3.0.0
cached_network_image: ^3.4.1
qr_flutter: ^4.1.0

dev_dependencies:
flutter_lints: ^5.0.0
Expand Down
23 changes: 12 additions & 11 deletions packages/conferenceapp/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="Devfest24"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:label="Devfest24">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
Expand All @@ -41,8 +42,8 @@
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
<action android:name="android.intent.action.PROCESS_TEXT" />
<data android:mimeType="text/plain" />
</intent>
</queries>
</manifest>
13 changes: 13 additions & 0 deletions packages/conferenceapp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ PODS:
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
Expand All @@ -85,6 +90,8 @@ DEPENDENCIES:
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -119,6 +126,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite_darwin:
:path: ".symlinks/plugins/sqflite_darwin/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
Firebase: cec914dab6fd7b1bd8ab56ea07ce4e03dd251c2d
Expand All @@ -143,6 +154,8 @@ SPEC CHECKSUMS:
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: 1959d098c91d8a792531a723c4a9d7e9f6a01e38

Expand Down
23 changes: 19 additions & 4 deletions packages/conferenceapp/lib/conference_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:devfest24/src/routing/routing.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'src/features/onboarding/presentation/presentation.dart';

class ConferenceApp extends ConsumerStatefulWidget {
const ConferenceApp({super.key});

Expand All @@ -17,14 +19,25 @@ class _ConferenceAppState extends ConsumerState<ConferenceApp> {
@override
void initState() {
super.initState();
Devfest2024Router.instance.initialiseRouter(ref);

Future.microtask(() async {
final [dynamic isFirstLaunch, dynamic token] = await Future.wait([
ConferenceAppStorageService.instance.isFirstLaunch,
ConferenceAppStorageService.instance.userToken,
]);

if (isFirstLaunch == true && (token.toString()).isEmpty) {
Devfest2024Router.rootNavigatorKey.currentContext
?.goNamedAndPopAll(OnboardingHomeScreen.route);
return;
}
});
}

void _unfocus() {
FocusManager.instance.primaryFocus?.unfocus();
}

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return GestureDetector(
Expand All @@ -33,9 +46,11 @@ class _ConferenceAppState extends ConsumerState<ConferenceApp> {
designSize: designSize,
minTextAdapt: true,
builder: (_, child) {
return MaterialApp.router(
return MaterialApp(
title: 'Devfest24 Conference App',
routerConfig: Devfest2024Router.instance.router,
navigatorKey: Devfest2024Router.rootNavigatorKey,
initialRoute: Devfest2024Router.initialRoute,
onGenerateRoute: Devfest2024Router.instance.onGenerateRoutes,
builder: (context, child) => AccessibilityTools(
minimumTapAreas: const MinimumTapAreas(mobile: 30, desktop: 44),
checkFontOverflows: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ final agendasViewModelNotifier =
() => AgendaViewModel(),
);

final dayOneSessionsProvider = Provider.autoDispose<List<SessionDto>>((ref) {
return ref.watch(agendasViewModelNotifier.select((vm) => vm.agendas
.where((agenda) => agenda.start?.day == 15)
.fold([], (previous, next) => [...previous, ...next.sessions.sessions])));
}, dependencies: [agendasViewModelNotifier]);
final dayTwoSessionsProvider = Provider.autoDispose<List<SessionDto>>((ref) {
return ref.watch(agendasViewModelNotifier.select((vm) => vm.agendas
.where((agenda) => agenda.start?.day == 16)
.fold([], (previous, next) => [...previous, ...next.sessions.sessions])));
}, dependencies: [agendasViewModelNotifier]);

final class AgendaViewModel extends AutoDisposeNotifier<AgendaUiState> {
late DashboardApiService _apiService;

Expand All @@ -27,7 +38,17 @@ final class AgendaViewModel extends AutoDisposeNotifier<AgendaUiState> {

state = model.emit(
result.fold(
(left) => state.copyWith(uiState: UiState.error, error: left),
(left) {
if (left is WithCachedDataException) {
return state.copyWith(
uiState: UiState.error,
error: left,
agendas: (left.result as AgendasDto).agendas,
);
}

return state.copyWith(uiState: UiState.error, error: left);
},
(right) =>
state.copyWith(uiState: UiState.success, agendas: right.agendas),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ final speakersViewModelNotifier =
() => SpeakersViewModel(),
);

final dayOneSpeakersProvider = Provider.autoDispose<List<SpeakerDto>>((ref) {
return ref.watch(speakersViewModelNotifier.select((vm) => vm.speakers
.where((speaker) => speaker.sessions
.where((session) => session.startTime!.day == 15)
.isNotEmpty)
.toList()));
}, dependencies: [speakersViewModelNotifier]);
final dayTwoSpeakersProvider = Provider.autoDispose<List<SpeakerDto>>((ref) {
return ref.watch(speakersViewModelNotifier.select((vm) => vm.speakers
.where((speaker) => speaker.sessions
.where((session) => session.startTime!.day == 16)
.isNotEmpty)
.toList()));
}, dependencies: [speakersViewModelNotifier]);

final class SpeakersViewModel extends AutoDisposeNotifier<SpeakersUiState> {
late DashboardApiService _apiService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ final sponsorsViewModelNotifier =
() => SponsorsViewModel(),
);

final sponsorsProvider = Provider.autoDispose<List<SponsorDto>>((ref) {
return ref.watch(sponsorsViewModelNotifier.select((vm) => vm.sponsorCategories
.fold(<SponsorDto>[],
(previous, next) => [...previous, ...next.sponsors])));
});

final class SponsorsViewModel extends AutoDisposeNotifier<SponsorsUiState> {
late DashboardApiService _apiService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ final class UserViewModel extends AutoDisposeNotifier<UserUiState> {
(right) => state.copyWith(uiState: UiState.success, user: right),
),
);
});
}, displayError: false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:cave/cave.dart';
import 'package:devfest24/src/features/dashboard/application/application.dart';
import 'package:devfest24/src/features/home/presentation/presentation.dart';
import 'package:devfest24/src/features/more/presentation/presentation.dart';
import 'package:devfest24/src/features/reserve/presentation/presentation.dart';
import 'package:devfest24/src/features/schedule/presentation/presentation.dart';
import 'package:devfest24/src/features/speakers/presentation/presentation.dart';
import 'package:flutter/material.dart';
Expand All @@ -11,11 +10,16 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../../shared/shared.dart';

class DashboardScreen extends StatelessWidget {
static const route = '/home';

const DashboardScreen({super.key});

@override
Widget build(BuildContext context) {
return const DefaultTabController(length: 5, child: _View());
return DefaultTabController(
length: _ViewState._tabs.length,
child: _View(),
);
}
}

Expand All @@ -32,7 +36,6 @@ class _ViewState extends ConsumerState<_View> {
KeepAliveWidget(child: HomeScreen()),
KeepAliveWidget(child: ScheduleHomeScreen()),
KeepAliveWidget(child: SpeakersHomeScreen()),
KeepAliveWidget(child: ReserveHomeScreen()),
KeepAliveWidget(child: MoreHomeScreen()),
];

Expand All @@ -57,6 +60,7 @@ class _ViewState extends ConsumerState<_View> {
ref.read(speakersViewModelNotifier.notifier).fetchSpeakers(),
ref.read(agendasViewModelNotifier.notifier).fetchAgenda(),
]);
ConferenceAppStorageService.instance.setIsFirstLaunch(false);
});
}

Expand Down Expand Up @@ -94,10 +98,6 @@ class _ViewState extends ConsumerState<_View> {
label: 'Speakers',
icon: Icon(IconsaxOutline.microphone),
),
DevfestBottomNavItem(
label: 'Reserve',
icon: Icon(IconsaxOutline.ticket),
),
DevfestBottomNavItem(
label: 'More',
icon: Icon(IconsaxOutline.more_square),
Expand Down
Loading
Loading