Add TWP Softphone Flutter app and complete mobile backend API
All checks were successful
Create Release / build (push) Successful in 4s
All checks were successful
Create Release / build (push) Successful in 4s
Backend: Add /voice/token endpoint with AccessToken + VoiceGrant for mobile VoIP, implement unhold_call() with call leg detection, wire FCM push notifications into call queue and webhook missed call handlers, add data-only FCM message support for Android background wake, and add Twilio API Key / Push Credential settings fields. Flutter app: Full softphone with Twilio Voice SDK integration, JWT auth with auto-refresh, SSE real-time queue updates, FCM push notifications, Material 3 UI with dashboard, active call screen, dialpad, and call controls (mute/speaker/hold/transfer). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
65
mobile/lib/app.dart
Normal file
65
mobile/lib/app.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'services/api_client.dart';
|
||||
import 'providers/auth_provider.dart';
|
||||
import 'providers/agent_provider.dart';
|
||||
import 'providers/call_provider.dart';
|
||||
import 'screens/login_screen.dart';
|
||||
import 'screens/dashboard_screen.dart';
|
||||
|
||||
class TwpSoftphoneApp extends StatefulWidget {
|
||||
const TwpSoftphoneApp({super.key});
|
||||
|
||||
@override
|
||||
State<TwpSoftphoneApp> createState() => _TwpSoftphoneAppState();
|
||||
}
|
||||
|
||||
class _TwpSoftphoneAppState extends State<TwpSoftphoneApp> {
|
||||
final _apiClient = ApiClient();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ChangeNotifierProvider(
|
||||
create: (_) {
|
||||
final auth = AuthProvider(_apiClient);
|
||||
auth.tryRestoreSession();
|
||||
return auth;
|
||||
},
|
||||
child: MaterialApp(
|
||||
title: 'TWP Softphone',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
colorSchemeSeed: Colors.blue,
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.light,
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
colorSchemeSeed: Colors.blue,
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
home: Consumer<AuthProvider>(
|
||||
builder: (context, auth, _) {
|
||||
if (auth.state == AuthState.authenticated) {
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => AgentProvider(
|
||||
auth.apiClient,
|
||||
auth.sseService,
|
||||
)..refresh(),
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => CallProvider(auth.voiceService),
|
||||
),
|
||||
],
|
||||
child: const DashboardScreen(),
|
||||
);
|
||||
}
|
||||
return const LoginScreen();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user