diff --git a/cim-client-sdk/cim-flutter-sdk/cim-boot-client.dart b/cim-client-sdk/cim-flutter-sdk/cim-boot-client.dart deleted file mode 100644 index 797f28f..0000000 --- a/cim-client-sdk/cim-flutter-sdk/cim-boot-client.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'dart:io'; -import 'dart:typed_data'; - -import '../protobuf/Message.pb.dart' as Message; -import '../protobuf/ReplyBody.pb.dart' as ReplyBody; -import '../protobuf/SentBody.pb.dart' as SentBody; -import 'package:fixnum/fixnum.dart'; - -late Socket socket; - -const APP_VERSION = "1.0.0"; -const APP_CHANNEL = "web"; -const APP_PACKAGE = "com.farsunset.cim"; -const SERVER_URL = "192.168.10.133"; -const SERVER_PORT = 23456; - -//PONG -const PONG_TYPE = 0; -//发送消息类型 -const Message_TYPE = 2; -//强制下线类型 -const ACTION_999 = 999; -//响应消息类型 -const REPLY_BODY = 4; -//消息发送 -const SEND_BODY = 3; -//PING -const PING_TYPE = 1; - -const DATA_HEADER_LENGTH = 1; - -void connect() async { - print('-------------开始连接----------------'); - Socket.connect(SERVER_URL, SERVER_PORT).then((Socket sock) { - // socket = sock; - sock.listen(dataHandler, - onError: errorHandler, onDone: doneHandler, cancelOnError: false); - socket = sock; - sendLoginMsg(); - }).catchError((e) { - print("Unable to connect: $e"); - }); -} - -void dataHandler(Uint8List data) { - print(data[0]); - int l = (data[1] & 0xff); - int h = (data[2] & 0xff); - int length = (l | h << 8); - if (data[0] == PING_TYPE) { - sendPong(); - } else if (data[0] == REPLY_BODY) { - var message = data.sublist(3, length + 3); - ReplyBody.Model info = new ReplyBody.Model(); - info.mergeFromBuffer(message); - print(info.key); - print(info); - } else if (data[0] == Message_TYPE) { - var message = data.sublist(3, length + 3); - Message.Model model = new Message.Model(); - model.mergeFromBuffer(message); - print(model.action); - print(model); - } -} - -void errorHandler(error, StackTrace trace) { - print(error); -} - -void doneHandler() { - print("-------------连接失败----------------"); -} - -//发送登录消息 -void sendLoginMsg() async { - Map map = { - "uid": "11111111112346121631126311", - "channel": APP_CHANNEL, - "appVersion": APP_VERSION, - "osVersion": "Android 10", - "packageName": APP_PACKAGE, - "deviceId": "121155155a61d6a1s6d1as6d1a6s1da", - "deviceName": "andoirdPhone", - "language": "Zh_cn", - }; - int time = new DateTime.now().millisecondsSinceEpoch; - Int64 timeStamp = Int64.parseInt(time.toString()); - var body = SentBody.Model(data: map); - body.key = "client_bind"; - body.timestamp = timeStamp; - var data = body.writeToBuffer(); - var protobuf = new Uint8List(data.length + 3); - protobuf[0] = 3; - protobuf[1] = (data.length & 0xff); - protobuf[2] = ((data.length >> 8) & 0xff); - protobuf.setRange(3, data.length + 3, data); - socket.add(protobuf); - await socket.flush(); -} - -//发送PONG响应 -void sendPong() async { - var PONG = new Uint8List(7); - var PONG_BODY = new Uint8List(4); - PONG_BODY[0] = 80; - PONG_BODY[1] = 79; - PONG_BODY[2] = 78; - PONG_BODY[3] = 71; - PONG[0] = PONG_TYPE; - PONG[1] = (PONG_BODY.length & 0xff); - PONG[2] = ((PONG_BODY.length >> 8) & 0xff); - PONG.setRange(3, 6, PONG_BODY); - socket.add(PONG); - await socket.flush(); - print("发送Pong"); -} diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.flutter-plugins b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.flutter-plugins new file mode 100644 index 0000000..cc0805d --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.flutter-plugins @@ -0,0 +1,2 @@ +# This is a generated file; do not edit or check into version control. +device_info_plus=C:\\Users\\smeb\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\device_info_plus-8.2.2\\ diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.flutter-plugins-dependencies b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.flutter-plugins-dependencies new file mode 100644 index 0000000..743a6c2 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"device_info_plus","dependencies":[]}],"date_created":"2023-07-17 09:14:10.336893","version":"3.7.7"} \ No newline at end of file diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.gitignore b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.gitignore new file mode 100644 index 0000000..96486fd --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.gitignore @@ -0,0 +1,30 @@ +# 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 +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages +build/ diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.metadata b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.metadata new file mode 100644 index 0000000..7f104ef --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/.metadata @@ -0,0 +1,27 @@ +# 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: 2ad6cd72c040113b47ee9055e722606a490ef0da + channel: stable + +project_type: plugin + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + + # 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' diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/CHANGELOG.md b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/CHANGELOG.md new file mode 100644 index 0000000..143cf82 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.6 + +* allow Custom login parameters. diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/LICENSE b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/LICENSE new file mode 100644 index 0000000..c822d2b --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/LICENSE @@ -0,0 +1,25 @@ +Copyright 2022 The SDK Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/README.md b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/README.md new file mode 100644 index 0000000..702b06b --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/README.md @@ -0,0 +1,73 @@ +# cim_flutter_sdk + +开源通讯库 [CIM](https://gitee.com/farsunset/cim) 的 flutter版本SDK + + +## WebSocket版本 + +[在这里](https://pub.dev/packages/cim_flutter_websocket_sdk) + +## 如何在自己的项目中引用SDK + +在 pubspec.yaml 引入 + + +``` +dependencies: + cim_flutter_sdk: ^1.0.6 +``` + + +## 如何使用 + +``` +import 'package:cim_flutter_sdk/cim_socket.dart'; +... + + late CIMSocket? cimSocket = null; + + late List list = []; + + late bool connectStatus = false; + + @override + void initState() { + super.initState(); + cimSocket = CIMSocket(onMessageReceived: (value) { + setState(() { + list.add(value.toProto3Json().toString()); + }); + }, onConnectionStatusChanged: (value) { + setState(() { + connectStatus = value; + }); + }); + cimSocket!.init('127.0.0.1', 34567, '16501516154949'); + cimSocket!.connect( + devicename: "Windows 10 Pro", + appVersion: "2.1.0", + osVersion: "10.0.19042.1165", + packageName: "com.farsunset.flutter", + deviceid: "asd52d1d0a6s1f6sdf1", + language: "zh_CN"); + } +... + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: Text(connectStatus ? '已连接' : '未连接'), + ), + body: ListView.builder( + itemCount: list.length, + itemBuilder: (context, index) { + return Text(list[index]); + }, + ), + ), + ); + } + +``` diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/analysis_options.yaml b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/analysis_options.yaml new file mode 100644 index 0000000..a5744c1 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/.gitignore b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/.gitignore new file mode 100644 index 0000000..24476c5 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/.gitignore @@ -0,0 +1,44 @@ +# 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 diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/.metadata b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/.metadata new file mode 100644 index 0000000..b1fefbe --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/.metadata @@ -0,0 +1,30 @@ +# 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: 2ad6cd72c040113b47ee9055e722606a490ef0da + channel: stable + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + - platform: windows + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + + # 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' diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/README.md b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/README.md new file mode 100644 index 0000000..cd437a1 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/README.md @@ -0,0 +1,16 @@ +# cim_flutter_sdk_example + +Demonstrates how to use the cim_flutter_sdk plugin. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/analysis_options.yaml b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/analysis_options.yaml new file mode 100644 index 0000000..61b6c4d --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/lib/main.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/lib/main.dart new file mode 100644 index 0000000..9ad42e0 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/lib/main.dart @@ -0,0 +1,60 @@ +import 'package:cim_flutter_sdk/cim_socket.dart'; +import 'package:flutter/material.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + late CIMSocket? cimSocket = null; + + late List list = []; + + late bool connectStatus = false; + + @override + void initState() { + super.initState(); + cimSocket = CIMSocket(onMessageReceived: (value) { + setState(() { + list.add(value.toProto3Json().toString()); + }); + }, onConnectionStatusChanged: (value) { + setState(() { + connectStatus = value; + }); + }); + cimSocket!.init('api.hoxin.farsunset.com', 34567, '16501516154949'); + cimSocket!.connect( + devicename: "Windows 10 Pro", + appVersion: "2.1.0", + osVersion: "10.0.19042.1165", + packageName: "com.farsunset.flutter", + deviceid: "asd52d1d0a6s1f6sdf1", + language: "zh_CN"); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: Text(connectStatus ? '已连接' : '未连接'), + ), + body: ListView.builder( + itemCount: list.length, + itemBuilder: (context, index) { + return Text(list[index]); + }, + ), + ), + ); + } +} diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/pubspec.lock b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/pubspec.lock new file mode 100644 index 0000000..ada1e8b --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/pubspec.lock @@ -0,0 +1,313 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" + source: hosted + version: "2.10.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" + source: hosted + version: "1.2.1" + cim_flutter_sdk: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "1.0.6" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" + source: hosted + version: "1.17.0" + common_utils: + dependency: transitive + description: + name: common_utils + sha256: c26884339b13ff99b0739e56f4b02090c84054ed9dd3a045435cd24e7b99c2c1 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" + source: hosted + version: "1.0.5" + decimal: + dependency: transitive + description: + name: decimal + sha256: eece91944f523657c75a3a008a90ec7f7eb3986191153a78570c7d0ac8ef3d01 + url: "https://pub.dev" + source: hosted + version: "2.3.2" + device_info_plus: + dependency: transitive + description: + name: device_info_plus + sha256: f52ab3b76b36ede4d135aab80194df8925b553686f0fa12226b4e2d658e45903 + url: "https://pub.dev" + source: hosted + version: "8.2.2" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + url: "https://pub.dev" + source: hosted + version: "2.0.2" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + js: + dependency: transitive + description: + name: js + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" + source: hosted + version: "0.6.5" + lints: + dependency: transitive + description: + name: lints + sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" + source: hosted + version: "0.12.13" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" + source: hosted + version: "0.2.0" + meta: + dependency: transitive + description: + name: meta + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" + source: hosted + version: "1.8.0" + path: + dependency: transitive + description: + name: path + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" + source: hosted + version: "1.8.2" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + protobuf: + dependency: transitive + description: + name: protobuf + sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + rational: + dependency: transitive + description: + name: rational + sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf + url: "https://pub.dev" + source: hosted + version: "2.2.2" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" + source: hosted + version: "1.9.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" + source: hosted + version: "0.4.16" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + win32: + dependency: transitive + description: + name: win32 + sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" + url: "https://pub.dev" + source: hosted + version: "4.1.4" +sdks: + dart: ">=2.19.4 <3.0.0" + flutter: ">=2.11.0" diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/pubspec.yaml b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/pubspec.yaml new file mode 100644 index 0000000..76a4c63 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/example/pubspec.yaml @@ -0,0 +1,83 @@ +name: cim_flutter_sdk_example +description: Demonstrates how to use the cim_flutter_sdk plugin. +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +environment: + sdk: '>=2.19.4 <3.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + cim_flutter_sdk: + # When depending on this package from a real application you should use: + # cim_flutter_sdk: ^x.y.z + # See https://dart.dev/tools/pub/dependencies#version-constraints + # The example app is bundled with the plugin so we use a path dependency on + # the parent directory to use the current plugin's version. + path: ../ + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/Message.pb.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.pb.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/Message.pb.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.pb.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/Message.pbenum.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.pbenum.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/Message.pbenum.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.pbenum.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/Message.pbjson.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.pbjson.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/Message.pbjson.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.pbjson.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/Message.pbserver.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.pbserver.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/Message.pbserver.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.pbserver.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/Message.proto b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.proto similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/Message.proto rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/Message.proto diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pb.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.pb.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pb.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.pb.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pbenum.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.pbenum.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pbenum.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.pbenum.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pbjson.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.pbjson.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pbjson.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.pbjson.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pbserver.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.pbserver.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.pbserver.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.pbserver.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.proto b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.proto similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/ReplyBody.proto rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/ReplyBody.proto diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pb.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.pb.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pb.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.pb.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pbenum.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.pbenum.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pbenum.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.pbenum.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pbjson.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.pbjson.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pbjson.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.pbjson.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pbserver.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.pbserver.dart similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.pbserver.dart rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.pbserver.dart diff --git a/cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.proto b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.proto similarity index 100% rename from cim-client-sdk/cim-flutter-sdk/protobuf/SentBody.proto rename to cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/SentBody.proto diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/cim_socket.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/cim_socket.dart new file mode 100644 index 0000000..6018c97 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/lib/cim_socket.dart @@ -0,0 +1,261 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:common_utils/common_utils.dart'; +import 'package:crypto/crypto.dart'; +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/material.dart'; + +import './Message.pb.dart' as messages; +import './ReplyBody.pb.dart' as replybody; +import './SentBody.pb.dart' as sentbody; +import 'package:fixnum/fixnum.dart'; +import 'package:convert/convert.dart'; + +//PONG +// ignore: constant_identifier_names +const PONG_TYPE = 0; +//发送消息类型 +// ignore: constant_identifier_names +const Message_TYPE = 2; +//强制下线类型 +// ignore: constant_identifier_names +const ACTION_999 = 999; +//响应消息类型 +// ignore: constant_identifier_names +const REPLY_BODY = 4; +//消息发送 +// ignore: constant_identifier_names +const SEND_BODY = 3; +//PING +// ignore: constant_identifier_names +const PING_TYPE = 1; + +// ignore: constant_identifier_names +const DATA_HEADER_LENGTH = 1; + +const sOCKETAPPVERSION = '100'; + +class CIMSocket { + CIMSocket( + {required this.onMessageReceived, + required this.onConnectionStatusChanged}); + + late Socket? socket; + late String? uri; + late int? port; + late String? uid; + late String endCode = "0"; + final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); + final ValueChanged onMessageReceived; + final ValueChanged onConnectionStatusChanged; + late TimerUtil timer = TimerUtil() + ..mTotalTime = 10000 + ..setOnTimerTickCallback((millisUntilFinished) { + if (millisUntilFinished == 0 && uid != null) { + connect(); + } + }); + + late String? devicename; + + late String? appVersion; + + late String? osVersion; + + late String? packageName; + + late String? deviceid; + + late String? language; + + late String? channelName; + + Future init(String uri, int port, String uid) async { + this.uri = uri; + this.port = port; + this.uid = uid; + } + + //登录 + Future connect( + {String? devicename, + String? appVersion, + String? osVersion, + String? packageName, + String? deviceid, + String? language, + String? channelName}) async { + this.devicename = devicename; + this.appVersion = appVersion; + this.osVersion = osVersion; + this.packageName = packageName; + this.deviceid = deviceid; + this.language = language; + this.channelName = channelName; + + if (uri == null || port == null || uid == null) { + throw IOException; + } + Socket.connect(uri, port!).then((Socket sock) { + sock.listen((data) async { + int l = (data[1] & 0xff); + int h = (data[2] & 0xff); + int length = (l | h << 8); + if (data[0] == PING_TYPE) { + sendPong(); + } else if (data[0] == REPLY_BODY) { + var message = data.sublist(3, length + 3); + replybody.Model info = replybody.Model(); + info.mergeFromBuffer(message); + } else if (data[0] == Message_TYPE) { + var message = data.sublist(3, length + 3); + messages.Model model = messages.Model(); + model.mergeFromBuffer(message); + onMessageReceived(model); + } + }, onError: (error, StackTrace trace) { + socket = null; + if (!timer.isActive()) { + timer.setTotalTime(12000); + timer.startCountDown(); + } + onConnectionStatusChanged(false); + }, onDone: () { + socket = null; + if (endCode != "999") { + timer.setTotalTime(12000); + timer.startCountDown(); + } + onConnectionStatusChanged(false); + }, cancelOnError: true); + socket = sock; + sendLoginMsg(); + }).catchError((e) { + socket = null; + timer.setTotalTime(12000); + timer.startCountDown(); + onConnectionStatusChanged(false); + }); + } + + //登出 + Future disConnect() async { + if (socket != null) { + endCode = '999'; + await socket!.close(); + } + } + + //发送登录消息 + Future sendLoginMsg() async { + SystemInfo systemInfo = SystemInfo(); + await systemInfo.init(); + String deviceName = devicename ?? systemInfo.deviceName; + // DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); + String channel = channelName ?? systemInfo.deviceName; + String systemVersion = osVersion ?? systemInfo.version; + String deviceId = deviceid ?? + hex.encode(md5 + .convert(const Utf8Encoder().convert(systemInfo.deviceId)) + .bytes); + + Map map = { + "uid": uid!, //主id + "channel": channel, + "appVersion": appVersion ?? sOCKETAPPVERSION, + "osVersion": systemVersion, + "packageName": packageName ?? "cn.asihe.cim", + "deviceId": deviceId, + // (await PlatformDeviceId.getDeviceId)!.replaceAll("-", ""), //应用id + "deviceName": '$deviceName ${systemInfo.model}', + "language": language ?? "zh-CN", + }; + int time = DateTime.now().millisecondsSinceEpoch; + Int64 timeStamp = Int64.parseInt(time.toString()); + var body = sentbody.Model(data: map); + body.key = "client_bind"; + body.timestamp = timeStamp; + var data = body.writeToBuffer(); + var protobuf = Uint8List(data.length + 3); + protobuf[0] = 3; + protobuf[1] = (data.length & 0xff); + protobuf[2] = ((data.length >> 8) & 0xff); + protobuf.setRange(3, data.length + 3, data); + socket!.add(protobuf); + await socket!.flush(); + onConnectionStatusChanged(true); + if (timer.isActive()) { + timer.cancel(); + } + } + +//发送PONG响应 + Future sendPong() async { + var pONG = Uint8List(7); + var pONGBODY = Uint8List(4); + pONGBODY[0] = 80; + pONGBODY[1] = 79; + pONGBODY[2] = 78; + pONGBODY[3] = 71; + pONG[0] = PONG_TYPE; + pONG[1] = (pONGBODY.length & 0xff); + pONG[2] = ((pONGBODY.length >> 8) & 0xff); + pONG.setRange(3, 6, pONGBODY); + socket!.add(pONG); + await socket!.flush(); + if (timer.isActive()) { + timer.cancel(); + } + } +} + +class SystemInfo { + String deviceName = 'cim_entity'; + String version = '0.0.1'; + String deviceId = 'CIM Entity'; + String model = "10"; + final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); + + Future init() async { + if (Platform.isAndroid) { + // Android相关代码 + var value = await deviceInfoPlugin.androidInfo; + deviceName = 'android'; + version = Platform.version.substring(0, 6); + deviceId = value.id; + model = value.model; + } else if (Platform.isIOS) { + // iOS相关代码 + var value = await deviceInfoPlugin.iosInfo; + deviceName = 'ios'; + version = Platform.version.substring(0, 6); + deviceId = value.identifierForVendor!; + model = value.model!; + } else if (Platform.isMacOS) { + // MacOS相关代码 + var value = await deviceInfoPlugin.macOsInfo; + + deviceName = 'mac'; + version = Platform.version.substring(0, 6); + deviceId = value.model; + model = value.model; + } else if (Platform.isWindows) { + // Windows相关代码 + var value = await deviceInfoPlugin.windowsInfo; + deviceName = 'windows'; + version = Platform.version.substring(0, 6); + deviceId = value.deviceId; + model = value.majorVersion.toString(); + } else if (Platform.isLinux) { + // Linux相关代码 + var value = await deviceInfoPlugin.linuxInfo; + deviceName = 'linux'; + version = Platform.version.substring(0, 6); + deviceId = value.id; + model = value.version!; + } + } +} diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/pubspec.yaml b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/pubspec.yaml new file mode 100644 index 0000000..2f36074 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_sdk/pubspec.yaml @@ -0,0 +1,80 @@ +name: cim_flutter_sdk +description: a flutter sdk for cim. cim is a livechat framework use java netty, support user connect server by tcp or websocket. +repository: https://gitee.com/farsunset/cim +version: 1.0.6 +homepage: https://farsunset.com/ + +environment: + sdk: '>=2.19.4 <3.0.0' + flutter: '>=2.5.0' + +dependencies: + flutter: + sdk: flutter + protobuf: ^2.0.1 # Google protobuf 序列化 + device_info_plus: ^8.2.2 + common_utils: ^2.1.0 + crypto: ^3.0.3 + convert: ^3.1.1 + fixnum: ^1.1.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +#flutter: +# This section identifies this Flutter project as a plugin project. +# The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.) +# which should be registered in the plugin registry. This is required for +# using method channels. +# The Android 'package' specifies package in which the registered class is. +# This is required for using method channels on Android. +# The 'ffiPlugin' specifies that native code should be built and bundled. +# This is required for using `dart:ffi`. +# All these are used by the tooling to maintain consistency when +# adding or updating assets for this project. +#plugin: +# platforms: +# This plugin project was generated without specifying any +# platforms with the `--platform` argument. If you see the `some_platform` map below, remove it and +# then add platforms following the instruction here: +# https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms +# ------------------- +# some_platform: +# pluginClass: somePluginClass +# ------------------- + +# To add assets to your plugin package, add an assets section, like this: +# assets: +# - images/a_dot_burr.jpeg +# - images/a_dot_ham.jpeg +# +# For details regarding assets in packages, see +# https://flutter.dev/assets-and-images/#from-packages +# +# An image asset can refer to one or more resolution-specific "variants", see +# https://flutter.dev/assets-and-images/#resolution-aware + +# To add custom fonts to your plugin package, add a fonts section here, +# in this "flutter" section. Each entry in this list should have a +# "family" key with the font family name, and a "fonts" key with a +# list giving the asset and other descriptors for the font. For +# example: +# fonts: +# - family: Schyler +# fonts: +# - asset: fonts/Schyler-Regular.ttf +# - asset: fonts/Schyler-Italic.ttf +# style: italic +# - family: Trajan Pro +# fonts: +# - asset: fonts/TrajanPro.ttf +# - asset: fonts/TrajanPro_Bold.ttf +# weight: 700 +# +# For details regarding fonts in packages, see +# https://flutter.dev/custom-fonts/#from-packages diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.flutter-plugins b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.flutter-plugins new file mode 100644 index 0000000..cc0805d --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.flutter-plugins @@ -0,0 +1,2 @@ +# This is a generated file; do not edit or check into version control. +device_info_plus=C:\\Users\\smeb\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\device_info_plus-8.2.2\\ diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.flutter-plugins-dependencies b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.flutter-plugins-dependencies new file mode 100644 index 0000000..9686087 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"device_info_plus","path":"C:\\\\Users\\\\smeb\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-8.2.2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"device_info_plus","dependencies":[]}],"date_created":"2023-07-17 09:27:39.500003","version":"3.7.7"} \ No newline at end of file diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.gitignore b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.gitignore new file mode 100644 index 0000000..96486fd --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.gitignore @@ -0,0 +1,30 @@ +# 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 +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages +build/ diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.metadata b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.metadata new file mode 100644 index 0000000..7f104ef --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/.metadata @@ -0,0 +1,27 @@ +# 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: 2ad6cd72c040113b47ee9055e722606a490ef0da + channel: stable + +project_type: plugin + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + + # 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' diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/CHANGELOG.md b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/CHANGELOG.md new file mode 100644 index 0000000..6249f3c --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.1 + +* allow Custom login parameters. diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/LICENSE b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/LICENSE new file mode 100644 index 0000000..90d3fd9 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/LICENSE @@ -0,0 +1,25 @@ +Copyright 2023 The SDK Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/README.md b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/README.md new file mode 100644 index 0000000..35a42b3 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/README.md @@ -0,0 +1,74 @@ +# cim_flutter_websocket_sdk + +开源通讯库 [CIM](https://gitee.com/farsunset/cim) 的 flutter版本 SDK 由于使用了 websocket 代替 Tcp长连接,额外支持了Web浏览器 + +## 长连接版本 + +[在这里](https://pub.dev/packages/cim_flutter_sdk) + + +## 如何在自己的项目中引用SDK + +在 pubspec.yaml 引入 + + +``` +dependencies: + cim_flutter_websocket_sdk: ^1.0.1 +``` + + +## 如何使用 + +``` +import 'package:cim_flutter_sdk/cim_socket.dart'; +... + + late CIMSocket? cimSocket = null; + + late List list = []; + + late String connectStatus = 'Disconnected'; + + @override + void initState() { + super.initState(); + cimSocket = CIMSocket(onMessageReceived: (value) { + setState(() { + list.add(value.toProto3Json().toString()); + }); + }, onConnectionStatusChanged: (value) { + setState(() { + connectStatus = value; + }); + }); + cimSocket!.init('127.0.0.1', 45678, '16501516154949', true); + cimSocket!.connect( + devicename: "Windows 10 Pro", + appVersion: "1.0.0", + osVersion: "10.0.19042", + packageName: "com.farsunset.cim", + deviceid: "16501516154949", + language: "zh-CN", + channelName: "web"); + } +... + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: Text(connectStatus), + ), + body: ListView.builder( + itemCount: list.length, + itemBuilder: (context, index) { + return Text(list[index]); + }, + ), + ), + ); + } + +``` \ No newline at end of file diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/analysis_options.yaml b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/analysis_options.yaml new file mode 100644 index 0000000..a5744c1 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/.gitignore b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/.gitignore new file mode 100644 index 0000000..24476c5 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/.gitignore @@ -0,0 +1,44 @@ +# 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 diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/.metadata b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/.metadata new file mode 100644 index 0000000..8245e38 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/.metadata @@ -0,0 +1,30 @@ +# 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: 2ad6cd72c040113b47ee9055e722606a490ef0da + channel: stable + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + - platform: web + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + + # 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' diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/README.md b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/README.md new file mode 100644 index 0000000..46459d8 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/README.md @@ -0,0 +1,16 @@ +# cim_flutter_websocket_sdk_example + +Demonstrates how to use the cim_flutter_websocket_sdk plugin. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/analysis_options.yaml b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/analysis_options.yaml new file mode 100644 index 0000000..61b6c4d --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/lib/main.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/lib/main.dart new file mode 100644 index 0000000..6209637 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/lib/main.dart @@ -0,0 +1,61 @@ +import 'package:cim_flutter_websocket_sdk/socket_io_connect.dart'; +import 'package:flutter/material.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + late CIMSocket? cimSocket = null; + + late List list = []; + + late String connectStatus = 'Disconnected'; + + @override + void initState() { + super.initState(); + cimSocket = CIMSocket(onMessageReceived: (value) { + setState(() { + list.add(value.toProto3Json().toString()); + }); + }, onConnectionStatusChanged: (value) { + setState(() { + connectStatus = value; + }); + }); + cimSocket!.init('wss.hoxin.farsunset.com', 443, '16501516154949', true); + cimSocket!.connect( + devicename: "Windows 10 Pro", + appVersion: "1.0.0", + osVersion: "10.0.19042", + packageName: "com.farsunset.cim", + deviceid: "16501516154949", + language: "zh-CN", + channelName: "web"); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: Text(connectStatus), + ), + body: ListView.builder( + itemCount: list.length, + itemBuilder: (context, index) { + return Text(list[index]); + }, + ), + ), + ); + } +} diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/pubspec.lock b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/pubspec.lock new file mode 100644 index 0000000..c437ab0 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/pubspec.lock @@ -0,0 +1,289 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" + source: hosted + version: "2.10.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" + source: hosted + version: "1.2.1" + cim_flutter_websocket_sdk: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "1.0.1" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" + source: hosted + version: "1.17.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" + source: hosted + version: "1.0.5" + device_info_plus: + dependency: transitive + description: + name: device_info_plus + sha256: f52ab3b76b36ede4d135aab80194df8925b553686f0fa12226b4e2d658e45903 + url: "https://pub.dev" + source: hosted + version: "8.2.2" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + url: "https://pub.dev" + source: hosted + version: "2.0.2" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + js: + dependency: transitive + description: + name: js + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" + source: hosted + version: "0.6.5" + matcher: + dependency: transitive + description: + name: matcher + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" + source: hosted + version: "0.12.13" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" + source: hosted + version: "0.2.0" + meta: + dependency: transitive + description: + name: meta + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" + source: hosted + version: "1.8.0" + path: + dependency: transitive + description: + name: path + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" + source: hosted + version: "1.8.2" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + protobuf: + dependency: transitive + description: + name: protobuf + sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" + source: hosted + version: "1.9.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" + source: hosted + version: "0.4.16" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + web_socket_client: + dependency: transitive + description: + name: web_socket_client + sha256: c58378b2374622c43abfb0a29dce1a9418f95e1dddbf7fdd695a8c34b01eb737 + url: "https://pub.dev" + source: hosted + version: "0.1.0-dev.3" + win32: + dependency: transitive + description: + name: win32 + sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" + url: "https://pub.dev" + source: hosted + version: "4.1.4" +sdks: + dart: ">=2.19.4 <3.0.0" + flutter: ">=2.11.0" diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/pubspec.yaml b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/pubspec.yaml new file mode 100644 index 0000000..cfd309e --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/example/pubspec.yaml @@ -0,0 +1,82 @@ +name: cim_flutter_websocket_sdk_example +description: Demonstrates how to use the cim_flutter_websocket_sdk plugin. +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +environment: + sdk: '>=2.19.4 <3.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + cim_flutter_websocket_sdk: + # When depending on this package from a real application you should use: + # cim_flutter_websocket_sdk: ^x.y.z + # See https://dart.dev/tools/pub/dependencies#version-constraints + # The example app is bundled with the plugin so we use a path dependency on + # the parent directory to use the current plugin's version. + path: ../ + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pb.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pb.dart new file mode 100644 index 0000000..a54c03c --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pb.dart @@ -0,0 +1,171 @@ +/// +// Generated code. Do not modify. +// source: Message.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; + +class Model extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Model', createEmptyInstance: create) + ..aInt64(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'action') + ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'content') + ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sender') + ..aOS(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'receiver') + ..aOS(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'extra') + ..aOS(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'title') + ..aOS(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'format') + ..aInt64(9, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'timestamp') + ..hasRequiredFields = false + ; + + Model._() : super(); + factory Model({ + $fixnum.Int64? id, + $core.String? action, + $core.String? content, + $core.String? sender, + $core.String? receiver, + $core.String? extra, + $core.String? title, + $core.String? format, + $fixnum.Int64? timestamp, + }) { + final _result = create(); + if (id != null) { + _result.id = id; + } + if (action != null) { + _result.action = action; + } + if (content != null) { + _result.content = content; + } + if (sender != null) { + _result.sender = sender; + } + if (receiver != null) { + _result.receiver = receiver; + } + if (extra != null) { + _result.extra = extra; + } + if (title != null) { + _result.title = title; + } + if (format != null) { + _result.format = format; + } + if (timestamp != null) { + _result.timestamp = timestamp; + } + return _result; + } + factory Model.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Model.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Model clone() => Model()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Model copyWith(void Function(Model) updates) => super.copyWith((message) => updates(message as Model)) as Model; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static Model create() => Model._(); + Model createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Model getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Model? _defaultInstance; + + @$pb.TagNumber(1) + $fixnum.Int64 get id => $_getI64(0); + @$pb.TagNumber(1) + set id($fixnum.Int64 v) { $_setInt64(0, v); } + @$pb.TagNumber(1) + $core.bool hasId() => $_has(0); + @$pb.TagNumber(1) + void clearId() => clearField(1); + + @$pb.TagNumber(2) + $core.String get action => $_getSZ(1); + @$pb.TagNumber(2) + set action($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasAction() => $_has(1); + @$pb.TagNumber(2) + void clearAction() => clearField(2); + + @$pb.TagNumber(3) + $core.String get content => $_getSZ(2); + @$pb.TagNumber(3) + set content($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasContent() => $_has(2); + @$pb.TagNumber(3) + void clearContent() => clearField(3); + + @$pb.TagNumber(4) + $core.String get sender => $_getSZ(3); + @$pb.TagNumber(4) + set sender($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasSender() => $_has(3); + @$pb.TagNumber(4) + void clearSender() => clearField(4); + + @$pb.TagNumber(5) + $core.String get receiver => $_getSZ(4); + @$pb.TagNumber(5) + set receiver($core.String v) { $_setString(4, v); } + @$pb.TagNumber(5) + $core.bool hasReceiver() => $_has(4); + @$pb.TagNumber(5) + void clearReceiver() => clearField(5); + + @$pb.TagNumber(6) + $core.String get extra => $_getSZ(5); + @$pb.TagNumber(6) + set extra($core.String v) { $_setString(5, v); } + @$pb.TagNumber(6) + $core.bool hasExtra() => $_has(5); + @$pb.TagNumber(6) + void clearExtra() => clearField(6); + + @$pb.TagNumber(7) + $core.String get title => $_getSZ(6); + @$pb.TagNumber(7) + set title($core.String v) { $_setString(6, v); } + @$pb.TagNumber(7) + $core.bool hasTitle() => $_has(6); + @$pb.TagNumber(7) + void clearTitle() => clearField(7); + + @$pb.TagNumber(8) + $core.String get format => $_getSZ(7); + @$pb.TagNumber(8) + set format($core.String v) { $_setString(7, v); } + @$pb.TagNumber(8) + $core.bool hasFormat() => $_has(7); + @$pb.TagNumber(8) + void clearFormat() => clearField(8); + + @$pb.TagNumber(9) + $fixnum.Int64 get timestamp => $_getI64(8); + @$pb.TagNumber(9) + set timestamp($fixnum.Int64 v) { $_setInt64(8, v); } + @$pb.TagNumber(9) + $core.bool hasTimestamp() => $_has(8); + @$pb.TagNumber(9) + void clearTimestamp() => clearField(9); +} + diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pbenum.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pbenum.dart new file mode 100644 index 0000000..2655f08 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pbenum.dart @@ -0,0 +1,7 @@ +/// +// Generated code. Do not modify. +// source: Message.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pbjson.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pbjson.dart new file mode 100644 index 0000000..37692d9 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pbjson.dart @@ -0,0 +1,28 @@ +/// +// Generated code. Do not modify. +// source: Message.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +import 'dart:core' as $core; +import 'dart:convert' as $convert; +import 'dart:typed_data' as $typed_data; +@$core.Deprecated('Use modelDescriptor instead') +const Model$json = const { + '1': 'Model', + '2': const [ + const {'1': 'id', '3': 1, '4': 1, '5': 3, '10': 'id'}, + const {'1': 'action', '3': 2, '4': 1, '5': 9, '10': 'action'}, + const {'1': 'content', '3': 3, '4': 1, '5': 9, '10': 'content'}, + const {'1': 'sender', '3': 4, '4': 1, '5': 9, '10': 'sender'}, + const {'1': 'receiver', '3': 5, '4': 1, '5': 9, '10': 'receiver'}, + const {'1': 'extra', '3': 6, '4': 1, '5': 9, '10': 'extra'}, + const {'1': 'title', '3': 7, '4': 1, '5': 9, '10': 'title'}, + const {'1': 'format', '3': 8, '4': 1, '5': 9, '10': 'format'}, + const {'1': 'timestamp', '3': 9, '4': 1, '5': 3, '10': 'timestamp'}, + ], +}; + +/// Descriptor for `Model`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List modelDescriptor = $convert.base64Decode('CgVNb2RlbBIOCgJpZBgBIAEoA1ICaWQSFgoGYWN0aW9uGAIgASgJUgZhY3Rpb24SGAoHY29udGVudBgDIAEoCVIHY29udGVudBIWCgZzZW5kZXIYBCABKAlSBnNlbmRlchIaCghyZWNlaXZlchgFIAEoCVIIcmVjZWl2ZXISFAoFZXh0cmEYBiABKAlSBWV4dHJhEhQKBXRpdGxlGAcgASgJUgV0aXRsZRIWCgZmb3JtYXQYCCABKAlSBmZvcm1hdBIcCgl0aW1lc3RhbXAYCSABKANSCXRpbWVzdGFtcA=='); diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pbserver.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pbserver.dart new file mode 100644 index 0000000..6b8edd0 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.pbserver.dart @@ -0,0 +1,9 @@ +/// +// Generated code. Do not modify. +// source: Message.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +export 'Message.pb.dart'; + diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.proto b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.proto new file mode 100644 index 0000000..2b8c058 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/Message.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +message Model { + int64 id = 1; + string action = 2; + string content = 3; + string sender = 4; + string receiver = 5; + string extra = 6; + string title = 7; + string format = 8; + int64 timestamp = 9; +} + \ No newline at end of file diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pb.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pb.dart new file mode 100644 index 0000000..dd76bb2 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pb.dart @@ -0,0 +1,109 @@ +/// +// Generated code. Do not modify. +// source: ReplyBody.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; + +class Model extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Model', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'key') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'code') + ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'message') + ..aInt64(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'timestamp') + ..m<$core.String, $core.String>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'data', entryClassName: 'Model.DataEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OS) + ..hasRequiredFields = false + ; + + Model._() : super(); + factory Model({ + $core.String? key, + $core.String? code, + $core.String? message, + $fixnum.Int64? timestamp, + $core.Map<$core.String, $core.String>? data, + }) { + final _result = create(); + if (key != null) { + _result.key = key; + } + if (code != null) { + _result.code = code; + } + if (message != null) { + _result.message = message; + } + if (timestamp != null) { + _result.timestamp = timestamp; + } + if (data != null) { + _result.data.addAll(data); + } + return _result; + } + factory Model.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Model.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Model clone() => Model()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Model copyWith(void Function(Model) updates) => super.copyWith((message) => updates(message as Model)) as Model; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static Model create() => Model._(); + Model createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Model getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Model? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get key => $_getSZ(0); + @$pb.TagNumber(1) + set key($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasKey() => $_has(0); + @$pb.TagNumber(1) + void clearKey() => clearField(1); + + @$pb.TagNumber(2) + $core.String get code => $_getSZ(1); + @$pb.TagNumber(2) + set code($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasCode() => $_has(1); + @$pb.TagNumber(2) + void clearCode() => clearField(2); + + @$pb.TagNumber(3) + $core.String get message => $_getSZ(2); + @$pb.TagNumber(3) + set message($core.String v) { $_setString(2, v); } + @$pb.TagNumber(3) + $core.bool hasMessage() => $_has(2); + @$pb.TagNumber(3) + void clearMessage() => clearField(3); + + @$pb.TagNumber(4) + $fixnum.Int64 get timestamp => $_getI64(3); + @$pb.TagNumber(4) + set timestamp($fixnum.Int64 v) { $_setInt64(3, v); } + @$pb.TagNumber(4) + $core.bool hasTimestamp() => $_has(3); + @$pb.TagNumber(4) + void clearTimestamp() => clearField(4); + + @$pb.TagNumber(5) + $core.Map<$core.String, $core.String> get data => $_getMap(4); +} + diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pbenum.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pbenum.dart new file mode 100644 index 0000000..90a3c89 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pbenum.dart @@ -0,0 +1,7 @@ +/// +// Generated code. Do not modify. +// source: ReplyBody.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pbjson.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pbjson.dart new file mode 100644 index 0000000..e3eed00 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pbjson.dart @@ -0,0 +1,35 @@ +/// +// Generated code. Do not modify. +// source: ReplyBody.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +import 'dart:core' as $core; +import 'dart:convert' as $convert; +import 'dart:typed_data' as $typed_data; +@$core.Deprecated('Use modelDescriptor instead') +const Model$json = const { + '1': 'Model', + '2': const [ + const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, + const {'1': 'code', '3': 2, '4': 1, '5': 9, '10': 'code'}, + const {'1': 'message', '3': 3, '4': 1, '5': 9, '10': 'message'}, + const {'1': 'timestamp', '3': 4, '4': 1, '5': 3, '10': 'timestamp'}, + const {'1': 'data', '3': 5, '4': 3, '5': 11, '6': '.Model.DataEntry', '10': 'data'}, + ], + '3': const [Model_DataEntry$json], +}; + +@$core.Deprecated('Use modelDescriptor instead') +const Model_DataEntry$json = const { + '1': 'DataEntry', + '2': const [ + const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, + const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, + ], + '7': const {'7': true}, +}; + +/// Descriptor for `Model`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List modelDescriptor = $convert.base64Decode('CgVNb2RlbBIQCgNrZXkYASABKAlSA2tleRISCgRjb2RlGAIgASgJUgRjb2RlEhgKB21lc3NhZ2UYAyABKAlSB21lc3NhZ2USHAoJdGltZXN0YW1wGAQgASgDUgl0aW1lc3RhbXASJAoEZGF0YRgFIAMoCzIQLk1vZGVsLkRhdGFFbnRyeVIEZGF0YRo3CglEYXRhRW50cnkSEAoDa2V5GAEgASgJUgNrZXkSFAoFdmFsdWUYAiABKAlSBXZhbHVlOgI4AQ=='); diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pbserver.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pbserver.dart new file mode 100644 index 0000000..2ad6b02 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.pbserver.dart @@ -0,0 +1,9 @@ +/// +// Generated code. Do not modify. +// source: ReplyBody.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +export 'ReplyBody.pb.dart'; + diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.proto b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.proto new file mode 100644 index 0000000..871a511 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/ReplyBody.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +message Model { + string key = 1; + string code = 2; + string message = 3; + int64 timestamp =4; + map data =5; + +} + \ No newline at end of file diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pb.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pb.dart new file mode 100644 index 0000000..780f730 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pb.dart @@ -0,0 +1,81 @@ +/// +// Generated code. Do not modify. +// source: SentBody.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; + +class Model extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Model', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'key') + ..aInt64(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'timestamp') + ..m<$core.String, $core.String>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'data', entryClassName: 'Model.DataEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OS) + ..hasRequiredFields = false + ; + + Model._() : super(); + factory Model({ + $core.String? key, + $fixnum.Int64? timestamp, + $core.Map<$core.String, $core.String>? data, + }) { + final _result = create(); + if (key != null) { + _result.key = key; + } + if (timestamp != null) { + _result.timestamp = timestamp; + } + if (data != null) { + _result.data.addAll(data); + } + return _result; + } + factory Model.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory Model.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + Model clone() => Model()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + Model copyWith(void Function(Model) updates) => super.copyWith((message) => updates(message as Model)) as Model; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static Model create() => Model._(); + Model createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static Model getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Model? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get key => $_getSZ(0); + @$pb.TagNumber(1) + set key($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasKey() => $_has(0); + @$pb.TagNumber(1) + void clearKey() => clearField(1); + + @$pb.TagNumber(2) + $fixnum.Int64 get timestamp => $_getI64(1); + @$pb.TagNumber(2) + set timestamp($fixnum.Int64 v) { $_setInt64(1, v); } + @$pb.TagNumber(2) + $core.bool hasTimestamp() => $_has(1); + @$pb.TagNumber(2) + void clearTimestamp() => clearField(2); + + @$pb.TagNumber(3) + $core.Map<$core.String, $core.String> get data => $_getMap(2); +} + diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pbenum.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pbenum.dart new file mode 100644 index 0000000..e9631c3 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pbenum.dart @@ -0,0 +1,7 @@ +/// +// Generated code. Do not modify. +// source: SentBody.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pbjson.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pbjson.dart new file mode 100644 index 0000000..a22098b --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pbjson.dart @@ -0,0 +1,33 @@ +/// +// Generated code. Do not modify. +// source: SentBody.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +import 'dart:core' as $core; +import 'dart:convert' as $convert; +import 'dart:typed_data' as $typed_data; +@$core.Deprecated('Use modelDescriptor instead') +const Model$json = const { + '1': 'Model', + '2': const [ + const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, + const {'1': 'timestamp', '3': 2, '4': 1, '5': 3, '10': 'timestamp'}, + const {'1': 'data', '3': 3, '4': 3, '5': 11, '6': '.Model.DataEntry', '10': 'data'}, + ], + '3': const [Model_DataEntry$json], +}; + +@$core.Deprecated('Use modelDescriptor instead') +const Model_DataEntry$json = const { + '1': 'DataEntry', + '2': const [ + const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, + const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'}, + ], + '7': const {'7': true}, +}; + +/// Descriptor for `Model`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List modelDescriptor = $convert.base64Decode('CgVNb2RlbBIQCgNrZXkYASABKAlSA2tleRIcCgl0aW1lc3RhbXAYAiABKANSCXRpbWVzdGFtcBIkCgRkYXRhGAMgAygLMhAuTW9kZWwuRGF0YUVudHJ5UgRkYXRhGjcKCURhdGFFbnRyeRIQCgNrZXkYASABKAlSA2tleRIUCgV2YWx1ZRgCIAEoCVIFdmFsdWU6AjgB'); diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pbserver.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pbserver.dart new file mode 100644 index 0000000..bba2612 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.pbserver.dart @@ -0,0 +1,9 @@ +/// +// Generated code. Do not modify. +// source: SentBody.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +export 'SentBody.pb.dart'; + diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.proto b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.proto new file mode 100644 index 0000000..5a1f93c --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/SentBody.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +message Model { + string key = 1; + int64 timestamp =2; + map data =3; + +} + \ No newline at end of file diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/socket_io_connect.dart b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/socket_io_connect.dart new file mode 100644 index 0000000..52d21ea --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/lib/socket_io_connect.dart @@ -0,0 +1,284 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:crypto/crypto.dart'; +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/foundation.dart'; + +import './Message.pb.dart' as messages; +import './ReplyBody.pb.dart' as replybody; +import './SentBody.pb.dart' as sentbody; +import 'package:fixnum/fixnum.dart'; +import 'package:convert/convert.dart'; + +// ignore_for_file: avoid_print +import 'package:web_socket_client/web_socket_client.dart'; + +//PONG +// ignore: constant_identifier_names +const PONG_TYPE = 0; +//发送消息类型 +// ignore: constant_identifier_names +const Message_TYPE = 2; +//强制下线类型 +// ignore: constant_identifier_names +const ACTION_999 = 999; +//响应消息类型 +// ignore: constant_identifier_names +const REPLY_BODY = 4; +//消息发送 +// ignore: constant_identifier_names +const SEND_BODY = 3; +//PING +// ignore: constant_identifier_names +const PING_TYPE = 1; + +// ignore: constant_identifier_names +const DATA_HEADER_LENGTH = 1; + +const sOCKETAPPVERSION = '100'; + +class CIMSocket { + CIMSocket( + {required this.onMessageReceived, + required this.onConnectionStatusChanged}); + + /// 句柄 + late WebSocket? channel; + + /// 地址 + late String? uri; + + /// 端口 + late int? port; + + /// 用户id + late String? uid; + + /// + late String endCode = "0"; + + /// 是否使用SSL + late bool useSsl = false; + + /// 设备信息 + final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); + + /// 消息回调 + final ValueChanged onMessageReceived; + + /// 连接状态回调 + final ValueChanged onConnectionStatusChanged; + + /// 设备名 + late String? devicename; + + /// app版本 + late String? appVersion; + + /// 系统版本 + late String? osVersion; + + /// 包名 + late String? packageName; + + /// 设备id + late String? deviceid; + + /// 语言 + late String? language; + + /// + late String? channelName; + + /// + /// [uri] 地址 + /// [port] 端口 + /// [uid] 用户id + /// [useSsl] 是否使用ssl + Future init(String uri, int port, String uid, bool useSsl) async { + this.uri = uri; + this.port = port; + this.uid = uid; + this.useSsl = useSsl; + } + + /// 连接 + /// [devicename] 设备名 + /// [appVersion] app版本 + /// [osVersion] 系统版本 + /// [packageName] 包名 + /// [deviceid] 设备id + /// [language] 语言 + /// [channelName] 渠道名 + Future connect({ + String? devicename, + String? appVersion, + String? osVersion, + String? packageName, + String? deviceid, + String? language, + String? channelName, + }) async { + if (uri == null || port == null || uid == null) { + throw IOException; + } + + this.devicename = devicename; + this.appVersion = appVersion; + this.osVersion = osVersion; + this.packageName = packageName; + this.deviceid = deviceid; + this.language = language; + this.channelName = channelName; + + channel = WebSocket(Uri.parse('${useSsl ? 'wss' : 'ws'}://$uri:$port'), + backoff: ConstantBackoff(Duration(seconds: 10)), + binaryType: 'arraybuffer'); + + channel!.connection.listen((event) { + if (event.runtimeType == Connected || event.runtimeType == Reconnected) { + sendLoginMsg(); + onConnectionStatusChanged( + event.runtimeType == Connected ? 'Connected' : 'Reconnected'); + } else { + onConnectionStatusChanged(event.runtimeType.toString()); + } + }); + + channel!.messages.listen((message) { + Uint8List data = message; + if (data[0] == PING_TYPE) { + sendPong(); + } else if (data[0] == REPLY_BODY) { + var message = data.sublist(1, data.length); + replybody.Model info = replybody.Model(); + info.mergeFromBuffer(message); + } else if (data[0] == Message_TYPE) { + var message = data.sublist(1, data.length); + messages.Model model = messages.Model(); + model.mergeFromBuffer(message); + onMessageReceived(model); + } + }, onError: (error, StackTrace trace) { + channel = null; + onConnectionStatusChanged('Disconnected'); + }, onDone: () { + channel = null; + onConnectionStatusChanged('Disconnected'); + }, cancelOnError: true); + } + + //登出 + Future disConnect() async { + if (channel != null) { + endCode = '999'; + channel!.close(); + } + } + + //发送登录消息 + Future sendLoginMsg() async { + SystemInfo systemInfo = SystemInfo(); + await systemInfo.init(); + String deviceName = devicename ?? systemInfo.deviceName; + // DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); + String channelN = channelName ?? systemInfo.deviceName; + String systemVersion = osVersion ?? systemInfo.version; + String deviceId = deviceid ?? + hex.encode(md5 + .convert(const Utf8Encoder().convert(systemInfo.deviceId)) + .bytes); + + Map map = { + "uid": uid!, //主id + "channel": channelN, + "appVersion": sOCKETAPPVERSION, + "osVersion": systemVersion, + "packageName": packageName ?? "cn.asihe.cim", + "deviceId": deviceId, + // (await PlatformDeviceId.getDeviceId)!.replaceAll("-", ""), //应用id + "deviceName": '$deviceName', + "language": language ?? "zh-CN", + }; + int time = DateTime.now().millisecondsSinceEpoch; + Int64 timeStamp = Int64.parseInt(time.toString()); + var body = sentbody.Model(data: map); + body.key = "client_bind"; + body.timestamp = timeStamp; + var data = body.writeToBuffer(); + var protobuf = Uint8List(data.length + 1); + protobuf[0] = 3; + protobuf.setRange(1, data.length + 1, data); + channel!.send(protobuf); + } + +//发送PONG响应 + Future sendPong() async { + var pONGBODY = Uint8List(4); + var pONG = Uint8List(pONGBODY.length + 1); + pONGBODY[0] = 80; + pONGBODY[1] = 79; + pONGBODY[2] = 78; + pONGBODY[3] = 71; + pONG[0] = 0; + pONG.setRange(1, 4, pONGBODY); + channel!.send(pONG); + } +} + +class SystemInfo { + String deviceName = 'cim_entity'; + String version = '0.0.1'; + String deviceId = 'CIM Entity'; + String model = "10"; + final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); + + Future init() async { + if (kIsWeb) { + var value = await deviceInfoPlugin.webBrowserInfo; + deviceName = "web"; + version = value.appVersion!.substring(0, 6); + deviceId = value.appCodeName!; + model = value.browserName.name; + return; + } + + if (Platform.isAndroid) { + // Android相关代码 + var value = await deviceInfoPlugin.androidInfo; + deviceName = 'android'; + version = Platform.version.substring(0, 6); + deviceId = value.id; + model = value.model; + } else if (Platform.isIOS) { + // iOS相关代码 + var value = await deviceInfoPlugin.iosInfo; + deviceName = 'ios'; + version = Platform.version.substring(0, 6); + deviceId = value.identifierForVendor!; + model = value.model!; + } else if (Platform.isMacOS) { + // MacOS相关代码 + var value = await deviceInfoPlugin.macOsInfo; + + deviceName = 'mac'; + version = Platform.version.substring(0, 6); + deviceId = value.model; + model = value.model; + } else if (Platform.isWindows) { + // Windows相关代码 + var value = await deviceInfoPlugin.windowsInfo; + deviceName = 'windows'; + version = Platform.version.substring(0, 6); + deviceId = value.deviceId; + model = value.majorVersion.toString(); + } else if (Platform.isLinux) { + // Linux相关代码 + var value = await deviceInfoPlugin.linuxInfo; + deviceName = 'linux'; + version = Platform.version.substring(0, 6); + deviceId = value.id; + model = value.version!; + } + } +} diff --git a/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/pubspec.yaml b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/pubspec.yaml new file mode 100644 index 0000000..4e50449 --- /dev/null +++ b/cim-client-sdk/cim-flutter-sdk/cim_flutter_websocket_sdk/pubspec.yaml @@ -0,0 +1,78 @@ +name: cim_flutter_websocket_sdk +description: A flutter websocket sdk for cim. Cim is a websocket based instant messaging protocol,support websocket protocol and socket protocol. +version: 1.0.1 +homepage: http://farsunset.com/ + +environment: + sdk: '>=2.19.4 <3.0.0' + flutter: '>=2.5.0' + +dependencies: + flutter: + sdk: flutter + protobuf: ^2.0.1 # Google protobuf 序列化 + device_info_plus: ^8.2.2 + crypto: ^3.0.3 + convert: ^3.1.1 + fixnum: ^1.1.0 + web_socket_client: ^0.1.0-dev.3 + +dev_dependencies: + flutter_test: + sdk: flutter +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +#flutter: +# This section identifies this Flutter project as a plugin project. +# The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.) +# which should be registered in the plugin registry. This is required for +# using method channels. +# The Android 'package' specifies package in which the registered class is. +# This is required for using method channels on Android. +# The 'ffiPlugin' specifies that native code should be built and bundled. +# This is required for using `dart:ffi`. +# All these are used by the tooling to maintain consistency when +# adding or updating assets for this project. +#plugin: +# platforms: +# This plugin project was generated without specifying any +# platforms with the `--platform` argument. If you see the `some_platform` map below, remove it and +# then add platforms following the instruction here: +# https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms +# ------------------- +# some_platform: +# pluginClass: somePluginClass +# ------------------- + +# To add assets to your plugin package, add an assets section, like this: +# assets: +# - images/a_dot_burr.jpeg +# - images/a_dot_ham.jpeg +# +# For details regarding assets in packages, see +# https://flutter.dev/assets-and-images/#from-packages +# +# An image asset can refer to one or more resolution-specific "variants", see +# https://flutter.dev/assets-and-images/#resolution-aware + +# To add custom fonts to your plugin package, add a fonts section here, +# in this "flutter" section. Each entry in this list should have a +# "family" key with the font family name, and a "fonts" key with a +# list giving the asset and other descriptors for the font. For +# example: +# fonts: +# - family: Schyler +# fonts: +# - asset: fonts/Schyler-Regular.ttf +# - asset: fonts/Schyler-Italic.ttf +# style: italic +# - family: Trajan Pro +# fonts: +# - asset: fonts/TrajanPro.ttf +# - asset: fonts/TrajanPro_Bold.ttf +# weight: 700 +# +# For details regarding fonts in packages, see +# https://flutter.dev/custom-fonts/#from-packages