Skip to content

Commit

Permalink
Merge pull request #315 from lamarios/feature/data-source-notifications
Browse files Browse the repository at this point in the history
add background service
  • Loading branch information
lamarios authored Sep 21, 2023
2 parents 597e88e + c3694e1 commit e7abaad
Show file tree
Hide file tree
Showing 191 changed files with 6,082 additions and 2,404 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>

<uses-feature android:name="android.software.leanback"
android:required="false"/>
Expand Down
Binary file added android/app/src/main/res/drawable/app_icon.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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<foreground android:drawable="@mipmap/ic_launcher_foreground" />

<monochrome android:drawable="@mipmap/ic_launcher_monochrome_foreground" />
</adaptive-icon>
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/4029.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add foreground service to get notified on new content (subscriptions / channel / playlists)
Fix search
Split settings in multiple settings sub pages as it was getting too big
22 changes: 9 additions & 13 deletions lib/app/states/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@ import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:flutter/material.dart';
import 'package:invidious/router.dart';
import 'package:logging/logging.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';

import '../../database.dart';
import '../../globals.dart';
import '../../home/models/db/home_layout.dart';
import '../../main.dart';
import '../../settings/models/db/server.dart';
import '../../videos/views/screens/video.dart';

part 'app.g.dart';

final log = Logger('HomeState');

class AppCubit extends Cubit<AppState> {

AppCubit(super.initialState) {
onReady();
}
Expand Down Expand Up @@ -51,19 +50,15 @@ class AppCubit extends Cubit<AppState> {
try {
Uri uri = Uri.parse(url);
if (YOUTUBE_HOSTS.contains(uri.host)) {
if (uri.pathSegments.length == 1 && uri.pathSegments.contains("watch") && uri.queryParameters.containsKey('v')) {
if (uri.pathSegments.length == 1 &&
uri.pathSegments.contains("watch") &&
uri.queryParameters.containsKey('v')) {
String videoId = uri.queryParameters['v']!;
navigatorKey.currentState?.push(MaterialPageRoute(
builder: (context) => VideoView(
videoId: videoId,
)));
appRouter.push(VideoRoute(videoId: videoId));
}
if (uri.host == 'youtu.be' && uri.pathSegments.length == 1) {
String videoId = uri.pathSegments[0];
navigatorKey.currentState?.push(MaterialPageRoute(
builder: (context) => VideoView(
videoId: videoId,
)));
appRouter.push(VideoRoute(videoId: videoId));
}
}
} catch (err, stacktrace) {
Expand All @@ -88,7 +83,8 @@ class AppCubit extends Cubit<AppState> {
emit(state.copyWith(homeLayout: db.getHomeLayout()));
}

bool get isLoggedIn => (state.server?.authToken?.isNotEmpty ?? false) || (state.server?.sidCookie?.isNotEmpty ?? false);
bool get isLoggedIn =>
(state.server?.authToken?.isNotEmpty ?? false) || (state.server?.sidCookie?.isNotEmpty ?? false);
}

@CopyWith(constructor: "_")
Expand Down
10 changes: 5 additions & 5 deletions lib/app/states/tv_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ class TvHomeCubit extends Cubit<TvHomeState> {
}
}

scrollToTop(){
scrollToTop() {
state.scrollController.animateTo(0, duration: animationDuration, curve: Curves.easeInOutQuad);
}
}

@CopyWith(constructor: "_")
class TvHomeState{
bool expandMenu = false;
ScrollController scrollController = ScrollController();
class TvHomeState {
bool expandMenu = false;
ScrollController scrollController = ScrollController();

TvHomeState();
TvHomeState();

TvHomeState._(this.expandMenu, this.scrollController);
}
23 changes: 23 additions & 0 deletions lib/app/views/screens/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:invidious/player/views/components/player.dart';

import '../../../player/views/components/mini_player_aware.dart';

@RoutePage()
class MainScreen extends StatelessWidget {
const MainScreen({super.key});

@override
Widget build(BuildContext context) {
return const Stack(
children: [
MiniPlayerAware(
child: AutoRouter(),
),
Player()
],
);
}
}
Loading

0 comments on commit e7abaad

Please sign in to comment.