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

Wallabag integration #185

Closed
wants to merge 12 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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ coverage/
packages/**/pubspec.lock

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols
Expand Down
21 changes: 12 additions & 9 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "593a031efb1e54aef4d083fc810482c2877ba1d2"
revision: "476aa717cd342d11e16439b71f4f4c9209c50712"
channel: "beta"

project_type: app
Expand All @@ -13,17 +13,20 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 593a031efb1e54aef4d083fc810482c2877ba1d2
base_revision: 593a031efb1e54aef4d083fc810482c2877ba1d2
create_revision: 476aa717cd342d11e16439b71f4f4c9209c50712
base_revision: 476aa717cd342d11e16439b71f4f4c9209c50712
- platform: android
create_revision: 593a031efb1e54aef4d083fc810482c2877ba1d2
base_revision: 593a031efb1e54aef4d083fc810482c2877ba1d2
create_revision: 476aa717cd342d11e16439b71f4f4c9209c50712
base_revision: 476aa717cd342d11e16439b71f4f4c9209c50712
- platform: ios
create_revision: 593a031efb1e54aef4d083fc810482c2877ba1d2
base_revision: 593a031efb1e54aef4d083fc810482c2877ba1d2
create_revision: 476aa717cd342d11e16439b71f4f4c9209c50712
base_revision: 476aa717cd342d11e16439b71f4f4c9209c50712
- platform: linux
create_revision: 476aa717cd342d11e16439b71f4f4c9209c50712
base_revision: 476aa717cd342d11e16439b71f4f4c9209c50712
- platform: macos
create_revision: 593a031efb1e54aef4d083fc810482c2877ba1d2
base_revision: 593a031efb1e54aef4d083fc810482c2877ba1d2
create_revision: 476aa717cd342d11e16439b71f4f4c9209c50712
base_revision: 476aa717cd342d11e16439b71f4f4c9209c50712

# User provided section

Expand Down
Binary file modified android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png
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 android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png
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 android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png
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 android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png
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.
1 change: 0 additions & 1 deletion android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
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 android/app/src/main/res/mipmap-mdpi/ic_launcher.png
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 android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
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 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
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 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/wallabag/logo-icon-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/wallabag/logo-icon-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions flutter_launcher_icons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ flutter_launcher_icons:
ios: true
macos:
generate: true
web:
generate: true
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
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 ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
6 changes: 4 additions & 2 deletions lib/app/bootstrap/bootstrap.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:developer';
import 'dart:io';

