urva_connect_sdk_main 0.0.3
urva_connect_sdk_main: ^0.0.3 copied to clipboard
Urva connect sdk used for urva support chat
urva-connect-sdk-flutter #
A comprehensive Flutter SDK for integrating Urva's support chat functionality into your mobile applications. This SDK provides a complete solution for building feature-rich chat applications with support for text messaging, media sharing, notifications, and more.
Features #
- Real-time Chat: Socket.io-based real-time messaging
- Media Support: Image, video, audio, and document sharing
- Rich UI Components: Reactions, mentions, link previews, and markdown support
- Notifications: Local and push notifications with customizable sounds
- Security: End-to-end encryption, certificate pinning, and secure storage
- Offline Support: Cached messages and offline file handling
- Multi-platform: iOS and Android support with platform-specific optimizations
- Theming: Dark/light theme support with customizable colors
- File Management: PDF viewer, image picker, and file compression
- Audio/Video: Voice messages, TTS, and video playback
- Connectivity: Network state monitoring and automatic reconnection
Getting Started #
Prerequisites #
- Flutter SDK ^3.9.2
- Dart SDK ^3.9.2
- iOS 11.0+ or Android API 21+
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
...
urva_connect_sdk_main: ^0.0.3
In your library add the following import:
import 'package:urva_connect_sdk_main/urva_connect_sdk_main.dart';
For help getting started with Flutter, view the online documentation.
Usage #
First initialize the sdk
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await UrvaConnectSdk.initializeSdk(
baseUrl: "BASE_URL",
userToken: "USER_AUTH_TOKEN",
companyToken: "COMAPANY_TOKEN",
);
runApp(MultiProvider(providers: [
...UrvaConnectProvider.allProvider
], child: MyApp(),));
}
Example for Urva connect sdk
class _MyHomePageState extends State<MyHomePage> {
ValueNotifier<bool> isLoading = ValueNotifier(false);
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
isLoading.value = true;
///for fetching connect data before opening the connect screen,
///this is optional, you can directly open the connect screen without fetching the connect data,
///but if you want to fetch the connect data before opening the connect screen, then you can use this method.
await UrvaConnectSdk.fetchConnectData();
isLoading.value = false;
},);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text(widget.title),),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ValueListenableBuilder(valueListenable: isLoading, builder: (context, value, child) {
if (value) {
return CircularProgressIndicator();
} else {
return ElevatedButton(onPressed: () {
UrvaConnectSdk.openScreen(context);
}, child: Text("Open Urva Connect"));
}
},)
],
),
),
),
);
}
}
Custom theme color pass
await UrvaConnectSdk.initializeSdk(
baseUrl: "BASE_URL",
userToken: "USER_AUTH_TOKEN",
companyToken: "COMAPANY_TOKEN",
themeColor: ThemeColor(
themeColor1dark: "#CCD2EC",
themeColor1Light: "#182144",
themeColor2dark: "#182144",
themeColor2Light: "#CCD2EC",
),
);
Change connect theme light/dark mode , please follow the code firstly set theme then open screen
UrvaConnectSdk.setThemeMode(ThemeMode.dark);
UrvaConnectSdk.openScreen(context);
Clear connect data and logout user
UrvaConnectSdk.logoutUrvaConnect();
for full example, please see this Demo.