Getting rid of status-im.multiaccounts.core + removing three word random names (#17384)
This commit is contained in:
parent
fb8a7d2d8e
commit
dc571b6067
|
@ -765,7 +765,7 @@ SPEC CHECKSUMS:
|
|||
RNLanguages: 962e562af0d34ab1958d89bcfdb64fafc37c513e
|
||||
RNPermissions: ad71dd4f767ec254f2cd57592fbee02afee75467
|
||||
RNReactNativeHapticFeedback: 2566b468cc8d0e7bb2f84b23adc0f4614594d071
|
||||
RNReanimated: 62e43ee6baafb9ba3d3af1857d7fd23a1d41bff0
|
||||
RNReanimated: 42f56dc5c032a11177b9ea12cdb57285318b432e
|
||||
RNShare: d82e10f6b7677f4b0048c23709bd04098d5aee6c
|
||||
RNStaticSafeAreaInsets: 055ddbf5e476321720457cdaeec0ff2ba40ec1b8
|
||||
RNSVG: 80584470ff1ffc7994923ea135a3e5ad825546b9
|
||||
|
|
|
@ -1194,21 +1194,6 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
|||
return getPublicStorageDirectory().getAbsolutePath();
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String generateAlias(final String seed) {
|
||||
return Statusgo.generateAlias(seed);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void generateAliasAsync(final String seed, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.generateAlias(seed), callback);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String identicon(final String seed) {
|
||||
return Statusgo.identicon(seed);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String encodeTransfer(final String to, final String value) {
|
||||
return Statusgo.encodeTransfer(to, value);
|
||||
|
@ -1269,31 +1254,6 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
|||
executeRunnableStatusGoMethod(() -> Statusgo.identicon(seed), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void generateAliasAndIdenticonAsync(final String seed, final Callback callback) {
|
||||
|
||||
Log.d(TAG, "generateAliasAndIdenticonAsync");
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String resIdenticon = Statusgo.identicon(seed);
|
||||
String resAlias = Statusgo.generateAlias(seed);
|
||||
|
||||
Log.d(TAG, resIdenticon);
|
||||
Log.d(TAG, resAlias);
|
||||
callback.invoke(resAlias, resIdenticon);
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable
|
||||
Map<String, Object> getConstants() {
|
||||
|
|
|
@ -880,10 +880,6 @@ RCT_EXPORT_METHOD(callRPC:(NSString *)payload
|
|||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(generateAlias:(NSString *)publicKey) {
|
||||
return StatusgoGenerateAlias(publicKey);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(keystoreDir) {
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *rootUrl =[[fileManager
|
||||
|
@ -943,19 +939,6 @@ RCT_EXPORT_METHOD(initLogging:(BOOL)enabled
|
|||
callback(@[initResult]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(generateAliasAsync:(NSString *)publicKey
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"generateAliasAsync() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoGenerateAlias(publicKey);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(identicon:(NSString *)publicKey) {
|
||||
return StatusgoIdenticon(publicKey);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(encodeTransfer:(NSString *)to
|
||||
value:(NSString *)value) {
|
||||
return StatusgoEncodeTransfer(to,value);
|
||||
|
@ -1011,15 +994,6 @@ RCT_EXPORT_METHOD(validateMnemonic:(NSString *)seed
|
|||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(identiconAsync:(NSString *)publicKey
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"identiconAsync() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoIdenticon(publicKey);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(createAccountAndLogin:(NSString *)request) {
|
||||
#if DEBUG
|
||||
NSLog(@"createAccountAndLogin() method called");
|
||||
|
@ -1034,16 +1008,6 @@ RCT_EXPORT_METHOD(restoreAccountAndLogin:(NSString *)request) {
|
|||
StatusgoRestoreAccountAndLogin(request);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(generateAliasAndIdenticonAsync:(NSString *)publicKey
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"generateAliasAndIdenticonAsync() method called");
|
||||
#endif
|
||||
NSString *identiconResult = StatusgoIdenticon(publicKey);
|
||||
NSString *aliasResult = StatusgoGenerateAlias(publicKey);
|
||||
callback(@[aliasResult, identiconResult]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(callPrivateRPC:(NSString *)payload
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
|
|
|
@ -354,38 +354,6 @@ void _StopCPUProfiling(const FunctionCallbackInfo<Value>& args) {
|
|||
|
||||
}
|
||||
|
||||
void _Identicon(const FunctionCallbackInfo<Value>& args) {
|
||||
Isolate* isolate = args.GetIsolate();
|
||||
Local<Context> context = isolate->GetCurrentContext();
|
||||
|
||||
if (args.Length() != 1) {
|
||||
// Throw an Error that is passed back to JavaScript
|
||||
isolate->ThrowException(Exception::TypeError(
|
||||
String::NewFromUtf8Literal(isolate, "Wrong number of arguments for Identicon")));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the argument types
|
||||
|
||||
if (!args[0]->IsString()) {
|
||||
isolate->ThrowException(Exception::TypeError(
|
||||
String::NewFromUtf8Literal(isolate, "Wrong argument type for 'pk'")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String::Utf8Value arg0Obj(isolate, args[0]->ToString(context).ToLocalChecked());
|
||||
char *arg0 = *arg0Obj;
|
||||
|
||||
// Call exported Go function, which returns a C string
|
||||
char *c = Identicon(arg0);
|
||||
|
||||
Local<String> ret = String::NewFromUtf8(isolate, c).ToLocalChecked();
|
||||
args.GetReturnValue().Set(ret);
|
||||
delete c;
|
||||
|
||||
}
|
||||
|
||||
void _EncodeTransfer(const FunctionCallbackInfo<Value>& args) {
|
||||
Isolate* isolate = args.GetIsolate();
|
||||
Local<Context> context = isolate->GetCurrentContext();
|
||||
|
@ -864,38 +832,6 @@ void _CreateAccountAndLogin(const FunctionCallbackInfo<Value>& args) {
|
|||
|
||||
}
|
||||
|
||||
void _GenerateAlias(const FunctionCallbackInfo<Value>& args) {
|
||||
Isolate* isolate = args.GetIsolate();
|
||||
Local<Context> context = isolate->GetCurrentContext();
|
||||
|
||||
if (args.Length() != 1) {
|
||||
// Throw an Error that is passed back to JavaScript
|
||||
isolate->ThrowException(Exception::TypeError(
|
||||
String::NewFromUtf8Literal(isolate, "Wrong number of arguments for GenerateAlias")));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the argument types
|
||||
|
||||
if (!args[0]->IsString()) {
|
||||
isolate->ThrowException(Exception::TypeError(
|
||||
String::NewFromUtf8Literal(isolate, "Wrong argument type for 'pk'")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String::Utf8Value arg0Obj(isolate, args[0]->ToString(context).ToLocalChecked());
|
||||
char *arg0 = *arg0Obj;
|
||||
|
||||
// Call exported Go function, which returns a C string
|
||||
char *c = GenerateAlias(arg0);
|
||||
|
||||
Local<String> ret = String::NewFromUtf8(isolate, c).ToLocalChecked();
|
||||
args.GetReturnValue().Set(ret);
|
||||
delete c;
|
||||
|
||||
}
|
||||
|
||||
void _ValidateMnemonic(const FunctionCallbackInfo<Value>& args) {
|
||||
Isolate* isolate = args.GetIsolate();
|
||||
Local<Context> context = isolate->GetCurrentContext();
|
||||
|
@ -1953,7 +1889,6 @@ void init(Local<Object> exports) {
|
|||
NODE_SET_METHOD(exports, "multiAccountStoreAccount", _MultiAccountStoreAccount);
|
||||
NODE_SET_METHOD(exports, "initKeystore", _InitKeystore);
|
||||
NODE_SET_METHOD(exports, "stopCPUProfiling", _StopCPUProfiling);
|
||||
NODE_SET_METHOD(exports, "identicon", _Identicon);
|
||||
NODE_SET_METHOD(exports, "encodeTransfer", _EncodeTransfer);
|
||||
NODE_SET_METHOD(exports, "encodeFunctionCall", _EncodeFunctionCall);
|
||||
NODE_SET_METHOD(exports, "decodeParameters", _DecodeParameters);
|
||||
|
@ -1968,7 +1903,6 @@ void init(Local<Object> exports) {
|
|||
NODE_SET_METHOD(exports, "resetChainData", _ResetChainData);
|
||||
NODE_SET_METHOD(exports, "saveAccountAndLogin", _SaveAccountAndLogin);
|
||||
NODE_SET_METHOD(exports, "createAccountAndLogin", _CreateAccountAndLogin);
|
||||
NODE_SET_METHOD(exports, "generateAlias", _GenerateAlias);
|
||||
NODE_SET_METHOD(exports, "validateMnemonic", _ValidateMnemonic);
|
||||
NODE_SET_METHOD(exports, "multiformatSerializePublicKey", _MultiformatSerializePublicKey);
|
||||
NODE_SET_METHOD(exports, "saveAccountAndLoginWithKeycard", _SaveAccountAndLoginWithKeycard);
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
[clojure.string :as string]
|
||||
[react-native.platform :as platform]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.transforms :as types]
|
||||
[utils.validators :as validators]))
|
||||
[utils.transforms :as types]))
|
||||
|
||||
(defn status
|
||||
[]
|
||||
|
@ -431,19 +430,6 @@
|
|||
;; in unknown scenarios we also consider the device rooted to avoid degrading security
|
||||
:else (callback true)))
|
||||
|
||||
(defn generate-gfycat
|
||||
"Generate a 3 words random name based on the user public-key, synchronously"
|
||||
[public-key]
|
||||
(log/debug "[native-module] generate-gfycat")
|
||||
(when (validators/valid-public-key? public-key)
|
||||
(.generateAlias ^js (status) public-key)))
|
||||
|
||||
(defn identicon
|
||||
"Generate a icon based on a string, synchronously"
|
||||
[seed]
|
||||
(log/debug "[native-module] identicon")
|
||||
(.identicon ^js (status) seed))
|
||||
|
||||
(defn encode-transfer
|
||||
[to-norm amount-hex]
|
||||
(log/debug "[native-module] encode-transfer")
|
||||
|
@ -501,12 +487,6 @@
|
|||
(log/debug "[native-module] to-checksum-address")
|
||||
(.toChecksumAddress ^js (status) address))
|
||||
|
||||
(defn gfycat-identicon-async
|
||||
"Generate an icon based on a string and 3 words random name asynchronously"
|
||||
[seed callback]
|
||||
(log/debug "[native-module] gfycat-identicon-async")
|
||||
(.generateAliasAndIdenticonAsync ^js (status) seed callback))
|
||||
|
||||
(defn validate-mnemonic
|
||||
"Validate that a mnemonic conforms to BIP39 dictionary/checksum standards"
|
||||
[mnemonic callback]
|
||||
|
|
|
@ -11,9 +11,3 @@
|
|||
:group/selected-contacts #{}
|
||||
:new-chat-name "")}
|
||||
(navigation/navigate-to :contact-toggle-list nil)))
|
||||
|
||||
(defn displayed-photo
|
||||
[{:keys [images]}]
|
||||
(or (:large images)
|
||||
(:thumbnail images)
|
||||
(first images)))
|
||||
|
|
|
@ -2,21 +2,12 @@
|
|||
(:require
|
||||
[clojure.set :as set]
|
||||
[clojure.string :as string]
|
||||
[status-im.utils.gfycat.core :as gfycat]
|
||||
[status-im2.constants :as constants]
|
||||
[utils.address :as address]))
|
||||
|
||||
(defn public-key->new-contact
|
||||
[public-key]
|
||||
(let [alias (gfycat/generate-gfy public-key)]
|
||||
{:alias alias
|
||||
:name alias
|
||||
:primary-name alias
|
||||
:public-key public-key}))
|
||||
|
||||
(defn public-key-and-ens-name->new-contact
|
||||
[public-key ens-name]
|
||||
(let [contact (public-key->new-contact public-key)]
|
||||
(let [contact {:public-key public-key}]
|
||||
(if ens-name
|
||||
(-> contact
|
||||
(assoc :ens-name ens-name)
|
||||
|
@ -27,8 +18,7 @@
|
|||
(defn public-key->contact
|
||||
[contacts public-key]
|
||||
(when public-key
|
||||
(or (get contacts public-key)
|
||||
(public-key->new-contact public-key))))
|
||||
(get contacts public-key {:public-key public-key})))
|
||||
|
||||
(defn- contact-by-address
|
||||
[[addr contact] address]
|
||||
|
@ -66,8 +56,13 @@
|
|||
(assoc public-key current-contact))]
|
||||
(->> members
|
||||
(map #(or (get all-contacts %)
|
||||
(public-key->new-contact %)))
|
||||
(sort-by (comp string/lower-case #(or (:primary-name %) (:name %) (:alias %))))
|
||||
{:public-key %}))
|
||||
(sort-by (comp string/lower-case
|
||||
(fn [{:keys [primary-name name alias public-key]}]
|
||||
(or primary-name
|
||||
name
|
||||
alias
|
||||
public-key))))
|
||||
(map #(if (get admins (:public-key %))
|
||||
(assoc % :admin? true)
|
||||
%)))))
|
||||
|
|
|
@ -1,55 +1,49 @@
|
|||
(ns status-im.contact.db-test
|
||||
(:require
|
||||
[cljs.test :refer-macros [deftest is testing]]
|
||||
[status-im.contact.db :as contact.db]
|
||||
[status-im.utils.gfycat.core :as gfycat]))
|
||||
(:require [cljs.test :refer-macros [deftest is testing]]
|
||||
[status-im.contact.db :as contact.db]))
|
||||
|
||||
(deftest contacts-subs
|
||||
(testing "get-all-contacts-in-group-chat"
|
||||
(with-redefs [gfycat/generate-gfy (constantly "generated")]
|
||||
(let
|
||||
[chat-contact-ids
|
||||
#{"0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917"
|
||||
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"
|
||||
"0x048a2f8b80c60f89a91b4c1316e56f75b087f446e7b8701ceca06a40142d8efe1f5aa36bd0fee9e248060a8d5207b43ae98bef4617c18c71e66f920f324869c09f"}
|
||||
admins
|
||||
#{"0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917"}
|
||||
(let
|
||||
[chat-contact-ids
|
||||
#{"0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917"
|
||||
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"
|
||||
"0x048a2f8b80c60f89a91b4c1316e56f75b087f446e7b8701ceca06a40142d8efe1f5aa36bd0fee9e248060a8d5207b43ae98bef4617c18c71e66f920f324869c09f"}
|
||||
admins
|
||||
#{"0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917"}
|
||||
|
||||
contacts
|
||||
{"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"
|
||||
{:last-updated 0
|
||||
:name "User B"
|
||||
:primary-name "User B"
|
||||
:last-online 0
|
||||
:public-key
|
||||
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}}
|
||||
current-multiaccount
|
||||
{:last-updated 0
|
||||
:signed-up? true
|
||||
:sharing-usage-data? false
|
||||
:primary-name "User A"
|
||||
:name "User A"
|
||||
contacts
|
||||
{"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"
|
||||
{:last-updated 0
|
||||
:name "User B"
|
||||
:primary-name "User B"
|
||||
:last-online 0
|
||||
:public-key
|
||||
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}}
|
||||
current-multiaccount
|
||||
{:last-updated 0
|
||||
:signed-up? true
|
||||
:sharing-usage-data? false
|
||||
:primary-name "User A"
|
||||
:name "User A"
|
||||
:public-key
|
||||
"0x048a2f8b80c60f89a91b4c1316e56f75b087f446e7b8701ceca06a40142d8efe1f5aa36bd0fee9e248060a8d5207b43ae98bef4617c18c71e66f920f324869c09f"}]
|
||||
(is
|
||||
(=
|
||||
(contact.db/get-all-contacts-in-group-chat chat-contact-ids
|
||||
admins
|
||||
contacts
|
||||
current-multiaccount)
|
||||
[{:admin? true
|
||||
:public-key
|
||||
"0x048a2f8b80c60f89a91b4c1316e56f75b087f446e7b8701ceca06a40142d8efe1f5aa36bd0fee9e248060a8d5207b43ae98bef4617c18c71e66f920f324869c09f"}]
|
||||
(is
|
||||
(=
|
||||
(contact.db/get-all-contacts-in-group-chat chat-contact-ids
|
||||
admins
|
||||
contacts
|
||||
current-multiaccount)
|
||||
[{:name "generated"
|
||||
:primary-name "generated"
|
||||
:alias "generated"
|
||||
:admin? true
|
||||
:public-key
|
||||
"0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917"}
|
||||
{:alias "User A"
|
||||
:primary-name "User A"
|
||||
:public-key
|
||||
"0x048a2f8b80c60f89a91b4c1316e56f75b087f446e7b8701ceca06a40142d8efe1f5aa36bd0fee9e248060a8d5207b43ae98bef4617c18c71e66f920f324869c09f"}
|
||||
{:last-updated 0
|
||||
:name "User B"
|
||||
:primary-name "User B"
|
||||
:last-online 0
|
||||
:public-key
|
||||
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}]))))))
|
||||
"0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917"}
|
||||
{:alias "User A"
|
||||
:primary-name "User A"
|
||||
:public-key
|
||||
"0x048a2f8b80c60f89a91b4c1316e56f75b087f446e7b8701ceca06a40142d8efe1f5aa36bd0fee9e248060a8d5207b43ae98bef4617c18c71e66f920f324869c09f"}
|
||||
{:last-updated 0
|
||||
:name "User B"
|
||||
:primary-name "User B"
|
||||
:last-online 0
|
||||
:public-key
|
||||
"0x04985040682b77a32bb4bb58268a0719bd24ca4d07c255153fe1eb2ccd5883669627bd1a092d7cc76e8e4b9104327667b19dcda3ac469f572efabe588c38c1985f"}])))))
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
(let [current-theme-type (get-in cofx [:db :profile/profile :appearance])]
|
||||
(when (and (multiaccounts.model/logged-in? db)
|
||||
(= current-theme-type status-im2.constants/theme-type-system))
|
||||
{:multiaccounts.ui/switch-theme-fx
|
||||
{:profile.settings/switch-theme-fx
|
||||
[(get-in db [:profile/profile :appearance])
|
||||
(:view-id db) true]})))
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
(:require
|
||||
["@react-native-async-storage/async-storage" :default AsyncStorage]
|
||||
["react-native" :refer (BackHandler)]
|
||||
[native-module.core :as native-module]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.keycard.card :as card]
|
||||
[status-im.utils.deprecated-types :as types]
|
||||
|
@ -200,15 +199,6 @@
|
|||
(fn [^js listener]
|
||||
(.remove listener)))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:keycard/generate-name
|
||||
(fn [{:keys [public-key on-success]}]
|
||||
(native-module/gfycat-identicon-async
|
||||
public-key
|
||||
(fn [whisper-name photo-path]
|
||||
(re-frame/dispatch
|
||||
[on-success whisper-name photo-path])))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:keycard/save-multiaccount-and-login
|
||||
card/save-multiaccount-and-login)
|
||||
|
|
|
@ -179,37 +179,30 @@
|
|||
;; name might have been generated during recovery via passphrase
|
||||
(get-in db [:intro-wizard :derived constants/path-whisper-keyword])
|
||||
{:name name})]
|
||||
;; if a name is still `nil` we have to generate it before multiaccount's
|
||||
;; creation otherwise spec validation will fail
|
||||
(if (nil? name)
|
||||
{:keycard/generate-name
|
||||
{:public-key whisper-public-key
|
||||
:on-success ::on-name-generated}}
|
||||
(rf/merge cofx
|
||||
{:db (-> db
|
||||
(assoc-in [:keycard :setup-step] nil)
|
||||
(dissoc :intro-wizard))}
|
||||
(multiaccounts.create/on-multiaccount-created
|
||||
{:recovered (or recovered (get-in db [:intro-wizard :recovering?]))
|
||||
:derived {constants/path-wallet-root-keyword
|
||||
{:public-key wallet-root-public-key
|
||||
:address (eip55/address->checksum wallet-root-address)}
|
||||
constants/path-whisper-keyword
|
||||
{:public-key whisper-public-key
|
||||
:address (eip55/address->checksum whisper-address)
|
||||
:name name}
|
||||
constants/path-default-wallet-keyword
|
||||
{:public-key wallet-public-key
|
||||
:address (eip55/address->checksum wallet-address)}}
|
||||
:address address
|
||||
:public-key public-key
|
||||
:keycard-instance-uid instance-uid
|
||||
:key-uid (address/normalized-hex key-uid)
|
||||
:keycard-pairing pairing
|
||||
:keycard-paired-on paired-on
|
||||
:chat-key whisper-private-key}
|
||||
encryption-public-key
|
||||
{})))))
|
||||
(rf/merge cofx
|
||||
{:db (-> db
|
||||
(assoc-in [:keycard :setup-step] nil)
|
||||
(dissoc :intro-wizard))}
|
||||
(multiaccounts.create/on-multiaccount-created
|
||||
{:recovered (or recovered (get-in db [:intro-wizard :recovering?]))
|
||||
:derived {constants/path-wallet-root-keyword
|
||||
{:public-key wallet-root-public-key
|
||||
:address (eip55/address->checksum wallet-root-address)}
|
||||
constants/path-whisper-keyword
|
||||
{:public-key whisper-public-key
|
||||
:address (eip55/address->checksum whisper-address)}
|
||||
constants/path-default-wallet-keyword
|
||||
{:public-key wallet-public-key
|
||||
:address (eip55/address->checksum wallet-address)}}
|
||||
:address address
|
||||
:public-key public-key
|
||||
:keycard-instance-uid instance-uid
|
||||
:key-uid (address/normalized-hex key-uid)
|
||||
:keycard-pairing pairing
|
||||
:keycard-paired-on paired-on
|
||||
:chat-key whisper-private-key}
|
||||
encryption-public-key
|
||||
{}))))
|
||||
|
||||
(rf/defn return-to-keycard-login
|
||||
[{:keys [db] :as cofx}]
|
||||
|
@ -381,17 +374,3 @@
|
|||
{:on-card-connected :keycard/load-recovering-key-screen
|
||||
:handler (common/dispatch-event :keycard/import-multiaccount)}))
|
||||
|
||||
(rf/defn on-name-generated
|
||||
{:events [::on-name-generated]
|
||||
:interceptors [(re-frame/inject-cofx :random-guid-generator)
|
||||
(re-frame/inject-cofx ::multiaccounts.create/get-signing-phrase)]}
|
||||
[{:keys [db] :as cofx} whisper-name]
|
||||
(rf/merge
|
||||
cofx
|
||||
{:db (update-in db
|
||||
[:keycard :profile/profile]
|
||||
(fn [multiacc]
|
||||
(assoc multiacc
|
||||
:recovered (get db :recovered-account?)
|
||||
:name whisper-name)))}
|
||||
(create-keycard-multiaccount)))
|
||||
|
|
|
@ -265,16 +265,10 @@
|
|||
constants/path-default-wallet]
|
||||
(fn [result]
|
||||
(let [derived-data (multiaccounts.create/normalize-derived-data-keys
|
||||
(types/json->clj result))
|
||||
public-key (get-in derived-data [constants/path-whisper-keyword :public-key])]
|
||||
(native-module/gfycat-identicon-async
|
||||
public-key
|
||||
(fn [name _]
|
||||
(let [derived-data-extended
|
||||
(update derived-data constants/path-whisper-keyword assoc :name name)]
|
||||
(reset! derived-acc
|
||||
{:root-key root-data
|
||||
:derived derived-data-extended})))))))))))
|
||||
(types/json->clj result))]
|
||||
(reset! derived-acc
|
||||
{:root-key root-data
|
||||
:derived derived-data}))))))))
|
||||
(when (= password (get @state :password))
|
||||
(swap! state assoc-in [:application-info :paired?] true)
|
||||
(later #(on-success (str (rand-int 10000000))))))
|
||||
|
|
|
@ -1,234 +0,0 @@
|
|||
(ns status-im.multiaccounts.core
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[native-module.core :as native-module]
|
||||
[quo.foundations.colors :as colors]
|
||||
[re-frame.core :as re-frame]
|
||||
[react-native.platform :as platform]
|
||||
[status-im.bottom-sheet.events :as bottom-sheet]
|
||||
[status-im.contact.db :as contact.db]
|
||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||
[status-im.utils.gfycat.core :as gfycat]
|
||||
[status-im2.common.theme.core :as theme]
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.shell.jump-to.utils :as shell.utils]
|
||||
[status-im2.setup.hot-reload :as hot-reload]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
;; validate that the given mnemonic was generated from Status Dictionary
|
||||
(re-frame/reg-fx
|
||||
::validate-mnemonic
|
||||
(fn [[passphrase callback]]
|
||||
(native-module/validate-mnemonic passphrase callback)))
|
||||
|
||||
(defn displayed-name
|
||||
"Use preferred name, display-name, name or alias in that order"
|
||||
[{:keys [name display-name preferred-name alias public-key ens-verified primary-name]}]
|
||||
(let [display-name (if (string/blank? display-name) nil display-name)
|
||||
preferred-name (if (string/blank? preferred-name) nil preferred-name)
|
||||
ens-name (or preferred-name
|
||||
display-name
|
||||
name)]
|
||||
;; Preferred name is our own otherwise we make sure it's verified
|
||||
(if (or preferred-name (and ens-verified name))
|
||||
ens-name
|
||||
(or display-name primary-name alias (gfycat/generate-gfy public-key)))))
|
||||
|
||||
(defn contact-by-identity
|
||||
[contacts contact-identity]
|
||||
(or (get contacts contact-identity)
|
||||
(contact.db/public-key->new-contact contact-identity)))
|
||||
|
||||
(defn contact-two-names-by-identity
|
||||
[contact profile contact-identity]
|
||||
(let [{:keys [public-key preferred-name display-name]} profile
|
||||
{:keys [primary-name secondary-name]} contact
|
||||
me? (= public-key contact-identity)]
|
||||
(if me?
|
||||
[(cond
|
||||
(not (string/blank? preferred-name)) preferred-name
|
||||
(not (string/blank? display-name)) display-name
|
||||
(not (string/blank? primary-name)) primary-name
|
||||
:else (gfycat/generate-gfy contact-identity))]
|
||||
[primary-name secondary-name])))
|
||||
|
||||
(defn displayed-photo
|
||||
[{:keys [images]}]
|
||||
(or (:thumbnail images)
|
||||
(:large images)
|
||||
(first images)))
|
||||
|
||||
(re-frame/reg-fx
|
||||
::webview-debug-changed
|
||||
(fn [value]
|
||||
(when platform/android?
|
||||
(native-module/toggle-webview-debug value))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
::blank-preview-flag-changed
|
||||
(fn [flag]
|
||||
(native-module/set-blank-preview-flag flag)))
|
||||
|
||||
(rf/defn confirm-wallet-set-up
|
||||
{:events [:multiaccounts.ui/wallet-set-up-confirmed]}
|
||||
[cofx]
|
||||
(multiaccounts.update/multiaccount-update cofx
|
||||
:wallet-set-up-passed?
|
||||
true
|
||||
{}))
|
||||
|
||||
(rf/defn switch-webview-debug
|
||||
{:events [:multiaccounts.ui/switch-webview-debug]}
|
||||
[{:keys [db] :as cofx} value]
|
||||
(rf/merge cofx
|
||||
{::webview-debug-changed value}
|
||||
(multiaccounts.update/multiaccount-update
|
||||
:webview-debug
|
||||
(boolean value)
|
||||
{})))
|
||||
|
||||
(rf/defn switch-preview-privacy-mode
|
||||
{:events [:multiaccounts.ui/preview-privacy-mode-switched]}
|
||||
[{:keys [db] :as cofx} private?]
|
||||
(rf/merge cofx
|
||||
{::blank-preview-flag-changed private?}
|
||||
(multiaccounts.update/multiaccount-update
|
||||
:preview-privacy?
|
||||
(boolean private?)
|
||||
{})))
|
||||
|
||||
(rf/defn switch-webview-permission-requests?
|
||||
{:events [:multiaccounts.ui/webview-permission-requests-switched]}
|
||||
[cofx enabled?]
|
||||
(multiaccounts.update/multiaccount-update
|
||||
cofx
|
||||
:webview-allow-permission-requests?
|
||||
(boolean enabled?)
|
||||
{}))
|
||||
|
||||
(rf/defn switch-default-sync-period
|
||||
{:events [:multiaccounts.ui/default-sync-period-switched]}
|
||||
[cofx value]
|
||||
(multiaccounts.update/multiaccount-update
|
||||
cofx
|
||||
:default-sync-period
|
||||
value
|
||||
{}))
|
||||
|
||||
(rf/defn switch-preview-privacy-mode-flag
|
||||
[{:keys [db]}]
|
||||
(let [private? (get-in db [:profile/profile :preview-privacy?])]
|
||||
{::blank-preview-flag-changed private?}))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:multiaccounts.ui/switch-theme-fx
|
||||
(fn [[theme-type view-id reload-ui?]]
|
||||
(let [[theme status-bar-theme nav-bar-color]
|
||||
;; Status bar theme represents status bar icons colors, so opposite to app theme
|
||||
(if (or (= theme-type constants/theme-type-dark)
|
||||
(and (= theme-type constants/theme-type-system)
|
||||
(theme/device-theme-dark?)))
|
||||
[:dark :light colors/neutral-100]
|
||||
[:light :dark colors/white])]
|
||||
(theme/set-theme theme)
|
||||
(re-frame/dispatch [:change-shell-status-bar-style
|
||||
(if (shell.utils/home-stack-open?) status-bar-theme :light)])
|
||||
(when reload-ui?
|
||||
(rf/dispatch [:dissmiss-all-overlays])
|
||||
(hot-reload/reload)
|
||||
(when-not (= view-id :shell-stack)
|
||||
(re-frame/dispatch [:change-shell-nav-bar-color nav-bar-color]))))))
|
||||
|
||||
(rf/defn switch-appearance
|
||||
{:events [:multiaccounts.ui/appearance-switched]}
|
||||
[cofx theme]
|
||||
(rf/merge cofx
|
||||
{:multiaccounts.ui/switch-theme-fx [theme :appearance true]}
|
||||
(multiaccounts.update/multiaccount-update :appearance theme {})))
|
||||
|
||||
(rf/defn switch-theme
|
||||
{:events [:multiaccounts.ui/switch-theme]}
|
||||
[cofx theme view-id]
|
||||
(let [theme (or theme
|
||||
(get-in cofx [:db :profile/profile :appearance])
|
||||
constants/theme-type-dark)]
|
||||
{:multiaccounts.ui/switch-theme-fx [theme view-id false]}))
|
||||
|
||||
(rf/defn switch-profile-picture-show-to
|
||||
{:events [:multiaccounts.ui/profile-picture-show-to-switched]}
|
||||
[cofx id]
|
||||
(rf/merge cofx
|
||||
{:json-rpc/call [{:method "wakuext_changeIdentityImageShowTo"
|
||||
:params [id]
|
||||
:on-success #(log/debug "picture settings changed successfully")}]}
|
||||
(multiaccounts.update/optimistic :profile-pictures-show-to id)))
|
||||
|
||||
(rf/defn switch-appearance-profile
|
||||
{:events [:multiaccounts.ui/appearance-profile-switched]}
|
||||
[cofx id]
|
||||
(multiaccounts.update/multiaccount-update cofx :profile-pictures-visibility id {}))
|
||||
|
||||
(defn clean-path
|
||||
[path]
|
||||
(if path
|
||||
(string/replace-first path #"file://" "")
|
||||
(log/warn "[native-module] Empty path was provided")))
|
||||
|
||||
(rf/defn save-profile-picture
|
||||
{:events [::save-profile-picture]}
|
||||
[cofx path ax ay bx by]
|
||||
(let [key-uid (get-in cofx [:db :profile/profile :key-uid])]
|
||||
(rf/merge cofx
|
||||
{:json-rpc/call [{:method "multiaccounts_storeIdentityImage"
|
||||
:params [key-uid (clean-path path) ax ay bx by]
|
||||
;; NOTE: In case of an error we can show a toast error
|
||||
:on-success #(re-frame/dispatch [::update-local-picture %])}]}
|
||||
(bottom-sheet/hide-bottom-sheet-old))))
|
||||
|
||||
(rf/defn save-profile-picture-from-url
|
||||
{:events [::save-profile-picture-from-url]}
|
||||
[cofx url]
|
||||
(let [key-uid (get-in cofx [:db :profile/profile :key-uid])]
|
||||
(rf/merge cofx
|
||||
{:json-rpc/call [{:method "multiaccounts_storeIdentityImageFromURL"
|
||||
:params [key-uid url]
|
||||
:on-error #(log/error "::save-profile-picture-from-url error" %)
|
||||
:on-success #(re-frame/dispatch [::update-local-picture %])}]}
|
||||
(bottom-sheet/hide-bottom-sheet-old))))
|
||||
|
||||
(comment
|
||||
(re-frame/dispatch
|
||||
[::save-profile-picture-from-url
|
||||
"https://lh3.googleusercontent.com/XuKjNm3HydsaxbPkbpGs9YyCKhn5QQk5oDC8XF2jzmPyYXeZofxFtfUDZuQ3EVmacS_BlBKzbX2ypm37YNX3n1fDJA3WndeFcPsp7Z0=w600"]))
|
||||
|
||||
(rf/defn delete-profile-picture
|
||||
{:events [::delete-profile-picture]}
|
||||
[cofx name]
|
||||
(let [key-uid (get-in cofx [:db :profile/profile :key-uid])]
|
||||
(rf/merge cofx
|
||||
{:json-rpc/call [{:method "multiaccounts_deleteIdentityImage"
|
||||
:params [key-uid]
|
||||
;; NOTE: In case of an error we could fallback to previous image in
|
||||
;; UI with a toast error
|
||||
:on-success #(log/info "[multiaccount] Delete profile image" %)}]}
|
||||
(multiaccounts.update/optimistic :images nil)
|
||||
(bottom-sheet/hide-bottom-sheet-old))))
|
||||
|
||||
(rf/defn get-profile-picture
|
||||
[cofx]
|
||||
(let [key-uid (get-in cofx [:db :profile/profile :key-uid])]
|
||||
{:json-rpc/call [{:method "multiaccounts_getIdentityImages"
|
||||
:params [key-uid]
|
||||
:on-success #(re-frame/dispatch [::update-local-picture %])}]}))
|
||||
|
||||
(rf/defn store-profile-picture
|
||||
{:events [::update-local-picture]}
|
||||
[cofx pics]
|
||||
(multiaccounts.update/optimistic cofx :images pics))
|
||||
|
||||
(comment
|
||||
;; Test seed for Dim Venerated Yaffle, it's not here by mistake, this is just a test account
|
||||
(native-module/validate-mnemonic
|
||||
"rocket mixed rebel affair umbrella legal resemble scene virus park deposit cargo"
|
||||
prn))
|
|
@ -2,7 +2,6 @@
|
|||
(:require
|
||||
[native-module.core :as native-module]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.wallet.core :as wallet]
|
||||
[status-im2.common.keychain.events :as keychain]
|
||||
[status-im2.db :as db]
|
||||
|
@ -30,15 +29,15 @@
|
|||
[{:keys [db] :as cofx} {:keys [auth-method logout?]}]
|
||||
(let [key-uid (get-in db [:profile/profile :key-uid])]
|
||||
(rf/merge cofx
|
||||
{:set-root :progress
|
||||
:chat.ui/clear-inputs nil
|
||||
:shell/reset-state nil
|
||||
:hide-popover nil
|
||||
::logout nil
|
||||
::multiaccounts/webview-debug-changed false
|
||||
:keychain/clear-user-password key-uid
|
||||
:profile/get-profiles-overview #(rf/dispatch
|
||||
[:profile/get-profiles-overview-success %])}
|
||||
{:set-root :progress
|
||||
:chat.ui/clear-inputs nil
|
||||
:shell/reset-state nil
|
||||
:hide-popover nil
|
||||
::logout nil
|
||||
:profile.settings/webview-debug-changed false
|
||||
:keychain/clear-user-password key-uid
|
||||
:profile/get-profiles-overview #(rf/dispatch
|
||||
[:profile/get-profiles-overview-success %])}
|
||||
(keychain/save-auth-method key-uid auth-method)
|
||||
(wallet/clear-timeouts)
|
||||
(initialize-app-db))))
|
||||
|
|
|
@ -26,12 +26,6 @@
|
|||
constants/path-default-wallet]
|
||||
(fn [result]
|
||||
(let [derived-data (multiaccounts.create/normalize-derived-data-keys
|
||||
(types/json->clj result))
|
||||
public-key (get-in derived-data [constants/path-whisper-keyword :public-key])]
|
||||
(native-module/gfycat-identicon-async
|
||||
public-key
|
||||
(fn [name _]
|
||||
(let [derived-data-extended
|
||||
(update derived-data constants/path-whisper-keyword assoc :name name)]
|
||||
(re-frame/dispatch [success-event root-data derived-data-extended]))))))))))))
|
||||
(types/json->clj result))]
|
||||
(re-frame/dispatch [success-event root-data derived-data])))))))))
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
[re-frame.core :as re-frame.core]
|
||||
[react-native.core :as rn]
|
||||
[status-im.ethereum.ens :as ens]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.chat-icon.styles :as styles]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.ui.components.icons.icons :as icons]
|
||||
[status-im.ui.screens.chat.photos :as photos]
|
||||
[status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils]))
|
||||
[status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]))
|
||||
|
||||
;;TODO REWORK THIS NAMESPACE
|
||||
|
||||
|
@ -161,14 +161,14 @@
|
|||
(defn contact-icon-view
|
||||
[contact {:keys [container] :as styles}]
|
||||
[rn/view container
|
||||
[photos/photo (multiaccounts/displayed-photo contact) styles]])
|
||||
[photos/photo (profile.utils/photo contact) styles]])
|
||||
|
||||
(defn contact-icon-contacts-tab
|
||||
[{:keys [primary-name] :as contact}]
|
||||
[profile]
|
||||
[rn/view styles/container-chat-list
|
||||
[quo/user-avatar
|
||||
{:full-name primary-name
|
||||
:profile-picture (multiaccounts/displayed-photo contact)
|
||||
{:full-name (profile.utils/displayed-name profile)
|
||||
:profile-picture (profile.utils/photo profile)
|
||||
:size :small
|
||||
:status-indicator? false}]])
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
:container-margin-bottom 8
|
||||
:on-press
|
||||
#(re-frame/dispatch
|
||||
[:multiaccounts.ui/switch-webview-debug (not webview-debug)])
|
||||
[:profile.settings/change-webview-debug (not webview-debug)])
|
||||
:accessory :switch
|
||||
:active webview-debug}
|
||||
{:size :small
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
(defn button
|
||||
[label icon theme selected?]
|
||||
[react/touchable-highlight
|
||||
{:on-press #(re-frame/dispatch [:multiaccounts.ui/appearance-switched theme])}
|
||||
{:on-press #(re-frame/dispatch [:profile.settings/change-appearance theme])}
|
||||
[react/view
|
||||
(merge {:align-items :center :padding 8 :border-radius 20}
|
||||
(when selected?
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.communities.core :as communities]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon]
|
||||
[status-im.ui.components.core :as quo]
|
||||
[status-im.ui.components.list.item :as list.item]
|
||||
|
@ -11,6 +10,7 @@
|
|||
[status-im.ui.components.topbar :as topbar]
|
||||
[status-im.ui.components.unviewed-indicator :as unviewed-indicator]
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
:accessibility-label :member-item
|
||||
:icon [chat-icon/profile-photo-plus-dot-view
|
||||
{:public-key public-key
|
||||
:photo-path (multiaccounts/displayed-photo member)}]
|
||||
:photo-path (profile.utils/photo member)}]
|
||||
:accessory (when (not= public-key my-public-key)
|
||||
[quo/button
|
||||
{:on-press
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
(ns status-im.ui.screens.contacts-list.views
|
||||
(:require
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.ui.components.invite.views :as invite]
|
||||
[status-im.ui.components.list.item :as list.item]
|
||||
[status-im.ui.components.list.views :as list.views]
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.i18n :as i18n])
|
||||
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
{:public-key public-key
|
||||
:full-name primary-name
|
||||
:customization-color (or customization-color :primary)
|
||||
:photo-path (multiaccounts/displayed-photo contact)}]
|
||||
:photo-path (profile.utils/photo contact)}]
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:chat.ui/show-profile public-key])}]))
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
{:active (= value id)
|
||||
:accessory :radio
|
||||
:title (get titles id)
|
||||
:on-press #(re-frame/dispatch [:multiaccounts.ui/default-sync-period-switched id])}])
|
||||
:on-press #(re-frame/dispatch [:profile.settings/update-value :default-sync-period id])}])
|
||||
|
||||
(views/defview default-sync-period-settings
|
||||
[]
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
[status-im.ui.screens.keycard.styles :as styles]
|
||||
[status-im.ui.screens.keycard.views :as keycard.views]
|
||||
[status-im.utils.core :as utils.core]
|
||||
[status-im.utils.gfycat.core :as gfy]
|
||||
[status-im.utils.identicon :as identicon]
|
||||
[status-im2.constants :as constants]
|
||||
[utils.i18n :as i18n])
|
||||
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
|
||||
|
@ -207,24 +205,13 @@
|
|||
[react/view
|
||||
{:margin-horizontal 16
|
||||
:flex-direction :column}
|
||||
[react/view
|
||||
{:justify-content :center
|
||||
:align-items :center
|
||||
:margin-bottom 11}
|
||||
[react/image
|
||||
{:source {:uri (identicon/identicon whisper-public-key)}
|
||||
:style {:width 61
|
||||
:height 61
|
||||
:border-radius 30
|
||||
:border-width 1
|
||||
:border-color colors/black-transparent}}]]
|
||||
[react/text
|
||||
{:style {:text-align :center
|
||||
:color colors/black
|
||||
:font-weight "500"}
|
||||
:number-of-lines 1
|
||||
:ellipsize-mode :middle}
|
||||
(gfy/generate-gfy whisper-public-key)]
|
||||
whisper-public-key]
|
||||
[quo/text
|
||||
{:style {:margin-top 4}
|
||||
:monospace true
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
[reagent.core :as reagent]
|
||||
[status-im.bottom-sheet.events :as bottom-sheet]
|
||||
[status-im.keycard.login :as keycard.login]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.ui.components.core :as quo]
|
||||
|
@ -19,6 +18,7 @@
|
|||
[status-im.ui.screens.keycard.pin.views :as pin.views]
|
||||
[status-im.ui.screens.keycard.styles :as styles]
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[status-im2.navigation.events :as navigation]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf])
|
||||
|
@ -212,7 +212,7 @@
|
|||
:reagent-render
|
||||
(fn [account small-screen?]
|
||||
;;TODO this should be done in a subscription
|
||||
[photos/photo (multiaccounts/displayed-photo account)
|
||||
[photos/photo (profile.utils/photo account)
|
||||
{:size (if small-screen? 45 61)}])}))
|
||||
|
||||
(defn access-is-reset
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
[re-frame.core :as re-frame]
|
||||
[reagent.core :as reagent]
|
||||
status-im.keycard.delete-key
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
|
||||
[status-im.ui.components.core :as quo]
|
||||
[status-im.ui.components.list.item :as list.item]
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.ui.screens.privacy-and-security-settings.events :as delete-profile]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.security.core :as security]))
|
||||
|
||||
|
@ -33,10 +33,11 @@
|
|||
(let [password (reagent/atom nil)
|
||||
text-input-ref (atom nil)]
|
||||
(fn []
|
||||
(let [keycard? @(re-frame/subscribe [:keycard-multiaccount?])
|
||||
multiaccount @(re-frame/subscribe [:profile/profile])
|
||||
(let [profile @(re-frame/subscribe [:profile/profile])
|
||||
keycard? @(re-frame/subscribe [:keycard-multiaccount?])
|
||||
error @(re-frame/subscribe [:delete-profile/error])
|
||||
keep-keys-on-keycard? @(re-frame/subscribe [:delete-profile/keep-keys-on-keycard?])]
|
||||
keep-keys-on-keycard? @(re-frame/subscribe
|
||||
[:delete-profile/keep-keys-on-keycard?])]
|
||||
(when (and @text-input-ref error (not @password))
|
||||
(.clear ^js @text-input-ref))
|
||||
[react/keyboard-avoiding-view {:style {:flex 1}}
|
||||
|
@ -47,8 +48,8 @@
|
|||
:size :x-large}
|
||||
(i18n/label :t/delete-profile)]]
|
||||
[list.item/list-item
|
||||
{:title (multiaccounts/displayed-name multiaccount)
|
||||
:icon [chat-icon.screen/contact-icon-contacts-tab multiaccount]}]
|
||||
{:title (profile.utils/displayed-name profile)
|
||||
:icon [chat-icon.screen/contact-icon-contacts-tab profile]}]
|
||||
(when keycard?
|
||||
[react/view
|
||||
[quo/list-header (i18n/label :t/actions)]
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
:active preview-privacy?
|
||||
:accessory :switch
|
||||
:on-press #(re-frame/dispatch
|
||||
[:multiaccounts.ui/preview-privacy-mode-switched
|
||||
[:profile.settings/change-preview-privacy
|
||||
((complement boolean) preview-privacy?)])}]
|
||||
(when config/collectibles-enabled?
|
||||
[list.item/list-item
|
||||
|
@ -111,7 +111,8 @@
|
|||
:subtitle (i18n/label :t/webview-camera-permission-requests-subtitle)
|
||||
:subtitle-max-lines 2
|
||||
:on-press #(re-frame/dispatch
|
||||
[:multiaccounts.ui/webview-permission-requests-switched
|
||||
[:profile.settings/update-value
|
||||
:webview-allow-permission-requests?
|
||||
((complement boolean) webview-allow-permission-requests?)])}])
|
||||
[separator]
|
||||
[quo/list-header (i18n/label :t/privacy-photos)]
|
||||
|
@ -148,7 +149,7 @@
|
|||
{:active (= value id)
|
||||
:accessory :radio
|
||||
:title (get titles id)
|
||||
:on-press #(re-frame/dispatch [:multiaccounts.ui/profile-picture-show-to-switched id])}])
|
||||
:on-press #(re-frame/dispatch [:profile.settings/change-profile-pictures-show-to id])}])
|
||||
|
||||
(views/defview profile-pic-show-to
|
||||
[]
|
||||
|
@ -168,7 +169,8 @@
|
|||
{:active (= value id)
|
||||
:accessory :radio
|
||||
:title (get titles id)
|
||||
:on-press #(re-frame/dispatch [:multiaccounts.ui/appearance-profile-switched id])}])
|
||||
:on-press #(re-frame/dispatch [:profile.settings/update-value :profile-pictures-visibility
|
||||
id])}])
|
||||
|
||||
(views/defview profile-pic
|
||||
[]
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
[quo.theme :as theme]
|
||||
[re-frame.core :as re-frame]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.ui.components.core :as quo]
|
||||
[status-im.ui.components.keyboard-avoid-presentation :as kb-presentation]
|
||||
|
@ -16,11 +15,12 @@
|
|||
[status-im.ui.components.topbar :as topbar]
|
||||
[status-im.ui.screens.profile.components.sheets :as sheets]
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn actions
|
||||
[{:keys [public-key added? blocked? ens-name mutual?] :as contact} muted?]
|
||||
[{:keys [public-key added? blocked? ens-name mutual?] :as profile} muted?]
|
||||
(concat [{:label (i18n/label :t/chat)
|
||||
:icon :main-icons/message
|
||||
:disabled (not mutual?)
|
||||
|
@ -33,7 +33,7 @@
|
|||
:icon :main-icons/remove-contact
|
||||
:selected true
|
||||
:accessibility-label :in-contacts-button
|
||||
:action #(re-frame/dispatch [:contact.ui/remove-contact-pressed contact])}]
|
||||
:action #(re-frame/dispatch [:contact.ui/remove-contact-pressed profile])}]
|
||||
[{:label (i18n/label :t/add-to-contacts)
|
||||
:icon :main-icons/add-contact
|
||||
:disabled blocked?
|
||||
|
@ -114,15 +114,15 @@
|
|||
|
||||
(defn nickname-view
|
||||
[]
|
||||
(let [{:keys [public-key primary-name nickname]} (rf/sub [:contacts/current-contact])
|
||||
entered-nickname (reagent/atom nickname)]
|
||||
(let [{:keys [public-key nickname] :as profile} (rf/sub [:contacts/current-contact])
|
||||
entered-nickname (reagent/atom nickname)]
|
||||
(fn []
|
||||
[kb-presentation/keyboard-avoiding-view
|
||||
{:style {:flex 1}
|
||||
:ignore-offset true}
|
||||
[topbar/topbar
|
||||
{:title (i18n/label :t/nickname)
|
||||
:subtitle primary-name
|
||||
:subtitle (profile.utils/displayed-name profile)
|
||||
:modal? true}]
|
||||
[react/view {:flex 1 :padding 16}
|
||||
[react/text {:style {:color colors/gray :margin-bottom 16}}
|
||||
|
@ -173,29 +173,25 @@
|
|||
:number-of-lines 2}
|
||||
label]]])
|
||||
|
||||
(defn profile
|
||||
(defn profile-view
|
||||
[]
|
||||
(let [{:keys [public-key
|
||||
secondary-name
|
||||
name
|
||||
ens-verified
|
||||
customization-color
|
||||
compressed-key]
|
||||
:as contact}
|
||||
@(re-frame/subscribe
|
||||
[:contacts/current-contact])
|
||||
|
||||
muted? @(re-frame/subscribe [:chats/muted
|
||||
public-key])
|
||||
{:keys [primary-name secondary-name customization-color]} contact
|
||||
:as profile} @(re-frame/subscribe [:contacts/current-contact])
|
||||
muted? @(re-frame/subscribe [:chats/muted public-key])
|
||||
customization-color (or customization-color :primary)
|
||||
on-share #(re-frame/dispatch
|
||||
[:show-popover
|
||||
(merge
|
||||
{:view :share-chat-key
|
||||
:address (or compressed-key
|
||||
public-key)}
|
||||
(when (and ens-verified name)
|
||||
{:ens-name name}))])]
|
||||
(when contact
|
||||
on-share #(re-frame/dispatch [:show-popover
|
||||
(merge
|
||||
{:view :share-chat-key
|
||||
:address (or compressed-key
|
||||
public-key)}
|
||||
(when (and ens-verified name)
|
||||
{:ens-name name}))])]
|
||||
(when profile
|
||||
[:<>
|
||||
[quo/header
|
||||
{:right-accessories [{:icon :main-icons/share
|
||||
|
@ -206,27 +202,26 @@
|
|||
:on-press #(re-frame/dispatch [:navigate-back])}]}]
|
||||
[:<>
|
||||
[(profile-header/extended-header
|
||||
{:on-press on-share
|
||||
{:on-press on-share
|
||||
:bottom-separator false
|
||||
:title primary-name
|
||||
:color
|
||||
(user-avatar.style/customization-color customization-color
|
||||
(theme/get-theme))
|
||||
:photo (multiaccounts/displayed-photo contact)
|
||||
:monospace (not ens-verified)
|
||||
:subtitle secondary-name
|
||||
:compressed-key compressed-key
|
||||
:public-key public-key})]
|
||||
:title (profile.utils/displayed-name profile)
|
||||
:color (user-avatar.style/customization-color customization-color
|
||||
(theme/get-theme))
|
||||
:photo (profile.utils/photo profile)
|
||||
:monospace (not ens-verified)
|
||||
:subtitle secondary-name
|
||||
:compressed-key compressed-key
|
||||
:public-key public-key})]
|
||||
[react/view
|
||||
{:height 1 :background-color colors/gray-lighter :margin-top 8}]
|
||||
[nickname-settings contact]
|
||||
[nickname-settings profile]
|
||||
[react/view {:height 1 :background-color colors/gray-lighter}]
|
||||
[react/view
|
||||
{:padding-top 17
|
||||
:flex-direction :row
|
||||
:align-items :stretch
|
||||
:flex 1}
|
||||
(for [{:keys [label] :as action} (actions contact muted?)
|
||||
(for [{:keys [label] :as action} (actions profile muted?)
|
||||
:when label]
|
||||
^{:key label}
|
||||
[button-item action])]]])))
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
(ns status-im.ui.screens.profile.group-chat.views
|
||||
(:require
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.ui.components.common.common :as components.common]
|
||||
|
@ -16,6 +15,7 @@
|
|||
[status-im.ui.screens.chat.utils :as chat.utils]
|
||||
[status-im.ui.screens.profile.components.styles :as profile.components.styles]
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.debounce :as debounce]
|
||||
[utils.i18n :as i18n])
|
||||
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
|
||||
|
@ -26,15 +26,14 @@
|
|||
[list.item/list-item
|
||||
{:theme :accent
|
||||
:icon [chat-icon/contact-icon-contacts-tab member]
|
||||
:title (:primary-name member)
|
||||
:title (profile.utils/displayed-name member)
|
||||
:subtitle (i18n/label :t/view-profile)
|
||||
:accessibility-label :view-chat-details-button
|
||||
:chevron true
|
||||
:on-press #(chat.sheets/hide-sheet-and-dispatch
|
||||
[:chat.ui/show-profile
|
||||
(:public-key member)])}]
|
||||
(when (and us-admin?
|
||||
(not (:admin? member)))
|
||||
(when (and us-admin? (not (:admin? member)))
|
||||
[list.item/list-item
|
||||
{:theme :accent
|
||||
:title (i18n/label :t/make-admin)
|
||||
|
@ -54,10 +53,10 @@
|
|||
|
||||
(defn render-member
|
||||
[{:keys [public-key] :as member} _ _ {:keys [chat-id admin? current-user-identity]}]
|
||||
(let [{:keys [primary-name secondary-name]} member]
|
||||
(let [{:keys [secondary-name]} member]
|
||||
[list.item/list-item
|
||||
(merge
|
||||
{:title primary-name
|
||||
{:title (profile.utils/displayed-name member)
|
||||
:subtitle secondary-name
|
||||
:accessibility-label :member-item
|
||||
:icon [chat-icon/contact-icon-contacts-tab member]
|
||||
|
@ -118,7 +117,7 @@
|
|||
(chat.utils/format-author-old contact)]
|
||||
[react/view {:flex-direction :row :align-items :flex-end}
|
||||
[react/view {:padding-left 16 :padding-top 4}
|
||||
[photos/photo (multiaccounts/displayed-photo contact) {:size 36}]]]]
|
||||
[photos/photo (profile.utils/photo contact) {:size 36}]]]]
|
||||
[list.item/list-item
|
||||
{:theme :accent
|
||||
:disabled (not allow-adding-members?)
|
||||
|
@ -137,9 +136,10 @@
|
|||
|
||||
(defn contacts-list-item
|
||||
[{:keys [from] :as invitation}]
|
||||
(let [contact (or @(re-frame/subscribe [:contacts/contact-by-identity from]) {:public-key from})]
|
||||
(let [contact (or @(re-frame/subscribe [:contacts/contact-by-identity from])
|
||||
{:public-key from})]
|
||||
[list.item/list-item
|
||||
{:title (multiaccounts/displayed-name contact)
|
||||
{:title (profile.utils/displayed-name contact)
|
||||
:icon [chat-icon/contact-icon-contacts-tab contact]
|
||||
:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old
|
||||
{:content (fn []
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
(ns status-im.ui.screens.profile.user.edit-picture
|
||||
(:require
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.list.item :as list.item]
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im2.config :as config]
|
||||
[status-im2.contexts.profile.settings.events]
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
(def crop-size 1000)
|
||||
|
@ -18,14 +18,14 @@
|
|||
[]
|
||||
(re-frame/dispatch [:bottom-sheet/hide-old])
|
||||
(react/show-image-picker
|
||||
#(re-frame/dispatch [::multiaccounts/save-profile-picture (.-path ^js %) 0 0 crop-size crop-size])
|
||||
#(re-frame/dispatch [:profile.settings/save-profile-picture (.-path ^js %) 0 0 crop-size crop-size])
|
||||
crop-opts))
|
||||
|
||||
(defn take-pic
|
||||
[]
|
||||
(re-frame/dispatch [:bottom-sheet/hide-old])
|
||||
(react/show-image-picker-camera
|
||||
#(re-frame/dispatch [::multiaccounts/save-profile-picture (.-path ^js %) 0 0 crop-size crop-size])
|
||||
#(re-frame/dispatch [:profile.settings/save-profile-picture (.-path ^js %) 0 0 crop-size crop-size])
|
||||
crop-opts))
|
||||
|
||||
(defn bottom-sheet
|
||||
|
@ -51,4 +51,4 @@
|
|||
:icon :main-icons/delete
|
||||
:theme :accent
|
||||
:title (i18n/label :t/profile-pic-remove)
|
||||
:on-press #(re-frame/dispatch [::multiaccounts/delete-profile-picture nil])}])]))
|
||||
:on-press #(re-frame/dispatch [:profile.settings/delete-profile-picture nil])}])]))
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
[re-frame.core :as re-frame]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.ethereum.stateofus :as stateofus]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.ui.components.common.common :as components.common]
|
||||
[status-im.ui.components.copyable-text :as copyable-text]
|
||||
|
@ -18,11 +17,11 @@
|
|||
[status-im.ui.screens.profile.user.edit-picture :as edit]
|
||||
[status-im.ui.screens.profile.user.styles :as styles]
|
||||
[status-im.ui.screens.profile.visibility-status.views :as visibility-status]
|
||||
[status-im.utils.gfycat.core :as gfy]
|
||||
[status-im.utils.universal-links.utils :as universal-links]
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im2.common.qr-codes.view :as qr-codes]
|
||||
[status-im2.config :as config]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.i18n :as i18n])
|
||||
(:require-macros [status-im.utils.views :as views]))
|
||||
|
||||
|
@ -198,8 +197,8 @@
|
|||
ens-verified
|
||||
preferred-name
|
||||
key-uid]
|
||||
:as account}
|
||||
@(re-frame/subscribe [:profile/multiaccount])
|
||||
:as profile}
|
||||
@(re-frame/subscribe [:profile/profile-with-image])
|
||||
customization-color (or (:color @(re-frame/subscribe [:onboarding-2/profile]))
|
||||
@(re-frame/subscribe [:profile/customization-color key-uid]))
|
||||
on-share #(re-frame/dispatch [:show-popover
|
||||
|
@ -224,12 +223,8 @@
|
|||
has-picture)}])
|
||||
:color (user-avatar.style/customization-color customization-color
|
||||
(theme/get-theme))
|
||||
:title (multiaccounts/displayed-name account)
|
||||
:photo (multiaccounts/displayed-photo account)
|
||||
:title (profile.utils/displayed-name profile)
|
||||
:photo (profile.utils/photo profile)
|
||||
:monospace (not ens-verified)
|
||||
:subtitle (if (and ens-verified public-key)
|
||||
(gfy/generate-gfy public-key)
|
||||
(utils/get-shortened-address (or
|
||||
compressed-key
|
||||
public-key)))})}
|
||||
:subtitle (utils/get-shortened-address (or compressed-key public-key))})}
|
||||
[content]]])))
|
||||
|
|
|
@ -521,7 +521,7 @@
|
|||
;;TODO custom toolbar
|
||||
:options {:insets {:bottom? true
|
||||
:top? true}}
|
||||
:component contact/profile}
|
||||
:component contact/profile-view}
|
||||
|
||||
;KEYCARD
|
||||
{:name :keycard-onboarding-intro
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
[reagent.core :as reagent]
|
||||
[status-im.ethereum.tokens :as tokens]
|
||||
[status-im.keycard.common :as keycard.common]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.signing.eip1559 :as eip1559]
|
||||
[status-im.ui.components.bottom-panel.views :as bottom-panel]
|
||||
|
@ -26,6 +25,7 @@
|
|||
[status-im.utils.deprecated-types :as types]
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im.wallet.utils :as wallet.utils]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.security.core :as security]))
|
||||
|
||||
|
@ -33,16 +33,10 @@
|
|||
[]
|
||||
[react/view {:height 1 :background-color colors/gray-lighter}])
|
||||
|
||||
(defn displayed-name
|
||||
[contact]
|
||||
(if (or (:preferred-name contact) (:name contact))
|
||||
(multiaccounts/displayed-name contact)
|
||||
(utils/get-shortened-checksum-address (:address contact))))
|
||||
|
||||
(defn contact-item
|
||||
[title contact]
|
||||
[title {:keys [address] :as profile}]
|
||||
[copyable-text/copyable-text-view
|
||||
{:copied-text (:address contact)}
|
||||
{:copied-text address}
|
||||
[list.item/list-item
|
||||
{:title title
|
||||
:title-prefix-width 45
|
||||
|
@ -52,7 +46,7 @@
|
|||
{:ellipsize-mode :middle
|
||||
:number-of-lines 1
|
||||
:monospace true}
|
||||
(displayed-name contact)]}]])
|
||||
(profile.utils/displayed-name profile)]}]])
|
||||
|
||||
(defn token-item
|
||||
[{:keys [icon color] :as token} display-symbol]
|
||||
|
@ -103,7 +97,7 @@
|
|||
{:style {:color colors/gray}
|
||||
:ellipsize-mode :middle
|
||||
:number-of-lines 1} (i18n/label :t/to-capitalized) " "
|
||||
[{:style {:color colors/black}} (displayed-name contact)]]
|
||||
[{:style {:color colors/black}} (profile.utils/displayed-name contact)]]
|
||||
[react/text {:style {:margin-top 6 :color colors/gray}}
|
||||
(str fee " " fee-display-symbol " " (string/lower-case (i18n/label :t/network-fee)))])]
|
||||
[react/view {:padding-horizontal 24}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
[clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.ui.components.accordion :as accordion]
|
||||
|
@ -308,8 +307,8 @@
|
|||
[list.item/list-item
|
||||
{:title (i18n/label :t/use-as-profile-picture)
|
||||
:theme :accent
|
||||
:on-press #(re-frame/dispatch
|
||||
[::multiaccounts/save-profile-picture-from-url (:image_url nft)])
|
||||
:on-press #(re-frame/dispatch [:profile.settings/save-profile-picture-from-url
|
||||
(:image_url nft)])
|
||||
:icon :main-icons/profile
|
||||
:accessibility-label
|
||||
:set-nft-as-pfp}]])]))
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
[quo.core :as quo]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.commands.core :as commands]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.bottom-panel.views :as bottom-panel]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
|
@ -20,6 +19,7 @@
|
|||
[status-im.ui.screens.wallet.send.styles :as styles]
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im.wallet.utils :as wallet.utils]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.address :as address]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.money :as money]))
|
||||
|
@ -78,14 +78,14 @@
|
|||
:content-height 300}]))}])
|
||||
|
||||
(defn render-contact
|
||||
[contact from-chat?]
|
||||
[{:keys [address] :as contact} from-chat?]
|
||||
(if from-chat?
|
||||
[list.item/list-item
|
||||
{:title (multiaccounts/displayed-name contact)
|
||||
{:title (profile.utils/displayed-name contact)
|
||||
:subtitle [components.core/text
|
||||
{:monospace true
|
||||
:color :secondary}
|
||||
(utils/get-shortened-checksum-address (:address contact))]
|
||||
(utils/get-shortened-checksum-address address)]
|
||||
:icon [chat-icon/contact-icon-contacts-tab contact]}]
|
||||
[list.item/list-item
|
||||
(merge {:title (if-not contact
|
||||
|
@ -94,7 +94,7 @@
|
|||
{:size :large
|
||||
:monospace true}
|
||||
(utils/get-shortened-checksum-address
|
||||
(if (string? contact) contact (:address contact)))])
|
||||
(if (string? contact) contact address))])
|
||||
:accessibility-label :choose-recipient-button
|
||||
:on-press #(do
|
||||
(re-frame/dispatch [:dismiss-keyboard])
|
||||
|
|
|
@ -47,7 +47,8 @@
|
|||
[quo/button
|
||||
{:on-press #(do
|
||||
(when-not wallet-set-up-passed?
|
||||
(re-frame/dispatch [:multiaccounts.ui/wallet-set-up-confirmed]))
|
||||
(re-frame/dispatch [:profile.settings/update-value
|
||||
:wallet-set-up-passed? true]))
|
||||
(re-frame/dispatch [:hide-popover]))
|
||||
:type :secondary}
|
||||
(i18n/label :t/ok-got-it)]]]]))
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
(ns status-im.utils.gfycat.core
|
||||
(:require
|
||||
[native-module.core :as native-module]))
|
||||
|
||||
(def unknown-gfy "Unknown")
|
||||
|
||||
(defn- build-gfy
|
||||
[public-key]
|
||||
(case public-key
|
||||
nil unknown-gfy
|
||||
"0" unknown-gfy
|
||||
(native-module/generate-gfycat public-key)))
|
||||
|
||||
(def generate-gfy (memoize build-gfy))
|
|
@ -1,5 +0,0 @@
|
|||
(ns status-im.utils.identicon
|
||||
(:require
|
||||
[native-module.core :as native-module]))
|
||||
|
||||
(def identicon (memoize native-module/identicon))
|
|
@ -59,15 +59,6 @@
|
|||
:logout
|
||||
(fn [] (.logout native-status))
|
||||
|
||||
:generateAlias
|
||||
(fn [seed] (.generateAlias native-status seed))
|
||||
|
||||
:generateAliasAndIdenticonAsync
|
||||
(fn [seed callback]
|
||||
(let [generated-identicon (.identicon native-status seed)
|
||||
generated-alias (.generateAlias native-status seed)]
|
||||
(callback generated-alias generated-identicon)))
|
||||
|
||||
:multiAccountGenerateAndDeriveAddresses
|
||||
(fn [json callback]
|
||||
(callback (.multiAccountGenerateAndDeriveAddresses native-status json)))
|
||||
|
@ -96,9 +87,6 @@
|
|||
(callback (.initKeystore native-status
|
||||
(str test-dir "/keystore/" key-uid))))
|
||||
|
||||
:identicon
|
||||
(fn [pk] (.identicon native-status pk))
|
||||
|
||||
:encodeTransfer
|
||||
(fn [to-norm amount-hex]
|
||||
(.encodeTransfer native-status to-norm amount-hex))
|
||||
|
|
|
@ -3,26 +3,24 @@
|
|||
[cljs.test :refer-macros [deftest is testing]]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.router.core :as router]
|
||||
[status-im.utils.gfycat.core :as gfycat]
|
||||
[status-im.utils.universal-links.core :as links]))
|
||||
|
||||
(deftest handle-url-test
|
||||
(with-redefs [gfycat/generate-gfy (constantly "generated")]
|
||||
(testing "the user is not logged in"
|
||||
(testing "it stores the url for later processing"
|
||||
(is (= {:db {:universal-links/url "some-url"}}
|
||||
(links/handle-url {:db {}} "some-url")))))
|
||||
(testing "the user is logged in"
|
||||
(let [db {:profile/profile {:public-key "pk"}
|
||||
:app-state "active"
|
||||
:universal-links/url "some-url"}]
|
||||
(testing "it clears the url"
|
||||
(is (nil? (get-in (links/handle-url {:db db} "some-url")
|
||||
[:db :universal-links/url]))))
|
||||
(testing "Handle a custom string"
|
||||
(is (= (get-in (links/handle-url {:db db} "https://status.app/u#statuse2e")
|
||||
[::router/handle-uri :uri])
|
||||
"https://status.app/u#statuse2e")))))))
|
||||
(testing "the user is not logged in"
|
||||
(testing "it stores the url for later processing"
|
||||
(is (= {:db {:universal-links/url "some-url"}}
|
||||
(links/handle-url {:db {}} "some-url")))))
|
||||
(testing "the user is logged in"
|
||||
(let [db {:profile/profile {:public-key "pk"}
|
||||
:app-state "active"
|
||||
:universal-links/url "some-url"}]
|
||||
(testing "it clears the url"
|
||||
(is (nil? (get-in (links/handle-url {:db db} "some-url")
|
||||
[:db :universal-links/url]))))
|
||||
(testing "Handle a custom string"
|
||||
(is (= (get-in (links/handle-url {:db db} "https://status.app/u#statuse2e")
|
||||
[::router/handle-uri :uri])
|
||||
"https://status.app/u#statuse2e"))))))
|
||||
|
||||
(deftest url-event-listener
|
||||
(testing "the url is not nil"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
[status-im.ethereum.eip681 :as eip681]
|
||||
[status-im.ethereum.mnemonic :as mnemonic]
|
||||
[status-im.ethereum.stateofus :as stateofus]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.ui.components.list-selection :as list-selection]
|
||||
|
@ -123,7 +122,7 @@
|
|||
(native-module/verify
|
||||
address
|
||||
hashed-password
|
||||
#(re-frame/dispatch [:wallet-legacy.accounts/add-new-account-password-verifyied %
|
||||
#(re-frame/dispatch [:wallet-legacy.accounts/add-new-account-password-verified %
|
||||
hashed-password]))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
|
@ -150,6 +149,11 @@
|
|||
(string/trim (security/unmask private-key))
|
||||
(store-account key-uid constants/path-default-wallet hashed-password :key))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
::validate-mnemonic
|
||||
(fn [[passphrase callback]]
|
||||
(native-module/validate-mnemonic passphrase callback)))
|
||||
|
||||
(rf/defn generate-new-account
|
||||
[{:keys [db]} hashed-password]
|
||||
(let [{:keys [key-uid wallet-root-address]}
|
||||
|
@ -165,10 +169,10 @@
|
|||
|
||||
(rf/defn import-new-account-seed
|
||||
[{:keys [db]} passphrase hashed-password]
|
||||
{:db (assoc-in db [:add-account :step] :generating)
|
||||
::multiaccounts/validate-mnemonic [(security/safe-unmask-data passphrase)
|
||||
#(re-frame/dispatch [:wallet-legacy.accounts/seed-validated
|
||||
% passphrase hashed-password])]})
|
||||
{:db (assoc-in db [:add-account :step] :generating)
|
||||
::validate-mnemonic [(security/safe-unmask-data passphrase)
|
||||
#(re-frame/dispatch [:wallet-legacy.accounts/seed-validated % passphrase
|
||||
hashed-password])]})
|
||||
|
||||
(rf/defn new-account-seed-validated
|
||||
{:events [:wallet-legacy.accounts/seed-validated]}
|
||||
|
@ -254,8 +258,8 @@
|
|||
{:address (eip55/address->checksum (address/normalized-hex address))
|
||||
:type :watch})))
|
||||
|
||||
(rf/defn add-new-account-password-verifyied
|
||||
{:events [:wallet-legacy.accounts/add-new-account-password-verifyied]}
|
||||
(rf/defn add-new-account-password-verified
|
||||
{:events [:wallet-legacy.accounts/add-new-account-password-verified]}
|
||||
[{:keys [db] :as cofx} result hashed-password]
|
||||
(let [{:keys [error]} (types/json->clj result)]
|
||||
(if (not (string/blank? error))
|
||||
|
|
|
@ -465,9 +465,7 @@
|
|||
{:from (wallet.utils/get-default-account (:profile/wallet-accounts
|
||||
db))
|
||||
:to (or (get-in db [:contacts/contacts identity])
|
||||
(-> identity
|
||||
contact.db/public-key->new-contact
|
||||
contact.db/enrich-contact))
|
||||
(contact.db/enrich-contact {:public-key identity}))
|
||||
:request-parameters request-parameters
|
||||
:chat-id chat-id
|
||||
:symbol symbol
|
||||
|
@ -513,9 +511,7 @@
|
|||
(let [identity (:current-chat-id db)
|
||||
{:keys [ens-verified name] :as contact}
|
||||
(or (get-in db [:contacts/contacts identity])
|
||||
(-> identity
|
||||
contact.db/public-key->new-contact
|
||||
contact.db/enrich-contact))]
|
||||
(contact.db/enrich-contact {:public-key identity}))]
|
||||
(cond-> {:db (assoc db
|
||||
:wallet-legacy/prepare-transaction
|
||||
{:from (wallet.utils/get-default-account
|
||||
|
@ -541,9 +537,7 @@
|
|||
:wallet-legacy/prepare-transaction
|
||||
{:from (wallet.utils/get-default-account (:profile/wallet-accounts db))
|
||||
:to (or (get-in db [:contacts/contacts identity])
|
||||
(-> identity
|
||||
contact.db/public-key->new-contact
|
||||
contact.db/enrich-contact))
|
||||
(contact.db/enrich-contact {:public-key identity}))
|
||||
:symbol :ETH
|
||||
:from-chat? true
|
||||
:request-command? true})
|
||||
|
|
|
@ -37,14 +37,15 @@
|
|||
(let [{:keys [group-chat chat-id public-key color
|
||||
profile-picture name]} context
|
||||
id (or chat-id public-key)
|
||||
contact-name-by-identity (when-not group-chat
|
||||
(rf/sub [:contacts/contact-name-by-identity id]))
|
||||
[primary-name _] (when-not group-chat
|
||||
(rf/sub [:contacts/contact-two-names-by-identity id]))
|
||||
display-name (cond
|
||||
(= contact-name-by-identity
|
||||
"Unknown") name
|
||||
(= contact-name-by-identity
|
||||
nil) name
|
||||
:else contact-name-by-identity)
|
||||
(= primary-name "Unknown")
|
||||
name
|
||||
(= primary-name nil)
|
||||
name
|
||||
:else
|
||||
primary-name)
|
||||
photo-path (or profile-picture (rf/sub [:chats/photo-path id]))]
|
||||
[rn/view
|
||||
{:style {:margin-horizontal 20}
|
||||
|
|
|
@ -342,9 +342,9 @@
|
|||
|
||||
(defn remove-from-group-entry
|
||||
[{:keys [public-key]} chat-id]
|
||||
(let [username (first (rf/sub [:contacts/contact-two-names-by-identity public-key]))]
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity public-key])]
|
||||
(entry {:icon :i/placeholder
|
||||
:label (i18n/label :t/remove-user-from-group {:username username})
|
||||
:label (i18n/label :t/remove-user-from-group {:username primary-name})
|
||||
:on-press #(hide-sheet-and-dispatch [:group-chats.ui/remove-member-pressed chat-id
|
||||
public-key true])
|
||||
:danger? true
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
(ns status-im2.common.home.top-nav.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im2.common.home.top-nav.style :as style]
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.debounce :refer [dispatch-and-chill]]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
|
@ -14,22 +14,24 @@
|
|||
:jump-to? true/false
|
||||
:container-style passed to outer view of component}"
|
||||
[{:keys [container-style blur? jump-to?]}]
|
||||
(let [{:keys [public-key]} (rf/sub [:profile/profile])
|
||||
online? (rf/sub [:visibility-status-updates/online? public-key])
|
||||
account (rf/sub [:profile/multiaccount])
|
||||
customization-color (rf/sub [:profile/customization-color])
|
||||
avatar {:online? online?
|
||||
:full-name (multiaccounts/displayed-name account)
|
||||
:profile-picture (multiaccounts/displayed-photo account)}
|
||||
unread-count (rf/sub [:activity-center/unread-count])
|
||||
indicator (rf/sub [:activity-center/unread-indicator])
|
||||
notification-type (case indicator
|
||||
:unread-indicator/seen :mention-seen ; should be `seen` - TODO discuss
|
||||
; with design team about
|
||||
; notifications for activity centre
|
||||
:unread-indicator/new :mention ; should be :notification TODO
|
||||
; https://github.com/status-im/status-mobile/issues/17102
|
||||
nil)]
|
||||
(let [{:keys [public-key] :as profile} (rf/sub [:profile/profile-with-image])
|
||||
online? (rf/sub [:visibility-status-updates/online?
|
||||
public-key])
|
||||
customization-color (rf/sub [:profile/customization-color])
|
||||
avatar {:online? online?
|
||||
:full-name (profile.utils/displayed-name profile)
|
||||
:profile-picture (profile.utils/photo profile)}
|
||||
|
||||
unread-count (rf/sub [:activity-center/unread-count])
|
||||
indicator (rf/sub [:activity-center/unread-indicator])
|
||||
notification-type (case indicator
|
||||
; should be `seen` TODO discuss with design team
|
||||
; notifications for activity centre
|
||||
:unread-indicator/seen :mention-seen
|
||||
; should be :notification TODO
|
||||
; https://github.com/status-im/status-mobile/issues/17102
|
||||
:unread-indicator/new :mention
|
||||
nil)]
|
||||
[quo/top-nav
|
||||
{:avatar-on-press #(rf/dispatch [:navigate-to :my-profile])
|
||||
:scan-on-press #(js/alert "to be implemented")
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
[]
|
||||
(let [entered-password (reagent/atom "")]
|
||||
(fn []
|
||||
(let [account (rf/sub [:profile/multiaccount])
|
||||
(let [profile (rf/sub [:profile/profile-with-image])
|
||||
{:keys [error button]} (rf/sub [:password-authentication])]
|
||||
[rn/view {:padding-horizontal 20}
|
||||
[quo/text {:size :heading-1 :weight :semi-bold}
|
||||
|
@ -20,8 +20,8 @@
|
|||
[rn/view {:style {:margin-top 8 :margin-bottom 20}}
|
||||
[quo/context-tag
|
||||
{:size 24
|
||||
:profile-picture (multiaccounts/displayed-photo account)
|
||||
:full-name (multiaccounts/displayed-name account)}]]
|
||||
:full-name (profile.utils/displayed-name profile)
|
||||
:profile-picture (profile.utils/photo profile)}]]
|
||||
[quo/input
|
||||
{:type :password
|
||||
:label (i18n/label :t/profile-password)
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
(:require
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im2.common.standard-authentication.enter-password.style :as style]
|
||||
[status-im2.common.standard-authentication.password-input.view :as password-input]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn view
|
||||
[{:keys [on-enter-password button-label button-icon-left customization-color]}]
|
||||
(let [{:keys [key-uid display-name] :as account} (rf/sub [:profile/multiaccount])
|
||||
{:keys [error processing password]} (rf/sub [:profile/login])
|
||||
sign-in-enabled? (rf/sub [:sign-in-enabled?])
|
||||
profile-picture (multiaccounts/displayed-photo account)]
|
||||
(let [{:keys [key-uid] :as profile} (rf/sub [:profile/profile-with-image])
|
||||
{:keys [error processing password]} (rf/sub [:profile/login])
|
||||
sign-in-enabled? (rf/sub [:sign-in-enabled?])]
|
||||
[:<>
|
||||
[rn/view {:style style/enter-password-container}
|
||||
[rn/view
|
||||
|
@ -28,8 +27,8 @@
|
|||
[quo/context-tag
|
||||
{:type :default
|
||||
:blur? true
|
||||
:profile-picture profile-picture
|
||||
:full-name display-name
|
||||
:profile-picture (profile.utils/photo profile)
|
||||
:full-name (profile.utils/displayed-name profile)
|
||||
:customization-color customization-color
|
||||
:size 24}]]
|
||||
[password-input/view
|
||||
|
|
|
@ -66,11 +66,11 @@
|
|||
|
||||
(defn reply-from
|
||||
[{:keys [from contact-name current-public-key pin?]}]
|
||||
(let [display-name (first (rf/sub [:contacts/contact-two-names-by-identity from]))
|
||||
photo-path (rf/sub [:chats/photo-path from])]
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity from])
|
||||
photo-path (rf/sub [:chats/photo-path from])]
|
||||
[rn/view {:style style/reply-from}
|
||||
[quo/user-avatar
|
||||
{:full-name display-name
|
||||
{:full-name primary-name
|
||||
:profile-picture photo-path
|
||||
:status-indicator? false
|
||||
:size :xxxs
|
||||
|
@ -86,7 +86,7 @@
|
|||
[{:keys [from content-type contentType parsed-text content deleted? deleted-for-me?
|
||||
album-images-count]}
|
||||
in-chat-input? pin? recording-audio?]
|
||||
(let [contact-name (rf/sub [:contacts/contact-name-by-identity from])
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity from])
|
||||
current-public-key (rf/sub [:multiaccount/public-key])
|
||||
content-type (or content-type contentType)
|
||||
text (get-quoted-text-with-mentions (or parsed-text (:parsed-text content)))]
|
||||
|
@ -106,7 +106,7 @@
|
|||
[reply-from
|
||||
{:pin? pin?
|
||||
:from from
|
||||
:contact-name contact-name
|
||||
:contact-name primary-name
|
||||
:current-public-key current-public-key}]
|
||||
(when (not-empty text)
|
||||
[quo/text
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
|
||||
(defn get-display-name
|
||||
[{:keys [chat-id message]}]
|
||||
(let [name (first (rf/sub [:contacts/contact-two-names-by-identity chat-id]))
|
||||
no-ens-name (string/blank? (get-in message [:content :ens-name]))]
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity chat-id])
|
||||
no-ens-name (string/blank? (get-in message [:content :ens-name]))]
|
||||
(if no-ens-name
|
||||
(first (string/split name " "))
|
||||
name)))
|
||||
(first (string/split primary-name " "))
|
||||
primary-name)))
|
||||
|
||||
(defn requests-summary
|
||||
[requests]
|
||||
|
|
|
@ -70,8 +70,7 @@
|
|||
(defn top-view
|
||||
[messages insets index animations derived landscape? screen-width]
|
||||
(let [{:keys [from timestamp]} (first messages)
|
||||
display-name (first (rf/sub [:contacts/contact-two-names-by-identity
|
||||
from]))
|
||||
[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity from])
|
||||
bg-color (if landscape?
|
||||
colors/neutral-100-opa-70
|
||||
colors/neutral-100-opa-0)
|
||||
|
@ -102,7 +101,7 @@
|
|||
[quo/text
|
||||
{:weight :semi-bold
|
||||
:size :paragraph-1
|
||||
:style {:color colors/white}} display-name]
|
||||
:style {:color colors/white}} primary-name]
|
||||
[quo/text
|
||||
{:weight :medium
|
||||
:size :paragraph-2
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
|
||||
(defn avatar
|
||||
[{:keys [public-key size hide-ring?]}]
|
||||
(let [display-name (first (rf/sub [:contacts/contact-two-names-by-identity public-key]))
|
||||
photo-path (rf/sub [:chats/photo-path public-key])
|
||||
online? (rf/sub [:visibility-status-updates/online? public-key])]
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity public-key])
|
||||
photo-path (rf/sub [:chats/photo-path public-key])
|
||||
online? (rf/sub [:visibility-status-updates/online? public-key])]
|
||||
[rn/view {:style {:padding-top 4}}
|
||||
[rn/touchable-opacity
|
||||
{:active-opacity 1
|
||||
:on-press #(rf/dispatch [:chat.ui/show-profile public-key])}
|
||||
[quo/user-avatar
|
||||
{:full-name display-name
|
||||
{:full-name primary-name
|
||||
:ring? (not hide-ring?)
|
||||
:profile-picture photo-path
|
||||
:online? online?
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
(defn view
|
||||
[contact-id contact-request-state group-chat]
|
||||
(let [customization-color (rf/sub [:profile/customization-color])
|
||||
names (rf/sub [:contacts/contact-two-names-by-identity contact-id])]
|
||||
[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity contact-id])]
|
||||
[rn/view
|
||||
[permission-context/view
|
||||
[quo/button
|
||||
|
@ -29,11 +29,11 @@
|
|||
(or (not contact-request-state)
|
||||
(= contact-request-state
|
||||
constants/contact-request-state-none))
|
||||
(i18n/label :t/contact-request-chat-add {:name (first names)})
|
||||
(i18n/label :t/contact-request-chat-add {:name primary-name})
|
||||
|
||||
(= contact-request-state
|
||||
constants/contact-request-state-received)
|
||||
(str (first names) " sent you a contact request")
|
||||
(str primary-name " sent you a contact request")
|
||||
|
||||
(= contact-request-state
|
||||
constants/contact-request-state-sent)
|
||||
|
|
|
@ -36,9 +36,8 @@
|
|||
(defn deleted-by-message
|
||||
[{:keys [deleted-by timestamp-str from on-long-press animation-duration]}]
|
||||
(let [;; deleted message with nil deleted-by is deleted by (:from message)
|
||||
display-name (first (rf/sub [:contacts/contact-two-names-by-identity
|
||||
(or deleted-by from)]))
|
||||
photo-path (rf/sub [:chats/photo-path (or deleted-by from)])]
|
||||
[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity (or deleted-by from)])
|
||||
photo-path (rf/sub [:chats/photo-path (or deleted-by from)])]
|
||||
[quo/system-message
|
||||
{:type :deleted
|
||||
:animate-bg-color? animation-duration
|
||||
|
@ -46,7 +45,7 @@
|
|||
:on-long-press on-long-press
|
||||
:timestamp timestamp-str
|
||||
:child [user-xxx-deleted-this-message
|
||||
{:display-name display-name :profile-picture photo-path}]}]))
|
||||
{:display-name primary-name :profile-picture photo-path}]}]))
|
||||
|
||||
(defn deleted-message
|
||||
[{:keys [deleted? deleted-for-me? deleted-by pinned timestamp-str from
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
(defn pinned-by-view
|
||||
[pinned-by]
|
||||
(let [{:keys [public-key]} (rf/sub [:multiaccount/contact])
|
||||
contact-names (rf/sub [:contacts/contact-two-names-by-identity pinned-by])
|
||||
[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity pinned-by])
|
||||
author-name (if (= pinned-by public-key)
|
||||
(i18n/label :t/You)
|
||||
(first contact-names))]
|
||||
primary-name)]
|
||||
[rn/view
|
||||
{:style style/pin-indicator-container
|
||||
:accessibility-label :pinned-by}
|
||||
|
@ -29,11 +29,11 @@
|
|||
|
||||
(defn pinned-message
|
||||
[{:keys [from quoted-message timestamp-str]}]
|
||||
(let [display-name (first (rf/sub [:contacts/contact-two-names-by-identity from]))
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity from])
|
||||
customization-color (rf/sub [:profile/customization-color])]
|
||||
[quo/system-message
|
||||
{:type :pinned
|
||||
:pinned-by display-name
|
||||
:pinned-by primary-name
|
||||
:customization-color customization-color
|
||||
:child [reply/quoted-message quoted-message false true]
|
||||
:timestamp timestamp-str}]))
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
|
||||
(defn system-message-contact-request
|
||||
[{:keys [chat-id timestamp-str from]} type]
|
||||
(let [display-name (first (rf/sub [:contacts/contact-two-names-by-identity chat-id]))
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity chat-id])
|
||||
contact (rf/sub [:contacts/contact-by-address chat-id])
|
||||
photo-path (when (seq (:images contact)) (rf/sub [:chats/photo-path chat-id]))
|
||||
customization-color (rf/sub [:profile/customization-color])
|
||||
|
@ -80,7 +80,7 @@
|
|||
[quo/system-message
|
||||
{:type type
|
||||
:timestamp timestamp-str
|
||||
:display-name display-name
|
||||
:display-name primary-name
|
||||
:customization-color customization-color
|
||||
:photo-path photo-path
|
||||
:incoming? (not= public-key from)}]))
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
|
||||
(defn contact-list-item-fn
|
||||
[{:keys [from compressed-key]}]
|
||||
(let [[primary-name secondary-name] (rf/sub [:contacts/contact-two-names-by-identity
|
||||
from])
|
||||
(let [[primary-name secondary-name] (rf/sub [:contacts/contact-two-names-by-identity from])
|
||||
{:keys [ens-verified added?]} (rf/sub [:contacts/contact-by-address from])]
|
||||
^{:key compressed-key}
|
||||
[contact-list-item/contact-list-item
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(:require
|
||||
[camel-snake-kebab.core :as csk]
|
||||
[status-im.communities.core :as models.communities]
|
||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||
[status-im2.contexts.profile.settings.events :as profile.settings.events]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.collection]
|
||||
[utils.re-frame :as rf]))
|
||||
|
@ -15,7 +15,7 @@
|
|||
{:events [:chat.ui/cache-link-preview-data]}
|
||||
[{{:profile/keys [profile]} :db :as cofx} site data]
|
||||
(let [link-previews-cache (get profile :link-previews-cache {})]
|
||||
(multiaccounts.update/optimistic
|
||||
(profile.settings.events/optimistic-profile-update
|
||||
cofx
|
||||
:link-previews-cache
|
||||
(assoc link-previews-cache site (utils.collection/map-keys csk/->kebab-case-keyword data)))))
|
||||
|
@ -35,7 +35,7 @@
|
|||
(rf/defn should-suggest-link-preview
|
||||
{:events [:chat.ui/should-suggest-link-preview]}
|
||||
[{:keys [db] :as cofx} enabled?]
|
||||
(multiaccounts.update/multiaccount-update
|
||||
(profile.settings.events/profile-update
|
||||
cofx
|
||||
:link-preview-request-enabled
|
||||
(boolean enabled?)
|
||||
|
@ -87,7 +87,7 @@
|
|||
(rf/defn enable
|
||||
{:events [:chat.ui/enable-link-previews]}
|
||||
[{{:profile/keys [profile]} :db :as cofx} site enabled?]
|
||||
(multiaccounts.update/multiaccount-update
|
||||
(profile.settings.events/profile-update
|
||||
cofx
|
||||
:link-previews-enabled-sites
|
||||
(if enabled?
|
||||
|
@ -98,7 +98,7 @@
|
|||
(rf/defn enable-all
|
||||
{:events [:chat.ui/enable-all-link-previews]}
|
||||
[cofx link-previews-whitelist enabled?]
|
||||
(multiaccounts.update/multiaccount-update
|
||||
(profile.settings.events/profile-update
|
||||
cofx
|
||||
:link-previews-enabled-sites
|
||||
(if enabled?
|
||||
|
|
|
@ -129,3 +129,4 @@
|
|||
:on-success on-success
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to unblock contact" % contact-id)}]})
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
(:require
|
||||
["react-native-image-crop-picker" :default image-picker]
|
||||
[quo.core :as quo]
|
||||
[status-im.multiaccounts.core]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(:require
|
||||
[native-module.core :as native-module]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im2.contexts.profile.login.events :as login]
|
||||
[status-im2.contexts.profile.login.events :as profile.login]
|
||||
[status-im2.contexts.profile.rpc :as profile.rpc]
|
||||
[status-im2.navigation.events :as navigation]
|
||||
[utils.re-frame :as rf]))
|
||||
|
@ -46,7 +46,7 @@
|
|||
(init-profiles-overview profiles key-uid)
|
||||
;;we check if biometric is available, and try to login with it,
|
||||
;;if succeed "node.login" signal will be triggered
|
||||
(login/login-with-biometric-if-available key-uid)))
|
||||
(profile.login/login-with-biometric-if-available key-uid)))
|
||||
(navigation/init-root cofx :intro)))
|
||||
|
||||
(rf/defn update-setting-from-backup
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
[status-im.data-store.visibility-status-updates :as visibility-status-updates-store]
|
||||
[status-im.group-chats.core :as group-chats]
|
||||
[status-im.mobile-sync-settings.core :as mobile-network]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.transport.core :as transport]
|
||||
[status-im2.common.biometric.events :as biometric]
|
||||
[status-im2.common.keychain.events :as keychain]
|
||||
|
@ -20,6 +19,7 @@
|
|||
[status-im2.contexts.contacts.events :as contacts]
|
||||
[status-im2.contexts.profile.config :as profile.config]
|
||||
[status-im2.contexts.profile.rpc :as profile.rpc]
|
||||
[status-im2.contexts.profile.settings.events :as profile.settings.events]
|
||||
[status-im2.contexts.push-notifications.events :as notifications]
|
||||
[status-im2.contexts.shell.activity-center.events :as activity-center]
|
||||
[status-im2.contexts.wallet.events :as wallet]
|
||||
|
@ -62,7 +62,7 @@
|
|||
:else
|
||||
(rf/merge
|
||||
cofx
|
||||
(multiaccounts/switch-theme nil :shell-stack)
|
||||
(profile.settings.events/switch-theme nil :shell-stack)
|
||||
(navigation/init-root :shell-stack)))))
|
||||
|
||||
;; login phase 1, we want to load and show chats faster so we split login into 2 phases
|
||||
|
@ -71,14 +71,14 @@
|
|||
(let [{:networks/keys [current-network networks]
|
||||
:as settings}
|
||||
(data-store.settings/rpc->settings settings)
|
||||
profile (profile.rpc/rpc->profiles-overview account)]
|
||||
profile-overview (profile.rpc/rpc->profiles-overview account)]
|
||||
(rf/merge cofx
|
||||
{:db (assoc db
|
||||
:chats/loading? true
|
||||
:networks/current-network current-network
|
||||
:wallet/tokens-loading? true
|
||||
:networks/networks (merge networks config/default-networks-by-id)
|
||||
:profile/profile (merge profile settings))}
|
||||
:profile/profile (merge profile-overview settings))}
|
||||
(notifications/load-preferences)
|
||||
(data-store.chats/fetch-chats-preview
|
||||
{:on-success
|
||||
|
@ -122,8 +122,8 @@
|
|||
(browser/initialize-browser)
|
||||
(mobile-network/on-network-status-change)
|
||||
(group-chats/get-group-chat-invitations)
|
||||
(multiaccounts/get-profile-picture)
|
||||
(multiaccounts/switch-preview-privacy-mode-flag)
|
||||
(profile.settings.events/get-profile-picture)
|
||||
(profile.settings.events/change-preview-privacy)
|
||||
(link-preview/request-link-preview-whitelist)
|
||||
(visibility-status-updates-store/fetch-visibility-status-updates-rpc)
|
||||
(switcher-cards-store/fetch-switcher-cards-rpc))))
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
(ns status-im2.contexts.profile.settings.effects
|
||||
(:require [native-module.core :as native-module]
|
||||
[quo.foundations.colors :as colors]
|
||||
[re-frame.core :as re-frame]
|
||||
[react-native.platform :as platform]
|
||||
[status-im2.common.theme.core :as theme]
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.shell.jump-to.utils :as shell.utils]
|
||||
[status-im2.setup.hot-reload :as hot-reload]))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:profile.settings/blank-preview-flag-changed
|
||||
(fn [flag]
|
||||
(native-module/set-blank-preview-flag flag)))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:profile.settings/webview-debug-changed
|
||||
(fn [value]
|
||||
(when platform/android?
|
||||
(native-module/toggle-webview-debug value))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:profile.settings/switch-theme-fx
|
||||
(fn [[theme-type view-id reload-ui?]]
|
||||
(let [[theme status-bar-theme nav-bar-color]
|
||||
;; Status bar theme represents status bar icons colors, so opposite to app theme
|
||||
(if (or (= theme-type constants/theme-type-dark)
|
||||
(and (= theme-type constants/theme-type-system)
|
||||
(theme/device-theme-dark?)))
|
||||
[:dark :light colors/neutral-100]
|
||||
[:light :dark colors/white])]
|
||||
(theme/set-theme theme)
|
||||
(re-frame/dispatch [:change-shell-status-bar-style
|
||||
(if (shell.utils/home-stack-open?) status-bar-theme :light)])
|
||||
(when reload-ui?
|
||||
(re-frame/dispatch [:dismiss-all-overlays])
|
||||
(when js/goog.DEBUG
|
||||
(hot-reload/reload))
|
||||
(when-not (= view-id :shell-stack)
|
||||
(re-frame/dispatch [:change-shell-nav-bar-color nav-bar-color]))))))
|
|
@ -0,0 +1,140 @@
|
|||
(ns status-im2.contexts.profile.settings.events
|
||||
(:require [clojure.string :as string]
|
||||
[status-im.bottom-sheet.events :as bottom-sheet.events]
|
||||
[status-im2.constants :as constants]
|
||||
status-im2.contexts.profile.settings.effects
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(rf/defn send-contact-update
|
||||
[{:keys [db]}]
|
||||
(let [{:keys [name preferred-name display-name]} (:profile/profile db)]
|
||||
{:json-rpc/call [{:method "wakuext_sendContactUpdates"
|
||||
:params [(or preferred-name display-name name) ""]
|
||||
:on-success #(log/debug "sent contact update")}]}))
|
||||
|
||||
(rf/defn profile-update
|
||||
[{:keys [db] :as cofx}
|
||||
setting setting-value
|
||||
{:keys [dont-sync? on-success] :or {on-success #()}}]
|
||||
(rf/merge
|
||||
cofx
|
||||
{:db (if setting-value
|
||||
(assoc-in db [:profile/profile setting] setting-value)
|
||||
(update db :profile/profile dissoc setting))
|
||||
:json-rpc/call
|
||||
[{:method "settings_saveSetting"
|
||||
:params [setting setting-value]
|
||||
:on-success on-success}]}
|
||||
|
||||
(when (#{:name :preferred-name} setting)
|
||||
(constantly {:profile/get-profiles-overview #(rf/dispatch [:multiaccounts.ui/update-name %])}))
|
||||
|
||||
(when (and (not dont-sync?) (#{:name :preferred-name} setting))
|
||||
(send-contact-update))))
|
||||
|
||||
(rf/defn optimistic-profile-update
|
||||
[{:keys [db]} setting setting-value]
|
||||
{:db (if setting-value
|
||||
(assoc-in db [:profile/profile setting] setting-value)
|
||||
(update db :profile/profile dissoc setting))})
|
||||
|
||||
(rf/defn change-preview-privacy
|
||||
[{:keys [db]}]
|
||||
(let [private? (get-in db [:profile/profile :preview-privacy?])]
|
||||
{:profile.settings/blank-preview-flag-changed private?}))
|
||||
|
||||
(rf/defn update-value
|
||||
{:events [:profile.settings/update-value]}
|
||||
[cofx key value]
|
||||
(profile-update cofx key value {}))
|
||||
|
||||
(rf/defn change-webview-debug
|
||||
{:events [:profile.settings/change-webview-debug]}
|
||||
[{:keys [db] :as cofx} value]
|
||||
(rf/merge cofx
|
||||
{:profile.settings/webview-debug-changed value}
|
||||
(profile-update :webview-debug (boolean value) {})))
|
||||
|
||||
(rf/defn change-preview-privacy-flag
|
||||
{:events [:profile.settings/change-preview-privacy]}
|
||||
[{:keys [db] :as cofx} private?]
|
||||
(rf/merge cofx
|
||||
{:profile.settings/blank-preview-flag-changed private?}
|
||||
(profile-update
|
||||
:preview-privacy?
|
||||
(boolean private?)
|
||||
{})))
|
||||
|
||||
|
||||
(rf/defn change-profile-pictures-show-to
|
||||
{:events [:profile.settings/change-profile-pictures-show-to]}
|
||||
[cofx id]
|
||||
(rf/merge cofx
|
||||
{:json-rpc/call [{:method "wakuext_changeIdentityImageShowTo"
|
||||
:params [id]
|
||||
:on-success #(log/debug "picture settings changed successfully")}]}
|
||||
(optimistic-profile-update :profile-pictures-show-to id)))
|
||||
|
||||
(rf/defn change-appearance
|
||||
{:events [:profile.settings/change-appearance]}
|
||||
[cofx theme]
|
||||
(rf/merge cofx
|
||||
{:profile.settings/switch-theme-fx [theme :appearance true]}
|
||||
(profile-update :appearance theme {})))
|
||||
|
||||
(rf/defn switch-theme
|
||||
{:events [:profile.settings/switch-theme]}
|
||||
[cofx theme view-id]
|
||||
(let [theme (or theme
|
||||
(get-in cofx [:db :profile/profile :appearance])
|
||||
constants/theme-type-dark)]
|
||||
{:profile.settings/switch-theme-fx [theme view-id false]}))
|
||||
|
||||
(rf/defn get-profile-picture
|
||||
{:events [:profile.settings/get-profile-picture]}
|
||||
[cofx]
|
||||
(let [key-uid (get-in cofx [:db :profile/profile :key-uid])]
|
||||
{:json-rpc/call [{:method "multiaccounts_getIdentityImages"
|
||||
:params [key-uid]
|
||||
:on-success [:profile.settings/update-local-picture]}]}))
|
||||
|
||||
(rf/defn save-profile-picture
|
||||
{:events [:profile.settings/save-profile-picture]}
|
||||
[cofx path ax ay bx by]
|
||||
(let [key-uid (get-in cofx [:db :profile/profile :key-uid])]
|
||||
(rf/merge cofx
|
||||
{:json-rpc/call [{:method "multiaccounts_storeIdentityImage"
|
||||
:params [key-uid (string/replace-first path #"file://" "") ax ay bx
|
||||
by]
|
||||
:on-success [:profile.settings/update-local-picture]}]}
|
||||
(bottom-sheet.events/hide-bottom-sheet-old))))
|
||||
|
||||
(rf/defn save-profile-picture-from-url
|
||||
{:events [:profile.settings/save-profile-picture-from-url]}
|
||||
[cofx url]
|
||||
(let [key-uid (get-in cofx [:db :profile/profile :key-uid])]
|
||||
(rf/merge cofx
|
||||
{:json-rpc/call [{:method "multiaccounts_storeIdentityImageFromURL"
|
||||
:params [key-uid url]
|
||||
:on-error #(log/error "::save-profile-picture-from-url error" %)
|
||||
:on-success [:profile.settings/update-local-picture]}]}
|
||||
(bottom-sheet.events/hide-bottom-sheet-old))))
|
||||
|
||||
(rf/defn delete-profile-picture
|
||||
{:events [:profile.settings/delete-profile-picture]}
|
||||
[cofx name]
|
||||
(let [key-uid (get-in cofx [:db :profile/profile :key-uid])]
|
||||
(rf/merge cofx
|
||||
{:json-rpc/call [{:method "multiaccounts_deleteIdentityImage"
|
||||
:params [key-uid]
|
||||
;; NOTE: In case of an error we could fallback to previous image in
|
||||
;; UI with a toast error
|
||||
:on-success #(log/info "[profile] Delete profile image" %)}]}
|
||||
(optimistic-profile-update :images nil)
|
||||
(bottom-sheet.events/hide-bottom-sheet-old))))
|
||||
|
||||
(rf/defn store-profile-picture
|
||||
{:events [:profile.settings/update-local-picture]}
|
||||
[cofx pics]
|
||||
(optimistic-profile-update cofx :images pics))
|
|
@ -0,0 +1,23 @@
|
|||
(ns status-im2.contexts.profile.utils
|
||||
(:require [clojure.string :as string]))
|
||||
|
||||
(defn displayed-name
|
||||
[{:keys [name display-name preferred-name alias ens-verified primary-name]}]
|
||||
;; `preferred-name` is our own name
|
||||
;; otherwise we make sure the `name` is verified and use it
|
||||
(let [display-name (when-not (string/blank? display-name)
|
||||
display-name)
|
||||
preferred-name (when-not (string/blank? preferred-name)
|
||||
preferred-name)
|
||||
ens-name (or preferred-name
|
||||
display-name
|
||||
name)]
|
||||
(if (or preferred-name (and ens-verified name))
|
||||
ens-name
|
||||
(or display-name primary-name alias))))
|
||||
|
||||
(defn photo
|
||||
[{:keys [images]}]
|
||||
(or (:large images)
|
||||
(:thumbnail images)
|
||||
(first images)))
|
|
@ -3,8 +3,8 @@
|
|||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im2.common.resources :as resources]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[status-im2.contexts.quo-preview.preview :as preview]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
(defn view
|
||||
[]
|
||||
(let [account (rf/sub [:profile/multiaccount])
|
||||
(let [profile (rf/sub [:profile/profile-with-image])
|
||||
state (reagent/atom
|
||||
{:blur? false
|
||||
:title "Title"
|
||||
|
@ -55,7 +55,7 @@
|
|||
:icon-avatar :i/placeholder
|
||||
:on-button-press #(js/alert "on press")
|
||||
:on-button-long-press #(js/alert "on long press")
|
||||
:profile-picture (multiaccounts/displayed-photo account)})]
|
||||
:profile-picture (profile.utils/photo profile)})]
|
||||
(fn []
|
||||
[preview/preview-container
|
||||
{:state state
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
[quo.foundations.colors :as colors]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[status-im2.contexts.shell.activity-center.notification.common.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn user-avatar-tag
|
||||
[user-id]
|
||||
(let [{:keys [primary-name] :as contact} (rf/sub [:contacts/contact-by-identity user-id])]
|
||||
(let [profile (rf/sub [:contacts/contact-by-identity user-id])]
|
||||
[quo/context-tag
|
||||
{:blur? true
|
||||
:size 24
|
||||
:full-name primary-name
|
||||
:profile-picture (multiaccounts/displayed-photo contact)}]))
|
||||
:full-name (profile.utils/displayed-name profile)
|
||||
:profile-picture (profile.utils/photo profile)}]))
|
||||
|
||||
(defn- render-swipe-action
|
||||
[{:keys [active-swipeable
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
[react-native.platform :as platform]
|
||||
[react-native.safe-area :as safe-area]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.components.list-selection :as list-selection]
|
||||
[status-im2.common.qr-codes.view :as qr-codes]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[status-im2.contexts.shell.share.style :as style]
|
||||
[utils.address :as address]
|
||||
[utils.i18n :as i18n]
|
||||
|
@ -46,10 +46,11 @@
|
|||
|
||||
(defn profile-tab
|
||||
[]
|
||||
(let [{:keys [emoji-hash compressed-key customization-color display-name]
|
||||
(let [{:keys [emoji-hash
|
||||
compressed-key
|
||||
customization-color]
|
||||
:as profile} (rf/sub [:profile/profile])
|
||||
profile-url (str image-server/status-profile-base-url compressed-key)
|
||||
profile-photo-uri (:uri (multiaccounts/displayed-photo profile))
|
||||
abbreviated-url (address/get-abbreviated-profile-url
|
||||
image-server/status-profile-base-url-without-https
|
||||
compressed-key)
|
||||
|
@ -68,8 +69,8 @@
|
|||
:on-text-long-press #(rf/dispatch [:share/copy-text-and-show-toast
|
||||
{:text-to-copy profile-url
|
||||
:post-copy-message (i18n/label :t/link-to-profile-copied)}])
|
||||
:profile-picture profile-photo-uri
|
||||
:full-name display-name
|
||||
:profile-picture (:uri (profile.utils/photo profile))
|
||||
:full-name (profile.utils/displayed-name profile)
|
||||
:customization-color customization-color}]]
|
||||
|
||||
[rn/view {:style style/emoji-hash-container}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
(defn view
|
||||
[]
|
||||
(let [{:keys [customization-color]} (rf/sub [:profile/multiaccount])
|
||||
(let [{:keys [customization-color]} (rf/sub [:profile/profile-with-image])
|
||||
valid-for-ms (reagent/atom code-valid-for-ms)
|
||||
code (reagent/atom nil)
|
||||
delay-ms (reagent/atom nil)
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
derivation-path (reagent/atom (utils/get-derivation-path number-of-accounts))
|
||||
{:keys [public-key]} (rf/sub [:profile/profile])
|
||||
on-change-text #(reset! account-name %)
|
||||
display-name (first (rf/sub [:contacts/contact-two-names-by-identity public-key]))
|
||||
[primary-name _] (first (rf/sub [:contacts/contact-two-names-by-identity public-key]))
|
||||
{window-width :width} (rn/get-window)]
|
||||
(fn [{:keys [theme]}]
|
||||
[rn/view
|
||||
|
@ -108,7 +108,7 @@
|
|||
[quo/category
|
||||
{:list-type :settings
|
||||
:label (i18n/label :t/origin)
|
||||
:data (get-keypair-data display-name @derivation-path)}]
|
||||
:data (get-keypair-data primary-name @derivation-path)}]
|
||||
[standard-auth/view
|
||||
{:size :size-48
|
||||
:track-text (i18n/label :t/slide-to-create-account)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
status-im2.contexts.onboarding.common.overlay.events
|
||||
status-im2.contexts.onboarding.events
|
||||
status-im2.contexts.profile.events
|
||||
status-im2.contexts.profile.settings.events
|
||||
status-im2.contexts.shell.share.events
|
||||
status-im2.contexts.syncing.events
|
||||
status-im2.contexts.wallet.events
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
(fn [root-id]
|
||||
(let [root (get (roots/roots) root-id)]
|
||||
(dismiss-all-modals)
|
||||
(re-frame/dispatch [:multiaccounts.ui/switch-theme
|
||||
(re-frame/dispatch [:profile.settings/switch-theme
|
||||
(get roots/themes root-id)
|
||||
root-id])
|
||||
(reset! state/root-id (or (get-in root [:root :stack :id]) root-id))
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
{:set-root (if keycard-account? :multiaccounts-keycard :multiaccounts)}))
|
||||
|
||||
(rf/defn dismiss-all-overlays
|
||||
{:events [:dissmiss-all-overlays]}
|
||||
{:events [:dismiss-all-overlays]}
|
||||
[{:keys [db]}]
|
||||
{:dispatch-n [[:hide-popover]
|
||||
[:hide-visibility-status-popover]
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
[clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.communities.core :as communities]
|
||||
[status-im.contact.core :as contact]
|
||||
[status-im.group-chats.core :as group-chat]
|
||||
[status-im.group-chats.db :as group-chats.db]
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.chat.composer.constants :as composer.constants]
|
||||
[status-im2.contexts.chat.events :as chat.events]))
|
||||
[status-im2.contexts.chat.events :as chat.events]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]))
|
||||
|
||||
(def memo-chats-stack-items (atom nil))
|
||||
|
||||
|
@ -313,10 +313,10 @@
|
|||
(re-frame/reg-sub
|
||||
:chats/photo-path
|
||||
:<- [:contacts/contacts]
|
||||
:<- [:profile/multiaccount]
|
||||
:<- [:profile/profile-with-image]
|
||||
(fn [[contacts {:keys [public-key] :as multiaccount}] [_ id]]
|
||||
(let [contact (or (when (= id public-key) multiaccount) (get contacts id))]
|
||||
(contact/displayed-photo contact))))
|
||||
(profile.utils/photo contact))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:chats/unread-messages-number
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
(:require
|
||||
[clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils]
|
||||
[status-im2.constants :as constants]
|
||||
[utils.i18n :as i18n]))
|
||||
|
@ -52,20 +51,16 @@
|
|||
(re-frame/reg-sub
|
||||
:communities/sorted-community-members
|
||||
(fn [[_ community-id]]
|
||||
(let [contacts (re-frame/subscribe [:contacts/contacts])
|
||||
multiaccount (re-frame/subscribe [:profile/profile])
|
||||
members (re-frame/subscribe [:communities/community-members community-id])]
|
||||
[contacts multiaccount members]))
|
||||
(fn [[contacts multiaccount members] _]
|
||||
(let [profile (re-frame/subscribe [:profile/profile])
|
||||
members (re-frame/subscribe [:communities/community-members community-id])]
|
||||
[profile members]))
|
||||
(fn [[profile members] _]
|
||||
(let [names (reduce (fn [acc contact-identity]
|
||||
(let [me? (= (:public-key multiaccount) contact-identity)
|
||||
contact (when-not me?
|
||||
(multiaccounts/contact-by-identity contacts contact-identity))
|
||||
name (first (multiaccounts/contact-two-names-by-identity
|
||||
contact
|
||||
multiaccount
|
||||
contact-identity))]
|
||||
(assoc acc contact-identity name)))
|
||||
(assoc acc
|
||||
contact-identity
|
||||
(when (= (:public-key profile) contact-identity)
|
||||
(:primary-name profile)
|
||||
contact-identity)))
|
||||
{}
|
||||
(keys members))]
|
||||
(->> members
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
[quo.theme :as theme]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.contact.db :as contact.db]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils]
|
||||
[status-im.utils.gfycat.core :as gfycat]
|
||||
[status-im2.constants :as constants]
|
||||
[status-im2.contexts.profile.utils :as profile.utils]
|
||||
[utils.address :as address]
|
||||
[utils.collection]
|
||||
[utils.i18n :as i18n]
|
||||
|
@ -213,7 +212,7 @@
|
|||
:contacts/contact-by-identity
|
||||
:<- [:contacts/contacts]
|
||||
(fn [contacts [_ contact-identity]]
|
||||
(multiaccounts/contact-by-identity contacts contact-identity)))
|
||||
(get contacts contact-identity {:public-key contact-identity})))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/contact-added?
|
||||
|
@ -234,40 +233,17 @@
|
|||
(fn [[_ contact-identity] _]
|
||||
[(re-frame/subscribe [:contacts/contact-by-identity contact-identity])
|
||||
(re-frame/subscribe [:profile/profile])])
|
||||
(fn [[contact current-multiaccount] [_ contact-identity]]
|
||||
(multiaccounts/contact-two-names-by-identity contact
|
||||
current-multiaccount
|
||||
contact-identity)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/contact-name-by-identity
|
||||
(fn [[_ contact-identity] _]
|
||||
[(re-frame/subscribe [:contacts/contact-two-names-by-identity contact-identity])])
|
||||
(fn [[names] _]
|
||||
(first names)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:messages/quote-info
|
||||
:<- [:chats/messages]
|
||||
:<- [:contacts/contacts]
|
||||
:<- [:profile/profile]
|
||||
(fn [[messages contacts current-multiaccount] [_ message-id]]
|
||||
(when-let [message (get messages message-id)]
|
||||
(let [from-identity (:from message)
|
||||
me? (= (:public-key current-multiaccount) from-identity)]
|
||||
(if me?
|
||||
{:quote {:from from-identity
|
||||
:text (get-in message [:content :text])}
|
||||
:ens-name (:preferred-name current-multiaccount)
|
||||
:alias (gfycat/generate-gfy from-identity)}
|
||||
(let [contact (or (contacts from-identity)
|
||||
(contact.db/public-key->new-contact from-identity))]
|
||||
{:quote {:from from-identity
|
||||
:text (get-in message [:content :text])}
|
||||
:ens-name (when (:ens-verified contact)
|
||||
(:name contact))
|
||||
:alias (or (:alias contact)
|
||||
(gfycat/generate-gfy from-identity))}))))))
|
||||
(fn [[{:keys [primary-name] :as contact}
|
||||
{:keys [public-key preferred-name display-name]}]
|
||||
[_ contact-identity]]
|
||||
[(if (= public-key contact-identity)
|
||||
(cond
|
||||
(not (string/blank? preferred-name)) preferred-name
|
||||
(not (string/blank? display-name)) display-name
|
||||
(not (string/blank? primary-name)) primary-name
|
||||
:else public-key)
|
||||
(profile.utils/displayed-name contact))
|
||||
(:secondary-name contact)]))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/all-contacts-not-in-current-chat
|
||||
|
|
|
@ -278,8 +278,8 @@
|
|||
(re-frame/reg-sub
|
||||
:messages/resolve-mention
|
||||
(fn [[_ mention] _]
|
||||
[(re-frame/subscribe [:contacts/contact-name-by-identity mention])])
|
||||
(fn [[contact-name] [_ mention]]
|
||||
[(re-frame/subscribe [:contacts/contact-two-names-by-identity mention])])
|
||||
(fn [[contact-names] [_ mention]]
|
||||
(if (= mention constants/everyone-mention-id)
|
||||
(i18n/label :t/everyone-mention)
|
||||
contact-name)))
|
||||
(first contact-names))))
|
||||
|
|
|
@ -39,11 +39,11 @@
|
|||
:<- [:profile/profiles-overview]
|
||||
:<- [:mediaserver/port]
|
||||
:<- [:initials-avatar-font-file]
|
||||
(fn [[multiaccounts port font-file] [_ target-key-uid]]
|
||||
(let [{:keys [images ens-name?] :as multiaccount} (get multiaccounts target-key-uid)
|
||||
image-name (-> images first :type)
|
||||
override-ring? (when ens-name? false)]
|
||||
(when multiaccount
|
||||
(fn [[profiles port font-file] [_ target-key-uid]]
|
||||
(let [{:keys [images ens-name?] :as profile} (get profiles target-key-uid)
|
||||
image-name (-> images first :type)
|
||||
override-ring? (when ens-name? false)]
|
||||
(when profile
|
||||
{:fn
|
||||
(if image-name
|
||||
(image-server/get-account-image-uri-fn {:port port
|
||||
|
@ -249,8 +249,8 @@
|
|||
(pos? (count (get multiaccount :images)))))
|
||||
|
||||
(defn- replace-multiaccount-image-uri
|
||||
[multiaccount ens-names port font-file avatar-opts]
|
||||
(let [{:keys [key-uid ens-name? images]} multiaccount
|
||||
[profile ens-names port font-file avatar-opts]
|
||||
(let [{:keys [key-uid ens-name? images]} profile
|
||||
ens-name? (or ens-name? (seq ens-names))
|
||||
theme (theme/get-theme)
|
||||
avatar-opts (assoc avatar-opts :override-ring? (when ens-name? false))
|
||||
|
@ -271,16 +271,16 @@
|
|||
:theme theme
|
||||
:font-file font-file}
|
||||
avatar-opts))}])]
|
||||
(assoc multiaccount :images new-images)))
|
||||
(assoc profile :images new-images)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:profile/multiaccount
|
||||
:profile/profile-with-image
|
||||
:<- [:profile/profile]
|
||||
:<- [:ens/names]
|
||||
:<- [:mediaserver/port]
|
||||
:<- [:initials-avatar-font-file]
|
||||
(fn [[multiaccount ens-names port font-file] [_ avatar-opts]]
|
||||
(replace-multiaccount-image-uri multiaccount ens-names port font-file avatar-opts)))
|
||||
(fn [[profile ens-names port font-file] [_ avatar-opts]]
|
||||
(replace-multiaccount-image-uri profile ens-names port font-file avatar-opts)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:profile/login-profile
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
(ns status-im2.subs.shell
|
||||
(:require
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im2.common.resources :as resources]
|
||||
[status-im2.config :as config]
|
||||
[status-im2.constants :as constants]
|
||||
|
@ -186,15 +185,12 @@
|
|||
(re-frame/subscribe [:contacts/contacts])
|
||||
(re-frame/subscribe [:profile/profile])
|
||||
(re-frame/subscribe [:profile/customization-color])])
|
||||
(fn [[chat communities contacts current-multiaccount profile-customization-color] [_ id]]
|
||||
(let [from (get-in chat [:last-message :from])
|
||||
contact (when from (multiaccounts/contact-by-identity contacts from))
|
||||
primary-name (when from
|
||||
(first (multiaccounts/contact-two-names-by-identity
|
||||
contact
|
||||
current-multiaccount
|
||||
from)))]
|
||||
(private-group-chat-card chat id communities primary-name profile-customization-color))))
|
||||
(fn [[chat communities contacts current-profile profile-customization-color] [_ id]]
|
||||
(let [from (get-in chat [:last-message :from])
|
||||
contact (if from
|
||||
(get contacts from {:public-key from})
|
||||
current-profile)]
|
||||
(private-group-chat-card chat id communities (:primary-name contact) profile-customization-color))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:shell/community-card
|
||||
|
|
Loading…
Reference in New Issue