Compare commits
99 commits
fix/fra_de
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0179c12b07 | ||
|
|
03bd42d750 | ||
|
|
512ca5afe8 | ||
|
|
f2615b89e0 | ||
|
|
5cadd63d1e | ||
|
|
6b9857b11b | ||
|
|
a760a98366 | ||
|
|
b7ef60692d | ||
|
|
5c14429eda | ||
|
|
2f95e7b4d3 | ||
|
|
273c77edbe | ||
|
|
0b81887728 | ||
|
|
63a1886ff5 | ||
|
|
2a6abbe183 | ||
|
|
ed6f3215b9 | ||
|
|
ad893ab16e | ||
|
|
7ae256b566 | ||
|
|
acdd201bbe | ||
|
|
ce24ddc919 | ||
|
|
ad48ff8bca | ||
|
|
095705ad37 | ||
|
|
1510a1b045 | ||
|
|
abf294625a | ||
|
|
0c573e6e5c | ||
|
|
ac4ea27a78 | ||
|
|
a524d3c362 | ||
|
|
f1fcb9129c | ||
|
|
b376328f33 | ||
|
|
413e1b4082 | ||
|
|
56f732144d | ||
|
|
db24bd842f | ||
|
|
be53335b67 | ||
|
|
0bc9aa977c | ||
|
|
ad54e09253 | ||
|
|
4641ef680c | ||
|
|
46f5f21216 | ||
|
|
00bbf41f9a | ||
|
|
cf109f9787 | ||
|
|
a3c20e3ae7 | ||
|
|
a9854bc378 | ||
|
|
20da49167c | ||
|
|
b71267eed5 | ||
|
|
d353a9416e | ||
|
|
4d10b44da5 | ||
|
|
7e1e3adf8d | ||
|
|
e74df76301 | ||
|
|
34ff5bcf16 | ||
|
|
e3dd3f5a86 | ||
|
|
3ca2bca27c | ||
|
|
9a208e36b2 | ||
|
|
ac0e70f719 | ||
|
|
940c3519a6 | ||
|
|
1047a01fd4 | ||
|
|
a130e83d60 | ||
|
|
93abf64da6 | ||
|
|
e01989c9c9 | ||
|
|
511c6e4093 | ||
|
|
b3d83c1580 | ||
|
|
0b910ca190 | ||
|
|
ae1180c222 | ||
|
|
b40110f919 | ||
|
|
f538301efa | ||
|
|
8ec47edf25 | ||
|
|
10a400351a | ||
|
|
7f2c276b6a | ||
|
|
9b31eb3d99 | ||
|
|
eb68b50a43 | ||
|
|
fe0d0f166c | ||
|
|
19d0be524b | ||
|
|
45def92bfa | ||
|
|
57c823ba4e | ||
|
|
0aba4044a1 | ||
|
|
992afa16cf | ||
|
|
6d116b6cec | ||
|
|
35eb8cb8df | ||
|
|
11053b2ca3 | ||
|
|
e383826e91 | ||
|
|
35f32d623c | ||
|
|
b7446f6d26 | ||
|
|
fdd0925184 | ||
|
|
5c71c34801 | ||
|
|
e4b90b58e8 | ||
|
|
8609f880fb | ||
|
|
0e635ec9fc | ||
|
|
284b0433d8 | ||
|
|
97f5a2270d | ||
|
|
9421135fac | ||
|
|
7d394f5313 | ||
|
|
c2c5b26d4b | ||
|
|
a68c9f5da8 | ||
|
|
8d96b08f14 | ||
|
|
715b92ab3f | ||
|
|
82008d5a5f | ||
|
|
e32e22de76 | ||
|
|
bd769e71bb | ||
|
|
9366a2f13a | ||
|
|
8cd335e649 | ||
|
|
2e4b0dc1e4 | ||
|
|
17c91784ad |
|
|
@ -22,6 +22,7 @@
|
|||
667E5D812B8E444E00EBCFC4 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 667E5D802B8E444D00EBCFC4 /* GoogleService-Info.plist */; };
|
||||
6691CA7E2B839C2D00B2A7B8 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6691CA7D2B839C2D00B2A7B8 /* NotificationService.swift */; };
|
||||
66A3E5B72CAE8E5C00FCB7FA /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */; };
|
||||
66C468FB2D2BE54800A836F7 /* PIPViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C468FA2D2BE54300A836F7 /* PIPViewModel.swift */; };
|
||||
66C491F92B24D25B00CEA16D /* ConfigExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */; };
|
||||
66C491FB2B24D32600CEA16D /* CoreExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FA2B24D32600CEA16D /* CoreExtension.swift */; };
|
||||
66C491FD2B24D36500CEA16D /* AudioRouteUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */; };
|
||||
|
|
@ -42,6 +43,8 @@
|
|||
66FBFC4B2B83BD7B00BC6AB1 /* CoreExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FA2B24D32600CEA16D /* CoreExtension.swift */; };
|
||||
66FDB7812C7C689A00561566 /* EventEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66FDB7802C7C689A00561566 /* EventEditViewController.swift */; };
|
||||
C60E8F192C0F649200A06DB8 /* UIApplicationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C60E8F182C0F649200A06DB8 /* UIApplicationExtension.swift */; };
|
||||
C618BF562D75CA03005A00E0 /* linphonesw in Frameworks */ = {isa = PBXBuildFile; productRef = C618BF552D75CA03005A00E0 /* linphonesw */; };
|
||||
C618BF582D75CA0D005A00E0 /* linphonesw in Frameworks */ = {isa = PBXBuildFile; productRef = C618BF572D75CA0D005A00E0 /* linphonesw */; };
|
||||
C62817282C1B389700DBA646 /* SideMenuAccountRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62817272C1B389700DBA646 /* SideMenuAccountRow.swift */; };
|
||||
C628172E2C1C3A3600DBA646 /* AccountExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C628172D2C1C3A3600DBA646 /* AccountExtension.swift */; };
|
||||
C62817302C1C3DCC00DBA646 /* AccountModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C628172F2C1C3DCC00DBA646 /* AccountModel.swift */; };
|
||||
|
|
@ -103,6 +106,10 @@
|
|||
D732A9132B04C7A300DB42BA /* HistoryListFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D732A9122B04C7A300DB42BA /* HistoryListFragment.swift */; };
|
||||
D732A9152B04C7FE00DB42BA /* HistoryListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D732A9142B04C7FE00DB42BA /* HistoryListViewModel.swift */; };
|
||||
D732A91B2B061BD900DB42BA /* HistoryListBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = D732A91A2B061BD900DB42BA /* HistoryListBottomSheet.swift */; };
|
||||
D732C38C2D311D2500F78100 /* SettingsFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D732C38B2D311D2100F78100 /* SettingsFragment.swift */; };
|
||||
D7343FE82D3FA2000059D784 /* CodecModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7343FE72D3FA1F40059D784 /* CodecModel.swift */; };
|
||||
D7343FED2D3FE1560059D784 /* HelpFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7343FEC2D3FE1550059D784 /* HelpFragment.swift */; };
|
||||
D7343FEF2D3FE16C0059D784 /* HelpViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7343FEE2D3FE16B0059D784 /* HelpViewModel.swift */; };
|
||||
D73449992BC6932A00778C56 /* MeetingWaitingRoomFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D73449982BC6932A00778C56 /* MeetingWaitingRoomFragment.swift */; };
|
||||
D734499B2BC694C900778C56 /* MeetingWaitingRoomViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D734499A2BC694C900778C56 /* MeetingWaitingRoomViewModel.swift */; };
|
||||
D748BF2C2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D748BF2B2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift */; };
|
||||
|
|
@ -114,6 +121,9 @@
|
|||
D74C9D012ACB098C0021626A /* PermissionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74C9D002ACB098C0021626A /* PermissionManager.swift */; };
|
||||
D74DA0122C047F0700A8561D /* HistoryModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74DA0112C047F0700A8561D /* HistoryModel.swift */; };
|
||||
D750D3392AD3E6EE00EC99C5 /* PopupLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D750D3382AD3E6EE00EC99C5 /* PopupLoadingView.swift */; };
|
||||
D756C8152D34FF9200A58F2F /* SettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D756C8142D34FF8900A58F2F /* SettingsViewModel.swift */; };
|
||||
D756C8172D352C5F00A58F2F /* CorePreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = D756C8162D352C5600A58F2F /* CorePreferences.swift */; };
|
||||
D756C8182D352C5F00A58F2F /* CorePreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = D756C8162D352C5600A58F2F /* CorePreferences.swift */; };
|
||||
D75759322B56D40900E7AC10 /* ZRTPPopup.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75759312B56D40900E7AC10 /* ZRTPPopup.swift */; };
|
||||
D759CB642C3FBD4200AC35E8 /* StartConversationFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D759CB632C3FBD4200AC35E8 /* StartConversationFragment.swift */; };
|
||||
D759CB662C3FBE1D00AC35E8 /* StartConversationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D759CB652C3FBE1D00AC35E8 /* StartConversationViewModel.swift */; };
|
||||
|
|
@ -123,8 +133,10 @@
|
|||
D77A080E2CB6BCAF0095D589 /* MessageConferenceInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77A080D2CB6BCA10095D589 /* MessageConferenceInfo.swift */; };
|
||||
D78290B82ADD3910004AA85C /* ContactsFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D78290B72ADD3910004AA85C /* ContactsFragment.swift */; };
|
||||
D78290BB2ADD40B2004AA85C /* ContactViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D78290BA2ADD40B2004AA85C /* ContactViewModel.swift */; };
|
||||
D783028F2D414847009CCB60 /* DebugFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D783028E2D414845009CCB60 /* DebugFragment.swift */; };
|
||||
D783C77C2B1089B200622CC2 /* assistant_linphone_default_values in Resources */ = {isa = PBXBuildFile; fileRef = D783C77A2B1089B200622CC2 /* assistant_linphone_default_values */; };
|
||||
D783C77D2B1089B200622CC2 /* assistant_third_party_default_values in Resources */ = {isa = PBXBuildFile; fileRef = D783C77B2B1089B200622CC2 /* assistant_third_party_default_values */; };
|
||||
D78607712D36CB8A009E6A7E /* SettingsAdvancedFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D78607702D36CB87009E6A7E /* SettingsAdvancedFragment.swift */; };
|
||||
D78E06282BE3811D00CE3783 /* CallStatsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D78E06272BE3811D00CE3783 /* CallStatsModel.swift */; };
|
||||
D78E062A2BEA698E00CE3783 /* MediaEncryptedSheetBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = D78E06292BEA698E00CE3783 /* MediaEncryptedSheetBottomSheet.swift */; };
|
||||
D78E062C2BEA69BC00CE3783 /* CallStatisticsSheetBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = D78E062B2BEA69BC00CE3783 /* CallStatisticsSheetBottomSheet.swift */; };
|
||||
|
|
@ -151,6 +163,8 @@
|
|||
D7C3650E2AF15BF200FE6142 /* PhotoPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C3650D2AF15BF200FE6142 /* PhotoPicker.swift */; };
|
||||
D7C48DF42AFA66F900D938CB /* EditContactController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C48DF32AFA66F900D938CB /* EditContactController.swift */; };
|
||||
D7C48DF62AFCDF4700D938CB /* ContactInnerActionsFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C48DF52AFCDF4700D938CB /* ContactInnerActionsFragment.swift */; };
|
||||
D7C500402D27F16C00DD53EC /* AccountSettingsFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C5003F2D27F16900DD53EC /* AccountSettingsFragment.swift */; };
|
||||
D7C500422D2BE98100DD53EC /* AccountSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C500412D2BE96E00DD53EC /* AccountSettingsViewModel.swift */; };
|
||||
D7CEE0352B7A210300FD79B7 /* ConversationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7CEE0342B7A210300FD79B7 /* ConversationsView.swift */; };
|
||||
D7CEE0382B7A214F00FD79B7 /* ConversationsListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7CEE0372B7A214F00FD79B7 /* ConversationsListViewModel.swift */; };
|
||||
D7CEE03B2B7A234200FD79B7 /* ConversationsFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7CEE03A2B7A234200FD79B7 /* ConversationsFragment.swift */; };
|
||||
|
|
@ -164,6 +178,8 @@
|
|||
D7D24D182AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */; };
|
||||
D7DA67622ACCB2FA00E95002 /* LoginFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */; };
|
||||
D7DA67642ACCB31700E95002 /* ProfileModeFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */; };
|
||||
D7DC096F2CFA1D7600A6D47C /* AccountProfileFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DC096E2CFA1D7400A6D47C /* AccountProfileFragment.swift */; };
|
||||
D7DC09712CFDBF9A00A6D47C /* AccountProfileViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DC09702CFDBF8300A6D47C /* AccountProfileViewModel.swift */; };
|
||||
D7E2E69F2CE356C90080DA0D /* PopupViewWithTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E2E69E2CE356C90080DA0D /* PopupViewWithTextField.swift */; };
|
||||
D7E6ADF32B9875C20009A2BC /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E6ADF22B9875C20009A2BC /* Message.swift */; };
|
||||
D7E6ADF52B9876ED0009A2BC /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E6ADF42B9876ED0009A2BC /* Attachment.swift */; };
|
||||
|
|
@ -217,6 +233,7 @@
|
|||
6646A7A22BB2E224006B842A /* ScheduleMeetingFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleMeetingFragment.swift; sourceTree = "<group>"; };
|
||||
667E5D802B8E444D00EBCFC4 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
|
||||
6691CA7D2B839C2D00B2A7B8 /* NotificationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
|
||||
66C468FA2D2BE54300A836F7 /* PIPViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PIPViewModel.swift; sourceTree = "<group>"; };
|
||||
66C491F82B24D25A00CEA16D /* ConfigExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigExtension.swift; sourceTree = "<group>"; };
|
||||
66C491FA2B24D32600CEA16D /* CoreExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreExtension.swift; sourceTree = "<group>"; };
|
||||
66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioRouteUtils.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -296,6 +313,10 @@
|
|||
D732A9122B04C7A300DB42BA /* HistoryListFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryListFragment.swift; sourceTree = "<group>"; };
|
||||
D732A9142B04C7FE00DB42BA /* HistoryListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryListViewModel.swift; sourceTree = "<group>"; };
|
||||
D732A91A2B061BD900DB42BA /* HistoryListBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryListBottomSheet.swift; sourceTree = "<group>"; };
|
||||
D732C38B2D311D2100F78100 /* SettingsFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsFragment.swift; sourceTree = "<group>"; };
|
||||
D7343FE72D3FA1F40059D784 /* CodecModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodecModel.swift; sourceTree = "<group>"; };
|
||||
D7343FEC2D3FE1550059D784 /* HelpFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelpFragment.swift; sourceTree = "<group>"; };
|
||||
D7343FEE2D3FE16B0059D784 /* HelpViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelpViewModel.swift; sourceTree = "<group>"; };
|
||||
D73449982BC6932A00778C56 /* MeetingWaitingRoomFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingWaitingRoomFragment.swift; sourceTree = "<group>"; };
|
||||
D734499A2BC694C900778C56 /* MeetingWaitingRoomViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingWaitingRoomViewModel.swift; sourceTree = "<group>"; };
|
||||
D748BF2B2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThirdPartySipAccountLoginFragment.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -307,6 +328,8 @@
|
|||
D74C9D002ACB098C0021626A /* PermissionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionManager.swift; sourceTree = "<group>"; };
|
||||
D74DA0112C047F0700A8561D /* HistoryModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryModel.swift; sourceTree = "<group>"; };
|
||||
D750D3382AD3E6EE00EC99C5 /* PopupLoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupLoadingView.swift; sourceTree = "<group>"; };
|
||||
D756C8142D34FF8900A58F2F /* SettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewModel.swift; sourceTree = "<group>"; };
|
||||
D756C8162D352C5600A58F2F /* CorePreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CorePreferences.swift; sourceTree = "<group>"; };
|
||||
D75759312B56D40900E7AC10 /* ZRTPPopup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZRTPPopup.swift; sourceTree = "<group>"; };
|
||||
D759CB632C3FBD4200AC35E8 /* StartConversationFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartConversationFragment.swift; sourceTree = "<group>"; };
|
||||
D759CB652C3FBE1D00AC35E8 /* StartConversationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartConversationViewModel.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -316,8 +339,10 @@
|
|||
D77A080D2CB6BCA10095D589 /* MessageConferenceInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageConferenceInfo.swift; sourceTree = "<group>"; };
|
||||
D78290B72ADD3910004AA85C /* ContactsFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsFragment.swift; sourceTree = "<group>"; };
|
||||
D78290BA2ADD40B2004AA85C /* ContactViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactViewModel.swift; sourceTree = "<group>"; };
|
||||
D783028E2D414845009CCB60 /* DebugFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugFragment.swift; sourceTree = "<group>"; };
|
||||
D783C77A2B1089B200622CC2 /* assistant_linphone_default_values */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = assistant_linphone_default_values; sourceTree = "<group>"; };
|
||||
D783C77B2B1089B200622CC2 /* assistant_third_party_default_values */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = assistant_third_party_default_values; sourceTree = "<group>"; };
|
||||
D78607702D36CB87009E6A7E /* SettingsAdvancedFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsAdvancedFragment.swift; sourceTree = "<group>"; };
|
||||
D78E06272BE3811D00CE3783 /* CallStatsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallStatsModel.swift; sourceTree = "<group>"; };
|
||||
D78E06292BEA698E00CE3783 /* MediaEncryptedSheetBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaEncryptedSheetBottomSheet.swift; sourceTree = "<group>"; };
|
||||
D78E062B2BEA69BC00CE3783 /* CallStatisticsSheetBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallStatisticsSheetBottomSheet.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -345,6 +370,8 @@
|
|||
D7C3650D2AF15BF200FE6142 /* PhotoPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoPicker.swift; sourceTree = "<group>"; };
|
||||
D7C48DF32AFA66F900D938CB /* EditContactController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditContactController.swift; sourceTree = "<group>"; };
|
||||
D7C48DF52AFCDF4700D938CB /* ContactInnerActionsFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactInnerActionsFragment.swift; sourceTree = "<group>"; };
|
||||
D7C5003F2D27F16900DD53EC /* AccountSettingsFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSettingsFragment.swift; sourceTree = "<group>"; };
|
||||
D7C500412D2BE96E00DD53EC /* AccountSettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSettingsViewModel.swift; sourceTree = "<group>"; };
|
||||
D7CEE0342B7A210300FD79B7 /* ConversationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationsView.swift; sourceTree = "<group>"; };
|
||||
D7CEE0372B7A214F00FD79B7 /* ConversationsListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationsListViewModel.swift; sourceTree = "<group>"; };
|
||||
D7CEE03A2B7A234200FD79B7 /* ConversationsFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationsFragment.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -358,6 +385,8 @@
|
|||
D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NotoSans-ExtraBold.ttf"; sourceTree = "<group>"; };
|
||||
D7DA67612ACCB2FA00E95002 /* LoginFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginFragment.swift; sourceTree = "<group>"; };
|
||||
D7DA67632ACCB31700E95002 /* ProfileModeFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileModeFragment.swift; sourceTree = "<group>"; };
|
||||
D7DC096E2CFA1D7400A6D47C /* AccountProfileFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountProfileFragment.swift; sourceTree = "<group>"; };
|
||||
D7DC09702CFDBF8300A6D47C /* AccountProfileViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountProfileViewModel.swift; sourceTree = "<group>"; };
|
||||
D7E2E69E2CE356C90080DA0D /* PopupViewWithTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupViewWithTextField.swift; sourceTree = "<group>"; };
|
||||
D7E6ADF22B9875C20009A2BC /* Message.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = "<group>"; };
|
||||
D7E6ADF42B9876ED0009A2BC /* Attachment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Attachment.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -378,6 +407,7 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C618BF582D75CA0D005A00E0 /* linphonesw in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -385,6 +415,7 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C618BF562D75CA03005A00E0 /* linphonesw in Frameworks */,
|
||||
4ED1F0A881A9ACB5977A8987 /* BuildFile in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
@ -599,9 +630,11 @@
|
|||
D7CEE0332B7A20A400FD79B7 /* Conversations */,
|
||||
D7A03FBB2ACC2D850081A588 /* Contacts */,
|
||||
D74C9CFD2ACAEC150021626A /* Fragments */,
|
||||
D7343FE92D3FE0830059D784 /* Help */,
|
||||
D7A03FBE2ACC2E010081A588 /* History */,
|
||||
66E56BC52BA45E49006CE56F /* Meetings */,
|
||||
66D382032CEB7DB80063E1C5 /* Models */,
|
||||
D7DC096A2CFA192200A6D47C /* Settings */,
|
||||
D7A2EDD42AC180FE005D90FC /* Viewmodel */,
|
||||
D719ABB82ABC67BF00B41C10 /* ContentView.swift */,
|
||||
);
|
||||
|
|
@ -611,6 +644,7 @@
|
|||
D719ABC72ABC6FB200B41C10 /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D756C8162D352C5600A58F2F /* CorePreferences.swift */,
|
||||
D719ABC82ABC6FD700B41C10 /* CoreContext.swift */,
|
||||
66C491FA2B24D32600CEA16D /* CoreExtension.swift */,
|
||||
);
|
||||
|
|
@ -680,6 +714,32 @@
|
|||
path = Fragments;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D7343FE92D3FE0830059D784 /* Help */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D7343FEA2D3FE1080059D784 /* Fragments */,
|
||||
D7343FEB2D3FE1150059D784 /* ViewModel */,
|
||||
);
|
||||
path = Help;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D7343FEA2D3FE1080059D784 /* Fragments */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D783028E2D414845009CCB60 /* DebugFragment.swift */,
|
||||
D7343FEC2D3FE1550059D784 /* HelpFragment.swift */,
|
||||
);
|
||||
path = Fragments;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D7343FEB2D3FE1150059D784 /* ViewModel */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D7343FEE2D3FE16B0059D784 /* HelpViewModel.swift */,
|
||||
);
|
||||
path = ViewModel;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D74C9CF62ACACEB70021626A /* Fragments */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
|
@ -837,6 +897,7 @@
|
|||
children = (
|
||||
D7B99E982B29B39000BE7BF2 /* CallViewModel.swift */,
|
||||
D734499A2BC694C900778C56 /* MeetingWaitingRoomViewModel.swift */,
|
||||
66C468FA2D2BE54300A836F7 /* PIPViewModel.swift */,
|
||||
);
|
||||
path = ViewModel;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -909,6 +970,45 @@
|
|||
path = Fragments;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D7DC096A2CFA192200A6D47C /* Settings */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D7DC096B2CFA192F00A6D47C /* Fragments */,
|
||||
D7DC096C2CFA193B00A6D47C /* Models */,
|
||||
D7DC096D2CFA194600A6D47C /* ViewModel */,
|
||||
);
|
||||
path = Settings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D7DC096B2CFA192F00A6D47C /* Fragments */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D78607702D36CB87009E6A7E /* SettingsAdvancedFragment.swift */,
|
||||
D732C38B2D311D2100F78100 /* SettingsFragment.swift */,
|
||||
D7C5003F2D27F16900DD53EC /* AccountSettingsFragment.swift */,
|
||||
D7DC096E2CFA1D7400A6D47C /* AccountProfileFragment.swift */,
|
||||
);
|
||||
path = Fragments;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D7DC096C2CFA193B00A6D47C /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D7343FE72D3FA1F40059D784 /* CodecModel.swift */,
|
||||
);
|
||||
path = Models;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D7DC096D2CFA194600A6D47C /* ViewModel */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D756C8142D34FF8900A58F2F /* SettingsViewModel.swift */,
|
||||
D7C500412D2BE96E00DD53EC /* AccountSettingsViewModel.swift */,
|
||||
D7DC09702CFDBF8300A6D47C /* AccountProfileViewModel.swift */,
|
||||
);
|
||||
path = ViewModel;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
|
|
@ -970,7 +1070,7 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = D719ABAE2ABC67BF00B41C10 /* Build configuration list for PBXProject "Linphone" */;
|
||||
buildConfigurationList = D719ABAE2ABC67BF00B41C10 /* Build configuration list for PBXProject "linphone" */;
|
||||
compatibilityVersion = "Xcode 14.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
|
|
@ -979,6 +1079,9 @@
|
|||
Base,
|
||||
);
|
||||
mainGroup = D719ABAA2ABC67BF00B41C10;
|
||||
packageReferences = (
|
||||
C618BF542D75CA03005A00E0 /* XCRemoteSwiftPackageReference "linphone-sdk-swift-ios" */,
|
||||
);
|
||||
productRefGroup = D719ABB42ABC67BF00B41C10 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
|
|
@ -1103,6 +1206,7 @@
|
|||
66FBFC492B83BD2400BC6AB1 /* ConfigExtension.swift in Sources */,
|
||||
66FBFC4A2B83BD3300BC6AB1 /* FileUtils.swift in Sources */,
|
||||
66FBFC4B2B83BD7B00BC6AB1 /* CoreExtension.swift in Sources */,
|
||||
D756C8172D352C5F00A58F2F /* CorePreferences.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -1132,10 +1236,12 @@
|
|||
D7C2DA1D2CA44DE400A2441B /* EventModel.swift in Sources */,
|
||||
D719ABC92ABC6FD700B41C10 /* CoreContext.swift in Sources */,
|
||||
D70A26F22B7F5D95006CC8FC /* ConversationFragment.swift in Sources */,
|
||||
D7DC096F2CFA1D7600A6D47C /* AccountProfileFragment.swift in Sources */,
|
||||
D717A10E2CEB772300849D92 /* ShareSheetController.swift in Sources */,
|
||||
66C491FD2B24D36500CEA16D /* AudioRouteUtils.swift in Sources */,
|
||||
D70959F12B8DF3EC0014AC0B /* ConversationModel.swift in Sources */,
|
||||
C6DC4E3D2C199C4E009096FD /* BundleExtenion.swift in Sources */,
|
||||
D7343FEF2D3FE16C0059D784 /* HelpViewModel.swift in Sources */,
|
||||
D7EAACCF2AD6ED8000AA6A8A /* PermissionsFragment.swift in Sources */,
|
||||
D759CB662C3FBE1D00AC35E8 /* StartConversationViewModel.swift in Sources */,
|
||||
D777DBB32AE12C5900565A99 /* ContactsManager.swift in Sources */,
|
||||
|
|
@ -1143,6 +1249,7 @@
|
|||
D796F2002B0BB61A0041115F /* ToastViewModel.swift in Sources */,
|
||||
D7C3650A2AF001C300FE6142 /* EditContactFragment.swift in Sources */,
|
||||
D7A03FBD2ACC2DB60081A588 /* ContactsView.swift in Sources */,
|
||||
D78607712D36CB8A009E6A7E /* SettingsAdvancedFragment.swift in Sources */,
|
||||
66E50A492BD12B2300AD61CA /* MeetingsView.swift in Sources */,
|
||||
D719ABCF2ABC779A00B41C10 /* AccountLoginViewModel.swift in Sources */,
|
||||
D717630D2BD7BD0E00464097 /* ParticipantsListFragment.swift in Sources */,
|
||||
|
|
@ -1150,6 +1257,7 @@
|
|||
C6A5A9452C10B6270070FEA4 /* OIDAuthStateExtension.swift in Sources */,
|
||||
D732A90F2B04C3B400DB42BA /* HistoryFragment.swift in Sources */,
|
||||
D79F1C162CD3D6AD00FF0A05 /* ConversationInfoFragment.swift in Sources */,
|
||||
D7C500422D2BE98100DD53EC /* AccountSettingsViewModel.swift in Sources */,
|
||||
D79622342B1DFE600037EACD /* DialerBottomSheet.swift in Sources */,
|
||||
C67586B02C09F247002E77BF /* URIHandler.swift in Sources */,
|
||||
C62817282C1B389700DBA646 /* SideMenuAccountRow.swift in Sources */,
|
||||
|
|
@ -1167,6 +1275,7 @@
|
|||
C62817302C1C3DCC00DBA646 /* AccountModel.swift in Sources */,
|
||||
D73449992BC6932A00778C56 /* MeetingWaitingRoomFragment.swift in Sources */,
|
||||
D7C48DF42AFA66F900D938CB /* EditContactController.swift in Sources */,
|
||||
D7343FED2D3FE1560059D784 /* HelpFragment.swift in Sources */,
|
||||
C628172E2C1C3A3600DBA646 /* AccountExtension.swift in Sources */,
|
||||
66C491FF2B24D4AC00CEA16D /* FileUtils.swift in Sources */,
|
||||
C62817322C1C400A00DBA646 /* StringExtension.swift in Sources */,
|
||||
|
|
@ -1175,11 +1284,13 @@
|
|||
D7702EF22AC7205000557C00 /* WelcomeView.swift in Sources */,
|
||||
D732A9152B04C7FE00DB42BA /* HistoryListViewModel.swift in Sources */,
|
||||
6646A7A32BB2E224006B842A /* ScheduleMeetingFragment.swift in Sources */,
|
||||
D7C500402D27F16C00DD53EC /* AccountSettingsFragment.swift in Sources */,
|
||||
D71FCA7F2AE1397200D2E43E /* ContactsListViewModel.swift in Sources */,
|
||||
D71FCA812AE14CFC00D2E43E /* ContactsListFragment.swift in Sources */,
|
||||
D734499B2BC694C900778C56 /* MeetingWaitingRoomViewModel.swift in Sources */,
|
||||
D719ABB72ABC67BF00B41C10 /* LinphoneApp.swift in Sources */,
|
||||
66E50A4B2BD12B7800AD61CA /* MeetingsFragment.swift in Sources */,
|
||||
D783028F2D414847009CCB60 /* DebugFragment.swift in Sources */,
|
||||
66162A202BDFC2F900DCE913 /* AddParticipantsViewModel.swift in Sources */,
|
||||
D732A91B2B061BD900DB42BA /* HistoryListBottomSheet.swift in Sources */,
|
||||
D72250632ADE9615008FB426 /* HistoryViewModel.swift in Sources */,
|
||||
|
|
@ -1205,12 +1316,14 @@
|
|||
6613A0B42BAEBE3F008923A4 /* MeetingViewModel.swift in Sources */,
|
||||
D7173EBE2B7A5C0A00BCC481 /* LinphoneUtils.swift in Sources */,
|
||||
66C492012B24DB6900CEA16D /* Log.swift in Sources */,
|
||||
D756C8182D352C5F00A58F2F /* CorePreferences.swift in Sources */,
|
||||
C6A5A9432C10B5ED0070FEA4 /* DecodableExtension.swift in Sources */,
|
||||
D714035B2BE11E00004BD8CA /* CallMediaEncryptionModel.swift in Sources */,
|
||||
D748BF2C2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift in Sources */,
|
||||
D7CEE0382B7A214F00FD79B7 /* ConversationsListViewModel.swift in Sources */,
|
||||
D74C9CF82ACACECE0021626A /* WelcomePage1Fragment.swift in Sources */,
|
||||
66E56BCE2BA9A1F8006CE56F /* MeetingModel.swift in Sources */,
|
||||
D7DC09712CFDBF9A00A6D47C /* AccountProfileViewModel.swift in Sources */,
|
||||
D7E6D0552AEBFCCE00A57AAF /* ContactsInnerFragment.swift in Sources */,
|
||||
D72343362AD037AF009AA24E /* ToastView.swift in Sources */,
|
||||
D7FB55112AD447FD00A5AB15 /* RegisterFragment.swift in Sources */,
|
||||
|
|
@ -1225,6 +1338,7 @@
|
|||
D72A9A052B9750A1000DC093 /* UIList.swift in Sources */,
|
||||
D726E43D2B19E4FE0083C415 /* StartCallFragment.swift in Sources */,
|
||||
66E56BCC2BA9A1E0006CE56F /* MeetingsListItemModel.swift in Sources */,
|
||||
D756C8152D34FF9200A58F2F /* SettingsViewModel.swift in Sources */,
|
||||
D7B99E9B2B29F7C300BE7BF2 /* ActivityIndicator.swift in Sources */,
|
||||
66F626B22BCEBB86003E2DEC /* AddParticipantsFragment.swift in Sources */,
|
||||
D72343302ACEFEF8009AA24E /* QrCodeScannerFragment.swift in Sources */,
|
||||
|
|
@ -1239,13 +1353,16 @@
|
|||
D72250692ADFBF2D008FB426 /* SideMenu.swift in Sources */,
|
||||
C6DC4E3F2C19C289009096FD /* SideMenuEntry.swift in Sources */,
|
||||
D714DE622C1C4636006C1F1D /* RegisterCodeConfirmationFragment.swift in Sources */,
|
||||
66C468FB2D2BE54800A836F7 /* PIPViewModel.swift in Sources */,
|
||||
D7CEE0352B7A210300FD79B7 /* ConversationsView.swift in Sources */,
|
||||
D717071E2AC5922E0037746F /* ColorExtension.swift in Sources */,
|
||||
D71968922B86369D00DF4459 /* ChatBubbleView.swift in Sources */,
|
||||
D732C38C2D311D2500F78100 /* SettingsFragment.swift in Sources */,
|
||||
D78290B82ADD3910004AA85C /* ContactsFragment.swift in Sources */,
|
||||
D7DA67642ACCB31700E95002 /* ProfileModeFragment.swift in Sources */,
|
||||
D7CEE03D2B7A23B200FD79B7 /* ConversationsListFragment.swift in Sources */,
|
||||
D74C9CFC2ACACF370021626A /* WelcomePage3Fragment.swift in Sources */,
|
||||
D7343FE82D3FA2000059D784 /* CodecModel.swift in Sources */,
|
||||
D77A080E2CB6BCAF0095D589 /* MessageConferenceInfo.swift in Sources */,
|
||||
C6A5A9412C10B5D50070FEA4 /* EncodableExtension.swift in Sources */,
|
||||
D719ABCC2ABC769C00B41C10 /* AssistantView.swift in Sources */,
|
||||
|
|
@ -1278,13 +1395,14 @@
|
|||
CODE_SIGN_ENTITLEMENTS = msgNotificationService/msgNotificationService.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 62;
|
||||
CURRENT_PROJECT_VERSION = 73;
|
||||
DEVELOPMENT_TEAM = Z2V957B3D6;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"DEBUG=1",
|
||||
"USE_CRASHLYTICS=1",
|
||||
);
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = msgNotificationService/Info.plist;
|
||||
|
|
@ -1298,7 +1416,7 @@
|
|||
);
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MARKETING_VERSION = 6.0.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited)";
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -DUSE_CRASHLYTICS";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.msgNotificationService;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
|
@ -1320,11 +1438,14 @@
|
|||
CODE_SIGN_ENTITLEMENTS = msgNotificationService/msgNotificationService.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 62;
|
||||
CURRENT_PROJECT_VERSION = 73;
|
||||
DEVELOPMENT_TEAM = Z2V957B3D6;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"USE_CRASHLYTICS=1",
|
||||
);
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = msgNotificationService/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = msgNotificationService;
|
||||
|
|
@ -1337,7 +1458,7 @@
|
|||
);
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MARKETING_VERSION = 6.0.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited)";
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -DUSE_CRASHLYTICS";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.msgNotificationService;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
|
@ -1474,7 +1595,7 @@
|
|||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Linphone/Linphone.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 62;
|
||||
CURRENT_PROJECT_VERSION = 73;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Linphone/Preview Content\"";
|
||||
|
|
@ -1484,11 +1605,15 @@
|
|||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"DEBUG=1",
|
||||
"USE_CRASHLYTICS=1",
|
||||
);
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = Linphone/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Linphone;
|
||||
INFOPLIST_KEY_NSCalendarsUsageDescription = "Deprecated - Prior to iOS 17 full calendar access is required";
|
||||
INFOPLIST_KEY_NSCameraUsageDescription = "Camera usage is required for video VOIP calls";
|
||||
INFOPLIST_KEY_NSContactsUsageDescription = "Make calls with your friends";
|
||||
INFOPLIST_KEY_NSLocalNetworkUsageDescription = "App requires access to the local network to establish VoIP connections";
|
||||
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Microphone usage is required for VOIP calls";
|
||||
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Share photos with your friends and customize avatars";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
|
|
@ -1510,7 +1635,7 @@
|
|||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||
MARKETING_VERSION = 6.0.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited)";
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -DUSE_CRASHLYTICS";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
|
|
@ -1530,18 +1655,23 @@
|
|||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Linphone/Linphone.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 62;
|
||||
CURRENT_PROJECT_VERSION = 73;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Linphone/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = Z2V957B3D6;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"USE_CRASHLYTICS=1",
|
||||
);
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = Linphone/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Linphone;
|
||||
INFOPLIST_KEY_NSCalendarsUsageDescription = "Deprecated - Prior to iOS 17 full calendar access is required";
|
||||
INFOPLIST_KEY_NSCameraUsageDescription = "Camera usage is required for video VOIP calls";
|
||||
INFOPLIST_KEY_NSContactsUsageDescription = "Make calls with your friends";
|
||||
INFOPLIST_KEY_NSLocalNetworkUsageDescription = "App requires access to the local network to establish VoIP connections";
|
||||
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Microphone usage is required for VOIP calls";
|
||||
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Share photos with your friends and customize avatars";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
|
|
@ -1563,7 +1693,7 @@
|
|||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||
MARKETING_VERSION = 6.0.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited)";
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -DUSE_CRASHLYTICS";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
|
|
@ -1586,7 +1716,7 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
D719ABAE2ABC67BF00B41C10 /* Build configuration list for PBXProject "Linphone" */ = {
|
||||
D719ABAE2ABC67BF00B41C10 /* Build configuration list for PBXProject "linphone" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
D719ABC02ABC67BF00B41C10 /* Debug */,
|
||||
|
|
@ -1605,6 +1735,30 @@
|
|||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
C618BF542D75CA03005A00E0 /* XCRemoteSwiftPackageReference "linphone-sdk-swift-ios" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://gitlab.linphone.org/BC/public/linphone-sdk-swift-ios.git";
|
||||
requirement = {
|
||||
branch = stable;
|
||||
kind = branch;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
C618BF552D75CA03005A00E0 /* linphonesw */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = C618BF542D75CA03005A00E0 /* XCRemoteSwiftPackageReference "linphone-sdk-swift-ios" */;
|
||||
productName = linphonesw;
|
||||
};
|
||||
C618BF572D75CA0D005A00E0 /* linphonesw */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = C618BF542D75CA03005A00E0 /* XCRemoteSwiftPackageReference "linphone-sdk-swift-ios" */;
|
||||
productName = linphonesw;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = D719ABAB2ABC67BF00B41C10 /* Project object */;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
BlueprintIdentifier = "D719ABB22ABC67BF00B41C10"
|
||||
BuildableName = "Linphone.app"
|
||||
BlueprintName = "Linphone"
|
||||
ReferencedContainer = "container:Linphone.xcodeproj">
|
||||
ReferencedContainer = "container:linphone.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
BlueprintIdentifier = "D719ABB22ABC67BF00B41C10"
|
||||
BuildableName = "Linphone.app"
|
||||
BlueprintName = "Linphone"
|
||||
ReferencedContainer = "container:Linphone.xcodeproj">
|
||||
ReferencedContainer = "container:linphone.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
BlueprintIdentifier = "D719ABB22ABC67BF00B41C10"
|
||||
BuildableName = "Linphone.app"
|
||||
BlueprintName = "Linphone"
|
||||
ReferencedContainer = "container:Linphone.xcodeproj">
|
||||
ReferencedContainer = "container:linphone.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
|
|
|
|||
21
Linphone/Assets.xcassets/app-store-logo.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "app-store-logo.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
1
Linphone/Assets.xcassets/app-store-logo.imageset/app-store-logo.svg
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M64.34,196.07l-9.45,16a8,8,0,1,1-13.78-8.14l9.46-16a8,8,0,1,1,13.77,8.14ZM232,152H184.2l-30.73-52a8,8,0,1,0-13.77,8.14l61.41,103.93a8,8,0,0,0,13.78-8.14L193.66,168H232a8,8,0,0,0,0-16Zm-89.53,0H90.38L158.89,36.07a8,8,0,0,0-13.78-8.14L128,56.89l-17.11-29a8,8,0,1,0-13.78,8.14l21.6,36.55L71.8,152H24a8,8,0,0,0,0,16H142.47a8,8,0,1,0,0-16Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 458 B |
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#4e6074" viewBox="0 0 256 256"><path d="M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"></path></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"></path></svg>
|
||||
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#4e6074" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"></path></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"></path></svg>
|
||||
|
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 311 B |
21
Linphone/Assets.xcassets/desktop.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "desktop.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
1
Linphone/Assets.xcassets/desktop.imageset/desktop.svg
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24h72v16H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V200h72a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40ZM48,56H208a8,8,0,0,1,8,8v80H40V64A8,8,0,0,1,48,56ZM208,184H48a8,8,0,0,1-8-8V160H216v16A8,8,0,0,1,208,184Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 373 B |
21
Linphone/Assets.xcassets/device-mobile-camera.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "device-mobile-camera.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
1
Linphone/Assets.xcassets/device-mobile-camera.imageset/device-mobile-camera.svg
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M176,16H80A24,24,0,0,0,56,40V216a24,24,0,0,0,24,24h96a24,24,0,0,0,24-24V40A24,24,0,0,0,176,16Zm8,200a8,8,0,0,1-8,8H80a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h96a8,8,0,0,1,8,8ZM140,60a12,12,0,1,1-12-12A12,12,0,0,1,140,60Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 335 B |
21
Linphone/Assets.xcassets/fire.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "fire.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
1
Linphone/Assets.xcassets/fire.imageset/fire.svg
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M183.89,153.34a57.6,57.6,0,0,1-46.56,46.55A8.75,8.75,0,0,1,136,200a8,8,0,0,1-1.32-15.89c16.57-2.79,30.63-16.85,33.44-33.45a8,8,0,0,1,15.78,2.68ZM216,144a88,88,0,0,1-176,0c0-27.92,11-56.47,32.66-84.85a8,8,0,0,1,11.93-.89l24.12,23.41,22-60.41a8,8,0,0,1,12.63-3.41C165.21,36,216,84.55,216,144Zm-16,0c0-46.09-35.79-85.92-58.21-106.33L119.52,98.74a8,8,0,0,1-13.09,3L80.06,76.16C64.09,99.21,56,122,56,144a72,72,0,0,0,144,0Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 541 B |
21
Linphone/Assets.xcassets/mountain2.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mountain2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
Linphone/Assets.xcassets/mountain2.imageset/mountain2.png
vendored
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
21
Linphone/Assets.xcassets/package.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "package.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
1
Linphone/Assets.xcassets/package.imageset/package.svg
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M223.68,66.15,135.68,18a15.88,15.88,0,0,0-15.36,0l-88,48.17a16,16,0,0,0-8.32,14v95.64a16,16,0,0,0,8.32,14l88,48.17a15.88,15.88,0,0,0,15.36,0l88-48.17a16,16,0,0,0,8.32-14V80.18A16,16,0,0,0,223.68,66.15ZM128,32l80.34,44-29.77,16.3-80.35-44ZM128,120,47.66,76l33.9-18.56,80.34,44ZM40,90l80,43.78v85.79L40,175.82Zm176,85.78h0l-80,43.79V133.82l32-17.51V152a8,8,0,0,0,16,0V107.55L216,90v85.77Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 510 B |
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#4e6074" viewBox="0 0 256 256"><path d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>
|
||||
|
Before Width: | Height: | Size: 466 B After Width: | Height: | Size: 466 B |
|
|
@ -88,8 +88,9 @@ final class ContactsManager: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
MagicSearchSingleton.shared.searchForContactsWithoutCoreThread(sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
|
||||
|
||||
let store = CNContactStore()
|
||||
|
||||
store.requestAccess(for: .contacts) { (granted, error) in
|
||||
if let error = error {
|
||||
print("\(#function) - failed to request access", error)
|
||||
|
|
@ -105,71 +106,127 @@ final class ContactsManager: ObservableObject {
|
|||
do {
|
||||
var contactCounter = 0
|
||||
try store.enumerateContacts(with: request, usingBlock: { (contact, _) in
|
||||
DispatchQueue.main.async {
|
||||
let newContact = Contact(
|
||||
identifier: contact.identifier,
|
||||
firstName: contact.givenName,
|
||||
lastName: contact.familyName,
|
||||
organizationName: contact.organizationName,
|
||||
jobTitle: "",
|
||||
displayName: contact.nickname,
|
||||
sipAddresses: contact.instantMessageAddresses.map { $0.value.service.lowercased() == "SIP".lowercased() ? $0.value.username : "" },
|
||||
phoneNumbers: contact.phoneNumbers.map { PhoneNumber(numLabel: $0.label ?? "", num: $0.value.stringValue)},
|
||||
imageData: ""
|
||||
)
|
||||
|
||||
let imageThumbnail = UIImage(data: contact.thumbnailImageData ?? Data())
|
||||
self.saveImage(
|
||||
image: imageThumbnail
|
||||
?? self.textToImage(
|
||||
firstName: contact.givenName.isEmpty
|
||||
&& contact.familyName.isEmpty
|
||||
&& contact.phoneNumbers.first?.value.stringValue != nil
|
||||
? contact.phoneNumbers.first!.value.stringValue
|
||||
: contact.givenName, lastName: contact.familyName),
|
||||
name: contact.givenName + contact.familyName,
|
||||
prefix: ((imageThumbnail == nil) ? "-default" : ""),
|
||||
contact: newContact, linphoneFriend: false, existingFriend: nil) {
|
||||
if (self.friendList?.friends.count ?? 0) + (self.linphoneFriendList?.friends.count ?? 0) == contactCounter {
|
||||
// Every contact properly added, proceed
|
||||
self.linphoneFriendList?.updateSubscriptions()
|
||||
self.friendList?.updateSubscriptions()
|
||||
|
||||
if let friendListDelegate = self.friendListDelegate {
|
||||
self.friendList?.removeDelegate(delegate: friendListDelegate)
|
||||
}
|
||||
self.friendListDelegate = FriendListDelegateStub(onNewSipAddressDiscovered: { (_: FriendList, linphoneFriend: Friend, sipUri: String) in
|
||||
let newContact = Contact(
|
||||
identifier: contact.identifier,
|
||||
firstName: contact.givenName,
|
||||
lastName: contact.familyName,
|
||||
organizationName: contact.organizationName,
|
||||
jobTitle: "",
|
||||
displayName: contact.nickname,
|
||||
sipAddresses: contact.instantMessageAddresses.map { $0.value.service.lowercased() == "SIP".lowercased() ? $0.value.username : "" },
|
||||
phoneNumbers: contact.phoneNumbers.map { PhoneNumber(numLabel: $0.label ?? "", num: $0.value.stringValue)},
|
||||
imageData: ""
|
||||
)
|
||||
|
||||
let imageThumbnail = UIImage(data: contact.thumbnailImageData ?? Data())
|
||||
if let image = imageThumbnail {
|
||||
DispatchQueue.main.async {
|
||||
self.saveImage(
|
||||
image: image,
|
||||
name: contact.givenName + contact.familyName,
|
||||
prefix: "",
|
||||
contact: newContact, linphoneFriend: false, existingFriend: nil) {
|
||||
if (self.friendList?.friends.count ?? 0) == contactCounter {
|
||||
// Every contact properly added, proceed
|
||||
self.linphoneFriendList?.updateSubscriptions()
|
||||
self.friendList?.updateSubscriptions()
|
||||
|
||||
var addedAvatarListModel: [ContactAvatarModel] = []
|
||||
linphoneFriend.phoneNumbers.forEach { phone in
|
||||
let address = core.interpretUrl(url: phone, applyInternationalPrefix: true)
|
||||
|
||||
let presence = linphoneFriend.getPresenceModelForUriOrTel(uriOrTel: address?.asStringUriOnly() ?? "")
|
||||
if address != nil && presence != nil {
|
||||
linphoneFriend.edit()
|
||||
linphoneFriend.addAddress(address: address!)
|
||||
linphoneFriend.done()
|
||||
|
||||
addedAvatarListModel.append(
|
||||
ContactAvatarModel(
|
||||
friend: linphoneFriend,
|
||||
name: linphoneFriend.name ?? "",
|
||||
address: linphoneFriend.address?.clone()?.asStringUriOnly() ?? "",
|
||||
withPresence: true
|
||||
if let friendListDelegate = self.friendListDelegate {
|
||||
self.friendList?.removeDelegate(delegate: friendListDelegate)
|
||||
}
|
||||
|
||||
self.friendListDelegate = FriendListDelegateStub(onNewSipAddressDiscovered: { (_: FriendList, linphoneFriend: Friend, sipUri: String) in
|
||||
var addedAvatarListModel: [ContactAvatarModel] = []
|
||||
linphoneFriend.phoneNumbers.forEach { _ in
|
||||
let address = try? Factory.Instance.createAddress(addr: sipUri)
|
||||
if address != nil {
|
||||
linphoneFriend.edit()
|
||||
linphoneFriend.addAddress(address: address!)
|
||||
linphoneFriend.done()
|
||||
|
||||
let addressTmp = linphoneFriend.address?.clone()?.asStringUriOnly() ?? ""
|
||||
addedAvatarListModel.append(
|
||||
ContactAvatarModel(
|
||||
friend: linphoneFriend,
|
||||
name: linphoneFriend.name ?? "",
|
||||
address: addressTmp,
|
||||
withPresence: true
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
NotificationCenter.default.post(
|
||||
name: NSNotification.Name("ContactAdded"),
|
||||
object: nil,
|
||||
userInfo: ["address": addressTmp]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.avatarListModel += addedAvatarListModel
|
||||
}
|
||||
|
||||
MagicSearchSingleton.shared.searchForContacts(sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
|
||||
})
|
||||
self.friendList?.addDelegate(delegate: self.friendListDelegate!)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.avatarListModel += addedAvatarListModel
|
||||
self.avatarListModel = self.avatarListModel.sorted { $0.name < $1.name }
|
||||
}
|
||||
})
|
||||
self.friendList?.addDelegate(delegate: self.friendListDelegate!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.textToImageInMainThread(firstName: contact.givenName, lastName: contact.familyName) { image in
|
||||
self.saveImage(
|
||||
image: image,
|
||||
name: contact.givenName + contact.familyName,
|
||||
prefix: "-default",
|
||||
contact: newContact, linphoneFriend: false, existingFriend: nil) {
|
||||
if (self.friendList?.friends.count ?? 0) == contactCounter {
|
||||
// Every contact properly added, proceed
|
||||
self.linphoneFriendList?.updateSubscriptions()
|
||||
self.friendList?.updateSubscriptions()
|
||||
|
||||
if let friendListDelegate = self.friendListDelegate {
|
||||
self.friendList?.removeDelegate(delegate: friendListDelegate)
|
||||
}
|
||||
|
||||
self.friendListDelegate = FriendListDelegateStub(onNewSipAddressDiscovered: { (_: FriendList, linphoneFriend: Friend, sipUri: String) in
|
||||
var addedAvatarListModel: [ContactAvatarModel] = []
|
||||
linphoneFriend.phoneNumbers.forEach { _ in
|
||||
let address = try? Factory.Instance.createAddress(addr: sipUri)
|
||||
if address != nil {
|
||||
linphoneFriend.edit()
|
||||
linphoneFriend.addAddress(address: address!)
|
||||
linphoneFriend.done()
|
||||
|
||||
let addressTmp = linphoneFriend.address?.clone()?.asStringUriOnly() ?? ""
|
||||
addedAvatarListModel.append(
|
||||
ContactAvatarModel(
|
||||
friend: linphoneFriend,
|
||||
name: linphoneFriend.name ?? "",
|
||||
address: addressTmp,
|
||||
withPresence: true
|
||||
)
|
||||
)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
NotificationCenter.default.post(
|
||||
name: NSNotification.Name("ContactAdded"),
|
||||
object: nil,
|
||||
userInfo: ["address": addressTmp]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.avatarListModel += addedAvatarListModel
|
||||
self.avatarListModel = self.avatarListModel.sorted { $0.name < $1.name }
|
||||
}
|
||||
})
|
||||
self.friendList?.addDelegate(delegate: self.friendListDelegate!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !(contact.givenName.isEmpty && contact.familyName.isEmpty) {
|
||||
|
|
@ -188,6 +245,35 @@ final class ContactsManager: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
func textToImageInMainThread(firstName: String, lastName: String, completion: @escaping (UIImage) -> Void) {
|
||||
DispatchQueue.main.async {
|
||||
let lblNameInitialize = UILabel()
|
||||
lblNameInitialize.frame.size = CGSize(width: 200.0, height: 200.0)
|
||||
lblNameInitialize.font = UIFont(name: "NotoSans-ExtraBold", size: 80)
|
||||
lblNameInitialize.textColor = UIColor(Color.grayMain2c600)
|
||||
|
||||
let textToDisplay = (firstName.first.map { String($0) } ?? "") + (lastName.first.map { String($0) } ?? "")
|
||||
|
||||
lblNameInitialize.text = textToDisplay.uppercased()
|
||||
lblNameInitialize.textAlignment = .center
|
||||
lblNameInitialize.backgroundColor = UIColor(Color.grayMain2c200)
|
||||
lblNameInitialize.layer.cornerRadius = 10.0
|
||||
lblNameInitialize.clipsToBounds = true
|
||||
|
||||
UIGraphicsBeginImageContext(lblNameInitialize.frame.size)
|
||||
defer { UIGraphicsEndImageContext() }
|
||||
|
||||
guard let context = UIGraphicsGetCurrentContext() else {
|
||||
completion(UIImage())
|
||||
return
|
||||
}
|
||||
|
||||
lblNameInitialize.layer.render(in: context)
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext() ?? UIImage()
|
||||
completion(image)
|
||||
}
|
||||
}
|
||||
|
||||
func textToImage(firstName: String, lastName: String) -> UIImage {
|
||||
let lblNameInitialize = UILabel()
|
||||
lblNameInitialize.frame.size = CGSize(width: 200.0, height: 200.0)
|
||||
|
|
@ -316,12 +402,15 @@ final class ContactsManager: ObservableObject {
|
|||
if directory != nil {
|
||||
DispatchQueue.main.async {
|
||||
do {
|
||||
let urlName = URL(string: name + prefix)
|
||||
let imagePath = urlName != nil ? urlName!.absoluteString.replacingOccurrences(of: "%", with: "") : "ImageError"
|
||||
|
||||
let decodedData: () = try data.write(to: directory!.appendingPathComponent(imagePath + ".png"))
|
||||
|
||||
completion(decodedData, imagePath + ".png")
|
||||
if let urlName = URL(string: name + prefix) {
|
||||
let imagePath = urlName.absoluteString.replacingOccurrences(of: "%", with: "")
|
||||
|
||||
let decodedData: () = try data.write(to: directory!.appendingPathComponent(imagePath + ".png"))
|
||||
|
||||
completion(decodedData, imagePath + ".png")
|
||||
} else {
|
||||
completion((), "")
|
||||
}
|
||||
} catch {
|
||||
print("Error: ", error)
|
||||
completion((), "")
|
||||
|
|
@ -343,25 +432,20 @@ final class ContactsManager: ObservableObject {
|
|||
}
|
||||
|
||||
func getFriendWithAddress(address: Address?) -> Friend? {
|
||||
if address != nil {
|
||||
let clonedAddress = address!.clone()
|
||||
clonedAddress!.clean()
|
||||
let sipUri = clonedAddress!.asStringUriOnly()
|
||||
|
||||
if self.friendList != nil && !self.friendList!.friends.isEmpty {
|
||||
var friend: Friend?
|
||||
friend = self.friendList!.friends.first(where: {$0.addresses.contains(where: {$0.asStringUriOnly() == sipUri})})
|
||||
if friend == nil && self.linphoneFriendList != nil && !self.linphoneFriendList!.friends.isEmpty {
|
||||
friend = self.linphoneFriendList!.friends.first(where: {$0.addresses.contains(where: {$0.asStringUriOnly() == sipUri})})
|
||||
}
|
||||
|
||||
return friend
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
guard let address = address, let clonedAddress = address.clone() else {
|
||||
return nil
|
||||
}
|
||||
clonedAddress.clean()
|
||||
let sipUri = clonedAddress.asStringUriOnly()
|
||||
|
||||
var friend: Friend?
|
||||
if let friendList = self.friendList {
|
||||
friend = friendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) })
|
||||
}
|
||||
if friend == nil, let linphoneFriendList = self.linphoneFriendList {
|
||||
friend = linphoneFriendList.friends.first(where: { $0.addresses.contains(where: { $0.asStringUriOnly() == sipUri }) })
|
||||
}
|
||||
return friend
|
||||
}
|
||||
|
||||
func getFriendWithAddressInCoreQueue(address: Address?, completion: @escaping (Friend?) -> Void) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import linphone // needed for unwrapped function linphone_core_set_push_and_app_
|
|||
import Combine
|
||||
import UniformTypeIdentifiers
|
||||
import Network
|
||||
import SwiftUI
|
||||
|
||||
#if USE_CRASHLYTICS
|
||||
import Firebase
|
||||
|
|
@ -35,15 +36,15 @@ final class CoreContext: ObservableObject {
|
|||
|
||||
static let shared = CoreContext()
|
||||
private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
var pipViewModel = PIPViewModel()
|
||||
|
||||
var coreVersion: String = Core.getVersion
|
||||
@Published var loggedIn: Bool = false
|
||||
@Published var loggingInProgress: Bool = false
|
||||
@Published var coreIsStarted: Bool = false
|
||||
@Published var accounts: [AccountModel] = []
|
||||
@Published var enteredForeground = false
|
||||
@Published var shortcuts: [ShortcutModel] = []
|
||||
private var mCore: Core!
|
||||
var mCore: Core!
|
||||
private var mIterateSuscription: AnyCancellable?
|
||||
|
||||
var bearerAuthInfoPendingPasswordUpdate: AuthInfo?
|
||||
|
|
@ -145,9 +146,15 @@ final class CoreContext: ObservableObject {
|
|||
self.mCore.videoPreviewEnabled = false
|
||||
self.mCore.fecEnabled = true
|
||||
self.mCore.friendListSubscriptionEnabled = true
|
||||
self.mCore.maxSizeForAutoDownloadIncomingFiles = 0
|
||||
|
||||
// Migration
|
||||
self.mCore.config!.setBool(section: "sip", key: "auto_answer_replacing_calls", value: false)
|
||||
self.mCore.config!.setBool(section: "sip", key: "deliver_imdn", value: false)
|
||||
self.mCore.config!.setString(section: "misc", key: "log_collection_upload_server_url", value: "https://files.linphone.org:443/http-file-transfer-server/hft.php")
|
||||
self.mCore.config!.setString(section: "misc", key: "file_transfer_server_url", value: "https://files.linphone.org:443/http-file-transfer-server/hft.php")
|
||||
self.mCore.config!.setString(section: "misc", key: "version_check_url_root", value: "https://download.linphone.org/releases")
|
||||
|
||||
self.mCore.imdnToEverybodyThreshold = 1
|
||||
|
||||
let shortcutsCount = self.mCore.config!.getInt(section: "ui", key: "shortcut_count", defaultValue: 0)
|
||||
if shortcutsCount > 0 {
|
||||
|
|
@ -183,10 +190,20 @@ final class CoreContext: ObservableObject {
|
|||
#else
|
||||
let pushEnvironment = ""
|
||||
#endif
|
||||
for account in core.accountList where account.params?.pushNotificationConfig?.provider != ("apns" + pushEnvironment) {
|
||||
for account in core.accountList {
|
||||
|
||||
let newParams = account.params?.clone()
|
||||
Log.info("Account \(String(describing: newParams?.identityAddress?.asStringUriOnly())) - updating apple push provider from \(String(describing: newParams?.pushNotificationConfig?.provider)) to apns\(pushEnvironment)")
|
||||
newParams?.pushNotificationConfig?.provider = "apns" + pushEnvironment
|
||||
if account.params?.pushNotificationConfig?.provider != ("apns" + pushEnvironment) {
|
||||
Log.info("Account \(String(describing: newParams?.identityAddress?.asStringUriOnly())) - updating apple push provider from \(String(describing: newParams?.pushNotificationConfig?.provider)) to apns\(pushEnvironment)")
|
||||
newParams?.pushNotificationConfig?.provider = "apns" + pushEnvironment
|
||||
}
|
||||
|
||||
if account.params?.internationalPrefix == nil {
|
||||
Log.info("Account \(account.displayName()): no international prefix set, adding 33 FRA by default: \(account.params?.internationalPrefix ?? "NIL")")
|
||||
newParams?.internationalPrefix = "33"
|
||||
newParams?.internationalPrefixIsoCountryCode = "FRA"
|
||||
newParams?.useInternationalPrefixForCallsAndChats = true
|
||||
}
|
||||
account.params = newParams
|
||||
}
|
||||
|
||||
|
|
@ -204,6 +221,15 @@ final class CoreContext: ObservableObject {
|
|||
}
|
||||
}, onCallStateChanged: { (core: Core, call: Call, cstate: Call.State, message: String) in
|
||||
TelecomManager.shared.onCallStateChanged(core: core, call: call, state: cstate, message: message)
|
||||
|
||||
if core.calls.isEmpty {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
|
||||
if UIApplication.shared.applicationState == .background {
|
||||
Log.info("[CoreContext] core is currently in background with no calls, triggering onEnterBackground procedure")
|
||||
self.onEnterBackground()
|
||||
}
|
||||
}
|
||||
}
|
||||
}, onAuthenticationRequested: { (_: Core, authInfo: AuthInfo, method: AuthMethod) in
|
||||
guard let username = authInfo.username, let server = authInfo.authorizationServer, !server.isEmpty else {
|
||||
Log.error("Authentication requested but either username [\(String(describing: authInfo.username))], domain [\(String(describing: authInfo.domain))] or server [\(String(describing: authInfo.authorizationServer))] is nil or empty!")
|
||||
|
|
@ -236,7 +262,7 @@ final class CoreContext: ObservableObject {
|
|||
}
|
||||
DispatchQueue.main.async {
|
||||
if status == ConfiguringState.Successful {
|
||||
ToastViewModel.shared.toastMessage = "Successful"
|
||||
ToastViewModel.shared.toastMessage = "Success_qr_code_validated"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
self.accounts = accountModels
|
||||
}
|
||||
|
|
@ -263,12 +289,15 @@ final class CoreContext: ObservableObject {
|
|||
}
|
||||
case .Cleared:
|
||||
Log.info("[onAccountRegistrationStateChanged] Account \(account.displayName()) registration was cleared. Looking for auth info")
|
||||
// Moved removeAuthInfo to "failed" state to prevent removing auth info when deactivating an account
|
||||
/*
|
||||
if let authInfo = account.findAuthInfo() {
|
||||
Log.info("[onAccountRegistrationStateChanged] Found auth info for account, removing it")
|
||||
core.removeAuthInfo(info: authInfo)
|
||||
} else {
|
||||
Log.warn("[onAccountRegistrationStateChanged] Failed to find matching auth info for account")
|
||||
}
|
||||
*/
|
||||
case .Failed: // If registration failed, remove account from core
|
||||
if self.networkStatusIsConnected {
|
||||
let params = account.params
|
||||
|
|
@ -276,6 +305,10 @@ final class CoreContext: ObservableObject {
|
|||
clonedParams?.registerEnabled = false
|
||||
account.params = clonedParams
|
||||
|
||||
if let authInfo = account.findAuthInfo() {
|
||||
core.removeAuthInfo(info: authInfo)
|
||||
}
|
||||
|
||||
Log.warn("Registration failed for account \(account.displayName()), deleting it from core")
|
||||
core.removeAccount(account: account)
|
||||
}
|
||||
|
|
@ -294,8 +327,6 @@ final class CoreContext: ObservableObject {
|
|||
} else if state == .Cleared {
|
||||
self.loggingInProgress = false
|
||||
self.loggedIn = false
|
||||
ToastViewModel.shared.toastMessage = "Success_account_logged_out"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
} else {
|
||||
self.loggingInProgress = false
|
||||
self.loggedIn = false
|
||||
|
|
|
|||
268
Linphone/Core/CorePreferences.swift
Normal file
|
|
@ -0,0 +1,268 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import linphonesw
|
||||
|
||||
class CorePreferences {
|
||||
static var printLogsInLogcat: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "debug", defaultValue: true)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "debug", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var firstLaunch: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "first_6.0_launch", defaultValue: true)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "first_6.0_launch", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var linphoneConfigurationVersion: Int {
|
||||
get {
|
||||
return Config.get().getInt(section: "app", key: "config_version", defaultValue: 52005)
|
||||
}
|
||||
set {
|
||||
Config.get().setInt(section: "app", key: "config_version", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var checkForUpdateServerUrl: String {
|
||||
get {
|
||||
return Config.get().getString(section: "misc", key: "version_check_url_root", defaultString: "")
|
||||
}
|
||||
set {
|
||||
Config.get().setString(section: "misc", key: "version_check_url_root", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var conditionsAndPrivacyPolicyAccepted: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "read_and_agree_terms_and_privacy", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "read_and_agree_terms_and_privacy", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var publishPresence: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "publish_presence", defaultValue: true)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "publish_presence", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var keepServiceAlive: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "keep_service_alive", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "keep_service_alive", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var deviceName: String {
|
||||
get {
|
||||
return Config.get().getString(section: "app", key: "device", defaultString: "").trimmingCharacters(in: .whitespaces)
|
||||
}
|
||||
set {
|
||||
Config.get().setString(section: "app", key: "device", value: newValue.trimmingCharacters(in: .whitespaces))
|
||||
}
|
||||
}
|
||||
|
||||
static var routeAudioToSpeakerWhenVideoIsEnabled: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "route_audio_to_speaker_when_video_enabled", defaultValue: true)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "route_audio_to_speaker_when_video_enabled", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var automaticallyStartCallRecording: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "auto_start_call_record", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "auto_start_call_record", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var showDialogWhenCallingDeviceUuidDirectly: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "show_confirmation_dialog_zrtp_trust_call", defaultValue: true)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "show_confirmation_dialog_zrtp_trust_call", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var markConversationAsReadWhenDismissingMessageNotification: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "mark_as_read_notif_dismissal", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "mark_as_read_notif_dismissal", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var contactsFilter: String {
|
||||
get {
|
||||
return Config.get().getString(section: "ui", key: "contacts_filter", defaultString: "")
|
||||
}
|
||||
set {
|
||||
Config.get().setString(section: "ui", key: "contacts_filter", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var showFavoriteContacts: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "ui", key: "show_favorites_contacts", defaultValue: true)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "ui", key: "show_favorites_contacts", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var voiceRecordingMaxDuration: Int {
|
||||
get {
|
||||
return Config.get().getInt(section: "app", key: "voice_recording_max_duration", defaultValue: 600000)
|
||||
}
|
||||
set {
|
||||
Config.get().setInt(section: "app", key: "voice_recording_max_duration", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var darkMode: Int {
|
||||
get {
|
||||
if !darkModeAllowed { return 0 }
|
||||
return Config.get().getInt(section: "app", key: "dark_mode", defaultValue: -1)
|
||||
}
|
||||
set {
|
||||
Config.get().setInt(section: "app", key: "dark_mode", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var enableSecureMode: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "ui", key: "enable_secure_mode", defaultValue: true)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "ui", key: "enable_secure_mode", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var themeMainColor: String {
|
||||
get {
|
||||
return Config.get().getString(section: "ui", key: "theme_main_color", defaultString: "orange")
|
||||
}
|
||||
set {
|
||||
Config.get().setString(section: "ui", key: "theme_main_color", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var darkModeAllowed: Bool {
|
||||
return Config.get().getBool(section: "ui", key: "dark_mode_allowed", defaultValue: true)
|
||||
}
|
||||
|
||||
static var changeMainColorAllowed: Bool {
|
||||
return Config.get().getBool(section: "ui", key: "change_main_color_allowed", defaultValue: false)
|
||||
}
|
||||
|
||||
static var hideSettings: Bool {
|
||||
return Config.get().getBool(section: "ui", key: "hide_settings", defaultValue: false)
|
||||
}
|
||||
|
||||
static var maxAccountsCount: Int {
|
||||
return Config.get().getInt(section: "ui", key: "max_account", defaultValue: 0)
|
||||
}
|
||||
|
||||
/*
|
||||
static var configPath: String {
|
||||
return context.view.window?.rootViewController?.view.frame.origin.x ?? "" + "/.linphonerc"
|
||||
}
|
||||
|
||||
static var factoryConfigPath: String {
|
||||
return context.view.window?.rootViewController?.view.frame.origin.x ?? "" + "/linphonerc"
|
||||
}
|
||||
|
||||
func copyAssetsFromPackage() {
|
||||
copy(from: "linphonerc_default", to: configPath)
|
||||
copy(from: "linphonerc_factory", to: factoryConfigPath, overrideIfExists: true)
|
||||
}
|
||||
*/
|
||||
|
||||
static var vfsEnabled: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "app", key: "vfs_enabled", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "app", key: "vfs_enabled", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var acceptEarlyMedia: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "sip", key: "incoming_calls_early_media", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "sip", key: "incoming_calls_early_media", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var allowOutgoingEarlyMedia: Bool {
|
||||
get {
|
||||
return Config.get().getBool(section: "sip", key: "real_early_media", defaultValue: false)
|
||||
}
|
||||
set {
|
||||
Config.get().setBool(section: "sip", key: "real_early_media", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
static var defaultDomain: String {
|
||||
get {
|
||||
return Config.get().getString(section: "app", key: "default_domain", defaultString: "sip.linphone.org")
|
||||
}
|
||||
set {
|
||||
Config.get().setString(section: "app", key: "default_domain", value: newValue)
|
||||
}
|
||||
}
|
||||
|
||||
private func copy(from: String, to: String, overrideIfExists: Bool = false) {
|
||||
let fileManager = FileManager.default
|
||||
if fileManager.fileExists(atPath: to), !overrideIfExists {
|
||||
return
|
||||
}
|
||||
|
||||
if let assetPath = Bundle.main.path(forResource: from, ofType: "") {
|
||||
do {
|
||||
try fileManager.copyItem(atPath: assetPath, toPath: to)
|
||||
} catch {
|
||||
print("Error copying file: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSLocalNetworkUsageDescription</key>
|
||||
<string>App requires access to the local network to establish VoIP connections</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
|
@ -111,6 +109,8 @@
|
|||
<true/>
|
||||
<key>ITSEncryptionExportComplianceCode</key>
|
||||
<string>b5cb085f-772a-4a4f-8c77-5d1332b1f93f</string>
|
||||
<key>NSCalendarsWriteOnlyAccessUsageDescription</key>
|
||||
<string></string>
|
||||
<key>NSSupportsSuddenTermination</key>
|
||||
<false/>
|
||||
<key>UIAppFonts</key>
|
||||
|
|
@ -126,15 +126,12 @@
|
|||
<array>
|
||||
<string>remote-notification</string>
|
||||
<string>voip</string>
|
||||
<string>audio</string>
|
||||
</array>
|
||||
<key>UILaunchScreen</key>
|
||||
<dict>
|
||||
<key>UIImageName</key>
|
||||
<string>linphone</string>
|
||||
</dict>
|
||||
<key>NSCalendarsUsageDescription</key>
|
||||
<string>Deprecated - Prior to iOS 17 full calendar access is required</string>
|
||||
<key>NSCalendarsWriteOnlyAccessUsageDescription</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ struct LinphoneApp: App {
|
|||
@State private var meetingsListViewModel: MeetingsListViewModel?
|
||||
@State private var meetingViewModel: MeetingViewModel?
|
||||
@State private var conversationForwardMessageViewModel: ConversationForwardMessageViewModel?
|
||||
@State private var accountProfileViewModel: AccountProfileViewModel?
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
|
|
@ -175,7 +176,8 @@ struct LinphoneApp: App {
|
|||
&& conversationViewModel != nil
|
||||
&& meetingsListViewModel != nil
|
||||
&& meetingViewModel != nil
|
||||
&& conversationForwardMessageViewModel != nil {
|
||||
&& conversationForwardMessageViewModel != nil
|
||||
&& accountProfileViewModel != nil {
|
||||
ContentView(
|
||||
contactViewModel: contactViewModel!,
|
||||
editContactViewModel: editContactViewModel!,
|
||||
|
|
@ -189,7 +191,8 @@ struct LinphoneApp: App {
|
|||
conversationViewModel: conversationViewModel!,
|
||||
meetingsListViewModel: meetingsListViewModel!,
|
||||
meetingViewModel: meetingViewModel!,
|
||||
conversationForwardMessageViewModel: conversationForwardMessageViewModel!
|
||||
conversationForwardMessageViewModel: conversationForwardMessageViewModel!,
|
||||
accountProfileViewModel: accountProfileViewModel!
|
||||
)
|
||||
.environmentObject(navigationManager)
|
||||
.onAppear {
|
||||
|
|
@ -201,6 +204,8 @@ struct LinphoneApp: App {
|
|||
// Notify the app to navigate to the chat room
|
||||
navigationManager.openChatRoom(callId: callId, peerAddr: peerAddr, localAddr: localAddr)
|
||||
}
|
||||
|
||||
accountProfileViewModel!.setAvatarModel()
|
||||
}
|
||||
.onOpenURL { url in
|
||||
URIHandler.handleURL(url: url)
|
||||
|
|
@ -226,18 +231,21 @@ struct LinphoneApp: App {
|
|||
meetingsListViewModel = MeetingsListViewModel()
|
||||
meetingViewModel = MeetingViewModel()
|
||||
conversationForwardMessageViewModel = ConversationForwardMessageViewModel()
|
||||
accountProfileViewModel = AccountProfileViewModel()
|
||||
}.onOpenURL { url in
|
||||
URIHandler.handleURL(url: url)
|
||||
}
|
||||
}
|
||||
}.onChange(of: scenePhase) { newPhase in
|
||||
if newPhase == .active {
|
||||
Log.info("Entering foreground")
|
||||
coreContext.onEnterForeground()
|
||||
} else if newPhase == .inactive {
|
||||
} else if newPhase == .background {
|
||||
Log.info("Entering background")
|
||||
coreContext.onEnterBackground()
|
||||
if !TelecomManager.shared.callInProgress {
|
||||
if newPhase == .active {
|
||||
Log.info("Entering foreground")
|
||||
coreContext.onEnterForeground()
|
||||
} else if newPhase == .inactive {
|
||||
} else if newPhase == .background {
|
||||
Log.info("Entering background")
|
||||
coreContext.onEnterBackground()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config xmlns="http://www.linphone.org/xsds/lpconfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.linphone.org/xsds/lpconfig.xsd lpconfig.xsd">
|
||||
<section name="proxy_default_values">
|
||||
<entry name="avpf" overwrite="true">1</entry>
|
||||
<entry name="dial_escape_plus" overwrite="true">0</entry>
|
||||
<entry name="publish" overwrite="true">1</entry>
|
||||
<entry name="publish_expires" overwrite="true">120</entry>
|
||||
<entry name="quality_reporting_collector" overwrite="true">sip:voip-metrics@sip.linphone.org;transport=tls</entry>
|
||||
<entry name="quality_reporting_enabled" overwrite="true">1</entry>
|
||||
<entry name="quality_reporting_interval" overwrite="true">180</entry>
|
||||
<entry name="reg_expires" overwrite="true">31536000</entry>
|
||||
<entry name="reg_identity" overwrite="true">sip:?@sip.linphone.org</entry>
|
||||
<entry name="reg_proxy" overwrite="true"><sip:sip.linphone.org;transport=tls></entry>
|
||||
<entry name="reg_route" overwrite="true"><sip:sip.linphone.org;transport=tls></entry>
|
||||
<entry name="reg_sendregister" overwrite="true">1</entry>
|
||||
<entry name="nat_policy_ref" overwrite="true">nat_policy_default_values</entry>
|
||||
<entry name="realm" overwrite="true">sip.linphone.org</entry>
|
||||
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
|
||||
<entry name="audio_video_conference_factory_uri" overwrite="true">sip:videoconference-factory@sip.linphone.org</entry>
|
||||
<entry name="push_notification_allowed" overwrite="true">1</entry>
|
||||
<entry name="avpf" overwrite="true">1</entry>
|
||||
<entry name="dial_escape_plus" overwrite="true">0</entry>
|
||||
<entry name="publish" overwrite="true">1</entry>
|
||||
<entry name="publish_expires" overwrite="true">120</entry>
|
||||
<entry name="quality_reporting_collector" overwrite="true">sip:voip-metrics@sip.linphone.org;transport=tls</entry>
|
||||
<entry name="quality_reporting_enabled" overwrite="true">1</entry>
|
||||
<entry name="quality_reporting_interval" overwrite="true">180</entry>
|
||||
<entry name="reg_expires" overwrite="true">31536000</entry>
|
||||
<entry name="reg_identity" overwrite="true">sip:?@sip.linphone.org</entry>
|
||||
<entry name="reg_proxy" overwrite="true"><sip:sip.linphone.org;transport=tls></entry>
|
||||
<entry name="reg_route" overwrite="true"><sip:sip.linphone.org;transport=tls></entry>
|
||||
<entry name="reg_sendregister" overwrite="true">1</entry>
|
||||
<entry name="nat_policy_ref" overwrite="true">nat_policy_default_values</entry>
|
||||
<entry name="realm" overwrite="true">sip.linphone.org</entry>
|
||||
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
|
||||
<entry name="audio_video_conference_factory_uri" overwrite="true">sip:videoconference-factory@sip.linphone.org</entry>
|
||||
<entry name="push_notification_allowed" overwrite="true">1</entry>
|
||||
<entry name="remote_push_notification_allowed" overwrite="true">1</entry>
|
||||
<entry name="cpim_in_basic_chat_rooms_enabled" overwrite="true">1</entry>
|
||||
<entry name="rtp_bundle" overwrite="true">1</entry>
|
||||
<entry name="lime_server_url" overwrite="true">https://lime.linphone.org/lime-server/lime-server.php</entry>
|
||||
<entry name="cpim_in_basic_chat_rooms_enabled" overwrite="true">1</entry>
|
||||
<entry name="rtp_bundle" overwrite="true">1</entry>
|
||||
<entry name="lime_server_url" overwrite="true">https://lime.linphone.org/lime-server/lime-server.php</entry>
|
||||
<entry name="lime_algo" overwrite="true">c25519</entry>
|
||||
<entry name="supported" overwrite="true"></entry>
|
||||
</section>
|
||||
<section name="nat_policy_default_values">
|
||||
<entry name="stun_server" overwrite="true">stun.linphone.org</entry>
|
||||
<entry name="protocols" overwrite="true">stun,ice</entry>
|
||||
<entry name="stun_server" overwrite="true">stun.linphone.org</entry>
|
||||
<entry name="protocols" overwrite="true">stun,ice</entry>
|
||||
</section>
|
||||
<section name="sip">
|
||||
<entry name="media_encryption" overwrite="true">zrtp</entry>
|
||||
<entry name="media_encryption_mandatory">1</entry>
|
||||
<entry name="media_encryption" overwrite="true">zrtp</entry>
|
||||
<entry name="media_encryption_mandatory">1</entry>
|
||||
</section>
|
||||
<section name="net">
|
||||
<entry name="friendlist_subscription_enabled" overwrite="true">1</entry>
|
||||
<entry name="friendlist_subscription_enabled" overwrite="true">1</entry>
|
||||
</section>
|
||||
</config>
|
||||
|
|
|
|||
|
|
@ -1,33 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config xmlns="http://www.linphone.org/xsds/lpconfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.linphone.org/xsds/lpconfig.xsd lpconfig.xsd">
|
||||
<section name="proxy_default_values">
|
||||
<entry name="avpf" overwrite="true">0</entry>
|
||||
<entry name="dial_escape_plus" overwrite="true">0</entry>
|
||||
<entry name="publish" overwrite="true">0</entry>
|
||||
<entry name="publish_expires" overwrite="true">-1</entry>
|
||||
<entry name="quality_reporting_collector" overwrite="true"></entry>
|
||||
<entry name="quality_reporting_enabled" overwrite="true">0</entry>
|
||||
<entry name="quality_reporting_interval" overwrite="true">0</entry>
|
||||
<entry name="reg_expires" overwrite="true">3600</entry>
|
||||
<entry name="reg_identity" overwrite="true"></entry>
|
||||
<entry name="reg_proxy" overwrite="true"></entry>
|
||||
<entry name="reg_route" overwrite="true"></entry>
|
||||
<entry name="reg_sendregister" overwrite="true">1</entry>
|
||||
<entry name="nat_policy_ref" overwrite="true"></entry>
|
||||
<entry name="realm" overwrite="true"></entry>
|
||||
<entry name="conference_factory_uri" overwrite="true"></entry>
|
||||
<entry name="audio_video_conference_factory_uri" overwrite="true"></entry>
|
||||
<entry name="push_notification_allowed" overwrite="true">0</entry>
|
||||
<entry name="cpim_in_basic_chat_rooms_enabled" overwrite="true">0</entry>
|
||||
<entry name="rtp_bundle" overwrite="true">0</entry>
|
||||
<entry name="lime_server_url" overwrite="true"></entry>
|
||||
<entry name="avpf" overwrite="true">0</entry>
|
||||
<entry name="dial_escape_plus" overwrite="true">0</entry>
|
||||
<entry name="publish" overwrite="true">0</entry>
|
||||
<entry name="publish_expires" overwrite="true">-1</entry>
|
||||
<entry name="quality_reporting_collector" overwrite="true"></entry>
|
||||
<entry name="quality_reporting_enabled" overwrite="true">0</entry>
|
||||
<entry name="quality_reporting_interval" overwrite="true">0</entry>
|
||||
<entry name="reg_expires" overwrite="true">3600</entry>
|
||||
<entry name="reg_identity" overwrite="true"></entry>
|
||||
<entry name="reg_proxy" overwrite="true"></entry>
|
||||
<entry name="reg_route" overwrite="true"></entry>
|
||||
<entry name="reg_sendregister" overwrite="true">1</entry>
|
||||
<entry name="nat_policy_ref" overwrite="true"></entry>
|
||||
<entry name="realm" overwrite="true"></entry>
|
||||
<entry name="conference_factory_uri" overwrite="true"></entry>
|
||||
<entry name="audio_video_conference_factory_uri" overwrite="true"></entry>
|
||||
<entry name="push_notification_allowed" overwrite="true">0</entry>
|
||||
<entry name="cpim_in_basic_chat_rooms_enabled" overwrite="true">0</entry>
|
||||
<entry name="rtp_bundle" overwrite="true">0</entry>
|
||||
<entry name="lime_server_url" overwrite="true"></entry>
|
||||
<entry name="lime_algo" overwrite="true"></entry>
|
||||
<entry name="supported" overwrite="true">outbound</entry>
|
||||
</section>
|
||||
<section name="nat_policy_default_values">
|
||||
<entry name="stun_server" overwrite="true">stun.linphone.org</entry>
|
||||
<entry name="protocols" overwrite="true">stun,ice</entry>
|
||||
<entry name="stun_server" overwrite="true">stun.linphone.org</entry>
|
||||
<entry name="protocols" overwrite="true">stun,ice</entry>
|
||||
</section>
|
||||
<section name="sip">
|
||||
<entry name="media_encryption">srtp</entry>
|
||||
<entry name="media_encryption_mandatory" overwrite="true">0</entry>
|
||||
<entry name="media_encryption">srtp</entry>
|
||||
<entry name="media_encryption_mandatory" overwrite="true">0</entry>
|
||||
</section>
|
||||
</config>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ sip_tcp_port=-1
|
|||
sip_tls_port=-1
|
||||
media_encryption=none
|
||||
update_presence_model_timestamp_before_publish_expires_refresh=1
|
||||
use_rfc2833=1
|
||||
use_info=1
|
||||
|
||||
[net]
|
||||
#Because dynamic bitrate adaption can increase bitrate, we must allow "no limit"
|
||||
|
|
@ -28,19 +30,29 @@ tunnel=disabled
|
|||
auto_download_incoming_voice_recordings=1
|
||||
auto_download_incoming_icalendars=1
|
||||
|
||||
|
||||
[tunnel]
|
||||
host=
|
||||
port=443
|
||||
|
||||
[misc]
|
||||
log_collection_upload_server_url=https://www.linphone.org:444/lft.php
|
||||
file_transfer_server_url=https://www.linphone.org:444/lft.php
|
||||
version_check_url_root=https://www.linphone.org/releases
|
||||
log_collection_upload_server_url=https://files.linphone.org/http-file-transfer-server/hft.php
|
||||
file_transfer_server_url=https://files.linphone.org/http-file-transfer-server/hft.php
|
||||
version_check_url_root=https://download.linphone.org/releases
|
||||
max_calls=10
|
||||
history_max_size=100
|
||||
conference_layout=1
|
||||
hide_empty_chat_rooms=1
|
||||
|
||||
[fec]
|
||||
fec_enabled=1
|
||||
|
||||
[magic_search]
|
||||
return_empty_friends=1
|
||||
|
||||
[chat]
|
||||
imdn_to_everybody_threshold=1
|
||||
|
||||
[ui]
|
||||
contacts_filter=sip.linphone.org
|
||||
|
||||
## End of default rc
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ accept_any_encryption=1
|
|||
guess_hostname=1
|
||||
register_only_when_network_is_up=1
|
||||
auto_net_state_mon=1
|
||||
auto_answer_replacing_calls=0
|
||||
auto_answer_replacing_calls=1
|
||||
ping_with_options=0
|
||||
use_cpim=1
|
||||
zrtp_key_agreements_suites=MS_ZRTP_KEY_AGREEMENT_K255_KYB512
|
||||
zrtp_key_agreements_suites=MS_ZRTP_KEY_AGREEMENT_K255_MLK512,MS_ZRTP_KEY_AGREEMENT_K255_KYB512
|
||||
chat_messages_aggregation_delay=1000
|
||||
chat_messages_aggregation=1
|
||||
update_presence_model_timestamp_before_publish_expires_refresh=1
|
||||
|
|
@ -27,6 +27,9 @@ rls_uri=sips:rls@sip.linphone.org
|
|||
[sound]
|
||||
#remove this property for any application that is not Linphone public version itself
|
||||
ec_calibrator_cool_tones=1
|
||||
disable_ringing=1
|
||||
|
||||
[audio]
|
||||
|
||||
[video]
|
||||
auto_resize_preview_to_keep_ratio=1
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class TelecomManager: ObservableObject {
|
|||
@Published var meetingWaitingRoomDisplayed: Bool = false
|
||||
@Published var meetingWaitingRoomSelected: Address?
|
||||
@Published var meetingWaitingRoomName: String = ""
|
||||
@Published var participantsInvited: Bool = false
|
||||
|
||||
var actionToFulFill: CXCallAction?
|
||||
var callkitAudioSessionActivated: Bool?
|
||||
|
|
@ -368,6 +369,8 @@ class TelecomManager: ObservableObject {
|
|||
completion(call.remoteAddress!.displayName!)
|
||||
} else if call.remoteAddress!.username != nil {
|
||||
completion(call.remoteAddress!.username!)
|
||||
} else {
|
||||
completion(String(call.remoteAddress!.asStringUriOnly().dropFirst(4)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -428,6 +431,29 @@ class TelecomManager: ObservableObject {
|
|||
func onCallStateChanged(core: Core, call: Call, state cstate: Call.State, message: String) {
|
||||
let callLog = call.callLog
|
||||
let callId = callLog?.callId ?? ""
|
||||
if !callInProgress && participantsInvited {
|
||||
if let remoteAddress = call.remoteAddress {
|
||||
let uuid = UUID()
|
||||
let name = remoteAddress.asStringUriOnly()
|
||||
let handle = CXHandle(type: .generic, value: remoteAddress.asStringUriOnly())
|
||||
let startCallAction = CXStartCallAction(call: uuid, handle: handle)
|
||||
let transaction = CXTransaction(action: startCallAction)
|
||||
|
||||
let callInfo = CallInfo.newOutgoingCallInfo(addr: remoteAddress, isSas: false, displayName: name, isVideo: true, isConference: true)
|
||||
providerDelegate.callInfos.updateValue(callInfo, forKey: uuid)
|
||||
providerDelegate.uuids.updateValue(uuid, forKey: callId)
|
||||
|
||||
setHeldOtherCalls(core: core, exceptCallid: callId)
|
||||
requestTransaction(transaction, action: "startCall")
|
||||
DispatchQueue.main.async {
|
||||
self.participantsInvited = false
|
||||
withAnimation {
|
||||
self.callDisplayed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if cstate == .PushIncomingReceived {
|
||||
Log.info("PushIncomingReceived in core delegate, display callkit call")
|
||||
TelecomManager.shared.displayIncomingCall(call: call, handle: "Calling", hasVideo: false, callId: callId, displayName: "Calling")
|
||||
|
|
@ -475,6 +501,8 @@ class TelecomManager: ObservableObject {
|
|||
displayName = call.remoteAddress!.displayName!
|
||||
} else if call.remoteAddress!.username != nil {
|
||||
displayName = call.remoteAddress!.username!
|
||||
} else {
|
||||
displayName = String(call.remoteAddress!.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -641,7 +669,7 @@ class TelecomManager: ObservableObject {
|
|||
if UIApplication.shared.applicationState != .active && (callLog == nil || callLog?.status == .Missed || callLog?.status == .Aborted || callLog?.status == .EarlyAborted) {
|
||||
// Configure the notification's payload.
|
||||
let content = UNMutableNotificationContent()
|
||||
content.title = NSString.localizedUserNotificationString(forKey: NSLocalizedString("Missed call", comment: ""), arguments: nil)
|
||||
content.title = NSString.localizedUserNotificationString(forKey: NSLocalizedString("notification_missed_call_title", comment: ""), arguments: nil)
|
||||
content.body = NSString.localizedUserNotificationString(forKey: displayName, arguments: nil)
|
||||
|
||||
// Deliver the notification.
|
||||
|
|
|
|||
|
|
@ -45,269 +45,50 @@ struct LoginFragment: View {
|
|||
NavigationView {
|
||||
ZStack {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
|
||||
if isShowBack {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
.padding(.top, -75)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
onBackPressed?()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
}
|
||||
|
||||
Text("assistant_account_login")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "username")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("username", text: $accountLoginViewModel.username)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isNameFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isNameFocused)
|
||||
|
||||
Text(String(localized: "password")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
ZStack(alignment: .trailing) {
|
||||
Group {
|
||||
if isSecured {
|
||||
SecureField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
} else {
|
||||
TextField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
}
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
isSecured.toggle()
|
||||
}, label: {
|
||||
Image(self.isSecured ? "eye-slash" : "eye")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20)
|
||||
})
|
||||
}
|
||||
.disabled(coreContext.loggedIn)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPasswordFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
Button(action: {
|
||||
sharedMainViewModel.changeDisplayProfileMode()
|
||||
self.accountLoginViewModel.login()
|
||||
coreContext.loggingInProgress = true
|
||||
}, label: {
|
||||
Text(coreContext.loggedIn ? "Log out" : "assistant_account_login")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background((accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty) ? Color.orangeMain100 : Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty)
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
Text("[Forgotten password?](https://subscribe.linphone.org/)")
|
||||
.underline()
|
||||
.tint(Color.grayMain2c600)
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.bottom, 30)
|
||||
|
||||
HStack {
|
||||
VStack {
|
||||
Divider()
|
||||
}
|
||||
Text(" or ")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
VStack {
|
||||
Divider()
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 10)
|
||||
|
||||
NavigationLink(destination: {
|
||||
QrCodeScannerFragment()
|
||||
}, label: {
|
||||
HStack {
|
||||
Image("qr-code")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
Text("Scan QR code")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
NavigationLink(isActive: $isLinkSIPActive, destination: {
|
||||
ThirdPartySipAccountWarningFragment(accountLoginViewModel: accountLoginViewModel)
|
||||
}, label: {
|
||||
Text("Use SIP Account")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.disabled(!sharedMainViewModel.generalTermsAccepted)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.simultaneousGesture(
|
||||
TapGesture().onEnded {
|
||||
self.linkActive = "SIP"
|
||||
if !sharedMainViewModel.generalTermsAccepted {
|
||||
withAnimation {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
} else {
|
||||
self.isLinkSIPActive = true
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack(alignment: .center) {
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("Not account yet?")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.padding(.horizontal, 10)
|
||||
|
||||
NavigationLink(destination: RegisterFragment(registerViewModel: RegisterViewModel()), isActive: $isLinkREGActive, label: {Text("Register")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
})
|
||||
.disabled(!sharedMainViewModel.generalTermsAccepted)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.padding(.horizontal, 10)
|
||||
.simultaneousGesture(
|
||||
TapGesture().onEnded {
|
||||
self.linkActive = "REG"
|
||||
if !sharedMainViewModel.generalTermsAccepted {
|
||||
withAnimation {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
} else {
|
||||
self.isLinkREGActive = true
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.bottom)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
if #available(iOS 16.4, *) {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.scrollBounceBehavior(.basedOnSize)
|
||||
} else {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
|
||||
if self.isShowPopup {
|
||||
let contentPopup1 = Text("En continuant, vous acceptez ces conditions, ")
|
||||
let contentPopup2 = Text("[notre politique de confidentialité](https://linphone.org/privacy-policy)").underline()
|
||||
let contentPopup3 = Text(" et ")
|
||||
let contentPopup4 = Text("[nos conditions d’utilisation](https://linphone.org/general-terms)").underline()
|
||||
let contentPopup5 = Text(".")
|
||||
PopupView(isShowPopup: $isShowPopup,
|
||||
title: Text("Conditions de service"),
|
||||
content: contentPopup1 + contentPopup2 + contentPopup3 + contentPopup4 + contentPopup5,
|
||||
titleFirstButton: Text("Deny all"),
|
||||
actionFirstButton: {self.isShowPopup.toggle()},
|
||||
titleSecondButton: Text("Accept all"),
|
||||
actionSecondButton: {acceptGeneralTerms()})
|
||||
.background(.black.opacity(0.65))
|
||||
.onTapGesture {
|
||||
self.isShowPopup.toggle()
|
||||
let generalTerms = String(format: "[%@](%@)", String(localized: "assistant_dialog_general_terms_label"), "https://www.linphone.org/en/terms-of-use/")
|
||||
let privacyPolicy = String(format: "[%@](%@)", String(localized: "assistant_dialog_privacy_policy_label"), "https://linphone.org/en/privacy-policy")
|
||||
let splitMsg = String(localized: "assistant_dialog_general_terms_and_privacy_policy_message").components(separatedBy: "%@")
|
||||
if splitMsg.count == 3 { // We expect form of STRING %A STRING %@ STRING
|
||||
let contentPopup1 = Text(.init(splitMsg[0]))
|
||||
let contentPopup2 = Text(.init(generalTerms)).underline()
|
||||
let contentPopup3 = Text(.init(splitMsg[1]))
|
||||
let contentPopup4 = Text(.init(privacyPolicy)).underline()
|
||||
let contentPopup5 = Text(.init(splitMsg[2]))
|
||||
PopupView(isShowPopup: $isShowPopup,
|
||||
title: Text("assistant_dialog_general_terms_and_privacy_policy_title"),
|
||||
content: contentPopup1 + contentPopup2 + contentPopup3 + contentPopup4 + contentPopup5,
|
||||
titleFirstButton: Text("dialog_deny"),
|
||||
actionFirstButton: {self.isShowPopup.toggle()},
|
||||
titleSecondButton: Text("dialog_accept"),
|
||||
actionSecondButton: {acceptGeneralTerms()})
|
||||
.background(.black.opacity(0.65))
|
||||
.onTapGesture {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
} else { // backup just in case
|
||||
PopupView(isShowPopup: $isShowPopup,
|
||||
title: Text("assistant_dialog_general_terms_and_privacy_policy_title"),
|
||||
content: Text(.init(String(format: String(localized: "assistant_dialog_general_terms_and_privacy_policy_message"), generalTerms, privacyPolicy))),
|
||||
titleFirstButton: Text("dialog_deny"),
|
||||
actionFirstButton: {self.isShowPopup.toggle()},
|
||||
titleSecondButton: Text("dialog_accept"),
|
||||
actionSecondButton: {acceptGeneralTerms()})
|
||||
.background(.black.opacity(0.65))
|
||||
.onTapGesture {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -319,10 +100,257 @@ struct LoginFragment: View {
|
|||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
}
|
||||
|
||||
func innerScrollView(geometry: GeometryProxy) -> some View {
|
||||
VStack {
|
||||
ZStack {
|
||||
HStack {
|
||||
if isShowBack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
onBackPressed?()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Color.clear
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Text("assistant_account_login")
|
||||
.default_text_style_800(styleSize: 20)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
.padding(.top, 10)
|
||||
.padding(.bottom, 20)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "username")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("username", text: $accountLoginViewModel.username)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isNameFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isNameFocused)
|
||||
|
||||
Text(String(localized: "password")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
ZStack(alignment: .trailing) {
|
||||
Group {
|
||||
if isSecured {
|
||||
SecureField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
} else {
|
||||
TextField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
}
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
isSecured.toggle()
|
||||
}, label: {
|
||||
Image(self.isSecured ? "eye-slash" : "eye")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20)
|
||||
})
|
||||
}
|
||||
.disabled(coreContext.loggedIn)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPasswordFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
Button(action: {
|
||||
sharedMainViewModel.changeDisplayProfileMode()
|
||||
self.accountLoginViewModel.login()
|
||||
coreContext.loggingInProgress = true
|
||||
}, label: {
|
||||
Text(coreContext.loggedIn ? "manage_account_delete" : "assistant_account_login")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background((accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty) ? Color.orangeMain100 : Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty)
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
Text(.init(String(format: ("[%@](%@)"), String(localized: "assistant_forgotten_password"), "https://subscribe.linphone.org/")))
|
||||
.underline()
|
||||
.tint(Color.grayMain2c600)
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.bottom, 30)
|
||||
|
||||
HStack {
|
||||
VStack {
|
||||
Divider()
|
||||
}
|
||||
Text("or")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
VStack {
|
||||
Divider()
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 10)
|
||||
|
||||
NavigationLink(destination: {
|
||||
QrCodeScannerFragment()
|
||||
}, label: {
|
||||
HStack {
|
||||
Image("qr-code")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
Text("assistant_scan_qr_code")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
NavigationLink(isActive: $isLinkSIPActive, destination: {
|
||||
ThirdPartySipAccountWarningFragment(accountLoginViewModel: accountLoginViewModel)
|
||||
}, label: {
|
||||
Text("assistant_login_third_party_sip_account")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.disabled(!sharedMainViewModel.generalTermsAccepted)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.simultaneousGesture(
|
||||
TapGesture().onEnded {
|
||||
self.linkActive = "SIP"
|
||||
if !sharedMainViewModel.generalTermsAccepted {
|
||||
withAnimation {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
} else {
|
||||
self.isLinkSIPActive = true
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack(alignment: .center) {
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("assistant_no_account_yet")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.padding(.horizontal, 10)
|
||||
|
||||
NavigationLink(destination: RegisterFragment(registerViewModel: RegisterViewModel()), isActive: $isLinkREGActive, label: { Text("assistant_account_register")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
})
|
||||
.disabled(!sharedMainViewModel.generalTermsAccepted)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.padding(.horizontal, 10)
|
||||
.simultaneousGesture(
|
||||
TapGesture().onEnded {
|
||||
self.linkActive = "REG"
|
||||
if !sharedMainViewModel.generalTermsAccepted {
|
||||
withAnimation {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
} else {
|
||||
self.isLinkREGActive = true
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.bottom)
|
||||
|
||||
Image("mountain2")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 60)
|
||||
.clipped()
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
|
||||
func acceptGeneralTerms() {
|
||||
sharedMainViewModel.changeGeneralTerms()
|
||||
self.isShowPopup.toggle()
|
||||
|
|
|
|||
|
|
@ -29,171 +29,21 @@ struct PermissionsFragment: View {
|
|||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
.padding(.top, -75)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
|
||||
Text("assistant_permissions_title")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Text(String(format: String(localized: "assistant_permissions_subtitle"), Bundle.main.displayName))
|
||||
.default_text_style(styleSize: 15)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("bell-ringing")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("assistant_permissions_post_notifications_title")
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(.leading, 10)
|
||||
}
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("address-book")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("assistant_permissions_read_contacts_title")
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(.leading, 10)
|
||||
}
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("microphone")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("assistant_permissions_record_audio_title")
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(.leading, 10)
|
||||
}
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("video-camera")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("assistant_permissions_access_camera_title")
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(.leading, 10)
|
||||
}
|
||||
.padding(.bottom)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxHeight: .infinity)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
withAnimation {
|
||||
sharedMainViewModel.changeWelcomeView()
|
||||
}
|
||||
}, label: {
|
||||
Text("assistant_permissions_skip_permissions")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal)
|
||||
|
||||
Button {
|
||||
permissionManager.getPermissions()
|
||||
} label: {
|
||||
Text("assistant_permissions_grant_all_of_them")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
|
||||
if #available(iOS 16.4, *) {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.scrollBounceBehavior(.basedOnSize)
|
||||
} else {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationBarHidden(true)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
.onReceive(permissionManager.$allPermissionsHaveBeenDisplayed, perform: { (granted) in
|
||||
if granted {
|
||||
withAnimation {
|
||||
|
|
@ -202,6 +52,161 @@ struct PermissionsFragment: View {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
func innerScrollView(geometry: GeometryProxy) -> some View {
|
||||
VStack {
|
||||
ZStack {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Text("assistant_permissions_title")
|
||||
.default_text_style_800(styleSize: 20)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
.padding(.top, 10)
|
||||
.padding(.bottom, 20)
|
||||
|
||||
Text(String(format: String(localized: "assistant_permissions_subtitle"), Bundle.main.displayName))
|
||||
.default_text_style(styleSize: 15)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("bell-ringing")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("assistant_permissions_post_notifications_title")
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(.leading, 10)
|
||||
}
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("address-book")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
Text(.init(String(format: String(localized: "assistant_permissions_read_contacts_title"), Bundle.main.displayName)))
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(.leading, 10)
|
||||
}
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("microphone")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("assistant_permissions_record_audio_title")
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(.leading, 10)
|
||||
}
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
HStack(alignment: .center) {
|
||||
Image("video-camera")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("assistant_permissions_access_camera_title")
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(.leading, 10)
|
||||
}
|
||||
.padding(.bottom)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.frame(maxHeight: .infinity)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
withAnimation {
|
||||
sharedMainViewModel.changeWelcomeView()
|
||||
}
|
||||
}, label: {
|
||||
Text("assistant_permissions_skip_permissions")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal)
|
||||
|
||||
Button {
|
||||
permissionManager.getPermissions()
|
||||
} label: {
|
||||
Text("assistant_permissions_grant_all_of_them")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom)
|
||||
|
||||
Image("mountain2")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 60)
|
||||
.clipped()
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ struct ProfileModeFragment: View {
|
|||
Button(action: {
|
||||
sharedMainViewModel.changeHideProfileMode()
|
||||
}, label: {
|
||||
Text("Continue")
|
||||
Text("dialog_continue")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
@ -156,7 +156,7 @@ struct ProfileModeFragment: View {
|
|||
+ " Etiam velit sapien, egestas sit amet dictum eget, condimentum a ligula."),
|
||||
titleFirstButton: nil,
|
||||
actionFirstButton: {},
|
||||
titleSecondButton: Text("Close"),
|
||||
titleSecondButton: Text("dialog_close"),
|
||||
actionSecondButton: {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,121 +41,14 @@ struct RegisterCodeConfirmationFragment: View {
|
|||
NavigationView {
|
||||
GeometryReader { geometry in
|
||||
ZStack {
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
.padding(.top, -75)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
|
||||
Text("assistant_account_register")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
ZStack {
|
||||
VStack {
|
||||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Image("confirm_sms_code_illu")
|
||||
.padding(.bottom, -geometry.safeAreaInsets.bottom)
|
||||
}
|
||||
}
|
||||
VStack(alignment: .center) {
|
||||
Spacer()
|
||||
|
||||
Text(String(format: NSLocalizedString("assistant_account_creation_sms_confirmation_explanation", comment: ""), registerViewModel.phoneNumber))
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
VStack {
|
||||
ZStack {
|
||||
|
||||
HStack(spacing: spaceBetweenBoxes) {
|
||||
otpText(text: registerViewModel.otp1, focused: registerViewModel.otpField.isEmpty)
|
||||
otpText(text: registerViewModel.otp2, focused: registerViewModel.otpField.count == 1)
|
||||
otpText(text: registerViewModel.otp3, focused: registerViewModel.otpField.count == 2)
|
||||
otpText(text: registerViewModel.otp4, focused: registerViewModel.otpField.count == 3)
|
||||
}
|
||||
|
||||
TextField("", text: $registerViewModel.otpField)
|
||||
.default_text_style_600(styleSize: 80)
|
||||
.frame(width: isFocused ? 0 : textFieldOriginalWidth, height: textBoxHeight)
|
||||
.textContentType(.oneTimeCode)
|
||||
.foregroundColor(.clear)
|
||||
.accentColor(.clear)
|
||||
.background(.clear)
|
||||
.keyboardType(.numberPad)
|
||||
.focused($isFocused)
|
||||
.onChange(of: registerViewModel.otpField) { _ in
|
||||
limitText(textLimit)
|
||||
if registerViewModel.otpField.count > 3 {
|
||||
registerViewModel.validateCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding(.vertical, 20)
|
||||
|
||||
Button(action: {
|
||||
dismiss()
|
||||
}, label: {
|
||||
Text("assistant_account_creation_wrong_phone_number")
|
||||
.default_text_style_orange_600(styleSize: 15)
|
||||
.frame(height: 35)
|
||||
})
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 5)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
Spacer()
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
if #available(iOS 16.4, *) {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
.onAppear {
|
||||
registerViewModel.otpField = ""
|
||||
.scrollBounceBehavior(.basedOnSize)
|
||||
} else {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -167,12 +60,127 @@ struct RegisterCodeConfirmationFragment: View {
|
|||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
|
||||
func innerScrollView(geometry: GeometryProxy) -> some View {
|
||||
VStack {
|
||||
ZStack {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Text("assistant_account_register")
|
||||
.default_text_style_800(styleSize: 20)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
.padding(.top, 10)
|
||||
.padding(.bottom, 20)
|
||||
|
||||
ZStack {
|
||||
VStack {
|
||||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Image("confirm_sms_code_illu")
|
||||
.padding(.bottom, -geometry.safeAreaInsets.bottom)
|
||||
}
|
||||
}
|
||||
VStack(alignment: .center) {
|
||||
Spacer()
|
||||
|
||||
Text(String(format: NSLocalizedString("assistant_account_creation_sms_confirmation_explanation", comment: ""), registerViewModel.phoneNumber))
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
VStack {
|
||||
ZStack {
|
||||
|
||||
HStack(spacing: spaceBetweenBoxes) {
|
||||
otpText(text: registerViewModel.otp1, focused: registerViewModel.otpField.isEmpty)
|
||||
otpText(text: registerViewModel.otp2, focused: registerViewModel.otpField.count == 1)
|
||||
otpText(text: registerViewModel.otp3, focused: registerViewModel.otpField.count == 2)
|
||||
otpText(text: registerViewModel.otp4, focused: registerViewModel.otpField.count == 3)
|
||||
}
|
||||
|
||||
TextField("", text: $registerViewModel.otpField)
|
||||
.default_text_style_600(styleSize: 80)
|
||||
.frame(width: isFocused ? 0 : textFieldOriginalWidth, height: textBoxHeight)
|
||||
.textContentType(.oneTimeCode)
|
||||
.foregroundColor(.clear)
|
||||
.accentColor(.clear)
|
||||
.background(.clear)
|
||||
.keyboardType(.numberPad)
|
||||
.focused($isFocused)
|
||||
.onChange(of: registerViewModel.otpField) { _ in
|
||||
limitText(textLimit)
|
||||
if registerViewModel.otpField.count > 3 {
|
||||
registerViewModel.validateCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.padding(.vertical, 20)
|
||||
|
||||
Button(action: {
|
||||
dismiss()
|
||||
}, label: {
|
||||
Text("assistant_account_creation_wrong_phone_number")
|
||||
.default_text_style_orange_600(styleSize: 15)
|
||||
.frame(height: 35)
|
||||
})
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 5)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
Spacer()
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("mountain2")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 60)
|
||||
.clipped()
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
.onAppear {
|
||||
registerViewModel.otpField = ""
|
||||
}
|
||||
}
|
||||
|
||||
private func otpText(text: String, focused: Bool) -> some View {
|
||||
|
||||
return Text(text)
|
||||
|
|
|
|||
|
|
@ -39,281 +39,30 @@ struct RegisterFragment: View {
|
|||
NavigationView {
|
||||
GeometryReader { geometry in
|
||||
ZStack {
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
.padding(.top, -75)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
|
||||
Text("assistant_account_register")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "username")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("username", text: $registerViewModel.username)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isNameFocused ? Color.orangeMain500 : (!registerViewModel.usernameError.isEmpty ? Color.redDanger500 : Color.gray200), lineWidth: 1)
|
||||
)
|
||||
.focused($isNameFocused)
|
||||
.onChange(of: registerViewModel.username) { _ in
|
||||
if !registerViewModel.usernameError.isEmpty {
|
||||
registerViewModel.usernameError = ""
|
||||
}
|
||||
}
|
||||
|
||||
Text(registerViewModel.usernameError)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.padding(.bottom)
|
||||
|
||||
Text(String(localized: "Phone number")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
HStack {
|
||||
Menu {
|
||||
Picker("", selection: $registerViewModel.dialPlanValueSelected) {
|
||||
ForEach(Array(registerViewModel.dialPlansLabelList.enumerated()), id: \.offset) { index, dialPlan in
|
||||
Text(dialPlan).tag(registerViewModel.dialPlansShortLabelList[index])
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
Text(registerViewModel.dialPlanValueSelected)
|
||||
|
||||
Image("caret-down")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.blue)
|
||||
.frame(width: 15, height: 15)
|
||||
}
|
||||
}
|
||||
.padding(.trailing, 5)
|
||||
|
||||
Divider()
|
||||
|
||||
TextField("Phone number", text: $registerViewModel.phoneNumber)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.padding(.leading, 5)
|
||||
.keyboardType(.numberPad)
|
||||
.onChange(of: registerViewModel.phoneNumber) { _ in
|
||||
if !registerViewModel.phoneNumberError.isEmpty {
|
||||
registerViewModel.phoneNumberError = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPhoneNumberFocused ? Color.orangeMain500 : (!registerViewModel.phoneNumberError.isEmpty ? Color.redDanger500 : Color.gray200), lineWidth: 1)
|
||||
)
|
||||
.focused($isPhoneNumberFocused)
|
||||
|
||||
Text(registerViewModel.phoneNumberError)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.padding(.bottom)
|
||||
|
||||
Text(String(localized: "password")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
ZStack(alignment: .trailing) {
|
||||
Group {
|
||||
if isSecured {
|
||||
SecureField("password", text: $registerViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
.onChange(of: registerViewModel.passwd) { _ in
|
||||
if !registerViewModel.passwordError.isEmpty {
|
||||
registerViewModel.passwordError = ""
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TextField("password", text: $registerViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
.onChange(of: registerViewModel.passwd) { _ in
|
||||
if !registerViewModel.passwordError.isEmpty {
|
||||
registerViewModel.passwordError = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
isSecured.toggle()
|
||||
}, label: {
|
||||
Image(self.isSecured ? "eye-slash" : "eye")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20)
|
||||
})
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPasswordFocused ? Color.orangeMain500 : (!registerViewModel.passwordError.isEmpty ? Color.redDanger500 : Color.gray200), lineWidth: 1)
|
||||
)
|
||||
|
||||
Text(registerViewModel.passwordError)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.padding(.bottom)
|
||||
|
||||
NavigationLink(isActive: $registerViewModel.isLinkActive, destination: {
|
||||
RegisterCodeConfirmationFragment(registerViewModel: registerViewModel)
|
||||
}, label: {
|
||||
Text("assistant_account_create")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background((registerViewModel.username.isEmpty || registerViewModel.phoneNumber.isEmpty || registerViewModel.passwd.isEmpty) ? Color.orangeMain100 : Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(!registerViewModel.isLinkActive)
|
||||
.padding(.bottom)
|
||||
.simultaneousGesture(
|
||||
TapGesture().onEnded {
|
||||
if !(registerViewModel.username.isEmpty || registerViewModel.phoneNumber.isEmpty || registerViewModel.passwd.isEmpty) {
|
||||
withAnimation {
|
||||
self.isShowPopup = true
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("assistant_create_account_using_email_on_our_web_platform")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
|
||||
Button(action: {
|
||||
UIApplication.shared.open(URL(string: "https://subscribe.linphone.org/register/email")!)
|
||||
}, label: {
|
||||
Text("assistant_web_platform_link")
|
||||
.default_text_style_orange_600(styleSize: 15)
|
||||
.frame(height: 35)
|
||||
})
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 5)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack(alignment: .center) {
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("assistant_already_have_an_account")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.padding(.horizontal, 10)
|
||||
|
||||
Button(action: {
|
||||
dismiss()
|
||||
}, label: {
|
||||
Text("assistant_account_login")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.padding(.horizontal, 10)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.bottom)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
if #available(iOS 16.4, *) {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.scrollBounceBehavior(.basedOnSize)
|
||||
} else {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
|
||||
if self.isShowPopup {
|
||||
let titlePopup = Text("assistant_dialog_confirm_phone_number_title")
|
||||
let contentPopup = Text(String(format: NSLocalizedString("assistant_dialog_confirm_phone_number_message", comment: ""), registerViewModel.phoneNumber))
|
||||
let contentPopup = Text("assistant_dialog_confirm_phone_number_message")
|
||||
|
||||
PopupView(
|
||||
isShowPopup: $isShowPopup,
|
||||
title: titlePopup,
|
||||
content: contentPopup,
|
||||
titleFirstButton: Text("Cancel"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {
|
||||
self.isShowPopup = false
|
||||
},
|
||||
titleSecondButton: Text("Continue"),
|
||||
titleSecondButton: Text("dialog_continue"),
|
||||
actionSecondButton: {
|
||||
self.isShowPopup = false
|
||||
registerViewModel.createInProgress = true
|
||||
|
|
@ -335,11 +84,268 @@ struct RegisterFragment: View {
|
|||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
|
||||
func innerScrollView(geometry: GeometryProxy) -> some View {
|
||||
VStack {
|
||||
ZStack {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Text("assistant_account_register")
|
||||
.default_text_style_800(styleSize: 20)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
.padding(.top, 10)
|
||||
.padding(.bottom, 20)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "username")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("username", text: $registerViewModel.username)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isNameFocused ? Color.orangeMain500 : (!registerViewModel.usernameError.isEmpty ? Color.redDanger500 : Color.gray200), lineWidth: 1)
|
||||
)
|
||||
.focused($isNameFocused)
|
||||
.onChange(of: registerViewModel.username) { _ in
|
||||
if !registerViewModel.usernameError.isEmpty {
|
||||
registerViewModel.usernameError = ""
|
||||
}
|
||||
}
|
||||
|
||||
Text(registerViewModel.usernameError)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.padding(.bottom)
|
||||
|
||||
Text(String(localized: "phone_number")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
HStack {
|
||||
Menu {
|
||||
Picker("", selection: $registerViewModel.dialPlanValueSelected) {
|
||||
ForEach(Array(registerViewModel.dialPlansLabelList.enumerated()), id: \.offset) { index, dialPlan in
|
||||
Text(dialPlan).tag(registerViewModel.dialPlansShortLabelList[index])
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
Text(registerViewModel.dialPlanValueSelected)
|
||||
|
||||
Image("caret-down")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.blue)
|
||||
.frame(width: 15, height: 15)
|
||||
}
|
||||
}
|
||||
.padding(.trailing, 5)
|
||||
|
||||
Divider()
|
||||
|
||||
TextField("phone_number", text: $registerViewModel.phoneNumber)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.padding(.leading, 5)
|
||||
.keyboardType(.numberPad)
|
||||
.onChange(of: registerViewModel.phoneNumber) { _ in
|
||||
if !registerViewModel.phoneNumberError.isEmpty {
|
||||
registerViewModel.phoneNumberError = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPhoneNumberFocused ? Color.orangeMain500 : (!registerViewModel.phoneNumberError.isEmpty ? Color.redDanger500 : Color.gray200), lineWidth: 1)
|
||||
)
|
||||
.focused($isPhoneNumberFocused)
|
||||
|
||||
Text(registerViewModel.phoneNumberError)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.padding(.bottom)
|
||||
|
||||
Text(String(localized: "password")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
ZStack(alignment: .trailing) {
|
||||
Group {
|
||||
if isSecured {
|
||||
SecureField("password", text: $registerViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
.onChange(of: registerViewModel.passwd) { _ in
|
||||
if !registerViewModel.passwordError.isEmpty {
|
||||
registerViewModel.passwordError = ""
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TextField("password", text: $registerViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
.onChange(of: registerViewModel.passwd) { _ in
|
||||
if !registerViewModel.passwordError.isEmpty {
|
||||
registerViewModel.passwordError = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
isSecured.toggle()
|
||||
}, label: {
|
||||
Image(self.isSecured ? "eye-slash" : "eye")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20)
|
||||
})
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPasswordFocused ? Color.orangeMain500 : (!registerViewModel.passwordError.isEmpty ? Color.redDanger500 : Color.gray200), lineWidth: 1)
|
||||
)
|
||||
|
||||
Text(registerViewModel.passwordError)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style_600(styleSize: 15)
|
||||
.padding(.bottom)
|
||||
|
||||
NavigationLink(isActive: $registerViewModel.isLinkActive, destination: {
|
||||
RegisterCodeConfirmationFragment(registerViewModel: registerViewModel)
|
||||
}, label: {
|
||||
Text("assistant_account_create")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background((registerViewModel.username.isEmpty || registerViewModel.phoneNumber.isEmpty || registerViewModel.passwd.isEmpty) ? Color.orangeMain100 : Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(!registerViewModel.isLinkActive)
|
||||
.padding(.bottom)
|
||||
.simultaneousGesture(
|
||||
TapGesture().onEnded {
|
||||
if !(registerViewModel.username.isEmpty || registerViewModel.phoneNumber.isEmpty || registerViewModel.passwd.isEmpty) {
|
||||
withAnimation {
|
||||
self.isShowPopup = true
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("assistant_create_account_using_email_on_our_web_platform")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
|
||||
Button(action: {
|
||||
UIApplication.shared.open(URL(string: "https://subscribe.linphone.org/register/email")!)
|
||||
}, label: {
|
||||
Text("assistant_web_platform_link")
|
||||
.default_text_style_orange_600(styleSize: 15)
|
||||
.frame(height: 35)
|
||||
})
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 5)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack(alignment: .center) {
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("assistant_already_have_an_account")
|
||||
.default_text_style(styleSize: 15)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.padding(.horizontal, 10)
|
||||
|
||||
Button(action: {
|
||||
dismiss()
|
||||
}, label: {
|
||||
Text("assistant_account_login")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.padding(.horizontal, 10)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.bottom)
|
||||
|
||||
Image("mountain2")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 60)
|
||||
.clipped()
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
|
|
|||
|
|
@ -36,207 +36,216 @@ struct ThirdPartySipAccountLoginFragment: View {
|
|||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
.padding(.top, -75)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
accountLoginViewModel.domain = "sip.linphone.org"
|
||||
accountLoginViewModel.transportType = "TLS"
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
|
||||
Text("Use a SIP account")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "username")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("username", text: $accountLoginViewModel.username)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isNameFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isNameFocused)
|
||||
|
||||
Text(String(localized: "password")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
ZStack(alignment: .trailing) {
|
||||
Group {
|
||||
if isSecured {
|
||||
SecureField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
} else {
|
||||
TextField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
}
|
||||
}
|
||||
Button(action: {
|
||||
isSecured.toggle()
|
||||
}, label: {
|
||||
Image(self.isSecured ? "eye-slash" : "eye")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20)
|
||||
})
|
||||
}
|
||||
.disabled(coreContext.loggedIn)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPasswordFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
Text(String(localized: "Domain")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("sip.linphone.org", text: $accountLoginViewModel.domain)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isDomainFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isDomainFocused)
|
||||
|
||||
Text(String(localized: "Display Name"))
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("Display Name", text: $accountLoginViewModel.displayName)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isDisplayNameFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isDisplayNameFocused)
|
||||
|
||||
Text(String(localized: "Transport"))
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
Menu {
|
||||
Button("TLS") {accountLoginViewModel.transportType = "TLS"}
|
||||
Button("TCP") {accountLoginViewModel.transportType = "TCP"}
|
||||
Button("UDP") {accountLoginViewModel.transportType = "UDP"}
|
||||
} label: {
|
||||
Text(accountLoginViewModel.transportType)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Image("caret-down")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
self.accountLoginViewModel.login()
|
||||
}, label: {
|
||||
Text(coreContext.loggedIn ? "Log out" : "assistant_account_login")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(
|
||||
(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty)
|
||||
? Color.orangeMain100
|
||||
: Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty)
|
||||
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
if #available(iOS 16.4, *) {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.scrollBounceBehavior(.basedOnSize)
|
||||
} else {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
}
|
||||
|
||||
func innerScrollView(geometry: GeometryProxy) -> some View {
|
||||
VStack {
|
||||
ZStack {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
accountLoginViewModel.domain = "sip.linphone.org"
|
||||
accountLoginViewModel.transportType = "TLS"
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Text("assistant_login_third_party_sip_account")
|
||||
.default_text_style_800(styleSize: 20)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
.padding(.top, 10)
|
||||
.padding(.bottom, 20)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "username")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("username", text: $accountLoginViewModel.username)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isNameFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isNameFocused)
|
||||
|
||||
Text(String(localized: "password")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
ZStack(alignment: .trailing) {
|
||||
Group {
|
||||
if isSecured {
|
||||
SecureField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
} else {
|
||||
TextField("password", text: $accountLoginViewModel.passwd)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.frame(height: 25)
|
||||
.focused($isPasswordFocused)
|
||||
}
|
||||
}
|
||||
Button(action: {
|
||||
isSecured.toggle()
|
||||
}, label: {
|
||||
Image(self.isSecured ? "eye-slash" : "eye")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20)
|
||||
})
|
||||
}
|
||||
.disabled(coreContext.loggedIn)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isPasswordFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
|
||||
Text(String(localized: "sip_address_domain")+"*")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("sip.linphone.org", text: $accountLoginViewModel.domain)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isDomainFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isDomainFocused)
|
||||
|
||||
Text(String(localized: "sip_address_display_name"))
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField("sip_address_display_name", text: $accountLoginViewModel.displayName)
|
||||
.default_text_style(styleSize: 15)
|
||||
.disableAutocorrection(true)
|
||||
.autocapitalization(.none)
|
||||
.disabled(coreContext.loggedIn)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isDisplayNameFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.focused($isDisplayNameFocused)
|
||||
|
||||
Text(String(localized: "assistant_sip_account_transport_protocol"))
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
Menu {
|
||||
Button("TLS") {accountLoginViewModel.transportType = "TLS"}
|
||||
Button("TCP") {accountLoginViewModel.transportType = "TCP"}
|
||||
Button("UDP") {accountLoginViewModel.transportType = "UDP"}
|
||||
} label: {
|
||||
Text(accountLoginViewModel.transportType)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Image("caret-down")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
self.accountLoginViewModel.login()
|
||||
}, label: {
|
||||
Text(coreContext.loggedIn ? "manage_account_delete" : "assistant_account_login")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(
|
||||
(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty)
|
||||
? Color.orangeMain100
|
||||
: Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.disabled(accountLoginViewModel.username.isEmpty || accountLoginViewModel.passwd.isEmpty || accountLoginViewModel.domain.isEmpty)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom)
|
||||
|
||||
Image("mountain2")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 60)
|
||||
.clipped()
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,156 +30,160 @@ struct ThirdPartySipAccountWarningFragment: View {
|
|||
var body: some View {
|
||||
NavigationView {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(.vertical) {
|
||||
VStack {
|
||||
ZStack {
|
||||
Image("mountain")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 100)
|
||||
.clipped()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
.padding(.top, -75)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
|
||||
Text("Use a SIP account")
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.top, 20)
|
||||
}
|
||||
.padding(.top, 35)
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Spacer()
|
||||
HStack(alignment: .center) {
|
||||
Image("chat-teardrop-text-slash")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
.padding(.horizontal)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Image("video-camera-slash")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 20, height: 20, alignment: .leading)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
.padding(.horizontal)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.bottom, 40)
|
||||
|
||||
Text("Some features require a Linphone account, such as group messaging, video conferences...\n\n"
|
||||
+ "These features are hidden when you register with a third party SIP account.\n\n"
|
||||
+ "To enable it in a commercial projet, please contact us. ")
|
||||
.default_text_style(styleSize: 15)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
HStack {
|
||||
Text("[linphone.org/contact](https://linphone.org/contact)")
|
||||
.tint(Color.orangeMain500)
|
||||
.default_text_style_orange_600(styleSize: 15)
|
||||
.frame(height: 35)
|
||||
}
|
||||
.padding(.horizontal, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.vertical)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
dismiss()
|
||||
}, label: {
|
||||
Text("I prefere create an account")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal)
|
||||
|
||||
NavigationLink(destination: {
|
||||
ThirdPartySipAccountLoginFragment(accountLoginViewModel: accountLoginViewModel)
|
||||
}, label: {
|
||||
Text("I understand")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, geometry.safeAreaInsets.bottom.isEqual(to: 0.0) ? 20 : 0)
|
||||
if #available(iOS 16.4, *) {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.scrollBounceBehavior(.basedOnSize)
|
||||
} else {
|
||||
ScrollView(.vertical) {
|
||||
innerScrollView(geometry: geometry)
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
|
||||
func innerScrollView(geometry: GeometryProxy) -> some View {
|
||||
VStack {
|
||||
ZStack {
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.all, 10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Text("assistant_login_third_party_sip_account")
|
||||
.default_text_style_800(styleSize: 20)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
.padding(.top, 10)
|
||||
.padding(.bottom, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Spacer()
|
||||
HStack(alignment: .center) {
|
||||
Image("chat-teardrop-text-slash")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
}
|
||||
.padding(20)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
.padding(.horizontal)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Image("video-camera-slash")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
}
|
||||
.padding(20)
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
.padding(.horizontal)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.bottom, 40)
|
||||
|
||||
Text(.init(String(format: String(localized: "assistant_third_party_sip_account_warning_explanation"), Bundle.main.displayName)))
|
||||
.default_text_style(styleSize: 15)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.bottom)
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
HStack {
|
||||
Text("[linphone.org/contact](https://linphone.org/contact)")
|
||||
.tint(Color.orangeMain500)
|
||||
.default_text_style_orange_600(styleSize: 15)
|
||||
.frame(height: 35)
|
||||
}
|
||||
.padding(.horizontal, 15)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.vertical)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
dismiss()
|
||||
}, label: {
|
||||
Text("assistant_third_party_sip_account_create_linphone_account")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.orangeMain500, lineWidth: 1)
|
||||
)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal)
|
||||
|
||||
NavigationLink(destination: {
|
||||
ThirdPartySipAccountLoginFragment(accountLoginViewModel: accountLoginViewModel)
|
||||
}, label: {
|
||||
Text("assistant_third_party_sip_account_warning_ok")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
})
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain500)
|
||||
.cornerRadius(60)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom)
|
||||
|
||||
Image("mountain2")
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: geometry.size.width, height: 60)
|
||||
.clipped()
|
||||
}
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
|
|
|||
|
|
@ -114,6 +114,10 @@ class AccountLoginViewModel: ObservableObject {
|
|||
#endif
|
||||
accountParams.pushNotificationConfig?.provider = "apns" + pushEnvironment
|
||||
|
||||
accountParams.internationalPrefix = "33"
|
||||
accountParams.internationalPrefixIsoCountryCode = "FRA"
|
||||
accountParams.useInternationalPrefixForCallsAndChats = true
|
||||
|
||||
// Now that our AccountParams is configured, we can create the Account object
|
||||
let account = try core.createAccount(params: accountParams)
|
||||
|
||||
|
|
@ -124,8 +128,10 @@ class AccountLoginViewModel: ObservableObject {
|
|||
// Also set the newly added account as default
|
||||
core.defaultAccount = account
|
||||
|
||||
self.domain = "sip.linphone.org"
|
||||
self.transportType = "TLS"
|
||||
DispatchQueue.main.async {
|
||||
self.domain = "sip.linphone.org"
|
||||
self.transportType = "TLS"
|
||||
}
|
||||
|
||||
} catch { NSLog(error.localizedDescription) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import Foundation
|
||||
import linphonesw
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable type_body_length
|
||||
|
|
@ -207,15 +208,25 @@ class RegisterViewModel: ObservableObject {
|
|||
func getDialPlansList() {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
let dialPlans = Factory.Instance.dialPlans
|
||||
var dialPlansListTmp: [DialPlan] = []
|
||||
var dialPlansLabelListTmp: [String] = []
|
||||
var dialPlansShortLabelListTmp: [String] = []
|
||||
|
||||
dialPlans.forEach { dialPlan in
|
||||
self.dialPlansList.append(dialPlan)
|
||||
self.dialPlansLabelList.append(
|
||||
dialPlansListTmp.append(dialPlan)
|
||||
dialPlansLabelListTmp.append(
|
||||
"\(dialPlan.flag) \(dialPlan.country) | +\(dialPlan.countryCallingCode)"
|
||||
)
|
||||
self.dialPlansShortLabelList.append(
|
||||
dialPlansShortLabelListTmp.append(
|
||||
"\(dialPlan.flag) +\(dialPlan.countryCallingCode)"
|
||||
)
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.dialPlansList = dialPlansListTmp
|
||||
self.dialPlansLabelList = dialPlansLabelListTmp
|
||||
self.dialPlansShortLabelList = dialPlansShortLabelListTmp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ struct CallView: View {
|
|||
@ObservedObject var contactViewModel: ContactViewModel
|
||||
@ObservedObject var editContactViewModel: EditContactViewModel
|
||||
@ObservedObject var meetingViewModel: MeetingViewModel
|
||||
@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
|
||||
@State private var addParticipantsViewModel: AddParticipantsViewModel?
|
||||
|
||||
|
|
@ -211,6 +212,7 @@ struct CallView: View {
|
|||
contactViewModel: contactViewModel,
|
||||
editContactViewModel: editContactViewModel,
|
||||
meetingViewModel: meetingViewModel,
|
||||
accountProfileViewModel: accountProfileViewModel,
|
||||
isShowConversationFragment: $isShowConversationFragment,
|
||||
isShowStartCallGroupPopup: $isShowStartCallGroupPopup,
|
||||
isShowEditContactFragment: $isShowEditContactFragment,
|
||||
|
|
@ -300,10 +302,10 @@ struct CallView: View {
|
|||
}
|
||||
|
||||
if callViewModel.isPaused {
|
||||
Text("Paused")
|
||||
Text("call_state_paused")
|
||||
.default_text_style_white_800(styleSize: 16)
|
||||
} else if telecomManager.isPausedByRemote {
|
||||
Text("Paused by remote")
|
||||
Text("call_state_paused_by_remote")
|
||||
.default_text_style_white_800(styleSize: 16)
|
||||
}
|
||||
}
|
||||
|
|
@ -532,6 +534,9 @@ struct CallView: View {
|
|||
LinphoneVideoViewHolder { view in
|
||||
coreContext.doOnCoreQueue { core in
|
||||
core.nativeVideoWindow = view
|
||||
DispatchQueue.main.async {
|
||||
CoreContext.shared.pipViewModel.setupPiPViewController(remoteView: view)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(
|
||||
|
|
@ -547,6 +552,9 @@ struct CallView: View {
|
|||
}
|
||||
.onAppear {
|
||||
if callViewModel.videoDisplayed {
|
||||
if coreContext.pipViewModel.pipController?.isPictureInPictureActive ?? false {
|
||||
coreContext.pipViewModel.pipController?.stopPictureInPicture()
|
||||
}
|
||||
callViewModel.videoDisplayed = false
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
callViewModel.videoDisplayed = true
|
||||
|
|
@ -555,6 +563,10 @@ struct CallView: View {
|
|||
}
|
||||
.onDisappear {
|
||||
if callViewModel.videoDisplayed {
|
||||
if !callViewModel.isPaused && TelecomManager.shared.callInProgress
|
||||
&& !(coreContext.pipViewModel.pipController?.isPictureInPictureActive ?? false) {
|
||||
coreContext.pipViewModel.pipController?.startPictureInPicture()
|
||||
}
|
||||
callViewModel.videoDisplayed = false
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
callViewModel.videoDisplayed = true
|
||||
|
|
@ -645,7 +657,7 @@ struct CallView: View {
|
|||
VStack {
|
||||
Spacer()
|
||||
|
||||
Text("En attente d'autres participants...")
|
||||
Text("conference_call_empty")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_300(styleSize: 25)
|
||||
|
|
@ -670,7 +682,7 @@ struct CallView: View {
|
|||
.foregroundStyle(Color.grayMain2c400)
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
Text("Partager le lien")
|
||||
Text("conference_share_link_title")
|
||||
.foregroundStyle(Color.grayMain2c400)
|
||||
.default_text_style(styleSize: 25)
|
||||
.frame(height: 40)
|
||||
|
|
@ -829,7 +841,7 @@ struct CallView: View {
|
|||
.foregroundStyle(.white)
|
||||
.frame(width: 40, height: 40)
|
||||
|
||||
Text("En pause")
|
||||
Text("conference_participant_paused_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -891,6 +903,20 @@ struct CallView: View {
|
|||
LinphoneVideoViewHolder { view in
|
||||
coreContext.doOnCoreQueue { core in
|
||||
core.nativeVideoWindow = view
|
||||
DispatchQueue.main.async {
|
||||
CoreContext.shared.pipViewModel.setupPiPViewController(remoteView: view)
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if coreContext.pipViewModel.pipController?.isPictureInPictureActive ?? false {
|
||||
coreContext.pipViewModel.pipController?.stopPictureInPicture()
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
if !callViewModel.isPaused && TelecomManager.shared.callInProgress
|
||||
&& !(coreContext.pipViewModel.pipController?.isPictureInPictureActive ?? false) {
|
||||
coreContext.pipViewModel.pipController?.startPictureInPicture()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1015,7 +1041,7 @@ struct CallView: View {
|
|||
.frame(width: 40, height: 40)
|
||||
.padding(.bottom, 5)
|
||||
|
||||
Text("Joining...")
|
||||
Text("conference_participant_joining_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1034,7 +1060,7 @@ struct CallView: View {
|
|||
.foregroundStyle(.white)
|
||||
.frame(width: 40, height: 40)
|
||||
|
||||
Text("En pause")
|
||||
Text("conference_participant_paused_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1182,7 +1208,7 @@ struct CallView: View {
|
|||
.frame(width: 40, height: 40)
|
||||
.padding(.bottom, 5)
|
||||
|
||||
Text("Joining...")
|
||||
Text("conference_participant_joining_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1201,7 +1227,7 @@ struct CallView: View {
|
|||
.foregroundStyle(.white)
|
||||
.frame(width: 40, height: 40)
|
||||
|
||||
Text("En pause")
|
||||
Text("conference_participant_paused_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1325,7 +1351,7 @@ struct CallView: View {
|
|||
.frame(width: maxValue/4, height: maxValue/4)
|
||||
.padding(.bottom, 5)
|
||||
|
||||
Text("Joining...")
|
||||
Text("conference_participant_joining_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1344,7 +1370,7 @@ struct CallView: View {
|
|||
.foregroundStyle(.white)
|
||||
.frame(width: maxValue/4, height: maxValue/4)
|
||||
|
||||
Text("En pause")
|
||||
Text("conference_participant_paused_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1441,7 +1467,7 @@ struct CallView: View {
|
|||
.frame(width: maxValue/4, height: maxValue/4)
|
||||
.padding(.bottom, 5)
|
||||
|
||||
Text("Joining...")
|
||||
Text("conference_participant_joining_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1460,7 +1486,7 @@ struct CallView: View {
|
|||
.foregroundStyle(.white)
|
||||
.frame(width: maxValue/4, height: maxValue/4)
|
||||
|
||||
Text("En pause")
|
||||
Text("conference_participant_paused_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1561,7 +1587,7 @@ struct CallView: View {
|
|||
.frame(width: maxValue/4, height: maxValue/4)
|
||||
.padding(.bottom, 5)
|
||||
|
||||
Text("Joining...")
|
||||
Text("conference_participant_joining_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1580,7 +1606,7 @@ struct CallView: View {
|
|||
.foregroundStyle(.white)
|
||||
.frame(width: maxValue/4, height: maxValue/4)
|
||||
|
||||
Text("En pause")
|
||||
Text("conference_participant_paused_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1677,7 +1703,7 @@ struct CallView: View {
|
|||
.frame(width: maxValue/4, height: maxValue/4)
|
||||
.padding(.bottom, 5)
|
||||
|
||||
Text("Joining...")
|
||||
Text("conference_participant_joining_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -1696,7 +1722,7 @@ struct CallView: View {
|
|||
.foregroundStyle(.white)
|
||||
.frame(width: maxValue/4, height: maxValue/4)
|
||||
|
||||
Text("En pause")
|
||||
Text("conference_participant_paused_text")
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.foregroundStyle(Color.white)
|
||||
.default_text_style_500(styleSize: 14)
|
||||
|
|
@ -2035,7 +2061,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text(callViewModel.callsCounter < 2 ? "Transfer" : "Attended transfer")
|
||||
Text(callViewModel.callsCounter < 2 ? "call_action_blind_transfer" : "call_action_attended_transfer")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2068,7 +2094,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("New call")
|
||||
Text("call_action_start_new_call")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2091,7 +2117,7 @@ struct CallView: View {
|
|||
.cornerRadius(40)
|
||||
.disabled(true)
|
||||
|
||||
Text("Partage d'écran")
|
||||
Text("conference_action_screen_sharing")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2116,7 +2142,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("Participants")
|
||||
Text("conference_action_show_participants")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2171,7 +2197,7 @@ struct CallView: View {
|
|||
}
|
||||
}
|
||||
|
||||
Text("Call list")
|
||||
Text("call_action_go_to_calls_list")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2201,7 +2227,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("Dialer")
|
||||
Text("call_action_show_dialer")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2224,7 +2250,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("Disposition")
|
||||
Text("call_action_change_layout")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2236,16 +2262,14 @@ struct CallView: View {
|
|||
HStack(spacing: 0) {
|
||||
VStack {
|
||||
Button {
|
||||
if callViewModel.isOneOneCall && callViewModel.remoteAddress != nil {
|
||||
callViewModel.createOneToOneChatRoomWith(remote: callViewModel.remoteAddress!)
|
||||
}
|
||||
callViewModel.createConversation()
|
||||
} label: {
|
||||
HStack {
|
||||
if !callViewModel.operationInProgress {
|
||||
Image("chat-teardrop-text")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(callViewModel.isOneOneCall ? .white : Color.gray500)
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: 32, height: 32)
|
||||
} else {
|
||||
ProgressView()
|
||||
|
|
@ -2253,8 +2277,13 @@ struct CallView: View {
|
|||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
.frame(width: 32, height: 32, alignment: .center)
|
||||
.onDisappear {
|
||||
if callViewModel.isOneOneCall && callViewModel.displayedConversation != nil {
|
||||
conversationViewModel.changeDisplayedChatRoom(conversationModel: callViewModel.displayedConversation!)
|
||||
if callViewModel.displayedConversation != nil {
|
||||
indexPage = 2
|
||||
self.conversationViewModel.changeDisplayedChatRoom(conversationModel: callViewModel.displayedConversation!)
|
||||
callViewModel.displayedConversation = nil
|
||||
withAnimation {
|
||||
telecomManager.callDisplayed = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2262,11 +2291,10 @@ struct CallView: View {
|
|||
}
|
||||
.buttonStyle(PressedButtonStyle(buttonSize: buttonSize))
|
||||
.frame(width: buttonSize, height: buttonSize)
|
||||
.background(callViewModel.isOneOneCall ? Color.gray500 : .white)
|
||||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
.disabled(!callViewModel.isOneOneCall)
|
||||
|
||||
Text("Messages")
|
||||
Text("call_action_show_messages")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2290,7 +2318,7 @@ struct CallView: View {
|
|||
.cornerRadius(40)
|
||||
.disabled(telecomManager.isPausedByRemote)
|
||||
|
||||
Text("Pause")
|
||||
Text("call_action_pause_call")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2315,7 +2343,7 @@ struct CallView: View {
|
|||
.cornerRadius(40)
|
||||
.disabled(callViewModel.isPaused || telecomManager.isPausedByRemote)
|
||||
|
||||
Text("Record")
|
||||
Text("call_action_record_call")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2338,7 +2366,7 @@ struct CallView: View {
|
|||
.cornerRadius(40)
|
||||
.disabled(true)
|
||||
|
||||
Text("Record")
|
||||
Text("call_action_record_call")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2361,7 +2389,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("Disposition")
|
||||
Text("call_action_change_layout")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2404,7 +2432,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text(callViewModel.callsCounter < 2 ? "Transfer" : "Attended transfer")
|
||||
Text(callViewModel.callsCounter < 2 ? "call_action_blind_transfer" : "call_action_attended_transfer")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2437,7 +2465,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("New call")
|
||||
Text("call_action_start_new_call")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2461,7 +2489,7 @@ struct CallView: View {
|
|||
.cornerRadius(40)
|
||||
.disabled(true)
|
||||
|
||||
Text("Partage d'écran")
|
||||
Text("conference_action_screen_sharing")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2487,7 +2515,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("Participants")
|
||||
Text("conference_action_show_participants")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2543,7 +2571,7 @@ struct CallView: View {
|
|||
}
|
||||
}
|
||||
|
||||
Text("Call list")
|
||||
Text("call_action_go_to_calls_list")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2573,7 +2601,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("Dialer")
|
||||
Text("call_action_show_dialer")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2596,7 +2624,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("Disposition")
|
||||
Text("call_action_change_layout")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2605,16 +2633,14 @@ struct CallView: View {
|
|||
|
||||
VStack {
|
||||
Button {
|
||||
if callViewModel.isOneOneCall && callViewModel.remoteAddress != nil {
|
||||
callViewModel.createOneToOneChatRoomWith(remote: callViewModel.remoteAddress!)
|
||||
}
|
||||
callViewModel.createConversation()
|
||||
} label: {
|
||||
HStack {
|
||||
if !callViewModel.operationInProgress {
|
||||
Image("chat-teardrop-text")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(callViewModel.isOneOneCall ? .white : Color.gray500)
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: 32, height: 32)
|
||||
} else {
|
||||
ProgressView()
|
||||
|
|
@ -2622,7 +2648,7 @@ struct CallView: View {
|
|||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
.frame(width: 32, height: 32, alignment: .center)
|
||||
.onDisappear {
|
||||
if callViewModel.isOneOneCall && callViewModel.displayedConversation != nil {
|
||||
if callViewModel.displayedConversation != nil {
|
||||
conversationViewModel.changeDisplayedChatRoom(conversationModel: callViewModel.displayedConversation!)
|
||||
}
|
||||
}
|
||||
|
|
@ -2631,11 +2657,10 @@ struct CallView: View {
|
|||
}
|
||||
.buttonStyle(PressedButtonStyle(buttonSize: buttonSize))
|
||||
.frame(width: buttonSize, height: buttonSize)
|
||||
.background(callViewModel.isOneOneCall ? Color.gray500 : .white)
|
||||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
.disabled(!callViewModel.isOneOneCall)
|
||||
|
||||
Text("Messages")
|
||||
Text("call_action_show_messages")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2659,7 +2684,7 @@ struct CallView: View {
|
|||
.cornerRadius(40)
|
||||
.disabled(telecomManager.isPausedByRemote)
|
||||
|
||||
Text("Pause")
|
||||
Text("call_action_pause_call")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2684,7 +2709,7 @@ struct CallView: View {
|
|||
.cornerRadius(40)
|
||||
.disabled(callViewModel.isPaused || telecomManager.isPausedByRemote)
|
||||
|
||||
Text("Record")
|
||||
Text("call_action_record_call")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2707,7 +2732,7 @@ struct CallView: View {
|
|||
.cornerRadius(40)
|
||||
.disabled(true)
|
||||
|
||||
Text("Record")
|
||||
Text("call_action_record_call")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2842,6 +2867,7 @@ struct PressedButtonStyle: ButtonStyle {
|
|||
contactViewModel: ContactViewModel(),
|
||||
editContactViewModel: EditContactViewModel(),
|
||||
meetingViewModel: MeetingViewModel(),
|
||||
accountProfileViewModel: AccountProfileViewModel(),
|
||||
fullscreenVideo: .constant(false),
|
||||
isShowStartCallFragment: .constant(false),
|
||||
isShowConversationFragment: .constant(false),
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ struct AudioRouteBottomSheet: View {
|
|||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
|
||||
Text(!callViewModel.isHeadPhoneAvailable() ? "Earpiece" : "Headphones")
|
||||
Text(!callViewModel.isHeadPhoneAvailable() ? "call_audio_device_type_earpiece" : "call_audio_device_type_headphones")
|
||||
.default_text_style_white(styleSize: 15)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -87,7 +87,7 @@ struct AudioRouteBottomSheet: View {
|
|||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
|
||||
Text("Speaker")
|
||||
Text("call_audio_device_type_speaker")
|
||||
.default_text_style_white(styleSize: 15)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -121,7 +121,8 @@ struct AudioRouteBottomSheet: View {
|
|||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
|
||||
Text("Bluetooth")
|
||||
Text(String(format: String(localized: "call_audio_device_type_bluetooth"),
|
||||
AVAudioSession.sharedInstance().currentRoute.outputs.first?.portName ?? ""))
|
||||
.default_text_style_white(styleSize: 15)
|
||||
|
||||
Spacer()
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ struct CallStatisticsSheetBottomSheet: View {
|
|||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Close") {
|
||||
Button("dialog_close") {
|
||||
callStatisticsSheet = false
|
||||
dismiss()
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ struct CallStatisticsSheetBottomSheet: View {
|
|||
.padding(15)
|
||||
}
|
||||
|
||||
Text("Audio")
|
||||
Text("call_stats_audio_title")
|
||||
.default_text_style_white_600(styleSize: 15)
|
||||
.padding(.top, 10)
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ struct CallStatisticsSheetBottomSheet: View {
|
|||
Spacer()
|
||||
|
||||
if callViewModel.callStatsModel.isVideoEnabled {
|
||||
Text("Vidéo")
|
||||
Text("call_stats_video_title")
|
||||
.default_text_style_white_600(styleSize: 15)
|
||||
.padding(.top, 10)
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct CallsListFragment: View {
|
|||
}
|
||||
}
|
||||
|
||||
Text("Call list")
|
||||
Text("calls_list_title")
|
||||
.multilineTextAlignment(.leading)
|
||||
.default_text_style_orange_800(styleSize: 16)
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ struct CallsListFragment: View {
|
|||
PopupView(isShowPopup: $isShowPopup,
|
||||
title: Text("calls_list_dialog_merge_into_conference_title"),
|
||||
content: nil,
|
||||
titleFirstButton: Text("Cancel"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {self.isShowPopup.toggle()},
|
||||
titleSecondButton: Text("calls_list_dialog_merge_into_conference_label"),
|
||||
actionSecondButton: {
|
||||
|
|
@ -171,7 +171,7 @@ struct CallsListFragment: View {
|
|||
HStack {
|
||||
Image((callViewModel.selectedCall!.state == .PausedByRemote
|
||||
|| callViewModel.selectedCall!.state == .Pausing
|
||||
|| callViewModel.selectedCall!.state == .Paused) ? "play" : "pause")
|
||||
|| callViewModel.selectedCall!.state == .Paused) ? String(localized: "call_action_resume_call") : String(localized: "call_action_pause_call"))
|
||||
.resizable()
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ struct CallsListFragment: View {
|
|||
|
||||
Text((callViewModel.selectedCall!.state == .PausedByRemote
|
||||
|| callViewModel.selectedCall!.state == .Pausing
|
||||
|| callViewModel.selectedCall!.state == .Paused) ? "Resume" : "Pause")
|
||||
|| callViewModel.selectedCall!.state == .Paused) ? "call_action_resume_call" : "call_action_pause_call")
|
||||
.default_text_style(styleSize: 15)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -217,7 +217,7 @@ struct CallsListFragment: View {
|
|||
.background(Color.redDanger500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("Hang up call")
|
||||
Text("call_action_hang_up")
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style_white(styleSize: 15)
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ struct CallsListFragment: View {
|
|||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
} else {
|
||||
Text(callViewModel.calls[index].callLog!.conferenceInfo!.subject ?? "Conference Name error")
|
||||
Text(callViewModel.calls[index].callLog!.conferenceInfo!.subject ?? String(localized: "conference_name_error"))
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
|
|
@ -284,7 +284,7 @@ struct CallsListFragment: View {
|
|||
|| callViewModel.calls[index].state == .Pausing
|
||||
|| callViewModel.calls[index].state == .Paused
|
||||
|| callViewModel.calls[index].state == .Resuming {
|
||||
Text(callViewModel.calls[index].state == .Resuming ? "Resuming" : "Paused")
|
||||
Text(callViewModel.calls[index].state == .Resuming ? String(localized: "call_state_resuming") : String(localized: "call_state_paused"))
|
||||
.default_text_style_300(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
.lineLimit(1)
|
||||
|
|
@ -294,7 +294,7 @@ struct CallsListFragment: View {
|
|||
.resizable()
|
||||
.frame(width: 25, height: 25)
|
||||
} else {
|
||||
Text("Active")
|
||||
Text("call_state_connected")
|
||||
.default_text_style_300(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
.lineLimit(1)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ struct ChangeLayoutBottomSheet: View {
|
|||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
|
||||
Text("Mosaïque")
|
||||
Text("conference_layout_grid")
|
||||
.foregroundStyle(callViewModel.participantList.count > 5 ? Color.gray500 : .white)
|
||||
.default_text_style_white(styleSize: 15)
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ struct ChangeLayoutBottomSheet: View {
|
|||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
|
||||
Text("Participant actif")
|
||||
Text("conference_layout_active_speaker")
|
||||
.default_text_style_white(styleSize: 15)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -109,7 +109,7 @@ struct ChangeLayoutBottomSheet: View {
|
|||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
|
||||
Text("Audio seulement")
|
||||
Text("conference_layout_audio_only")
|
||||
.default_text_style_white(styleSize: 15)
|
||||
|
||||
Spacer()
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ struct MediaEncryptedSheetBottomSheet: View {
|
|||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Close") {
|
||||
Button("dialog_close") {
|
||||
mediaEncryptedSheet = false
|
||||
dismiss()
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ struct MediaEncryptedSheetBottomSheet: View {
|
|||
.padding(15)
|
||||
}
|
||||
|
||||
Text("Chiffrement du média")
|
||||
Text("call_stats_media_encryption_title")
|
||||
.default_text_style_white_600(styleSize: 15)
|
||||
.padding(.top, 10)
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ struct MediaEncryptedSheetBottomSheet: View {
|
|||
mediaEncryptedSheet = false
|
||||
dismiss()
|
||||
}, label: {
|
||||
Text("Faire la validation à nouveau")
|
||||
Text("call_do_zrtp_sas_validation_again")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
|
|||
|
|
@ -107,13 +107,13 @@ struct ParticipantsListFragment: View {
|
|||
.background(.white)
|
||||
|
||||
if self.isShowPopup {
|
||||
let contentPopup = Text("Etes-vous sûr de vouloir supprimer \(callViewModel.participantList[indexToRemove].name) ?")
|
||||
let contentPopup = Text(String(format: String(localized: "meeting_call_remove_participant_confirmation_message"), callViewModel.participantList[indexToRemove].name))
|
||||
PopupView(isShowPopup: $isShowPopup,
|
||||
title: Text("Supprimer un participant"),
|
||||
title: Text("meeting_call_remove_participant_confirmation_title"),
|
||||
content: contentPopup,
|
||||
titleFirstButton: Text("Non"),
|
||||
titleFirstButton: Text("dialog_no"),
|
||||
actionFirstButton: {self.isShowPopup.toggle()},
|
||||
titleSecondButton: Text("Oui"),
|
||||
titleSecondButton: Text("dialog_yes"),
|
||||
actionSecondButton: {
|
||||
callViewModel.removeParticipant(index: indexToRemove)
|
||||
self.isShowPopup.toggle()
|
||||
|
|
@ -158,7 +158,7 @@ struct ParticipantsListFragment: View {
|
|||
Spacer()
|
||||
|
||||
if callViewModel.myParticipantModel!.isAdmin {
|
||||
Text("Administrateur")
|
||||
Text("conversation_info_participant_is_admin_label")
|
||||
.foregroundStyle(Color.grayMain2c300)
|
||||
.default_text_style(styleSize: 12)
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
|
|
@ -202,7 +202,7 @@ struct ParticipantsListFragment: View {
|
|||
Spacer()
|
||||
|
||||
if callViewModel.participantList[index].isAdmin {
|
||||
Text("Administrateur")
|
||||
Text("conversation_info_participant_is_admin_label")
|
||||
.foregroundStyle(Color.grayMain2c300)
|
||||
.default_text_style(styleSize: 12)
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
|
|
@ -250,7 +250,7 @@ struct ParticipantsListFragment: View {
|
|||
.scaledToFit()
|
||||
.clipped()
|
||||
.padding(.all)
|
||||
Text("No participant for the moment...")
|
||||
Text("meeting_call_remove_no_participants")
|
||||
.default_text_style_800(styleSize: 16)
|
||||
Spacer()
|
||||
Spacer()
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ struct MeetingWaitingRoomFragment: View {
|
|||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
|
||||
Text(!meetingWaitingRoomViewModel.isHeadPhoneAvailable() ? "Earpiece" : "Headphones")
|
||||
Text(!meetingWaitingRoomViewModel.isHeadPhoneAvailable() ? "call_audio_device_type_earpiece" : "call_audio_device_type_headphones")
|
||||
.default_text_style_white(styleSize: 15)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -536,7 +536,8 @@ struct MeetingWaitingRoomFragment: View {
|
|||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
|
||||
Text("Bluetooth")
|
||||
Text(String(format: String(localized: "call_audio_device_type_bluetooth"),
|
||||
AVAudioSession.sharedInstance().currentRoute.outputs.first?.portName ?? ""))
|
||||
.default_text_style_white(styleSize: 15)
|
||||
|
||||
Spacer()
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import Foundation
|
||||
import linphonesw
|
||||
import SwiftUI
|
||||
|
||||
class CallMediaEncryptionModel: ObservableObject {
|
||||
var coreContext = CoreContext.shared
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import Foundation
|
||||
import linphonesw
|
||||
import SwiftUI
|
||||
|
||||
class SentVideoWindow: ObservableObject {
|
||||
var widthFactor: CGFloat = 1
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import Foundation
|
||||
import linphonesw
|
||||
import SwiftUI
|
||||
|
||||
class ParticipantModel: ObservableObject {
|
||||
|
||||
|
|
@ -53,7 +54,13 @@ class ParticipantModel: ObservableObject {
|
|||
if let addressFriend = friendResult {
|
||||
self.name = addressFriend.name!
|
||||
} else {
|
||||
self.name = address.displayName != nil ? address.displayName! : address.username!
|
||||
if address.displayName != nil {
|
||||
self.name = address.displayName!
|
||||
} else if address.username != nil {
|
||||
self.name = address.username!
|
||||
} else {
|
||||
self.name = String(address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import SwiftUI
|
|||
import linphonesw
|
||||
import AVFAudio
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable type_body_length
|
||||
|
|
@ -95,6 +96,9 @@ class CallViewModel: ObservableObject {
|
|||
} catch _ {
|
||||
|
||||
}
|
||||
NotificationCenter.default.addObserver(forName: Notification.Name("CallViewModelReset"), object: nil, queue: nil) { notification in
|
||||
self.resetCallView()
|
||||
}
|
||||
}
|
||||
|
||||
func resetCallView() {
|
||||
|
|
@ -170,6 +174,8 @@ class CallViewModel: ObservableObject {
|
|||
displayNameTmp = self.currentCall!.remoteAddress!.displayName!
|
||||
} else if self.currentCall!.remoteAddress!.username != nil && displayNameTmp.isEmpty {
|
||||
displayNameTmp = self.currentCall!.remoteAddress!.username!
|
||||
} else if displayNameTmp.isEmpty {
|
||||
displayNameTmp = String(self.currentCall!.remoteAddress!.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -351,6 +357,8 @@ class CallViewModel: ObservableObject {
|
|||
activeSpeakerNameTmp = activeSpeakerParticipantTmp!.address.displayName!
|
||||
} else if activeSpeakerParticipantTmp!.address.username != nil {
|
||||
activeSpeakerNameTmp = activeSpeakerParticipantTmp!.address.username!
|
||||
} else {
|
||||
activeSpeakerNameTmp = String(activeSpeakerParticipantTmp!.address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -467,7 +475,9 @@ class CallViewModel: ObservableObject {
|
|||
activeSpeakerNameTmp = activeSpeakerParticipantTmp!.address.displayName!
|
||||
} else if activeSpeakerParticipantTmp!.address.username != nil {
|
||||
activeSpeakerNameTmp = activeSpeakerParticipantTmp!.address.username!
|
||||
}
|
||||
} else {
|
||||
activeSpeakerNameTmp = String(activeSpeakerParticipantTmp!.address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
if self.activeSpeakerParticipant == nil {
|
||||
|
|
@ -574,15 +584,15 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
})
|
||||
}, onActiveSpeakerParticipantDevice: { (conference: Conference, participantDevice: ParticipantDevice) in
|
||||
if participantDevice.address != nil {
|
||||
}, onActiveSpeakerParticipantDevice: { (conference: Conference, participantDevice: ParticipantDevice?) in
|
||||
if participantDevice != nil && participantDevice!.address != nil {
|
||||
let activeSpeakerParticipantBis = self.activeSpeakerParticipant
|
||||
|
||||
let activeSpeakerParticipantTmp = ParticipantModel(
|
||||
address: participantDevice.address!,
|
||||
address: participantDevice!.address!,
|
||||
isJoining: false,
|
||||
onPause: participantDevice.state == .OnHold,
|
||||
isMuted: participantDevice.isMuted
|
||||
onPause: participantDevice!.state == .OnHold,
|
||||
isMuted: participantDevice!.isMuted
|
||||
)
|
||||
|
||||
var activeSpeakerNameTmp = ""
|
||||
|
|
@ -594,6 +604,8 @@ class CallViewModel: ObservableObject {
|
|||
activeSpeakerNameTmp = activeSpeakerParticipantTmp.address.displayName!
|
||||
} else if activeSpeakerParticipantTmp.address.username != nil {
|
||||
activeSpeakerNameTmp = activeSpeakerParticipantTmp.address.username!
|
||||
} else {
|
||||
activeSpeakerNameTmp = String(activeSpeakerParticipantTmp.address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1154,141 +1166,179 @@ class CallViewModel: ObservableObject {
|
|||
Log.info("\(CallViewModel.TAG) \(list.count) participants added to conference")
|
||||
}
|
||||
|
||||
func createOneToOneChatRoomWith(remote: Address) {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
let account = core.defaultAccount
|
||||
if account == nil {
|
||||
Log.error(
|
||||
"\(StartConversationViewModel.TAG) No default account found, can't create conversation with \(remote.asStringUriOnly())!"
|
||||
)
|
||||
return
|
||||
func createConversation() {
|
||||
if currentCall != nil {
|
||||
self.operationInProgress = true
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
let existingConversation = self.lookupCurrentCallConversation(call: self.currentCall!)
|
||||
if existingConversation != nil {
|
||||
Log.info("\(CallViewModel.TAG) Found existing conversation \(LinphoneUtils.getConversationId(chatRoom: existingConversation!)), going to it")
|
||||
|
||||
let model = ConversationModel(chatRoom: existingConversation!)
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
Log.info("\(CallViewModel.TAG) No existing conversation was found, let's create it")
|
||||
self.createCurrentCallConversation(call: self.currentCall!)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func lookupCurrentCallConversation(call: Call) -> ChatRoom? {
|
||||
let localAddress = call.callLog?.localAddress
|
||||
let remoteAddress = call.remoteAddress
|
||||
|
||||
let params: ConferenceParams? = nil
|
||||
let existingConversation: ChatRoom?
|
||||
if call.conference != nil {
|
||||
existingConversation = call.core?.searchChatRoom(
|
||||
params: params,
|
||||
localAddr: localAddress,
|
||||
remoteAddr: remoteAddress,
|
||||
participants: []
|
||||
)
|
||||
} else {
|
||||
let participants = [remoteAddress!]
|
||||
existingConversation = call.core?.searchChatRoom(
|
||||
params: params,
|
||||
localAddr: localAddress,
|
||||
remoteAddr: nil,
|
||||
participants: participants
|
||||
)
|
||||
}
|
||||
|
||||
if existingConversation != nil {
|
||||
Log.info("\(CallViewModel.TAG) Found existing conversation \(existingConversation!.peerAddress?.asStringUriOnly() ?? "") found for current call with local address \(localAddress?.asStringUriOnly() ?? "") and remote address \(remoteAddress?.asStringUriOnly() ?? "")")
|
||||
} else {
|
||||
Log.warn("\(CallViewModel.TAG) No existing conversation found for current call with local address \(localAddress?.asStringUriOnly() ?? "") and remote address \(remoteAddress?.asStringUriOnly() ?? "")")
|
||||
}
|
||||
|
||||
return existingConversation
|
||||
}
|
||||
|
||||
func createCurrentCallConversation(call: Call) {
|
||||
if let remoteAddress = call.remoteAddress {
|
||||
let participants = [remoteAddress]
|
||||
let core = call.core
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
do {
|
||||
let params: ChatRoomParams = try core.createDefaultChatRoomParams()
|
||||
params.groupEnabled = false
|
||||
params.subject = "Dummy subject"
|
||||
params.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
let sameDomain = remote.domain == account?.params?.domain ?? ""
|
||||
if StartConversationViewModel.isEndToEndEncryptionMandatory() && sameDomain {
|
||||
Log.info("\(StartConversationViewModel.TAG) Account is in secure mode & domain matches, creating a E2E conversation")
|
||||
params.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.encryptionEnabled = true
|
||||
} else if !StartConversationViewModel.isEndToEndEncryptionMandatory() {
|
||||
if LinphoneUtils.isEndToEndEncryptedChatAvailable(core: core) {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) Account is in interop mode but LIME is available, creating a E2E conversation"
|
||||
)
|
||||
params.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.encryptionEnabled = true
|
||||
} else {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) Account is in interop mode but LIME isn't available, creating a SIP simple conversation"
|
||||
)
|
||||
params.backend = ChatRoom.Backend.Basic
|
||||
params.encryptionEnabled = false
|
||||
if let params = getChatRoomParams(call: call) {
|
||||
do {
|
||||
if core != nil {
|
||||
let chatRoom = try core!.createChatRoom(params: params, participants: participants)
|
||||
if params.chatParams?.backend == ChatRoom.Backend.FlexisipChat {
|
||||
if chatRoom.state == ChatRoom.State.Created {
|
||||
let chatRoomId = LinphoneUtils.getConversationId(chatRoom: chatRoom)
|
||||
Log.info("\(CallViewModel.TAG) 1-1 conversation \(chatRoomId) has been created")
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
Log.info("\(CallViewModel.TAG) Conversation isn't in Created state yet, wait for it")
|
||||
self.chatRoomAddDelegate(core: core!, chatRoom: chatRoom)
|
||||
}
|
||||
} else {
|
||||
let id = LinphoneUtils.getConversationId(chatRoom: chatRoom)
|
||||
Log.info("\(CallViewModel.TAG) Conversation successfully created \(id)")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} catch {
|
||||
Log.error(
|
||||
"\(StartConversationViewModel.TAG) Account is in secure mode, can't chat with SIP address of different domain \(remote.asStringUriOnly())"
|
||||
"\(CallViewModel.TAG) Failed to create 1-1 conversation with \(remoteAddress.asStringUriOnly())"
|
||||
)
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_invalid_participant_error"
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getChatRoomParams(call: Call) -> ConferenceParams? {
|
||||
let localAddress = call.callLog?.localAddress
|
||||
let remoteAddress = call.remoteAddress
|
||||
let core = call.core
|
||||
if let account = LinphoneUtils.getAccountForAddress(address: localAddress!) ?? LinphoneUtils.getDefaultAccount() {
|
||||
do {
|
||||
let params = try coreContext.mCore.createConferenceParams(conference: call.conference)
|
||||
params.chatEnabled = true
|
||||
params.groupEnabled = false
|
||||
params.subject = NSLocalizedString("conversation_one_to_one_hidden_subject", comment: "")
|
||||
params.account = account
|
||||
|
||||
let participants = [remote]
|
||||
let localAddress = account?.params?.identityAddress
|
||||
let existingChatRoom = core.searchChatRoom(params: params, localAddr: localAddress, remoteAddr: nil, participants: participants)
|
||||
if existingChatRoom == nil {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) No existing 1-1 conversation between local account "
|
||||
+ "\(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) was found for given parameters, let's create it"
|
||||
)
|
||||
let chatRoom = try core.createChatRoom(params: params, localAddr: localAddress, participants: participants)
|
||||
if params.backend == ChatRoom.Backend.FlexisipChat {
|
||||
if chatRoom.state == ChatRoom.State.Created {
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) 1-1 conversation \(id) has been created")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation isn't in Created state yet, wait for it")
|
||||
self.chatRoomAddDelegate(core: core, chatRoom: chatRoom)
|
||||
}
|
||||
} else {
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation successfully created \(id)")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.warn(
|
||||
"\(StartConversationViewModel.TAG) A 1-1 conversation between local account \(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) for given parameters already exists!"
|
||||
)
|
||||
if let chatParams = params.chatParams {
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
let model = ConversationModel(chatRoom: existingChatRoom!)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
let sameDomain = remoteAddress?.domain == CorePreferences.defaultDomain && remoteAddress?.domain == account.params?.domain
|
||||
if account.params != nil && (account.params!.instantMessagingEncryptionMandatory && sameDomain) {
|
||||
Log.info(
|
||||
"\(CallViewModel.TAG) Account is in secure mode & domain matches, requesting E2E encryption"
|
||||
)
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
} else if account.params != nil && !account.params!.instantMessagingEncryptionMandatory {
|
||||
if core != nil && LinphoneUtils.isEndToEndEncryptedChatAvailable(core: core!) {
|
||||
Log.info(
|
||||
"\(CallViewModel.TAG) Account is in interop mode but LIME is available, requesting E2E encryption"
|
||||
)
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
} else {
|
||||
Log.info(
|
||||
"\(CallViewModel.TAG) Account is in interop mode but LIME isn't available, disabling E2E encryption"
|
||||
)
|
||||
chatParams.backend = ChatRoom.Backend.Basic
|
||||
params.securityLevel = Conference.SecurityLevel.None
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
Log.error(
|
||||
"\(CallViewModel.TAG) Account is in secure mode, can't chat with SIP address of different domain \(remoteAddress?.asStringUriOnly() ?? "")"
|
||||
)
|
||||
return nil
|
||||
}
|
||||
return params
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
} catch {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
Log.error("\(StartConversationViewModel.TAG) Failed to create 1-1 conversation with \(remote.asStringUriOnly())!")
|
||||
Log.error("\(CallViewModel.TAG) Can't create ConferenceParams \(remoteAddress?.asStringUriOnly() ?? "")")
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func goToConversation(model: ConversationModel) {
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1323,13 +1373,13 @@ class CallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
} else if state == ChatRoom.State.CreationFailed {
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ class MeetingWaitingRoomViewModel: ObservableObject {
|
|||
userNameTmp = core.defaultAccount!.contactAddress!.displayName!
|
||||
} else if core.defaultAccount!.contactAddress!.username != nil {
|
||||
userNameTmp = core.defaultAccount!.contactAddress!.username!
|
||||
} else {
|
||||
userNameTmp = String(core.defaultAccount!.contactAddress!.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
133
Linphone/UI/Call/ViewModel/PIPViewModel.swift
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2025 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import linphonesw
|
||||
import SwiftUI
|
||||
import AVKit
|
||||
|
||||
class PIPViewModel: NSObject, AVPictureInPictureControllerDelegate {
|
||||
static let TAG = "[PIPViewModel]"
|
||||
|
||||
var pipController: AVPictureInPictureController?
|
||||
var pipVideoCallViewController: PictureInPictureVideoCallViewController?
|
||||
var pipRemoteVideoView = SampleBufferVideoCallView()
|
||||
var videoCallView = UIView()
|
||||
|
||||
var callStateChangedDelegate: CallDelegate?
|
||||
|
||||
func setupPiPViewController(remoteView: UIView) {
|
||||
Log.info("\(PIPViewModel.TAG) Setup PiPViewController")
|
||||
videoCallView = remoteView
|
||||
self.pipVideoCallViewController = PictureInPictureVideoCallViewController()
|
||||
pipRemoteVideoView = pipVideoCallViewController!.pipRemoteVideoView
|
||||
let pipContentSource = AVPictureInPictureController.ContentSource(
|
||||
activeVideoCallSourceView: videoCallView,
|
||||
contentViewController: pipVideoCallViewController!)
|
||||
pipController = AVPictureInPictureController(contentSource: pipContentSource)
|
||||
pipController?.delegate = self
|
||||
pipController?.canStartPictureInPictureAutomaticallyFromInline = true
|
||||
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
if let call = core.currentCall {
|
||||
self.callStateChangedDelegate = CallDelegateStub(onStateChanged: { (call: Call, cstate: Call.State, _: String) in
|
||||
if CoreContext.shared.pipViewModel.pipController?.isPictureInPictureActive ?? false {
|
||||
if cstate == .End || cstate == .Error {
|
||||
Log.info("\(PIPViewModel.TAG) call state 'End' or 'Error' detected, stopping picture in picture")
|
||||
CoreContext.shared.pipViewModel.pipController?.stopPictureInPicture()
|
||||
self.callStateChangedDelegate = nil
|
||||
}
|
||||
}
|
||||
})
|
||||
call.addDelegate(delegate: self.callStateChangedDelegate!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func pictureInPictureControllerWillStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
|
||||
Log.info("\(PIPViewModel.TAG) pictureInPictureControllerWillStartPictureInPicture")
|
||||
self.pipVideoCallViewController?.matchVideoDimension()
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
core.nativeVideoWindow = self.pipRemoteVideoView
|
||||
}
|
||||
}
|
||||
|
||||
func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
|
||||
Log.info("\(PIPViewModel.TAG) pictureInPictureControllerDidStopPictureInPicture")
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
core.nativeVideoWindow = self.videoCallView
|
||||
}
|
||||
}
|
||||
|
||||
func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, failedToStartPictureInPictureWithError error: Error) {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
core.nativeVideoWindow = self.videoCallView
|
||||
}
|
||||
Log.error("\(PIPViewModel.TAG) failedToStartPictureInPictureWithError : \(error)")
|
||||
}
|
||||
|
||||
func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void) {
|
||||
Log.info("\(PIPViewModel.TAG) restoreUserInterfaceForPictureInPictureStopWithCompletionHandler")
|
||||
TelecomManager.shared.callDisplayed = true
|
||||
completionHandler(true)
|
||||
}
|
||||
}
|
||||
|
||||
class PictureInPictureVideoCallViewController: AVPictureInPictureVideoCallViewController {
|
||||
|
||||
var pipRemoteVideoView = SampleBufferVideoCallView()
|
||||
var pipWidth: Double = 720
|
||||
var pipHeight: Double = 480
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = .black
|
||||
view.clipsToBounds = true
|
||||
view.addSubview(pipRemoteVideoView)
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
view.layer.cornerRadius = 0
|
||||
}
|
||||
|
||||
override func viewDidLayoutSubviews() {
|
||||
super.viewDidLayoutSubviews()
|
||||
self.matchVideoDimension()
|
||||
}
|
||||
|
||||
func matchVideoDimension() {
|
||||
Log.info("\(PIPViewModel.TAG) - PIPViewController - matchVideoDimension to \(pipWidth)x\(pipHeight)")
|
||||
self.preferredContentSize = CGSize(width: pipWidth, height: pipHeight)
|
||||
pipRemoteVideoView.frame = view.bounds
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable force_cast
|
||||
class SampleBufferVideoCallView: UIView {
|
||||
override class var layerClass: AnyClass {
|
||||
AVSampleBufferDisplayLayer.self
|
||||
}
|
||||
|
||||
var sampleBufferDisplayLayer: AVSampleBufferDisplayLayer {
|
||||
layer as! AVSampleBufferDisplayLayer
|
||||
}
|
||||
}
|
||||
// swiftlint:enable force_cast
|
||||
|
|
@ -121,11 +121,11 @@ struct ContactInnerActionsFragment: View {
|
|||
VStack {
|
||||
if contactAvatarModel.friend!.phoneNumbersWithLabel[index].label != nil
|
||||
&& !contactAvatarModel.friend!.phoneNumbersWithLabel[index].label!.isEmpty {
|
||||
Text("Phone (\(contactAvatarModel.friend!.phoneNumbersWithLabel[index].label!)) :")
|
||||
Text(String(localized: "phone_number") + " \(contactAvatarModel.friend!.phoneNumbersWithLabel[index].label!)) :")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
} else {
|
||||
Text("Phone :")
|
||||
Text(String(localized: "phone_number") + " :")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ struct ContactInnerActionsFragment: View {
|
|||
VStack {
|
||||
if contactAvatarModel.friend!.organization != nil
|
||||
&& !contactAvatarModel.friend!.organization!.isEmpty {
|
||||
Text("**Company :** \(contactAvatarModel.friend!.organization!)")
|
||||
Text(.init(String(format:"**%@ :** %@", String(localized: "contact_editor_company"), contactAvatarModel.friend!.organization!)))
|
||||
.default_text_style(styleSize: 14)
|
||||
.padding(.vertical, 15)
|
||||
.padding(.horizontal, 20)
|
||||
|
|
@ -179,7 +179,7 @@ struct ContactInnerActionsFragment: View {
|
|||
|
||||
if contactAvatarModel.friend!.jobTitle != nil
|
||||
&& !contactAvatarModel.friend!.jobTitle!.isEmpty {
|
||||
Text("**Job :** \(contactAvatarModel.friend!.jobTitle!)")
|
||||
Text(.init(String(format:"**%@ :** %@", String(localized: "contact_editor_job_title"), contactAvatarModel.friend!.jobTitle!)))
|
||||
.default_text_style(styleSize: 14)
|
||||
.padding(.top,
|
||||
contactAvatarModel.friend!.organization != nil
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ struct ContactInnerFragment: View {
|
|||
}
|
||||
|
||||
Spacer()
|
||||
if contactViewModel.indexDisplayedFriend != nil && contactViewModel.indexDisplayedFriend! < contactsManager.lastSearch.count
|
||||
&& !contactAvatarModel.nativeUri.isEmpty {
|
||||
|
||||
if !contactAvatarModel.nativeUri.isEmpty {
|
||||
Button(action: {
|
||||
editNativeContact()
|
||||
}, label: {
|
||||
|
|
@ -118,17 +118,9 @@ struct ContactInnerFragment: View {
|
|||
VStack(spacing: 0) {
|
||||
VStack(spacing: 0) {
|
||||
VStack(spacing: 0) {
|
||||
if contactViewModel.indexDisplayedFriend != nil && contactViewModel.indexDisplayedFriend! < contactsManager.lastSearch.count {
|
||||
if contactViewModel.indexDisplayedFriend != nil {
|
||||
Avatar(contactAvatarModel: contactAvatarModel, avatarSize: 100)
|
||||
} else if contactViewModel.indexDisplayedFriend != nil
|
||||
&& contactViewModel.indexDisplayedFriend! < contactsManager.lastSearch.count {
|
||||
Image("profil-picture-default")
|
||||
.resizable()
|
||||
.frame(width: 100, height: 100)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
if contactViewModel.indexDisplayedFriend != nil
|
||||
&& contactViewModel.indexDisplayedFriend! < contactsManager.lastSearch.count {
|
||||
|
||||
Text(contactAvatarModel.name)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.multilineTextAlignment(.center)
|
||||
|
|
@ -144,7 +136,6 @@ struct ContactInnerFragment: View {
|
|||
.default_text_style_300(styleSize: 12)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
||||
}
|
||||
.frame(minHeight: 150)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
@ -172,17 +163,18 @@ struct ContactInnerFragment: View {
|
|||
Image("phone")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.foregroundStyle(contactAvatarModel.address.isEmpty ? Color.grayMain2c400 : Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.background(contactAvatarModel.address.isEmpty ? Color.grayMain2c100 : Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("contact_call_action")
|
||||
.default_text_style(styleSize: 14)
|
||||
}
|
||||
})
|
||||
.disabled(contactAvatarModel.address.isEmpty)
|
||||
|
||||
Spacer()
|
||||
|
||||
|
|
@ -204,17 +196,18 @@ struct ContactInnerFragment: View {
|
|||
Image("chat-teardrop-text")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.foregroundStyle(contactAvatarModel.address.isEmpty ? Color.grayMain2c400 : Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.background(contactAvatarModel.address.isEmpty ? Color.grayMain2c100 : Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("contact_message_action")
|
||||
.default_text_style(styleSize: 14)
|
||||
}
|
||||
})
|
||||
.disabled(contactAvatarModel.address.isEmpty)
|
||||
|
||||
Spacer()
|
||||
|
||||
|
|
@ -236,17 +229,18 @@ struct ContactInnerFragment: View {
|
|||
Image("video-camera")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.foregroundStyle(contactAvatarModel.address.isEmpty ? Color.grayMain2c400 : Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.grayMain2c200)
|
||||
.background(contactAvatarModel.address.isEmpty ? Color.grayMain2c100 : Color.grayMain2c200)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text("contact_video_call_action")
|
||||
.default_text_style(styleSize: 14)
|
||||
}
|
||||
})
|
||||
.disabled(contactAvatarModel.address.isEmpty)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
|
@ -278,7 +272,7 @@ struct ContactInnerFragment: View {
|
|||
.fullScreenCover(isPresented: $presentingEditContact) {
|
||||
NavigationView {
|
||||
EditContactView(contact: $cnContact)
|
||||
.navigationBarTitle("Edit Contact")
|
||||
.navigationBarTitle("contact_edit_title")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.edgesIgnoringSafeArea(.vertical)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ struct ContactListBottomSheet: View {
|
|||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Close") {
|
||||
Button("dialog_close") {
|
||||
if #available(iOS 16.0, *) {
|
||||
showingSheet.toggle()
|
||||
} else {
|
||||
|
|
@ -147,7 +147,7 @@ struct ContactListBottomSheet: View {
|
|||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
Text(contactViewModel.stringToCopy.prefix(4) == "sip:"
|
||||
? "Block the address" : "Block the number")
|
||||
? "menu_block_address" : "menu_block_number")
|
||||
.default_text_style(styleSize: 16)
|
||||
Spacer()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ struct ContactsListBottomSheet: View {
|
|||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Close") {
|
||||
Button("dialog_close") {
|
||||
if #available(iOS 16.0, *) {
|
||||
showingSheet.toggle()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -136,9 +136,7 @@ struct EditContactFragment: View {
|
|||
.padding(.top, 2)
|
||||
.disabled(editContactViewModel.firstName.isEmpty)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
addOrEditFriend()
|
||||
}
|
||||
addOrEditFriend()
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
@ -532,25 +530,28 @@ struct EditContactFragment: View {
|
|||
contact: newContact, linphoneFriend: true, existingFriend: editContactViewModel.selectedEditFriend) {
|
||||
MagicSearchSingleton.shared.searchForContacts(sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
|
||||
|
||||
if editContactViewModel.selectedEditFriend != nil
|
||||
&& editContactViewModel.selectedEditFriend!.name != editContactViewModel.firstName + " " + editContactViewModel.lastName {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
let result = ContactsManager.shared.lastSearch.firstIndex(where: {
|
||||
$0.friend!.name == newContact.firstName + " " + newContact.lastName
|
||||
})
|
||||
contactViewModel.indexDisplayedFriend = result
|
||||
DispatchQueue.main.async {
|
||||
if editContactViewModel.selectedEditFriend != nil {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
let result = ContactsManager.shared.lastSearch.firstIndex(where: {
|
||||
$0.friend!.name == newContact.firstName + " " + newContact.lastName
|
||||
})
|
||||
contactViewModel.indexDisplayedFriend = result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delayColorDismiss()
|
||||
if editContactViewModel.selectedEditFriend == nil {
|
||||
withAnimation {
|
||||
isShowEditContactFragment.toggle()
|
||||
|
||||
delayColorDismiss()
|
||||
if editContactViewModel.selectedEditFriend == nil {
|
||||
withAnimation {
|
||||
isShowEditContactFragment.toggle()
|
||||
}
|
||||
} else {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dismiss()
|
||||
editContactViewModel.resetValues()
|
||||
}
|
||||
editContactViewModel.resetValues()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import linphonesw
|
|||
import Combine
|
||||
|
||||
class ContactAvatarModel: ObservableObject, Identifiable {
|
||||
let id = UUID()
|
||||
|
||||
let friend: Friend?
|
||||
|
||||
|
|
@ -46,24 +47,23 @@ class ContactAvatarModel: ObservableObject, Identifiable {
|
|||
self.name = name
|
||||
self.address = address
|
||||
var addressesTmp: [String] = []
|
||||
if friend != nil {
|
||||
friend!.addresses.forEach { address in
|
||||
if let friend = friend {
|
||||
friend.addresses.forEach { address in
|
||||
addressesTmp.append(address.asStringUriOnly())
|
||||
}
|
||||
}
|
||||
self.addresses = addressesTmp
|
||||
self.nativeUri = friend?.nativeUri ?? ""
|
||||
self.withPresence = withPresence
|
||||
if friend != nil &&
|
||||
withPresence == true {
|
||||
if let friend = friend, withPresence == true {
|
||||
self.lastPresenceInfo = ""
|
||||
|
||||
self.presenceStatus = friend!.consolidatedPresence
|
||||
self.presenceStatus = friend.consolidatedPresence
|
||||
|
||||
if friend!.consolidatedPresence == .Online || friend!.consolidatedPresence == .Busy {
|
||||
if friend!.consolidatedPresence == .Online || friend!.presenceModel!.latestActivityTimestamp != -1 {
|
||||
self.lastPresenceInfo = (friend!.consolidatedPresence == .Online) ?
|
||||
"Online" : getCallTime(startDate: friend!.presenceModel!.latestActivityTimestamp)
|
||||
if friend.consolidatedPresence == .Online || friend.consolidatedPresence == .Busy {
|
||||
if friend.consolidatedPresence == .Online || friend.presenceModel?.latestActivityTimestamp != -1 {
|
||||
self.lastPresenceInfo = (friend.consolidatedPresence == .Online) ?
|
||||
"Online" : getCallTime(startDate: friend.presenceModel!.latestActivityTimestamp)
|
||||
} else {
|
||||
self.lastPresenceInfo = "Away"
|
||||
}
|
||||
|
|
@ -86,11 +86,12 @@ class ContactAvatarModel: ObservableObject, Identifiable {
|
|||
func addFriendDelegate() {
|
||||
friendDelegate = FriendDelegateStub(onPresenceReceived: { (friend: Friend) in
|
||||
let latestActivityTimestamp = friend.presenceModel?.latestActivityTimestamp ?? -1
|
||||
let consolidatedPresenceTmp = friend.consolidatedPresence
|
||||
DispatchQueue.main.async {
|
||||
self.presenceStatus = friend.consolidatedPresence
|
||||
if friend.consolidatedPresence == .Online || friend.consolidatedPresence == .Busy {
|
||||
if friend.consolidatedPresence == .Online || latestActivityTimestamp != -1 {
|
||||
self.lastPresenceInfo = friend.consolidatedPresence == .Online ?
|
||||
self.presenceStatus = consolidatedPresenceTmp
|
||||
if consolidatedPresenceTmp == .Online || consolidatedPresenceTmp == .Busy {
|
||||
if consolidatedPresenceTmp == .Online || latestActivityTimestamp != -1 {
|
||||
self.lastPresenceInfo = consolidatedPresenceTmp == .Online ?
|
||||
"Online" : self.getCallTime(startDate: latestActivityTimestamp)
|
||||
} else {
|
||||
self.lastPresenceInfo = "Away"
|
||||
|
|
@ -100,7 +101,10 @@ class ContactAvatarModel: ObservableObject, Identifiable {
|
|||
}
|
||||
}
|
||||
})
|
||||
friend?.addDelegate(delegate: friendDelegate!)
|
||||
|
||||
if friend != nil && friendDelegate != nil {
|
||||
friend!.addDelegate(delegate: friendDelegate!)
|
||||
}
|
||||
}
|
||||
|
||||
func removeFriendDelegate() {
|
||||
|
|
@ -149,11 +153,25 @@ class ContactAvatarModel: ObservableObject, Identifiable {
|
|||
}
|
||||
completion(avatarModel!)
|
||||
} else {
|
||||
let name = address.displayName != nil ? address.displayName! : address.username!
|
||||
var name = ""
|
||||
if address.displayName != nil {
|
||||
name = address.displayName!
|
||||
} else if address.username != nil {
|
||||
name = address.username!
|
||||
} else {
|
||||
name = String(address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
completion(ContactAvatarModel(friend: nil, name: name, address: address.asStringUriOnly(), withPresence: false))
|
||||
}
|
||||
} else {
|
||||
let name = address.displayName != nil ? address.displayName! : address.username!
|
||||
var name = ""
|
||||
if address.displayName != nil {
|
||||
name = address.displayName!
|
||||
} else if address.username != nil {
|
||||
name = address.username!
|
||||
} else {
|
||||
name = String(address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
completion(ContactAvatarModel(friend: nil, name: name, address: address.asStringUriOnly(), withPresence: false))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import linphonesw
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class ContactViewModel: ObservableObject {
|
||||
|
|
@ -43,7 +44,7 @@ class ContactViewModel: ObservableObject {
|
|||
let account = core.defaultAccount
|
||||
if account == nil {
|
||||
Log.error(
|
||||
"\(StartConversationViewModel.TAG) No default account found, can't create conversation with \(remote.asStringUriOnly())!"
|
||||
"\(ConversationForwardMessageViewModel.TAG) No default account found, can't create conversation with \(remote.asStringUriOnly())"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
|
@ -53,37 +54,42 @@ class ContactViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
do {
|
||||
let params: ChatRoomParams = try core.createDefaultChatRoomParams()
|
||||
let params = try core.createConferenceParams(conference: nil)
|
||||
params.chatEnabled = true
|
||||
params.groupEnabled = false
|
||||
params.subject = "Dummy subject"
|
||||
params.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
params.subject = NSLocalizedString("conversation_one_to_one_hidden_subject", comment: "")
|
||||
params.account = account
|
||||
|
||||
let sameDomain = remote.domain == account?.params?.domain ?? ""
|
||||
if StartConversationViewModel.isEndToEndEncryptionMandatory() && sameDomain {
|
||||
Log.info("\(StartConversationViewModel.TAG) Account is in secure mode & domain matches, creating a E2E conversation")
|
||||
params.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.encryptionEnabled = true
|
||||
} else if !StartConversationViewModel.isEndToEndEncryptionMandatory() {
|
||||
guard let chatParams = params.chatParams else { return }
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
let sameDomain = remote.domain == CorePreferences.defaultDomain && remote.domain == account!.params?.domain
|
||||
if account!.params != nil && (account!.params!.instantMessagingEncryptionMandatory && sameDomain) {
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) Account is in secure mode & domain matches, creating an E2E encrypted conversation")
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
} else if account!.params != nil && (!account!.params!.instantMessagingEncryptionMandatory) {
|
||||
if LinphoneUtils.isEndToEndEncryptedChatAvailable(core: core) {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) Account is in interop mode but LIME is available, creating a E2E conversation"
|
||||
"\(ConversationForwardMessageViewModel.TAG) Account is in interop mode but LIME is available, creating an E2E encrypted conversation"
|
||||
)
|
||||
params.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.encryptionEnabled = true
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
} else {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) Account is in interop mode but LIME isn't available, creating a SIP simple conversation"
|
||||
"\(ConversationForwardMessageViewModel.TAG) Account is in interop mode but LIME isn't available, creating a SIP simple conversation"
|
||||
)
|
||||
params.backend = ChatRoom.Backend.Basic
|
||||
params.encryptionEnabled = false
|
||||
chatParams.backend = ChatRoom.Backend.Basic
|
||||
params.securityLevel = Conference.SecurityLevel.None
|
||||
}
|
||||
} else {
|
||||
Log.error(
|
||||
"\(StartConversationViewModel.TAG) Account is in secure mode, can't chat with SIP address of different domain \(remote.asStringUriOnly())"
|
||||
"\(ConversationForwardMessageViewModel.TAG) Account is in secure mode, can't chat with SIP address of different domain \(remote.asStringUriOnly())"
|
||||
)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_invalid_participant_error"
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
return
|
||||
|
|
@ -94,85 +100,56 @@ class ContactViewModel: ObservableObject {
|
|||
let existingChatRoom = core.searchChatRoom(params: params, localAddr: localAddress, remoteAddr: nil, participants: participants)
|
||||
if existingChatRoom == nil {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) No existing 1-1 conversation between local account "
|
||||
+ "\(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) was found for given parameters, let's create it"
|
||||
"\(ConversationForwardMessageViewModel.TAG) No existing 1-1 conversation between local account \(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) was found for given parameters, let's create it"
|
||||
)
|
||||
let chatRoom = try core.createChatRoom(params: params, localAddr: localAddress, participants: participants)
|
||||
if params.backend == ChatRoom.Backend.FlexisipChat {
|
||||
if chatRoom.state == ChatRoom.State.Created {
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) 1-1 conversation \(id) has been created")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
do {
|
||||
let chatRoom = try core.createChatRoom(params: params, participants: participants)
|
||||
if chatParams.backend == ChatRoom.Backend.FlexisipChat {
|
||||
let state = chatRoom.state
|
||||
if state == ChatRoom.State.Created {
|
||||
let chatRoomId = LinphoneUtils.getConversationId(chatRoom: chatRoom)
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) 1-1 conversation \(chatRoomId) has been created")
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) Conversation isn't in Created state yet (state is \(state)), wait for it")
|
||||
self.chatRoomAddDelegate(core: core, chatRoom: chatRoom)
|
||||
}
|
||||
} else {
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation isn't in Created state yet, wait for it")
|
||||
self.chatRoomAddDelegate(core: core, chatRoom: chatRoom)
|
||||
}
|
||||
} else {
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation successfully created \(id)")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
let chatRoomId = LinphoneUtils.getConversationId(chatRoom: chatRoom)
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) Conversation successfully created \(chatRoomId)")
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Log.error("\(ConversationForwardMessageViewModel.TAG) Failed to create 1-1 conversation with \(remote.asStringUriOnly())")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.warn(
|
||||
"\(StartConversationViewModel.TAG) A 1-1 conversation between local account \(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) for given parameters already exists!"
|
||||
"\(ConversationForwardMessageViewModel.TAG) A 1-1 conversation between local account \(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) for given parameters already exists!"
|
||||
)
|
||||
|
||||
let model = ConversationModel(chatRoom: existingChatRoom!)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
Log.error("\(StartConversationViewModel.TAG) Failed to create 1-1 conversation with \(remote.asStringUriOnly())!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
import linphonesw
|
||||
import SwiftUI
|
||||
|
||||
class ContactsListViewModel: ObservableObject {
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
import linphonesw
|
||||
import SwiftUI
|
||||
|
||||
class EditContactViewModel: ObservableObject {
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
import linphonesw
|
||||
import SwiftUI
|
||||
|
||||
class FavoriteContactsListViewModel: ObservableObject {
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ struct ContentView: View {
|
|||
@ObservedObject var meetingsListViewModel: MeetingsListViewModel
|
||||
@ObservedObject var meetingViewModel: MeetingViewModel
|
||||
@ObservedObject var conversationForwardMessageViewModel: ConversationForwardMessageViewModel
|
||||
@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
|
||||
@State var index = 0
|
||||
@State private var orientation = UIDevice.current.orientation
|
||||
|
|
@ -70,16 +71,26 @@ struct ContentView: View {
|
|||
@State var isShowSipAddressesPopup = false
|
||||
@State var isShowSipAddressesPopupType = 0 // 0 to call, 1 to message, 2 to video call
|
||||
@State var isShowConversationFragment = false
|
||||
@State var isShowAccountProfileFragment = false
|
||||
@State var isShowSettingsFragment = false
|
||||
@State var isShowHelpFragment = false
|
||||
|
||||
@State var fullscreenVideo = false
|
||||
|
||||
@State var isShowScheduleMeetingFragment = false
|
||||
@State private var isShowLoginFragment: Bool = false
|
||||
|
||||
private let avatarSize = 45.0
|
||||
@State private var imagePath: URL?
|
||||
|
||||
var body: some View {
|
||||
let pub = NotificationCenter.default
|
||||
.publisher(for: NSNotification.Name("ContactLoaded"))
|
||||
|
||||
let pub2 = NotificationCenter.default
|
||||
.publisher(for: NSNotification.Name("ContactAdded"))
|
||||
.compactMap { $0.userInfo?["address"] as? String }
|
||||
let imageChanged = NotificationCenter.default
|
||||
.publisher(for: NSNotification.Name("ImageChanged"))
|
||||
GeometryReader { geometry in
|
||||
VStack(spacing: 0) {
|
||||
if (telecomManager.callInProgress && !fullscreenVideo && ((!telecomManager.callDisplayed && callViewModel.callsCounter == 1) || callViewModel.callsCounter > 1)) || isShowConversationFragment {
|
||||
|
|
@ -92,7 +103,7 @@ struct ContentView: View {
|
|||
.padding(.leading, 10)
|
||||
|
||||
if callViewModel.callsCounter > 1 {
|
||||
Text("\(callViewModel.callsCounter) appels")
|
||||
Text(String(format: String(localized: "calls_count_label"), callViewModel.callsCounter.description))
|
||||
.default_text_style_white(styleSize: 16)
|
||||
} else {
|
||||
Text("\(callViewModel.displayName)")
|
||||
|
|
@ -102,7 +113,7 @@ struct ContentView: View {
|
|||
Spacer()
|
||||
|
||||
if callViewModel.callsCounter == 1 {
|
||||
Text("\(callViewModel.isPaused || telecomManager.isPausedByRemote ? "En pause" : "Actif")")
|
||||
Text(callViewModel.isPaused || telecomManager.isPausedByRemote ? String(localized: "call_state_paused") : String(localized: "call_state_connected"))
|
||||
.default_text_style_white(styleSize: 16)
|
||||
.padding(.trailing, 10)
|
||||
}
|
||||
|
|
@ -140,10 +151,10 @@ struct ContentView: View {
|
|||
.foregroundStyle(self.index == 0 ? Color.orangeMain500 : Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
if self.index == 0 {
|
||||
Text("Contacts")
|
||||
Text("bottom_navigation_contacts_label")
|
||||
.default_text_style_700(styleSize: 10)
|
||||
} else {
|
||||
Text("Contacts")
|
||||
Text("bottom_navigation_contacts_label")
|
||||
.default_text_style(styleSize: 10)
|
||||
}
|
||||
}
|
||||
|
|
@ -188,10 +199,10 @@ struct ContentView: View {
|
|||
.foregroundStyle(self.index == 1 ? Color.orangeMain500 : Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
if self.index == 1 {
|
||||
Text("Calls")
|
||||
Text("bottom_navigation_calls_label")
|
||||
.default_text_style_700(styleSize: 10)
|
||||
} else {
|
||||
Text("Calls")
|
||||
Text("bottom_navigation_calls_label")
|
||||
.default_text_style(styleSize: 10)
|
||||
}
|
||||
}
|
||||
|
|
@ -283,9 +294,9 @@ struct ContentView: View {
|
|||
|
||||
VStack(spacing: 0) {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.orangeMain500)
|
||||
.edgesIgnoringSafeArea(.top)
|
||||
.frame(height: 1)
|
||||
.foregroundColor(Color.orangeMain500)
|
||||
.edgesIgnoringSafeArea(.top)
|
||||
.frame(height: 1)
|
||||
|
||||
ZStack {
|
||||
VStack {
|
||||
|
|
@ -305,15 +316,62 @@ struct ContentView: View {
|
|||
VStack(spacing: 0) {
|
||||
if searchIsActive == false {
|
||||
HStack {
|
||||
Image("profile-image-example")
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
if (accountProfileViewModel.accountModelIndex ?? 0) < CoreContext.shared.accounts.count {
|
||||
AsyncImage(url: imagePath) { image in
|
||||
switch image {
|
||||
case .empty:
|
||||
ProgressView()
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
case .success(let image):
|
||||
image
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
case .failure:
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex ?? 0].avatarModel?.name ?? "",
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
@unknown default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
openMenu()
|
||||
}
|
||||
.onAppear {
|
||||
if let accountModelIndex = accountProfileViewModel.accountModelIndex,
|
||||
accountModelIndex < CoreContext.shared.accounts.count {
|
||||
let imagePathTmp = CoreContext.shared.accounts[accountModelIndex].getImagePath()
|
||||
if !(imagePathTmp.lastPathComponent.isEmpty || imagePathTmp.lastPathComponent == "Error" || imagePathTmp.lastPathComponent == "ImageError.png") {
|
||||
imagePath = imagePathTmp
|
||||
}
|
||||
}
|
||||
}
|
||||
.onChange(of: CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex ?? 0].usernaneAvatar) { _ in
|
||||
if let accountModelIndex = accountProfileViewModel.accountModelIndex,
|
||||
accountModelIndex < CoreContext.shared.accounts.count {
|
||||
let imagePathTmp = CoreContext.shared.accounts[accountModelIndex].getImagePath()
|
||||
if !(imagePathTmp.lastPathComponent.isEmpty || imagePathTmp.lastPathComponent == "Error" || imagePathTmp.lastPathComponent == "ImageError.png") {
|
||||
sharedMainViewModel.changeDefaultAvatar(defaultAvatarURL: imagePathTmp)
|
||||
imagePath = imagePathTmp
|
||||
}
|
||||
}
|
||||
}
|
||||
.onReceive(imageChanged) { _ in
|
||||
if let accountModelIndex = accountProfileViewModel.accountModelIndex,
|
||||
accountModelIndex < CoreContext.shared.accounts.count {
|
||||
let imagePathTmp = CoreContext.shared.accounts[accountModelIndex].getImagePath()
|
||||
sharedMainViewModel.changeDefaultAvatar(defaultAvatarURL: imagePathTmp)
|
||||
imagePath = imagePathTmp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text(index == 0 ? "bottom_navigation_contacts_label" : (index == 1 ? "bottom_navigation_calls_label" : (index == 2 ? "bottom_navigation_conversations_label" : "bottom_navigation_meetings_label")))
|
||||
Text(String(localized: index == 0 ? "bottom_navigation_contacts_label" : (index == 1 ? "bottom_navigation_calls_label" : (index == 2 ? "bottom_navigation_conversations_label" : "bottom_navigation_meetings_label"))))
|
||||
.default_text_style_white_800(styleSize: 20)
|
||||
.padding(.leading, 10)
|
||||
|
||||
|
|
@ -391,7 +449,7 @@ struct ContentView: View {
|
|||
isShowDeleteAllHistoryPopup.toggle()
|
||||
} label: {
|
||||
HStack {
|
||||
Text("Delete all history")
|
||||
Text("menu_delete_history")
|
||||
Spacer()
|
||||
Image("trash-simple-red")
|
||||
.resizable()
|
||||
|
|
@ -669,10 +727,10 @@ struct ContentView: View {
|
|||
.foregroundStyle(self.index == 0 ? Color.orangeMain500 : Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
if self.index == 0 {
|
||||
Text("Contacts")
|
||||
Text("bottom_navigation_contacts_label")
|
||||
.default_text_style_700(styleSize: 10)
|
||||
} else {
|
||||
Text("Contacts")
|
||||
Text("bottom_navigation_contacts_label")
|
||||
.default_text_style(styleSize: 10)
|
||||
}
|
||||
}
|
||||
|
|
@ -719,10 +777,10 @@ struct ContentView: View {
|
|||
.foregroundStyle(self.index == 1 ? Color.orangeMain500 : Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
if self.index == 1 {
|
||||
Text("Calls")
|
||||
Text("bottom_navigation_calls_label")
|
||||
.default_text_style_700(styleSize: 9)
|
||||
} else {
|
||||
Text("Calls")
|
||||
Text("bottom_navigation_calls_label")
|
||||
.default_text_style(styleSize: 9)
|
||||
}
|
||||
}
|
||||
|
|
@ -863,17 +921,18 @@ struct ContentView: View {
|
|||
conversationsListViewModel: conversationsListViewModel,
|
||||
conversationForwardMessageViewModel: conversationForwardMessageViewModel,
|
||||
contactViewModel: contactViewModel,
|
||||
editContactViewModel: editContactViewModel,
|
||||
editContactViewModel: editContactViewModel,
|
||||
meetingViewModel: meetingViewModel,
|
||||
accountProfileViewModel: accountProfileViewModel,
|
||||
isShowConversationFragment: $isShowConversationFragment,
|
||||
isShowStartCallGroupPopup: $isShowStartCallGroupPopup,
|
||||
isShowEditContactFragment: $isShowEditContactFragment,
|
||||
indexPage: $index,
|
||||
isShowScheduleMeetingFragment: $isShowScheduleMeetingFragment
|
||||
)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color.gray100)
|
||||
.ignoresSafeArea(.keyboard)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color.gray100)
|
||||
.ignoresSafeArea(.keyboard)
|
||||
} else if self.index == 3 {
|
||||
MeetingFragment(meetingViewModel: meetingViewModel, meetingsListViewModel: meetingsListViewModel, isShowScheduleMeetingFragment: $isShowScheduleMeetingFragment, isShowSendCancelMeetingNotificationPopup: $isShowSendCancelMeetingNotificationPopup)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
@ -907,11 +966,15 @@ struct ContentView: View {
|
|||
}
|
||||
|
||||
SideMenu(
|
||||
accountProfileViewModel: accountProfileViewModel,
|
||||
width: geometry.size.width / 5 * 4,
|
||||
isOpen: self.sideMenuIsOpen,
|
||||
isOpen: $sideMenuIsOpen,
|
||||
menuClose: self.openMenu,
|
||||
safeAreaInsets: geometry.safeAreaInsets,
|
||||
isShowLoginFragment: $isShowLoginFragment
|
||||
isShowLoginFragment: $isShowLoginFragment,
|
||||
isShowAccountProfileFragment: $isShowAccountProfileFragment,
|
||||
isShowSettingsFragment: $isShowSettingsFragment,
|
||||
isShowHelpFragment: $isShowHelpFragment
|
||||
)
|
||||
.ignoresSafeArea(.all)
|
||||
.zIndex(2)
|
||||
|
|
@ -1001,17 +1064,16 @@ struct ContentView: View {
|
|||
|
||||
if isShowDeleteContactPopup {
|
||||
PopupView(isShowPopup: $isShowDeleteContactPopup,
|
||||
title: Text(
|
||||
contactViewModel.selectedFriend != nil
|
||||
? "Delete \(contactViewModel.selectedFriend!.name!)?"
|
||||
: (contactViewModel.indexDisplayedFriend != nil
|
||||
? "Delete \(contactsManager.lastSearch[contactViewModel.indexDisplayedFriend!].friend!.name!)?"
|
||||
: "Error Name")),
|
||||
content: Text("This contact will be deleted definitively."),
|
||||
titleFirstButton: Text("Cancel"),
|
||||
title: Text(String(format: String(localized: "contact_dialog_delete_title"),contactViewModel.selectedFriend != nil
|
||||
? contactViewModel.selectedFriend!.name!
|
||||
: (contactViewModel.indexDisplayedFriend != nil
|
||||
? contactsManager.lastSearch[contactViewModel.indexDisplayedFriend!].friend!.name!
|
||||
: "Error Name"))),
|
||||
content: Text("contact_dialog_delete_message"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {
|
||||
self.isShowDeleteContactPopup.toggle()},
|
||||
titleSecondButton: Text("Ok"),
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
if contactViewModel.selectedFriendToDelete != nil {
|
||||
if contactViewModel.indexDisplayedFriend != nil {
|
||||
|
|
@ -1043,14 +1105,14 @@ struct ContentView: View {
|
|||
|
||||
if isShowDeleteAllHistoryPopup {
|
||||
PopupView(isShowPopup: $isShowDeleteContactPopup,
|
||||
title: Text("Do you really want to delete all calls history?"),
|
||||
content: Text("All calls will be removed from the history."),
|
||||
titleFirstButton: Text("Cancel"),
|
||||
title: Text("history_dialog_delete_all_call_logs_title"),
|
||||
content: Text("history_dialog_delete_all_call_logs_message"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {
|
||||
self.isShowDeleteAllHistoryPopup.toggle()
|
||||
historyListViewModel.callLogsAddressToDelete = ""
|
||||
},
|
||||
titleSecondButton: Text("Ok"),
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
historyListViewModel.removeCallLogs()
|
||||
self.isShowDeleteAllHistoryPopup.toggle()
|
||||
|
|
@ -1068,11 +1130,11 @@ struct ContentView: View {
|
|||
|
||||
if isShowDismissPopup {
|
||||
PopupView(isShowPopup: $isShowDismissPopup,
|
||||
title: Text("Don’t save modifications?"),
|
||||
content: Text("All modifications will be canceled."),
|
||||
titleFirstButton: Text("Cancel"),
|
||||
title: Text("contact_editor_dialog_abort_confirmation_title"),
|
||||
content: Text("contact_editor_dialog_abort_confirmation_message"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {self.isShowDismissPopup.toggle()},
|
||||
titleSecondButton: Text("Ok"),
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
if editContactViewModel.selectedEditFriend == nil {
|
||||
self.isShowDismissPopup.toggle()
|
||||
|
|
@ -1141,17 +1203,45 @@ struct ContentView: View {
|
|||
}
|
||||
}
|
||||
|
||||
if isShowAccountProfileFragment {
|
||||
AccountProfileFragment(
|
||||
accountProfileViewModel: accountProfileViewModel,
|
||||
registerViewModel: RegisterViewModel(),
|
||||
isShowAccountProfileFragment: $isShowAccountProfileFragment
|
||||
)
|
||||
.zIndex(3)
|
||||
.transition(.move(edge: .trailing))
|
||||
}
|
||||
|
||||
if isShowSettingsFragment {
|
||||
SettingsFragment(
|
||||
settingsViewModel: SettingsViewModel(),
|
||||
isShowSettingsFragment: $isShowSettingsFragment
|
||||
)
|
||||
.zIndex(3)
|
||||
.transition(.move(edge: .trailing))
|
||||
}
|
||||
|
||||
if isShowHelpFragment {
|
||||
HelpFragment(
|
||||
helpViewModel: HelpViewModel(),
|
||||
isShowHelpFragment: $isShowHelpFragment
|
||||
)
|
||||
.zIndex(3)
|
||||
.transition(.move(edge: .trailing))
|
||||
}
|
||||
|
||||
if isShowSendCancelMeetingNotificationPopup {
|
||||
PopupView(isShowPopup: $isShowSendCancelMeetingNotificationPopup,
|
||||
title: Text("The meeting will be cancelled"),
|
||||
content: Text("Send notification to participants ?"),
|
||||
titleFirstButton: Text("Cancel for me only"),
|
||||
title: Text("meeting_schedule_cancel_dialog_title"),
|
||||
content: Text("meeting_schedule_cancel_dialog_message"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
meetingsListViewModel.deleteSelectedMeeting()
|
||||
self.isShowSendCancelMeetingNotificationPopup.toggle(
|
||||
) },
|
||||
titleSecondButton: Text("Send cancellation notifications"),
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
meetingViewModel.displayedMeeting = nil
|
||||
if let meetingToDelete = self.meetingsListViewModel.selectedMeetingToDelete {
|
||||
|
|
@ -1172,11 +1262,11 @@ struct ContentView: View {
|
|||
isShowPopup: $isShowStartCallGroupPopup,
|
||||
title: Text("conversation_info_confirm_start_group_call_dialog_title"),
|
||||
content: Text("conversation_info_confirm_start_group_call_dialog_message"),
|
||||
titleFirstButton: Text("Cancel"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {
|
||||
self.isShowStartCallGroupPopup.toggle()
|
||||
},
|
||||
titleSecondButton: Text("Confirm"),
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
conversationViewModel.displayedConversation!.createGroupCall()
|
||||
|
|
@ -1196,11 +1286,11 @@ struct ContentView: View {
|
|||
isShowPopup: $isShowStartCallGroupPopup,
|
||||
title: Text("conversation_info_confirm_start_group_call_dialog_title"),
|
||||
content: Text("conversation_info_confirm_start_group_call_dialog_message"),
|
||||
titleFirstButton: Text("Cancel"),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {
|
||||
self.isShowStartCallGroupPopup.toggle()
|
||||
},
|
||||
titleSecondButton: Text("Confirm"),
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
conversationViewModel.displayedConversation!.createGroupCall()
|
||||
|
|
@ -1240,8 +1330,9 @@ struct ContentView: View {
|
|||
conversationsListViewModel: conversationsListViewModel,
|
||||
conversationForwardMessageViewModel: conversationForwardMessageViewModel,
|
||||
contactViewModel: contactViewModel,
|
||||
editContactViewModel: editContactViewModel,
|
||||
editContactViewModel: editContactViewModel,
|
||||
meetingViewModel: meetingViewModel,
|
||||
accountProfileViewModel: accountProfileViewModel,
|
||||
fullscreenVideo: $fullscreenVideo,
|
||||
isShowStartCallFragment: $isShowStartCallFragment,
|
||||
isShowConversationFragment: $isShowConversationFragment,
|
||||
|
|
@ -1270,18 +1361,18 @@ struct ContentView: View {
|
|||
.zIndex(6)
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
MagicSearchSingleton.shared.searchForContacts(sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
|
||||
}
|
||||
.onChange(of: navigationManager.selectedCallId) { newCallId in
|
||||
if newCallId != nil {
|
||||
self.index = 2
|
||||
}
|
||||
}
|
||||
.onReceive(pub) { _ in
|
||||
conversationsListViewModel.computeChatRoomsList(filter: "")
|
||||
conversationsListViewModel.updateChatRoomsList()
|
||||
historyListViewModel.refreshHistoryAvatarModel()
|
||||
}
|
||||
.onReceive(pub2) { address in
|
||||
conversationsListViewModel.updateChatRoom(address: address)
|
||||
}
|
||||
}
|
||||
.overlay {
|
||||
if isMenuOpen {
|
||||
|
|
@ -1302,8 +1393,11 @@ struct ContentView: View {
|
|||
orientation = newOrientation
|
||||
}
|
||||
.onChange(of: scenePhase) { newPhase in
|
||||
CoreContext.shared.enteredForeground = newPhase == .active
|
||||
orientation = UIDevice.current.orientation
|
||||
if newPhase == .active {
|
||||
conversationsListViewModel.computeChatRoomsList(filter: "")
|
||||
accountProfileViewModel.setAvatarModel()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1340,7 +1434,8 @@ class NavigationManager: ObservableObject {
|
|||
conversationViewModel: ConversationViewModel(),
|
||||
meetingsListViewModel: MeetingsListViewModel(),
|
||||
meetingViewModel: MeetingViewModel(),
|
||||
conversationForwardMessageViewModel: ConversationForwardMessageViewModel()
|
||||
conversationForwardMessageViewModel: ConversationForwardMessageViewModel(),
|
||||
accountProfileViewModel: AccountProfileViewModel()
|
||||
)
|
||||
}
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ struct ChatBubbleView: View {
|
|||
|
||||
VStack(spacing: 2) {
|
||||
if !eventLogMessage.message.messageConferenceInfo!.meetingDescription.isEmpty {
|
||||
Text("Description")
|
||||
Text("meeting_schedule_description_title")
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
|
|
@ -374,10 +374,8 @@ struct ChatBubbleView: View {
|
|||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
if !CoreContext.shared.enteredForeground {
|
||||
conversationViewModel.selectedMessageToDisplayDetails = eventLogMessage
|
||||
conversationViewModel.prepareBottomSheetForDeliveryStatus()
|
||||
}
|
||||
conversationViewModel.selectedMessageToDisplayDetails = eventLogMessage
|
||||
conversationViewModel.prepareBottomSheetForDeliveryStatus()
|
||||
}
|
||||
.disabled(conversationViewModel.selectedMessage != nil)
|
||||
.padding(.top, -4)
|
||||
|
|
|
|||
|
|
@ -223,6 +223,11 @@ struct ConversationForwardMessageFragment: View {
|
|||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.onAppear {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||
MagicSearchSingleton.shared.searchForSuggestions()
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||
magicSearch.searchForContacts(
|
||||
|
|
@ -276,27 +281,51 @@ struct ConversationForwardMessageFragment: View {
|
|||
} label: {
|
||||
HStack {
|
||||
if index < contactsManager.lastSearchSuggestions.count
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil
|
||||
&& contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil {
|
||||
if contactsManager.lastSearchSuggestions[index].address!.displayName != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.displayName!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.displayName ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else if contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address!.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
}
|
||||
} else {
|
||||
Image("profil-picture-default")
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text("Username error")
|
||||
Text("username_error")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
|
|
|
|||
|
|
@ -24,9 +24,12 @@ import UniformTypeIdentifiers
|
|||
// swiftlint:disable type_body_length
|
||||
struct ConversationFragment: View {
|
||||
|
||||
@Environment(\.scenePhase) var scenePhase
|
||||
@State private var orientation = UIDevice.current.orientation
|
||||
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
|
||||
|
||||
@EnvironmentObject var navigationManager: NavigationManager
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
|
|
@ -36,6 +39,7 @@ struct ConversationFragment: View {
|
|||
@ObservedObject var contactViewModel: ContactViewModel
|
||||
@ObservedObject var editContactViewModel: EditContactViewModel
|
||||
@ObservedObject var meetingViewModel: MeetingViewModel
|
||||
@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
|
||||
@State var isMenuOpen = false
|
||||
@State private var isMuted: Bool = false
|
||||
|
|
@ -81,13 +85,11 @@ struct ConversationFragment: View {
|
|||
.onRotate { newOrientation in
|
||||
orientation = newOrientation
|
||||
}
|
||||
.onAppear() {
|
||||
.onAppear {
|
||||
displayedChatroomPeerAddr = conversationViewModel.displayedConversation?.remoteSipUri
|
||||
Log.info("debugtrace = onAppear: displayedChatroomPeerAddr = \(displayedChatroomPeerAddr)")
|
||||
}
|
||||
.onDisappear {
|
||||
displayedChatroomPeerAddr = nil
|
||||
Log.info("debugtrace = onDisappear: displayedChatroomPeerAddr = nil")
|
||||
conversationViewModel.removeConversationDelegate()
|
||||
}
|
||||
.sheet(isPresented: $conversationViewModel.isShowSelectedMessageToDisplayDetails, onDismiss: {
|
||||
|
|
@ -127,13 +129,11 @@ struct ConversationFragment: View {
|
|||
.onRotate { newOrientation in
|
||||
orientation = newOrientation
|
||||
}
|
||||
.onAppear() {
|
||||
.onAppear {
|
||||
displayedChatroomPeerAddr = conversationViewModel.displayedConversation?.remoteSipUri
|
||||
Log.info("debugtrace = onAppear: displayedChatroomPeerAddr = \(displayedChatroomPeerAddr)")
|
||||
}
|
||||
.onDisappear {
|
||||
displayedChatroomPeerAddr = nil
|
||||
Log.info("debugtrace = onDisappear: displayedChatroomPeerAddr = nil")
|
||||
conversationViewModel.removeConversationDelegate()
|
||||
}
|
||||
.halfSheet(showSheet: $conversationViewModel.isShowSelectedMessageToDisplayDetails) {
|
||||
|
|
@ -165,6 +165,13 @@ struct ConversationFragment: View {
|
|||
.background(Color.gray100.ignoresSafeArea(.keyboard))
|
||||
}
|
||||
}
|
||||
.onChange(of: scenePhase) { newPhase in
|
||||
if newPhase == .active {
|
||||
if conversationViewModel.displayedConversation != nil && (navigationManager.peerAddr == nil || navigationManager.peerAddr!.contains(conversationViewModel.displayedConversation!.remoteSipUri)) {
|
||||
conversationViewModel.resetDisplayedChatRoom()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
}
|
||||
|
|
@ -665,7 +672,7 @@ struct ConversationFragment: View {
|
|||
.focused($isMessageTextFocused)
|
||||
.padding(.vertical, 5)
|
||||
.onChange(of: conversationViewModel.messageText) { text in
|
||||
if !text.isEmpty && !CoreContext.shared.enteredForeground {
|
||||
if !text.isEmpty {
|
||||
conversationViewModel.compose()
|
||||
}
|
||||
}
|
||||
|
|
@ -678,7 +685,7 @@ struct ConversationFragment: View {
|
|||
.default_text_style(styleSize: 15)
|
||||
.focused($isMessageTextFocused)
|
||||
.onChange(of: conversationViewModel.messageText) { text in
|
||||
if !text.isEmpty && !CoreContext.shared.enteredForeground {
|
||||
if !text.isEmpty {
|
||||
conversationViewModel.compose()
|
||||
}
|
||||
}
|
||||
|
|
@ -711,7 +718,7 @@ struct ConversationFragment: View {
|
|||
}
|
||||
} else {
|
||||
Button {
|
||||
if conversationViewModel.displayedConversationHistorySize > 0 {
|
||||
if conversationViewModel.displayedConversationHistorySize > 1 {
|
||||
NotificationCenter.default.post(name: .onScrollToBottom, object: nil)
|
||||
}
|
||||
conversationViewModel.sendMessage()
|
||||
|
|
@ -995,6 +1002,7 @@ struct ConversationFragment: View {
|
|||
contactViewModel: contactViewModel,
|
||||
editContactViewModel: editContactViewModel,
|
||||
meetingViewModel: meetingViewModel,
|
||||
accountProfileViewModel: accountProfileViewModel,
|
||||
isMuted: $isMuted,
|
||||
isShowEphemeralFragment: $isShowEphemeralFragment,
|
||||
isShowStartCallGroupPopup: $isShowStartCallGroupPopup,
|
||||
|
|
@ -1028,7 +1036,7 @@ struct ImdnOrReactionsSheet: View {
|
|||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Picker("Categories", selection: $selectedCategoryIndex) {
|
||||
Picker("picker_categories", selection: $selectedCategoryIndex) {
|
||||
ForEach(0..<conversationViewModel.sheetCategories.count, id: \.self) { index in
|
||||
Text(conversationViewModel.sheetCategories[index].name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ struct ConversationInfoFragment: View {
|
|||
@ObservedObject var contactViewModel: ContactViewModel
|
||||
@ObservedObject var editContactViewModel: EditContactViewModel
|
||||
@ObservedObject var meetingViewModel: MeetingViewModel
|
||||
@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
|
||||
@State var addParticipantsViewModel = AddParticipantsViewModel()
|
||||
|
||||
|
|
@ -46,6 +47,7 @@ struct ConversationInfoFragment: View {
|
|||
@State private var participantListIsOpen = true
|
||||
|
||||
var body: some View {
|
||||
let accountModel = CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex ?? 0]
|
||||
NavigationView {
|
||||
GeometryReader { geometry in
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
|
|
@ -287,14 +289,48 @@ struct ConversationInfoFragment: View {
|
|||
VStack(spacing: 0) {
|
||||
ForEach(conversationViewModel.participantConversationModel) { participantConversationModel in
|
||||
HStack {
|
||||
Avatar(contactAvatarModel: participantConversationModel, avatarSize: 50)
|
||||
if conversationViewModel.myParticipantConversationModel != nil && conversationViewModel.myParticipantConversationModel!.address != participantConversationModel.address {
|
||||
Avatar(contactAvatarModel: participantConversationModel, avatarSize: 50)
|
||||
} else {
|
||||
let avatarSize = 50.0
|
||||
AsyncImage(url: CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex!].imagePathAvatar) { image in
|
||||
switch image {
|
||||
case .empty:
|
||||
ProgressView()
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
case .success(let image):
|
||||
image
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
case .failure:
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: accountModel.avatarModel?.name ?? "",
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
@unknown default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VStack {
|
||||
Text(participantConversationModel.name)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
if conversationViewModel.myParticipantConversationModel != nil && conversationViewModel.myParticipantConversationModel!.address != participantConversationModel.address {
|
||||
Text(participantConversationModel.name)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
} else {
|
||||
Text(accountModel.displayName.isEmpty ? participantConversationModel.name : accountModel.displayName)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
}
|
||||
|
||||
let participantConversationModelIsAdmin = conversationViewModel.participantConversationModelAdmin.first(
|
||||
where: {$0.address == participantConversationModel.address})
|
||||
|
|
@ -667,6 +703,7 @@ struct ConversationInfoFragment: View {
|
|||
contactViewModel: ContactViewModel(),
|
||||
editContactViewModel: EditContactViewModel(),
|
||||
meetingViewModel: MeetingViewModel(),
|
||||
accountProfileViewModel: AccountProfileViewModel(),
|
||||
addParticipantsViewModel: AddParticipantsViewModel(),
|
||||
isMuted: .constant(false),
|
||||
isShowEphemeralFragment: .constant(false),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct ConversationsListBottomSheet: View {
|
|||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Close") {
|
||||
Button("dialog_close") {
|
||||
if #available(iOS 16.0, *) {
|
||||
showingSheet.toggle()
|
||||
} else {
|
||||
|
|
@ -80,7 +80,7 @@ struct ConversationsListBottomSheet: View {
|
|||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
Text("Marquer comme non lu")
|
||||
Text("conversation_action_mark_as_read")
|
||||
.default_text_style(styleSize: 16)
|
||||
Spacer()
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ struct ConversationsListBottomSheet: View {
|
|||
.foregroundStyle(Color.grayMain2c500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
Text(conversationsListViewModel.selectedConversation!.isMuted ? "Réactiver les notifications" : "Mettre en sourdine")
|
||||
Text(conversationsListViewModel.selectedConversation!.isMuted ? "conversation_action_unmute" : "conversation_action_mute")
|
||||
.default_text_style(styleSize: 16)
|
||||
Spacer()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ import linphonesw
|
|||
|
||||
struct ConversationsListFragment: View {
|
||||
|
||||
@Environment(\.scenePhase) var scenePhase
|
||||
|
||||
@EnvironmentObject var navigationManager: NavigationManager
|
||||
|
||||
@ObservedObject var conversationViewModel: ConversationViewModel
|
||||
|
|
@ -69,6 +71,14 @@ struct ConversationsListFragment: View {
|
|||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.onChange(of: scenePhase) { newPhase in
|
||||
if newPhase == .active {
|
||||
if navigationManager.peerAddr != nil {
|
||||
conversationViewModel.getChatRoomWithStringAddress(conversationsList: conversationsListViewModel.conversationsList, stringAddr: navigationManager.peerAddr!)
|
||||
navigationManager.peerAddr = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,8 +93,6 @@ struct ConversationRow: View {
|
|||
@Binding var text: String
|
||||
|
||||
var body: some View {
|
||||
let pub = NotificationCenter.default
|
||||
.publisher(for: NSNotification.Name("ChatRoomsComputed"))
|
||||
HStack {
|
||||
Avatar(contactAvatarModel: conversation.avatarModel, avatarSize: 50)
|
||||
|
||||
|
|
@ -187,22 +195,6 @@ struct ConversationRow: View {
|
|||
.listRowInsets(EdgeInsets(top: 6, leading: 20, bottom: 6, trailing: 20))
|
||||
.listRowSeparator(.hidden)
|
||||
.background(.white)
|
||||
.onReceive(pub) { _ in
|
||||
if CoreContext.shared.enteredForeground && conversationViewModel.displayedConversation != nil
|
||||
&& (navigationManager.peerAddr == nil || navigationManager.peerAddr == conversationViewModel.displayedConversation!.remoteSipUri) {
|
||||
if conversationViewModel.displayedConversation != nil {
|
||||
conversationViewModel.resetDisplayedChatRoom(conversationsList: conversationsListViewModel.conversationsList)
|
||||
}
|
||||
}
|
||||
|
||||
CoreContext.shared.enteredForeground = false
|
||||
|
||||
if navigationManager.peerAddr != nil
|
||||
&& conversation.remoteSipUri.contains(navigationManager.peerAddr!) {
|
||||
conversationViewModel.getChatRoomWithStringAddress(conversationsList: conversationsListViewModel.conversationsList, stringAddr: navigationManager.peerAddr!)
|
||||
navigationManager.peerAddr = nil
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
conversationViewModel.changeDisplayedChatRoom(conversationModel: conversation)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ struct StartConversationFragment: View {
|
|||
ScrollView {
|
||||
if !ContactsManager.shared.lastSearch.isEmpty {
|
||||
HStack(alignment: .center) {
|
||||
Text("All contacts")
|
||||
Text("contacts_list_all_contacts_title")
|
||||
.default_text_style_800(styleSize: 16)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -187,9 +187,7 @@ struct StartConversationFragment: View {
|
|||
|
||||
ContactsListFragment(contactViewModel: ContactViewModel(), contactsListViewModel: ContactsListViewModel(), showingSheet: .constant(false)
|
||||
, startCallFunc: { addr in
|
||||
withAnimation {
|
||||
startConversationViewModel.createOneToOneChatRoomWith(remote: addr)
|
||||
}
|
||||
})
|
||||
.padding(.horizontal, 16)
|
||||
|
||||
|
|
@ -266,35 +264,57 @@ struct StartConversationFragment: View {
|
|||
var suggestionsList: some View {
|
||||
ForEach(0..<contactsManager.lastSearchSuggestions.count, id: \.self) { index in
|
||||
Button {
|
||||
withAnimation {
|
||||
if contactsManager.lastSearchSuggestions[index].address != nil {
|
||||
startConversationViewModel.createOneToOneChatRoomWith(remote: contactsManager.lastSearchSuggestions[index].address!)
|
||||
}
|
||||
if let address = contactsManager.lastSearchSuggestions[index].address {
|
||||
startConversationViewModel.createOneToOneChatRoomWith(remote: address)
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
if index < contactsManager.lastSearchSuggestions.count
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil
|
||||
&& contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil {
|
||||
if contactsManager.lastSearchSuggestions[index].address!.displayName != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.displayName!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.displayName ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else if contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address!.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
}
|
||||
} else {
|
||||
Image("profil-picture-default")
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text("Username error")
|
||||
Text("username_error")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
|
|
@ -370,6 +390,9 @@ struct StartConversationFragment: View {
|
|||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
.onDisappear {
|
||||
startConversationViewModel.messageText = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,7 +208,6 @@ struct UIList: UIViewRepresentable {
|
|||
|
||||
if isScrolledToBottom && conversationViewModel.displayedConversationUnreadMessagesCount > 0 {
|
||||
conversationViewModel.markAsRead()
|
||||
conversationsListViewModel.computeChatRoomsList(filter: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -363,15 +362,16 @@ struct UIList: UIViewRepresentable {
|
|||
|
||||
NotificationCenter.default.addObserver(forName: .onScrollToBottom, object: nil, queue: nil) { _ in
|
||||
DispatchQueue.main.async {
|
||||
if !self.sections.isEmpty {
|
||||
if self.sections.first != nil
|
||||
&& parent.conversationViewModel.conversationMessagesSection.first != nil
|
||||
&& parent.conversationViewModel.displayedConversation != nil
|
||||
&& self.sections.first!.chatRoomID == parent.conversationViewModel.displayedConversation!.id
|
||||
&& self.sections.first!.rows.count == parent.conversationViewModel.conversationMessagesSection.first!.rows.count {
|
||||
self.tableView!.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: true)
|
||||
}
|
||||
guard !self.sections.isEmpty,
|
||||
let firstSection = self.sections.first,
|
||||
let firstConversationSection = parent.conversationViewModel.conversationMessagesSection.first,
|
||||
let displayedConversation = parent.conversationViewModel.displayedConversation,
|
||||
let tableView = self.tableView,
|
||||
firstSection.chatRoomID == displayedConversation.id,
|
||||
firstSection.rows.count == firstConversationSection.rows.count else {
|
||||
return
|
||||
}
|
||||
tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -467,7 +467,6 @@ struct UIList: UIViewRepresentable {
|
|||
|
||||
if self.parent.isScrolledToBottom && self.parent.conversationViewModel.displayedConversationUnreadMessagesCount > 0 {
|
||||
self.parent.conversationViewModel.markAsRead()
|
||||
self.parent.conversationsListViewModel.computeChatRoomsList(filter: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class ConversationModel: ObservableObject, Identifiable {
|
|||
private var coreContext = CoreContext.shared
|
||||
private var contactsManager = ContactsManager.shared
|
||||
|
||||
let chatRoom: ChatRoom
|
||||
var chatRoom: ChatRoom
|
||||
let isDisabledBecauseNotSecured: Bool = false
|
||||
|
||||
static let TAG = "[Conversation Model]"
|
||||
|
|
@ -50,8 +50,7 @@ class ConversationModel: ObservableObject, Identifiable {
|
|||
@Published var unreadMessagesCount: Int
|
||||
@Published var avatarModel: ContactAvatarModel
|
||||
|
||||
private var conferenceScheduler: ConferenceScheduler?
|
||||
private var conferenceSchedulerDelegate: ConferenceSchedulerDelegate?
|
||||
private var conferenceDelegate: ConferenceDelegate?
|
||||
|
||||
init(chatRoom: ChatRoom) {
|
||||
self.chatRoom = chatRoom
|
||||
|
|
@ -134,35 +133,28 @@ class ConversationModel: ObservableObject, Identifiable {
|
|||
}
|
||||
|
||||
do {
|
||||
let conferenceInfo = try Factory.Instance.createConferenceInfo()
|
||||
conferenceInfo.organizer = account!.params?.identityAddress
|
||||
conferenceInfo.subject = self.chatRoom.subject ?? "Conference"
|
||||
|
||||
var participantsList: [ParticipantInfo] = []
|
||||
var participantsList: [Address] = []
|
||||
self.chatRoom.participants.forEach { participant in
|
||||
do {
|
||||
let info = try Factory.Instance.createParticipantInfo(address: participant.address!)
|
||||
// For meetings, all participants must have Speaker role
|
||||
info.role = Participant.Role.Speaker
|
||||
participantsList.append(info)
|
||||
} catch let error {
|
||||
Log.error(
|
||||
"\(ConversationModel.TAG) Can't create ParticipantInfo: \(error)"
|
||||
)
|
||||
}
|
||||
participantsList.append(participant.address!)
|
||||
}
|
||||
|
||||
conferenceInfo.addParticipantInfos(participantInfos: participantsList)
|
||||
|
||||
Log.info(
|
||||
"\(ConversationModel.TAG) Creating group call with subject \(self.chatRoom.subject ?? "Conference") and \(participantsList.count) participant(s)"
|
||||
)
|
||||
|
||||
self.conferenceScheduler = try core.createConferenceScheduler(account: account)
|
||||
if self.conferenceScheduler != nil {
|
||||
self.conferenceAddDelegate(core: core, conferenceScheduler: self.conferenceScheduler!)
|
||||
// Will trigger the conference creation/update automatically
|
||||
self.conferenceScheduler!.info = conferenceInfo
|
||||
if let conference = LinphoneUtils.createGroupCall(core: core, account: account, subject: self.chatRoom.subject ?? "Conference") {
|
||||
let callParams = try? core.createCallParams(call: nil)
|
||||
if let callParams = callParams {
|
||||
callParams.videoEnabled = true
|
||||
callParams.videoDirection = .RecvOnly
|
||||
|
||||
Log.info("\(ConversationModel.TAG) Inviting \(participantsList.count) participant(s) into newly created conference")
|
||||
|
||||
try conference.inviteParticipants(addresses: participantsList, params: callParams)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
TelecomManager.shared.participantsInvited = true
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch let error {
|
||||
Log.error(
|
||||
|
|
@ -172,145 +164,132 @@ class ConversationModel: ObservableObject, Identifiable {
|
|||
}
|
||||
}
|
||||
|
||||
func conferenceAddDelegate(core: Core, conferenceScheduler: ConferenceScheduler) {
|
||||
self.conferenceSchedulerDelegate = ConferenceSchedulerDelegateStub(onStateChanged: { (conferenceScheduler: ConferenceScheduler, state: ConferenceScheduler.State) in
|
||||
Log.info("\(ConversationModel.TAG) Conference scheduler state is \(state)")
|
||||
if state == ConferenceScheduler.State.Ready {
|
||||
conferenceScheduler.removeDelegate(delegate: self.conferenceSchedulerDelegate!)
|
||||
self.conferenceSchedulerDelegate = nil
|
||||
|
||||
let conferenceAddress = conferenceScheduler.info?.uri
|
||||
if conferenceAddress != nil {
|
||||
Log.info(
|
||||
"\(ConversationModel.TAG) Conference info created, address is \(conferenceAddress!.asStringUriOnly())"
|
||||
)
|
||||
|
||||
TelecomManager.shared.doCallWithCore(addr: conferenceAddress!, isVideo: true, isConference: true)
|
||||
} else {
|
||||
Log.error("\(ConversationModel.TAG) Conference info URI is null!")
|
||||
|
||||
func conferenceAddDelegate(core: Core, conference: Conference) {
|
||||
self.conferenceDelegate = ConferenceDelegateStub(onStateChanged: { (conference: Conference, state: Conference.State) in
|
||||
Log.info("\(ConversationModel.TAG) Conference state is \(state)")
|
||||
if state == .Created {
|
||||
NotificationCenter.default.post(name: Notification.Name("CallViewModelReset"), object: self)
|
||||
} else if state == .CreationFailed {
|
||||
Log.error("\(ConversationModel.TAG) Failed to create group call!")
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_group_call_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
} else if state == ConferenceScheduler.State.Error {
|
||||
conferenceScheduler.removeDelegate(delegate: self.conferenceSchedulerDelegate!)
|
||||
self.conferenceSchedulerDelegate = nil
|
||||
Log.error("\(ConversationModel.TAG) Failed to create group call!")
|
||||
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_group_call_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
})
|
||||
conferenceScheduler.addDelegate(delegate: self.conferenceSchedulerDelegate!)
|
||||
|
||||
if self.conferenceDelegate != nil {
|
||||
conference.addDelegate(delegate: self.conferenceDelegate!)
|
||||
}
|
||||
}
|
||||
|
||||
func getContentTextMessage() {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
let lastMessage = self.chatRoom.lastMessageInHistory
|
||||
if lastMessage != nil {
|
||||
var fromAddressFriend = lastMessage!.fromAddress != nil
|
||||
? self.contactsManager.getFriendWithAddress(address: lastMessage!.fromAddress)?.name ?? nil
|
||||
: nil
|
||||
|
||||
if !lastMessage!.isOutgoing && lastMessage!.chatRoom != nil && !lastMessage!.chatRoom!.hasCapability(mask: ChatRoom.Capabilities.OneToOne.rawValue) {
|
||||
if fromAddressFriend == nil {
|
||||
if lastMessage!.fromAddress!.displayName != nil {
|
||||
fromAddressFriend = lastMessage!.fromAddress!.displayName! + ": "
|
||||
} else if lastMessage!.fromAddress!.username != nil {
|
||||
fromAddressFriend = lastMessage!.fromAddress!.username! + ": "
|
||||
} else {
|
||||
fromAddressFriend = ""
|
||||
}
|
||||
let lastMessage = self.chatRoom.lastMessageInHistory
|
||||
if lastMessage != nil {
|
||||
var fromAddressFriend = lastMessage!.fromAddress != nil
|
||||
? self.contactsManager.getFriendWithAddress(address: lastMessage!.fromAddress)?.name ?? nil
|
||||
: nil
|
||||
|
||||
if !lastMessage!.isOutgoing && lastMessage!.chatRoom != nil && !lastMessage!.chatRoom!.hasCapability(mask: ChatRoom.Capabilities.OneToOne.rawValue) {
|
||||
if fromAddressFriend == nil {
|
||||
if lastMessage!.fromAddress!.displayName != nil {
|
||||
fromAddressFriend = lastMessage!.fromAddress!.displayName! + ": "
|
||||
} else if lastMessage!.fromAddress!.username != nil {
|
||||
fromAddressFriend = lastMessage!.fromAddress!.username! + ": "
|
||||
} else {
|
||||
fromAddressFriend! += ": "
|
||||
fromAddressFriend = String(lastMessage!.fromAddress!.asStringUriOnly().dropFirst(4)) + ": "
|
||||
}
|
||||
|
||||
} else {
|
||||
fromAddressFriend = nil
|
||||
fromAddressFriend! += ": "
|
||||
}
|
||||
|
||||
let lastMessageTextTmp = (fromAddressFriend ?? "")
|
||||
+ (lastMessage!.contents.first(where: {$0.isText == true})?.utf8Text ?? (lastMessage!.contents.first(where: {$0.isFile == true || $0.isFileTransfer == true})?.name ?? ""))
|
||||
|
||||
let lastMessageIsOutgoingTmp = lastMessage?.isOutgoing ?? false
|
||||
|
||||
let lastMessageStateTmp = lastMessage?.state.rawValue ?? 0
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.lastMessageText = lastMessageTextTmp
|
||||
|
||||
self.lastMessageIsOutgoing = lastMessageIsOutgoingTmp
|
||||
|
||||
self.lastMessageState = lastMessageStateTmp
|
||||
}
|
||||
} else {
|
||||
fromAddressFriend = nil
|
||||
}
|
||||
|
||||
let lastMessageTextTmp = (fromAddressFriend ?? "")
|
||||
+ (lastMessage!.contents.first(where: {$0.isText == true})?.utf8Text ?? (lastMessage!.contents.first(where: {$0.isFile == true || $0.isFileTransfer == true})?.name ?? ""))
|
||||
|
||||
let lastMessageIsOutgoingTmp = lastMessage?.isOutgoing ?? false
|
||||
|
||||
let lastMessageStateTmp = lastMessage?.state.rawValue ?? 0
|
||||
|
||||
// DispatchQueue.main.async {
|
||||
self.lastMessageText = lastMessageTextTmp
|
||||
|
||||
self.lastMessageIsOutgoing = lastMessageIsOutgoingTmp
|
||||
|
||||
self.lastMessageState = lastMessageStateTmp
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
func getChatRoomSubject() {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
let addressFriend = (self.chatRoom.participants.first != nil && self.chatRoom.participants.first!.address != nil)
|
||||
? self.contactsManager.getFriendWithAddress(address: self.chatRoom.participants.first?.address)
|
||||
: nil
|
||||
|
||||
var subjectTmp = ""
|
||||
|
||||
if self.isGroup {
|
||||
subjectTmp = self.chatRoom.subject!
|
||||
} else if addressFriend != nil {
|
||||
subjectTmp = addressFriend!.name!
|
||||
} else {
|
||||
if self.chatRoom.participants.first != nil
|
||||
&& self.chatRoom.participants.first!.address != nil {
|
||||
|
||||
subjectTmp = self.chatRoom.participants.first!.address!.displayName != nil
|
||||
? self.chatRoom.participants.first!.address!.displayName!
|
||||
: self.chatRoom.participants.first!.address!.username!
|
||||
|
||||
}
|
||||
let addressFriend = (self.chatRoom.participants.first != nil && self.chatRoom.participants.first!.address != nil)
|
||||
? self.contactsManager.getFriendWithAddress(address: self.chatRoom.participants.first?.address)
|
||||
: nil
|
||||
|
||||
var subjectTmp = ""
|
||||
|
||||
if self.isGroup {
|
||||
subjectTmp = self.chatRoom.subject!
|
||||
} else if addressFriend != nil {
|
||||
subjectTmp = addressFriend!.name!
|
||||
} else {
|
||||
if self.chatRoom.participants.first != nil
|
||||
&& self.chatRoom.participants.first!.address != nil {
|
||||
|
||||
subjectTmp = self.chatRoom.participants.first!.address!.displayName != nil
|
||||
? self.chatRoom.participants.first!.address!.displayName!
|
||||
: (self.chatRoom.participants.first!.address!.username ?? String(self.chatRoom.participants.first!.address!.asStringUriOnly().dropFirst(4)))
|
||||
|
||||
}
|
||||
|
||||
let addressTmp = addressFriend?.address?.asStringUriOnly() ?? ""
|
||||
|
||||
let avatarModelTmp = addressFriend != nil && !self.isGroup
|
||||
? ContactsManager.shared.avatarListModel.first(where: {
|
||||
$0.friend!.name == addressFriend!.name
|
||||
&& $0.friend!.address!.asStringUriOnly() == addressFriend!.address!.asStringUriOnly()
|
||||
})
|
||||
?? ContactAvatarModel(
|
||||
friend: nil,
|
||||
name: subjectTmp,
|
||||
address: addressTmp,
|
||||
withPresence: false
|
||||
)
|
||||
: ContactAvatarModel(
|
||||
}
|
||||
|
||||
let addressTmp = addressFriend?.address?.asStringUriOnly() ?? ""
|
||||
|
||||
let avatarModelTmp: ContactAvatarModel
|
||||
if let addressFriend = addressFriend, !self.isGroup {
|
||||
if let existingAvatarModel = ContactsManager.shared.avatarListModel.first(where: {
|
||||
$0.friend?.name == addressFriend.name &&
|
||||
$0.friend?.address?.asStringUriOnly() == addressFriend.address?.asStringUriOnly()
|
||||
}) {
|
||||
avatarModelTmp = existingAvatarModel
|
||||
} else {
|
||||
avatarModelTmp = ContactAvatarModel(
|
||||
friend: nil,
|
||||
name: subjectTmp,
|
||||
address: addressTmp,
|
||||
withPresence: false
|
||||
)
|
||||
}
|
||||
} else {
|
||||
avatarModelTmp = ContactAvatarModel(
|
||||
friend: nil,
|
||||
name: subjectTmp,
|
||||
address: self.chatRoom.peerAddress?.asStringUriOnly() ?? addressTmp,
|
||||
withPresence: false
|
||||
)
|
||||
|
||||
var participantsAddressTmp: [String] = []
|
||||
|
||||
self.chatRoom.participants.forEach { participant in
|
||||
participantsAddressTmp.append(participant.address?.asStringUriOnly() ?? "")
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.subject = subjectTmp
|
||||
self.avatarModel = avatarModelTmp
|
||||
self.participantsAddress = participantsAddressTmp
|
||||
}
|
||||
}
|
||||
|
||||
var participantsAddressTmp: [String] = []
|
||||
|
||||
self.chatRoom.participants.forEach { participant in
|
||||
participantsAddressTmp.append(participant.address?.asStringUriOnly() ?? "")
|
||||
}
|
||||
|
||||
// DispatchQueue.main.async {
|
||||
self.subject = subjectTmp
|
||||
self.avatarModel = avatarModelTmp
|
||||
self.participantsAddress = participantsAddressTmp
|
||||
// }
|
||||
}
|
||||
|
||||
func getUnreadMessagesCount() {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
let unreadMessagesCountTmp = self.chatRoom.unreadMessagesCount
|
||||
DispatchQueue.main.async {
|
||||
self.unreadMessagesCount = unreadMessagesCountTmp
|
||||
}
|
||||
}
|
||||
let unreadMessagesCountTmp = self.chatRoom.unreadMessagesCount
|
||||
// DispatchQueue.main.async {
|
||||
self.unreadMessagesCount = unreadMessagesCountTmp
|
||||
// }
|
||||
}
|
||||
|
||||
func refreshAvatarModel() {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,13 @@ class EventModel: ObservableObject {
|
|||
if let addressFriend = friendResult {
|
||||
name = addressFriend.name!
|
||||
} else {
|
||||
name = address!.displayName != nil ? address!.displayName! : address!.username!
|
||||
if address!.displayName != nil {
|
||||
name = address!.displayName!
|
||||
} else if address!.username != nil {
|
||||
name = address!.username!
|
||||
} else {
|
||||
name = String(address!.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
|
||||
let textValue: String
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import linphonesw
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class ConversationForwardMessageViewModel: ObservableObject {
|
||||
|
|
@ -84,7 +85,7 @@ class ConversationForwardMessageViewModel: ObservableObject {
|
|||
let account = core.defaultAccount
|
||||
if account == nil {
|
||||
Log.error(
|
||||
"\(StartConversationViewModel.TAG) No default account found, can't create conversation with \(remote.asStringUriOnly())!"
|
||||
"\(ConversationForwardMessageViewModel.TAG) No default account found, can't create conversation with \(remote.asStringUriOnly())"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
|
@ -94,37 +95,42 @@ class ConversationForwardMessageViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
do {
|
||||
let params: ChatRoomParams = try core.createDefaultChatRoomParams()
|
||||
let params = try core.createConferenceParams(conference: nil)
|
||||
params.chatEnabled = true
|
||||
params.groupEnabled = false
|
||||
params.subject = "Dummy subject"
|
||||
params.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
params.subject = NSLocalizedString("conversation_one_to_one_hidden_subject", comment: "")
|
||||
params.account = account
|
||||
|
||||
let sameDomain = remote.domain == account?.params?.domain ?? ""
|
||||
if StartConversationViewModel.isEndToEndEncryptionMandatory() && sameDomain {
|
||||
Log.info("\(StartConversationViewModel.TAG) Account is in secure mode & domain matches, creating a E2E conversation")
|
||||
params.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.encryptionEnabled = true
|
||||
} else if !StartConversationViewModel.isEndToEndEncryptionMandatory() {
|
||||
guard let chatParams = params.chatParams else { return }
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
let sameDomain = remote.domain == CorePreferences.defaultDomain && remote.domain == account!.params?.domain
|
||||
if account!.params != nil && (account!.params!.instantMessagingEncryptionMandatory && sameDomain) {
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) Account is in secure mode & domain matches, creating an E2E encrypted conversation")
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
} else if account!.params != nil && (!account!.params!.instantMessagingEncryptionMandatory) {
|
||||
if LinphoneUtils.isEndToEndEncryptedChatAvailable(core: core) {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) Account is in interop mode but LIME is available, creating a E2E conversation"
|
||||
"\(ConversationForwardMessageViewModel.TAG) Account is in interop mode but LIME is available, creating an E2E encrypted conversation"
|
||||
)
|
||||
params.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.encryptionEnabled = true
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
} else {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) Account is in interop mode but LIME isn't available, creating a SIP simple conversation"
|
||||
"\(ConversationForwardMessageViewModel.TAG) Account is in interop mode but LIME isn't available, creating a SIP simple conversation"
|
||||
)
|
||||
params.backend = ChatRoom.Backend.Basic
|
||||
params.encryptionEnabled = false
|
||||
chatParams.backend = ChatRoom.Backend.Basic
|
||||
params.securityLevel = Conference.SecurityLevel.None
|
||||
}
|
||||
} else {
|
||||
Log.error(
|
||||
"\(StartConversationViewModel.TAG) Account is in secure mode, can't chat with SIP address of different domain \(remote.asStringUriOnly())"
|
||||
"\(ConversationForwardMessageViewModel.TAG) Account is in secure mode, can't chat with SIP address of different domain \(remote.asStringUriOnly())"
|
||||
)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_invalid_participant_error"
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
return
|
||||
|
|
@ -135,85 +141,56 @@ class ConversationForwardMessageViewModel: ObservableObject {
|
|||
let existingChatRoom = core.searchChatRoom(params: params, localAddr: localAddress, remoteAddr: nil, participants: participants)
|
||||
if existingChatRoom == nil {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) No existing 1-1 conversation between local account "
|
||||
+ "\(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) was found for given parameters, let's create it"
|
||||
"\(ConversationForwardMessageViewModel.TAG) No existing 1-1 conversation between local account \(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) was found for given parameters, let's create it"
|
||||
)
|
||||
let chatRoom = try core.createChatRoom(params: params, localAddr: localAddress, participants: participants)
|
||||
if params.backend == ChatRoom.Backend.FlexisipChat {
|
||||
if chatRoom.state == ChatRoom.State.Created {
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) 1-1 conversation \(id) has been created")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
do {
|
||||
let chatRoom = try core.createChatRoom(params: params, participants: participants)
|
||||
if chatParams.backend == ChatRoom.Backend.FlexisipChat {
|
||||
let state = chatRoom.state
|
||||
if state == ChatRoom.State.Created {
|
||||
let chatRoomId = LinphoneUtils.getConversationId(chatRoom: chatRoom)
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) 1-1 conversation \(chatRoomId) has been created")
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) Conversation isn't in Created state yet (state is \(state)), wait for it")
|
||||
self.chatRoomAddDelegate(core: core, chatRoom: chatRoom)
|
||||
}
|
||||
} else {
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation isn't in Created state yet, wait for it")
|
||||
self.chatRoomAddDelegate(core: core, chatRoom: chatRoom)
|
||||
}
|
||||
} else {
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation successfully created \(id)")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
let chatRoomId = LinphoneUtils.getConversationId(chatRoom: chatRoom)
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) Conversation successfully created \(chatRoomId)")
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Log.error("\(ConversationForwardMessageViewModel.TAG) Failed to create 1-1 conversation with \(remote.asStringUriOnly())")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.warn(
|
||||
"\(StartConversationViewModel.TAG) A 1-1 conversation between local account \(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) for given parameters already exists!"
|
||||
"\(ConversationForwardMessageViewModel.TAG) A 1-1 conversation between local account \(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) for given parameters already exists!"
|
||||
)
|
||||
|
||||
let model = ConversationModel(chatRoom: existingChatRoom!)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
Log.error("\(StartConversationViewModel.TAG) Failed to create 1-1 conversation with \(remote.asStringUriOnly())!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -223,7 +200,7 @@ class ConversationForwardMessageViewModel: ObservableObject {
|
|||
let state = chatRoom.state
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
if state == ChatRoom.State.CreationFailed {
|
||||
Log.error("\(StartConversationViewModel.TAG) Conversation \(id) creation has failed!")
|
||||
Log.error("\(ConversationForwardMessageViewModel.TAG) Conversation \(id) creation has failed!")
|
||||
if let chatRoomDelegate = self.chatRoomDelegate {
|
||||
chatRoom.removeDelegate(delegate: chatRoomDelegate)
|
||||
}
|
||||
|
|
@ -237,9 +214,9 @@ class ConversationForwardMessageViewModel: ObservableObject {
|
|||
}, onConferenceJoined: { (chatRoom: ChatRoom, _: EventLog) in
|
||||
let state = chatRoom.state
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation \(id) \(chatRoom.subject ?? "") state changed: \(state)")
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) Conversation \(id) \(chatRoom.subject ?? "") state changed: \(state)")
|
||||
if state == ChatRoom.State.Created {
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation \(id) successfully created")
|
||||
Log.info("\(ConversationForwardMessageViewModel.TAG) Conversation \(id) successfully created")
|
||||
if let chatRoomDelegate = self.chatRoomDelegate {
|
||||
chatRoom.removeDelegate(delegate: chatRoomDelegate)
|
||||
}
|
||||
|
|
@ -262,7 +239,7 @@ class ConversationForwardMessageViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
} else if state == ChatRoom.State.CreationFailed {
|
||||
Log.error("\(StartConversationViewModel.TAG) Conversation \(id) creation has failed!")
|
||||
Log.error("\(ConversationForwardMessageViewModel.TAG) Conversation \(id) creation has failed!")
|
||||
if let chatRoomDelegate = self.chatRoomDelegate {
|
||||
chatRoom.removeDelegate(delegate: chatRoomDelegate)
|
||||
}
|
||||
|
|
@ -280,8 +257,7 @@ class ConversationForwardMessageViewModel: ObservableObject {
|
|||
func forwardMessage() {
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
if self.displayedConversation != nil && self.selectedMessage != nil {
|
||||
let chatMessageToDisplay = self.displayedConversation!.chatRoom.findEventLog(messageId: self.selectedMessage!.eventModel.eventLogId)?.chatMessage
|
||||
if let messageToForward = chatMessageToDisplay {
|
||||
if let messageToForward = self.selectedMessage!.eventModel.eventLog.chatMessage {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
do {
|
||||
let forwardedMessage = try self.displayedConversation!.chatRoom.createForwardMessage(message: messageToForward)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import Foundation
|
||||
import linphonesw
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class ConversationsListViewModel: ObservableObject {
|
||||
|
|
@ -47,35 +48,180 @@ class ConversationsListViewModel: ObservableObject {
|
|||
let chatRooms = account != nil ? account!.chatRooms : core.chatRooms
|
||||
|
||||
self.conversationsListTmp = []
|
||||
DispatchQueue.main.async {
|
||||
self.conversationsList = []
|
||||
}
|
||||
|
||||
chatRooms.forEach { chatRoom in
|
||||
if filter.isEmpty {
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
self.conversationsListTmp.append(model)
|
||||
DispatchQueue.main.async {
|
||||
self.conversationsList.append(model)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.conversationsList = self.conversationsListTmp
|
||||
NotificationCenter.default.post(name: NSNotification.Name("ChatRoomsComputed"), object: nil)
|
||||
}
|
||||
|
||||
self.updateUnreadMessagesCount()
|
||||
}
|
||||
}
|
||||
|
||||
func updateChatRoomsList() {
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
if !self.conversationsListTmp.isEmpty {
|
||||
self.contactsManager.avatarListModel.forEach { contactAvatarModel in
|
||||
self.conversationsListTmp.forEach { conversationModel in
|
||||
if conversationModel.participantsAddress.contains(contactAvatarModel.address) {
|
||||
if conversationModel.isGroup && conversationModel.participantsAddress.count > 1 {
|
||||
if let lastMessage = conversationModel.chatRoom.lastMessageInHistory, let fromAddress = lastMessage.fromAddress, fromAddress.asStringUriOnly().contains(contactAvatarModel.address) {
|
||||
var fromAddressFriend = self.contactsManager.getFriendWithAddress(address: fromAddress)?.name
|
||||
|
||||
if !lastMessage.isOutgoing && lastMessage.chatRoom != nil && !lastMessage.chatRoom!.hasCapability(mask: ChatRoom.Capabilities.OneToOne.rawValue) {
|
||||
if fromAddressFriend == nil {
|
||||
if let displayName = fromAddress.displayName {
|
||||
fromAddressFriend = displayName + ": "
|
||||
} else if let username = fromAddress.username {
|
||||
fromAddressFriend = username + ": "
|
||||
} else {
|
||||
fromAddressFriend = String(fromAddress.asStringUriOnly().dropFirst(4)) + ": "
|
||||
}
|
||||
} else {
|
||||
fromAddressFriend! += ": "
|
||||
}
|
||||
} else {
|
||||
fromAddressFriend = nil
|
||||
}
|
||||
|
||||
let lastMessageTextTmp = (fromAddressFriend ?? "") + (lastMessage.contents.first(where: { $0.isText })?.utf8Text ?? (lastMessage.contents.first(where: { $0.isFile || $0.isFileTransfer })?.name ?? ""))
|
||||
|
||||
if let index = self.conversationsList.firstIndex(where: { $0.chatRoom === conversationModel.chatRoom }) {
|
||||
DispatchQueue.main.async {
|
||||
conversationModel.lastMessageText = lastMessageTextTmp
|
||||
self.conversationsList[index].lastMessageText = lastMessageTextTmp
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
conversationModel.lastMessageText = lastMessageTextTmp
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if !conversationModel.isGroup, let firstParticipantAddress = conversationModel.participantsAddress.first, firstParticipantAddress.contains(contactAvatarModel.address) {
|
||||
if let index = self.conversationsList.firstIndex(where: { $0.chatRoom === conversationModel.chatRoom }) {
|
||||
DispatchQueue.main.async {
|
||||
conversationModel.avatarModel = contactAvatarModel
|
||||
conversationModel.subject = contactAvatarModel.name
|
||||
self.conversationsList[index].avatarModel = contactAvatarModel
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
conversationModel.avatarModel = contactAvatarModel
|
||||
conversationModel.subject = contactAvatarModel.name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateChatRoom(address: String) {
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
if let contactAvatarModel = self.contactsManager.avatarListModel.first(where: { $0.addresses.contains(address) }) {
|
||||
self.conversationsListTmp.forEach { conversationModel in
|
||||
if conversationModel.participantsAddress.contains(contactAvatarModel.address) {
|
||||
if conversationModel.isGroup && conversationModel.participantsAddress.count > 1 {
|
||||
if let lastMessage = conversationModel.chatRoom.lastMessageInHistory, let fromAddress = lastMessage.fromAddress, fromAddress.asStringUriOnly().contains(contactAvatarModel.address) {
|
||||
var fromAddressFriend = self.contactsManager.getFriendWithAddress(address: fromAddress)?.name
|
||||
|
||||
if !lastMessage.isOutgoing && lastMessage.chatRoom != nil && !lastMessage.chatRoom!.hasCapability(mask: ChatRoom.Capabilities.OneToOne.rawValue) {
|
||||
if fromAddressFriend == nil {
|
||||
if let displayName = fromAddress.displayName {
|
||||
fromAddressFriend = displayName + ": "
|
||||
} else if let username = fromAddress.username {
|
||||
fromAddressFriend = username + ": "
|
||||
} else {
|
||||
fromAddressFriend = String(fromAddress.asStringUriOnly().dropFirst(4)) + ": "
|
||||
}
|
||||
} else {
|
||||
fromAddressFriend! += ": "
|
||||
}
|
||||
} else {
|
||||
fromAddressFriend = nil
|
||||
}
|
||||
|
||||
let lastMessageTextTmp = (fromAddressFriend ?? "") + (lastMessage.contents.first(where: { $0.isText })?.utf8Text ?? (lastMessage.contents.first(where: { $0.isFile || $0.isFileTransfer })?.name ?? ""))
|
||||
|
||||
if let index = self.conversationsList.firstIndex(where: { $0.chatRoom === conversationModel.chatRoom }) {
|
||||
DispatchQueue.main.async {
|
||||
conversationModel.lastMessageText = lastMessageTextTmp
|
||||
self.conversationsList[index].lastMessageText = lastMessageTextTmp
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
conversationModel.lastMessageText = lastMessageTextTmp
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if !conversationModel.isGroup, let firstParticipantAddress = conversationModel.participantsAddress.first, firstParticipantAddress.contains(contactAvatarModel.address) {
|
||||
if let index = self.conversationsList.firstIndex(where: { $0.chatRoom === conversationModel.chatRoom }) {
|
||||
DispatchQueue.main.async {
|
||||
conversationModel.avatarModel = contactAvatarModel
|
||||
conversationModel.subject = contactAvatarModel.name
|
||||
self.conversationsList[index].avatarModel = contactAvatarModel
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
conversationModel.avatarModel = contactAvatarModel
|
||||
conversationModel.subject = contactAvatarModel.name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func addConversationDelegate() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
let account = core.defaultAccount
|
||||
let chatRoomsCounter = account?.chatRooms != nil ? account!.chatRooms.count : core.chatRooms.count
|
||||
|
||||
self.coreConversationDelegate = CoreDelegateStub(onMessagesReceived: { (_: Core, _: ChatRoom, _: [ChatMessage]) in
|
||||
self.computeChatRoomsList(filter: "")
|
||||
}, onMessageSent: { (_: Core, _: ChatRoom, _: ChatMessage) in
|
||||
self.computeChatRoomsList(filter: "")
|
||||
}, onChatRoomRead: { (_: Core, _: ChatRoom) in
|
||||
self.computeChatRoomsList(filter: "")
|
||||
}, onChatRoomStateChanged: { (core: Core, chatRoom: ChatRoom, state: ChatRoom.State) in
|
||||
self.coreConversationDelegate = CoreDelegateStub(onMessagesReceived: { (_: Core, chatRoom: ChatRoom, _: [ChatMessage]) in
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
let idTmp = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
let index = self.conversationsList.firstIndex(where: { $0.id == idTmp })
|
||||
DispatchQueue.main.async {
|
||||
if index != nil {
|
||||
self.conversationsList.remove(at: index!)
|
||||
}
|
||||
self.conversationsList.insert(model, at: 0)
|
||||
}
|
||||
self.updateUnreadMessagesCount()
|
||||
}, onMessageSent: { (_: Core, chatRoom: ChatRoom, _: ChatMessage) in
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
let idTmp = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
let index = self.conversationsList.firstIndex(where: { $0.id == idTmp })
|
||||
DispatchQueue.main.async {
|
||||
if index != nil {
|
||||
self.conversationsList.remove(at: index!)
|
||||
}
|
||||
self.conversationsList.insert(model, at: 0)
|
||||
}
|
||||
self.updateUnreadMessagesCount()
|
||||
}, onChatRoomRead: { (_: Core, chatRoom: ChatRoom) in
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
let idTmp = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
let index = self.conversationsList.firstIndex(where: { $0.id == idTmp })
|
||||
DispatchQueue.main.async {
|
||||
if index != nil {
|
||||
self.conversationsList.remove(at: index!)
|
||||
self.conversationsList.insert(model, at: index!)
|
||||
} else {
|
||||
self.conversationsList.insert(model, at: 0)
|
||||
}
|
||||
}
|
||||
self.updateUnreadMessagesCount()
|
||||
}, onChatRoomStateChanged: { (core: Core, _: ChatRoom, state: ChatRoom.State) in
|
||||
// Log.info("[ConversationsListViewModel] Conversation [${LinphoneUtils.getChatRoomId(chatRoom)}] state changed [$state]")
|
||||
if core.globalState == .On {
|
||||
switch state {
|
||||
|
|
@ -134,7 +280,7 @@ class ConversationsListViewModel: ObservableObject {
|
|||
} else if message.fromAddress!.username != nil {
|
||||
fromAddressFriend = message.fromAddress!.username! + ": "
|
||||
} else {
|
||||
fromAddressFriend = ""
|
||||
fromAddressFriend = String(message.fromAddress!.asStringUriOnly().dropFirst(4)) + ": "
|
||||
}
|
||||
} else {
|
||||
fromAddressFriend! += ": "
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import linphonesw
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class StartConversationViewModel: ObservableObject {
|
||||
|
|
@ -78,27 +79,31 @@ class StartConversationViewModel: ObservableObject {
|
|||
|
||||
let groupChatRoomSubject = self.messageText
|
||||
do {
|
||||
let params: ChatRoomParams = try core.createDefaultChatRoomParams()
|
||||
params.groupEnabled = true
|
||||
params.subject = groupChatRoomSubject
|
||||
params.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.encryptionEnabled = true
|
||||
let chatRoomParams = try core.createConferenceParams(conference: nil)
|
||||
chatRoomParams.chatEnabled = true
|
||||
chatRoomParams.groupEnabled = true
|
||||
chatRoomParams.subject = groupChatRoomSubject
|
||||
chatRoomParams.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
chatRoomParams.account = account
|
||||
|
||||
if let chatParams = chatRoomParams.chatParams {
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
}
|
||||
|
||||
var participantsTmp: [Address] = []
|
||||
self.participants.forEach { participant in
|
||||
participantsTmp.append(participant.address)
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.participants.removeAll()
|
||||
}
|
||||
|
||||
if account!.params != nil {
|
||||
let localAddress = account!.params!.identityAddress
|
||||
let chatRoom = try core.createChatRoom(params: chatRoomParams, participants: participantsTmp)
|
||||
|
||||
let chatRoom = try core.createChatRoom(
|
||||
params: params,
|
||||
localAddr: localAddress,
|
||||
participants: participantsTmp
|
||||
)
|
||||
|
||||
if params.backend == ChatRoom.Backend.FlexisipChat {
|
||||
if chatRoomParams.chatParams != nil && chatRoomParams.chatParams!.backend == ChatRoom.Backend.FlexisipChat {
|
||||
if chatRoom.state == ChatRoom.State.Created {
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info(
|
||||
|
|
@ -106,20 +111,9 @@ class StartConversationViewModel: ObservableObject {
|
|||
)
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
Log.info(
|
||||
|
|
@ -132,20 +126,9 @@ class StartConversationViewModel: ObservableObject {
|
|||
Log.info("\(StartConversationViewModel.TAG) Conversation successfully created \(id) \(groupChatRoomSubject)")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -163,11 +146,11 @@ class StartConversationViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func createOneToOneChatRoomWith(remote: Address) {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
let account = core.defaultAccount
|
||||
if account == nil {
|
||||
Log.error(
|
||||
"\(StartConversationViewModel.TAG) No default account found, can't create conversation with \(remote.asStringUriOnly())!"
|
||||
"\(StartConversationViewModel.TAG) No default account found, can't create conversation with \(remote.asStringUriOnly())"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
|
@ -177,37 +160,42 @@ class StartConversationViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
do {
|
||||
let params: ChatRoomParams = try core.createDefaultChatRoomParams()
|
||||
let params = try core.createConferenceParams(conference: nil)
|
||||
params.chatEnabled = true
|
||||
params.groupEnabled = false
|
||||
params.subject = "Dummy subject"
|
||||
params.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
params.subject = NSLocalizedString("conversation_one_to_one_hidden_subject", comment: "")
|
||||
params.account = account
|
||||
|
||||
let sameDomain = remote.domain == account?.params?.domain ?? ""
|
||||
if StartConversationViewModel.isEndToEndEncryptionMandatory() && sameDomain {
|
||||
Log.info("\(StartConversationViewModel.TAG) Account is in secure mode & domain matches, creating a E2E conversation")
|
||||
params.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.encryptionEnabled = true
|
||||
} else if !StartConversationViewModel.isEndToEndEncryptionMandatory() {
|
||||
guard let chatParams = params.chatParams else { return }
|
||||
chatParams.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
|
||||
let sameDomain = remote.domain == CorePreferences.defaultDomain && remote.domain == account!.params?.domain
|
||||
if account!.params != nil && (account!.params!.instantMessagingEncryptionMandatory && sameDomain) {
|
||||
Log.info("\(StartConversationViewModel.TAG) Account is in secure mode & domain matches, creating an E2E encrypted conversation")
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
} else if account!.params != nil && (!account!.params!.instantMessagingEncryptionMandatory) {
|
||||
if LinphoneUtils.isEndToEndEncryptedChatAvailable(core: core) {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) Account is in interop mode but LIME is available, creating a E2E conversation"
|
||||
"\(StartConversationViewModel.TAG) Account is in interop mode but LIME is available, creating an E2E encrypted conversation"
|
||||
)
|
||||
params.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.encryptionEnabled = true
|
||||
chatParams.backend = ChatRoom.Backend.FlexisipChat
|
||||
params.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
} else {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) Account is in interop mode but LIME isn't available, creating a SIP simple conversation"
|
||||
)
|
||||
params.backend = ChatRoom.Backend.Basic
|
||||
params.encryptionEnabled = false
|
||||
chatParams.backend = ChatRoom.Backend.Basic
|
||||
params.securityLevel = Conference.SecurityLevel.None
|
||||
}
|
||||
} else {
|
||||
Log.error(
|
||||
"\(StartConversationViewModel.TAG) Account is in secure mode, can't chat with SIP address of different domain \(remote.asStringUriOnly())"
|
||||
)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_invalid_participant_error"
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
return
|
||||
|
|
@ -218,85 +206,56 @@ class StartConversationViewModel: ObservableObject {
|
|||
let existingChatRoom = core.searchChatRoom(params: params, localAddr: localAddress, remoteAddr: nil, participants: participants)
|
||||
if existingChatRoom == nil {
|
||||
Log.info(
|
||||
"\(StartConversationViewModel.TAG) No existing 1-1 conversation between local account "
|
||||
+ "\(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) was found for given parameters, let's create it"
|
||||
"\(StartConversationViewModel.TAG) No existing 1-1 conversation between local account \(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) was found for given parameters, let's create it"
|
||||
)
|
||||
let chatRoom = try core.createChatRoom(params: params, localAddr: localAddress, participants: participants)
|
||||
if params.backend == ChatRoom.Backend.FlexisipChat {
|
||||
if chatRoom.state == ChatRoom.State.Created {
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) 1-1 conversation \(id) has been created")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
do {
|
||||
let chatRoom = try core.createChatRoom(params: params, participants: participants)
|
||||
if chatParams.backend == ChatRoom.Backend.FlexisipChat {
|
||||
let state = chatRoom.state
|
||||
if state == ChatRoom.State.Created {
|
||||
let chatRoomId = LinphoneUtils.getConversationId(chatRoom: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) 1-1 conversation \(chatRoomId) has been created")
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation isn't in Created state yet (state is \(state)), wait for it")
|
||||
self.chatRoomAddDelegate(core: core, chatRoom: chatRoom)
|
||||
}
|
||||
} else {
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation isn't in Created state yet, wait for it")
|
||||
self.chatRoomAddDelegate(core: core, chatRoom: chatRoom)
|
||||
}
|
||||
} else {
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation successfully created \(id)")
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
let chatRoomId = LinphoneUtils.getConversationId(chatRoom: chatRoom)
|
||||
Log.info("\(StartConversationViewModel.TAG) Conversation successfully created \(chatRoomId)")
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Log.error("\(StartConversationViewModel.TAG) Failed to create 1-1 conversation with \(remote.asStringUriOnly())")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.warn(
|
||||
"\(StartConversationViewModel.TAG) A 1-1 conversation between local account \(localAddress?.asStringUriOnly() ?? "") and remote \(remote.asStringUriOnly()) for given parameters already exists!"
|
||||
)
|
||||
|
||||
let model = ConversationModel(chatRoom: existingChatRoom!)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_conversation_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
Log.error("\(StartConversationViewModel.TAG) Failed to create 1-1 conversation with \(remote.asStringUriOnly())!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -304,9 +263,9 @@ class StartConversationViewModel: ObservableObject {
|
|||
func chatRoomAddDelegate(core: Core, chatRoom: ChatRoom) {
|
||||
self.chatRoomDelegate = ChatRoomDelegateStub(onStateChanged: { (chatRoom: ChatRoom, state: ChatRoom.State) in
|
||||
let state = chatRoom.state
|
||||
let id = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
let chatRoomId = LinphoneUtils.getChatRoomId(room: chatRoom)
|
||||
if state == ChatRoom.State.CreationFailed {
|
||||
Log.error("\(StartConversationViewModel.TAG) Conversation \(id) creation has failed!")
|
||||
Log.error("\(StartConversationViewModel.TAG) Conversation \(chatRoomId) creation has failed!")
|
||||
if let chatRoomDelegate = self.chatRoomDelegate {
|
||||
chatRoom.removeDelegate(delegate: chatRoomDelegate)
|
||||
}
|
||||
|
|
@ -329,20 +288,9 @@ class StartConversationViewModel: ObservableObject {
|
|||
self.chatRoomDelegate = nil
|
||||
|
||||
let model = ConversationModel(chatRoom: chatRoom)
|
||||
if self.operationInProgress == false {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = true
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.displayedConversation = model
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.displayedConversation = model
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else if state == ChatRoom.State.CreationFailed {
|
||||
Log.error("\(StartConversationViewModel.TAG) Conversation \(id) creation has failed!")
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class HelpView { // TODO (basic debug moved here until halp view is implemented)
|
|||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
Core.resetLogCollection()
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Success_clear_logs"
|
||||
ToastViewModel.shared.toastMessage = "help_troubleshooting_debug_logs_cleaned_toast_message"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ struct PopupLoadingView: View {
|
|||
.padding(.top)
|
||||
.padding(.bottom)
|
||||
|
||||
Text("Opération en cours...")
|
||||
Text("operation_in_progress_overlay")
|
||||
.tint(Color.grayMain2c600)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct PopupViewWithTextField: View {
|
|||
Button(action: {
|
||||
conversationViewModel.isShowConversationInfoPopup = false
|
||||
}, label: {
|
||||
Text("Cancel")
|
||||
Text("dialog_cancel")
|
||||
.default_text_style_orange_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
@ -58,7 +58,7 @@ struct PopupViewWithTextField: View {
|
|||
Button(action: {
|
||||
conversationViewModel.setNewChatRoomSubject()
|
||||
}, label: {
|
||||
Text("Confirm")
|
||||
Text("dialog_ok")
|
||||
.default_text_style_white_600(styleSize: 20)
|
||||
.frame(height: 35)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
|
|
|||
|
|
@ -23,11 +23,16 @@ import UniformTypeIdentifiers
|
|||
|
||||
struct SideMenu: View {
|
||||
|
||||
@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
|
||||
let width: CGFloat
|
||||
let isOpen: Bool
|
||||
@Binding var isOpen: Bool
|
||||
let menuClose: () -> Void
|
||||
let safeAreaInsets: EdgeInsets
|
||||
@Binding var isShowLoginFragment: Bool
|
||||
@Binding var isShowAccountProfileFragment: Bool
|
||||
@Binding var isShowSettingsFragment: Bool
|
||||
@Binding var isShowHelpFragment: Bool
|
||||
@State private var showHelp = false
|
||||
|
||||
var body: some View {
|
||||
|
|
@ -66,7 +71,7 @@ struct SideMenu: View {
|
|||
|
||||
List {
|
||||
ForEach(0..<CoreContext.shared.accounts.count, id: \.self) { index in
|
||||
SideMenuAccountRow( model: CoreContext.shared.accounts[index])
|
||||
SideMenuAccountRow( model: CoreContext.shared.accounts[index], accountProfileViewModel: accountProfileViewModel, isOpen: $isOpen, isShowAccountProfileFragment: $isShowAccountProfileFragment)
|
||||
.background()
|
||||
.listRowInsets(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16))
|
||||
.listRowSeparator(.hidden)
|
||||
|
|
@ -121,30 +126,33 @@ struct SideMenu: View {
|
|||
ForEach(0..<CoreContext.shared.shortcuts.count, id: \.self) { index in
|
||||
SideMenuShortcut(shortcutModel: CoreContext.shared.shortcuts[index])
|
||||
}
|
||||
|
||||
SideMenuEntry(
|
||||
iconName: "gear",
|
||||
title: "settings_title"
|
||||
)
|
||||
).onTapGesture {
|
||||
self.menuClose()
|
||||
withAnimation {
|
||||
isShowSettingsFragment = true
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
SideMenuEntry(
|
||||
iconName: "record-fill",
|
||||
title: "recordings_title"
|
||||
)
|
||||
*/
|
||||
|
||||
SideMenuEntry(
|
||||
iconName: "question",
|
||||
title: "help_title"
|
||||
).onTapGesture {
|
||||
showHelp = true
|
||||
}
|
||||
.confirmationDialog("Temp Help", isPresented: $showHelp, titleVisibility: .visible) {
|
||||
Button("Send Logs") {
|
||||
HelpView.sendLogs()
|
||||
}
|
||||
Button("Clear Logs") {
|
||||
HelpView.clearLogs()
|
||||
}
|
||||
Button("Logout") {
|
||||
HelpView.logout()
|
||||
self.menuClose()
|
||||
withAnimation {
|
||||
isShowHelpFragment = true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.padding(.bottom, safeAreaInsets.bottom + 13)
|
||||
|
|
@ -170,11 +178,15 @@ struct SideMenu: View {
|
|||
GeometryReader { geometry in
|
||||
@State var triggerNavigateToLogin: Bool = false
|
||||
SideMenu(
|
||||
accountProfileViewModel: AccountProfileViewModel(),
|
||||
width: geometry.size.width / 5 * 4,
|
||||
isOpen: true,
|
||||
isOpen: .constant(true),
|
||||
menuClose: {},
|
||||
safeAreaInsets: geometry.safeAreaInsets,
|
||||
isShowLoginFragment: $triggerNavigateToLogin
|
||||
isShowLoginFragment: $triggerNavigateToLogin,
|
||||
isShowAccountProfileFragment: .constant(false),
|
||||
isShowSettingsFragment: .constant(false),
|
||||
isShowHelpFragment: .constant(false)
|
||||
)
|
||||
.ignoresSafeArea(.all)
|
||||
.zIndex(2)
|
||||
|
|
|
|||
|
|
@ -22,63 +22,103 @@ import linphonesw
|
|||
import UniformTypeIdentifiers
|
||||
|
||||
struct SideMenuAccountRow: View {
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
|
||||
@ObservedObject var model: AccountModel
|
||||
@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
|
||||
@State private var navigateToOption = false
|
||||
@Binding var isOpen: Bool
|
||||
@Binding var isShowAccountProfileFragment: Bool
|
||||
|
||||
private let avatarSize = 45.0
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
|
||||
Avatar(contactAvatarModel:
|
||||
ContactAvatarModel(friend: nil,
|
||||
name: model.displayName,
|
||||
address: model.address,
|
||||
withPresence: true),
|
||||
avatarSize: 45)
|
||||
.padding(.leading, 6)
|
||||
|
||||
VStack {
|
||||
Text(model.displayName)
|
||||
.default_text_style_grey_400(styleSize: 14)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
if accountProfileViewModel.accountModelIndex != nil && CoreContext.shared.accounts.count > accountProfileViewModel.accountModelIndex! {
|
||||
AsyncImage(url: CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex!].imagePathAvatar) { image in
|
||||
switch image {
|
||||
case .empty:
|
||||
ProgressView()
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
case .success(let image):
|
||||
image
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
case .failure:
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: model.avatarModel?.name ?? "",
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
@unknown default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
.padding(.leading, 6)
|
||||
|
||||
VStack {
|
||||
Text(model.humanReadableRegistrationState)
|
||||
.default_text_style_uncolored(styleSize: 12)
|
||||
.foregroundStyle(model.registrationStateAssociatedUIColor)
|
||||
}
|
||||
.padding(EdgeInsets(top: 4, leading: 8, bottom: 4, trailing: 8))
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(12)
|
||||
.frame(height: 20)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.onTapGesture {
|
||||
model.refreshRegiter()
|
||||
}
|
||||
}
|
||||
.padding(.leading, 4)
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack {
|
||||
if model.notificationsCount > 0 {
|
||||
Text(String(model.notificationsCount))
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 12)
|
||||
Text(model.displayName)
|
||||
.default_text_style_grey_400(styleSize: 14)
|
||||
.lineLimit(1)
|
||||
.frame(width: 20, height: 20)
|
||||
.background(Color.redDanger500)
|
||||
.cornerRadius(50)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
VStack {
|
||||
Text(model.humanReadableRegistrationState)
|
||||
.default_text_style_uncolored(styleSize: 12)
|
||||
.foregroundStyle(model.registrationStateAssociatedUIColor)
|
||||
}
|
||||
.padding(EdgeInsets(top: 4, leading: 8, bottom: 4, trailing: 8))
|
||||
.background(Color.grayMain2c200)
|
||||
.cornerRadius(12)
|
||||
.frame(height: 20)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.onTapGesture {
|
||||
model.refreshRegiter()
|
||||
}
|
||||
}
|
||||
Image("dots-three-vertical")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.scaledToFit()
|
||||
.frame(height: 30)
|
||||
.padding(.leading, 4)
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack {
|
||||
if model.notificationsCount > 0 {
|
||||
Text(String(model.notificationsCount))
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 12)
|
||||
.lineLimit(1)
|
||||
.frame(width: 20, height: 20)
|
||||
.background(Color.redDanger500)
|
||||
.cornerRadius(50)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
Menu {
|
||||
Button {
|
||||
withAnimation {
|
||||
|
||||
isOpen = false
|
||||
isShowAccountProfileFragment = true
|
||||
}
|
||||
} label: {
|
||||
Label("drawer_menu_manage_account", systemImage: "arrow.right.circle")
|
||||
}
|
||||
} label: {
|
||||
Image("dots-three-vertical")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundColor(Color.gray)
|
||||
.scaledToFit()
|
||||
.frame(height: 30)
|
||||
}
|
||||
}
|
||||
.frame(width: 64, alignment: .trailing)
|
||||
.padding(.top, 12)
|
||||
.padding(.bottom, 12)
|
||||
}
|
||||
.frame(width: 64, alignment: .trailing)
|
||||
.padding(.top, 12)
|
||||
.padding(.bottom, 12)
|
||||
}
|
||||
.frame(height: 61)
|
||||
.background(model.isDefaultAccount ? Color.grayMain2c100 : .clear)
|
||||
|
|
|
|||
|
|
@ -52,8 +52,3 @@ struct SideMenuShortcut: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SideMenuShortcut(shortcutModel: ShortcutModel(linkUrl: URL("link")!, name: "name", iconLinkUrl: URL("icon")!)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,43 +52,57 @@ struct ToastView: View {
|
|||
}
|
||||
|
||||
switch toastViewModel.toastMessage {
|
||||
case "Successful":
|
||||
Text("QR code validated!")
|
||||
case "Success_qr_code_validated":
|
||||
Text("qr_code_validated")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_version_up_to_date":
|
||||
Text("help_version_up_to_date_toast_message")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_remove_call_logs":
|
||||
Text("History has been deleted")
|
||||
Text("call_history_deleted_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_clear_logs":
|
||||
Text("Logs cleared")
|
||||
Text("help_troubleshooting_debug_logs_cleaned_toast_message")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_send_logs":
|
||||
Text("Logs URL copied into clipboard")
|
||||
Text("debug_logs_copied_to_clipboard_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_address_copied_into_clipboard":
|
||||
Text("SIP address copied into clipboard")
|
||||
Text("sip_address_copied_to_clipboard_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_message_copied_into_clipboard":
|
||||
Text("Message copied into clipboard")
|
||||
Text("message_copied_to_clipboard_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_text_copied_into_clipboard":
|
||||
Text("text_copied_to_clipboard_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
|
|
@ -109,105 +123,112 @@ struct ToastView: View {
|
|||
.padding(8)
|
||||
|
||||
case "Failed":
|
||||
Text("Invalid QR code!")
|
||||
Text("assistant_qr_code_invalid_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Invalide URI":
|
||||
Text("Invalide URI")
|
||||
Text("assistant_invalid_uri_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Registration_failed":
|
||||
Text("The user name or password is incorrects")
|
||||
Text("assistant_account_login_forbidden_error")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Unavailable_network":
|
||||
Text("Network is not reachable")
|
||||
Text("network_not_reachable")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_toast_network_connected":
|
||||
Text("Network is now reachable again")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_account_logged_out":
|
||||
Text("Account successfully logged out")
|
||||
Text("network_reachable_again")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_toast_call_transfer_successful":
|
||||
Text("Call has been successfully transferred")
|
||||
Text("call_transfer_successful_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_toast_call_transfer_in_progress":
|
||||
Text("Call is being transferred")
|
||||
Text("call_transfer_in_progress_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_toast_meeting_deleted":
|
||||
Text("Successfully removed meeting")
|
||||
Text("meeting_info_deleted_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_meeting_info_created_toast":
|
||||
Text("meeting_info_created_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Success_meeting_info_updated_toast":
|
||||
Text("meeting_info_updated_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Failed_toast_call_transfer_failed":
|
||||
Text("Call transfer failed!")
|
||||
Text("call_transfer_failed_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Failed_uri_handler_call_failed":
|
||||
Text("Call failed")
|
||||
Text("uri_handler_call_failed_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Failed_uri_handler_config_failed":
|
||||
Text("Configuration failed")
|
||||
Text("uri_handler_config_failed_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "uri_handler_config_success":
|
||||
Text("Configuration successfully applied")
|
||||
Text("uri_handler_config_success_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Failed_uri_handler_bad_call_address":
|
||||
Text("Unable to call, invalid address")
|
||||
Text("uri_handler_bad_call_address_failed_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Failed_uri_handler_bad_config_address":
|
||||
Text("Unable to retrieve configuration, invalid address")
|
||||
Text("uri_handler_bad_config_address_failed_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
|
|
@ -254,21 +275,42 @@ struct ToastView: View {
|
|||
.foregroundStyle(Color.redDanger500)
|
||||
|
||||
case "Meeting_added_to_calendar":
|
||||
Text("Meeting added to iPhone calendar")
|
||||
Text("meeting_exported_as_calendar_event")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.greenSuccess500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Failed_meeting_invitations_not_sent":
|
||||
Text("Could not send ICS invitations to meeting to any participant")
|
||||
case "meeting_failed_to_edit_toast":
|
||||
Text("meeting_failed_to_edit_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "meeting_failed_to_schedule_toast":
|
||||
Text("meeting_failed_to_schedule_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "meeting_failed_to_send_invites_toast":
|
||||
Text("meeting_failed_to_send_invites_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "meeting_failed_to_send_part_of_invites_toast":
|
||||
Text("meeting_failed_to_send_part_of_invites_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Failed_no_subject_or_participant":
|
||||
Text("A subject and at least one participant is required to create a meeting")
|
||||
Text("meeting_schedule_failed_no_subject_or_participant_toast")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
|
|
|
|||
239
Linphone/UI/Main/Help/Fragments/DebugFragment.swift
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
struct DebugFragment: View {
|
||||
@ObservedObject var helpViewModel: HelpViewModel
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
@State private var showShareSheet: Bool = false
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
VStack(spacing: 1) {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.orangeMain500)
|
||||
.edgesIgnoringSafeArea(.top)
|
||||
.frame(height: 0)
|
||||
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
.padding(.top, 4)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
Text("help_troubleshooting_title")
|
||||
.default_text_style_orange_800(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.top, 4)
|
||||
.lineLimit(1)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 50)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, 4)
|
||||
.background(.white)
|
||||
|
||||
ScrollView {
|
||||
VStack(spacing: 0) {
|
||||
VStack(spacing: 20) {
|
||||
/*
|
||||
Toggle("help_troubleshooting_print_logs_in_logcat", isOn: $helpViewModel.logcat)
|
||||
.default_text_style_700(styleSize: 15)
|
||||
*/
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
Button(
|
||||
action: {
|
||||
helpViewModel.cleanLogs()
|
||||
}, label: {
|
||||
Text("help_troubleshooting_clean_logs")
|
||||
.default_text_style_orange_500(styleSize: 14)
|
||||
.lineLimit(1)
|
||||
}
|
||||
)
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain100)
|
||||
.cornerRadius(60)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(
|
||||
action: {
|
||||
helpViewModel.shareLogs()
|
||||
}, label: {
|
||||
Text("help_troubleshooting_share_logs")
|
||||
.default_text_style_orange_500(styleSize: 14)
|
||||
.lineLimit(1)
|
||||
}
|
||||
)
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain100)
|
||||
.cornerRadius(60)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Button {
|
||||
UIPasteboard.general.setValue(
|
||||
helpViewModel.version,
|
||||
forPasteboardType: UTType.plainText.identifier
|
||||
)
|
||||
ToastViewModel.shared.toastMessage = "Success_text_copied_into_clipboard"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
} label: {
|
||||
HStack {
|
||||
Image("app-store-logo")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
VStack {
|
||||
Text("help_troubleshooting_app_version_title")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Text(helpViewModel.version)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
.padding(.horizontal, 5)
|
||||
|
||||
Image("copy")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
}
|
||||
}
|
||||
Button {
|
||||
UIPasteboard.general.setValue(
|
||||
helpViewModel.sdkVersion,
|
||||
forPasteboardType: UTType.plainText.identifier
|
||||
)
|
||||
ToastViewModel.shared.toastMessage = "Success_text_copied_into_clipboard"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
} label: {
|
||||
HStack {
|
||||
Image("package")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
VStack {
|
||||
Text("help_troubleshooting_sdk_version_title")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Text(helpViewModel.sdkVersion)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
.padding(.horizontal, 5)
|
||||
|
||||
Image("copy")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
}
|
||||
}
|
||||
Button {
|
||||
} label: {
|
||||
HStack {
|
||||
Image("fire")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
VStack {
|
||||
Text("help_troubleshooting_firebase_project_title")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Text(helpViewModel.firebaseProjectId)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
.padding(.horizontal, 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 20)
|
||||
.padding(.horizontal, 20)
|
||||
.background(Color.gray100)
|
||||
}
|
||||
}
|
||||
.background(Color.gray100)
|
||||
}
|
||||
.background(Color.gray100)
|
||||
|
||||
if helpViewModel.logsUploadInProgress {
|
||||
PopupLoadingView()
|
||||
.background(.black.opacity(0.65))
|
||||
}
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.onChange(of: helpViewModel.logText) { _ in
|
||||
showShareSheet = true
|
||||
}
|
||||
.sheet(isPresented: $showShareSheet) {
|
||||
ShareAnySheet(items: [helpViewModel.logText])
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ShareAnySheet: UIViewControllerRepresentable {
|
||||
var items: [Any] // The content to share
|
||||
|
||||
func makeUIViewController(context: Context) -> UIActivityViewController {
|
||||
UIActivityViewController(activityItems: items, applicationActivities: nil)
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {
|
||||
// No updates needed
|
||||
}
|
||||
}
|
||||
275
Linphone/UI/Main/Help/Fragments/HelpFragment.swift
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct HelpFragment: View {
|
||||
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var helpViewModel: HelpViewModel
|
||||
|
||||
@Binding var isShowHelpFragment: Bool
|
||||
|
||||
@State var advancedSettingsIsOpen: Bool = false
|
||||
|
||||
@FocusState var isVoicemailUriFocused: Bool
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
ZStack {
|
||||
VStack(spacing: 1) {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.orangeMain500)
|
||||
.edgesIgnoringSafeArea(.top)
|
||||
.frame(height: 0)
|
||||
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
.padding(.top, 4)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
isShowHelpFragment = false
|
||||
}
|
||||
}
|
||||
|
||||
Text("help_title")
|
||||
.default_text_style_orange_800(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.top, 4)
|
||||
.lineLimit(1)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 50)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, 4)
|
||||
.background(.white)
|
||||
|
||||
ScrollView {
|
||||
VStack(spacing: 0) {
|
||||
VStack(spacing: 20) {
|
||||
Text("help_about_title")
|
||||
.default_text_style_800(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.bottom, 5)
|
||||
|
||||
Button {
|
||||
if let url = URL(string: NSLocalizedString("website_privacy_policy_url", comment: "")) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
Image("detective")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
VStack {
|
||||
Text("help_about_privacy_policy_title")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Text("help_about_privacy_policy_subtitle")
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
.padding(.horizontal, 5)
|
||||
|
||||
Image("arrow-square-out")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
Image("info")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
VStack {
|
||||
Text("help_about_version_title")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Text(helpViewModel.version)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
.padding(.horizontal, 5)
|
||||
|
||||
Button(
|
||||
action: {
|
||||
helpViewModel.checkForUpdate()
|
||||
}, label: {
|
||||
Text("help_about_check_for_update")
|
||||
.default_text_style_orange_500(styleSize: 14)
|
||||
.lineLimit(1)
|
||||
}
|
||||
)
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 10)
|
||||
.background(Color.orangeMain100)
|
||||
.cornerRadius(60)
|
||||
}
|
||||
|
||||
Button {
|
||||
if let url = URL(string: NSLocalizedString("website_open_source_licences_usage_url", comment: "")) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
Image("check-square-offset")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
VStack {
|
||||
Text("help_about_open_source_licenses_title")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Text("help_about_open_source_licenses_subtitle")
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
.padding(.horizontal, 5)
|
||||
|
||||
Image("arrow-square-out")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
if let url = URL(string: NSLocalizedString("website_translate_weblate_url", comment: "")) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
Image("earth")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
Text("help_about_contribute_translations_title")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
.padding(.horizontal, 5)
|
||||
|
||||
Image("arrow-square-out")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
}
|
||||
}
|
||||
|
||||
Text("help_about_advanced_title")
|
||||
.default_text_style_800(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 5)
|
||||
|
||||
NavigationLink(destination: {
|
||||
DebugFragment(helpViewModel: helpViewModel)
|
||||
}, label: {
|
||||
HStack {
|
||||
Image("wrench")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 30, height: 30)
|
||||
|
||||
Text("help_troubleshooting_title")
|
||||
.default_text_style_700(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.multilineTextAlignment(.leading)
|
||||
.padding(.horizontal, 5)
|
||||
|
||||
Image("caret-right")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25)
|
||||
}
|
||||
})
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.padding(.all, 20)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.background(Color.gray100)
|
||||
}
|
||||
.background(Color.gray100)
|
||||
|
||||
if helpViewModel.checkUpdateAvailable {
|
||||
PopupView(
|
||||
isShowPopup: $helpViewModel.checkUpdateAvailable,
|
||||
title: Text("help_dialog_update_available_title"),
|
||||
content: Text(String(format: String(localized: "help_dialog_update_available_message"), helpViewModel.versionAvailable)),
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {
|
||||
helpViewModel.checkUpdateAvailable = false
|
||||
},
|
||||
titleSecondButton: Text("dialog_install"),
|
||||
actionSecondButton: {
|
||||
helpViewModel.checkUpdateAvailable = false
|
||||
if let url = URL(string: helpViewModel.urlVersionAvailable) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
)
|
||||
.background(.black.opacity(0.65))
|
||||
.zIndex(3)
|
||||
.onTapGesture {
|
||||
helpViewModel.checkUpdateAvailable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
}
|
||||
}
|
||||
186
Linphone/UI/Main/Help/ViewModel/HelpViewModel.swift
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import linphonesw
|
||||
import SwiftUI
|
||||
|
||||
class HelpViewModel: ObservableObject {
|
||||
private let TAG = "[HelpViewModel]"
|
||||
|
||||
@Published var logcat: Bool = false
|
||||
@Published var logText: String = ""
|
||||
@Published var version: String = ""
|
||||
@Published var appVersion: String = ""
|
||||
@Published var sdkVersion: String = ""
|
||||
@Published var firebaseProjectId: String = ""
|
||||
@Published var checkUpdateAvailable: Bool = false
|
||||
@Published var uploadLogsAvailable: Bool = false
|
||||
@Published var logsUploadInProgress: Bool = false
|
||||
@Published var versionAvailable: String = ""
|
||||
@Published var urlVersionAvailable: String = ""
|
||||
|
||||
private var coreDelegate: CoreDelegate?
|
||||
|
||||
init() {
|
||||
let appName = Bundle.main.infoDictionary?["CFBundleName"] as? String
|
||||
let versionTmp = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
|
||||
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String
|
||||
|
||||
self.version = (versionTmp ?? "6.0.0") + "-beta-" + (build ?? "0")
|
||||
|
||||
self.sdkVersion = Core.getVersion
|
||||
|
||||
if let path = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist"),
|
||||
let plist = NSDictionary(contentsOfFile: path) as? [String: Any],
|
||||
let projectID = plist["PROJECT_ID"] as? String {
|
||||
firebaseProjectId = projectID
|
||||
}
|
||||
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
self.coreDelegate = CoreDelegateStub(
|
||||
onLogCollectionUploadStateChanged: {(
|
||||
core: Core,
|
||||
state: Core.LogCollectionUploadState,
|
||||
info: String
|
||||
) in
|
||||
if info.starts(with: "https") {
|
||||
DispatchQueue.main.async {
|
||||
self.logsUploadInProgress = false
|
||||
self.logText = info
|
||||
}
|
||||
}
|
||||
},
|
||||
onVersionUpdateCheckResultReceived: {(
|
||||
core: Core,
|
||||
result: VersionUpdateCheckResult,
|
||||
version: String?,
|
||||
url: String?
|
||||
) in
|
||||
switch result {
|
||||
case .NewVersionAvailable:
|
||||
if let version = version, let url = url {
|
||||
Log.info("\(self.TAG): Update available, version [\(version)], url [\(url)]")
|
||||
DispatchQueue.main.async {
|
||||
self.versionAvailable = version
|
||||
self.urlVersionAvailable = url
|
||||
self.checkUpdateAvailable = true
|
||||
}
|
||||
}
|
||||
case .UpToDate:
|
||||
Log.info("\(self.TAG): This version is up-to-date")
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Success_version_up_to_date"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
default:
|
||||
Log.info("\(self.TAG): Can't check for update, an error happened [\(result)]")
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
core.addDelegate(delegate: self.coreDelegate!)
|
||||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
if let delegate = coreDelegate {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
core.removeDelegate(delegate: delegate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func toggleLogcat() {
|
||||
let newValue = !self.logcat
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
CorePreferences.printLogsInLogcat = newValue
|
||||
Factory.Instance.enableLogcatLogs(newValue)
|
||||
self.logcat = newValue
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func shareLogs() {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.info("\(self.TAG) Uploading debug logs for sharing")
|
||||
core.uploadLogCollection()
|
||||
DispatchQueue.main.async {
|
||||
self.logsUploadInProgress = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func cleanLogs() {
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
Core.resetLogCollection()
|
||||
Log.info("\(self.TAG) Debug logs have been cleaned")
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Success_clear_logs"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func checkForUpdate() {
|
||||
let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.info("\(self.TAG) Checking for update using current version \(currentVersion ?? "6.0.0")")
|
||||
core.checkForUpdate(currentVersion: currentVersion ?? "6.0.0")
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func showConfigFile() {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.i("\(self.TAG) Dumping & displaying Core's config")
|
||||
let config = core.config.dump()
|
||||
let file = FileUtils.getFileStorageCacheDir(
|
||||
"linphonerc.txt",
|
||||
overrideExisting: true
|
||||
)
|
||||
DispatchQueue.main.async {
|
||||
if FileUtils.dumpStringToFile(config, file: file) {
|
||||
Log.i("\(self.TAG) .linphonerc string saved as file in cache folder")
|
||||
self.showConfigFileEvent = Event(value: file.absolutePath)
|
||||
} else {
|
||||
Log.e("\(self.TAG) Failed to save .linphonerc string as file in cache folder")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func clearNativeFriendsDatabase() {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
if let list = core.getFriendListByName(NATIVE_ADDRESS_BOOK_FRIEND_LIST) {
|
||||
let friends = list.friends
|
||||
Log.i("\(self.TAG) Friend list to remove found with [\(friends.count)] friends")
|
||||
for friend in friends {
|
||||
list.removeFriend(friend)
|
||||
}
|
||||
core.removeFriendList(list)
|
||||
Log.i("\(self.TAG) Friend list [\(NATIVE_ADDRESS_BOOK_FRIEND_LIST)] removed")
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ struct DialerBottomSheet: View {
|
|||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Close") {
|
||||
Button("dialog_close") {
|
||||
showingDialer.toggle()
|
||||
dismiss()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ struct HistoryListBottomSheet: View {
|
|||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Close") {
|
||||
Button("dialog_close") {
|
||||
if #available(iOS 16.0, *) {
|
||||
showingSheet.toggle()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ struct StartCallFragment: View {
|
|||
}
|
||||
}
|
||||
|
||||
Text(!callViewModel.isTransferInsteadCall ? "history_call_start_title" : "Transfer call to")
|
||||
Text(!callViewModel.isTransferInsteadCall ? "history_call_start_title" : "call_transfer_current_call_title")
|
||||
.multilineTextAlignment(.leading)
|
||||
.default_text_style_orange_800(styleSize: 16)
|
||||
|
||||
|
|
@ -304,8 +304,10 @@ struct StartCallFragment: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
}
|
||||
|
||||
@Sendable private func delayColor() async {
|
||||
|
|
@ -375,27 +377,51 @@ struct StartCallFragment: View {
|
|||
} label: {
|
||||
HStack {
|
||||
if index < contactsManager.lastSearchSuggestions.count
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil
|
||||
&& contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil {
|
||||
if contactsManager.lastSearchSuggestions[index].address!.displayName != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.displayName!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.displayName ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else if contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address!.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
}
|
||||
} else {
|
||||
Image("profil-picture-default")
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text("Username error")
|
||||
Text("username_error")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
|
|
|
|||
|
|
@ -112,24 +112,27 @@ class HistoryModel: ObservableObject {
|
|||
|
||||
func refreshAvatarModel() {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
let addressFriendTmp = ContactsManager.shared.getFriendWithAddress(
|
||||
address: self.callLog.dir == .Outgoing ? self.callLog.toAddress! : self.callLog.fromAddress!
|
||||
)
|
||||
if addressFriendTmp != nil {
|
||||
guard let address = (self.callLog.dir == .Outgoing ? self.callLog.toAddress : self.callLog.fromAddress) else {
|
||||
DispatchQueue.main.async {
|
||||
self.avatarModel = ContactAvatarModel(friend: nil, name: self.addressName, address: self.address, withPresence: false)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
let addressFriendTmp = ContactsManager.shared.getFriendWithAddress(address: address)
|
||||
if let addressFriendTmp = addressFriendTmp {
|
||||
self.addressFriend = addressFriendTmp
|
||||
|
||||
let addressNameTmp = self.addressName
|
||||
|
||||
let avatarModelTmp = addressFriendTmp != nil
|
||||
? ContactsManager.shared.avatarListModel.first(where: {
|
||||
$0.friend!.name == addressFriendTmp!.name
|
||||
&& $0.friend!.address!.asStringUriOnly() == addressFriendTmp!.address!.asStringUriOnly()
|
||||
let avatarModelTmp = ContactsManager.shared.avatarListModel.first(where: {
|
||||
guard let friend = $0.friend else { return false }
|
||||
return friend.name == addressFriendTmp.name && friend.address?.asStringUriOnly() == addressFriendTmp.address?.asStringUriOnly()
|
||||
}) ?? ContactAvatarModel(friend: nil, name: self.addressName, address: self.address, withPresence: false)
|
||||
: ContactAvatarModel(friend: nil, name: self.addressName, address: self.address, withPresence: false)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.addressFriend = addressFriendTmp
|
||||
self.addressName = addressFriendTmp!.name ?? addressNameTmp
|
||||
self.addressName = addressFriendTmp.name ?? addressNameTmp
|
||||
self.avatarModel = avatarModelTmp
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import linphonesw
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
class HistoryListViewModel: ObservableObject {
|
||||
|
||||
|
|
@ -148,23 +149,23 @@ class HistoryListViewModel: ObservableObject {
|
|||
switch callStatus {
|
||||
case Call.Status.Missed:
|
||||
if isOutgoing {
|
||||
"Outgoing Call"
|
||||
String(localized: "call_outgoing")
|
||||
} else {
|
||||
"Missed Call"
|
||||
String(localized: "notification_missed_call_title")
|
||||
}
|
||||
|
||||
case Call.Status.Success:
|
||||
if isOutgoing {
|
||||
"Outgoing Call"
|
||||
String(localized: "call_outgoing")
|
||||
} else {
|
||||
"Incoming Call"
|
||||
String(localized: "call_audio_incoming")
|
||||
}
|
||||
|
||||
default:
|
||||
if isOutgoing {
|
||||
"Outgoing Call"
|
||||
String(localized: "call_outgoing")
|
||||
} else {
|
||||
"Incoming Call"
|
||||
String(localized: "call_audio_incoming")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import linphonesw
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
// swiftlint:disable line_length
|
||||
class StartCallViewModel: ObservableObject {
|
||||
|
|
@ -37,8 +38,7 @@ class StartCallViewModel: ObservableObject {
|
|||
|
||||
@Published var operationInProgress: Bool = false
|
||||
|
||||
private var conferenceScheduler: ConferenceScheduler?
|
||||
private var conferenceSchedulerDelegate: ConferenceSchedulerDelegate?
|
||||
private var conferenceDelegate: ConferenceDelegate?
|
||||
|
||||
init() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
|
|
@ -67,7 +67,7 @@ class StartCallViewModel: ObservableObject {
|
|||
let account = core.defaultAccount
|
||||
if account == nil {
|
||||
Log.error(
|
||||
"\(StartCallViewModel.TAG) No default account found, can't create group call!"
|
||||
"\(ConversationModel.TAG) No default account found, can't create group call!"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
|
@ -77,86 +77,64 @@ class StartCallViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
do {
|
||||
let conferenceInfo = try Factory.Instance.createConferenceInfo()
|
||||
conferenceInfo.organizer = account!.params?.identityAddress
|
||||
conferenceInfo.subject = self.messageText
|
||||
|
||||
var participantsList: [ParticipantInfo] = []
|
||||
var participantsList: [Address] = []
|
||||
self.participants.forEach { participant in
|
||||
do {
|
||||
let info = try Factory.Instance.createParticipantInfo(address: participant.address)
|
||||
// For meetings, all participants must have Speaker role
|
||||
info.role = Participant.Role.Speaker
|
||||
participantsList.append(info)
|
||||
} catch let error {
|
||||
Log.error(
|
||||
"\(StartCallViewModel.TAG) Can't create ParticipantInfo: \(error)"
|
||||
)
|
||||
}
|
||||
participantsList.append(participant.address)
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.participants.removeAll()
|
||||
}
|
||||
|
||||
conferenceInfo.addParticipantInfos(participantInfos: participantsList)
|
||||
|
||||
Log.info(
|
||||
"\(StartCallViewModel.TAG) Creating group call with subject \(self.messageText) and \(participantsList.count) participant(s)"
|
||||
"\(ConversationModel.TAG) Creating group call with subject \(self.messageText) and \(participantsList.count) participant(s)"
|
||||
)
|
||||
|
||||
self.conferenceScheduler = try core.createConferenceScheduler(account: account)
|
||||
if self.conferenceScheduler != nil {
|
||||
self.conferenceAddDelegate(core: core, conferenceScheduler: self.conferenceScheduler!)
|
||||
// Will trigger the conference creation/update automatically
|
||||
self.conferenceScheduler!.info = conferenceInfo
|
||||
if let conference = LinphoneUtils.createGroupCall(core: core, account: account, subject: self.messageText) {
|
||||
self.conferenceAddDelegate(core: core, conference: conference)
|
||||
let callParams = try? core.createCallParams(call: nil)
|
||||
if let callParams = callParams {
|
||||
callParams.videoEnabled = true
|
||||
callParams.videoDirection = .RecvOnly
|
||||
|
||||
Log.info("\(ConversationModel.TAG) Inviting \(participantsList.count) participant(s) into newly created conference")
|
||||
|
||||
try conference.inviteParticipants(addresses: participantsList, params: callParams)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
TelecomManager.shared.participantsInvited = true
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch let error {
|
||||
Log.error(
|
||||
"\(StartCallViewModel.TAG) createGroupCall: \(error)"
|
||||
"\(ConversationModel.TAG) createGroupCall: \(error)"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func conferenceAddDelegate(core: Core, conferenceScheduler: ConferenceScheduler) {
|
||||
self.conferenceSchedulerDelegate = ConferenceSchedulerDelegateStub(onStateChanged: { (conferenceScheduler: ConferenceScheduler, state: ConferenceScheduler.State) in
|
||||
Log.info("\(StartCallViewModel.TAG) Conference scheduler state is \(state)")
|
||||
if state == ConferenceScheduler.State.Ready {
|
||||
conferenceScheduler.removeDelegate(delegate: self.conferenceSchedulerDelegate!)
|
||||
self.conferenceSchedulerDelegate = nil
|
||||
|
||||
let conferenceAddress = conferenceScheduler.info?.uri
|
||||
if conferenceAddress != nil {
|
||||
Log.info(
|
||||
"\(StartCallViewModel.TAG) Conference info created, address is \(conferenceAddress?.asStringUriOnly() ?? "Error conference address")"
|
||||
)
|
||||
|
||||
self.startVideoCall(core: core, conferenceAddress: conferenceAddress!)
|
||||
} else {
|
||||
Log.error("\(StartCallViewModel.TAG) Conference info URI is null!")
|
||||
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_group_call_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
|
||||
func conferenceAddDelegate(core: Core, conference: Conference) {
|
||||
self.conferenceDelegate = ConferenceDelegateStub(onStateChanged: { (conference: Conference, state: Conference.State) in
|
||||
Log.info("\(StartCallViewModel.TAG) Conference state is \(state)")
|
||||
if state == .Created {
|
||||
NotificationCenter.default.post(name: Notification.Name("CallViewModelReset"), object: self)
|
||||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
}
|
||||
} else if state == ConferenceScheduler.State.Error {
|
||||
conferenceScheduler.removeDelegate(delegate: self.conferenceSchedulerDelegate!)
|
||||
self.conferenceSchedulerDelegate = nil
|
||||
} else if state == .CreationFailed {
|
||||
Log.error("\(StartCallViewModel.TAG) Failed to create group call!")
|
||||
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_group_call_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Failed_to_create_group_call_error"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
self.operationInProgress = false
|
||||
}
|
||||
}
|
||||
})
|
||||
conferenceScheduler.addDelegate(delegate: self.conferenceSchedulerDelegate!)
|
||||
|
||||
if self.conferenceDelegate != nil {
|
||||
conference.addDelegate(delegate: self.conferenceDelegate!)
|
||||
}
|
||||
}
|
||||
|
||||
func startVideoCall(core: Core, conferenceAddress: Address) {
|
||||
|
|
|
|||
|
|
@ -69,8 +69,9 @@ struct AddParticipantsFragment: View {
|
|||
.multilineTextAlignment(.leading)
|
||||
.default_text_style_orange_800(styleSize: 16)
|
||||
.padding(.top, 20)
|
||||
Text("\($addParticipantsViewModel.participantsToAdd.count) selected participants")
|
||||
.default_text_style_300(styleSize: 12)
|
||||
|
||||
Text(String(format: String(localized: "selected_participants_count"), $addParticipantsViewModel.participantsToAdd.count.description))
|
||||
.default_text_style_300(styleSize: 12)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
|
@ -217,7 +218,7 @@ struct AddParticipantsFragment: View {
|
|||
}
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Text("Suggestions")
|
||||
Text("generic_address_picker_suggestions_list_title")
|
||||
.default_text_style_800(styleSize: 16)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -258,27 +259,51 @@ struct AddParticipantsFragment: View {
|
|||
} label: {
|
||||
HStack {
|
||||
if index < contactsManager.lastSearchSuggestions.count
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil
|
||||
&& contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil {
|
||||
if contactsManager.lastSearchSuggestions[index].address!.displayName != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.displayName!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.displayName ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else if contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address!.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
}
|
||||
} else {
|
||||
Image("profil-picture-default")
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text("Username error")
|
||||
Text("username_error")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ struct MeetingFragment: View {
|
|||
let model = MeetingViewModel()
|
||||
model.subject = "Meeting subject"
|
||||
model.conferenceUri = "linphone.com/lalalal.fr"
|
||||
model.description = "description du meeting ça va être la bringue wesh wesh gros bien ou bien ça roule"
|
||||
model.description = ""
|
||||
return MeetingFragment(meetingViewModel: model
|
||||
, meetingsListViewModel: MeetingsListViewModel()
|
||||
, isShowScheduleMeetingFragment: .constant(true)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct MeetingsListBottomSheet: View {
|
|||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Close") {
|
||||
Button("dialog_close") {
|
||||
if #available(iOS 16.0, *) {
|
||||
showingSheet.toggle()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -412,7 +412,9 @@ struct ScheduleMeetingFragment: View {
|
|||
func getDatePopup(isTimeSelection: Bool) -> some View {
|
||||
GeometryReader { geometry in
|
||||
VStack(alignment: .leading) {
|
||||
Text("Select \(setFromDate ? "start" : "end") \(isTimeSelection ? "time" : "date")")
|
||||
Text(setFromDate ?
|
||||
(isTimeSelection ? String(localized: "meeting_schedule_pick_start_time_title") : String(localized: "meeting_schedule_pick_start_date_title"))
|
||||
: String(localized: "meeting_schedule_pick_end_time_title"))
|
||||
.default_text_style_800(styleSize: 16)
|
||||
.frame(alignment: .leading)
|
||||
.padding(.bottom, 2)
|
||||
|
|
@ -433,7 +435,7 @@ struct ScheduleMeetingFragment: View {
|
|||
|
||||
HStack {
|
||||
Spacer()
|
||||
Text("Cancel")
|
||||
Text("dialog_cancel")
|
||||
.default_text_style_orange_500(styleSize: 16)
|
||||
.onTapGesture {
|
||||
if isTimeSelection {
|
||||
|
|
@ -442,7 +444,7 @@ struct ScheduleMeetingFragment: View {
|
|||
showDatePicker.toggle()
|
||||
}
|
||||
}
|
||||
Text("Ok")
|
||||
Text("dialog_ok")
|
||||
.default_text_style_orange_500(styleSize: 16)
|
||||
.onTapGesture {
|
||||
pickDate()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
import linphonesw
|
||||
import SwiftUI
|
||||
|
||||
class MeetingModel: ObservableObject {
|
||||
|
||||
|
|
|
|||
|
|
@ -181,14 +181,23 @@ class MeetingViewModel: ObservableObject {
|
|||
DispatchQueue.main.async {
|
||||
self.operationInProgress = false
|
||||
self.errorMsg = (self.displayedMeeting != nil) ? "Could not edit conference" : "Could not create conference"
|
||||
// TODO: show error toast
|
||||
ToastViewModel.shared.toastMessage = (self.displayedMeeting != nil) ? "meeting_failed_to_edit_toast" : "meeting_failed_to_schedule_toast"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
} else if state == ConferenceScheduler.State.Ready {
|
||||
let conferenceAddress = self.conferenceScheduler?.info?.uri
|
||||
if let confInfoToEdit = self.conferenceInfoToEdit {
|
||||
Log.info("\(MeetingViewModel.TAG) Conference info \(confInfoToEdit.uri?.asStringUriOnly() ?? "'nil'") has been updated")
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Success_meeting_info_updated_toast"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
} else {
|
||||
Log.info("\(MeetingViewModel.TAG) Conference info created, address will be \(conferenceAddress?.asStringUriOnly() ?? "'nil'")")
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Success_meeting_info_created_toast"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
}
|
||||
|
||||
if self.sendInvitations {
|
||||
|
|
@ -202,6 +211,9 @@ class MeetingViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
} else if state == ConferenceScheduler.State.Updating {
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
self.sendIcsInvitation(core: core)
|
||||
}
|
||||
}, onInvitationsSent: { (_: ConferenceScheduler, failedInvitations: [Address]) in
|
||||
|
|
@ -211,7 +223,7 @@ class MeetingViewModel: ObservableObject {
|
|||
} else if failedInvitations.count == self.participants.count {
|
||||
Log.error("\(MeetingViewModel.TAG) No invitation sent!")
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Failed_meeting_invitations_not_sent"
|
||||
ToastViewModel.shared.toastMessage = "meeting_failed_to_send_invites_toast"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
} else {
|
||||
|
|
@ -224,7 +236,7 @@ class MeetingViewModel: ObservableObject {
|
|||
}
|
||||
Log.warn("\(MeetingViewModel.TAG) \(failedInvitations.count) invitations couldn't have been sent to: \(failInvList)")
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Error: \(failedInvitations.count) invitations couldn't be sent to \(failInvList)"
|
||||
ToastViewModel.shared.toastMessage = "meeting_failed_to_send_part_of_invites_toast"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
}
|
||||
|
|
@ -262,6 +274,19 @@ class MeetingViewModel: ObservableObject {
|
|||
if let conferenceInfo = (self.displayedMeeting != nil ? self.displayedMeeting!.confInfo : try? Factory.Instance.createConferenceInfo()) {
|
||||
let localAccount = core.defaultAccount
|
||||
conferenceInfo.organizer = localAccount?.params?.identityAddress
|
||||
|
||||
// Allows to have a chat room within the conference
|
||||
conferenceInfo.setCapability(streamType: StreamType.Text, enable: true)
|
||||
|
||||
// Enable end-to-end encryption if client supports it
|
||||
if LinphoneUtils.isEndToEndEncryptedChatAvailable(core: core) {
|
||||
Log.info("\(MeetingViewModel.TAG) Requesting EndToEnd security level for conference")
|
||||
conferenceInfo.securityLevel = Conference.SecurityLevel.EndToEnd
|
||||
} else {
|
||||
Log.info("\(MeetingViewModel.TAG) Requesting PointToPoint security level for conference")
|
||||
conferenceInfo.securityLevel = Conference.SecurityLevel.PointToPoint
|
||||
}
|
||||
|
||||
self.fillConferenceInfo(confInfo: conferenceInfo)
|
||||
self.resetConferenceSchedulerAndListeners(core: core)
|
||||
self.conferenceScheduler?.account = localAccount
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class MeetingsListViewModel: ObservableObject {
|
|||
todayIdx = currentIdx
|
||||
}
|
||||
|
||||
DispatchQueue.main.sync {
|
||||
DispatchQueue.main.async {
|
||||
self.todayIdx = todayIdx
|
||||
self.meetingsList = meetingsListTmp
|
||||
}
|
||||
|
|
|
|||
672
Linphone/UI/Main/Settings/Fragments/AccountProfileFragment.swift
Normal file
|
|
@ -0,0 +1,672 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-iphone
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
// swiftlint:disable type_body_length
|
||||
struct AccountProfileFragment: View {
|
||||
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
|
||||
|
||||
@ObservedObject var accountProfileViewModel: AccountProfileViewModel
|
||||
@ObservedObject var registerViewModel: RegisterViewModel
|
||||
|
||||
@Binding var isShowAccountProfileFragment: Bool
|
||||
@State var detailIsOpen: Bool = true
|
||||
@State var deviceIsOpen: Bool = false
|
||||
|
||||
@State private var showPhotoPicker = false
|
||||
@State private var selectedImage: UIImage?
|
||||
@State private var removedImage = false
|
||||
@State private var isShowPopup = false
|
||||
@State private var isShowLogoutPopup = false
|
||||
@State private var flag = true
|
||||
|
||||
@FocusState var isDisplayNameFocused: Bool
|
||||
|
||||
private let avatarSize = 100.0
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
ZStack {
|
||||
VStack(spacing: 1) {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.orangeMain500)
|
||||
.edgesIgnoringSafeArea(.top)
|
||||
.frame(height: 0)
|
||||
|
||||
HStack {
|
||||
Image("caret-left")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
.padding(.top, 4)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
accountProfileViewModel.saveChangesWhenLeaving()
|
||||
withAnimation {
|
||||
if isShowAccountProfileFragment {
|
||||
isShowAccountProfileFragment = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text("manage_account_title")
|
||||
.default_text_style_orange_800(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.top, 4)
|
||||
.lineLimit(1)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 50)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, 4)
|
||||
.background(.white)
|
||||
|
||||
ScrollView {
|
||||
VStack(spacing: 0) {
|
||||
if accountProfileViewModel.accountModelIndex != nil && CoreContext.shared.accounts.count > accountProfileViewModel.accountModelIndex! {
|
||||
let accountModel = CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex!]
|
||||
VStack(spacing: 0) {
|
||||
if #unavailable(iOS 16.0) {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.gray100)
|
||||
.frame(height: 7)
|
||||
}
|
||||
|
||||
VStack(spacing: 0) {
|
||||
if accountModel.avatarModel != nil
|
||||
&& accountModel.photoAvatarModel != nil
|
||||
&& !accountModel.photoAvatarModel!.isEmpty
|
||||
&& selectedImage == nil && !removedImage {
|
||||
|
||||
AsyncImage(url: CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex!].imagePathAvatar) { image in
|
||||
switch image {
|
||||
case .empty:
|
||||
ProgressView()
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
case .success(let image):
|
||||
image
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
case .failure:
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: accountModel.avatarModel?.name ?? "",
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
@unknown default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
} else if selectedImage == nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: accountModel.avatarModel?.name ?? "",
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
} else {
|
||||
Image(uiImage: selectedImage!)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: avatarSize, height: avatarSize)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
|
||||
if accountModel.avatarModel != nil
|
||||
&& accountModel.photoAvatarModel != nil
|
||||
&& !accountModel.photoAvatarModel!.isEmpty
|
||||
&& (accountModel.photoAvatarModel!.suffix(11) != "default.png" || selectedImage != nil)
|
||||
&& !removedImage {
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
showPhotoPicker = true
|
||||
}, label: {
|
||||
HStack {
|
||||
Image("pencil-simple")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
Text("manage_account_edit_picture")
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.multilineTextAlignment(.center)
|
||||
.default_text_style(styleSize: 14)
|
||||
}
|
||||
})
|
||||
.padding(.top, 10)
|
||||
.padding(.trailing, 10)
|
||||
.sheet(isPresented: $showPhotoPicker) {
|
||||
PhotoPicker(filter: .images, limit: 1) { results in
|
||||
PhotoPicker.convertToUIImageArray(fromResults: results) { imagesOrNil, errorOrNil in
|
||||
if let error = errorOrNil {
|
||||
print(error)
|
||||
}
|
||||
if let images = imagesOrNil {
|
||||
if let first = images.first {
|
||||
selectedImage = first
|
||||
removedImage = false
|
||||
saveImage()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
removedImage = true
|
||||
selectedImage = nil
|
||||
saveImage()
|
||||
}, label: {
|
||||
HStack {
|
||||
Image("trash-simple")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
Text("manage_account_remove_picture")
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.multilineTextAlignment(.center)
|
||||
.default_text_style(styleSize: 14)
|
||||
}
|
||||
})
|
||||
.padding(.top, 10)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
} else {
|
||||
Button(action: {
|
||||
showPhotoPicker = true
|
||||
}, label: {
|
||||
HStack {
|
||||
Image("camera")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
Text("manage_account_add_picture")
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.multilineTextAlignment(.center)
|
||||
.default_text_style(styleSize: 14)
|
||||
}
|
||||
})
|
||||
.padding(.top, 10)
|
||||
.sheet(isPresented: $showPhotoPicker) {
|
||||
PhotoPicker(filter: .images, limit: 1) { results in
|
||||
PhotoPicker.convertToUIImageArray(fromResults: results) { imagesOrNil, errorOrNil in
|
||||
if let error = errorOrNil {
|
||||
print(error)
|
||||
}
|
||||
if let images = imagesOrNil {
|
||||
if let first = images.first {
|
||||
selectedImage = first
|
||||
removedImage = false
|
||||
showPhotoPicker = false
|
||||
saveImage()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(minHeight: 150)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 10)
|
||||
.padding(.bottom, 2)
|
||||
.background(Color.gray100)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Text("manage_account_details_title")
|
||||
.default_text_style_800(styleSize: 18)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image(detailIsOpen ? "caret-up" : "caret-down")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
}
|
||||
.padding(.top, 30)
|
||||
.padding(.bottom, 10)
|
||||
.padding(.horizontal, 20)
|
||||
.background(Color.gray100)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
detailIsOpen.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
if detailIsOpen {
|
||||
if accountModel.avatarModel != nil {
|
||||
VStack(spacing: 0) {
|
||||
VStack(spacing: 30) {
|
||||
HStack {
|
||||
Text(String(localized: "sip_address") + ":")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
|
||||
Text(accountModel.avatarModel!.address)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
|
||||
Button(action: {
|
||||
UIPasteboard.general.setValue(
|
||||
accountModel.avatarModel!.address,
|
||||
forPasteboardType: UTType.plainText.identifier
|
||||
)
|
||||
|
||||
ToastViewModel.shared.toastMessage = "Success_address_copied_into_clipboard"
|
||||
ToastViewModel.shared.displayToast.toggle()
|
||||
}, label: {
|
||||
Image("copy")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
})
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("sip_address_display_name")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
|
||||
TextField(accountModel.displayNameAvatar, text: Binding(
|
||||
get: { accountModel.displayNameAvatar },
|
||||
set: { newValue in
|
||||
accountModel.displayNameAvatar = newValue
|
||||
}
|
||||
))
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.background(.white)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(isDisplayNameFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.focused($isDisplayNameFocused)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text("manage_account_international_prefix")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.padding(.bottom, -5)
|
||||
.lineLimit(1)
|
||||
|
||||
Button(action: {
|
||||
isShowPopup = true
|
||||
}, label: {
|
||||
Image("question")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 20, height: 20)
|
||||
})
|
||||
.padding(.bottom, -5)
|
||||
}
|
||||
Menu {
|
||||
Picker("", selection: $accountProfileViewModel.dialPlanValueSelected) {
|
||||
ForEach(registerViewModel.dialPlansLabelList, id: \.self) { dialPlan in
|
||||
Text(dialPlan).tag(dialPlan)
|
||||
}
|
||||
}
|
||||
.onChange(of: accountProfileViewModel.dialPlanValueSelected) { newValue in
|
||||
accountProfileViewModel.updateDialPlan(newDialPlan: newValue)
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
Text(accountProfileViewModel.dialPlanValueSelected)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Image("caret-down")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
.frame(height: 25)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 15)
|
||||
.background(.white)
|
||||
.cornerRadius(60)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 60)
|
||||
.inset(by: 0.5)
|
||||
.stroke(Color.gray200, lineWidth: 1)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 30)
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
.background(.white)
|
||||
.cornerRadius(15)
|
||||
.padding(.horizontal)
|
||||
.zIndex(-1)
|
||||
.transition(.move(edge: .top))
|
||||
}
|
||||
}
|
||||
|
||||
VStack(spacing: 0) {
|
||||
VStack(spacing: 15) {
|
||||
HStack(spacing: 20) {
|
||||
Toggle("", isOn: Binding(
|
||||
get: { accountModel.isRegistrered },
|
||||
set: { _ in
|
||||
accountProfileViewModel.toggleRegister()
|
||||
}
|
||||
))
|
||||
.labelsHidden()
|
||||
|
||||
Text(accountModel.humanReadableRegistrationState)
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.bottom, -5)
|
||||
.lineLimit(1)
|
||||
}
|
||||
|
||||
Text(accountModel.summary)
|
||||
.default_text_style(styleSize: 15)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.bottom, -5)
|
||||
}
|
||||
.padding(.vertical, 30)
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
.background(.white)
|
||||
.cornerRadius(15)
|
||||
.padding(.all)
|
||||
.background(Color.gray100)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Text("manage_account_devices_title")
|
||||
.default_text_style_800(styleSize: 18)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image(deviceIsOpen ? "caret-up" : "caret-down")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
.padding(.all, 10)
|
||||
}
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 20)
|
||||
.background(Color.gray100)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
deviceIsOpen.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
if deviceIsOpen {
|
||||
VStack(spacing: 0) {
|
||||
VStack(spacing: 15) {
|
||||
ForEach(accountModel.devices.indices, id: \.self) { index in
|
||||
VStack {
|
||||
HStack {
|
||||
Image(accountModel.devices[index].isMobileDevice ? "device-mobile-camera" : "desktop")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
|
||||
Text(accountModel.devices[index].deviceName)
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Button(action: {
|
||||
deviceIsOpen = false
|
||||
accountModel.removeDevice(deviceIndex: index)
|
||||
deviceIsOpen = true
|
||||
}, label: {
|
||||
HStack {
|
||||
Image("trash-simple")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
Text("manage_account_device_remove")
|
||||
.default_text_style_orange_500(styleSize: 14)
|
||||
.frame(height: 35)
|
||||
}
|
||||
|
||||
})
|
||||
.padding(.horizontal, 10)
|
||||
.background(Color.orangeMain100)
|
||||
.cornerRadius(60)
|
||||
}
|
||||
.padding(.bottom, 10)
|
||||
|
||||
Text("manage_account_device_last_connection")
|
||||
.default_text_style_700(styleSize: 15)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
HStack {
|
||||
Image("calendar-blank")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
|
||||
Text(accountModel.devices[index].lastDate)
|
||||
.default_text_style(styleSize: 15)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Image("clock")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c600)
|
||||
.frame(width: 25, height: 25, alignment: .leading)
|
||||
|
||||
Text(accountModel.devices[index].lastTime)
|
||||
.default_text_style(styleSize: 15)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
.padding(.all, 20)
|
||||
.background(Color.gray100)
|
||||
.cornerRadius(15)
|
||||
|
||||
}
|
||||
}
|
||||
.padding(.all, 20)
|
||||
.frame(maxWidth: .infinity)
|
||||
.overlay(
|
||||
VStack {
|
||||
if accountModel.devices.indices.isEmpty {
|
||||
Text("manage_account_no_device")
|
||||
.default_text_style_500(styleSize: 16)
|
||||
}
|
||||
}
|
||||
.padding(.all)
|
||||
)
|
||||
}
|
||||
.background(.white)
|
||||
.cornerRadius(15)
|
||||
.padding(.horizontal)
|
||||
.zIndex(-2)
|
||||
.transition(.move(edge: .top))
|
||||
}
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Text("contact_details_actions_title")
|
||||
.default_text_style_800(styleSize: 18)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 10)
|
||||
.padding(.horizontal, 20)
|
||||
.background(Color.gray100)
|
||||
|
||||
VStack(spacing: 0) {
|
||||
VStack(spacing: 18) {
|
||||
if accountProfileViewModel.accountModelIndex != nil && CoreContext.shared.accounts.count > accountProfileViewModel.accountModelIndex! {
|
||||
NavigationLink(
|
||||
destination:
|
||||
AccountSettingsFragment(
|
||||
accountModel: CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex!]
|
||||
),
|
||||
label: {
|
||||
HStack {
|
||||
Image("gear")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.frame(width: 25, height: 25)
|
||||
|
||||
Text("manage_account_settings")
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Divider()
|
||||
|
||||
Button(action: {
|
||||
isShowLogoutPopup = true
|
||||
}, label: {
|
||||
HStack {
|
||||
Image("sign-out")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.frame(width: 25, height: 25)
|
||||
|
||||
Text("manage_account_delete")
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
})
|
||||
}
|
||||
.padding(.vertical, 20)
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
.background(.white)
|
||||
.cornerRadius(15)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.frame(maxWidth: sharedMainViewModel.maxWidth)
|
||||
.onAppear {
|
||||
accountModel.requestDevicesList()
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.background(Color.gray100)
|
||||
}
|
||||
.background(Color.gray100)
|
||||
|
||||
if self.isShowPopup {
|
||||
PopupView(isShowPopup: $isShowPopup,
|
||||
title: Text("manage_account_international_prefix"),
|
||||
content: Text("manage_account_dialog_international_prefix_help_message"),
|
||||
titleFirstButton: nil,
|
||||
actionFirstButton: {},
|
||||
titleSecondButton: Text("dialog_ok"),
|
||||
actionSecondButton: {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
)
|
||||
.background(.black.opacity(0.65))
|
||||
.onTapGesture {
|
||||
self.isShowPopup.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
if self.isShowLogoutPopup {
|
||||
let localizedString = NSLocalizedString("manage_account_dialog_remove_account_message", comment: "")
|
||||
|
||||
let components = localizedString.components(separatedBy: " ")
|
||||
let textPart = components.dropLast().joined(separator: " ")
|
||||
|
||||
let contentPopup1 = Text(textPart + " ")
|
||||
let contentPopup2 = Text("[https://sip.linphone.org](https://sip.linphone.org)").underline()
|
||||
|
||||
PopupView(
|
||||
isShowPopup: $isShowLogoutPopup,
|
||||
title: Text("manage_account_dialog_remove_account_title"),
|
||||
content: contentPopup1 + contentPopup2,
|
||||
titleFirstButton: Text("dialog_cancel"),
|
||||
actionFirstButton: {
|
||||
self.isShowLogoutPopup.toggle()
|
||||
},
|
||||
titleSecondButton: Text("manage_account_delete"),
|
||||
actionSecondButton: {
|
||||
if accountProfileViewModel.accountModelIndex != nil {
|
||||
CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex!].logout()
|
||||
}
|
||||
}
|
||||
)
|
||||
.background(.black.opacity(0.65))
|
||||
.onTapGesture {
|
||||
self.isShowLogoutPopup.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
}
|
||||
|
||||
func saveImage() {
|
||||
let accountModel = CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex ?? 0]
|
||||
let usernameTmp = CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex ?? 0].usernaneAvatar
|
||||
|
||||
accountProfileViewModel.saveImage(
|
||||
image: selectedImage
|
||||
?? ContactsManager.shared.textToImage(
|
||||
firstName: accountModel.avatarModel!.name, lastName: ""),
|
||||
name: usernameTmp,
|
||||
prefix: ((selectedImage == nil) ? "-default" : ""))
|
||||
}
|
||||
}
|
||||
// swiftlint:enable type_body_length
|
||||