call_event.dart 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /// Object CallEvent.
  2. class CallEvent {
  3. Event event;
  4. dynamic body;
  5. CallEvent(this.body, this.event);
  6. @override
  7. String toString() => 'CallEvent( body: $body, event: $event)';
  8. }
  9. enum Event {
  10. actionDidUpdateDevicePushTokenVoip,
  11. actionCallIncoming,
  12. actionCallStart,
  13. actionCallAccept,
  14. actionCallDecline,
  15. actionCallEnded,
  16. actionCallTimeout,
  17. actionCallCallback,
  18. actionCallToggleHold,
  19. actionCallToggleMute,
  20. actionCallToggleDmtf,
  21. actionCallToggleGroup,
  22. actionCallToggleAudioSession,
  23. actionCallCustom,
  24. }
  25. /// Using extension for backward compatibility Dart SDK 2.17.0 and lower
  26. extension EventX on Event {
  27. String get name {
  28. switch (this) {
  29. case Event.actionDidUpdateDevicePushTokenVoip:
  30. return 'com.hiennv.flutter_callkit_incoming.DID_UPDATE_DEVICE_PUSH_TOKEN_VOIP';
  31. case Event.actionCallIncoming:
  32. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_INCOMING';
  33. case Event.actionCallStart:
  34. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_START';
  35. case Event.actionCallAccept:
  36. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_ACCEPT';
  37. case Event.actionCallDecline:
  38. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_DECLINE';
  39. case Event.actionCallEnded:
  40. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_ENDED';
  41. case Event.actionCallTimeout:
  42. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_TIMEOUT';
  43. case Event.actionCallCallback:
  44. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_CALLBACK';
  45. case Event.actionCallToggleHold:
  46. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_TOGGLE_HOLD';
  47. case Event.actionCallToggleMute:
  48. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_TOGGLE_MUTE';
  49. case Event.actionCallToggleDmtf:
  50. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_TOGGLE_DMTF';
  51. case Event.actionCallToggleGroup:
  52. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_TOGGLE_GROUP';
  53. case Event.actionCallToggleAudioSession:
  54. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_TOGGLE_AUDIO_SESSION';
  55. case Event.actionCallCustom:
  56. return 'com.hiennv.flutter_callkit_incoming.ACTION_CALL_CUSTOM';
  57. }
  58. }
  59. }