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

Feature/example #4

Merged
merged 50 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6b96736
Update documentation
PlugFox Aug 3, 2023
d82894f
Add metrics
PlugFox Aug 3, 2023
fc479ae
Add reconnects & subscriptions metrics
PlugFox Aug 3, 2023
cfdb468
Add metrics
PlugFox Aug 3, 2023
8962163
Update version
PlugFox Aug 3, 2023
a246168
Add override
PlugFox Aug 3, 2023
921db9b
Add metrics to readme
PlugFox Aug 3, 2023
58b36b5
Merge branch 'master' into feature/example
PlugFox Aug 3, 2023
453c432
Update metrics
PlugFox Aug 4, 2023
7f7fd71
Add generics
PlugFox Aug 4, 2023
ad8099e
Update subscription state
PlugFox Aug 4, 2023
e65beca
Update metrics documentation
PlugFox Aug 4, 2023
74c8503
Update codegeneration
PlugFox Aug 4, 2023
d586ecc
Update contribution guide
PlugFox Aug 4, 2023
9fa0dd1
Fix linter issues
PlugFox Aug 4, 2023
848826c
Bump release
PlugFox Aug 4, 2023
e478a3b
Add example
PlugFox Aug 4, 2023
c10900d
Fix subscribe
PlugFox Aug 4, 2023
9de40ad
Update readme
PlugFox Aug 4, 2023
7e9b9c6
Add example placeholder
PlugFox Aug 4, 2023
2ae2b48
Patch native platform
PlugFox Aug 4, 2023
d442fa8
Remove tests
PlugFox Aug 4, 2023
1be87a1
Add sign in form
PlugFox Aug 4, 2023
79101f3
Update sign in form
PlugFox Aug 4, 2023
f6ce9af
Update app
PlugFox Aug 4, 2023
31bdbe6
Update example
PlugFox Aug 12, 2023
af4b63b
Update location of chat connection repository
PlugFox Aug 12, 2023
f9c31a7
Add username by default
PlugFox Aug 12, 2023
f2d8471
Encode channels
PlugFox Aug 12, 2023
7d27e8c
Update launch
PlugFox Aug 12, 2023
09d33ab
Update message sender
PlugFox Aug 12, 2023
77366f3
Fix queue
PlugFox Aug 12, 2023
5a47158
Remove extra column
PlugFox Aug 12, 2023
ab7270c
Update chat room
PlugFox Aug 12, 2023
9a13562
Add placeholder subsriber
PlugFox Aug 12, 2023
28cbdf5
Update analysis options
PlugFox Sep 6, 2023
d4cd7a2
Update depricated
PlugFox Sep 6, 2023
8369a5e
Update chat subscription
PlugFox Sep 6, 2023
838b73e
Update chat message
PlugFox Sep 6, 2023
d4281de
Bump version to 0.0.1-pre.7
PlugFox Nov 2, 2023
7626815
Merge branch 'master' into feature/example
PlugFox Nov 2, 2023
a47330c
Update dependencies
PlugFox Nov 2, 2023
fed92c1
Do not get dependencies in example directory
PlugFox Nov 2, 2023
0833776
Update setting.json
PlugFox Feb 13, 2024
917db0e
Merge branch 'master' into feature/example
PlugFox Feb 13, 2024
dca6b5b
Update
PlugFox Feb 13, 2024
9b24337
Update editor settings in .vscode/settings.json
PlugFox May 2, 2024
b2433a0
Remove nodoc comments
PlugFox May 2, 2024
4cd67aa
Merge branch 'feature/example-logs' into feature/example
PlugFox May 2, 2024
0cd3e39
Update analysis options and localization.dart files, refactor Control…
PlugFox May 2, 2024
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
16 changes: 7 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.wordBasedSuggestions": false,
"editor.wordBasedSuggestions": "off",
"editor.selectionHighlight": false,
"editor.defaultFormatter": "Dart-Code.dart-code",
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.quickSuggestions": {
"comments": "on",
"strings": "on",
"other": "on"
},
"editor.links": true,
"editor.rulers": [80]
"editor.rulers": [
80
]
},
"dart.lineLength": 80,
"dart.doNotFormat": [
Expand All @@ -36,26 +38,22 @@
"**.pbjson.dart",
"**/generated/**"
],

