Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the problem of sending the previous token to the server #61

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'dart:developer';
/*import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:pusher_client/pusher_client.dart';
Expand Down Expand Up @@ -107,3 +107,4 @@ class _MyAppState extends State<MyApp> {
);
}
}
*/
6 changes: 3 additions & 3 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -106,7 +106,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -141,7 +141,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
typed_data:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
/*import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:pusher_client_example/main.dart';
Expand All @@ -25,3 +25,4 @@ void main() {
);
});
}
*/
32 changes: 26 additions & 6 deletions lib/src/pusher/pusher_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,40 @@ class PusherClient extends StreamHandler {
const MethodChannel('com.github.chinloyal/pusher_client');
static const classId = 'PusherClient';

static PusherClient? _singleton;
// static PusherClient? _singleton;
void Function(ConnectionStateChange?)? _onConnectionStateChange;
void Function(ConnectionError?)? _onConnectionError;
String? _socketId;

PusherClient._(
/* PusherClient._(
String appKey,
PusherOptions options, {
bool enableLogging = true,
bool autoConnect = true,
});

plugin:
platforms:
android:
package: com.github.chinloyal.pusher_client
pluginClass: PusherClientPlugin
ios:
pluginClass: PusherClientPlugin



*/

//String? appKey;
//PusherOptions? options;

/// Creates a [PusherClient] -- returns the instance if it's already be called.
factory PusherClient(
/* PusherClient(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, this code has serious error bro,
you commented whole of PusherClient constractor func,
could you please send me its correct version if you have it?

String appKey,
PusherOptions options, {
bool enableLogging = true,
bool autoConnect = true,
}) {
});*/ /*{
_singleton ??= PusherClient._(
appKey,
options,
Expand All @@ -53,10 +68,15 @@ class PusherClient extends StreamHandler {

if (autoConnect) _singleton!.connect();

return _singleton!;
}
// return _singleton!;
} */

//String getAppKey() => appKey!;

// PusherOptions getOptions() => options!;

Future _init(String appKey, PusherOptions options, InitArgs initArgs) async {
print("PUSHERRRR CONNECTTTTT");
registerListener(classId, _eventHandler);
await _channel.invokeMethod(
'init',
Expand Down
6 changes: 3 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -92,7 +92,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -127,7 +127,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
typed_data:
dependency: transitive
description:
Expand Down
7 changes: 0 additions & 7 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,3 @@ dev_dependencies:
sdk: flutter

flutter:
plugin:
platforms:
android:
package: com.github.chinloyal.pusher_client
pluginClass: PusherClientPlugin
ios:
pluginClass: PusherClientPlugin
4 changes: 2 additions & 2 deletions test/pusher_client_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter/material.dart';
/*import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pusher_client/pusher_client.dart';
Expand Down Expand Up @@ -30,4 +30,4 @@ void main() {

// test()
});
}
}*/