import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
Expand All @@ -23,7 +22,9 @@ Future<void> bootstrap(

WidgetsFlutterBinding.ensureInitialized();
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
if (Platform.isAndroid) await FlutterDisplayMode.setHighRefreshRate();
if (defaultTargetPlatform == TargetPlatform.android) {
await FlutterDisplayMode.setHighRefreshRate();
}

Bloc.observer = const AppBlocObserver();
HydratedBloc.storage = await HydratedStorage.build(
Expand All @@ -35,6 +36,7 @@ Future<void> bootstrap(

final appContainer = await AppContainer.create();
unawaited(appContainer.authCubit.init());
unawaited(appContainer.wallabagCubit.validate());
final appRouter = AppRouter.create(appContainer);

runApp(await builder(appContainer, appRouter, deviceInfo));
Expand Down
4 changes: 4 additions & 0 deletions lib/app/container/app_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'package:glider/story_similar/cubit/story_similar_cubit.dart';
import 'package:glider/submit/cubit/submit_cubit.dart';
import 'package:glider/user/cubit/user_cubit.dart';
import 'package:glider/user_item_search/bloc/user_item_search_bloc.dart';
import 'package:glider/wallabag/cubit/wallabag_cubit.dart';
import 'package:glider_data/glider_data.dart';
import 'package:glider_domain/glider_domain.dart';
import 'package:http/http.dart' as http;
Expand All @@ -44,6 +45,7 @@ class AppContainer {
const AppContainer(
this.navigationShellCubit,
this.authCubit,
this.wallabagCubit,
this.settingsCubit,
this.storiesCubit,
this.storiesSearchBloc,
Expand Down Expand Up @@ -100,6 +102,7 @@ class AppContainer {
return AppContainer(
NavigationShellCubit(packageRepository),
AuthCubit(authRepository, itemInteractionRepository, cookieManager),
WallabagCubit(authRepository),
SettingsCubit(
settingsRepository,
packageRepository,
Expand Down Expand Up @@ -134,6 +137,7 @@ class AppContainer {

final NavigationShellCubit navigationShellCubit;
final AuthCubit authCubit;
final WallabagCubit wallabagCubit;
final SettingsCubit settingsCubit;
final StoriesCubit storiesCubit;
final StoriesSearchBloc storiesSearchBloc;
Expand Down
3 changes: 2 additions & 1 deletion lib/app/models/app_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ enum AppRoute {
user,
userValueDialog(parent: user),
textSelectDialog,
confirmDialog;
confirmDialog,
wallabagAddArticleDialog;

const AppRoute({this.parent});

Expand Down
21 changes: 21 additions & 0 deletions lib/app/router/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import 'package:glider/stories_search/view/catch_up_shell_page.dart';
import 'package:glider/submit/view/submit_page.dart';
import 'package:glider/user/view/user_page.dart';
import 'package:glider/user/widgets/user_value_dialog.dart';
import 'package:glider/wallabag/widgets/wallabag_add_article_dialog.dart';
import 'package:glider/whats_new/view/whats_new_page.dart';
import 'package:go_router/go_router.dart';

Expand Down Expand Up @@ -56,6 +57,7 @@ class AppRouter {
appContainer.itemCubitFactory,
appContainer.authCubit,
appContainer.settingsCubit,
appContainer.wallabagCubit,
),
),
),
Expand All @@ -71,6 +73,7 @@ class AppRouter {
appContainer.itemCubitFactory,
appContainer.authCubit,
appContainer.settingsCubit,
appContainer.wallabagCubit,
),
),
),
Expand All @@ -86,6 +89,7 @@ class AppRouter {
appContainer.itemCubitFactory,
appContainer.authCubit,
appContainer.settingsCubit,
appContainer.wallabagCubit,
),
),
),
Expand All @@ -101,6 +105,7 @@ class AppRouter {
appContainer.itemCubitFactory,
appContainer.authCubit,
appContainer.settingsCubit,
appContainer.wallabagCubit,
),
),
),
Expand All @@ -125,6 +130,7 @@ class AppRouter {
child: AuthPage(
appContainer.authCubit,
appContainer.settingsCubit,
appContainer.wallabagCubit,
appContainer.userCubitFactory,
appContainer.itemCubitFactory,
appContainer.userItemSearchBlocFactory,
Expand All @@ -138,6 +144,7 @@ class AppRouter {
fullscreenDialog: true,
child: SettingsPage(
appContainer.settingsCubit,
appContainer.wallabagCubit,
),
),
parentNavigatorKey: rootNavigatorKey,
Expand Down Expand Up @@ -184,6 +191,7 @@ class AppRouter {
appContainer.storyItemSearchCubitFactory,
appContainer.authCubit,
appContainer.settingsCubit,
appContainer.wallabagCubit,
id: int.parse(state.uri.queryParameters['id']!),
),
),
Expand Down Expand Up @@ -221,6 +229,7 @@ class AppRouter {
appContainer.itemCubitFactory,
appContainer.authCubit,
appContainer.settingsCubit,
appContainer.wallabagCubit,
id: int.parse(state.uri.queryParameters['id']!),
title: state.extra as String?,
),
Expand All @@ -238,6 +247,7 @@ class AppRouter {
appContainer.userItemSearchBlocFactory,
appContainer.authCubit,
appContainer.settingsCubit,
appContainer.wallabagCubit,
username: state.uri.queryParameters['id']!,
),
),
Expand Down Expand Up @@ -277,6 +287,17 @@ class AppRouter {
),
parentNavigatorKey: rootNavigatorKey,
),
GoRoute(
path: AppRoute.wallabagAddArticleDialog.path,
pageBuilder: (context, state) => DialogPage<void>(
builder: (context) => WallabagAddArticleDialog(
(state.extra as WallabagAddArticleExtra?)!.wallabagCubit,
(state.extra as WallabagAddArticleExtra?)!.itemCubit,
appContainer.settingsCubit,
),
),
parentNavigatorKey: rootNavigatorKey,
),
],
),
);
Expand Down
4 changes: 4 additions & 0 deletions lib/auth/view/auth_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ import 'package:glider/common/extensions/widget_list_extension.dart';
import 'package:glider/l10n/extensions/app_localizations_extension.dart';
import 'package:glider/settings/cubit/settings_cubit.dart';
import 'package:glider/user/view/user_page.dart';
import 'package:glider/wallabag/cubit/wallabag_cubit.dart';
import 'package:go_router/go_router.dart';