// Flutter Version Manager
//"dart.flutterSdkPath": ".fvm/flutter_sdk",

// Remove .fvm files from search
"search.exclude": {
//"**/.fvm": true,
".dart_tool": true,
"coverage": true,
"build": true
},

// Remove from file watching
"files.watcherExclude": {
//"**/.fvm": true,
".dart_tool": true,
"coverage": true,
"build": true
},

// Causes the debug view to automatically appear when a breakpoint is hit. This
// setting is global and not configurable per-language.
"debug.openDebug": "openOnDebugBreak",
Expand Down Expand Up @@ -83,4 +81,4 @@
]
}
} */
}
}
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: format get test publish deploy centrifugo-up centrifugo-down coverage analyze check pana generate
.PHONY: format get outdated test publish deploy centrifugo-up centrifugo-down coverage analyze check pana generate

format:
@echo "Formatting the code"
Expand All @@ -8,6 +8,9 @@ format:
get:
@dart pub get

outdated:
@dart pub outdated --show-all --dev-dependencies --dependency-overrides --transitive --no-prereleases

test: get
@dart test --debug --coverage=.coverage --platform chrome,vm

Expand Down
3 changes: 0 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ linter:
avoid_js_rounded_ints: true
avoid_print: true
avoid_renaming_method_parameters: true
avoid_returning_null_for_future: true
avoid_returning_null_for_void: true
avoid_single_cascade_in_expression_statements: true
avoid_slow_async_io: true
Expand Down Expand Up @@ -140,7 +139,6 @@ linter:

