diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index 0a54c1b52..9aaf37194 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -613,6 +613,10 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat let updateType = conversationUpdate.conversationUpdateType guard updateType != .minor else { return } // No view items were affected if updateType == .reload { + if threadStartedAsMessageRequest { + updateNavBarButtons() // In case the message request was approved + } + return messagesTableView.reloadData() } var shouldScrollToBottom = false @@ -633,6 +637,11 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat self.messagesTableView.reloadRows(at: [ IndexPath(row: Int(update.oldIndex), section: 0) ], with: .none) default: preconditionFailure() } + + // Update the nav items if the message request was approved + if (update.viewItem?.interaction as? TSInfoMessage)?.messageType == .messageRequestAccepted { + self.updateNavBarButtons() + } } } UIView.performWithoutAnimation { diff --git a/Session/Meta/Images.xcassets/Session/warning.imageset/Contents.json b/Session/Meta/Images.xcassets/Session/warning.imageset/Contents.json new file mode 100644 index 000000000..0b55f782a --- /dev/null +++ b/Session/Meta/Images.xcassets/Session/warning.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "warning.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Session/Meta/Images.xcassets/Session/warning.imageset/warning.pdf b/Session/Meta/Images.xcassets/Session/warning.imageset/warning.pdf new file mode 100644 index 000000000..80fc5e25f --- /dev/null +++ b/Session/Meta/Images.xcassets/Session/warning.imageset/warning.pdf @@ -0,0 +1,125 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 9.791016 13.111328 cm +0.000000 0.000000 0.000000 scn +13.476560 -0.000008 m +88.623062 -0.000008 l +91.389732 -0.000008 93.782394 0.602219 95.801064 1.806664 c +97.819061 3.011093 99.373398 4.630554 100.464066 6.665062 c +101.554733 8.699562 102.100060 10.970070 102.100060 13.476585 c +102.100060 14.583359 101.945396 15.706406 101.636063 16.845726 c +101.326729 17.985054 100.879059 19.075554 100.293060 20.117218 c +62.646458 85.693398 l +61.376923 87.939461 59.700493 89.640297 57.617161 90.795898 c +55.533829 91.951500 53.352856 92.529297 51.074257 92.529297 c +48.795589 92.529297 46.606461 91.951500 44.506859 90.795898 c +42.407257 89.640297 40.722694 87.939461 39.453159 85.693398 c +1.806660 20.068382 l +0.602220 17.985046 0.000000 15.787788 0.000000 13.476585 c +0.000000 10.970070 0.545253 8.699562 1.635759 6.665062 c +2.726226 4.630554 4.280593 3.011093 6.298860 1.806664 c +8.317060 0.602219 10.709626 -0.000008 13.476560 -0.000008 c +h +13.525359 7.666031 m +11.832692 7.666031 10.473660 8.260109 9.448260 9.448265 c +8.422860 10.636414 7.910159 11.979187 7.910159 13.476585 c +7.910159 13.932312 7.958992 14.412453 8.056659 14.917015 c +8.154325 15.421577 8.317092 15.917992 8.544959 16.406273 c +46.142559 81.982498 l +46.695957 82.926498 47.412125 83.618195 48.291058 84.057594 c +49.169926 84.497063 50.097656 84.716797 51.074257 84.716797 c +52.018257 84.716797 52.921558 84.497063 53.784157 84.057594 c +54.646824 83.618195 55.354828 82.926498 55.908161 81.982498 c +93.457062 16.357445 l +93.977730 15.445984 94.238060 14.485703 94.238060 13.476585 c +94.238060 11.979187 93.709061 10.636414 92.651062 9.448265 c +91.593063 8.260109 90.217827 7.666031 88.525360 7.666031 c +13.525359 7.666031 l +h +f +n +Q +q +1.000000 0.000000 -0.000000 1.000000 55.591797 30.201187 cm +0.000000 0.000000 0.000000 scn +5.273499 15.869133 m +7.714899 15.869133 8.951868 17.154930 8.984402 19.726532 c +9.716801 45.507832 l +9.749334 46.744831 9.334299 47.778366 8.471699 48.608433 c +7.609099 49.438499 6.526735 49.853531 5.224602 49.853531 c +3.890002 49.853531 2.807667 49.446632 1.977600 48.632832 c +1.147467 47.819031 0.748700 46.793633 0.781300 45.556633 c +1.416000 19.726532 l +1.481134 17.154930 2.766965 15.869133 5.273499 15.869133 c +h +5.273499 0.000000 m +6.673232 0.000000 7.902070 0.488285 8.960003 1.464851 c +10.017937 2.441410 10.546902 3.645840 10.546902 5.078133 c +10.546902 6.510399 10.026069 7.714832 8.984402 8.691433 c +7.942735 9.667965 6.705765 10.156235 5.273499 10.156235 c +3.841165 10.156235 2.604167 9.659832 1.562500 8.667030 c +0.520833 7.674164 0.000000 6.477867 0.000000 5.078133 c +0.000000 3.678394 0.520833 2.482101 1.562500 1.489262 c +2.604167 0.496422 3.841165 0.000000 5.273499 0.000000 c +h +f +n +Q + +endstream +endobj + +3 0 obj + 2758 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 122.000000 119.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Pages 5 0 R + /Type /Catalog + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000002848 00000 n +0000002871 00000 n +0000003046 00000 n +0000003120 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +3179 +%%EOF \ No newline at end of file diff --git a/Session/Meta/Translations/de.lproj/Localizable.strings b/Session/Meta/Translations/de.lproj/Localizable.strings index adb414ff9..ff7f2e7ba 100644 --- a/Session/Meta/Translations/de.lproj/Localizable.strings +++ b/Session/Meta/Translations/de.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/en.lproj/Localizable.strings b/Session/Meta/Translations/en.lproj/Localizable.strings index e67ae41f7..62c842bb6 100644 --- a/Session/Meta/Translations/en.lproj/Localizable.strings +++ b/Session/Meta/Translations/en.lproj/Localizable.strings @@ -649,3 +649,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/es.lproj/Localizable.strings b/Session/Meta/Translations/es.lproj/Localizable.strings index d663aea99..c51058740 100644 --- a/Session/Meta/Translations/es.lproj/Localizable.strings +++ b/Session/Meta/Translations/es.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/fa.lproj/Localizable.strings b/Session/Meta/Translations/fa.lproj/Localizable.strings index 5823242fc..3842e4dd4 100644 --- a/Session/Meta/Translations/fa.lproj/Localizable.strings +++ b/Session/Meta/Translations/fa.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/fi.lproj/Localizable.strings b/Session/Meta/Translations/fi.lproj/Localizable.strings index 269137b81..5a122192a 100644 --- a/Session/Meta/Translations/fi.lproj/Localizable.strings +++ b/Session/Meta/Translations/fi.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/fr.lproj/Localizable.strings b/Session/Meta/Translations/fr.lproj/Localizable.strings index 584c3b737..5eaf82663 100644 --- a/Session/Meta/Translations/fr.lproj/Localizable.strings +++ b/Session/Meta/Translations/fr.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/hi.lproj/Localizable.strings b/Session/Meta/Translations/hi.lproj/Localizable.strings index 393a979e0..f95cd0d82 100644 --- a/Session/Meta/Translations/hi.lproj/Localizable.strings +++ b/Session/Meta/Translations/hi.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/hr.lproj/Localizable.strings b/Session/Meta/Translations/hr.lproj/Localizable.strings index 162f4aa7b..fa0936cc3 100644 --- a/Session/Meta/Translations/hr.lproj/Localizable.strings +++ b/Session/Meta/Translations/hr.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/id-ID.lproj/Localizable.strings b/Session/Meta/Translations/id-ID.lproj/Localizable.strings index 520dbf7e6..e2a15c7b9 100644 --- a/Session/Meta/Translations/id-ID.lproj/Localizable.strings +++ b/Session/Meta/Translations/id-ID.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/it.lproj/Localizable.strings b/Session/Meta/Translations/it.lproj/Localizable.strings index 9767ed4f2..01f64d75d 100644 --- a/Session/Meta/Translations/it.lproj/Localizable.strings +++ b/Session/Meta/Translations/it.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/ja.lproj/Localizable.strings b/Session/Meta/Translations/ja.lproj/Localizable.strings index dcd2509a6..6aeabe218 100644 --- a/Session/Meta/Translations/ja.lproj/Localizable.strings +++ b/Session/Meta/Translations/ja.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/nl.lproj/Localizable.strings b/Session/Meta/Translations/nl.lproj/Localizable.strings index 2e56c911b..33883326f 100644 --- a/Session/Meta/Translations/nl.lproj/Localizable.strings +++ b/Session/Meta/Translations/nl.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/pl.lproj/Localizable.strings b/Session/Meta/Translations/pl.lproj/Localizable.strings index cdfe3530e..acc6456c8 100644 --- a/Session/Meta/Translations/pl.lproj/Localizable.strings +++ b/Session/Meta/Translations/pl.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings index 553bc9b55..641a62bc1 100644 --- a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings +++ b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/ru.lproj/Localizable.strings b/Session/Meta/Translations/ru.lproj/Localizable.strings index 1d319dc6b..d4aef8ce9 100644 --- a/Session/Meta/Translations/ru.lproj/Localizable.strings +++ b/Session/Meta/Translations/ru.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/si.lproj/Localizable.strings b/Session/Meta/Translations/si.lproj/Localizable.strings index f186558d9..419bb4ac5 100644 --- a/Session/Meta/Translations/si.lproj/Localizable.strings +++ b/Session/Meta/Translations/si.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/sk.lproj/Localizable.strings b/Session/Meta/Translations/sk.lproj/Localizable.strings index 06e81338f..8a087d5ee 100644 --- a/Session/Meta/Translations/sk.lproj/Localizable.strings +++ b/Session/Meta/Translations/sk.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/sv.lproj/Localizable.strings b/Session/Meta/Translations/sv.lproj/Localizable.strings index 11e2cedcb..f4823c5a4 100644 --- a/Session/Meta/Translations/sv.lproj/Localizable.strings +++ b/Session/Meta/Translations/sv.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/th.lproj/Localizable.strings b/Session/Meta/Translations/th.lproj/Localizable.strings index cc269e133..7aba32232 100644 --- a/Session/Meta/Translations/th.lproj/Localizable.strings +++ b/Session/Meta/Translations/th.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings index 2c403e362..3db68b0f3 100644 --- a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings +++ b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings index 8536c26d5..fd94c57a2 100644 --- a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings index a988ba784..7fa672dc5 100644 --- a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings @@ -623,3 +623,5 @@ "NEW_CONVERSATION_MENU_CLOSED_GROUP" = "Closed Group"; "modal_call_permission_request_title" = "Call Permissions Required"; "modal_call_permission_request_explanation" = "You can enable the 'Voice and video calls' permission in the Privacy Settings."; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE" = "Oops, an error occurred"; +"DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE" = "Please try again later"; diff --git a/Session/Open Groups/OpenGroupSuggestionGrid.swift b/Session/Open Groups/OpenGroupSuggestionGrid.swift index 5154d9e50..2d3094718 100644 --- a/Session/Open Groups/OpenGroupSuggestionGrid.swift +++ b/Session/Open Groups/OpenGroupSuggestionGrid.swift @@ -1,5 +1,6 @@ import PromiseKit import NVActivityIndicatorView +import SessionUIKit final class OpenGroupSuggestionGrid : UIView, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { private let maxWidth: CGFloat @@ -32,6 +33,42 @@ final class OpenGroupSuggestionGrid : UIView, UICollectionViewDataSource, UIColl return result }() + private lazy var errorView: UIView = { + let result: UIView = UIView() + result.isHidden = true + + return result + }() + + private lazy var errorImageView: UIImageView = { + let result: UIImageView = UIImageView(image: #imageLiteral(resourceName: "warning").withRenderingMode(.alwaysTemplate)) + result.tintColor = Colors.destructive + + return result + }() + + private lazy var errorTitleLabel: UILabel = { + let result: UILabel = UILabel() + result.font = UIFont.systemFont(ofSize: Values.mediumFontSize, weight: .medium) + result.text = "DEFAULT_OPEN_GROUP_LOAD_ERROR_TITLE".localized() + result.textColor = Colors.text + result.textAlignment = .center + result.numberOfLines = 0 + + return result + }() + + private lazy var errorSubtitleLabel: UILabel = { + let result: UILabel = UILabel() + result.font = UIFont.systemFont(ofSize: Values.smallFontSize, weight: .medium) + result.text = "DEFAULT_OPEN_GROUP_LOAD_ERROR_SUBTITLE".localized() + result.textColor = Colors.text + result.textAlignment = .center + result.numberOfLines = 0 + + return result + }() + // MARK: Settings private static let cellHeight: CGFloat = 40 private static let separatorWidth = 1 / UIScreen.main.scale @@ -54,17 +91,40 @@ final class OpenGroupSuggestionGrid : UIView, UICollectionViewDataSource, UIColl private func initialize() { addSubview(collectionView) collectionView.pin(to: self) + addSubview(spinner) - spinner.pin([ UIView.HorizontalEdge.left, UIView.VerticalEdge.top ], to: self) + spinner.pin(.top, to: .top, of: self) + spinner.center(.horizontal, in: self) spinner.startAnimating() + + addSubview(errorView) + errorView.pin(.top, to: .top, of: self, withInset: 10) + errorView.pin( [HorizontalEdge.leading, HorizontalEdge.trailing], to: self) + + errorView.addSubview(errorImageView) + errorImageView.pin(.top, to: .top, of: errorView) + errorImageView.center(.horizontal, in: errorView) + errorImageView.set(.width, to: 60) + errorImageView.set(.height, to: 60) + + errorView.addSubview(errorTitleLabel) + errorTitleLabel.pin(.top, to: .bottom, of: errorImageView, withInset: 10) + errorTitleLabel.center(.horizontal, in: errorView) + + errorView.addSubview(errorSubtitleLabel) + errorSubtitleLabel.pin(.top, to: .bottom, of: errorTitleLabel, withInset: 20) + errorSubtitleLabel.center(.horizontal, in: errorView) + heightConstraint = set(.height, to: OpenGroupSuggestionGrid.cellHeight) widthAnchor.constraint(greaterThanOrEqualToConstant: OpenGroupSuggestionGrid.cellHeight).isActive = true - if OpenGroupAPIV2.defaultRoomsPromise == nil { - OpenGroupAPIV2.getDefaultRoomsIfNeeded() - } - let _ = OpenGroupAPIV2.defaultRoomsPromise?.done { [weak self] rooms in - self?.rooms = rooms - } + + OpenGroupAPIV2.getDefaultRoomsIfNeeded() + .done { [weak self] rooms in + self?.rooms = rooms + } + .catch { [weak self] _ in + self?.update() + } } // MARK: Updating @@ -75,6 +135,7 @@ final class OpenGroupSuggestionGrid : UIView, UICollectionViewDataSource, UIColl let height = OpenGroupSuggestionGrid.cellHeight * ceil(CGFloat(roomCount) / 2) heightConstraint.constant = height collectionView.reloadData() + errorView.isHidden = (roomCount > 0) } // MARK: Layout @@ -174,8 +235,22 @@ extension OpenGroupSuggestionGrid { private func update() { guard let room = room else { return } let promise = OpenGroupAPIV2.getGroupImage(for: room.id, on: OpenGroupAPIV2.defaultServer) - imageView.image = given(promise.value) { UIImage(data: $0)! } - imageView.isHidden = (imageView.image == nil) + + if let imageData: Data = promise.value { + imageView.image = UIImage(data: imageData) + imageView.isHidden = (imageView.image == nil) + } + else { + imageView.isHidden = true + + _ = promise.done { [weak self] imageData in + DispatchQueue.main.async { + self?.imageView.image = UIImage(data: imageData) + self?.imageView.isHidden = (self?.imageView.image == nil) + } + } + } + label.text = room.name } } diff --git a/Session/Shared/ConversationCell.swift b/Session/Shared/ConversationCell.swift index ff0d96c35..eda26c2ff 100644 --- a/Session/Shared/ConversationCell.swift +++ b/Session/Shared/ConversationCell.swift @@ -239,7 +239,6 @@ final class ConversationCell : UITableViewCell { // Contact if threadViewModel.isGroupThread, let thread = threadViewModel.threadRecord as? TSGroupThread { displayNameLabel.attributedText = getHighlightedSnippet(snippet: getDisplayName(), searchText: normalizedSearchText, fontSize: Values.mediumFontSize) - bottomLabelStackView.isHidden = false let context: Contact.Context = thread.isOpenGroup ? .openGroup : .regular var rawSnippet: String = "" thread.groupModel.groupMemberIds.forEach{ id in @@ -252,7 +251,12 @@ final class ConversationCell : UITableViewCell { } } } - snippetLabel.attributedText = getHighlightedSnippet(snippet: rawSnippet, searchText: normalizedSearchText, fontSize: Values.smallFontSize) + if rawSnippet.isEmpty { + bottomLabelStackView.isHidden = true + } else { + bottomLabelStackView.isHidden = false + snippetLabel.attributedText = getHighlightedSnippet(snippet: rawSnippet, searchText: normalizedSearchText, fontSize: Values.smallFontSize) + } } else { displayNameLabel.attributedText = getHighlightedSnippet(snippet: getDisplayNameForSearch(threadViewModel.contactSessionID!), searchText: normalizedSearchText, fontSize: Values.mediumFontSize) bottomLabelStackView.isHidden = true diff --git a/SessionMessagingKit/Open Groups/OpenGroupAPIV2+ObjC.swift b/SessionMessagingKit/Open Groups/OpenGroupAPIV2+ObjC.swift index dd9a57b18..11686edc8 100644 --- a/SessionMessagingKit/Open Groups/OpenGroupAPIV2+ObjC.swift +++ b/SessionMessagingKit/Open Groups/OpenGroupAPIV2+ObjC.swift @@ -14,6 +14,6 @@ extension OpenGroupAPIV2 { @objc(getDefaultRoomsIfNeeded) public static func objc_getDefaultRoomsIfNeeded() { - return getDefaultRoomsIfNeeded() + getDefaultRoomsIfNeeded() } } diff --git a/SessionMessagingKit/Open Groups/OpenGroupAPIV2.swift b/SessionMessagingKit/Open Groups/OpenGroupAPIV2.swift index f47a30463..481fcdfd0 100644 --- a/SessionMessagingKit/Open Groups/OpenGroupAPIV2.swift +++ b/SessionMessagingKit/Open Groups/OpenGroupAPIV2.swift @@ -422,21 +422,37 @@ public final class OpenGroupAPIV2 : NSObject { } // MARK: General - public static func getDefaultRoomsIfNeeded() { + + @discardableResult public static func getDefaultRoomsIfNeeded() -> Promise<[OpenGroupAPIV2.Info]> { + if let existingPromise: Promise<[OpenGroupAPIV2.Info]> = defaultRoomsPromise { + return existingPromise + } + + let (promise, seal) = Promise<[OpenGroupAPIV2.Info]>.pending() + Storage.shared.write(with: { transaction in Storage.shared.setOpenGroupPublicKey(for: defaultServer, to: defaultServerPublicKey, using: transaction) }, completion: { - let promise = attempt(maxRetryCount: 8, recoveringOn: DispatchQueue.main) { + let internalPromise: Promise<[OpenGroupAPIV2.Info]> = attempt(maxRetryCount: 8, recoveringOn: DispatchQueue.main) { OpenGroupAPIV2.getAllRooms(from: defaultServer) } - let _ = promise.done(on: OpenGroupAPIV2.workQueue) { items in - items.forEach { getGroupImage(for: $0.id, on: defaultServer).retainUntilComplete() } - } - promise.catch(on: OpenGroupAPIV2.workQueue) { _ in - OpenGroupAPIV2.defaultRoomsPromise = nil - } - defaultRoomsPromise = promise + + internalPromise + .done(on: OpenGroupAPIV2.workQueue) { items in + items.forEach { getGroupImage(for: $0.id, on: defaultServer).retainUntilComplete() } + seal.fulfill(items) + } + .retainUntilComplete() + + internalPromise + .catch(on: OpenGroupAPIV2.workQueue) { error in + OpenGroupAPIV2.defaultRoomsPromise = nil + seal.reject(error) + } }) + + defaultRoomsPromise = promise + return promise } public static func getInfo(for room: String, on server: String) -> Promise { diff --git a/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift b/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift index 8b490812a..2815cfdb8 100644 --- a/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift +++ b/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift @@ -459,11 +459,7 @@ extension MessageReceiver { // Use the same identifier for notifications when in backgroud polling to prevent spam let notificationIdentifier = isBackgroundPoll ? thread.uniqueId : UUID().uuidString tsIncomingMessage.setNotificationIdentifier(notificationIdentifier, transaction: transaction) - DispatchQueue.main.async { - Storage.read { transaction in - SSKEnvironment.shared.notificationsManager!.notifyUser(for: tsIncomingMessage, in: thread, transaction: transaction) - } - } + SSKEnvironment.shared.notificationsManager!.notifyUser(for: tsIncomingMessage, in: thread, transaction: transaction) return tsMessageID } diff --git a/SessionNotificationServiceExtension/NSENotificationPresenter.swift b/SessionNotificationServiceExtension/NSENotificationPresenter.swift index a060c36c2..2eae9479e 100644 --- a/SessionNotificationServiceExtension/NSENotificationPresenter.swift +++ b/SessionNotificationServiceExtension/NSENotificationPresenter.swift @@ -86,6 +86,7 @@ public class NSENotificationPresenter: NSObject, NotificationsProtocol { // If it's a message request then overwrite the body to be something generic (only show a notification // when receiving a new message request if there aren't any others or the user had hidden them) if thread.isMessageRequest() { + notificationContent.title = "Session" notificationContent.body = "MESSAGE_REQUESTS_NOTIFICATION".localized() }