Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: true
matrix:
pkg: [pubnub, pubnub_flutter]
pkg: [pubnub]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -40,7 +40,7 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.pkg }}-
- name: Setup Dart stable
uses: dart-lang/setup-dart@v1.3
uses: dart-lang/setup-dart@v1.5.0
- name: "Build and run tests for '${{ matrix.pkg }}'"
env:
PKG: ${{ matrix.pkg }}
Expand All @@ -51,7 +51,7 @@ jobs:
git clone https://github.com/flutter/flutter.git -b stable "$FLUTTER_PATH"
export PATH="$PATH:$FLUTTER_PATH/bin"
fi
dart pub global activate derry 1.3.0
dart pub global activate derry 1.5.0
cd "${{ github.workspace }}/${{ matrix.pkg }}"
[[ ${{ matrix.pkg }} == "pubnub_flutter" ]] && flutter pub get || dart pub get
derry validate analysis
Expand Down
7 changes: 6 additions & 1 deletion .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
changelog:
- date: 2023-05-18
version: v4.2.3
changes:
- type: bug
text: "Fixes issue of losing timetoken value precision in web environment."
- date: 2022-11-14
version: v4.2.2
changes:
Expand Down Expand Up @@ -415,7 +420,7 @@ supported-platforms:
platforms:
- "Dart SDK >=2.6.0 <3.0.0"
version: "PubNub Dart SDK"
version: "4.2.2"
version: "4.2.3"
sdks:
-
full-name: PubNub Dart SDK
Expand Down
20 changes: 12 additions & 8 deletions acceptance_tests/lib/src/hooks/mock_server_hook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ class MockServerHook extends Hook {
Iterable<Tag> tags,
) async {
try {
var tagParts = tags.firstWhere((element) => element.name.startsWith('@contract=')).name.split('=');
var tagParts = tags
.firstWhere((element) => element.name.startsWith('@contract='))
.name
.split('=');

var contract = tagParts.skip(1).first;

// await Future.delayed(Duration(seconds: 3));

var res = await http.get(Uri.parse('http://localhost:8090/init?__contract__script__=$contract'));
var res = await http.get(Uri.parse(
'http://localhost:8090/init?__contract__script__=$contract'));

// check for 200 response and fail scenario if not 200

Expand All @@ -35,8 +39,8 @@ class MockServerHook extends Hook {
int myData = 0;

@override
Future<StepResult?> onAfterStep(
covariant PubNubWorld world, ScenarioRunnable scenario, String step, StepResult stepResult) async {
Future<StepResult?> onAfterStep(covariant PubNubWorld world,
ScenarioRunnable scenario, String step, StepResult stepResult) async {
// print(
// 'Hook step: $step, result: ${stepResult.result} ${stepResult.resultReason}');

Expand All @@ -58,12 +62,12 @@ class MockServerHook extends Hook {
// '[Hook] x ${failedExp.length}, . ${pendingExp.length}, v ${succeededExp.length}');

if (failedExp.isNotEmpty) {
return StepResult(
stepResult.elapsedMilliseconds, StepExecutionResult.fail, 'Failed expectations: $failedExp.');
return StepResult(stepResult.elapsedMilliseconds,
StepExecutionResult.fail, 'Failed expectations: $failedExp.');
}
} catch (e) {
return StepResult(
stepResult.elapsedMilliseconds, StepExecutionResult.error, 'Unable to verify expectations: $e.');
return StepResult(stepResult.elapsedMilliseconds,
StepExecutionResult.error, 'Unable to verify expectations: $e.');
}
}

Expand Down
1 change: 1 addition & 0 deletions acceptance_tests/lib/src/parameters/keyset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ class KeysetParameter extends CustomParameter<Keyset> {
cipherKey: CipherKey.fromUtf8('invalid'),
);
}
return null;
});
}
3 changes: 2 additions & 1 deletion acceptance_tests/lib/src/reporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class PubNubReporter extends Reporter {
print('');
print(' $scenarioCount scenarios executed');
print('${Color.PASS}✓${Color.RESET} $passedScenarioCount scenarios passed');
print('${Color.FAIL}x${Color.RESET} ${scenarioCount - passedScenarioCount} scenarios failed');
print(
'${Color.FAIL}x${Color.RESET} ${scenarioCount - passedScenarioCount} scenarios failed');
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//
import 'package:gherkin/gherkin.dart';
import 'package:pubnub/core.dart';
import 'package:pubnub/pubnub.dart';
import 'package:test/test.dart';

import '../../world.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:gherkin/gherkin.dart';
import 'package:pubnub/pubnub.dart';
import 'package:test/test.dart';

import '../../world.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:gherkin/gherkin.dart';
import 'package:pubnub/pubnub.dart';
import 'package:test/test.dart';

import '../../world.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:gherkin/gherkin.dart';
import 'package:pubnub/core.dart';
import 'package:pubnub/pubnub.dart';
import 'package:test/expect.dart';

import '../../world.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dart:io';

import 'package:gherkin/gherkin.dart';
import 'package:pubnub/pubnub.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:gherkin/gherkin.dart';
import 'package:pubnub/pubnub.dart';

import '../world.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:gherkin/gherkin.dart';
import 'package:pubnub/pubnub.dart';

import '../world.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dart:convert';

import 'package:gherkin/gherkin.dart';

Expand Down
2 changes: 1 addition & 1 deletion acceptance_tests/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: 1.0.0
publish_to: none

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
glob: ^2.0.1
Expand Down
6 changes: 6 additions & 0 deletions pubnub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v4.2.3
May 18 2023

#### Fixed
- Fixes issue of losing timetoken value precision in web environment. Fixed the following issues reported by [@RicharC293](https://github.com/RicharC293): [#110](https://github.com/pubnub/dart/issues/110).

## v4.2.2
November 14 2022

Expand Down
2 changes: 1 addition & 1 deletion pubnub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To add the package to your Dart or Flutter project, add `pubnub` as a dependency

```yaml
dependencies:
pubnub: ^4.2.2
pubnub: ^4.2.3
```

After adding the dependency to `pubspec.yaml`, run the `dart pub get` command in the root directory of your project (the same that the `pubspec.yaml` is in).
Expand Down
2 changes: 1 addition & 1 deletion pubnub/lib/src/core/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Core {
/// Internal module responsible for supervising.
SupervisorModule supervisor = SupervisorModule();

static String version = '4.2.2';
static String version = '4.2.3';

Core(
{Keyset? defaultKeyset,
Expand Down
6 changes: 3 additions & 3 deletions pubnub/lib/src/core/net/exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import '../exceptions.dart';
import 'response.dart';

class RequestTimeoutException extends PubNubException {
final dynamic? additionalData;
final dynamic additionalData;

RequestTimeoutException([this.additionalData]) : super('request timed out');
}

class RequestCancelException extends PubNubException {
final dynamic? additionalData;
final dynamic additionalData;

RequestCancelException([this.additionalData]) : super('request cancelled');
}

class RequestOtherException extends PubNubException {
final dynamic? additionalData;
final dynamic additionalData;

RequestOtherException([this.additionalData])
: super('request failed ($additionalData)');
Expand Down
1 change: 0 additions & 1 deletion pubnub/lib/src/core/supervisor/signals.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:async';

import 'package:pubnub/core.dart';
import 'event.dart';

final _logger = injectLogger('pubnub.core.supervisor.signals');

Expand Down
6 changes: 3 additions & 3 deletions pubnub/lib/src/dx/_endpoints/history.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class FetchHistoryResult extends Result {
if (object is List) {
return FetchHistoryResult._(
object[0],
Timetoken(BigInt.from(object[1] as int)),
Timetoken(BigInt.from(object[2] as int)));
Timetoken(BigInt.parse('${object[1]}')),
Timetoken(BigInt.parse('${object[2]}')));
}

throw getExceptionFromAny(object);
Expand Down Expand Up @@ -161,7 +161,7 @@ class BatchHistoryResultEntry {
cipherKey == null
? object['message']
: decryptFunction!(cipherKey, object['message']),
Timetoken(BigInt.parse(object['timetoken'])),
Timetoken(BigInt.parse('${object['timetoken']}')),
object['uuid'],
MessageTypeExtension.fromInt(object['message_type']),
object['actions'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class GetMembershipsMetadataParams extends Parameters {
/// {@category Objects}
class MembershipMetadata {
ChannelMetadataDetails _channel;
dynamic? _custom;
dynamic _custom;
String _updated;
String _eTag;

Expand Down Expand Up @@ -212,12 +212,12 @@ class GetChannelMembersParams extends Parameters {
/// {@category Objects}
class ChannelMemberMetadata {
final UuidMetadataDetails _uuid;
final dynamic? _custom;
final dynamic _custom;
final String _updated;
final String _eTag;

UuidMetadataDetails get uuid => _uuid;
dynamic? get custom => _custom;
dynamic get custom => _custom;
String get updated => _updated;
String get eTag => _eTag;

Expand Down
2 changes: 1 addition & 1 deletion pubnub/lib/src/dx/_endpoints/objects/uuid_metadata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class UuidMetadataDetails {
String? get externalId => _externalId;
String? get profileUrl => _profileUrl;
String? get email => _email;
dynamic? get custom => _custom;
dynamic get custom => _custom;
String? get updated => _updated;
String? get eTag => _eTag;

Expand Down
2 changes: 1 addition & 1 deletion pubnub/lib/src/dx/_utils/exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PubNubException getExceptionFromAny(dynamic error) {
}

if (error is XmlDocument) {
var details = error.rootElement.getElement('Message')?.text;
var details = error.rootElement.getElement('Message')?.value;

return PubNubException(
'Request to third party service failed. Details: $details');
Expand Down
6 changes: 3 additions & 3 deletions pubnub/lib/src/dx/files/files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ class FileDx {
Future<PublishFileMessageResult> sendFile(
String channel, String fileName, List<int> file,
{CipherKey? cipherKey,
dynamic? fileMessage,
dynamic fileMessage,
bool? storeFileMessage,
int? fileMessageTtl,
dynamic? fileMessageMeta,
dynamic fileMessageMeta,
Keyset? keyset,
String? using}) async {
keyset ??= _core.keysets[using];
Expand Down Expand Up @@ -148,7 +148,7 @@ class FileDx {
String channel, FileMessage message,
{bool? storeMessage,
int? ttl,
dynamic? meta,
dynamic meta,
CipherKey? cipherKey,
Keyset? keyset,
String? using}) async {
Expand Down
2 changes: 0 additions & 2 deletions pubnub/lib/src/dx/objects/channel_metadata.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:pubnub/core.dart';
import '../_endpoints/objects/objects_types.dart';
import 'objects.dart';
import 'objects_types.dart';

/// Represents a channel metadata.
///
Expand Down
4 changes: 2 additions & 2 deletions pubnub/lib/src/dx/objects/schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class UuidMetadataInput {
String? name;
String? email;
dynamic? custom;
dynamic custom;
String? externalId;
String? profileUrl;

Expand All @@ -26,7 +26,7 @@ class UuidMetadataInput {
class ChannelMetadataInput {
String? name;
String? description;
dynamic? custom;
dynamic custom;

ChannelMetadataInput({this.name, this.description, this.custom});

Expand Down
2 changes: 0 additions & 2 deletions pubnub/lib/src/dx/objects/uuid_metadata.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:pubnub/core.dart';
import '../_endpoints/objects/objects_types.dart';
import 'objects.dart';
import 'schema.dart';

/// Representation of UuidMetadata object
/// Useful while dealing with one specific `uuid` details
Expand Down
2 changes: 1 addition & 1 deletion pubnub/lib/src/dx/time.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ mixin TimeDx on Core {
return defaultFlow<TimeParams, Timetoken>(
core: this,
params: TimeParams(),
serialize: (object, [_]) => Timetoken(BigInt.from(object[0] as int)));
serialize: (object, [_]) => Timetoken(BigInt.parse('${object[0]}')));
}
}
1 change: 1 addition & 0 deletions pubnub/lib/src/networking/meta/diagnostics/html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ Diagnostic? getNetworkDiagnostic(dynamic exception) {
return AccessDeniedDiagnostic();
}
}
return null;
}
1 change: 1 addition & 0 deletions pubnub/lib/src/networking/meta/diagnostics/io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Diagnostic? getNetworkDiagnostic(dynamic exception) {
return AccessDeniedDiagnostic();
}
}
return null;
}

enum _Errno {
Expand Down
2 changes: 0 additions & 2 deletions pubnub/lib/src/parser/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'package:xml/xml.dart' show XmlDocument;

import 'package:pubnub/core.dart';

import '../core/parser.dart';

/// @nodoc
abstract class Parser<T> {
Future<T> decode(String input);
Expand Down
Loading