-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1656 from nextcloud/feat/neon_talk/placeholder
- Loading branch information
Showing
32 changed files
with
372 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: "ead455963c12b453cdb2358cad34969c76daf180" | ||
channel: "stable" | ||
|
||
project_type: package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../assets/AGPL-3.0.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include: package:neon_lints/flutter.yaml | ||
|
||
analyzer: | ||
exclude: | ||
- lib/l10n/** |
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
arb-dir: lib/l10n | ||
template-arb-file: en.arb | ||
output-localization-file: localizations.dart | ||
synthetic-package: false | ||
output-class: TalkLocalizations | ||
output-dir: lib/l10n | ||
nullable-getter: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"@@locale": "en" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:flutter_localizations/flutter_localizations.dart'; | ||
import 'package:intl/intl.dart' as intl; | ||
|
||
import 'localizations_en.dart'; | ||
|
||
/// Callers can lookup localized strings with an instance of TalkLocalizations | ||
/// returned by `TalkLocalizations.of(context)`. | ||
/// | ||
/// Applications need to include `TalkLocalizations.delegate()` in their app's | ||
/// `localizationDelegates` list, and the locales they support in the app's | ||
/// `supportedLocales` list. For example: | ||
/// | ||
/// ```dart | ||
/// import 'l10n/localizations.dart'; | ||
/// | ||
/// return MaterialApp( | ||
/// localizationsDelegates: TalkLocalizations.localizationsDelegates, | ||
/// supportedLocales: TalkLocalizations.supportedLocales, | ||
/// home: MyApplicationHome(), | ||
/// ); | ||
/// ``` | ||
/// | ||
/// ## Update pubspec.yaml | ||
/// | ||
/// Please make sure to update your pubspec.yaml to include the following | ||
/// packages: | ||
/// | ||
/// ```yaml | ||
/// dependencies: | ||
/// # Internationalization support. | ||
/// flutter_localizations: | ||
/// sdk: flutter | ||
/// intl: any # Use the pinned version from flutter_localizations | ||
/// | ||
/// # Rest of dependencies | ||
/// ``` | ||
/// | ||
/// ## iOS Applications | ||
/// | ||
/// iOS applications define key application metadata, including supported | ||
/// locales, in an Info.plist file that is built into the application bundle. | ||
/// To configure the locales supported by your app, you’ll need to edit this | ||
/// file. | ||
/// | ||
/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file. | ||
/// Then, in the Project Navigator, open the Info.plist file under the Runner | ||
/// project’s Runner folder. | ||
/// | ||
/// Next, select the Information Property List item, select Add Item from the | ||
/// Editor menu, then select Localizations from the pop-up menu. | ||
/// | ||
/// Select and expand the newly-created Localizations item then, for each | ||
/// locale your application supports, add a new item and select the locale | ||
/// you wish to add from the pop-up menu in the Value field. This list should | ||
/// be consistent with the languages listed in the TalkLocalizations.supportedLocales | ||
/// property. | ||
abstract class TalkLocalizations { | ||
TalkLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString()); | ||
|
||
final String localeName; | ||
|
||
static TalkLocalizations of(BuildContext context) { | ||
return Localizations.of<TalkLocalizations>(context, TalkLocalizations)!; | ||
} | ||
|
||
static const LocalizationsDelegate<TalkLocalizations> delegate = _TalkLocalizationsDelegate(); | ||
|
||
/// A list of this localizations delegate along with the default localizations | ||
/// delegates. | ||
/// | ||
/// Returns a list of localizations delegates containing this delegate along with | ||
/// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, | ||
/// and GlobalWidgetsLocalizations.delegate. | ||
/// | ||
/// Additional delegates can be added by appending to this list in | ||
/// MaterialApp. This list does not have to be used at all if a custom list | ||
/// of delegates is preferred or required. | ||
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[ | ||
delegate, | ||
GlobalMaterialLocalizations.delegate, | ||
GlobalCupertinoLocalizations.delegate, | ||
GlobalWidgetsLocalizations.delegate, | ||
]; | ||
|
||
/// A list of this localizations delegate's supported locales. | ||
static const List<Locale> supportedLocales = <Locale>[Locale('en')]; | ||
} | ||
|
||
class _TalkLocalizationsDelegate extends LocalizationsDelegate<TalkLocalizations> { | ||
const _TalkLocalizationsDelegate(); | ||
|
||
@override | ||
Future<TalkLocalizations> load(Locale locale) { | ||
return SynchronousFuture<TalkLocalizations>(lookupTalkLocalizations(locale)); | ||
} | ||
|
||
@override | ||
bool isSupported(Locale locale) => <String>['en'].contains(locale.languageCode); | ||
|
||
@override | ||
bool shouldReload(_TalkLocalizationsDelegate old) => false; | ||
} | ||
|
||
TalkLocalizations lookupTalkLocalizations(Locale locale) { | ||
// Lookup logic when only language code is specified. | ||
switch (locale.languageCode) { | ||
case 'en': | ||
return TalkLocalizationsEn(); | ||
} | ||
|
||
throw FlutterError('TalkLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' | ||
'an issue with the localizations generation tool. Please file an issue ' | ||
'on GitHub with a reproducible sample app and the gen-l10n configuration ' | ||
'that was used.'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import 'localizations.dart'; | ||
|
||
/// The translations for English (`en`). | ||
class TalkLocalizationsEn extends TalkLocalizations { | ||
TalkLocalizationsEn([String locale = 'en']) : super(locale); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/// The Neon client for the Talk app. | ||
/// | ||
/// Add `TalkApp()` to your runNeon command to execute this app. | ||
library neon_talk; | ||
|
||
export 'src/app.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:built_collection/built_collection.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
import 'package:meta/meta.dart'; | ||
import 'package:neon_framework/models.dart'; | ||
import 'package:neon_talk/l10n/localizations.dart'; | ||
import 'package:neon_talk/src/blocs/talk.dart'; | ||
import 'package:neon_talk/src/options.dart'; | ||
import 'package:neon_talk/src/pages/main.dart'; | ||
import 'package:neon_talk/src/routes.dart'; | ||
import 'package:nextcloud/nextcloud.dart'; | ||
|
||
/// Implementation of the server `talk` app. | ||
@experimental | ||
class TalkApp extends AppImplementation<TalkBloc, TalkOptions> { | ||
/// Creates a new Talk app implementation instance. | ||
TalkApp(); | ||
|
||
@override | ||
final String id = 'talk'; | ||
|
||
@override | ||
final BuiltSet<String> additionalMatchingIDs = BuiltSet([AppIDs.spreed]); | ||
|
||
@override | ||
final LocalizationsDelegate<TalkLocalizations> localizationsDelegate = TalkLocalizations.delegate; | ||
|
||
@override | ||
final List<Locale> supportedLocales = TalkLocalizations.supportedLocales; | ||
|
||
@override | ||
late final TalkOptions options = TalkOptions(storage); | ||
|
||
@override | ||
TalkBloc buildBloc(Account account) => TalkBloc(account); | ||
|
||
@override | ||
final Widget page = const TalkMainPage(); | ||
|
||
@override | ||
final RouteBase route = $talkAppRoute; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:meta/meta.dart'; | ||
import 'package:neon_framework/blocs.dart'; | ||
import 'package:neon_framework/models.dart'; | ||
|
||
/// Bloc for fetching Talk rooms | ||
sealed class TalkBloc implements InteractiveBloc { | ||
/// Creates a new Talk Bloc instance. | ||
@internal | ||
factory TalkBloc(Account account) => _TalkBloc(account); | ||
} | ||
|
||
class _TalkBloc extends InteractiveBloc implements TalkBloc { | ||
_TalkBloc(this.account); | ||
|
||
final Account account; | ||
|
||
@override | ||
Future<void> refresh() async {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:neon_framework/settings.dart'; | ||
|
||
/// Settings options specific to the talk app. | ||
class TalkOptions extends AppImplementationOptions { | ||
/// Creates a new talk options instance. | ||
TalkOptions(super.storage) { | ||
super.categories = []; | ||
super.options = []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// The main page displaying the chat list. | ||
class TalkMainPage extends StatelessWidget { | ||
/// Creates a new Talk main page. | ||
const TalkMainPage({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) => const Placeholder(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
import 'package:neon_framework/utils.dart'; | ||
import 'package:neon_talk/src/pages/main.dart'; | ||
|
||
part 'routes.g.dart'; | ||
|
||
/// Route for the talk app. | ||
@TypedGoRoute<TalkAppRoute>( | ||
path: '${appsBaseRoutePrefix}talk', | ||
name: 'talk', | ||
) | ||
@immutable | ||
class TalkAppRoute extends NeonBaseAppRoute { | ||
/// Creates a new talk app route. | ||
const TalkAppRoute(); | ||
|
||
@override | ||
Widget build(BuildContext context, GoRouterState state) => const TalkMainPage(); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.