|
| 1 | +(ns status-im.contexts.shell.activity-center.notification.syncing.view |
| 2 | + (:require |
| 3 | + [quo.core :as quo] |
| 4 | + quo.theme |
| 5 | + [react-native.core :as rn] |
| 6 | + [status-im.common.new-device-sheet.view :as new-device-sheet] |
| 7 | + [status-im.contexts.shell.activity-center.notification.common.view :as common] |
| 8 | + [utils.datetime :as datetime] |
| 9 | + [utils.i18n :as i18n] |
| 10 | + [utils.re-frame :as rf])) |
| 11 | + |
| 12 | +(defn- swipeable |
| 13 | + [{:keys [extra-fn]} child] |
| 14 | + [common/swipeable |
| 15 | + {:left-button common/swipe-button-read-or-unread |
| 16 | + :left-on-press common/swipe-on-press-toggle-read |
| 17 | + :right-button common/swipe-button-delete |
| 18 | + :right-on-press common/swipe-on-press-delete |
| 19 | + :extra-fn extra-fn} |
| 20 | + child]) |
| 21 | + |
| 22 | +(defn installation-created-view |
| 23 | + [{:keys [notification extra-fn]}] |
| 24 | + (let [{:keys [installationId read timestamp]} notification |
| 25 | + customization-color (rf/sub [:profile/customization-color]) |
| 26 | + theme (quo.theme/use-theme) |
| 27 | + more-details (rn/use-callback |
| 28 | + (fn [] |
| 29 | + (rf/dispatch [:show-bottom-sheet |
| 30 | + {:content |
| 31 | + (fn [] |
| 32 | + [new-device-sheet/other-device-view |
| 33 | + (:id installationId)])}])) |
| 34 | + [installationId])] |
| 35 | + [swipeable {:extra-fn extra-fn} |
| 36 | + [quo/activity-log |
| 37 | + {:title (i18n/label :t/sync-your-profile) |
| 38 | + :customization-color customization-color |
| 39 | + :icon :i/mobile |
| 40 | + :timestamp (datetime/timestamp->relative timestamp) |
| 41 | + :unread? (not read) |
| 42 | + :context [(i18n/label :t/check-other-device-for-pairing)] |
| 43 | + :items [{:type :button |
| 44 | + :subtype :positive |
| 45 | + :key :review-pairing-request |
| 46 | + :blur? true |
| 47 | + :label (i18n/label :t/more-details) |
| 48 | + :theme theme |
| 49 | + :on-press more-details}]}]])) |
| 50 | + |
| 51 | +(defn installation-received-view |
| 52 | + [{:keys [notification extra-fn]}] |
| 53 | + (let [{:keys [installationId read timestamp]} notification |
| 54 | + customization-color (rf/sub [:profile/customization-color]) |
| 55 | + theme (quo.theme/use-theme) |
| 56 | + review-pairing-request (rn/use-callback |
| 57 | + (fn [] |
| 58 | + (rf/dispatch [:show-bottom-sheet |
| 59 | + {:content |
| 60 | + (fn [] |
| 61 | + [new-device-sheet/origin-device-view |
| 62 | + (:id installationId)])}])) |
| 63 | + [installationId])] |
| 64 | + [swipeable {:extra-fn extra-fn} |
| 65 | + [quo/activity-log |
| 66 | + {:title (i18n/label :t/new-device-detected) |
| 67 | + :customization-color customization-color |
| 68 | + :icon :i/mobile |
| 69 | + :timestamp (datetime/timestamp->relative timestamp) |
| 70 | + :unread? (not read) |
| 71 | + :context [(i18n/label :t/new-device-detected)] |
| 72 | + :items [{:type :button |
| 73 | + :subtype :positive |
| 74 | + :key :review-pairing-request |
| 75 | + :blur? true |
| 76 | + :label (i18n/label :t/review-pairing-request) |
| 77 | + :theme theme |
| 78 | + :on-press review-pairing-request}]}]])) |
0 commit comments