Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Commit

Permalink
WIP: Add Nextcloud Talk
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin committed May 20, 2020
1 parent d235461 commit 861dbcf
Show file tree
Hide file tree
Showing 40 changed files with 1,905 additions and 359 deletions.
2 changes: 2 additions & 0 deletions apps/viktoriaapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ features:
full_name: Timetable
- name: substitution_plan
full_name: SubstitutionPlan
- name: nextcloud_talk
full_name: NextcloudTalk
- name: calendar
full_name: Calendar
- name: cafetoria
Expand Down
2 changes: 2 additions & 0 deletions apps/viktoriamanagement.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ features:
full_name: Timetable
- name: substitution_plan
full_name: SubstitutionPlan
- name: nextcloud_talk
full_name: NextcloudTalk
- name: ipad_list
full_name: IPadList
firebase_web:
Expand Down
19 changes: 13 additions & 6 deletions features/aixformation/lib/src/aixformation_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,20 @@ class AiXformationRow extends PreferredSize {
},
child: CustomRow(
leading: CustomCachedNetworkImage(
imageUrl: post.imageUrl,
height: 60,
width: 60,
provider: CustomCachedNetworkImageUrlProvider(
imageUrl: post.imageUrl,
),
height: customRowHeight - 26,
width: customRowHeight - 26,
),
title: Text(
post.title,
style: TextStyle(
fontSize: 17,
color: ThemeWidget.of(context).textColor,
),
overflow: TextOverflow.ellipsis,
),
title: post.title,
titleColor: ThemeWidget.of(context).textColor,
titleFontWeight: FontWeight.normal,
subtitle: IconsTexts(
icons: [
Icons.event,
Expand Down
9 changes: 8 additions & 1 deletion features/cafetoria/lib/src/cafetoria_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ class CafetoriaRow extends PreferredSize {
Icons.restaurant,
color: ThemeWidget.of(context).textColorLight,
),
title: menu.name,
title: Text(
menu.name,
style: TextStyle(
fontSize: 17,
color: Theme.of(context).accentColor,
),
overflow: TextOverflow.ellipsis,
),
subtitle: menu.price != 0 || menu.time.isNotEmpty
? IconsTexts(
icons: [
Expand Down
1 change: 0 additions & 1 deletion features/calendar/lib/src/calendar_events.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore: public_member_api_docs
import 'package:utils/utils.dart';

// ignore: public_member_api_docs
Expand Down
10 changes: 8 additions & 2 deletions features/calendar/lib/src/calendar_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ class CalendarRow extends PreferredSize {
Icons.calendar_today,
color: ThemeWidget.of(context).textColorLight,
),
title: '${event.name}',
titleOverflow: TextOverflow.ellipsis,
title: Text(
event.name,
style: TextStyle(
fontSize: 17,
color: Theme.of(context).accentColor,
),
overflow: TextOverflow.ellipsis,
),
subtitle: Text(
event.dateString,
style: TextStyle(
Expand Down
10 changes: 8 additions & 2 deletions features/ipad_list/lib/src/ipad_list_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,14 @@ class IPadGroupRow extends PreferredSize {
),
],
),
title: '${IPadListLocalizations.iPadGroup}: $groupName',
titleOverflow: TextOverflow.ellipsis,
title: Text(
'${IPadListLocalizations.iPadGroup}: $groupName',
style: TextStyle(
fontSize: 17,
color: Theme.of(context).accentColor,
),
overflow: TextOverflow.ellipsis,
),
subtitle: Row(
children: <Widget>[
Text(
Expand Down
12 changes: 6 additions & 6 deletions features/ipad_list/lib/src/ipad_list_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class _HistoryLoader extends Loader<DeviceHistory> {
final status = super.loadOffline(context);
// Save the parsed data in an extra attribute, because after each load online call,
// the parsed data will be override by the new data
_history.entries = parsedData?.entries ?? {};
_history.entries = data?.entries ?? {};
return status;
}

Expand All @@ -72,7 +72,7 @@ class _HistoryLoader extends Loader<DeviceHistory> {

// Add the loaded entries to the old entries
if (oldData != null) {
parsedData.entries.forEach((key, value) {
data.entries.forEach((key, value) {
_history.entries[key] = value;
});
}
Expand All @@ -81,8 +81,8 @@ class _HistoryLoader extends Loader<DeviceHistory> {
}

/// Returns the battery history for the given devices
Future<DeviceHistory> getDeviceHistory(BuildContext context,
List<IPad> devices, DateTime date,
Future<DeviceHistory> getDeviceHistory(
BuildContext context, List<IPad> devices, DateTime date,
{bool loadOffline = false}) async {
final ids = devices.map((d) => d.id).toList();

Expand All @@ -100,8 +100,8 @@ class _HistoryLoader extends Loader<DeviceHistory> {
final history = DeviceHistory(entries: {});
for (final device in devices) {
history.entries[device.id] = _history.entries[device.id]
?.where((d) => !d.lastModified.isBefore(date))
?.toList() ??
?.where((d) => !d.lastModified.isBefore(date))
?.toList() ??
[];
history.entries[device.id]
.sort((d1, d2) => d1.lastModified.compareTo(d2.lastModified));
Expand Down
10 changes: 8 additions & 2 deletions features/ipad_list/lib/src/ipad_list_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ class IPadRow extends PreferredSize {
color: ThemeWidget.of(context).textColorLight,
),
),
title: iPad.name,
titleOverflow: TextOverflow.ellipsis,
title: Text(
iPad.name,
style: TextStyle(
fontSize: 17,
color: Theme.of(context).accentColor,
),
overflow: TextOverflow.ellipsis,
),
subtitle: BatteryIndicator(
level: iPad.batteryLevel,
isCharging: iPad.isCharging,
Expand Down
79 changes: 79 additions & 0 deletions features/nextcloud_talk/lib/nextcloud_talk.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
library nextcloud_talk;

import 'package:flutter/material.dart';
import 'package:nextcloud_talk/src/nextcloud_talk_events.dart';
import 'package:nextcloud_talk/src/nextcloud_talk_keys.dart';
import 'package:nextcloud_talk/src/nextcloud_talk_loader.dart';
import 'package:utils/utils.dart';
import 'package:widgets/widgets.dart';

import 'src/nextcloud_talk_info_card.dart';
import 'src/nextcloud_talk_localizations.dart';
import 'src/nextcloud_talk_page.dart';

/// The Nextcloud Talk feature
class NextcloudTalkFeature implements Feature {
@override
String get name => NextcloudTalkLocalizations.name;

@override
String get featureKey => NextcloudTalkKeys.nextcloudTalk;

@override
List<String> dependsOn(BuildContext context) => null;

@override
NextcloudTalkLoader loader = NextcloudTalkLoader();

@override
NotificationsHandler get notificationsHandler => null;

@override
TagsHandler get tagsHandler => null;

@override
InfoCard getInfoCard(DateTime date, double maxHeight) =>
NextcloudTalkInfoCard(
date: date,
maxHeight: maxHeight,
);

@override
Widget getPage() => NextcloudTalkPage(key: ValueKey(featureKey));

@override
NextcloudTalkWidget getFeatureWidget(Widget child) => NextcloudTalkWidget(
feature: this,
key: ValueKey(featureKey),
child: child,
);

@override
DateTime getHomePageDate() => null;

@override
Duration durationToHomePageDateUpdate() => null;

@override
Subscription subscribeToDataUpdates(
EventBus eventBus, Function(ChangedEvent p1) callback) =>
eventBus.respond<NextcloudTalkUpdateEvent>(callback);
}

// ignore: public_member_api_docs
class NextcloudTalkWidget extends FeatureWidget<NextcloudTalkFeature> {
// ignore: public_member_api_docs
const NextcloudTalkWidget({
@required Widget child,
@required NextcloudTalkFeature feature,
Key key,
}) : super(
child: child,
feature: feature,
key: key,
);

/// Find the closest [NextcloudTalkWidget] from ancestor tree.
static NextcloudTalkWidget of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<NextcloudTalkWidget>();
}
Loading

0 comments on commit 861dbcf

Please sign in to comment.