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

Protocol 2.0 draft #446

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public AblyMethodCallHandler(final MethodChannel methodChannel,
_map.put(PlatformConstants.PlatformMethod.releaseRestChannel, this::releaseRestChannel);

//Realtime
_map.put(PlatformConstants.PlatformMethod.getRealtimeConnectionRecoveryKey, this::getRealtimeConnectionRecoveryKey);
_map.put(PlatformConstants.PlatformMethod.createRealtime, this::createRealtime);
_map.put(PlatformConstants.PlatformMethod.connectRealtime, this::connectRealtime);
_map.put(PlatformConstants.PlatformMethod.closeRealtime, this::closeRealtime);
Expand Down Expand Up @@ -465,6 +466,12 @@ public void notImplemented() {
}
}

private void getRealtimeConnectionRecoveryKey(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
final AblyFlutterMessage ablyMessage = (AblyFlutterMessage) call.arguments;
final String recoveryKey = instanceStore.getRealtime(ablyMessage.handle).connection.getRecoveryKey();
result.success(recoveryKey);
}

private void connectRealtime(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
final AblyFlutterMessage ablyMessage = (AblyFlutterMessage) call.arguments;
instanceStore.getRealtime(ablyMessage.handle).connect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static final public class PlatformMethod {
public static final String realtimeHistory = "realtimeHistory";
public static final String realtimeTime = "realtimeTime";
public static final String restTime = "restTime";
public static final String getRealtimeConnectionRecoveryKey = "getRealtimeConnectionRecoveryKey";
public static final String pushActivate = "pushActivate";
public static final String pushDeactivate = "pushDeactivate";
public static final String pushReset = "pushReset";
Expand Down
4 changes: 4 additions & 0 deletions bin/codegen_context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ const List<Map<String, dynamic>> _platformMethods = [
{'name': 'realtimeHistory', 'value': 'realtimeHistory'},
{'name': 'realtimeTime', 'value': 'realtimeTime'},
{'name': 'restTime', 'value': 'restTime'},
{
'name': 'getRealtimeConnectionRecoveryKey',
'value': 'getRealtimeConnectionRecoveryKey'
},

// Push Notifications
{'name': 'pushActivate', 'value': 'pushActivate'},
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
18 changes: 9 additions & 9 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PODS:
- Ably (1.2.10):
- AblyDeltaCodec (= 1.3.2)
- Ably (1.2.15):
- AblyDeltaCodec (= 1.3.3)
- msgpack (= 0.4.0)
- ably_flutter (1.2.15):
- Ably (= 1.2.10)
- Ably
- Flutter
- AblyDeltaCodec (1.3.2)
- AblyDeltaCodec (1.3.3)
- device_info_plus (0.0.1):
- Flutter
- Flutter (1.0.0)
Expand Down Expand Up @@ -44,16 +44,16 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluttertoast/ios"

SPEC CHECKSUMS:
Ably: 80be962e2e87bac69727a26ba72b868c8e86288e
ably_flutter: bba4fea46a2a3269fae98b67bd5c0c75cf3f0132
AblyDeltaCodec: 783d017270de70bbbc0a84e4235297b225d33636
Ably: bdbaa2cf4937881ac38f0fa4b99905c21a8bc28e
ably_flutter: 1341de3d132c22e32e2234710b58aae945eb2562
AblyDeltaCodec: add5d06a756b3581b12aab5b5500a320b8c55bea
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58
msgpack: c85f6251873059738472ae136951cec5f30f3251
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196

PODFILE CHECKSUM: fe0e1ee7f3d1f7d00b11b474b62dd62134535aea
PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d

COCOAPODS: 1.11.3
6 changes: 3 additions & 3 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -446,7 +446,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -495,7 +495,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
2 changes: 2 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
14 changes: 7 additions & 7 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
charcode:
dependency: transitive
description:
Expand All @@ -49,7 +49,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
crypto:
dependency: "direct main"
description:
Expand Down Expand Up @@ -199,7 +199,7 @@ packages:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
version: "0.6.4"
lints:
dependency: transitive
description:
Expand All @@ -213,14 +213,14 @@ packages:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
path:
dependency: transitive
description:
Expand Down Expand Up @@ -323,7 +323,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
win32:
dependency: transitive
description:
Expand All @@ -346,5 +346,5 @@ packages:
source: hosted
version: "5.3.1"
sdks:
dart: ">=2.15.0 <3.0.0"
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.8.0"
10 changes: 10 additions & 0 deletions ios/Classes/AblyFlutter.m
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ -(void)reset;
result(handle);
};

static const FlutterHandler _getRealtimeConnectionRecoveryKey = ^void(AblyFlutter *const ably, FlutterMethodCall *const call, const FlutterResult result) {
AblyFlutterMessage *const ablyMessage = call.arguments;

AblyInstanceStore *const instanceStore = [ably instanceStore];

NSString *recoveryKey = [[instanceStore realtimeFrom:ablyMessage.handle].connection getRecoveryKey];
result(recoveryKey);
};

static const FlutterHandler _connectRealtime = ^void(AblyFlutter *const ably, FlutterMethodCall *const call, const FlutterResult result) {
AblyFlutterMessage *const ablyMessage = call.arguments;

Expand Down Expand Up @@ -702,6 +711,7 @@ -(instancetype)initWithChannel:(FlutterMethodChannel *const)channel
AblyPlatformMethod_createRealtime: _createRealtime,
AblyPlatformMethod_setRealtimeChannelOptions: _setRealtimeChannelOptions,
AblyPlatformMethod_connectRealtime: _connectRealtime,
AblyPlatformMethod_getRealtimeConnectionRecoveryKey: _getRealtimeConnectionRecoveryKey,
AblyPlatformMethod_closeRealtime: _closeRealtime,
AblyPlatformMethod_attachRealtimeChannel: _attachRealtimeChannel,
AblyPlatformMethod_detachRealtimeChannel: _detachRealtimeChannel,
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/codec/AblyPlatformConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ extern NSString *const AblyPlatformMethod_releaseRealtimeChannel;
extern NSString *const AblyPlatformMethod_realtimeHistory;
extern NSString *const AblyPlatformMethod_realtimeTime;
extern NSString *const AblyPlatformMethod_restTime;
extern NSString *const AblyPlatformMethod_getRealtimeConnectionRecoveryKey;
extern NSString *const AblyPlatformMethod_pushActivate;
extern NSString *const AblyPlatformMethod_pushDeactivate;
extern NSString *const AblyPlatformMethod_pushReset;
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/codec/AblyPlatformConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
NSString *const AblyPlatformMethod_realtimeHistory= @"realtimeHistory";
NSString *const AblyPlatformMethod_realtimeTime= @"realtimeTime";
NSString *const AblyPlatformMethod_restTime= @"restTime";
NSString *const AblyPlatformMethod_getRealtimeConnectionRecoveryKey= @"getRealtimeConnectionRecoveryKey";
NSString *const AblyPlatformMethod_pushActivate= @"pushActivate";
NSString *const AblyPlatformMethod_pushDeactivate= @"pushDeactivate";
NSString *const AblyPlatformMethod_pushReset= @"pushReset";
Expand Down
8 changes: 4 additions & 4 deletions lib/src/generated/platform_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class PlatformMethod {
static const String realtimeHistory = 'realtimeHistory';
static const String realtimeTime = 'realtimeTime';
static const String restTime = 'restTime';
static const String getRealtimeConnectionRecoveryKey =
'getRealtimeConnectionRecoveryKey';
static const String pushActivate = 'pushActivate';
static const String pushDeactivate = 'pushDeactivate';
static const String pushReset = 'pushReset';
Expand Down Expand Up @@ -385,8 +387,7 @@ class TxPushRequestPermission {
static const String alert = 'alert';
static const String carPlay = 'carPlay';
static const String criticalAlert = 'criticalAlert';
static const String providesAppNotificationSettings =
'providesAppNotificationSettings';
static const String providesAppNotificationSettings = 'providesAppNotificationSettings';
static const String provisional = 'provisional';
static const String announcement = 'announcement';
}
Expand All @@ -402,8 +403,7 @@ class TxUNNotificationSettings {
static const String alertStyle = 'alertStyle';
static const String showPreviewsSetting = 'showPreviewsSetting';
static const String criticalAlertSetting = 'criticalAlertSetting';
static const String providesAppNotificationSettings =
'providesAppNotificationSettings';
static const String providesAppNotificationSettings = 'providesAppNotificationSettings';
static const String announcementSetting = 'announcementSetting';
static const String scheduledDeliverySetting = 'scheduledDeliverySetting';
static const String timeSensitiveSetting = 'timeSensitiveSetting';
Expand Down
12 changes: 4 additions & 8 deletions lib/src/platform/src/realtime/connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@ class Connection extends PlatformObject {
/// https://docs.ably.com/client-lib-development-guide/features/#RTN9
String? key;

/// RTN16b) Connection#recoveryKey is an attribute composed of the
/// connection key and latest serial received on the connection
String? recoveryKey;

/// The serial number of the last message to be received on this connection.
///
/// https://docs.ably.com/client-lib-development-guide/features/#RTN10
int? serial;
/// https://docs.ably.com/client-lib-development-guide/features/#RTN16g
/// https://docs.ably.com/client-lib-development-guide/features/#RTN16h
Future<String?> getRecoveryKey() async =>
invoke(PlatformMethod.getRealtimeConnectionRecoveryKey);

/// current state of this connection
///
Expand Down
31 changes: 12 additions & 19 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.8.2"
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,21 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: "direct main"
description:
Expand All @@ -49,7 +42,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -80,28 +73,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: "direct main"
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -113,7 +106,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand All @@ -134,21 +127,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
vector_math:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion test_integration/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
Loading