fix reconnection event
This commit is contained in:
@@ -417,6 +417,7 @@ class StreamChatClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _connectionStatusHandler(ConnectionStatus status) async {
|
void _connectionStatusHandler(ConnectionStatus status) async {
|
||||||
|
final previousState = wsConnectionStatus;
|
||||||
final currentState = _wsConnectionStatus = status;
|
final currentState = _wsConnectionStatus = status;
|
||||||
|
|
||||||
handleEvent(Event(
|
handleEvent(Event(
|
||||||
@@ -436,10 +437,12 @@ class StreamChatClient {
|
|||||||
await sync(cids: cids, lastSyncAt: _lastSyncedAt);
|
await sync(cids: cids, lastSyncAt: _lastSyncedAt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleEvent(Event(
|
if (previousState != ConnectionStatus.connected) {
|
||||||
type: EventType.connectionRecovered,
|
handleEvent(Event(
|
||||||
online: true,
|
type: EventType.connectionRecovered,
|
||||||
));
|
online: true,
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.example.example"
|
applicationId "com.example.example"
|
||||||
minSdkVersion 21
|
minSdkVersion 22
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 50;
|
objectVersion = 51;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@@ -68,7 +68,6 @@
|
|||||||
59062C6EC2CCFE110AC70AB8 /* Pods-Runner.release.xcconfig */,
|
59062C6EC2CCFE110AC70AB8 /* Pods-Runner.release.xcconfig */,
|
||||||
4684439012E1DB1A82103E26 /* Pods-Runner.profile.xcconfig */,
|
4684439012E1DB1A82103E26 /* Pods-Runner.profile.xcconfig */,
|
||||||
);
|
);
|
||||||
name = Pods;
|
|
||||||
path = Pods;
|
path = Pods;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -356,13 +355,17 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
DEVELOPMENT_TEAM = EHV7XZLAHA;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Flutter",
|
"$(PROJECT_DIR)/Flutter",
|
||||||
);
|
);
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Flutter",
|
"$(PROJECT_DIR)/Flutter",
|
||||||
@@ -488,13 +491,17 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
DEVELOPMENT_TEAM = EHV7XZLAHA;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Flutter",
|
"$(PROJECT_DIR)/Flutter",
|
||||||
);
|
);
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Flutter",
|
"$(PROJECT_DIR)/Flutter",
|
||||||
@@ -515,13 +522,17 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
DEVELOPMENT_TEAM = EHV7XZLAHA;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Flutter",
|
"$(PROJECT_DIR)/Flutter",
|
||||||
);
|
);
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
LIBRARY_SEARCH_PATHS = (
|
LIBRARY_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Flutter",
|
"$(PROJECT_DIR)/Flutter",
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ class StreamChannelListController extends PagedValueNotifier<int, Channel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_channelEventSubscription = client.on().listen((event) {
|
_channelEventSubscription = client.on().listen((event) {
|
||||||
|
print('event.type: ${event.type}');
|
||||||
// Returns early if the event is already handled by the listener.
|
// Returns early if the event is already handled by the listener.
|
||||||
if (eventListener?.call(event) ?? false) return;
|
if (eventListener?.call(event) ?? false) return;
|
||||||
|
|
||||||
@@ -237,10 +238,6 @@ class StreamChannelListController extends PagedValueNotifier<int, Channel> {
|
|||||||
_eventHandler.onChannelVisible(event, this);
|
_eventHandler.onChannelVisible(event, this);
|
||||||
} else if (eventType == EventType.connectionRecovered) {
|
} else if (eventType == EventType.connectionRecovered) {
|
||||||
_eventHandler.onConnectionRecovered(event, this);
|
_eventHandler.onConnectionRecovered(event, this);
|
||||||
} else if (eventType == EventType.connectionChanged) {
|
|
||||||
if (event.online != null) {
|
|
||||||
_eventHandler.onConnectionRecovered(event, this);
|
|
||||||
}
|
|
||||||
} else if (eventType == EventType.messageNew) {
|
} else if (eventType == EventType.messageNew) {
|
||||||
_eventHandler.onMessageNew(event, this);
|
_eventHandler.onMessageNew(event, this);
|
||||||
} else if (eventType == EventType.notificationAddedToChannel) {
|
} else if (eventType == EventType.notificationAddedToChannel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user