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

Interactive Book Integration Phase 1 | GSoC 2021 #112

Merged
merged 48 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
19afd28
Bringup Interactive Book UI Views.
manjotsidhu Jun 7, 2021
b3bab59
IbPageView: Implement Table of Contents UI.
manjotsidhu Jun 8, 2021
2a230d2
IbPageView: Fading Floating Action Buttons for readability
manjotsidhu Jun 9, 2021
540b22c
IbPageView: Improve Floating Action Buttons.
manjotsidhu Jun 11, 2021
2230d48
IbLandingView: Seperate Actions for Expandable tile Drawer
manjotsidhu Jun 11, 2021
cf7b7c5
UI Tests: Fix Landing View Test due to recent changes
manjotsidhu Jun 12, 2021
d2a2fa3
GH Actions: Temporarily enable ib branch to run CI.
manjotsidhu Jun 12, 2021
3cf60e2
Models: Bringup Interactive Book Models.
manjotsidhu Jun 12, 2021
dffdeda
Services: Implement Interactive Book APIs
manjotsidhu Jun 13, 2021
90a58d1
IbPageView: Use camelCasing for constructor variable.
manjotsidhu Jun 13, 2021
06eda81
Tests: Fix IbApiTest typo.
manjotsidhu Jun 13, 2021
abc3a9b
Models: Replace IbRawPage with IbChapter.
manjotsidhu Jun 13, 2021
339c577
Ib: Models: Format code
manjotsidhu Jun 13, 2021
e2c6d28
Services: Bringup Interactive Book Engine
manjotsidhu Jun 15, 2021
a7a49c7
Implement Interactive Book ViewModels.
manjotsidhu Jun 16, 2021
102c05b
IbEngineService: Implement Navigation
manjotsidhu Jun 17, 2021
52d47b1
IbEngineService: Implement Table of Contents parsing
manjotsidhu Jun 18, 2021
67122f4
IbEngine: Include Table of Contents Filters.
manjotsidhu Jun 22, 2021
970d662
IbChapter: Use obj ref for prev, next attrs
manjotsidhu Jun 22, 2021
a710623
Implement ViewModels to Interactive Book views.
manjotsidhu Jun 23, 2021
d8df87d
IbPageView: Format Code.
manjotsidhu Jun 25, 2021
2fa8ec7
Interactive Book: Switch to flutter_markdown
manjotsidhu Jun 26, 2021
7e76b63
IB: Bringup Simulator embeds extension using webview.
manjotsidhu Jun 27, 2021
0346d89
Switch to CV fork of flutter_markdown package
manjotsidhu Jun 28, 2021
cbdfaf8
Ib: Implement Chapter Contents for parent pages.
manjotsidhu Jun 28, 2021
4aa8fbd
Markdown: Fix h4 style.
manjotsidhu Jun 28, 2021
f22689b
Markdown: Set image root path as IB_BASE_URL.
manjotsidhu Jun 28, 2021
102c00f
Ib: Ignore Parsing Pop Quizes
manjotsidhu Jun 29, 2021
cfd225e
IbLiquidSyntax: Add support for images via liquid tags.
manjotsidhu Jun 29, 2021
25c52b0
IbEngine: Encode HTML characters using HtmlUnescape.
manjotsidhu Jun 29, 2021
8cb89e5
IbPageView: Launch absolute links on external browser. #104
manjotsidhu Jul 4, 2021
5a7a5b4
IbTheme: Independent of CVTheme.
manjotsidhu Jul 4, 2021
8412599
IbPageView: Use Scrollbar with ScrollView
manjotsidhu Jul 4, 2021
a7f8d28
IbPageView: Scrollbar: Disable always shown.
manjotsidhu Jul 4, 2021
b32d231
Upgrade Packages
manjotsidhu Jul 5, 2021
011b174
conf: update pod dependencies
Nitish145 Jul 6, 2021
e3d6944
conf: update pubspec.lock
Nitish145 Jul 6, 2021
c510f38
conf: update flutter SDK to support extensions
manjotsidhu Jul 6, 2021
ce1a78f
Services: Bringup hive database service.
manjotsidhu Jul 6, 2021
af32150
Fix typos.
manjotsidhu Jul 6, 2021
648ebe1
DatabaseServiceTest: Fix test for MacOS.
manjotsidhu Jul 6, 2021
ab8183f
Ib: Cache getChapters API using Hive.
manjotsidhu Jul 13, 2021
8a2000d
IbPageView: Reduce divider thickness.
manjotsidhu Jul 14, 2021
1c97f2f
IbLandingView: Highlight and expand selected chapter.
manjotsidhu Jul 14, 2021
d4eac3a
IbLandingView: Fixes and Improvements
manjotsidhu Jul 14, 2021
3139d7a
IbLandingView: properly init and dispose valueNotifier.
manjotsidhu Jul 15, 2021
6471528
Ib: Bringup HTML Interactions!
manjotsidhu Jul 20, 2021
2eaa0c2
conf: remove branch ib from CI triggers
Nitish145 Jul 21, 2021
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
3 changes: 3 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
# Get flutter dependencies.
- run: flutter pub get

