forked from mirrors/linphone-iphone
Add ephemeral message selector view
This commit is contained in:
parent
bd8a89a9d3
commit
0a162390a3
7 changed files with 409 additions and 8 deletions
|
|
@ -169,6 +169,7 @@
|
|||
D7E6D0512AEBDBD500A57AAF /* ContactsListBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E6D0502AEBDBD500A57AAF /* ContactsListBottomSheet.swift */; };
|
||||
D7E6D0552AEBFCCE00A57AAF /* ContactsInnerFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E6D0542AEBFCCE00A57AAF /* ContactsInnerFragment.swift */; };
|
||||
D7EAACCF2AD6ED8000AA6A8A /* PermissionsFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7EAACCE2AD6ED8000AA6A8A /* PermissionsFragment.swift */; };
|
||||
D7EFD1E42CD11F70005E67CD /* EphemeralFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7EFD1E32CD11F53005E67CD /* EphemeralFragment.swift */; };
|
||||
D7F4D9CB2B5FD27200CDCD76 /* CallsListFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7F4D9CA2B5FD27200CDCD76 /* CallsListFragment.swift */; };
|
||||
D7F5F6412C359F3B007FCF2F /* SipAddressesPopup.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7F5F6402C359F3B007FCF2F /* SipAddressesPopup.swift */; };
|
||||
D7FB55112AD447FD00A5AB15 /* RegisterFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7FB55102AD447FD00A5AB15 /* RegisterFragment.swift */; };
|
||||
|
|
@ -358,6 +359,7 @@
|
|||
D7E6D0502AEBDBD500A57AAF /* ContactsListBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsListBottomSheet.swift; sourceTree = "<group>"; };
|
||||
D7E6D0542AEBFCCE00A57AAF /* ContactsInnerFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsInnerFragment.swift; sourceTree = "<group>"; };
|
||||
D7EAACCE2AD6ED8000AA6A8A /* PermissionsFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionsFragment.swift; sourceTree = "<group>"; };
|
||||
D7EFD1E32CD11F53005E67CD /* EphemeralFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EphemeralFragment.swift; sourceTree = "<group>"; };
|
||||
D7F4D9CA2B5FD27200CDCD76 /* CallsListFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallsListFragment.swift; sourceTree = "<group>"; };
|
||||
D7F5F6402C359F3B007FCF2F /* SipAddressesPopup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SipAddressesPopup.swift; sourceTree = "<group>"; };
|
||||
D7FB55102AD447FD00A5AB15 /* RegisterFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterFragment.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -845,6 +847,7 @@
|
|||
D7CEE0392B7A232200FD79B7 /* Fragments */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D7EFD1E32CD11F53005E67CD /* EphemeralFragment.swift */,
|
||||
D7CEE03A2B7A234200FD79B7 /* ConversationsFragment.swift */,
|
||||
D7CEE03C2B7A23B200FD79B7 /* ConversationsListFragment.swift */,
|
||||
D70A26ED2B7CF60B006CC8FC /* ConversationsListBottomSheet.swift */,
|
||||
|
|
@ -1168,6 +1171,7 @@
|
|||
D75759322B56D40900E7AC10 /* ZRTPPopup.swift in Sources */,
|
||||
D78E062E2BEA69F400CE3783 /* AudioRouteBottomSheet.swift in Sources */,
|
||||
D7A0ACBB2C415D630043AE79 /* StartGroupConversationFragment.swift in Sources */,
|
||||
D7EFD1E42CD11F70005E67CD /* EphemeralFragment.swift in Sources */,
|
||||
D7A2EDD62AC18115005D90FC /* SharedMainViewModel.swift in Sources */,
|
||||
D7A03FC62ACC458A0081A588 /* SplashScreen.swift in Sources */,
|
||||
D70C82A52C85EDCA0087F43F /* ConversationForwardMessageFragment.swift in Sources */,
|
||||
|
|
|
|||
21
Linphone/Assets.xcassets/ephemeral.imageset/Contents.json
vendored
Normal file
21
Linphone/Assets.xcassets/ephemeral.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "ephemeral.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
16
Linphone/Assets.xcassets/ephemeral.imageset/ephemeral.svg
vendored
Normal file
16
Linphone/Assets.xcassets/ephemeral.imageset/ephemeral.svg
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<svg width="131" height="112" viewBox="0 0 131 112" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M76.7875 21.1829V63.5485C76.7875 64.953 76.2296 66.2999 75.2365 67.2931C74.2433 68.2862 72.8963 68.8441 71.4918 68.8441H22.7435L16.688 78.148C16.6752 78.1619 16.6608 78.1741 16.645 78.1844C15.6941 78.9923 14.4869 79.4357 13.2392 79.4355C12.4623 79.4342 11.6952 79.2625 10.9918 78.9324C10.077 78.5109 9.30303 77.8346 8.76243 76.9847C8.22183 76.1348 7.93753 75.1471 7.94351 74.1398V21.1829C7.94351 19.7784 8.50145 18.4314 9.49459 17.4383C10.4877 16.4451 11.8347 15.8872 13.2392 15.8872H71.4918C72.8963 15.8872 74.2433 16.4451 75.2365 17.4383C76.2296 18.4314 76.7875 19.7784 76.7875 21.1829Z" fill="url(#paint0_linear_4814_15326)"/>
|
||||
<path d="M52.9842 42.6507C52.7866 44.9478 51.9371 47.1407 50.5355 48.9714C49.134 50.802 47.2388 52.1943 45.0728 52.9845C42.9069 53.7746 40.5603 53.9297 38.3092 53.4315C36.0581 52.9333 33.9961 51.8025 32.3659 50.1723C30.7356 48.542 29.6048 46.48 29.1066 44.2289C28.6084 41.9778 28.7635 39.6312 29.5537 37.4653C30.3438 35.2994 31.7361 33.4041 33.5668 32.0026C35.3974 30.6011 37.5903 29.7515 39.8874 29.5539C40.0095 29.5439 40.1324 29.5579 40.2491 29.5954C40.3658 29.6328 40.474 29.6928 40.5675 29.7721C40.661 29.8513 40.7379 29.9482 40.794 30.0572C40.85 30.1661 40.884 30.2851 40.8941 30.4072C40.9042 30.5294 40.8901 30.6523 40.8527 30.769C40.8153 30.8856 40.7552 30.9938 40.676 31.0873C40.5967 31.1808 40.4999 31.2578 40.3909 31.3138C40.2819 31.3698 40.163 31.4039 40.0408 31.414C38.0966 31.581 36.2406 32.2999 34.6911 33.486C33.1416 34.6721 31.9631 36.2761 31.2943 38.1092C30.6255 39.9424 30.4941 41.9284 30.9157 43.8337C31.3373 45.7389 32.2943 47.4841 33.6742 48.864C35.054 50.2438 36.7992 51.2008 38.7045 51.6224C40.6097 52.044 42.5958 51.9127 44.4289 51.2438C46.2621 50.575 47.8661 49.3965 49.0522 47.847C50.2383 46.2975 50.9571 44.4415 51.1242 42.4973C51.1445 42.2506 51.262 42.0222 51.4508 41.8621C51.6396 41.7021 51.8843 41.6237 52.1309 41.644C52.3776 41.6644 52.606 41.7819 52.766 41.9707C52.9261 42.1595 53.0045 42.4041 52.9842 42.6507ZM39.9641 35.134V41.644C39.9641 41.8907 40.0621 42.1272 40.2365 42.3016C40.4109 42.476 40.6475 42.574 40.8941 42.574H47.4042C47.6508 42.574 47.8874 42.476 48.0618 42.3016C48.2362 42.1272 48.3342 41.8907 48.3342 41.644C48.3342 41.3974 48.2362 41.1608 48.0618 40.9864C47.8874 40.812 47.6508 40.714 47.4042 40.714H41.8241V35.134C41.8241 34.8873 41.7261 34.6508 41.5517 34.4764C41.3773 34.3019 41.1408 34.204 40.8941 34.204C40.6475 34.204 40.4109 34.3019 40.2365 34.4764C40.0621 34.6508 39.9641 34.8873 39.9641 35.134ZM44.6141 32.344C44.89 32.344 45.1598 32.2621 45.3892 32.1089C45.6186 31.9556 45.7974 31.7377 45.903 31.4828C46.0085 31.2279 46.0362 30.9474 45.9823 30.6768C45.9285 30.4062 45.7957 30.1576 45.6006 29.9625C45.4055 29.7674 45.1569 29.6346 44.8863 29.5807C44.6157 29.5269 44.3352 29.5545 44.0803 29.6601C43.8254 29.7657 43.6075 29.9445 43.4542 30.1739C43.3009 30.4033 43.2191 30.673 43.2191 30.9489C43.2191 31.3189 43.3661 31.6738 43.6277 31.9354C43.8893 32.197 44.2442 32.344 44.6141 32.344ZM48.7992 35.134C49.0751 35.134 49.3448 35.0522 49.5742 34.8989C49.8036 34.7456 49.9824 34.5277 50.088 34.2728C50.1936 34.0179 50.2212 33.7374 50.1674 33.4668C50.1135 33.1962 49.9807 32.9476 49.7856 32.7525C49.5905 32.5574 49.3419 32.4246 49.0713 32.3708C48.8007 32.3169 48.5202 32.3446 48.2653 32.4501C48.0104 32.5557 47.7925 32.7345 47.6393 32.9639C47.486 33.1933 47.4042 33.4631 47.4042 33.739C47.4042 34.1089 47.5511 34.4638 47.8127 34.7254C48.0744 34.987 48.4292 35.134 48.7992 35.134ZM51.5892 39.319C51.8651 39.319 52.1348 39.2372 52.3642 39.0839C52.5936 38.9306 52.7724 38.7127 52.878 38.4578C52.9836 38.2029 53.0112 37.9224 52.9574 37.6518C52.9036 37.3812 52.7707 37.1327 52.5756 36.9376C52.3805 36.7425 52.1319 36.6096 51.8613 36.5558C51.5907 36.502 51.3102 36.5296 51.0553 36.6352C50.8004 36.7408 50.5826 36.9196 50.4293 37.149C50.276 37.3784 50.1942 37.6481 50.1942 37.924C50.1942 38.294 50.3411 38.6488 50.6028 38.9104C50.8644 39.172 51.2192 39.319 51.5892 39.319Z" fill="#FAFEFF"/>
|
||||
<path d="M61.3721 54.3001V96.2635C61.3721 97.6547 61.93 98.9889 62.9232 99.9726C63.9164 100.956 65.2634 101.509 66.6679 101.509H115.418L121.473 110.725C121.486 110.738 121.501 110.75 121.516 110.761C122.467 111.561 123.675 112 124.922 112C125.699 111.999 126.466 111.828 127.17 111.502C128.085 111.084 128.859 110.414 129.399 109.572C129.94 108.73 130.224 107.752 130.218 106.754V54.3001C130.218 52.9089 129.66 51.5747 128.667 50.591C127.674 49.6073 126.327 49.0547 124.922 49.0547H66.6679C65.2634 49.0547 63.9164 49.6073 62.9232 50.591C61.93 51.5747 61.3721 52.9089 61.3721 54.3001Z" fill="url(#paint1_linear_4814_15326)"/>
|
||||
<path d="M106.984 76.6507C106.787 78.9478 105.937 81.1407 104.536 82.9714C103.134 84.802 101.239 86.1943 99.0728 86.9845C96.9069 87.7746 94.5603 87.9297 92.3092 87.4315C90.0581 86.9333 87.9961 85.8025 86.3659 84.1723C84.7356 82.542 83.6048 80.48 83.1066 78.2289C82.6084 75.9778 82.7635 73.6312 83.5537 71.4653C84.3438 69.2994 85.7361 67.4041 87.5668 66.0026C89.3974 64.6011 91.5903 63.7515 93.8874 63.5539C94.0095 63.5439 94.1324 63.5579 94.2491 63.5954C94.3658 63.6328 94.474 63.6928 94.5675 63.7721C94.661 63.8513 94.7379 63.9482 94.794 64.0572C94.85 64.1661 94.884 64.2851 94.8941 64.4072C94.9042 64.5294 94.8901 64.6523 94.8527 64.769C94.8153 64.8856 94.7552 64.9938 94.676 65.0873C94.5967 65.1808 94.4999 65.2578 94.3909 65.3138C94.2819 65.3698 94.163 65.4039 94.0408 65.414C92.0966 65.581 90.2406 66.2999 88.6911 67.486C87.1416 68.6721 85.9631 70.2761 85.2943 72.1092C84.6255 73.9424 84.4941 75.9284 84.9157 77.8337C85.3373 79.7389 86.2943 81.4841 87.6742 82.864C89.054 84.2438 90.7992 85.2008 92.7045 85.6224C94.6097 86.044 96.5958 85.9127 98.4289 85.2438C100.262 84.575 101.866 83.3965 103.052 81.847C104.238 80.2975 104.957 78.4415 105.124 76.4973C105.145 76.2506 105.262 76.0222 105.451 75.8621C105.64 75.7021 105.884 75.6237 106.131 75.644C106.378 75.6644 106.606 75.7819 106.766 75.9707C106.926 76.1595 107.005 76.4041 106.984 76.6507ZM93.9641 69.134V75.644C93.9641 75.8907 94.0621 76.1272 94.2365 76.3016C94.4109 76.476 94.6475 76.574 94.8941 76.574H101.404C101.651 76.574 101.887 76.476 102.062 76.3016C102.236 76.1272 102.334 75.8907 102.334 75.644C102.334 75.3974 102.236 75.1608 102.062 74.9864C101.887 74.812 101.651 74.714 101.404 74.714H95.8241V69.134C95.8241 68.8873 95.7261 68.6508 95.5517 68.4764C95.3773 68.3019 95.1408 68.204 94.8941 68.204C94.6475 68.204 94.4109 68.3019 94.2365 68.4764C94.0621 68.6508 93.9641 68.8873 93.9641 69.134ZM98.6141 66.344C98.89 66.344 99.1598 66.2621 99.3892 66.1089C99.6186 65.9556 99.7974 65.7377 99.903 65.4828C100.009 65.2279 100.036 64.9474 99.9823 64.6768C99.9285 64.4062 99.7957 64.1576 99.6006 63.9625C99.4055 63.7674 99.1569 63.6346 98.8863 63.5807C98.6157 63.5269 98.3352 63.5545 98.0803 63.6601C97.8254 63.7657 97.6075 63.9445 97.4542 64.1739C97.3009 64.4033 97.2191 64.673 97.2191 64.9489C97.2191 65.3189 97.3661 65.6738 97.6277 65.9354C97.8893 66.197 98.2442 66.344 98.6141 66.344ZM102.799 69.134C103.075 69.134 103.345 69.0522 103.574 68.8989C103.804 68.7456 103.982 68.5277 104.088 68.2728C104.194 68.0179 104.221 67.7374 104.167 67.4668C104.114 67.1962 103.981 66.9476 103.786 66.7525C103.59 66.5574 103.342 66.4246 103.071 66.3708C102.801 66.3169 102.52 66.3446 102.265 66.4501C102.01 66.5557 101.793 66.7345 101.639 66.9639C101.486 67.1933 101.404 67.4631 101.404 67.739C101.404 68.1089 101.551 68.4638 101.813 68.7254C102.074 68.987 102.429 69.134 102.799 69.134ZM105.589 73.319C105.865 73.319 106.135 73.2372 106.364 73.0839C106.594 72.9306 106.772 72.7127 106.878 72.4578C106.984 72.2029 107.011 71.9224 106.957 71.6518C106.904 71.3812 106.771 71.1327 106.576 70.9376C106.381 70.7425 106.132 70.6096 105.861 70.5558C105.591 70.502 105.31 70.5296 105.055 70.6352C104.8 70.7408 104.583 70.9196 104.429 71.149C104.276 71.3784 104.194 71.6481 104.194 71.924C104.194 72.294 104.341 72.6488 104.603 72.9104C104.864 73.172 105.219 73.319 105.589 73.319Z" fill="#FAFEFF"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_4814_15326" x1="121.299" y1="-19.6218" x2="-31.6628" y2="110.151" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FF9730"/>
|
||||
<stop offset="1" stop-color="#FFB266" stop-opacity="0.7"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_4814_15326" x1="16.8591" y1="13.8827" x2="168.599" y2="143.856" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FF9730"/>
|
||||
<stop offset="1" stop-color="#FFB266" stop-opacity="0.7"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.3 KiB |
|
|
@ -1031,22 +1031,134 @@
|
|||
}
|
||||
},
|
||||
"conversation_ephemeral_messages_duration_disabled" : {
|
||||
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Disabled"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Désactiver"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conversation_ephemeral_messages_duration_one_day" : {
|
||||
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1 day"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1 jour"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conversation_ephemeral_messages_duration_one_hour" : {
|
||||
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1 hour"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1 heure"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conversation_ephemeral_messages_duration_one_minute" : {
|
||||
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1 minute"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1 minute"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conversation_ephemeral_messages_duration_one_week" : {
|
||||
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1 week"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "1 semaine"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conversation_ephemeral_messages_duration_three_days" : {
|
||||
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "3 days"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "3 jours"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conversation_ephemeral_messages_subtitle" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "New messages will be automatically deleted once read by everyone.\nChoose a duration:"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Les messages éphémères seront automatiquement supprimés une fois lu par tout le monde et après un certain délai :"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conversation_ephemeral_messages_title" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Ephemeral messages"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Messages éphémères"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"conversation_event_admin_set" : {
|
||||
"extractionState" : "manual",
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ struct ConversationFragment: View {
|
|||
@State private var voiceRecordingInProgress = false
|
||||
|
||||
@State private var isShowConversationForwardMessageFragment = false
|
||||
@State private var isShowEphemeralFragment = false
|
||||
|
||||
@Binding var isShowConversationFragment: Bool
|
||||
@Binding var isShowStartCallGroupPopup: Bool
|
||||
|
|
@ -202,7 +203,7 @@ struct ConversationFragment: View {
|
|||
.padding(.top, 4)
|
||||
.lineLimit(1)
|
||||
|
||||
if isMuted || conversationViewModel.displayedConversation!.isEphemeral {
|
||||
if isMuted || conversationViewModel.ephemeralTime != NSLocalizedString("conversation_ephemeral_messages_duration_disabled", comment: "") {
|
||||
HStack {
|
||||
if isMuted {
|
||||
Image("bell-slash")
|
||||
|
|
@ -212,12 +213,18 @@ struct ConversationFragment: View {
|
|||
.frame(width: 16, height: 16, alignment: .trailing)
|
||||
}
|
||||
|
||||
if conversationViewModel.displayedConversation!.isEphemeral {
|
||||
if conversationViewModel.ephemeralTime != NSLocalizedString("conversation_ephemeral_messages_duration_disabled", comment: "") {
|
||||
Image("clock-countdown")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 16, height: 16, alignment: .trailing)
|
||||
|
||||
Text(conversationViewModel.ephemeralTime)
|
||||
.default_text_style(styleSize: 12)
|
||||
.padding(.leading, -2)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
|
@ -279,6 +286,9 @@ struct ConversationFragment: View {
|
|||
|
||||
Button {
|
||||
isMenuOpen = false
|
||||
withAnimation {
|
||||
isShowEphemeralFragment = true
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
Text("conversation_menu_configure_ephemeral_messages")
|
||||
|
|
@ -946,6 +956,15 @@ struct ConversationFragment: View {
|
|||
.zIndex(5)
|
||||
.transition(.move(edge: .trailing))
|
||||
}
|
||||
|
||||
if isShowEphemeralFragment {
|
||||
EphemeralFragment(
|
||||
conversationViewModel: conversationViewModel,
|
||||
isShowEphemeralFragment: $isShowEphemeralFragment
|
||||
)
|
||||
.zIndex(5)
|
||||
.transition(.move(edge: .trailing))
|
||||
}
|
||||
}
|
||||
}
|
||||
// swiftlint:enable cyclomatic_complexity
|
||||
|
|
|
|||
157
Linphone/UI/Main/Conversations/Fragments/EphemeralFragment.swift
Normal file
157
Linphone/UI/Main/Conversations/Fragments/EphemeralFragment.swift
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* 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 linphonesw
|
||||
|
||||
struct EphemeralFragment: View {
|
||||
@ObservedObject var conversationViewModel: ConversationViewModel
|
||||
|
||||
@State private var selectedOption = NSLocalizedString("conversation_ephemeral_messages_duration_disabled", comment: "")
|
||||
let options = [
|
||||
NSLocalizedString("conversation_ephemeral_messages_duration_one_minute", comment: ""),
|
||||
NSLocalizedString("conversation_ephemeral_messages_duration_one_hour", comment: ""),
|
||||
NSLocalizedString("conversation_ephemeral_messages_duration_one_day", comment: ""),
|
||||
NSLocalizedString("conversation_ephemeral_messages_duration_three_days", comment: ""),
|
||||
NSLocalizedString("conversation_ephemeral_messages_duration_one_week", comment: ""),
|
||||
NSLocalizedString("conversation_ephemeral_messages_duration_disabled", comment: "")
|
||||
]
|
||||
|
||||
@Binding var isShowEphemeralFragment: Bool
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
GeometryReader { geometry in
|
||||
ZStack {
|
||||
VStack(spacing: 1) {
|
||||
|
||||
Rectangle()
|
||||
.foregroundStyle(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, 2)
|
||||
.padding(.leading, -10)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
isShowEphemeralFragment = false
|
||||
conversationViewModel.setEphemeralTime(lifetimeString: selectedOption)
|
||||
}
|
||||
}
|
||||
|
||||
Text("conversation_ephemeral_messages_title")
|
||||
.multilineTextAlignment(.leading)
|
||||
.default_text_style_orange_800(styleSize: 16)
|
||||
|
||||
Spacer()
|
||||
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 50)
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, 4)
|
||||
.background(.white)
|
||||
|
||||
VStack(spacing: 0) {
|
||||
ScrollView {
|
||||
VStack(spacing: 20) {
|
||||
Image("ephemeral")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: geometry.size.width/2.5)
|
||||
|
||||
Text("conversation_ephemeral_messages_subtitle")
|
||||
.default_text_style(styleSize: 14)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
VStack {
|
||||
ForEach(options, id: \.self) { option in
|
||||
Button(action: {
|
||||
selectedOption = option
|
||||
}) {
|
||||
VStack {
|
||||
HStack {
|
||||
Image(selectedOption == option ? "radio-button-fill" : "radio-button")
|
||||
|
||||
Text(option)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
.padding(.top, 2)
|
||||
|
||||
if option != NSLocalizedString("conversation_ephemeral_messages_duration_disabled", comment: "") {
|
||||
Divider()
|
||||
}
|
||||
}
|
||||
.background(.white)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.background(.white)
|
||||
.frame(maxWidth: .infinity)
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background(.white)
|
||||
.cornerRadius(10)
|
||||
}
|
||||
.padding(.horizontal, 10)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 20)
|
||||
.padding(.horizontal, 10)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.background(Color.gray100)
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.onAppear {
|
||||
conversationViewModel.getEphemeralTime()
|
||||
selectedOption = conversationViewModel.ephemeralTime
|
||||
}
|
||||
.onChange(of: conversationViewModel.ephemeralTime) { _ in
|
||||
selectedOption = conversationViewModel.ephemeralTime
|
||||
}
|
||||
.onDisappear {
|
||||
withAnimation {
|
||||
isShowEphemeralFragment = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
EphemeralFragment(
|
||||
conversationViewModel: ConversationViewModel(),
|
||||
isShowEphemeralFragment: .constant(true)
|
||||
)
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ import SwiftUI
|
|||
import AVFoundation
|
||||
|
||||
// swiftlint:disable line_length
|
||||
// swiftlint:disable file_length
|
||||
// swiftlint:disable type_body_length
|
||||
// swiftlint:disable cyclomatic_complexity
|
||||
|
||||
|
|
@ -37,6 +38,9 @@ class ConversationViewModel: ObservableObject {
|
|||
@Published var messageText: String = ""
|
||||
@Published var composingLabel: String = ""
|
||||
|
||||
@Published var isEphemeral: Bool = false
|
||||
@Published var ephemeralTime: String = NSLocalizedString("conversation_ephemeral_messages_duration_disabled", comment: "")
|
||||
|
||||
// Used to keep track of a ChatRoom callback without having to worry about life cycle
|
||||
// Init will add the delegate, deinit will remove it
|
||||
class ChatRoomDelegateHolder {
|
||||
|
|
@ -122,6 +126,8 @@ class ConversationViewModel: ObservableObject {
|
|||
self.getNewMessages(eventLogs: [eventLogs])
|
||||
}, onSubjectChanged: { (_: ChatRoom, eventLogs: EventLog) in
|
||||
self.getNewMessages(eventLogs: [eventLogs])
|
||||
}, onEphemeralEvent: {(_: ChatRoom, eventLogs: EventLog) in
|
||||
self.getNewMessages(eventLogs: [eventLogs])
|
||||
}, onEphemeralMessageDeleted: {(_: ChatRoom, eventLog: EventLog) in
|
||||
self.removeMessage(eventLog)
|
||||
})
|
||||
|
|
@ -329,6 +335,7 @@ class ConversationViewModel: ObservableObject {
|
|||
self.getUnreadMessagesCount()
|
||||
self.getParticipantConversationModel()
|
||||
self.computeComposingLabel()
|
||||
self.getEphemeralTime()
|
||||
|
||||
self.mediasToSend.removeAll()
|
||||
self.messageToReply = nil
|
||||
|
|
@ -1990,6 +1997,70 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setEphemeralTime(lifetimeString: String) {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
if self.displayedConversation != nil {
|
||||
var lifetime: Int = 0
|
||||
|
||||
switch lifetimeString {
|
||||
case NSLocalizedString("conversation_ephemeral_messages_duration_one_minute", comment: ""):
|
||||
lifetime = 60
|
||||
case NSLocalizedString("conversation_ephemeral_messages_duration_one_hour", comment: ""):
|
||||
lifetime = 3600
|
||||
case NSLocalizedString("conversation_ephemeral_messages_duration_one_day", comment: ""):
|
||||
lifetime = 86400
|
||||
case NSLocalizedString("conversation_ephemeral_messages_duration_three_days", comment: ""):
|
||||
lifetime = 259200
|
||||
case NSLocalizedString("conversation_ephemeral_messages_duration_one_week", comment: ""):
|
||||
lifetime = 604800
|
||||
default:
|
||||
lifetime = 0
|
||||
}
|
||||
|
||||
if lifetime == 0 {
|
||||
self.displayedConversation!.chatRoom.ephemeralEnabled = false
|
||||
self.displayedConversation!.chatRoom.ephemeralLifetime = lifetime
|
||||
} else {
|
||||
self.displayedConversation!.chatRoom.ephemeralEnabled = true
|
||||
self.displayedConversation!.chatRoom.ephemeralLifetime = lifetime
|
||||
}
|
||||
|
||||
self.getEphemeralTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getEphemeralTime() {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
if self.displayedConversation != nil {
|
||||
|
||||
let lifetime = self.displayedConversation!.chatRoom.ephemeralLifetime
|
||||
DispatchQueue.main.async {
|
||||
switch lifetime {
|
||||
case 60:
|
||||
self.isEphemeral = true
|
||||
self.ephemeralTime = NSLocalizedString("conversation_ephemeral_messages_duration_one_minute", comment: "")
|
||||
case 3600:
|
||||
self.isEphemeral = true
|
||||
self.ephemeralTime = NSLocalizedString("conversation_ephemeral_messages_duration_one_hour", comment: "")
|
||||
case 86400:
|
||||
self.isEphemeral = true
|
||||
self.ephemeralTime = NSLocalizedString("conversation_ephemeral_messages_duration_one_day", comment: "")
|
||||
case 259200:
|
||||
self.isEphemeral = true
|
||||
self.ephemeralTime = NSLocalizedString("conversation_ephemeral_messages_duration_three_days", comment: "")
|
||||
case 604800:
|
||||
self.isEphemeral = true
|
||||
self.ephemeralTime = NSLocalizedString("conversation_ephemeral_messages_duration_one_week", comment: "")
|
||||
default:
|
||||
self.isEphemeral = false
|
||||
self.ephemeralTime = NSLocalizedString("conversation_ephemeral_messages_duration_disabled", comment: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
@ -2278,3 +2349,4 @@ class AudioRecorder: NSObject, ObservableObject {
|
|||
return headsetCard ?? bluetoothCard ?? microphoneCard
|
||||
}
|
||||
}
|
||||
// swiftlint:enable file_length
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue