Skip to content

Commit

Permalink
Feature/example (#3)
Browse files Browse the repository at this point in the history
* Update documentation

* Add metrics

* Add reconnects & subscriptions metrics

* Add metrics

* Update version

* Add override

* Add metrics to readme

* Update metrics

* Add generics

* Update subscription state

* Update metrics documentation

* Update codegeneration

* Update contribution guide

* Fix linter issues

* Bump release

* Add example

* Fix subscribe

* Update readme

* Add example placeholder

* Patch native platform

* Remove tests

* Add sign in form

* Update sign in form

* Update app

* Update example

* Update location of chat connection repository

* Add username by default

* Encode channels

* Update launch

* Update message sender

* Fix queue

* Remove extra column

* Update chat room

* Add placeholder subsriber

* Update analysis options

* Update depricated

* Update chat subscription

* Update chat message

* Bump version to 0.0.1-pre.7

* Update dependencies

* Do not get dependencies in example directory
  • Loading branch information
PlugFox committed Nov 2, 2023
1 parent 4342179 commit c03a5a3
Show file tree
Hide file tree
Showing 236 changed files with 11,799 additions and 467 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run:
working-directory: ./
container:
image: dart:beta
image: dart:stable
timeout-minutes: 10
steps:
- name: 🚂 Get latest code
Expand All @@ -58,7 +58,7 @@ jobs:
- name: 👷 Install Dependencies
timeout-minutes: 1
run: |
dart pub get
dart pub get --no-example
- name: 🔎 Check format
timeout-minutes: 1
Expand Down
26 changes: 20 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,34 @@
"version": "0.2.0",
"configurations": [
{
"name": "Console (example)",
"name": "Example (lcl)",
"request": "launch",
"type": "dart",
"program": "examples/console/bin/main.dart",
"flutterMode": "debug",
"cwd": "${workspaceFolder}/example",
"program": "lib/main.dart",
"env": {
"ENVIRONMENT": "local"
},
"console": "debugConsole",
"runTestsOnDevice": false,
"toolArgs": [],
"args": [
// "--token=X.Y.Z",
"--verbose"
]
"args": ["--dart-define-from-file=config/local.json"]
},
{
"name": "Example (dev)",
"request": "launch",
"type": "dart",
"flutterMode": "debug",
"cwd": "${workspaceFolder}/example",
"program": "lib/main.dart",
"env": {
"ENVIRONMENT": "development"
},
"console": "debugConsole",
"runTestsOnDevice": false,
"toolArgs": [],
"args": ["--dart-define-from-file=config/development.json"]
}
]
}
69 changes: 69 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,75 @@
},
"problemMatcher": []
},
{
"label": "Get protoc plugin",
"type": "shell",
"command": ["dart pub global activate protoc_plugin"],
"dependsOn": ["Dependencies"],
"group": {
"kind": "none",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Generate protobuf",
"type": "shell",
"command": [
"protoc",
"--proto_path=lib/src/transport/protobuf",
"--dart_out=lib/src/transport/protobuf lib/src/transport/protobuf/client.proto"
],
"dependsOn": ["Get protoc plugin"],
"group": {
"kind": "none",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Codegenerate",
"type": "shell",
"command": ["dart run build_runner build --delete-conflicting-outputs"],
"dependsOn": ["Dependencies"],
"group": {
"kind": "none",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Format",
"type": "shell",
"command": [
"dart format --fix -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/transport/protobuf/"
],
"group": {
"kind": "none",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Prepare example",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/example"
},
"command": [
"dart pub global activate intl_utils",
"dart pub global run intl_utils:generate",
"fvm flutter pub get",
/* "&& fvm flutter gen-l10n --arb-dir lib/src/common/localization --output-dir lib/src/common/localization/generated --template-arb-file intl_en.arb", */
"&& fvm flutter pub run build_runner build --delete-conflicting-outputs",
"&& dart format --fix -l 80 ."
],
"group": {
"kind": "none",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Start Centrifugo Server",
"type": "shell",
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## 0.0.1-pre.2
## 0.0.1-pre.7

- **ADDED**: Initial release
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Windows:
$ choco install protoc
$ dart pub global activate protoc_plugin
$ dart pub get
$ protoc --proto_path=lib/src/model/protobuf --dart_out=lib/src/model/protobuf lib/src/model/protobuf/client.proto
$ protoc --proto_path=lib/src/transport/protobuf --dart_out=lib/src/transport/protobuf lib/src/transport/protobuf/client.proto
$ dart run build_runner build --delete-conflicting-outputs
$ dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/model/protobuf/
$ dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/transport/protobuf/
```

Linux:
Expand All @@ -21,9 +21,9 @@ $ sudo apt install -y protobuf-compiler dart
$ export PATH="$PATH":"$HOME/.pub-cache/bin"
$ dart pub global activate protoc_plugin
$ dart pub get
$ protoc --proto_path=lib/src/model/protobuf --dart_out=lib/src/model/protobuf lib/src/model/protobuf/client.proto
$ protoc --proto_path=lib/src/transport/protobuf --dart_out=lib/src/transport/protobuf lib/src/transport/protobuf/client.proto
$ dart run build_runner build --delete-conflicting-outputs
$ dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/model/protobuf/
$ dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/transport/protobuf/
```

macOS:
Expand All @@ -34,7 +34,7 @@ $ brew install protobuf dart
$ export PATH="$PATH":"$HOME/.pub-cache/bin"
$ dart pub global activate protoc_plugin
$ dart pub get
$ protoc --proto_path=lib/src/model/protobuf --dart_out=lib/src/model/protobuf lib/src/model/protobuf/client.proto
$ protoc --proto_path=lib/src/transport/protobuf --dart_out=lib/src/transport/protobuf lib/src/transport/protobuf/client.proto
$ dart run build_runner build --delete-conflicting-outputs
$ dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/model/protobuf/
$ dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/transport/protobuf/
```
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ get:
test: get
@dart test --debug --coverage=.coverage --platform chrome,vm

publish:
publish: generate
@yes | dart pub publish

deploy: publish
Expand Down Expand Up @@ -44,6 +44,6 @@ pana: check

generate: get
@dart pub global activate protoc_plugin
@protoc --proto_path=lib/src/model/protobuf --dart_out=lib/src/model/protobuf lib/src/model/protobuf/client.proto
@protoc --proto_path=lib/src/transport/protobuf --dart_out=lib/src/transport/protobuf lib/src/transport/protobuf/client.proto
@dart run build_runner build --delete-conflicting-outputs
@dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/model/protobuf/
@dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/transport/protobuf/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Connection related features
- ✅ Publish data into a channel
- ✅ Enqueue methods
- ✅ Set observer for hooking events & errors
- Metrics
- Metrics
- ❌ Optimistic subscriptions
- ❌ Run in separate isolate
- ❌ JSON transport
Expand Down Expand Up @@ -99,4 +99,4 @@ We appreciate any form of support, whether it's a financial donation or just a s
## License
[MIT](https://opensource.org/licenses/MIT)
[The MIT License](https://opensource.org/licenses/MIT)
7 changes: 3 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ analyzer:
- "build/**"
# Codegen
- "lib/**.g.dart"
- "lib/src/model/protobuf/*"
- "lib/src/model/pubspec.yaml.g.dart"
- "lib/src/transport/protobuf/*"
- "lib/src/transport/pubspec.yaml.g.dart"
# Tests
- "test/**.mocks.dart"
- ".test_coverage.dart"
Expand Down Expand Up @@ -89,10 +89,9 @@ linter:
close_sinks: true
control_flow_in_finally: true
empty_statements: true
iterable_contains_unrelated_type: true
collection_methods_unrelated_type: true
join_return_with_assignment: true
leading_newlines_in_multiline_strings: true
list_remove_unrelated_type: true
literal_only_boolean_expressions: true
missing_whitespace_between_adjacent_strings: true
no_adjacent_strings_in_list: true
Expand Down
4 changes: 4 additions & 0 deletions example/.fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutterSdkVersion": "stable",
"flavors": {}
}
79 changes: 79 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

# Databases
.sqlite
.db
.lock

# Logs
log.txt

# Emulator
emulator/

# Temporary files
temp/
.temp/

# Env
.env*

# Test
coverage/

# Flutter Version Manager
.fvm/flutter_sdk

# Generated files

# Screenshots
integration_test/screenshots/

# Firebase
.firebase/

# Config
config/local.json
45 changes: 45 additions & 0 deletions example/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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.

version:
revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
channel: beta

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
base_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
- platform: android
create_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
base_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
- platform: ios
create_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
base_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
- platform: linux
create_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
base_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
- platform: macos
create_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
base_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
- platform: web
create_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
base_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
- platform: windows
create_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b
base_revision: 74e4b092e5212ebf8292dde2a48d3da960c0920b

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
24 changes: 24 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# spinifyapp

Spinify App Example

## Code generation

```bash
$ make codegen
```

## Localization

```bash
$ code lib/src/common/localization/intl_en.arb
$ make intl
```

## Recreating the project

**! Warning: This will overwrite all files in the current directory.**

```bash
fvm spawn beta create --overwrite -t app --project-name "spinifyapp" --org "dev.plugfox.spinify" --description "Spinify App Example" --platforms ios,android,windows,linux,macos,web .
```
Loading

0 comments on commit c03a5a3

Please sign in to comment.