# Run build runner to generate dart files
- run: flutter packages pub run --no-sound-null-safety build_runner build --delete-conflicting-outputs

# Check for any formatting issues in the code.
- run: flutter format --set-exit-if-changed .

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- ib
pull_request:

jobs:
Expand All @@ -27,6 +28,9 @@ jobs:
# Get flutter dependencies.
- run: flutter pub get

# Run build runner to generate dart files
- run: flutter packages pub run --no-sound-null-safety build_runner build --delete-conflicting-outputs

# Check for any formatting issues in the code.
- run: flutter format --set-exit-if-changed .

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ A detailed guide for multiple platforms setup could be find [here](https://flutt
- `flutter pub get` to get all the dependencies.
- `flutter run`

### Generating Files using Build Runner

`flutter packages pub run --no-sound-null-safety build_runner build`

### Android OAuth Config

This project uses flutter version 1.20.2 and hence the support for compile time variables. To use compile time variables pass them in `--dart-defines` as `flutter run --dart-define=VAR_NAME=VAR_VALUE`. Supported `dart-defines` include :
Expand Down
58 changes: 29 additions & 29 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ PODS:
- AppAuth/ExternalUserAgent (= 1.4.0)
- AppAuth/Core (1.4.0)
- AppAuth/ExternalUserAgent (1.4.0)
- FBSDKCoreKit (9.1.0):
- FBSDKCoreKit/Basics (= 9.1.0)
- FBSDKCoreKit/Core (= 9.1.0)
- FBSDKCoreKit/Basics (9.1.0)
- FBSDKCoreKit/Core (9.1.0):
- FBSDKCoreKit/Basics
- FBSDKLoginKit (9.1.0):
- FBSDKLoginKit/Login (= 9.1.0)
- FBSDKLoginKit/Login (9.1.0):
- FBSDKCoreKit (~> 9.1.0)
- FBSDKCoreKit (11.0.1):
- FBSDKCoreKit/Core (= 11.0.1)
- FBSDKCoreKit/Core (11.0.1):
- FBSDKCoreKit_Basics (~> 11.0.1)
- FBSDKCoreKit_Basics (11.0.1):
- FBSDKCoreKit_Basics/Basics (= 11.0.1)
- FBSDKCoreKit_Basics/Basics (11.0.1)
- FBSDKLoginKit (11.0.1):
- FBSDKLoginKit/Login (= 11.0.1)
- FBSDKLoginKit/Login (11.0.1):
- FBSDKCoreKit (~> 11.0.1)
- FBSDKCoreKit_Basics (~> 11.0.1)
- Flutter (1.0.0)
- flutter_facebook_auth (2.0.0):
- FBSDKCoreKit (~> 9.1.0)
- FBSDKLoginKit (~> 9.1.0)
- FBSDKCoreKit (~> 11.0.0)
- FBSDKLoginKit (~> 11.0.0)
- Flutter
- flutter_keyboard_visibility (0.0.1):
- Flutter
- flutter_secure_storage (3.3.1):
- Flutter
- flutter_web_auth (0.2.4):
- flutter_web_auth (0.3.0):
- Flutter
- google_sign_in (0.0.1):
- Flutter
Expand All @@ -32,14 +34,10 @@ PODS:
- AppAuth (~> 1.2)
- GTMAppAuth (~> 1.0)
- GTMSessionFetcher/Core (~> 1.1)
- GTMAppAuth (1.1.0):
- GTMAppAuth (1.2.2):
- AppAuth/Core (~> 1.4)
- GTMSessionFetcher (~> 1.4)
- GTMSessionFetcher (1.5.0):
- GTMSessionFetcher/Full (= 1.5.0)
- GTMSessionFetcher/Core (1.5.0)
- GTMSessionFetcher/Full (1.5.0):
- GTMSessionFetcher/Core (= 1.5.0)
- GTMSessionFetcher/Core (~> 1.5)
- GTMSessionFetcher/Core (1.6.1)
- image_picker (0.0.1):
- Flutter
- share (0.0.1):
Expand Down Expand Up @@ -74,6 +72,7 @@ SPEC REPOS:
trunk:
- AppAuth
- FBSDKCoreKit
- FBSDKCoreKit_Basics
- FBSDKLoginKit
- GoogleSignIn
- GTMAppAuth
Expand Down Expand Up @@ -109,24 +108,25 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
AppAuth: 31bcec809a638d7bd2f86ea8a52bd45f6e81e7c7
FBSDKCoreKit: a00fe2efd780c195a5e09201bf51c56106245b40
FBSDKLoginKit: d98498c598ec09de657385a9349a1f21119b7f86
FBSDKCoreKit: 38c9e29a3f1436362acacff6486d3a28628c288f
FBSDKCoreKit_Basics: 06780a4a12e16596bde8406add02c6aa1bf38616
FBSDKLoginKit: 8243e04c590c38b85c69fcf09d1234514d2475c3
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
flutter_facebook_auth: 4b170c07b7fce791497093fcc3f134fb215f3f07
flutter_facebook_auth: abc044072738b7baa90d80583dabdb1211614f0d
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
flutter_web_auth: b7465086188ce4413d7e8b23622583784b9007a7
flutter_web_auth: ede89bf8107b021cf16e769756d267d84d24e88b
google_sign_in: 6bd214b9c154f881422f5fe27b66aaa7bbd580cc
GoogleSignIn: 7137d297ddc022a7e0aa4619c86d72c909fa7213
GTMAppAuth: 197a8dabfea5d665224aa00d17f164fc2248dab9
GTMSessionFetcher: b3503b20a988c4e20cc189aa798fd18220133f52
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
GTMAppAuth: ad5c2b70b9a8689e1a04033c9369c4915bfcbe89
GTMSessionFetcher: 36689134877faeb055b27dfa4ccc9ceaa42e029e
image_picker: e06f7a68f000bd36f552c1847e33cda96ed31f1f
share: 0b2c3e82132f5888bccca3351c504d0003b3b410
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e
wakelock: bfc7955c418d0db797614075aabbc58a39ab5107
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b

PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa

Expand Down
2 changes: 2 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AppAuth/AppAuth.framework",
"${BUILT_PRODUCTS_DIR}/FBSDKCoreKit/FBSDKCoreKit.framework",
"${BUILT_PRODUCTS_DIR}/FBSDKCoreKit_Basics/FBSDKCoreKit_Basics.framework",
"${BUILT_PRODUCTS_DIR}/FBSDKLoginKit/FBSDKLoginKit.framework",
"${BUILT_PRODUCTS_DIR}/GTMAppAuth/GTMAppAuth.framework",
"${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework",
Expand All @@ -302,6 +303,7 @@
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppAuth.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKCoreKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKCoreKit_Basics.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKLoginKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMAppAuth.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework",
Expand Down
10 changes: 10 additions & 0 deletions lib/config/environment_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ class EnvironmentConfig {
defaultValue: 'https://circuitverse.org/api/v1',
);

static const String IB_API_BASE_URL = String.fromEnvironment(
'IB_API_BASE_URL',
defaultValue: 'https://learn.circuitverse.org/_api/pages',
);

static const String IB_BASE_URL = String.fromEnvironment(
'IB_BASE_URL',
defaultValue: 'https://learn.circuitverse.org',
);

// GITHUB OAUTH ENV VARIABLES
static const String GITHUB_OAUTH_CLIENT_ID = String.fromEnvironment(
'GITHUB_OAUTH_CLIENT_ID',
Expand Down
2 changes: 2 additions & 0 deletions lib/cv_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';

class CVTheme {
CVTheme._();

static Color textFieldLabelColor(context) {
return Theme.of(context).brightness == Brightness.dark
? Colors.grey[300]
Expand Down Expand Up @@ -70,6 +71,7 @@ class CVTheme {
static const Color bgCard = Color.fromRGBO(255, 255, 255, 0.9);
static const Color bgCardDark = Color.fromRGBO(97, 97, 97, 1);
static const Color htmlEditorBg = Color.fromRGBO(245, 245, 245, 1);

static const OutlineInputBorder primaryDarkOutlineBorder = OutlineInputBorder(
borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: CVTheme.primaryColorDark),
Expand Down
76 changes: 76 additions & 0 deletions lib/ib_theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import 'package:flutter/material.dart';

class IbTheme {
IbTheme._();

static ThemeData getThemeData(context) {
return Theme.of(context).copyWith(
primaryIconTheme: Theme.of(context).primaryIconTheme.copyWith(
color: Colors.white,
),
accentColor: IbTheme.primaryColor,
primaryColor: IbTheme.primaryColor,
textTheme: Theme.of(context).textTheme.apply(
fontFamily: IbTheme.fontFamily,
bodyColor: IbTheme.textColor(context),
),
primaryTextTheme: Theme.of(context).primaryTextTheme.apply(
fontFamily: IbTheme.fontFamily,
bodyColor: Colors.white,
),
accentTextTheme: Theme.of(context).accentTextTheme.apply(
fontFamily: IbTheme.fontFamily,
),
);
}

static Color textFieldLabelColor(context) {
return Theme.of(context).brightness == Brightness.dark
? Colors.grey[300]
: Colors.grey[600];
}

static Color textColor(context) {
return Theme.of(context).brightness == Brightness.dark
? Colors.white
: IbTheme.bodyTextColor;
}

static Color primaryHeadingColor(context) {
return Theme.of(context).brightness == Brightness.dark
? Colors.white
: IbTheme.headingTextColor;
}

static Color boxBg(context) {
return Theme.of(context).brightness == Brightness.dark
? bgCardDark
: bgCard;
}

static Color boxShadow(context) {
return Theme.of(context).brightness == Brightness.dark ? bgCardDark : grey;
}

static Color highlightText(context) {
return Theme.of(context).brightness == Brightness.dark
? primaryColor
: primaryColorDark;
}

static Color getPrimaryColor(context) {
return Theme.of(context).brightness == Brightness.dark
? IbTheme.brightPrimaryColor
: IbTheme.primaryColor;
}

static const Color primaryColor = Color.fromRGBO(2, 110, 87, 1);
static const Color brightPrimaryColor = Color.fromRGBO(0, 232, 179, 1);
static const Color primaryColorDark = Color.fromRGBO(2, 110, 87, 0.5);
static const Color bodyTextColor = Color.fromRGBO(92, 89, 98, 1);
static const Color headingTextColor = Color.fromRGBO(39, 38, 43, 1);
static const String fontFamily = 'Roboto';
static const Color grey = Color.fromRGBO(150, 150, 150, 1);
static const Color bgCard = Color.fromRGBO(255, 255, 255, 0.9);
static const Color bgCardDark = Color.fromRGBO(97, 97, 97, 1);
}
19 changes: 19 additions & 0 deletions lib/locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import 'package:mobile_app/services/API/fcm_api.dart';
import 'package:mobile_app/services/API/grades_api.dart';
import 'package:mobile_app/services/API/group_members_api.dart';
import 'package:mobile_app/services/API/groups_api.dart';
import 'package:mobile_app/services/API/ib_api.dart';
import 'package:mobile_app/services/API/projects_api.dart';
import 'package:mobile_app/services/API/users_api.dart';
import 'package:mobile_app/services/API/country_institute_api.dart';
import 'package:mobile_app/services/database_service.dart';
import 'package:mobile_app/services/dialog_service.dart';
import 'package:mobile_app/services/API/contributors_api.dart';
import 'package:mobile_app/services/ib_engine_service.dart';
import 'package:mobile_app/services/local_storage_service.dart';
import 'package:mobile_app/viewmodels/authentication/auth_options_viewmodel.dart';
import 'package:mobile_app/viewmodels/authentication/forgot_password_viewmodel.dart';
Expand All @@ -24,6 +27,8 @@ import 'package:mobile_app/viewmodels/groups/my_groups_viewmodel.dart';
import 'package:mobile_app/viewmodels/groups/new_group_viewmodel.dart';
import 'package:mobile_app/viewmodels/groups/update_assignment_viewmodel.dart';
import 'package:mobile_app/viewmodels/home/home_viewmodel.dart';
import 'package:mobile_app/viewmodels/ib/ib_landing_viewmodel.dart';
import 'package:mobile_app/viewmodels/ib/ib_page_viewmodel.dart';
import 'package:mobile_app/viewmodels/profile/edit_profile_viewmodel.dart';
import 'package:mobile_app/viewmodels/profile/profile_viewmodel.dart';
import 'package:mobile_app/viewmodels/profile/user_favourites_viewmodel.dart';
Expand All @@ -37,10 +42,16 @@ import 'package:mobile_app/viewmodels/about/about_viewmodel.dart';
GetIt locator = GetIt.instance;

Future<void> setupLocator() async {
// Dialog Service
locator.registerLazySingleton(() => DialogService());

// Local Storage Service
var localStorageService = await LocalStorageService.getInstance();
locator.registerSingleton<LocalStorageService>(localStorageService);

// Database Service
locator.registerLazySingleton<DatabaseService>(() => DatabaseServiceImpl());

// API Services
locator.registerLazySingleton<ContributorsApi>(() => HttpContributorsApi());
locator.registerLazySingleton<UsersApi>(() => HttpUsersApi());
Expand All @@ -53,6 +64,10 @@ Future<void> setupLocator() async {
locator.registerLazySingleton<FCMApi>(() => HttpFCMApi());
locator.registerLazySingleton<CountryInstituteAPI>(
() => HttpCountryInstituteAPI());
locator.registerLazySingleton<IbApi>(() => HttpIbApi());

// Interactive Book Engine Service
locator.registerLazySingleton<IbEngineService>(() => IbEngineServiceImpl());

// Startup ViewModel
locator.registerFactory(() => StartUpViewModel());
Expand Down Expand Up @@ -89,4 +104,8 @@ Future<void> setupLocator() async {
locator.registerFactory(() => AddAssignmentViewModel());
locator.registerFactory(() => UpdateAssignmentViewModel());
locator.registerFactory(() => AssignmentDetailsViewModel());

// Interactive Book ViewModels
locator.registerFactory(() => IbLandingViewModel());
locator.registerFactory(() => IbPageViewModel());
}
4 changes: 4 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:get/get.dart';
import 'package:mobile_app/cv_theme.dart';
import 'package:mobile_app/locale/locales.dart';
import 'package:mobile_app/locator.dart';
import 'package:mobile_app/services/database_service.dart';
import 'package:mobile_app/utils/router.dart';
import 'package:theme_provider/theme_provider.dart';
import 'ui/views/startup_view.dart';
Expand All @@ -16,6 +17,9 @@ Future<void> main() async {
// Register all the models and services before the app starts
await setupLocator();

// Init Hive
await locator<DatabaseService>().init();

runApp(CircuitVerseMobile());
}

Expand Down
2 changes: 1 addition & 1 deletion lib/models/failure_model.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Failure {
class Failure implements Exception {
final String message;

Failure(this.message);
Expand Down
27 changes: 27 additions & 0 deletions lib/models/ib/ib_chapter.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:flutter/material.dart';

class IbChapter {
final String id;
final String value;
final String navOrder;
IbChapter prev;
IbChapter next;
final List<IbChapter> items;

IbChapter({
@required this.id,
@required this.value,
@required this.navOrder,
this.prev,
this.next,
this.items,
});

set prevPage(IbChapter prev) => this.prev = prev;
set nextPage(IbChapter next) => this.next = next;

@override
String toString() {
return '{id: $id, prev: ${prev?.id}, next: ${next?.id}';
}
}
17 changes: 17 additions & 0 deletions lib/models/ib/ib_content.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';

abstract class IbContent {
String content;

IbContent({@required this.content});
}

class IbTocItem extends IbContent {
final List<IbTocItem> items;

IbTocItem({@required String content, this.items}) : super(content: content);
}

class IbMd extends IbContent {
IbMd({@required String content}) : super(content: content);
}
Loading