Compare commits

...
Author SHA1 Message Date
Ibrahem 5715248bfe Initial commit 2023-08-23 17:58:41 +03:00
Volodymyr Kozieiev 821e39a562 Network dropdown component (#16982) 2023-08-23 14:12:15 +01:00
Ibrahem Khalil 4cef868eab [16866] Action Drawer design review (#17033) 2023-08-23 15:58:23 +03:00
Anton Iakimov 34f7a48503 nix: map android arch to status-go builds
Fixes partially #15595
In order to build less targets, when not needed we introduce this
mapping logic.
If only specific ABI is required - status-go will have the same
arhitecuture.
2023-08-23 12:15:05 +03:00
Omar Basem e0f83384a2 Quo2 Wallet: Network Link (#17049)
* Quo2 Wallet: Network Link component
2023-08-23 12:53:45 +04:00
flexsurfer 8fe7fad540 Audio button does not disappear when changed to 'Send' button #17082 (#17083) 2023-08-22 20:39:44 +02:00
Yevheniia Berdnyk 4dd5d88f0f e2e: updated community tests 703086 and 702786 2023-08-22 21:15:14 +03:00
26 changed files with 462 additions and 137 deletions
+1 -9
View File
@@ -15,19 +15,11 @@ rec {
];
inputsFrom = [
release
(release {})
androidShell
];
shellHook = ''
export ANDROID_SDK_ROOT="${androidPkgs.sdk}"
export ANDROID_NDK_ROOT="${androidPkgs.ndk}"
export STATUS_NIX_MAVEN_REPO="${deps.gradle}"
# required by some makefile targets
export STATUS_GO_ANDROID_LIBDIR=${status-go}
# check if node modules changed and if so install them
$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh ${deps.nodejs-patched}
'';
+16 -8
View File
@@ -30,6 +30,9 @@ let
# Pass secretsFile for POKT_TOKEN to jsbundle build
builtJsBundle = jsbundle { inherit secretsFile; };
# Map ANDROID_ABI_INCLUDE to status-go targets
androidAbiIncludeSplit = lib.splitString ";" androidAbiInclude;
envFileName =
if androidAbiInclude == "x86" then ".env.e2e"
@@ -77,20 +80,25 @@ in stdenv.mkDerivation rec {
ANDROID_ABI_SPLIT = androidAbiSplit;
ANDROID_ABI_INCLUDE = androidAbiInclude;
# Android SDK/NDK for use by Gradle
ANDROID_SDK_ROOT = "${androidPkgs.sdk}";
ANDROID_NDK_ROOT = "${androidPkgs.ndk}";
# Fix for ERR_OSSL_EVP_UNSUPPORTED error.
NODE_OPTIONS = "--openssl-legacy-provider";
# Used by the Android Gradle build script in android/build.gradle
STATUS_GO_ANDROID_LIBDIR = status-go;
phases = [
"unpackPhase" "secretsPhase" "buildPhase" "checkPhase" "installPhase"
"shellHook" "unpackPhase" "secretsPhase" "buildPhase" "checkPhase" "installPhase"
];
# We use shellHook as a single place to setup env vars for both build derivation and shell
shellHook = ''
# Used by the Android Gradle build script in android/build.gradle
export STATUS_GO_ANDROID_LIBDIR=${ status-go { abis = androidAbiIncludeSplit; } }
# Android SDK/NDK for use by Gradle
export ANDROID_SDK_ROOT="${androidPkgs.sdk}"
export ANDROID_NDK_ROOT="${androidPkgs.ndk}"
export STATUS_NIX_MAVEN_REPO="${deps.gradle}"
'';
unpackPhase = ''
cp -ar $src/. ./
chmod u+w -R ./
+1 -1
View File
@@ -66,7 +66,7 @@ let
# helpers for use with target argument
ios = targets.mobile.ios.shell;
android = targets.mobile.android.shell;
status-go = targets.status-go.mobile.android;
status-go = targets.status-go.mobile.android {};
};
# for merging the default shell with others
+10 -2
View File
@@ -1,10 +1,18 @@
{ callPackage, meta, source, goBuildLdFlags }:
{
android = callPackage ./build.nix {
android = {abis ? [ "armeabi-v7a" "arm64-v8a" "x86" ]}: callPackage ./build.nix {
platform = "android";
platformVersion = "23";
targets = [ "android/arm" "android/arm64" "android/386" ];
# Hide different arch naming in gomobile from Android builds.
targets = let
abiMap = {
"armeabi-v7a" = "android/arm";
"arm64-v8a" = "android/arm64";
"x86" = "android/386";
"x86_64" = "android/amd64";
};
in map (arch: abiMap."${arch}") abis;
outputFileName = "status-go-${source.shortRev}.aar";
inherit meta source goBuildLdFlags;
};
+19 -17
View File
@@ -10,14 +10,14 @@
;; (-> reanimated/slide-out-up-animation (.damping 20) .springify (.stiffness 300))
(js/eval
"
var globalThis
if (typeof window === \"undefined\") {
globalThis = global
} else {
globalThis = window
}
globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return () => globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__}})
")
var globalThis
if (typeof window === \"undefined\") {
globalThis = global
} else {
globalThis = window
}
globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return () => globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__}})
")
(def action-button #js {:default #js {:Item #js {}}})
(def config #js {:default #js {}})
@@ -139,15 +139,17 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
(def react-native-share #js {:default {}})
(def react-native-svg
#js
{:ClipPath #js {:render identity}
:Circle #js {:render identity}
:Defs #js {:render identity}
:G #js {:render identity}
:Path #js {:render identity}
:Rect #js {:render identity}
:SvgUri #js {:render identity}
:SvgXml #js {:render identity}
:default #js {:render identity}})
{:ClipPath #js {:render identity}
:Circle #js {:render identity}
:Defs #js {:render identity}
:G #js {:render identity}
:Path #js {:render identity}
:Rect #js {:render identity}
:SvgUri #js {:render identity}
:SvgXml #js {:render identity}
:LinearGradient #js {:render identity}
:Stop #js {:render identity}
:default #js {:render identity}})
(def react-native-webview #js {:default {}})
(def react-native-audio-toolkit
#js
@@ -23,10 +23,11 @@
:margin-horizontal 12
:flex-direction :row})
(def left-icon
(defn left-icon
[sub-label?]
{:height 20
:margin-top :auto
:margin-bottom :auto
:margin-top (if sub-label? 10 :auto)
:margin-bottom (when-not sub-label? :auto)
:margin-right 12
:width 20})
@@ -51,7 +51,7 @@
[rn/view
{:accessibility-label :left-icon-for-action
:accessible true
:style style/left-icon}
:style (style/left-icon sub-label)}
[icon/icon icon
{:color (or icon-color (get-icon-color danger? theme))
:size 20}]]
@@ -0,0 +1,35 @@
(ns quo2.components.dropdowns.network-dropdown.component-spec
(:require [quo2.components.dropdowns.network-dropdown.view :as network-dropdown]
[quo2.foundations.resources :as quo.resources]
[test-helpers.component :as h]))
(def ^:private networks-list
[{:source (quo.resources/get-network :ethereum)}
{:source (quo.resources/get-network :optimism)}
{:source (quo.resources/get-network :arbitrum)}])
(h/describe "Network dropdown"
(h/test "default render"
(h/render [network-dropdown/view {:state :default}
networks-list])
(h/is-truthy (h/query-by-label-text :network-dropdown)))
(h/test "Should call :on-press in enabled state"
(let [on-press (h/mock-fn)]
(h/render [network-dropdown/view
{:state :default
:on-press on-press}
networks-list])
(h/is-truthy (h/query-by-label-text :network-dropdown))
(h/fire-event :press (h/query-by-label-text :network-dropdown))
(h/was-called on-press)))
(h/test "Should not call :on-press in disabled state"
(let [on-press (h/mock-fn)]
(h/render [network-dropdown/view
{:state :disabled
:on-press on-press}
networks-list])
(h/is-truthy (h/query-by-label-text :network-dropdown))
(h/fire-event :press (h/query-by-label-text :network-dropdown))
(h/was-not-called on-press))))
@@ -0,0 +1,24 @@
(ns quo2.components.dropdowns.network-dropdown.style
(:require [quo2.foundations.colors :as colors]))
(defn container-border-color
[{:keys [state blur? theme pressed?]}]
(let [default-color (if blur?
colors/neutral-80-opa-5
(colors/theme-colors colors/neutral-30 colors/neutral-70 theme))
active-color (if blur?
colors/neutral-80-opa-10
(colors/theme-colors colors/neutral-40 colors/neutral-60 theme))]
(condp = state
:disabled default-color
:default (if pressed? active-color default-color))))
(defn dropdown-container
[{:keys [state] :as props}]
{:border-width 1
:border-radius 10
:padding-horizontal 8
:padding-vertical 6
:opacity (if (= state :disabled) 0.3 1)
:border-color (container-border-color props)
:align-items :center})
@@ -0,0 +1,26 @@
(ns quo2.components.dropdowns.network-dropdown.view
(:require [quo2.theme :as quo.theme]
[quo2.components.dropdowns.network-dropdown.style :as style]
[react-native.core :as rn]
[quo2.components.list-items.preview-list :as preview-list]
[reagent.core :as reagent]))
(defn- internal-view
[_ _]
(let [pressed? (reagent/atom false)]
(fn
[{:keys [on-press state] :as props} networks]
[rn/pressable
{:style (style/dropdown-container (merge props {:pressed? @pressed?}))
:accessibility-label :network-dropdown
:disabled (= state :disabled)
:on-press on-press
:on-press-in (fn [] (reset! pressed? true))
:on-press-out (fn [] (reset! pressed? false))}
[preview-list/preview-list
{:type :network
:list-size (count networks)
:size 20}
networks]])))
(def view (quo.theme/with-theme internal-view))
@@ -21,6 +21,12 @@
:hole-size 26
:hole-x 19
:hole-y -1}
20 {:border-radius {:circular 10 :rounded 8}
:hole-radius {:circular 11 :rounded 9}
:margin-left -4
:hole-size 22
:hole-x 15
:hole-y -1}
16 {:border-radius {:circular 8 :rounded 8}
:hole-radius {:circular 9 :rounded 9}
:margin-left -4
@@ -32,19 +38,19 @@
(defn avatar
[item type size border-radius]
(case type
:user [user-avatar/user-avatar
(merge {:ring? false
:status-indicator? false
:size (case size
32 :small
24 :xs
16 :xxxs)}
item)]
(:photo :collectible) [fast-image/fast-image
{:source (:source item)
:style {:width size
:height size
:border-radius border-radius}}]))
:user [user-avatar/user-avatar
(merge {:ring? false
:status-indicator? false
:size (case size
32 :small
24 :xs
16 :xxxs)}
item)]
(:photo :collectible :network) [fast-image/fast-image
{:source (:source item)
:style {:width size
:height size
:border-radius border-radius}}]))
(defn list-item
[index type size item list-size margin-left
@@ -115,7 +121,7 @@
(defn- preview-list-internal
"[preview-list opts items]
opts
{:type :user/:community/:account/:token/:collectible/:dapp
{:type :user/:community/:account/:token/:collectible/:dapp/:network
:size 32/24/16
:list-size override items count in overflow label (optional)
:transparent? overflow-label transparent?}
@@ -0,0 +1,85 @@
(ns quo2.components.wallet.network-link.view
(:require
[quo2.foundations.colors :as colors]
[quo2.theme :as quo.theme]
[react-native.svg :as svg]))
(defn link-linear
[{:keys [source theme]}]
[svg/svg {:xmlns "http://www.w3.org/2000/svg" :width "73" :height "10" :fill :none}
[svg/path {:stroke (get colors/networks source) :d "M68 5H5"}]
[svg/circle
{:cx "68"
:cy "5"
:r "4"
:fill (colors/theme-colors colors/white colors/neutral-90 theme)
:stroke (get colors/networks source)}]
[svg/circle
{:cx "5"
:cy "5"
:r "4"
:fill (colors/theme-colors colors/white colors/neutral-90 theme)
:stroke (get colors/networks source)}]])
(defn link-1x
[{:keys [source destination theme]}]
[svg/svg {:xmlns "http://www.w3.org/2000/svg" :width "73" :height "66" :fill :none}
[svg/path
{:stroke "url(#gradient)" :d "M68 5h-9.364c-11.046 0-20 8.954-20 20v16c0 11.046-8.955 20-20 20H5"}]
[svg/circle
{:cx "68"
:cy "5"
:r "4"
:fill (colors/theme-colors colors/white colors/neutral-90 theme)
:stroke (get colors/networks destination)}]
[svg/circle
{:cx "5"
:cy "61"
:r "4"
:fill (colors/theme-colors colors/white colors/neutral-90 theme)
:stroke (get colors/networks source)}]
[svg/defs
[svg/linear-gradient
{:id "gradient" :x1 "72.271" :x2 "82.385" :y1 "5" :y2 "34.155" :gradientUnits "userSpaceOnUse"}
[svg/stop {:stopColor (get colors/networks destination)}]
[svg/stop {:offset "1" :stopColor (get colors/networks source)}]]]])
(defn link-2x
[{:keys [source destination theme]}]
[svg/svg
{:width "73" :height "122" :viewBox "0 0 73 122" :fill "none" :xmlns "http://www.w3.org/2000/svg"}
[svg/path
{:d
"M67.9999 5L58.6356 5C47.5899 5 38.6356 13.9543 38.6356 25L38.6356 97C38.6356 108.046 29.6813 117 18.6356 117L5.00006 117"
:stroke "url(#gradient)"}]
[svg/circle
{:cx "68"
:cy "5"
:r "4"
:fill (colors/theme-colors colors/white colors/neutral-90 theme)
:stroke (get colors/networks destination)}]
[svg/circle
{:cx "5"
:cy "117"
:r "4"
:fill (colors/theme-colors colors/white colors/neutral-90 theme)
:stroke (get colors/networks source)}]
[svg/defs
[svg/linear-gradient
{:id "gradient"
:x1 "72.2711"
:y1 "5.00001"
:x2 "102.867"
:y2 "49.0993"
:gradientUnits "userSpaceOnUse"}
[svg/stop {:stop-color (get colors/networks destination)}]
[svg/stop {:offset "1" :stop-color (get colors/networks source)}]]]])
(defn- view-internal
[{:keys [shape] :as props}]
(case shape
:linear [link-linear props]
:1x [link-1x props]
:2x [link-2x props]))
(def view (quo.theme/with-theme view-internal))
+4
View File
@@ -41,6 +41,7 @@
quo2.components.drawers.drawer-buttons.view
quo2.components.drawers.permission-context.view
quo2.components.dropdowns.dropdown
quo2.components.dropdowns.network-dropdown.view
quo2.components.empty-state.empty-state.view
quo2.components.gradient.gradient-cover.view
quo2.components.graph.wallet-graph.view
@@ -114,6 +115,7 @@
quo2.components.wallet.keypair.view
quo2.components.wallet.network-amount.view
quo2.components.wallet.network-bridge.view
quo2.components.wallet.network-link.view
quo2.components.wallet.progress-bar.view
quo2.components.wallet.summary-info.view
quo2.components.wallet.token-input.view
@@ -192,6 +194,7 @@
;;;; Dropdowns
(def dropdown quo2.components.dropdowns.dropdown/dropdown)
(def network-dropdown quo2.components.dropdowns.network-dropdown.view/view)
;;;; Empty State
(def empty-state quo2.components.empty-state.empty-state.view/empty-state)
@@ -323,5 +326,6 @@
(def network-bridge quo2.components.wallet.network-bridge.view/view)
(def progress-bar quo2.components.wallet.progress-bar.view/view)
(def summary-info quo2.components.wallet.summary-info.view/view)
(def network-link quo2.components.wallet.network-link.view/view)
(def token-input quo2.components.wallet.token-input.view/view)
(def wallet-overview quo2.components.wallet.wallet-overview.view/view)
+1
View File
@@ -23,6 +23,7 @@
[quo2.components.drawers.documentation-drawers.component-spec]
[quo2.components.drawers.drawer-buttons.component-spec]
[quo2.components.drawers.permission-context.component-spec]
[quo2.components.dropdowns.network-dropdown.component-spec]
[quo2.components.gradient.gradient-cover.component-spec]
[quo2.components.graph.wallet-graph.component-spec]
[quo2.components.inputs.input.component-spec]
+4
View File
@@ -28,3 +28,7 @@
{:ethereum (js/require "../resources/images/tokens/mainnet/ETH-network.png")
:optimism (js/require "../resources/images/tokens/mainnet/OP.png")
:arbitrum (js/require "../resources/images/tokens/mainnet/ARB.png")})
(defn get-network
[n]
(get networks n))
+2
View File
@@ -10,3 +10,5 @@
(def circle (reagent/adapt-react-class Svg/Circle))
(def svgxml (reagent/adapt-react-class Svg/SvgXml))
(def g (reagent/adapt-react-class Svg/G))
(def linear-gradient (reagent/adapt-react-class Svg/LinearGradient))
(def stop (reagent/adapt-react-class Svg/Stop))
+10 -6
View File
@@ -243,15 +243,19 @@
(rf/merge
cofx
{:json-rpc/call [{:method "wakuext_editMessage"
:params [{:id message-id
:text text
:content-type (if (message-content/emoji-only-content?
{:text text :response-to quoted-message})
constants/content-type-emoji
constants/content-type-text)}]
:params [{:id message-id
:text text
:content-type (if (message-content/emoji-only-content?
{:text text
:response-to quoted-message})
constants/content-type-emoji
constants/content-type-text)
:link-previews (map #(select-keys % [:url :title :description :thumbnail])
(get-in db [:chat/link-previews :unfurled]))}]
:js-response true
:on-error #(log/error "failed to edit message " %)
:on-success (fn [result]
(prn result "awpdkoawpodkawd")
(re-frame/dispatch [:sanitize-messages-and-process-response
result]))}]}
(link-preview/reset-unfurled)
+1 -1
View File
@@ -189,7 +189,7 @@
(defn view-profile-entry
[chat-id]
(entry {:icon :i/friend
(entry {:icon :i/profile
:label (i18n/label :t/view-profile)
:on-press #(show-profile-action chat-id)
:danger? false
@@ -65,16 +65,16 @@
:i/arrow-up]])
(defn send-button
[props {:keys [text-value] :as state} animations window-height images? edit]
(let [btn-opacity (reanimated/use-shared-value 0)
z-index (reagent/atom (if (and (empty? @text-value) (not images?)) 0 1))]
[props {:keys [text-value] :as state} animations window-height images? edit btn-opacity]
(let [z-index (reagent/atom (if (and (empty? @text-value) (not images?)) 0 1))]
[:f> f-send-button props state animations window-height images? btn-opacity z-index edit]))
(defn disabled-audio-button
[]
[quo/composer-button
{:on-press #(js/alert "to be implemented")
:icon :i/audio}])
[opacity]
[reanimated/view {:style (reanimated/apply-animations-to-style {:opacity opacity} {})}
[quo/composer-button
{:on-press #(js/alert "to be implemented")
:icon :i/audio}]])
(defn audio-button
[{:keys [record-reset-fn input-ref]}
@@ -169,8 +169,8 @@
[quo/composer-button
{:on-press #(go-to-camera images-count)
:icon :i/camera
:container-style {:margin-right 12}}
]))
:container-style {:margin-right 12}}]))
(defn open-photo-selector
[{:keys [input-ref]}
@@ -212,16 +212,18 @@
(defn view
[props state animations window-height insets {:keys [edit images]}]
[rn/view {:style style/actions-container}
[rn/view
{:style {:flex-direction :row
:display (if @(:recording? state) :none :flex)}}
[camera-button]
[image-button props animations insets]
[reaction-button]
[format-button]]
[:f> send-button props state animations window-height images edit]
(when (and (not edit) (not images))
;; TODO(alwx): needs to be replaced with an `audio-button` later.
;; See https://github.com/status-im/status-mobile/issues/16084 for more details.
[disabled-audio-button])])
(let [send-btn-opacity (reanimated/use-shared-value 0)
audio-btn-opacity (reanimated/interpolate send-btn-opacity [0 1] [1 0])]
[rn/view {:style style/actions-container}
[rn/view
{:style {:flex-direction :row
:display (if @(:recording? state) :none :flex)}}
[camera-button]
[image-button props animations insets]
[reaction-button]
[format-button]]
[:f> send-button props state animations window-height images edit send-btn-opacity]
(when (and (not edit) (not images))
;; TODO(alwx): needs to be replaced with an `audio-button` later.
;; See https://github.com/status-im/status-mobile/issues/16084 for more details.
[:f> disabled-audio-button audio-btn-opacity])]))
@@ -123,7 +123,7 @@
[gradients/view props state animations show-bottom-gradient?]
[link-preview/view]
[images/images-list]])]
[actions/view props state animations window-height insets subs]]]]]))
[:f> actions/view props state animations window-height insets subs]]]]]))
(defn composer
[insets]
@@ -0,0 +1,49 @@
(ns status-im2.contexts.quo-preview.dropdowns.network-dropdown
(:require [quo2.foundations.resources :as quo.resources]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im2.contexts.quo-preview.preview :as preview]
[quo2.core :as quo]))
(def descriptor
[{:key :state
:type :select
:options [{:key :default
:value "Default"}
{:key :disabled
:value "Disabled"}]}
{:key :blur?
:type :select
:options [{:key true
:value "True"}
{:key false
:value "False"}]}
{:key :amount
:type :select
:options [{:key 1
:value 1}
{:key 2
:value 2}
{:key 3
:value 3}]}])
(def ^:private networks-list
[{:source (quo.resources/get-network :ethereum)}
{:source (quo.resources/get-network :optimism)}
{:source (quo.resources/get-network :arbitrum)}])
(defn preview-dropdown
[]
(let [component-state (reagent/atom {:state :default :blur? false :amount 3})]
(fn []
[preview/preview-container
{:state component-state
:descriptor descriptor
:blur? (:blur? @component-state)
:show-blur-background? true}
[rn/view {:style {:align-self :center}}
[quo/network-dropdown
(merge {:on-press #(js/alert "Dropdown pressed")}
@component-state)
(take (:amount @component-state) networks-list)]]])))
@@ -1,6 +1,7 @@
(ns status-im2.contexts.quo-preview.list-items.preview-lists
(:require [quo2.components.list-items.preview-list :as quo2]
[quo2.foundations.colors :as colors]
[quo2.foundations.resources :as quo.resources]
[react-native.core :as rn]
[reagent.core :as reagent]
[utils.i18n :as i18n]
@@ -23,7 +24,9 @@
:options [{:key :user
:value "User"}
{:key :photo
:value "Photo"}]}
:value "Photo"}
{:key :network
:value "Network"}]}
{:label "List Size"
:key :list-size
:default 10
@@ -44,6 +47,11 @@
{:source (resources/get-mock-image :photo2)}
{:source (resources/get-mock-image :photo3)}])
(def networks-list
[{:source (quo.resources/get-network :ethereum)}
{:source (quo.resources/get-network :optimism)}
{:source (quo.resources/get-network :arbitrum)}])
(defn cool-preview
[]
(let [state (reagent/atom {:type :user
@@ -60,8 +68,9 @@
:align-items :center}
[quo2/preview-list @state
(case @type
:user user-list
:photo photos-list)]]]])))
:user user-list
:photo photos-list
:network networks-list)]]]])))
(defn preview-preview-lists
[]
@@ -45,6 +45,7 @@
[status-im2.contexts.quo-preview.drawers.drawer-buttons :as drawer-buttons]
[status-im2.contexts.quo-preview.drawers.permission-drawers :as permission-drawers]
[status-im2.contexts.quo-preview.dropdowns.dropdown :as dropdown]
[status-im2.contexts.quo-preview.dropdowns.network-dropdown :as network-dropdown]
[status-im2.contexts.quo-preview.foundations.shadows :as shadows]
[status-im2.contexts.quo-preview.info.info-message :as info-message]
[status-im2.contexts.quo-preview.info.information-box :as information-box]
@@ -115,6 +116,7 @@
[status-im2.contexts.quo-preview.wallet.keypair :as keypair]
[status-im2.contexts.quo-preview.wallet.network-amount :as network-amount]
[status-im2.contexts.quo-preview.wallet.network-bridge :as network-bridge]
[status-im2.contexts.quo-preview.wallet.network-link :as network-link]
[status-im2.contexts.quo-preview.wallet.progress-bar :as progress-bar]
[status-im2.contexts.quo-preview.wallet.summary-info :as summary-info]
[status-im2.contexts.quo-preview.wallet.token-input :as token-input]
@@ -199,7 +201,9 @@
{:name :permission-drawers
:component permission-drawers/preview-permission-drawers}]
:dropdowns [{:name :dropdown
:component dropdown/preview-dropdown}]
:component dropdown/preview-dropdown}
{:name :network-dropdown
:component network-dropdown/preview-dropdown}]
:empty-state [{:name :empty-state
:component empty-state/preview-empty-state}]
:gradient [{:name :gradient-cover
@@ -345,6 +349,8 @@
:component network-amount/preview}
{:name :network-bridge
:component network-bridge/preview}
{:name :network-link
:component network-link/preview}
{:name :progress-bar
:component progress-bar/preview}
{:name :summary-info
@@ -0,0 +1,50 @@
(ns status-im2.contexts.quo-preview.wallet.network-link
(:require
[quo2.core :as quo]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im2.contexts.quo-preview.preview :as preview]))
(def networks
[{:key :ethereum
:value "Ethereum"}
{:key :optimism
:value "Optimism"}
{:key :arbitrum
:vault "Arbitrum"}])
(def descriptor
[{:label "Shape:"
:key :shape
:type :select
:options [{:key :linear
:value "Linear"}
{:key :1x
:value "1x"}
{:key :2x
:value "2x"}]}
{:label "Source:"
:key :source
:type :select
:options networks}
{:label "Destination:"
:key :destination
:type :select
:options networks}])
(defn preview
[]
(let [state (reagent/atom {:shape :linear
:source :ethereum
:destination :optimism})]
(fn []
[rn/view
{:style {:flex 1
:padding-horizontal 20}}
[rn/view {:style {:min-height 150}}
[preview/customizer state descriptor]]
[rn/view
{:style {:flex 1
:padding-top 40
:align-items :center}}
[quo/network-link @state]]])))
@@ -984,24 +984,29 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.home_2.get_chat(self.community_name, community=True).click()
self.community_2.get_channel(self.channel_name).click()
self.channel_2.send_message(self.text_message)
community_1_element = self.community_1.get_chat(self.community_name)
community_1_element = self.community_1.get_chat(self.community_name, community=True)
if not community_1_element.new_messages_grey_dot.is_element_displayed(90):
self.errors.append('New messages counter is not shown in home > Commmunity element')
self.errors.append('New messages counter is not shown in home > Community element')
community_1_element.click()
channel_1_element = self.community_1.get_chat(self.channel_name, community_channel=True)
if not channel_1_element.new_messages_grey_dot.is_element_displayed():
self.errors.append("New messages counter is not shown in community channel element")
self.community_1.click_system_back_button()
mark_as_read_button = self.community_1.mark_all_messages_as_read_button
community_1_element.long_press_until_element_is_shown(mark_as_read_button)
mark_as_read_button.click()
if community_1_element.new_messages_grey_dot.is_element_displayed():
self.errors.append(
'Unread messages badge is shown in community channel while there are no unread messages')
# TODO: there should be one more check for community channel, which is still not ready
# self.community_1.click_system_back_button_until_element_is_shown()
# community_1_element = self.home_1.get_chat(self.community_name, community=True)
# if community_1_element.new_messages_community.is_element_displayed():
# self.errors.append('New messages community badge is shown on community after marking messages as read')
'Unread messages badge is shown in community element while there are no unread messages')
community_1_element.click()
if channel_1_element.new_messages_grey_dot.is_element_displayed():
self.errors.append(
"New messages badge is shown in community channel element while there are no unread messages")
self.errors.verify_no_errors()
@marks.testrail_id(702786)
@marks.xfail(
reason="Issue with username in PN, issue #6 in https://github.com/status-im/status-mobile/issues/15500")
def test_community_mentions_push_notification(self):
self.home_1.navigate_back_to_home_view()
if not self.channel_2.chat_message_input.is_element_displayed():
@@ -1030,6 +1035,8 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
else:
self.errors.append("Push notification with the mention was not received by admin")
self.channel_1.click_system_back_button()
if message_received:
self.channel_1.just_fyi("Set reaction for the message with a mention")
self.channel_1.set_reaction(message=self.username_1, emoji="sad")
@@ -1039,46 +1046,45 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
except (Failed, NoSuchElementException):
self.errors.append("Message reaction is not shown for the sender")
# ToDo: this part is skipped because of an issue - sent messages stuck without any status for a long time
# and can not be edited during that time
# self.device_2.just_fyi("Sender edits the message with a mention")
# self.channel_2.chat_element_by_text(self.username_1).wait_for_sent_state()
# self.channel_2.chat_element_by_text(self.username_1).long_press_element_by_coordinate(rel_y=0)
# try:
# self.channel_2.element_by_translation_id("edit-message").click()
# for i in range(29, 32):
# self.channel_2.driver.press_keycode(i)
# self.channel_2.send_message_button.click()
# edited_message = self.username_1 + " abc"
# if not self.channel_2.chat_element_by_text(edited_message).is_element_displayed():
# self.errors.append("Edited message is not shown correctly for the sender")
# if not self.channel_1.chat_element_by_text(edited_message).is_element_displayed():
# self.errors.append("Edited message is not shown correctly for the (receiver) admin")
# except NoSuchElementException:
# self.errors.append("Can not edit a message with a mention")
self.device_2.just_fyi("Sender edits the message with a mention")
self.channel_2.chat_element_by_text(self.username_1).wait_for_sent_state()
self.channel_2.chat_element_by_text(self.username_1).long_press_element_by_coordinate(rel_y=0)
try:
self.channel_2.element_by_translation_id("edit-message").click()
for i in range(29, 32):
self.channel_2.driver.press_keycode(i)
self.channel_2.send_message_button.click()
edited_message = self.username_1 + " abc"
if not self.channel_2.chat_element_by_text(edited_message).is_element_displayed():
self.errors.append("Edited message is not shown correctly for the sender")
if not self.channel_1.chat_element_by_text(edited_message).is_element_displayed():
self.errors.append("Edited message is not shown correctly for the (receiver) admin")
except NoSuchElementException:
self.errors.append("Can not edit a message with a mention")
# ToDo: enable when https://github.com/status-im/status-mobile/issues/14956 is fixed
# self.home_2.click_system_back_button_until_element_is_shown()
# if not self.channel_1.chat_message_input.is_element_displayed():
# self.channel_1.click_system_back_button_until_element_is_shown()
# self.home_1.communities_tab.click()
# self.home_1.get_chat(self.community_name, community=True).click()
# self.community_1.get_channel(self.channel_name).click()
#
# self.device_1.just_fyi("Admin sends a message with a mention")
# self.channel_1.mention_user(self.username_2)
# self.channel_1.send_message_button.click()
# self.device_2.just_fyi("Invited member gets push notification with the mention and tap it")
# self.device_2.open_notification_bar()
# if not self.home_2.get_pn(self.username_2):
# self.device_2.driver.fail("Push notification with the mention was not received by the invited member")
# self.device_2.click_upon_push_notification_by_text(self.username_2)
# if not self.channel_2.chat_element_by_text(self.username_2).is_element_displayed():
# if self.channel_2.chat_message_input.is_element_displayed():
# self.device_2.driver.fail("Message with the mention is not shown in the chat for the invited member")
# else:
# self.device_2.driver.fail(
# "Channel did not open by clicking on a notification with the mention for the invited member")
self.home_2.navigate_back_to_home_view()
if not self.channel_1.chat_message_input.is_element_displayed():
self.channel_1.navigate_back_to_home_view()
self.home_1.communities_tab.click()
self.home_1.get_chat(self.community_name, community=True).click()
self.community_1.get_channel(self.channel_name).click()
self.device_1.just_fyi("Admin sends a message with a mention")
self.channel_1.mention_user(self.username_2)
self.channel_1.send_message_button.click()
self.device_2.just_fyi("Invited member gets push notification with the mention and tap it")
self.device_2.open_notification_bar()
push_notification_element = self.home_2.get_pn(self.username_2)
if push_notification_element:
push_notification_element.click()
if not self.channel_2.chat_element_by_text(self.username_2).is_element_displayed():
if self.channel_2.chat_message_input.is_element_displayed():
self.errors.append("Message with the mention is not shown in the chat for the invited member")
else:
self.errors.append(
"Channel did not open by clicking on a notification with the mention for the invited member")
else:
self.errors.append("Push notification with the mention was not received by the invited member")
self.errors.verify_no_errors()
@marks.testrail_id(702809)
+1
View File
@@ -546,6 +546,7 @@ class HomeView(BaseView):
def get_public_key_via_share_profile_tab(self):
self.driver.info("Getting public key via Share tab")
self.show_qr_code_button.click()
self.link_to_profile_text.wait_for_visibility_of_element()
self.link_to_profile_text.click()
c_text = self.driver.get_clipboard_text()
self.click_system_back_button()