Compare commits

..
1 Commits
Author SHA1 Message Date
Omar Basem 2fb9e258be ac-blur 2023-08-23 13:08:54 +04:00
20 changed files with 70 additions and 233 deletions
+9 -1
View File
@@ -15,11 +15,19 @@ 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}
'';
+8 -16
View File
@@ -30,9 +30,6 @@ 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"
@@ -80,25 +77,20 @@ 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 = [
"shellHook" "unpackPhase" "secretsPhase" "buildPhase" "checkPhase" "installPhase"
"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
+2 -10
View File
@@ -1,18 +1,10 @@
{ callPackage, meta, source, goBuildLdFlags }:
{
android = {abis ? [ "armeabi-v7a" "arm64-v8a" "x86" ]}: callPackage ./build.nix {
android = callPackage ./build.nix {
platform = "android";
platformVersion = "23";
# 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;
targets = [ "android/arm" "android/arm64" "android/386" ];
outputFileName = "status-go-${source.shortRev}.aar";
inherit meta source goBuildLdFlags;
};
@@ -23,11 +23,10 @@
:margin-horizontal 12
:flex-direction :row})
(defn left-icon
[sub-label?]
(def left-icon
{:height 20
:margin-top (if sub-label? 10 :auto)
:margin-bottom (when-not sub-label? :auto)
:margin-top :auto
:margin-bottom :auto
:margin-right 12
:width 20})
@@ -51,7 +51,7 @@
[rn/view
{:accessibility-label :left-icon-for-action
:accessible true
:style (style/left-icon sub-label)}
:style style/left-icon}
[icon/icon icon
{:color (or icon-color (get-icon-color danger? theme))
:size 20}]]
@@ -1,35 +0,0 @@
(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))))
@@ -1,24 +0,0 @@
(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})
@@ -1,26 +0,0 @@
(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,12 +21,6 @@
: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
@@ -38,19 +32,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 :network) [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) [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
@@ -121,7 +115,7 @@
(defn- preview-list-internal
"[preview-list opts items]
opts
{:type :user/:community/:account/:token/:collectible/:dapp/:network
{:type :user/:community/:account/:token/:collectible/:dapp
:size 32/24/16
:list-size override items count in overflow label (optional)
:transparent? overflow-label transparent?}
-2
View File
@@ -41,7 +41,6 @@
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
@@ -194,7 +193,6 @@
;;;; 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)
-1
View File
@@ -23,7 +23,6 @@
[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,7 +28,3 @@
{: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))
+6 -10
View File
@@ -243,19 +243,15 @@
(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)
:link-previews (map #(select-keys % [:url :title :description :thumbnail])
(get-in db [:chat/link-previews :unfurled]))}]
: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)}]
: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/profile
(entry {:icon :i/friend
:label (i18n/label :t/view-profile)
:on-press #(show-profile-action chat-id)
:danger? false
@@ -1,49 +0,0 @@
(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,7 +1,6 @@
(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]
@@ -24,9 +23,7 @@
:options [{:key :user
:value "User"}
{:key :photo
:value "Photo"}
{:key :network
:value "Network"}]}
:value "Photo"}]}
{:label "List Size"
:key :list-size
:default 10
@@ -47,11 +44,6 @@
{: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
@@ -68,9 +60,8 @@
:align-items :center}
[quo2/preview-list @state
(case @type
:user user-list
:photo photos-list
:network networks-list)]]]])))
:user user-list
:photo photos-list)]]]])))
(defn preview-preview-lists
[]
@@ -45,7 +45,6 @@
[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]
@@ -201,9 +200,7 @@
{:name :permission-drawers
:component permission-drawers/preview-permission-drawers}]
:dropdowns [{:name :dropdown
:component dropdown/preview-dropdown}
{:name :network-dropdown
:component network-dropdown/preview-dropdown}]
:component dropdown/preview-dropdown}]
:empty-state [{:name :empty-state
:component empty-state/preview-empty-state}]
:gradient [{:name :gradient-cover
@@ -40,6 +40,10 @@
:justify-content :center
:padding-bottom 20})
(def box { :background-color :red
:height 100
:width 100})
(def empty-title
{:padding-bottom 2
:color colors/white})
@@ -1,11 +1,13 @@
(ns status-im2.contexts.shell.activity-center.tabs.empty-tab.view
(:require [utils.re-frame :as rf]
[react-native.core :as rn]
[quo2.core :as quo]
[status-im2.contexts.shell.activity-center.style :as style]
[utils.i18n :as i18n]
[status-im2.contexts.shell.activity-center.notification-types :as types]
[status-im2.common.resources :as resources]))
(:require
[react-native.blur :as blur]
[utils.re-frame :as rf]
[react-native.core :as rn]
[quo2.core :as quo]
[status-im2.contexts.shell.activity-center.style :as style]
[utils.i18n :as i18n]
[status-im2.contexts.shell.activity-center.notification-types :as types]
[status-im2.common.resources :as resources]))
(def empty-tab-description
{types/no-type (i18n/label :t/empty-notifications-all-tab)
@@ -23,8 +25,11 @@
(let [filter-type (rf/sub [:activity-center/filter-type])
description (get empty-tab-description filter-type nil)]
[rn/view {:style style/empty-container}
[quo/empty-state
{:blur? true
:image (resources/get-image :no-notifications-dark)
:title (i18n/label :t/empty-notifications-title-unread)
:description description}]]))
[blur/view {:overlayColor :transparent} [rn/view {:style style/box}]]
;[quo/empty-state
; {:blur? true
; :placeholder? true
; :image (resources/get-image :no-notifications-dark)
; :title (i18n/label :t/empty-notifications-title-unread)
; :description description}]
]))