Skip to content

Commit

Permalink
Merge branch 'develop' into refactor-add-addresses-to-watch-screen/logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrkhalil committed Apr 26, 2024
2 parents 6e424bf + 2ec6a3e commit 75cde66
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 30 deletions.
6 changes: 6 additions & 0 deletions nix/status-go/library/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ buildGoPackage {

phases = ["unpackPhase" "configurePhase" "buildPhase"];

# https://pkg.go.dev/net#hdr-Name_Resolution
# https://github.com/status-im/status-mobile/issues/19736
# https://github.com/status-im/status-mobile/issues/19581
# TODO: try removing when go is upgraded to 1.22
GODEBUG = "netdns=cgo+2";

preBuild = ''
pushd go/src/$goPackagePath
go run cmd/library/*.go > $NIX_BUILD_TOP/main.go
Expand Down
7 changes: 6 additions & 1 deletion nix/status-go/mobile/build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ in buildGoPackage {
# Ensure XCode is present for iOS, instead of failing at the end of the build.
preConfigure = optionalString isIOS enforceXCodeAvailable;

# https://pkg.go.dev/net#hdr-Name_Resolution
# https://github.com/status-im/status-mobile/issues/19736
# https://github.com/status-im/status-mobile/issues/19581
# TODO: try removing when go is upgraded to 1.22
GODEBUG = "netdns=cgo+2";

buildPhase = ''
runHook preBuild
echo -e "\nBuilding $pname for: ${concatStringsSep "," targets}"
gomobile bind \
${concatStringsSep " " goBuildFlags} \
-ldflags="$ldflags" \
Expand Down
7 changes: 5 additions & 2 deletions src/status_im/contexts/chat/messenger/composer/effects.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

(defn initialize
[props state animations {:keys [max-height] :as dimensions}
{:keys [chat-input audio] :as subscriptions}]
{:keys [chat-input audio input-text images link-previews? reply] :as subscriptions}]
(rn/use-effect
(fn []
(maximized-effect state animations dimensions chat-input)
Expand All @@ -99,10 +99,13 @@
(background-effect state animations dimensions chat-input)
(link-preview-effect state)
(audio-effect state audio)
(empty-effect animations subscriptions)
(kb/add-kb-listeners props state animations dimensions)
#(component-will-unmount props))
[max-height])
(rn/use-effect
(fn []
(empty-effect animations subscriptions))
[input-text images link-previews? reply])
(rn/use-effect
(fn []
(reenter-screen-effect state dimensions subscriptions animations))
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/contexts/chat/messenger/composer/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
(drag-gesture/drag-gesture props state animations dimensions keyboard-shown)}
[reanimated/view
{:style (style/sheet-container insets animations theme)}
[sub-view/bar]
[sub-view/bar theme]
[:<>
[reply/view state (:input-ref props)]
[edit/view
Expand Down
42 changes: 36 additions & 6 deletions src/status_im/contexts/syncing/device/view.cljs
Original file line number Diff line number Diff line change
@@ -1,17 +1,47 @@
(ns status-im.contexts.syncing.device.view
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im.contexts.syncing.device.style :as style]
[utils.i18n :as i18n]))
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn- hide-sheet
[]
(rf/dispatch [:hide-bottom-sheet]))

(defn- unpair-confirmation
[installation-id name]
(fn []
(let [unpair-device #(rf/dispatch [:syncing/disable-installation installation-id])]
[rn/view
[quo/drawer-top
{:title (i18n/label :t/unpair-device)
:description (i18n/label :t/unpair-device-description {:name name})}]
[quo/bottom-actions
{:actions :two-actions
:button-one-label (i18n/label :t/unpair)
:button-one-props {:type :danger
:on-press unpair-device}
:button-two-label (i18n/label :t/cancel)
:button-two-props {:type :grey
:on-press hide-sheet}}]])))

(defn view
[{:keys [name
installation-id
this-device?
device-type
enabled?
show-button?]}]
(let [paired? (and (not this-device?) enabled?)
unpaired? (not enabled?)]
(let [paired? (and (not this-device?) enabled?)
unpaired? (not enabled?)
show-unpair-confirmation (fn []
(rf/dispatch [:show-bottom-sheet
{:theme :dark
:content (unpair-confirmation installation-id name)}]))
pair-device (fn []
(rf/dispatch [:syncing/enable-installation installation-id]))]
[quo/settings-item
(cond->
{:container-style style/device-container
Expand All @@ -24,13 +54,13 @@
(and show-button? unpaired?) (assoc
:action :button
:action-props
{:title (i18n/label :t/pair)
:on-press #(js/alert "feature not added yet")})
{:button-text (i18n/label :t/pair)
:on-press pair-device})
(and show-button? paired?) (assoc
:action :button
:action-props
{:button-text (i18n/label :t/unpair)
:on-press #(js/alert "feature not added yet")})
:on-press show-unpair-confirmation})
this-device? (assoc
:tag :positive
:tag-props {:label (i18n/label :t/this-device)}))]))
51 changes: 51 additions & 0 deletions src/status_im/contexts/syncing/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[status-im.constants :as constants]
[status-im.contexts.syncing.utils :as sync-utils]
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[utils.security.core :as security]
[utils.transforms :as transforms]))
Expand Down Expand Up @@ -111,3 +112,53 @@
(native-module/get-connection-string-for-bootstrapping-another-device
config-map
handle-connection)))))

(rf/reg-event-fx
:syncing/enable-installation
(fn [_ [installation-id]]
{:fx [[:json-rpc/call
[{:method "wakuext_enableInstallation"
:params [installation-id]
:on-success #(rf/dispatch [:syncing/on-enable-installation-success installation-id])
:on-error #(rf/dispatch [:syncing/on-toggle-installation-failed % installation-id])}]]]}))

(rf/reg-event-fx
:syncing/disable-installation
(fn [_ [installation-id]]
{:fx [[:json-rpc/call
[{:method "wakuext_disableInstallation"
:params [installation-id]
:on-success #(rf/dispatch [:syncing/on-disable-installation-success installation-id])
:on-error #(rf/dispatch [:syncing/on-toggle-installation-failed % installation-id])}]]]}))

(rf/reg-event-fx
:syncing/on-enable-installation-success
(fn [{:keys [db]} [installation-id]]
{:db (assoc-in db
[:pairing/installations installation-id :enabled?]
true)
:fx [[:dispatch
[:toasts/upsert
{:type :positive
:theme :dark
:text (i18n/label :t/pair-device-toast)}]]]}))

(rf/reg-event-fx
:syncing/on-disable-installation-success
(fn [{:keys [db]} [installation-id]]
{:db (assoc-in db
[:pairing/installations installation-id :enabled?]
false)
:fx [[:dispatch [:hide-bottom-sheet]]
[:dispatch
[:toasts/upsert
{:type :positive
:theme :dark
:text (i18n/label :t/unpair-device-toast)}]]]}))

(rf/reg-event-fx
:syncing/on-toggle-installation-failed
(fn [_ [error installation-id]]
(log/error "Failed to toggle installation"
{:error error
:installation-id installation-id})))
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
:flex 1})

(def page-container
{:flex 1
:justify-content :flex-start
:margin-horizontal 20})
{:flex 1
:padding-horizontal 20})

(def title-container
{:flex-direction :row
Expand All @@ -20,9 +19,6 @@
:margin-top 12
:margin-bottom 12})

(def navigation-bar
{:height 56})

(def subtitle
{:margin-top 20
:color colors/white-opa-40})
31 changes: 20 additions & 11 deletions src/status_im/contexts/syncing/syncing_devices_list/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn go-back
[]
(rf/dispatch [:navigate-back]))

(defn open-setup-syncing
[]
(rf/dispatch [:open-modal :settings-setup-syncing]))

(defn view
[]
(let [devices (rf/sub [:pairing/installations])
Expand All @@ -25,8 +33,11 @@
{:type :no-title
:background :blur
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back])}]
[rn/view {:style style/page-container}
:on-press go-back}]
[rn/scroll-view
{:content-container-style style/page-container
:style {:flex 1}
:shows-vertical-scroll-indicator false}
[rn/view {:style style/title-container}
[quo/text
{:size :heading-1
Expand All @@ -38,7 +49,7 @@
:type :primary
:customization-color profile-color
:icon-only? true
:on-press #(rf/dispatch [:open-modal :settings-setup-syncing])}
:on-press open-setup-syncing}
:i/add]]
[device/view (merge user-device {:this-device? true})]
(when (seq paired-devices)
Expand All @@ -48,18 +59,16 @@
:weight :medium
:style style/subtitle}
(i18n/label :t/paired-with-this-device)]
[rn/flat-list
{:key-fn str
:render-fn device/view
:data paired-devices}]])
(for [device-props paired-devices]
^{:key (:installation-id device-props)}
[device/view device-props])])
(when (seq unpaired-devices)
[rn/view
[quo/text
{:size :paragraph-2
:weight :medium
:style style/subtitle}
(i18n/label :t/not-paired-with-this-device)]
[rn/flat-list
{:key-fn str
:render-fn device/view
:data unpaired-devices}]])]]))
(for [device-props unpaired-devices]
^{:key (:installation-id device-props)}
[device/view device-props])])]]))
6 changes: 3 additions & 3 deletions status-go-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v0.179.10",
"commit-sha1": "90b18d4f8801b09f68bb5b794a5b6af92001d26e",
"src-sha256": "0dlrnpr7wj9z2ywm90avgdzdr9wg71dy82v5jjc9wmiz537mn7wy"
"version": "v0.179.11",
"commit-sha1": "b124e2b4f27a2aa41ffebb1ccf385475c5e87781",
"src-sha256": "142988smak33gmz0zd21ifkn2kajh9di858hrfffbk0xsxbv59rm"
}
4 changes: 4 additions & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,7 @@
"own-your-crypto": "Own your crypto",
"pair": "Pair",
"pair-devices": "Pair devices",
"pair-device-toast": "Device successfully paired",
"pair-card": "Pair to this device",
"pair-code": "Pair code",
"pair-code-explanation": "Pairs card to a different device (up to 5) to unlock keys and sign transactions with the same Keycard",
Expand Down Expand Up @@ -1476,6 +1477,9 @@
"unpair": "Unpair",
"unpair-card": "Unpair card",
"unpair-card-confirmation": "This operation will unpair card from current device. Requires 6-digit passcode authorization. Do you want to proceed?",
"unpair-device": "Unpair device?",
"unpair-device-description": "This device will no longer synchronize with {{name}} until you pair them again.",
"unpair-device-toast": "Device successfully unpaired",
"unpaired-keycard-text": "The Keycard you tapped is not associated with this phone",
"unpaired-keycard-title": "Looks like your card has been unpaired",
"unpair-keycard": "Unpair Keycard from this phone",
Expand Down

0 comments on commit 75cde66

Please sign in to comment.