class AuthPage extends StatefulWidget {
const AuthPage(
this._authCubit,
this._settingsCubit,
this._wallabagCubit,
this._userCubitFactory,
this._itemCubitFactory,
this._userItemSearchBlocFactory, {
Expand All @@ -28,6 +30,7 @@ class AuthPage extends StatefulWidget {

final AuthCubit _authCubit;
final SettingsCubit _settingsCubit;
final WallabagCubit _wallabagCubit;
final UserCubitFactory _userCubitFactory;
final ItemCubitFactory _itemCubitFactory;
final UserItemSearchBlocFactory _userItemSearchBlocFactory;
Expand Down Expand Up @@ -89,6 +92,7 @@ class _AuthPageState extends State<AuthPage> {
widget._userItemSearchBlocFactory,
widget._authCubit,
widget._settingsCubit,
widget._wallabagCubit,
username: state.username!,
)
: Scaffold(
Expand Down
8 changes: 7 additions & 1 deletion lib/common/interfaces/menu_item.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import 'package:flutter/widgets.dart';
import 'package:glider/auth/cubit/auth_cubit.dart';
import 'package:glider/settings/cubit/settings_cubit.dart';
import 'package:glider/wallabag/cubit/wallabag_cubit.dart';

abstract interface class MenuItem<S> {
bool isVisible(S state, AuthState authState, SettingsState settingsState);
bool isVisible(
S state,
AuthState authState,
SettingsState settingsState,
WallabagState? wallabagState,
);

IconData? icon(S state);

Expand Down
11 changes: 9 additions & 2 deletions lib/favorites/view/favorites_shell_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:glider/item/widgets/item_tile.dart';
import 'package:glider/l10n/extensions/app_localizations_extension.dart';
import 'package:glider/navigation_shell/models/navigation_shell_action.dart';
import 'package:glider/settings/cubit/settings_cubit.dart';
import 'package:glider/wallabag/cubit/wallabag_cubit.dart';
import 'package:glider_domain/glider_domain.dart';
import 'package:go_router/go_router.dart';

Expand All @@ -23,14 +24,16 @@ class FavoritesShellPage extends StatefulWidget {
this._favoritesCubit,
this._itemCubitFactory,
this._authCubit,
this._settingsCubit, {
this._settingsCubit,
this._wallabagCubit, {
super.key,
});

final FavoritesCubit _favoritesCubit;
final ItemCubitFactory _itemCubitFactory;
final AuthCubit _authCubit;
final SettingsCubit _settingsCubit;
final WallabagCubit _wallabagCubit;

@override
State<FavoritesShellPage> createState() => _FavoritesShellPageState();
Expand Down Expand Up @@ -61,6 +64,7 @@ class _FavoritesShellPageState extends State<FavoritesShellPage> {
widget._itemCubitFactory,
widget._authCubit,
widget._settingsCubit,
widget._wallabagCubit,
),
),
const SliverPadding(
Expand Down Expand Up @@ -97,7 +101,7 @@ class _SliverFavoritesAppBar extends StatelessWidget {
builder: (context, settingsState) => MenuAnchor(
menuChildren: [
for (final action in NavigationShellAction.values)
if (action.isVisible(null, authState, settingsState))
if (action.isVisible(null, authState, settingsState, null))
MenuItemButton(
onPressed: () async => action.execute(context),
child: Text(action.label(context, null)),
Expand All @@ -124,12 +128,14 @@ class _SliverFavoritesBody extends StatelessWidget {
this._itemCubitFactory,
this._authCubit,
this._settingsCubit,
this._wallabagCubit,
);

final FavoritesCubit _favoritesCubit;
final ItemCubitFactory _itemCubitFactory;
final AuthCubit _authCubit;
final SettingsCubit _settingsCubit;
final WallabagCubit _wallabagCubit;

@override
Widget build(BuildContext context) {
Expand All @@ -153,6 +159,7 @@ class _SliverFavoritesBody extends StatelessWidget {
_itemCubitFactory,
_authCubit,
_settingsCubit,
_wallabagCubit,
id: id,
loadingType: ItemType.story,
onTap: (context, item) async => context.push(
Expand Down
Loading
Loading