# Pedantic 1.9.0
always_declare_return_types: true
always_require_non_null_named_parameters: true
annotate_overrides: true
avoid_empty_else: true
avoid_init_to_null: true
Expand Down Expand Up @@ -204,7 +202,6 @@ linter:
prefer_mixin: true
use_setters_to_change_properties: true
avoid_setters_without_getters: true
avoid_returning_null: true
avoid_returning_this: true
type_annotate_public_apis: true
avoid_types_on_closure_parameters: true
Expand Down
1 change: 1 addition & 0 deletions example/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
44 changes: 44 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
2 changes: 0 additions & 2 deletions example/lib/src/common/constant/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ enum EnvironmentFlavor {
/// Production
production('production');

/// {@nodoc}
const EnvironmentFlavor(this.value);

/// {@nodoc}
factory EnvironmentFlavor.from(String? value) =>
switch (value?.trim().toLowerCase()) {
'local' || 'loc' || 'lcl' || 'l' => development,
Expand Down
7 changes: 5 additions & 2 deletions example/lib/src/common/controller/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ abstract interface class IControllerObserver {
void onDispose(IController controller);

/// Called on any state change in the controller.
void onStateChanged(IController controller, Object prevState, Object nextState);
void onStateChanged(
IController controller, Object prevState, Object nextState);

/// Called on any error in the controller.
void onError(IController controller, Object error, StackTrace stackTrace);
}

/// {@template controller}
/// {@macro controller}
abstract base class Controller with ChangeNotifier implements IController {
/// {@macro controller}
Controller() {
runZonedGuarded<void>(
() => Controller.observer?.onCreate(this),
Expand All @@ -44,6 +46,7 @@ abstract base class Controller with ChangeNotifier implements IController {
/// Controller observer
static IControllerObserver? observer;

/// Whether the controller is disposed.
bool get isDisposed => _$isDisposed;
bool _$isDisposed = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ base mixin SequentialControllerConcurrency on Controller {
);
}

/// {@nodoc}
final class _ControllerEventQueue {
/// {@nodoc}
_ControllerEventQueue();

final DoubleLinkedQueue<_SequentialTask<Object?>> _queue =
Expand All @@ -57,11 +55,9 @@ final class _ControllerEventQueue {
bool _isClosed = false;

/// Event queue length.
/// {@nodoc}
int get length => _queue.length;

/// Push it at the end of the queue.
/// {@nodoc}
Future<T> push<T>(FutureOr<T> Function() fn) {
final task = _SequentialTask<T>(fn);
_queue.add(task);
Expand All @@ -72,14 +68,12 @@ final class _ControllerEventQueue {
/// Mark the queue as closed.
/// The queue will be processed until it's empty.
/// But all new and current events will be rejected with [WSClientClosed].
/// {@nodoc}
FutureOr<void> close() async {
_isClosed = true;
await _processing;
}

/// Execute the queue.
/// {@nodoc}
void _exec() => _processing ??= Future.doWhile(() async {
final event = _queue.first;
try {
Expand All @@ -104,23 +98,17 @@ final class _ControllerEventQueue {
});
}

/// {@nodoc}
class _SequentialTask<T> {
/// {@nodoc}
_SequentialTask(FutureOr<T> Function() fn)
: _fn = fn,
_completer = Completer<T>();

/// {@nodoc}
final Completer<T> _completer;

/// {@nodoc}
final FutureOr<T> Function() _fn;

/// {@nodoc}
Future<T> get future => _completer.future;

/// {@nodoc}
FutureOr<T> call() async {
final result = await _fn();
if (!_completer.isCompleted) {
Expand All @@ -129,7 +117,6 @@ class _SequentialTask<T> {
return result;
}

/// {@nodoc}
void reject(Object error, [StackTrace? stackTrace]) {
if (_completer.isCompleted) return;
_completer.completeError(error, stackTrace);
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/common/localization/localization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class Localization extends generated.GeneratedLocalization {
/// Get language by code.
static ({String name, String nativeName})? getLanguageByCode(String code) =>
switch (_isoLangs[code]) {
(:String name, :String nativeName) => (
(String name, String nativeName) => (
name: name,
nativeName: nativeName
),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/common/widget/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class App extends StatelessWidget {
builder: (context, child) => MediaQuery(
data: MediaQuery.of(context).copyWith(
/* textScaler: TextScaler.noScaling, */
textScaleFactor: 1,
textScaler: const TextScaler.linear(1),
),
child: WindowScope(
/* title: Localization.of(context).title, */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ sealed class AuthenticationState extends _$AuthenticationStateBase {
}

/// Idling state
/// {@nodoc}
final class AuthenticationState$Idle extends AuthenticationState
with _$AuthenticationState {
/// {@nodoc}
const AuthenticationState$Idle(
{required super.user, super.message = 'Idling', this.error});

Expand All @@ -37,28 +35,23 @@ final class AuthenticationState$Idle extends AuthenticationState
}

/// Processing
/// {@nodoc}
final class AuthenticationState$Processing extends AuthenticationState
with _$AuthenticationState {
/// {@nodoc}
const AuthenticationState$Processing(
{required super.user, super.message = 'Processing'});

@override
String? get error => null;
}

/// {@nodoc}
base mixin _$AuthenticationState on AuthenticationState {}

/// Pattern matching for [AuthenticationState].
typedef AuthenticationStateMatch<R, S extends AuthenticationState> = R Function(
S state);

/// {@nodoc}
@immutable
abstract base class _$AuthenticationStateBase {
/// {@nodoc}
const _$AuthenticationStateBase({required this.user, required this.message});

/// Data entity payload.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,26 @@ sealed class ChatConnectionState extends _$ChatConnectionStateBase {
}

/// Disconnected
/// {@nodoc}
final class ChatConnectionState$Disconnected extends ChatConnectionState {
/// {@nodoc}
const ChatConnectionState$Disconnected({super.message = 'Disconnected'});
}

/// Connecting
/// {@nodoc}
final class ChatConnectionState$Connecting extends ChatConnectionState {
/// {@nodoc}
const ChatConnectionState$Connecting({super.message = 'Connecting'});
}

/// Connected
/// {@nodoc}
final class ChatConnectionState$Connected extends ChatConnectionState {
/// {@nodoc}
const ChatConnectionState$Connected({super.message = 'Connected'});
}

/// Pattern matching for [ChatConnectionState].
typedef ChatConnectionStateMatch<R, S extends ChatConnectionState> = R Function(
S state);

/// {@nodoc}
@immutable
abstract base class _$ChatConnectionStateBase {
/// {@nodoc}
const _$ChatConnectionStateBase({required this.message});

/// Message or state description.
Expand Down
Loading
Loading