forked from eatvio/eatvio_app
feat(chat): add websocket
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '12.0'
|
||||
platform :ios, '14.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
@@ -37,5 +37,9 @@ end
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
target.build_configurations.each do |config|
|
||||
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
|
||||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
68F4DD6659288F4CFDC41C5C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7024DE075B2C1E5A149230E4 /* Pods_Runner.framework */; };
|
||||
46B43B96F809CEC6058EFDD3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15ADDB2A35F334AF0AE50011 /* Pods_Runner.framework */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
@@ -32,13 +32,12 @@
|
||||
/* Begin PBXFileReference section */
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
1DC098B20AE17A152A9E7BC6 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
15ADDB2A35F334AF0AE50011 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
4B6A3CFB60775CA626789750 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
7024DE075B2C1E5A149230E4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
938EE8FB5BAA359AAEDEFFF8 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -46,7 +45,8 @@
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
EC46FEE88A2E87A3510B5EC3 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
9D8D6181877DE17809AFF936 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
DF0C4038A57E19D3ABA03C15 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -54,27 +54,19 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
68F4DD6659288F4CFDC41C5C /* Pods_Runner.framework in Frameworks */,
|
||||
46B43B96F809CEC6058EFDD3 /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
28430AE518366E9EB19A31C9 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7024DE075B2C1E5A149230E4 /* Pods_Runner.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6F201E010624CF963CC3A17B /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1DC098B20AE17A152A9E7BC6 /* Pods-Runner.debug.xcconfig */,
|
||||
4B6A3CFB60775CA626789750 /* Pods-Runner.release.xcconfig */,
|
||||
EC46FEE88A2E87A3510B5EC3 /* Pods-Runner.profile.xcconfig */,
|
||||
938EE8FB5BAA359AAEDEFFF8 /* Pods-Runner.debug.xcconfig */,
|
||||
9D8D6181877DE17809AFF936 /* Pods-Runner.release.xcconfig */,
|
||||
DF0C4038A57E19D3ABA03C15 /* Pods-Runner.profile.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
@@ -97,7 +89,7 @@
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
6F201E010624CF963CC3A17B /* Pods */,
|
||||
28430AE518366E9EB19A31C9 /* Frameworks */,
|
||||
AEE6B7943D197783DD1CB2EE /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -124,6 +116,14 @@
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AEE6B7943D197783DD1CB2EE /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
15ADDB2A35F334AF0AE50011 /* Pods_Runner.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -131,14 +131,14 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
C9531164650CD277994F87F5 /* [CP] Check Pods Manifest.lock */,
|
||||
9A49250058577CAA8C897A03 /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
8944C2327F94FA34E28A19A3 /* [CP] Embed Pods Frameworks */,
|
||||
1D324C14EB43C988423BC1AD /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -198,23 +198,7 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
8944C2327F94FA34E28A19A3 /* [CP] Embed Pods Frameworks */ = {
|
||||
1D324C14EB43C988423BC1AD /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@@ -231,6 +215,22 @@
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
@@ -246,7 +246,7 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
C9531164650CD277994F87F5 /* [CP] Check Pods Manifest.lock */ = {
|
||||
9A49250058577CAA8C897A03 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
export 'package:flutter_bloc/flutter_bloc.dart';
|
||||
export 'package:eatvio_app/core/constants/constants.dart';
|
||||
export 'package:eatvio_app/core/errors/exceptions.dart';
|
||||
export 'package:eatvio_app/core/network/network_info.dart';
|
||||
export 'package:eatvio_app/core/utils/image_constant.dart';
|
||||
export 'package:eatvio_app/core/utils/logger.dart';
|
||||
export 'package:eatvio_app/core/utils/pref_utils.dart';
|
||||
|
||||
46
lib/core/initialization_cubit/initialization_cubit.dart
Normal file
46
lib/core/initialization_cubit/initialization_cubit.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/core/initialization_cubit/initialization_state.dart';
|
||||
import 'package:eatvio_app/core/token_storage.dart';
|
||||
import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
|
||||
import 'package:pusher_client/pusher_client.dart';
|
||||
|
||||
class InitializationCubit extends Cubit<InitializationState> {
|
||||
late final webSocketChannel;
|
||||
|
||||
final ChatRepository chatRepository;
|
||||
|
||||
InitializationCubit({required this.chatRepository}) : super(const InitializationState.loading());
|
||||
|
||||
runInitialization() async {
|
||||
try {
|
||||
await TokenStorage.haveTokenInStorage();
|
||||
|
||||
final wsUrl = await chatRepository.getWebsocket();
|
||||
|
||||
PusherOptions options = PusherOptions(
|
||||
host: 'socket.mobile-stage.eatvio.ru',
|
||||
wsPort: 443,
|
||||
encrypted: true,
|
||||
auth: PusherAuth(
|
||||
'wss://' + wsUrl.host + '/app/' + wsUrl.key,
|
||||
headers: {
|
||||
'Authorization': 'Bearer ${TokenStorage.getTokenFromStorage()}',
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
PusherClient pusher = PusherClient(
|
||||
wsUrl.key,
|
||||
options,
|
||||
autoConnect: true,
|
||||
enableLogging: true,
|
||||
);
|
||||
|
||||
await pusher.connect();
|
||||
|
||||
emit(const InitializationState.success());
|
||||
} catch (e) {
|
||||
emit(InitializationState.error(errorMessage: e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
14
lib/core/initialization_cubit/initialization_state.dart
Normal file
14
lib/core/initialization_cubit/initialization_state.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'initialization_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class InitializationState with _$InitializationState {
|
||||
const factory InitializationState() = _InitializationState;
|
||||
|
||||
const factory InitializationState.loading() = InitializationStateLoading;
|
||||
|
||||
const factory InitializationState.success() = InitializationStateSuccess;
|
||||
|
||||
const factory InitializationState.error({required String errorMessage}) = InitializationStateError;
|
||||
}
|
||||
589
lib/core/initialization_cubit/initialization_state.freezed.dart
Normal file
589
lib/core/initialization_cubit/initialization_state.freezed.dart
Normal file
@@ -0,0 +1,589 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'initialization_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$InitializationState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function() success,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? success,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function()? success,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value) $default, {
|
||||
required TResult Function(InitializationStateLoading value) loading,
|
||||
required TResult Function(InitializationStateSuccess value) success,
|
||||
required TResult Function(InitializationStateError value) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_InitializationState value)? $default, {
|
||||
TResult? Function(InitializationStateLoading value)? loading,
|
||||
TResult? Function(InitializationStateSuccess value)? success,
|
||||
TResult? Function(InitializationStateError value)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value)? $default, {
|
||||
TResult Function(InitializationStateLoading value)? loading,
|
||||
TResult Function(InitializationStateSuccess value)? success,
|
||||
TResult Function(InitializationStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $InitializationStateCopyWith<$Res> {
|
||||
factory $InitializationStateCopyWith(
|
||||
InitializationState value, $Res Function(InitializationState) then) =
|
||||
_$InitializationStateCopyWithImpl<$Res, InitializationState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState>
|
||||
implements $InitializationStateCopyWith<$Res> {
|
||||
_$InitializationStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitializationStateImplCopyWith<$Res> {
|
||||
factory _$$InitializationStateImplCopyWith(_$InitializationStateImpl value,
|
||||
$Res Function(_$InitializationStateImpl) then) =
|
||||
__$$InitializationStateImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitializationStateImplCopyWithImpl<$Res>
|
||||
extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateImpl>
|
||||
implements _$$InitializationStateImplCopyWith<$Res> {
|
||||
__$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value,
|
||||
$Res Function(_$InitializationStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitializationStateImpl implements _InitializationState {
|
||||
const _$InitializationStateImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'InitializationState()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$InitializationStateImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function() success,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return $default();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? success,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return $default?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function()? success,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value) $default, {
|
||||
required TResult Function(InitializationStateLoading value) loading,
|
||||
required TResult Function(InitializationStateSuccess value) success,
|
||||
required TResult Function(InitializationStateError value) error,
|
||||
}) {
|
||||
return $default(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_InitializationState value)? $default, {
|
||||
TResult? Function(InitializationStateLoading value)? loading,
|
||||
TResult? Function(InitializationStateSuccess value)? success,
|
||||
TResult? Function(InitializationStateError value)? error,
|
||||
}) {
|
||||
return $default?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value)? $default, {
|
||||
TResult Function(InitializationStateLoading value)? loading,
|
||||
TResult Function(InitializationStateSuccess value)? success,
|
||||
TResult Function(InitializationStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _InitializationState implements InitializationState {
|
||||
const factory _InitializationState() = _$InitializationStateImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitializationStateLoadingImplCopyWith<$Res> {
|
||||
factory _$$InitializationStateLoadingImplCopyWith(
|
||||
_$InitializationStateLoadingImpl value,
|
||||
$Res Function(_$InitializationStateLoadingImpl) then) =
|
||||
__$$InitializationStateLoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitializationStateLoadingImplCopyWithImpl<$Res>
|
||||
extends _$InitializationStateCopyWithImpl<$Res,
|
||||
_$InitializationStateLoadingImpl>
|
||||
implements _$$InitializationStateLoadingImplCopyWith<$Res> {
|
||||
__$$InitializationStateLoadingImplCopyWithImpl(
|
||||
_$InitializationStateLoadingImpl _value,
|
||||
$Res Function(_$InitializationStateLoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitializationStateLoadingImpl implements InitializationStateLoading {
|
||||
const _$InitializationStateLoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'InitializationState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$InitializationStateLoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function() success,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? success,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function()? success,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value) $default, {
|
||||
required TResult Function(InitializationStateLoading value) loading,
|
||||
required TResult Function(InitializationStateSuccess value) success,
|
||||
required TResult Function(InitializationStateError value) error,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_InitializationState value)? $default, {
|
||||
TResult? Function(InitializationStateLoading value)? loading,
|
||||
TResult? Function(InitializationStateSuccess value)? success,
|
||||
TResult? Function(InitializationStateError value)? error,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value)? $default, {
|
||||
TResult Function(InitializationStateLoading value)? loading,
|
||||
TResult Function(InitializationStateSuccess value)? success,
|
||||
TResult Function(InitializationStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class InitializationStateLoading implements InitializationState {
|
||||
const factory InitializationStateLoading() = _$InitializationStateLoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitializationStateSuccessImplCopyWith<$Res> {
|
||||
factory _$$InitializationStateSuccessImplCopyWith(
|
||||
_$InitializationStateSuccessImpl value,
|
||||
$Res Function(_$InitializationStateSuccessImpl) then) =
|
||||
__$$InitializationStateSuccessImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitializationStateSuccessImplCopyWithImpl<$Res>
|
||||
extends _$InitializationStateCopyWithImpl<$Res,
|
||||
_$InitializationStateSuccessImpl>
|
||||
implements _$$InitializationStateSuccessImplCopyWith<$Res> {
|
||||
__$$InitializationStateSuccessImplCopyWithImpl(
|
||||
_$InitializationStateSuccessImpl _value,
|
||||
$Res Function(_$InitializationStateSuccessImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitializationStateSuccessImpl implements InitializationStateSuccess {
|
||||
const _$InitializationStateSuccessImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'InitializationState.success()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$InitializationStateSuccessImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function() success,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return success();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? success,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return success?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function()? success,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (success != null) {
|
||||
return success();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value) $default, {
|
||||
required TResult Function(InitializationStateLoading value) loading,
|
||||
required TResult Function(InitializationStateSuccess value) success,
|
||||
required TResult Function(InitializationStateError value) error,
|
||||
}) {
|
||||
return success(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_InitializationState value)? $default, {
|
||||
TResult? Function(InitializationStateLoading value)? loading,
|
||||
TResult? Function(InitializationStateSuccess value)? success,
|
||||
TResult? Function(InitializationStateError value)? error,
|
||||
}) {
|
||||
return success?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value)? $default, {
|
||||
TResult Function(InitializationStateLoading value)? loading,
|
||||
TResult Function(InitializationStateSuccess value)? success,
|
||||
TResult Function(InitializationStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (success != null) {
|
||||
return success(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class InitializationStateSuccess implements InitializationState {
|
||||
const factory InitializationStateSuccess() = _$InitializationStateSuccessImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitializationStateErrorImplCopyWith<$Res> {
|
||||
factory _$$InitializationStateErrorImplCopyWith(
|
||||
_$InitializationStateErrorImpl value,
|
||||
$Res Function(_$InitializationStateErrorImpl) then) =
|
||||
__$$InitializationStateErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String errorMessage});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitializationStateErrorImplCopyWithImpl<$Res>
|
||||
extends _$InitializationStateCopyWithImpl<$Res,
|
||||
_$InitializationStateErrorImpl>
|
||||
implements _$$InitializationStateErrorImplCopyWith<$Res> {
|
||||
__$$InitializationStateErrorImplCopyWithImpl(
|
||||
_$InitializationStateErrorImpl _value,
|
||||
$Res Function(_$InitializationStateErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? errorMessage = null,
|
||||
}) {
|
||||
return _then(_$InitializationStateErrorImpl(
|
||||
errorMessage: null == errorMessage
|
||||
? _value.errorMessage
|
||||
: errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitializationStateErrorImpl implements InitializationStateError {
|
||||
const _$InitializationStateErrorImpl({required this.errorMessage});
|
||||
|
||||
@override
|
||||
final String errorMessage;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'InitializationState.error(errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$InitializationStateErrorImpl &&
|
||||
(identical(other.errorMessage, errorMessage) ||
|
||||
other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, errorMessage);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl>
|
||||
get copyWith => __$$InitializationStateErrorImplCopyWithImpl<
|
||||
_$InitializationStateErrorImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function() success,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return error(errorMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? success,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return error?.call(errorMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function()? success,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(errorMessage);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value) $default, {
|
||||
required TResult Function(InitializationStateLoading value) loading,
|
||||
required TResult Function(InitializationStateSuccess value) success,
|
||||
required TResult Function(InitializationStateError value) error,
|
||||
}) {
|
||||
return error(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_InitializationState value)? $default, {
|
||||
TResult? Function(InitializationStateLoading value)? loading,
|
||||
TResult? Function(InitializationStateSuccess value)? success,
|
||||
TResult? Function(InitializationStateError value)? error,
|
||||
}) {
|
||||
return error?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_InitializationState value)? $default, {
|
||||
TResult Function(InitializationStateLoading value)? loading,
|
||||
TResult Function(InitializationStateSuccess value)? success,
|
||||
TResult Function(InitializationStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class InitializationStateError implements InitializationState {
|
||||
const factory InitializationStateError({required final String errorMessage}) =
|
||||
_$InitializationStateErrorImpl;
|
||||
|
||||
String get errorMessage;
|
||||
@JsonKey(ignore: true)
|
||||
_$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
|
||||
// For checking internet connectivity
|
||||
abstract class NetworkInfoI {
|
||||
Future<bool> isConnected();
|
||||
|
||||
Future<ConnectivityResult> get connectivityResult;
|
||||
|
||||
Stream<ConnectivityResult> get onConnectivityChanged;
|
||||
}
|
||||
|
||||
class NetworkInfo implements NetworkInfoI {
|
||||
Connectivity connectivity;
|
||||
|
||||
static final NetworkInfo _networkInfo = NetworkInfo._internal(Connectivity());
|
||||
|
||||
factory NetworkInfo() {
|
||||
return _networkInfo;
|
||||
}
|
||||
|
||||
NetworkInfo._internal(this.connectivity) {
|
||||
connectivity = this.connectivity;
|
||||
}
|
||||
|
||||
///checks internet is connected or not
|
||||
///returns [true] if internet is connected
|
||||
///else it will return [false]
|
||||
@override
|
||||
Future<bool> isConnected() async {
|
||||
final result = await connectivity.checkConnectivity();
|
||||
if (result != ConnectivityResult.none) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// to check type of internet connectivity
|
||||
@override
|
||||
Future<ConnectivityResult> get connectivityResult async {
|
||||
return connectivity.checkConnectivity();
|
||||
}
|
||||
|
||||
//check the type on internet connection on changed of internet connection
|
||||
@override
|
||||
Stream<ConnectivityResult> get onConnectivityChanged =>
|
||||
connectivity.onConnectivityChanged;
|
||||
}
|
||||
@@ -6,7 +6,11 @@ part 'websocket_info_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class WebsocketInfoModel with _$WebsocketInfoModel {
|
||||
const factory WebsocketInfoModel() = _WebsocketInfoModel;
|
||||
const factory WebsocketInfoModel({
|
||||
required String key,
|
||||
required String host,
|
||||
required String port,
|
||||
}) = _WebsocketInfoModel;
|
||||
|
||||
factory WebsocketInfoModel.fromJson(Map<String, Object?> json) => _$WebsocketInfoModelFromJson(json);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,14 @@ WebsocketInfoModel _$WebsocketInfoModelFromJson(Map<String, dynamic> json) {
|
||||
|
||||
/// @nodoc
|
||||
mixin _$WebsocketInfoModel {
|
||||
String get key => throw _privateConstructorUsedError;
|
||||
String get host => throw _privateConstructorUsedError;
|
||||
String get port => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$WebsocketInfoModelCopyWith<WebsocketInfoModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -28,6 +35,8 @@ abstract class $WebsocketInfoModelCopyWith<$Res> {
|
||||
factory $WebsocketInfoModelCopyWith(
|
||||
WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) =
|
||||
_$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>;
|
||||
@useResult
|
||||
$Res call({String key, String host, String port});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -39,13 +48,40 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel>
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? key = null,
|
||||
Object? host = null,
|
||||
Object? port = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
key: null == key
|
||||
? _value.key
|
||||
: key // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
host: null == host
|
||||
? _value.host
|
||||
: host // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
port: null == port
|
||||
? _value.port
|
||||
: port // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$WebsocketInfoModelImplCopyWith<$Res> {
|
||||
abstract class _$$WebsocketInfoModelImplCopyWith<$Res>
|
||||
implements $WebsocketInfoModelCopyWith<$Res> {
|
||||
factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value,
|
||||
$Res Function(_$WebsocketInfoModelImpl) then) =
|
||||
__$$WebsocketInfoModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String key, String host, String port});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -55,30 +91,72 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res>
|
||||
__$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value,
|
||||
$Res Function(_$WebsocketInfoModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? key = null,
|
||||
Object? host = null,
|
||||
Object? port = null,
|
||||
}) {
|
||||
return _then(_$WebsocketInfoModelImpl(
|
||||
key: null == key
|
||||
? _value.key
|
||||
: key // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
host: null == host
|
||||
? _value.host
|
||||
: host // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
port: null == port
|
||||
? _value.port
|
||||
: port // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
|
||||
const _$WebsocketInfoModelImpl();
|
||||
const _$WebsocketInfoModelImpl(
|
||||
{required this.key, required this.host, required this.port});
|
||||
|
||||
factory _$WebsocketInfoModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$WebsocketInfoModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String key;
|
||||
@override
|
||||
final String host;
|
||||
@override
|
||||
final String port;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WebsocketInfoModel()';
|
||||
return 'WebsocketInfoModel(key: $key, host: $host, port: $port)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$WebsocketInfoModelImpl);
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$WebsocketInfoModelImpl &&
|
||||
(identical(other.key, key) || other.key == key) &&
|
||||
(identical(other.host, host) || other.host == host) &&
|
||||
(identical(other.port, port) || other.port == port));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
int get hashCode => Object.hash(runtimeType, key, host, port);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
|
||||
__$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -89,8 +167,22 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
|
||||
}
|
||||
|
||||
abstract class _WebsocketInfoModel implements WebsocketInfoModel {
|
||||
const factory _WebsocketInfoModel() = _$WebsocketInfoModelImpl;
|
||||
const factory _WebsocketInfoModel(
|
||||
{required final String key,
|
||||
required final String host,
|
||||
required final String port}) = _$WebsocketInfoModelImpl;
|
||||
|
||||
factory _WebsocketInfoModel.fromJson(Map<String, dynamic> json) =
|
||||
_$WebsocketInfoModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get key;
|
||||
@override
|
||||
String get host;
|
||||
@override
|
||||
String get port;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,16 @@ part of 'websocket_info_model.dart';
|
||||
|
||||
_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$WebsocketInfoModelImpl();
|
||||
_$WebsocketInfoModelImpl(
|
||||
key: json['key'] as String,
|
||||
host: json['host'] as String,
|
||||
port: json['port'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$WebsocketInfoModelImplToJson(
|
||||
_$WebsocketInfoModelImpl instance) =>
|
||||
<String, dynamic>{};
|
||||
<String, dynamic>{
|
||||
'key': instance.key,
|
||||
'host': instance.host,
|
||||
'port': instance.port,
|
||||
};
|
||||
|
||||
@@ -2,32 +2,30 @@ import 'package:flutter/material.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
|
||||
class CustomSearchView extends StatelessWidget {
|
||||
CustomSearchView(
|
||||
{Key? key,
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.scrollPadding,
|
||||
this.controller,
|
||||
this.focusNode,
|
||||
this.autofocus = false,
|
||||
this.textStyle,
|
||||
this.textInputType = TextInputType.text,
|
||||
this.maxLines,
|
||||
this.hintText,
|
||||
this.hintStyle,
|
||||
this.prefix,
|
||||
this.prefixConstraints,
|
||||
this.suffix,
|
||||
this.suffixConstraints,
|
||||
this.contentPadding,
|
||||
this.borderDecoration,
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged})
|
||||
: super(
|
||||
key: key,
|
||||
);
|
||||
CustomSearchView({
|
||||
Key? key,
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.scrollPadding,
|
||||
this.controller,
|
||||
this.focusNode,
|
||||
this.autofocus = false,
|
||||
this.textStyle,
|
||||
this.textInputType = TextInputType.text,
|
||||
this.maxLines,
|
||||
this.hintText,
|
||||
this.hintStyle,
|
||||
this.prefix,
|
||||
this.prefixConstraints,
|
||||
this.suffix,
|
||||
this.suffixConstraints,
|
||||
this.contentPadding,
|
||||
this.borderDecoration,
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
final Alignment? alignment;
|
||||
|
||||
@@ -73,13 +71,12 @@ class CustomSearchView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null ? Align(alignment: alignment ?? Alignment.center, child: searchViewWidget(context)) : searchViewWidget(context);
|
||||
return searchViewWidget(context);
|
||||
}
|
||||
|
||||
searchViewWidget(BuildContext context) => SizedBox(
|
||||
width: width ?? double.maxFinite,
|
||||
child: TextFormField(
|
||||
scrollPadding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
onTapOutside: (event) => onTapOutside(),
|
||||
|
||||
@@ -44,7 +44,7 @@ class ChatSelectScreen extends StatelessWidget {
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return [
|
||||
SliverAppBar(
|
||||
backgroundColor: Colors.white,
|
||||
automaticallyImplyLeading: false,
|
||||
stretchTriggerOffset: 1,
|
||||
forceMaterialTransparency: true,
|
||||
floating: true,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
|
||||
import 'package:eatvio_app/features/chat/services/chat_service.dart';
|
||||
@@ -10,6 +11,7 @@ final sl = GetIt.instance;
|
||||
Future<void> init() async {
|
||||
// BLoC
|
||||
sl.registerFactory<ChatRoomCubit>(() => ChatRoomCubit(chatRepository: sl()));
|
||||
sl.registerFactory<InitializationCubit>(() => InitializationCubit(chatRepository: sl()));
|
||||
|
||||
// Repository
|
||||
sl.registerLazySingleton<ChatRepository>(() => ChatRepository(chatService: sl()));
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'package:eatvio_app/app_router.dart';
|
||||
import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart';
|
||||
import 'package:eatvio_app/core/initialization_cubit/initialization_state.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_bloc.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/models/chat_select_model.dart';
|
||||
import 'package:eatvio_app/locator_service.dart';
|
||||
import 'package:eatvio_app/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart';
|
||||
import 'package:eatvio_app/presentation/diary/diary_edit_screen/models/diary_edit_model.dart';
|
||||
import 'package:eatvio_app/presentation/feed/feed_screen/bloc/feed_bloc.dart';
|
||||
@@ -40,64 +43,53 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<InitializationCubit>(create: (context) => sl<InitializationCubit>()..runInitialization()),
|
||||
BlocProvider<ThemeBloc>(
|
||||
create: (context) => ThemeBloc(
|
||||
ThemeState(themeType: PrefUtils().getThemeData()),
|
||||
),
|
||||
create: (context) => ThemeBloc(ThemeState(themeType: PrefUtils().getThemeData())),
|
||||
),
|
||||
BlocProvider<MyProfileBloc>(
|
||||
create: (context) => MyProfileBloc(
|
||||
MyProfileState(
|
||||
myProfileModelObj: MyProfileModel(),
|
||||
),
|
||||
)..add(MyProfileInitialEvent()),
|
||||
create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent()),
|
||||
),
|
||||
BlocProvider<FeedBloc>(
|
||||
create: (context) => FeedBloc(FeedState(myProfileModelObj: FeedModel()))
|
||||
..add(
|
||||
FeedInitialEvent(),
|
||||
),
|
||||
create: (context) => FeedBloc(FeedState(myProfileModelObj: FeedModel()))..add(FeedInitialEvent()),
|
||||
),
|
||||
BlocProvider<DiaryEditBloc>(
|
||||
create: (context) => DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel()))
|
||||
..add(
|
||||
DiaryEditInitialEvent(),
|
||||
),
|
||||
create: (context) => DiaryEditBloc(DiaryEditState(diaryEditModelObj: DiaryEditModel()))..add(DiaryEditInitialEvent()),
|
||||
),
|
||||
BlocProvider<ChatSelectBloc>(
|
||||
create: (context) => ChatSelectBloc(ChatSelectState(chatSelectModelObj: ChatSelectModel()))
|
||||
..add(
|
||||
ChatSelectInitialEvent(),
|
||||
),
|
||||
create: (context) => ChatSelectBloc(ChatSelectState(chatSelectModelObj: ChatSelectModel()))..add(ChatSelectInitialEvent()),
|
||||
),
|
||||
],
|
||||
child: BlocBuilder<ThemeBloc, ThemeState>(
|
||||
builder: (context, state) {
|
||||
return KeyboardDismisser(
|
||||
gestures: [
|
||||
GestureType.onTap,
|
||||
GestureType.onPanUpdateDownDirection,
|
||||
],
|
||||
child: MaterialApp.router(
|
||||
theme: theme,
|
||||
title: 'Eatvio',
|
||||
routerConfig: AppRouter.appRouter,
|
||||
debugShowCheckedModeBanner: false,
|
||||
localizationsDelegates: [
|
||||
AppLocalizationDelegate(),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
child: BlocListener<InitializationCubit, InitializationState>(
|
||||
listener: (BuildContext context, InitializationState state) { },
|
||||
child: BlocBuilder<ThemeBloc, ThemeState>(
|
||||
builder: (context, state) {
|
||||
return KeyboardDismisser(
|
||||
gestures: [
|
||||
GestureType.onTap,
|
||||
GestureType.onPanUpdateDownDirection,
|
||||
],
|
||||
supportedLocales: [
|
||||
Locale(
|
||||
'ru',
|
||||
'',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: MaterialApp.router(
|
||||
theme: theme,
|
||||
title: 'Eatvio',
|
||||
routerConfig: AppRouter.appRouter,
|
||||
debugShowCheckedModeBanner: false,
|
||||
localizationsDelegates: [
|
||||
AppLocalizationDelegate(),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [
|
||||
Locale(
|
||||
'ru',
|
||||
'',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
lineTouchData: LineTouchData(
|
||||
touchTooltipData: LineTouchTooltipData(
|
||||
maxContentWidth: 100,
|
||||
tooltipBgColor: Colors.black,
|
||||
// tooltipBgColor: Colors.black,
|
||||
getTooltipItems: mapSpots(),
|
||||
),
|
||||
handleBuiltInTouches: true,
|
||||
@@ -519,7 +519,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
lineTouchData: LineTouchData(
|
||||
touchTooltipData: LineTouchTooltipData(
|
||||
maxContentWidth: 100,
|
||||
tooltipBgColor: Colors.black,
|
||||
// tooltipBgColor: Colors.black,
|
||||
getTooltipItems: mapTouchedSpots(),
|
||||
),
|
||||
handleBuiltInTouches: true,
|
||||
|
||||
57
pubspec.yaml
57
pubspec.yaml
@@ -12,36 +12,55 @@ dependencies:
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
|
||||
flutter_bloc: ^8.0.0
|
||||
connectivity_plus: ^5.0.2
|
||||
shared_preferences: ^2.0.15
|
||||
cached_network_image: ^3.3.1
|
||||
flutter_svg: ^2.0.9
|
||||
equatable: ^2.0.0
|
||||
validators: ^3.0.0
|
||||
# BLoC state manager
|
||||
flutter_bloc: ^8.1.6
|
||||
# local storage
|
||||
shared_preferences: ^2.2.3
|
||||
hive: ^2.2.3
|
||||
hive_flutter: ^1.1.0
|
||||
isar_flutter_libs: ^4.0.0-dev.13
|
||||
path_provider: ^2.1.0
|
||||
fl_chart: ^0.66.0
|
||||
flutter_spinkit: ^5.0.0
|
||||
#
|
||||
cached_network_image: ^3.3.1
|
||||
#
|
||||
flutter_svg: ^2.0.9
|
||||
#
|
||||
equatable: ^2.0.5
|
||||
#
|
||||
freezed_annotation: ^2.4.1
|
||||
#
|
||||
json_annotation: ^4.9.0
|
||||
#
|
||||
validators: ^3.0.0
|
||||
#
|
||||
isar_flutter_libs: ^3.1.0+1
|
||||
#
|
||||
path_provider: ^2.1.3
|
||||
#
|
||||
fl_chart: ^0.68.0
|
||||
#
|
||||
flutter_spinkit: ^5.2.1
|
||||
#
|
||||
flutter_dotenv: ^5.1.0
|
||||
#
|
||||
carousel_slider: ^4.2.1
|
||||
flutter_form_builder: ^9.2.1
|
||||
image_picker: ^1.0.7
|
||||
#
|
||||
flutter_form_builder: ^9.3.0
|
||||
#
|
||||
image_picker: ^1.1.2
|
||||
#
|
||||
flutter_typeahead: ^5.2.0
|
||||
bloc_test: ^9.1.6
|
||||
# navigation
|
||||
go_router: ^14.1.4
|
||||
#
|
||||
keyboard_dismisser: ^3.0.0
|
||||
|
||||
freezed_annotation: ^2.4.1
|
||||
json_annotation: ^4.9.0
|
||||
# service generator
|
||||
retrofit: ^4.1.0
|
||||
# di
|
||||
get_it: ^7.7.0
|
||||
# http request
|
||||
dio: ^5.4.3+1
|
||||
|
||||
# photo viewer
|
||||
# websocket
|
||||
pusher_client: ^2.0.0
|
||||
# photo gallery viewer
|
||||
photo_view: ^0.15.0
|
||||
#url launcher
|
||||
url_launcher: ^6.3.0
|
||||
|
||||
@@ -2,13 +2,10 @@ import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:bloc_test/bloc_test.dart';
|
||||
import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart';
|
||||
import 'package:eatvio_app/presentation/auth/auth_screen/bloc/auth_bloc.dart';
|
||||
import 'package:eatvio_app/presentation/auth/auth_screen/models/auth_model.dart';
|
||||
|
||||
class MockAuthBloc extends MockBloc<AuthEvent, AuthState> implements AuthBloc {}
|
||||
|
||||
void main() {
|
||||
group('AuthScreen', () {
|
||||
testWidgets('renders AuthScreen with initial state',
|
||||
|
||||
Reference in New Issue
Block a user