[fix #3163] remove phone command

Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
This commit is contained in:
Eric Dvorsak 2018-01-30 11:57:47 +01:00
parent da70ff7954
commit 0b0405d9a5
No known key found for this signature in database
GPG Key ID: 932AC1CE5F05DE0C
37 changed files with 124 additions and 1788 deletions

View File

@ -12,8 +12,6 @@
}
},
"modules": [
"react-native-contacts",
"awesome-phonenumber",
"realm",
"react-native-i18n",
"realm/react-native",
@ -24,7 +22,6 @@
"dismissKeyboard",
"react-native-linear-gradient",
"react-native-splash-screen",
"react-native-android-sms-listener",
"react-native-status",
"react-native-camera",
"react-native-qrcode",

View File

@ -196,13 +196,11 @@ dependencies {
implementation project(':react-native-image-resizer')
implementation project(':react-native-dialogs')
implementation project(':react-native-randombytes')
implementation project(':react-native-android-sms-listener')
implementation project(':realm')
implementation project(':react-native-vector-icons')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:23.0.1"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-contacts')
implementation project(':react-native-i18n')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-camera')

View File

@ -16,8 +16,6 @@
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- these permissions should be removed -->

View File

@ -5,7 +5,6 @@ import com.BV.LinearGradient.LinearGradientPackage;
import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage;
import com.bitgo.randombytes.RandomBytesPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.centaurwarchief.smslistener.SmsListenerPackage;
import com.facebook.react.ReactApplication;
import com.ocetnik.timer.BackgroundTimerPackage;
import com.horcrux.svg.SvgPackage;
@ -23,7 +22,6 @@ import com.lwansbrough.RCTCamera.RCTCameraPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.rnfs.RNFSPackage;
import com.rt2zz.reactnativecontacts.ReactNativeContacts;
import es.tiarg.nfcreactnative.NfcReactNativePackage;
import fr.bamlab.rnimageresizer.ImageResizerPackage;
import im.status.ethereum.module.StatusPackage;
@ -68,12 +66,10 @@ public class MainApplication extends MultiDexApplication implements ReactApplica
statusPackage,
new RealmReactPackage(),
new VectorIconsPackage(),
new ReactNativeContacts(),
new RNI18nPackage(),
new RandomBytesPackage(),
new LinearGradientPackage(),
new RCTCameraPackage(),
new SmsListenerPackage(),
new OrientationPackage(),
new RNFSPackage(),
new ReactNativeDialogsPackage(),

View File

@ -20,10 +20,6 @@ include ':react-native-dialogs'
project(':react-native-dialogs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-dialogs/android')
include ':react-native-randombytes'
project(':react-native-randombytes').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-randombytes/android')
include ':react-native-android-sms-listener'
project(':react-native-android-sms-listener').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-sms-listener/android')
include ':react-native-contacts'
project(':react-native-contacts').projectDir = new File(settingsDir, '../node_modules/react-native-contacts/android')
include ':react-native-i18n'
project(':react-native-i18n').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-i18n/android')
include ':react-native-vector-icons'

View File

@ -57,7 +57,6 @@
9E54D6001F17A5DB009F0C16 /* libTestFairy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E54D5FD1F17A5DB009F0C16 /* libTestFairy.a */; };
9E54D6011F17A5DB009F0C16 /* upload-dsym.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9E54D5FF1F17A5DB009F0C16 /* upload-dsym.sh */; };
9E7C64731E03FDDE004C7042 /* libRCTCamera.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20B7D1151D3F74CD00B70F14 /* libRCTCamera.a */; };
9E7C64991E03FDE5004C7042 /* libRCTContacts.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20B7D10A1D3F74CD00B70F14 /* libRCTContacts.a */; };
9ED2F45E1D9D535A00B36508 /* SF-UI-Text-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 9ED2F45D1D9D52DD00B36508 /* SF-UI-Text-Regular.otf */; };
9ED2F45F1D9D535A00B36508 /* SF-UI-Text-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 9ED2F45C1D9D52C100B36508 /* SF-UI-Text-Medium.otf */; };
9ED2F4611D9D579900B36508 /* SF-UI-Text-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 9ED2F4601D9D577B00B36508 /* SF-UI-Text-Bold.otf */; };
@ -183,13 +182,6 @@
remoteGlobalIDString = 5DBEB1501B18CEA900B34395;
remoteInfo = RNVectorIcons;
};
20B7D1091D3F74CD00B70F14 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 09F98D1521C24548AC72563A /* RCTContacts.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1441618E1BD0A79300FA4F59;
remoteInfo = RCTContacts;
};
20B7D10D1D3F74CD00B70F14 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */;
@ -547,7 +539,6 @@
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* StatusImTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StatusImTests.m; sourceTree = "<group>"; };
064351D2FD901F8B6C9AE2A5 /* Pods-StatusImTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StatusImTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-StatusImTests/Pods-StatusImTests.debug.xcconfig"; sourceTree = "<group>"; };
09F98D1521C24548AC72563A /* RCTContacts.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTContacts.xcodeproj; path = "../node_modules/react-native-contacts/ios/RCTContacts.xcodeproj"; sourceTree = "<group>"; };
101A4045637A2ADF57D28EF5 /* libPods-StatusIm.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-StatusIm.a"; sourceTree = BUILT_PRODUCTS_DIR; };
11632AA0A5F84F029DD91797 /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
@ -681,7 +672,6 @@
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
9E7C64731E03FDDE004C7042 /* libRCTCamera.a in Frameworks */,
9E7C64991E03FDE5004C7042 /* libRCTContacts.a in Frameworks */,
FD4F213C3873473CB703B1D2 /* libRNFS.a in Frameworks */,
213311F38CA74CE280FD09AD /* libRNI18n.a in Frameworks */,
4D3D740D5EFA4F8592B048D7 /* libBVLinearGradient.a in Frameworks */,
@ -905,14 +895,6 @@
name = Products;
sourceTree = "<group>";
};
20B7D1061D3F74CD00B70F14 /* Products */ = {
isa = PBXGroup;
children = (
20B7D10A1D3F74CD00B70F14 /* libRCTContacts.a */,
);
name = Products;
sourceTree = "<group>";
};
20B7D1111D3F74CD00B70F14 /* Products */ = {
isa = PBXGroup;
children = (
@ -997,7 +979,6 @@
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
9F1854E6D9654226B1FC8308 /* RCTCamera.xcodeproj */,
09F98D1521C24548AC72563A /* RCTContacts.xcodeproj */,
305F194186D848FDB07AF34C /* RNFS.xcodeproj */,
46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */,
807594C429CA44128AB5666B /* BVLinearGradient.xcodeproj */,
@ -1298,10 +1279,6 @@
ProductGroup = 20B7D1111D3F74CD00B70F14 /* Products */;
ProjectRef = 9F1854E6D9654226B1FC8308 /* RCTCamera.xcodeproj */;
},
{
ProductGroup = 20B7D1061D3F74CD00B70F14 /* Products */;
ProjectRef = 09F98D1521C24548AC72563A /* RCTContacts.xcodeproj */;
},
{
ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
@ -1507,13 +1484,6 @@
remoteRef = 20B7D1021D3F74CD00B70F14 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
20B7D10A1D3F74CD00B70F14 /* libRCTContacts.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTContacts.a;
remoteRef = 20B7D1091D3F74CD00B70F14 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
20B7D10E1D3F74CD00B70F14 /* libRNI18n.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -2155,7 +2125,6 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-camera/ios",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-i18n/RNI18n",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
@ -2213,7 +2182,6 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-camera/ios",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-i18n/RNI18n",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
@ -2293,7 +2261,6 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-camera/ios",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-i18n/RNI18n",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
@ -2353,7 +2320,6 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-camera/ios",
"$(SRCROOT)/../node_modules/react-native-contacts/ios/RCTContacts",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-i18n/RNI18n",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",

963
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@
"dependencies": {
"assert": "1.4.1",
"asyncstorage-down": "4.0.1",
"awesome-phonenumber": "2.1.2",
"babel-core": "6.24.1",
"babel-generator": "6.24.1",
"babel-helper-builder-react-jsx": "6.18.0",
@ -48,12 +47,10 @@
"react-dom": "16.2.0",
"react-native": "0.51.0",
"react-native-action-button": "2.8.1",
"react-native-android-sms-listener": "github:adrian-tiberius/react-native-android-sms-listener#listener-bugfix",
"react-native-autolink": "1.1.1",
"react-native-background-timer": "2.0.0",
"react-native-camera": "0.10.0",
"react-native-config": "0.9.0",
"react-native-contacts": "1.0.3",
"react-native-crypto": "2.1.1",
"react-native-dialogs": "0.0.20",
"react-native-emoji-picker": "git+https://github.com/status-im/react-native-emoji-picker.git",

View File

@ -1,12 +1,9 @@
(ns status-im.react-native.js-dependencies)
(def action-button (js/require "react-native-action-button"))
(def android-sms-listener (js/require "react-native-android-sms-listener"))
(def autolink (js/require "react-native-autolink"))
(def camera (js/require "react-native-camera"))
(def config (js/require "react-native-config"))
;; TODO see https://github.com/rt2zz/react-native-contacts/issues/45
(def contacts (js/require "react-native-contacts"))
(def dialogs (js/require "react-native-dialogs"))
(def dismiss-keyboard (js/require "dismissKeyboard"))
(def emoji-picker (js/require "react-native-emoji-picker"))

View File

@ -413,87 +413,6 @@ function startsWith(str1, str2) {
return str1.lastIndexOf(str2, 0) == 0 && str1 != str2;
}
function phoneSuggestions(params, context) {
var ph, suggestions;
if (!params.phone || params.phone == "") {
ph = context.suggestions;
} else {
ph = context.suggestions.filter(function (phone) {
return startsWith(phone.number, params.phone);
});
}
if (ph.length == 0) {
return;
}
suggestions = ph.map(function (phone) {
return status.components.view(suggestionContainerStyle,
[status.components.view(suggestionSubContainerStyle,
[
status.components.text(
{style: valueStyle},
phone.number
),
status.components.text(
{style: descriptionStyle},
phone.description
)
])]);
});
var view = status.components.scrollView(
suggestionsContainerStyle(ph.length),
suggestions
);
return {markup: view};
}
var phoneConfig = {
name: "phone",
icon: "phone_white",
color: "#5bb2a2",
title: I18n.t('phone_title'),
scope: ["personal-chats", "registered", "dapps"],
description: I18n.t('phone_description'),
sequentialParams: true,
validator: function (params) {
return {
validationHandler: "phone",
parameters: [params.phone]
};
},
params: [{
name: "phone",
type: status.types.PHONE,
suggestions: phoneSuggestions,
placeholder: I18n.t('phone_placeholder')
}],
preview: function (params) {
if (params) {
return {
markup: status.components.text(
{},
params.phone
)
};
}
},
shortPreview: function (params) {
if (params) {
return {
markup: status.components.chatPreviewText(
{},
params.phone
)
};
}
}
};
status.command(phoneConfig);
status.response(phoneConfig);
var ropstenNetworkId = 3;
var rinkebyNetworkId = 4;
@ -659,44 +578,6 @@ status.command({
}
});
status.response({
name: "confirmation-code",
color: "#7099e6",
scope: ["personal-chats", "registered", "dapps"],
description: I18n.t('confirm_description'),
sequentialParams: true,
params: [{
name: "code",
type: status.types.NUMBER
}],
validator: function (params) {
if (!/^[\d]{4}$/.test(params.code)) {
var error = status.components.validationMessage(
I18n.t('confirm_validation_title'),
I18n.t('confirm_validation_description')
);
return {markup: error};
}
},
preview: function (params) {
return {
markup: status.components.text(
{},
params.code
)
};
},
shortPreview: function (params) {
return {
markup: status.components.chatPreviewText(
{},
params.code
)
};
}
});
status.response({
name: "password",
color: "#7099e6",

View File

@ -1,13 +1,5 @@
I18n.translations = {
en: {
phone_title: 'Send Phone Number',
phone_description: 'Find friends using your number',
phone_placeholder: 'Phone number',
confirm_description: 'Confirmation code',
confirm_validation_title: 'Confirmation code',
confirm_validation_description: 'Wrong format',
password_description: 'Password',
password_placeholder: 'Type your password',
password_placeholder2: 'Confirm',
@ -26,14 +18,6 @@ I18n.translations = {
faucet_placeholder: 'Faucet URL'
},
ru: {
phone_title: 'Отправить номер телефона',
phone_description: 'Найти друзей, используя ваш номер',
phone_placeholder: 'Номер телефона',
confirm_description: 'Код подтверждения',
confirm_validation_title: 'Код подтверждения',
confirm_validation_description: 'Неверный формат',
password_description: 'Пароль',
password_placeholder: 'Введите свой пароль',
password_placeholder2: 'Повторно введите пароль для подтверждения',
@ -43,14 +27,6 @@ I18n.translations = {
},
af: {
phone_title: 'Stuur telefoonnommer',
phone_description: 'Vind vriende deur jou nommer te gebruik',
phone_placeholder: 'Telefoonnommer',
confirm_description: 'Bevestigingskode',
confirm_validation_title: 'Bevestigingskode',
confirm_validation_description: 'Verkeerde formaat',
password_description: 'Wagwoord',
password_placeholder: 'Tik jou wagwoord in',
password_placeholder2: 'Tik asseblief weer jou wagwoord in om te bevestig',
@ -60,14 +36,6 @@ I18n.translations = {
},
ar: {
phone_title: 'أرسل رقم الهاتف',
phone_description: 'ابحث عن الأصدقاء باستخدام رقمك',
phone_placeholder: 'رقم الهاتف',
confirm_description: 'رمز التأكيد',
confirm_validation_title: 'رمز التأكيد',
confirm_validation_description: 'صيغة خاطئة',
password_description: 'كلمة المرور',
password_placeholder: 'اكتب كلمة المرور الخاصة بك',
password_placeholder2: 'الرجاء إعادة إدخال كلمة المرور للتأكيد',
@ -77,14 +45,6 @@ I18n.translations = {
},
'zh-hant': {
phone_title: '發送手機號碼',
phone_description: '使用你的號碼發現好友',
phone_placeholder: '手機號碼',
confirm_description: '確認碼',
confirm_validation_title: '確認碼',
confirm_validation_description: '格式錯誤',
password_description: '密碼',
password_placeholder: '鍵入你的密碼',
password_placeholder2: '重新鍵入你的密碼',
@ -104,14 +64,6 @@ I18n.translations = {
},
'zh-hant-tw': {
phone_title: '傳送電話號碼',
phone_description: '用你的號碼來查詢朋友',
phone_placeholder: '電話號碼',
confirm_description: '確認碼',
confirm_validation_title: '確認碼',
confirm_validation_description: '格式錯誤',
password_description: '密碼',
password_placeholder: '輸入密碼',
password_placeholder2: '請重新輸入密碼以確認',
@ -131,14 +83,6 @@ I18n.translations = {
},
'zh-hant-sg': {
phone_title: '傳送電話號碼',
phone_description: '用你的號碼來查詢朋友',
phone_placeholder: '電話號碼',
confirm_description: '確認碼',
confirm_validation_title: '確認碼',
confirm_validation_description: '格式錯誤',
password_description: '密碼',
password_placeholder: '輸入密碼',
password_placeholder2: '請重新輸入密碼以確認',
@ -158,14 +102,6 @@ I18n.translations = {
},
'zh-hant-hk': {
phone_title: '發送電話號碼',
phone_description: '用你的號碼來查找朋友',
phone_placeholder: '電話號碼',
confirm_description: '確認碼',
confirm_validation_title: '確認碼',
confirm_validation_description: '格式錯誤',
password_description: '密碼',
password_placeholder: '輸入密碼',
password_placeholder2: '請重新輸入密碼以確認',
@ -185,14 +121,6 @@ I18n.translations = {
},
'zh-hans': {
phone_title: '发送电话号码',
phone_description: '用你的号码来查找朋友',
phone_placeholder: '电话号码',
confirm_description: '确认码',
confirm_validation_title: '确认码',
confirm_validation_description: '格式错误',
password_description: '密码',
password_placeholder: '输入密码',
password_placeholder2: '请重新输入密码以确认',
@ -212,14 +140,6 @@ I18n.translations = {
},
'zh-yue': {
phone_title: '發送電話號碼',
phone_description: '使用本電話號碼查找好友',
phone_placeholder: '電話號碼',
confirm_description: '驗證碼',
confirm_validation_title: '驗證碼',
confirm_validation_description: '格式錯誤',
password_description: '密碼',
password_placeholder: '輸入密碼',
password_placeholder2: '請重新輸入密碼確認',
@ -239,14 +159,6 @@ I18n.translations = {
},
'zh-wuu': {
phone_title: '发送电话号码',
phone_description: '用你的号码查找朋友',
phone_placeholder: '电话号码',
confirm_description: '确认码',
confirm_validation_title: '确认码',
confirm_validation_description: '错误格式',
password_description: '密码',
password_placeholder: '输入密码',
password_placeholder2: '请重新输入密码确认',
@ -266,14 +178,6 @@ I18n.translations = {
},
nl: {
phone_title: 'Stuur telefoonnummer',
phone_description: 'Zoek vrienden met behulp van je nummer',
phone_placeholder: 'Telefoonnummer',
confirm_description: 'Bevestigingscode',
confirm_validation_title: 'Bevestigingscode',
confirm_validation_description: 'Verkeerd format',
password_description: 'Wachtwoord',
password_placeholder: 'Typ je wachtwoord',
password_placeholder2: 'Voer je wachtwoord opnieuw in om te bevestigen',
@ -283,14 +187,6 @@ I18n.translations = {
},
fr: {
phone_title: 'Envoyer le numéro de téléphone',
phone_description: 'Trouver des amis en utilisant votre numéro',
phone_placeholder: 'Numéro de téléphone',
confirm_description: 'Code de confirmation',
confirm_validation_title: 'Code de confirmation',
confirm_validation_description: 'Format incorrect',
password_description: 'Mot de passe',
password_placeholder: 'Tapez votre mot de passe',
password_placeholder2: 'Veuillez retapez votre mot de passe pour le confirmer',
@ -300,14 +196,6 @@ I18n.translations = {
},
de: {
phone_title: 'Telefonnummer absenden',
phone_description: 'Freunde mit Ihrer Nummer finden',
phone_placeholder: 'Telefonnummer',
confirm_description: 'Bestätigungscode',
confirm_validation_title: 'Bestätigungscode',
confirm_validation_description: 'Falsches Format',
password_description: 'Passwort',
password_placeholder: 'Geben Sie Ihr Passwort ein',
password_placeholder2: 'Bitte geben Sie das Passwort zur Bestätigung erneut ein',
@ -317,14 +205,6 @@ I18n.translations = {
},
hi: {
phone_title: 'फ़ोन नंबर भेजें',
phone_description: 'अपने नंबर का उपयोग करके दोस्त ढूंढें',
phone_placeholder: 'फ़ोन नंबर',
confirm_description: 'पुष्टि कोड',
confirm_validation_title: 'पुष्टि कोड',
confirm_validation_description: 'गलत प्रारूप',
password_description: 'पासवर्ड',
password_placeholder: 'अपना पासवर्ड टाइप करें',
password_placeholder2: 'पुष्टि करने के लिए फिर से पासवर्ड दर्ज करें',
@ -334,14 +214,6 @@ I18n.translations = {
},
hu: {
phone_title: 'Telefonszám küldése',
phone_description: 'Ismerősök megkeresése telefonszám alapján',
phone_placeholder: 'Telefonszám',
confirm_description: 'Megerősítési kód',
confirm_validation_title: 'Megerősítési kód',
confirm_validation_description: 'Rossz formátum',
password_description: 'Jelszó',
password_placeholder: 'Add meg a jelszavad',
password_placeholder2: 'A megerősítéshez kérjük, add meg újra a jelszavad',
@ -351,14 +223,6 @@ I18n.translations = {
},
it: {
phone_title: 'Invia numero di telefono',
phone_description: 'Trova gli amici che usano il tuo numero',
phone_placeholder: 'Numero di telefono',
confirm_description: 'Codice di conferma',
confirm_validation_title: 'Codice di conferma',
confirm_validation_description: 'Formato errato',
password_description: 'Password',
password_placeholder: 'Digita la tua password',
password_placeholder2: 'Reinserisci la password per confermare',
@ -368,14 +232,6 @@ I18n.translations = {
},
ja: {
phone_title: '電話番号を送信',
phone_description: '電話番号から友人を検索',
phone_placeholder: '携帯電話番号',
confirm_description: '確認コード',
confirm_validation_title: '確認コード',
confirm_validation_description: '誤った形式です',
password_description: 'パスワード',
password_placeholder: 'パスワードを入力してください',
password_placeholder2: '確認のためにパスワードを再入力してください',
@ -394,14 +250,6 @@ I18n.translations = {
faucet_placeholder: 'フォーセットURL'
},
ko: {
phone_title: '전화번호 보내기',
phone_description: '내 번호를 사용하여 친구 찾기',
phone_placeholder: '전화번호',
confirm_description: '확인 코드',
confirm_validation_title: '확인 코드',
confirm_validation_description: '잘못된 형식',
password_description: '비밀번호',
password_placeholder: '비밀번호를 입력하세요',
password_placeholder2: '확인을 위해 비밀번호를 다시 입력해 주세요',
@ -411,14 +259,6 @@ I18n.translations = {
},
pl: {
phone_title: 'Wyślij numer telefonu',
phone_description: 'Znajdź znajomych, używając swojego numeru',
phone_placeholder: 'Numer telefonu',
confirm_description: 'Kod potwierdzający',
confirm_validation_title: 'Kod potwierdzający',
confirm_validation_description: 'Nieprawidłowy format',
password_description: 'Hasło',
password_placeholder: 'Wpisz swoje hasło',
password_placeholder2: 'Wprowadź ponownie hasło, aby potwierdzić',
@ -428,14 +268,6 @@ I18n.translations = {
},
'pt-br': {
phone_title: 'Enviar número de telefone',
phone_description: 'Encontrar amigos por meio do seu número',
phone_placeholder: 'Número de telefone',
confirm_description: 'Código de confirmação',
confirm_validation_title: 'Código de confirmação',
confirm_validation_description: 'Formato incorreto',
password_description: 'Senha',
password_placeholder: 'Digite sua senha',
password_placeholder2: 'Por favor, digite a senha novamente para confirmar',
@ -445,14 +277,6 @@ I18n.translations = {
},
'pt-pt': {
phone_title: 'Enviar o Número de Telefone',
phone_description: 'Encontrar amigos que utilizem o seu número',
phone_placeholder: 'Número de telefone',
confirm_description: 'Código de confirmação',
confirm_validation_title: 'Código de confirmação',
confirm_validation_description: 'Formato errado',
password_description: 'Palavra-passe',
password_placeholder: 'Digite a sua palavra-passe',
password_placeholder2: 'Por favor, volte a digitar a palavra-passe para confirmar',
@ -462,14 +286,6 @@ I18n.translations = {
},
ro: {
phone_title: 'Trimite numărul de telefon',
phone_description: 'Găsește prieteni folosindu-ți numărul de telefon',
phone_placeholder: 'Număr de telefon',
confirm_description: 'Cod de confirmare',
confirm_validation_title: 'Cod de confirmare',
confirm_validation_description: 'Format greșit',
password_description: 'Parolă',
password_placeholder: 'Tastează parola',
password_placeholder2: 'Te rugăm să re-introduci parola pentru a confirma',
@ -479,14 +295,6 @@ I18n.translations = {
},
sl: {
phone_title: 'Pošlji telefonsko številko',
phone_description: 'Iskanje prijateljev z uporabo tvoje telefonske številke',
phone_placeholder: 'Telefonska številka',
confirm_description: 'Potrditvena koda',
confirm_validation_title: 'Potrditvena koda',
confirm_validation_description: 'Neveljaven format',
password_description: 'Geslo',
password_placeholder: 'Vnesi svoje geslo',
password_placeholder2: 'Prosimo, ponovno vnesi geslo za potrditev',
@ -496,14 +304,6 @@ I18n.translations = {
},
es: {
phone_title: 'Enviar número de teléfono',
phone_description: 'Encontrar amigos que estén utilizando tu número',
phone_placeholder: 'Número de teléfono',
confirm_description: 'Código de confirmación',
confirm_validation_title: 'Código de confirmación',
confirm_validation_description: 'Formato erróneo',
password_description: 'Contraseña',
password_placeholder: 'Escribe tu contraseña',
password_placeholder2: 'Por favor, vuelve a escribir la contraseña para confirmar',
@ -513,14 +313,6 @@ I18n.translations = {
},
'es-ar': {
phone_title: 'Envia un número telefónico',
phone_description: 'Encuentra amigos utilizando tu número',
phone_placeholder: 'Número telefónico',
confirm_description: 'Código de confirmación',
confirm_validation_title: 'Código de confirmación',
confirm_validation_description: 'Formato incorrecto',
password_description: 'Contraseña',
password_placeholder: 'Ingresa tu contraseña',
password_placeholder2: 'Ingresa tu contraseña para confirmar',
@ -530,14 +322,6 @@ I18n.translations = {
},
sw: {
phone_title: 'Tuma Namba ya Simu',
phone_description: 'Pata marafiki kwa kutumia namba yako',
phone_placeholder: 'Namba ya simu',
confirm_description: 'Kificho cha uthibitisho',
confirm_validation_title: 'Kificho cha uthibitisho',
confirm_validation_description: 'Muundo hafifu',
password_description: 'Nenosiri',
password_placeholder: 'Andika nenosiri lako',
password_placeholder2: 'Tafadhali ingiza tena nenosiri kuthibitisha',
@ -547,14 +331,6 @@ I18n.translations = {
},
sv: {
phone_title: 'Skicka telefonnummer',
phone_description: 'Hitta vänner som använder ditt nummer',
phone_placeholder: 'Telefonnummer',
confirm_description: 'Bekräftelsekod',
confirm_validation_title: 'Bekräftelsekod',
confirm_validation_description: 'Fel format',
password_description: 'Lösenord',
password_placeholder: 'Skriv ditt lösenord',
password_placeholder2: 'Var god ange ditt lösenord igen för att bekräfta',
@ -564,14 +340,6 @@ I18n.translations = {
},
'fr-ch': {
phone_title: 'Envoyer numéro de téléphone',
phone_description: 'Trouvez des amis en utilisant votre numéro',
phone_placeholder: 'Numéro de téléphone',
confirm_description: 'Code de confirmation',
confirm_validation_title: 'Code de confirmation',
confirm_validation_description: 'Mauvais format',
password_description: 'Mot de passe',
password_placeholder: 'Tapez votre mot de passe',
password_placeholder2: 'Veuillez saisir à nouveau le mot de passe pour confirmer',
@ -581,14 +349,6 @@ I18n.translations = {
},
'de-ch': {
phone_title: 'Sende Telefonnummer',
phone_description: 'Finde Freunde mittels deiner Telefonnummer',
phone_placeholder: 'Telefonnummer',
confirm_description: 'Konfirmationscode',
confirm_validation_title: 'Konfirmationscode',
confirm_validation_description: 'Falsches Format',
password_description: 'Passwort',
password_placeholder: 'Gib dein Passwort ein',
password_placeholder2: 'Bitte gib das Passwort zur Bestätigung erneut ein',
@ -598,14 +358,6 @@ I18n.translations = {
},
'it-ch': {
phone_title: 'Invia numero di telefono',
phone_description: 'Trova amici che utilizzano il tuo numero',
phone_placeholder: 'Numero di telefono',
confirm_description: 'Codice di conferma',
confirm_validation_title: 'Codice di conferma',
confirm_validation_description: 'Formato errato',
password_description: 'Password',
password_placeholder: 'Digita la tua password',
password_placeholder2: 'Inserisci nuovamente la password per confermare',
@ -615,14 +367,6 @@ I18n.translations = {
},
th: {
phone_title: 'ส่งหมายเลขโทรศัพท์',
phone_description: 'ค้นหาเพื่อนโดยใช้หมายเลขของคุณ ',
phone_placeholder: 'หมายเลขโทรศัพท์',
confirm_description: 'รหัสยืนยัน',
confirm_validation_title: 'รหัสยืนยัน',
confirm_validation_description: 'รูปแบบผิด',
password_description: 'รหัสผ่าน',
password_placeholder: 'พิมพ์รหัสผ่านของคุณ',
password_placeholder2: 'โปรดกรอกรหัสผ่านอีกครั้งเพื่อยืนยัน',
@ -632,14 +376,6 @@ I18n.translations = {
},
tr: {
phone_title: 'Telefon Numarasını Gönder',
phone_description: 'Telefon numaranı kullanarak arkadaşlarınızı bulun',
phone_placeholder: 'Telefon numarası',
confirm_description: 'Onay kodu',
confirm_validation_title: 'Onay kodu',
confirm_validation_description: 'Hatalı format',
password_description: 'Şifre',
password_placeholder: 'Şifrenizi girin',
password_placeholder2: 'Onaylamak için lütfen parolanızı yeniden girin',
@ -649,14 +385,6 @@ I18n.translations = {
},
uk: {
phone_title: 'Надіслати номер телефону',
phone_description: 'Знайдіть друзів, використовуючи свій номер',
phone_placeholder: 'Номер телефону',
confirm_description: 'Код підтвердження',
confirm_validation_title: 'Код підтвердження',
confirm_validation_description: 'Неправильний формат',
password_description: 'Пароль',
password_placeholder: 'Введіть свій пароль',
password_placeholder2: 'Будь ласка, введіть пароль ще раз для підтвердження',
@ -666,14 +394,6 @@ I18n.translations = {
},
ur: {
phone_title: 'فون نمبر بھیجیں',
phone_description: 'فون نمبر استعمال کرتے ہوئے دوستوں کو تلاش کریں',
phone_placeholder: 'فون نمبر',
confirm_description: 'تصدیقی کوڈ',
confirm_validation_title: 'تصدیقی کوڈ',
confirm_validation_description: 'غلط فارمیٹ',
password_description: 'پاسورڈ',
password_placeholder: 'اپنا پاسورڈ لکھیں',
password_placeholder2: 'برائے مہربانی تصدیق کے لیے اپنا پاسورڈ دوبارہ لکھیں',
@ -683,14 +403,6 @@ I18n.translations = {
},
vi: {
phone_title: 'Gửi số điện thoại',
phone_description: 'Tìm bạn bè bằng các sử dụng số điện thoại của bạn',
phone_placeholder: 'Số điện thoại',
confirm_description: 'Mã xác nhận',
confirm_validation_title: 'Mã xác nhận',
confirm_validation_description: 'Sai định dạng',
password_description: 'Mật khẩu',
password_placeholder: 'Gõ mật khẩu của bạn',
password_placeholder2: 'Vui lòng nhập lại mật khẩu để xác nhận',

View File

@ -244,7 +244,6 @@ var status = {
types: {
TEXT: 'text',
NUMBER: 'number',
PHONE: 'phone',
PASSWORD: 'password'
},
events: {

View File

@ -16,26 +16,6 @@
:content content
:content-type content-type})
(def enter-confirmation-code-message
(console-message {:content {:command "confirmation-code"
:content (i18n/label :t/confirmation-code)}
:content-type const/content-type-command-request}))
(def incorrect-confirmation-code-message
(console-message {:content {:command "confirmation-code"
:content (i18n/label :t/incorrect-code)}
:content-type const/content-type-command-request}))
(def contacts-synchronised-message
(console-message {:content (i18n/label :t/contacts-syncronized)
:content-type const/text-content-type}))
(def phone-number-request-message
(console-message {:content {:command "phone"
:content (i18n/label :t/phone-number-required)}
:content-type const/content-type-command-request}))
(def shake-your-phone-message
(console-message {:content (i18n/label :t/shake-your-phone)
:content-type const/text-content-type}))

View File

@ -27,7 +27,6 @@
status-im.chat.events.send-message
status-im.chat.events.queue-message
status-im.chat.events.receive-message
status-im.chat.events.sign-up
status-im.chat.events.console
status-im.chat.events.webview-bridge))

View File

@ -4,7 +4,6 @@
[status-im.constants :as const]
[status-im.i18n :as i18n]
[status-im.chat.console :as console-chat]
[status-im.chat.events.sign-up :as sign-up-events]
[status-im.ui.screens.accounts.events :as accounts-events]
[taoensso.timbre :as log]
[status-im.i18n :as i18n]
@ -48,14 +47,6 @@
(fn [{:keys [db]} {:keys [params]}]
(accounts-events/create-account db (:password params)))
"phone"
(fn [{:keys [db]} {:keys [params id]}]
(sign-up-events/sign-up db (:phone params) id))
"confirmation-code"
(fn [{:keys [db]} {:keys [params id]}]
(sign-up-events/sign-up-confirm db (:code params) id))
"faucet"
(fn [{:keys [db random-id]} {:keys [params id]}]
(let [{:accounts/keys [accounts current-account-id]} db
@ -64,13 +55,13 @@
{:http-get {:url (gstring/format faucet-url current-address)
:success-event-creator (fn [_]
(faucet-response-event
random-id
(i18n/label :t/faucet-success)))
random-id
(i18n/label :t/faucet-success)))
:failure-event-creator (fn [event]
(log/error "Faucet error" event)
(faucet-response-event
random-id
(i18n/label :t/faucet-error)))}}))
random-id
(i18n/label :t/faucet-error)))}}))
"debug"
(fn [{:keys [db random-id now] :as cofx} {:keys [params id]}]
@ -82,9 +73,9 @@
[[:initialize-debugging {:force-start? true}]
[:chat-received-message/add
(console-chat/console-message
{:message-id random-id
:content (i18n/label :t/debug-enabled)
:content-type const/text-content-type})]]
{:message-id random-id
:content (i18n/label :t/debug-enabled)
:content-type const/text-content-type})]]
[[:stop-debugging]])))))})
(def commands-names (set (keys console-commands->fx)))

View File

@ -141,10 +141,9 @@
params {:parameters {:args args
:bot-db bot-db
:seq-arg seq-arg}
:context (merge {:data data
:from current-account-id
:to to}
(input-model/command-dependent-context-params current-chat-id command))}]
:context {:data data
:from current-account-id
:to to}}]
{:call-jail {:jail-id owner-id
:path path
:params params

View File

@ -1,156 +0,0 @@
(ns status-im.chat.events.sign-up
(:require [re-frame.core :as re-frame]
[status-im.constants :as const]
[status-im.chat.console :as console-chat]
[status-im.utils.handlers :as handlers]
[status-im.utils.phone-number :as phone-number-util]
[status-im.utils.sms-listener :as sms-listener]
[status-im.ui.screens.accounts.events :as accounts-events]
[taoensso.timbre :as log]))
;;;; Helpers fns
(defn sign-up
"Creates effects for signing up"
[db phone-number message-id]
(let [current-account-id (:accounts/current-account-id db)
{:keys [public-key address]} (get-in db [:accounts/accounts current-account-id])]
{:http-post {:action "sign-up"
:data {:phone-number (phone-number-util/format-phone-number phone-number)
:whisper-identity public-key
:address address}
:success-event-creator (fn [_]
[::sign-up-success message-id])
:failure-event-creator (fn [_]
[::http-request-failure [::sign-up phone-number message-id]])}}))
(defn sign-up-confirm
"Creates effects for sign-up confirmation"
[db confirmation-code message-id]
{:http-post {:action "sign-up-confirm"
:data {:code confirmation-code}
:success-event-creator (fn [body]
[::sign-up-confirm-response body message-id])
:failure-event-creator (fn [_]
[::http-request-failure [::sign-up-confirm confirmation-code message-id]])}})
;;;; Handlers
(handlers/register-handler-fx
::sign-up
[re-frame/trim-v]
(fn [{:keys [db]} [phone-number message-id]]
(sign-up db phone-number message-id)))
(defn- message-seen [{:keys [db] :as fx} message-id]
(let [statuses-path [:chats const/console-chat-id :messages message-id :user-statuses]
statuses (-> (get-in db statuses-path)
(assoc const/console-chat-id :seen))]
(-> fx
(assoc-in (into [:db] statuses-path) statuses)
(assoc :update-message {:message-id message-id
:user-statuses statuses}))))
(handlers/register-handler-fx
:start-listening-confirmation-code-sms
[re-frame/trim-v]
(fn [{:keys [db]} [sms-listener]]
{:db (if-not (:confirmation-code-sms-listener db)
(assoc db :confirmation-code-sms-listener sms-listener)
db)}))
(defn stop-listening-confirmation-code-sms [{:keys [db] :as fx}]
(-> fx
(update :db dissoc :confirmation-code-sms-listener)
(assoc ::remove-sms-listener (:confirmation-code-sms-listener db))))
(re-frame/reg-fx
::remove-sms-listener
(fn [subscription]
(sms-listener/remove-sms-listener subscription)))
(defn- sms-receive-handler [{confirmation-code :body}]
(when-let [matches (re-matches #"(\d{4})" confirmation-code)]
(re-frame/dispatch [::sign-up-confirm (second matches)])))
(def start-listening-confirmation-code-sms-event
[:request-permissions
[:receive-sms]
(fn []
(let [listener (sms-listener/add-sms-listener sms-receive-handler)]
(re-frame/dispatch [:start-listening-confirmation-code-sms listener])))])
(handlers/register-handler-fx
::sign-up-success
[re-frame/trim-v (re-frame/inject-cofx :random-id)]
(fn [{:keys [db random-id]} [message-id]]
(-> {:db db
:dispatch-n [;; create manual way for entering confirmation code
[:chat-received-message/add console-chat/enter-confirmation-code-message]
;; create automatic way for receiving confirmation code
start-listening-confirmation-code-sms-event]}
(message-seen message-id))))
(defn- extract-last-phone-number [chats]
(let [phone-message (->> (get-in chats [const/console-chat-id :messages])
(map second)
(some (fn [{:keys [type content] :as message}]
(when (and (= type :response)
(= (:command content) "phone"))
message))))]
(get-in phone-message [:content :params :phone])))
(handlers/register-handler-fx
::sign-up-confirm
(fn [{:keys [db]} [confirmation-code message-id]]
(sign-up-confirm db confirmation-code message-id)))
(defn- sign-up-confirmed [{:keys [db] :as fx} now]
(let [last-phone-number (extract-last-phone-number (:chats db))
fx (-> (stop-listening-confirmation-code-sms fx)
(update :dispatch-n conj
[:request-permissions [:read-contacts]
#(re-frame/dispatch [:sync-contacts (fn [contacts]
[::contacts-synced contacts])])]))]
(cond-> fx
last-phone-number (accounts-events/account-update {:phone last-phone-number
:last-updated now}))))
(handlers/register-handler-fx
::sign-up-confirm-response
[re-frame/trim-v (re-frame/inject-cofx :random-id)]
(fn [{:keys [db random-id now]} [{:keys [message status]} message-id]]
(let [messages (cond-> []
true
(conj (console-chat/console-message {:content message
:content-type const/text-content-type}))
(= "failed" status)
(conj console-chat/incorrect-confirmation-code-message))]
(cond-> {:db db
:dispatch-n (mapv #(vector :chat-received-message/add %) messages)}
message-id
(message-seen message-id)
(= "confirmed" status)
(sign-up-confirmed now)))))
(handlers/register-handler-fx
::contacts-synced
[re-frame/trim-v (re-frame/inject-cofx :random-id)]
(fn [{:keys [db random-id now] :as cofx} [contacts]]
(-> {:db db}
(accounts-events/account-update {:signed-up? true
:last-updated now})
(assoc :dispatch [:chat-received-message/add console-chat/contacts-synchronised-message]))))
(handlers/register-handler-fx
::http-request-failure
[re-frame/trim-v]
(fn [_ [original-event-vector]]
;; TODO(janherich): in case of http request failure, we will try to hit http endpoint in loop forever,
;; maybe it's better to cut it after N tries and display error message with explanation to user
{:dispatch-later [{:ms 1000 :dispatch original-event-vector}]}))

View File

@ -7,7 +7,6 @@
[status-im.chat.models.commands :as commands-model]
[status-im.chat.views.input.validation-messages :refer [validation-message]]
[status-im.i18n :as i18n]
[status-im.utils.phone-number :as phone-number]
[status-im.js-dependencies :as dependencies]
[taoensso.timbre :as log]))
@ -205,16 +204,6 @@
(remove #(nil? (first %)))
(into {}))))
(defn command-dependent-context-params
"Returns additional `:context` data that will be added to specific commands.
The following data shouldn't be hardcoded here."
[chat-id {:keys [name] :as command}]
(case chat-id
"console" (case name
"phone" {:suggestions (phone-number/get-examples)}
{})
{}))
(defn modified-db-after-change
"Returns the new db object that should be used after any input change."
[{:keys [current-chat-id] :as db}]
@ -239,11 +228,3 @@
:prev-command (-> command :command :name)})))))
(defmulti validation-handler (fn [name] (keyword name)))
(defmethod validation-handler :phone
[_]
(fn [[number] error-events-creator]
(when-not (phone-number/valid-mobile-number? number)
(error-events-creator [validation-message
{:title (i18n/label :t/phone-number)
:description (i18n/label :t/invalid-phone)}]))))

View File

@ -10,11 +10,10 @@
(s/def :chat/chat-ui-props (s/nilable map?)) ; {id (string) props (map)}
(s/def :chat/chat-list-ui-props (s/nilable map?))
(s/def :chat/layout-height (s/nilable number?)) ; height of chat's view layout
(s/def :chat/expandable-view-height-to-value (s/nilable number?))
(s/def :chat/expandable-view-height-to-value (s/nilable number?))
(s/def :chat/selected-participants (s/nilable set?))
(s/def :chat/chat-loaded-callbacks (s/nilable map?))
(s/def :chat/chat-loaded-callbacks (s/nilable map?))
(s/def :chat/public-group-topic (s/nilable string?))
(s/def :chat/confirmation-code-sms-listener (s/nilable any?)) ; .addListener result object
(s/def :chat/messages (s/nilable map?)) ; messages indexed by message-id
(s/def :chat/not-loaded-message-ids (s/nilable set?)) ; set of message-ids not yet fully loaded from persisted state
(s/def :chat/last-clock-value (s/nilable number?)) ; last logical clock value of messages in chat

View File

@ -48,7 +48,18 @@
(> (str/index-of content "command=location") -1))
(aset message "show?" false))))))
(defn remove-phone-messages! [old-realm new-realm]
(let [messages (.objects new-realm "message")]
(dotimes [i (.-length messages)]
(let [message (aget messages i)
content (aget message "content")
type (aget message "content-type")]
(when (and (= type "command")
(> (str/index-of content "command=phone") -1))
(aset message "show?" false))))))
(defn migration [old-realm new-realm]
(log/debug "migrating v21 account database: " old-realm new-realm)
(remove-contact! new-realm "browse")
(remove-location-messages! old-realm new-realm))
(remove-location-messages! old-realm new-realm)
(remove-phone-messages! old-realm new-realm))

View File

@ -6,7 +6,7 @@
[status-im.data-store.realm.schemas.base.v5.core :as v5]
[status-im.data-store.realm.schemas.base.v6.core :as v6]))
; put schemas ordered by version
;; put schemas ordered by version
(def schemas [{:schema v1/schema
:schemaVersion 1
:migration v1/migration}

View File

@ -11,7 +11,6 @@
:updates-private-key {:type :string
:optional true}
:name {:type :string :optional true}
:phone {:type :string :optional true}
:email {:type :string :optional true}
:status {:type :string :optional true}
:debug? {:type :bool :default false}

View File

@ -171,7 +171,7 @@
:transactions-delete-content :transactions-unsigned-empty
:transaction-moved-text :add-members :sign-later-title :sharing-cancel
:yes :dapps :popular-tags :network-settings :twelve-words-in-correct-order
:transaction-moved-title :phone-number :photos-access-error :hash
:transaction-moved-title :photos-access-error :hash
:removed-from-chat :done :remove-from-contacts :delete-chat :new-group-chat
:edit-chats :wallet :wallet-exchange :wallet-request :sign-in
:datetime-yesterday :create-new-account :sign-in-to-status :dapp-profile
@ -182,28 +182,28 @@
:delete-group :send-request :paste-json :browsing-title
:wallet-add-asset :reorder-groups :transactions-history-empty :discover
:browsing-cancel :faucet-success :intro-status :name :gas-price
:phone-number-required :view-transaction-details :wallet-error
:view-transaction-details :wallet-error
:validation-amount-is-too-precise :copy-transaction-hash :unknown-address
:received-invitation :show-qr :edit-network-config :connect
:choose-from-contacts :edit :wallet-address-from-clipboard
:account-generation-message :remove-network :no-messages :passphrase
:recipient :members-title :new-group :phone-e164 :suggestions-requests
:recipient :members-title :new-group :suggestions-requests
:connected :rpc-url :settings :remove-from-group :specify-rpc-url
:contacts-syncronized :transactions-sign-all :gas-limit :wallet-browse-photos
:transactions-sign-all :gas-limit :wallet-browse-photos
:add-new-contact :no-statuses-discovered-body :add-json-file :delete
:search-contacts :chats :transaction-sent :transaction :public-group-status
:leave-chat :transactions-delete :mainnet-text :image-source-make-photo
:chat :start-conversation :topic-format :add-new-network :save
:enter-valid-public-key :faucet-error :phone-significant :all
:enter-valid-public-key :faucet-error :all
:confirmations-helper-text :search-for :sharing-copy-to-clipboard
:your-wallets :phone-international :sync-in-progress :enter-password
:your-wallets :sync-in-progress :enter-password
:enter-address :switch-users :send-transaction :confirmations
:recover-access :incorrect-code :image-source-gallery :sync-synced
:recover-access :image-source-gallery :sync-synced
:currency :status-pending :delete-contact :connecting-requires-login
:no-hashtags-discovered-title :datetime-day :request-transaction
:wallet-send :mute-notifications :invalid-phone :scan-qr :contact-s
:wallet-send :mute-notifications :scan-qr :contact-s
:unsigned-transaction-expired :status-sending :gas-used
:transactions-filter-type :next :recent :confirmation-code
:transactions-filter-type :next :recent
:open-on-etherscan :share :status :from
:wrong-password :search-chats :transactions-sign-later :in-contacts
:transactions-sign :sharing-share :type-a-message :type-a-command

View File

@ -1,6 +1,5 @@
(ns status-im.js-dependencies)
(def awesome-phonenumber (js/require "awesome-phonenumber"))
(def Chance (js/require "chance"))
(def eccjs (js/require "eccjs"))
(def emojis (js/require "emojilib"))

View File

@ -9,9 +9,7 @@
(def permissions-map
{:read-external-storage "android.permission.READ_EXTERNAL_STORAGE"
:write-external-storage "android.permission.WRITE_EXTERNAL_STORAGE"
:read-contacts "android.permission.READ_CONTACTS"
:camera "android.permission.CAMERA"
:receive-sms "android.permission.RECEIVE_SMS"})
:camera "android.permission.CAMERA"})
(defn all-granted? [permissions]
(let [permission-vals (distinct (vals permissions))]

View File

@ -20,7 +20,6 @@
(spec/def :account/networks (spec/nilable :networks/networks))
(spec/def :account/wnode (spec/nilable string?))
(spec/def :account/settings (spec/nilable (spec/map-of keyword? any?)))
(spec/def :account/phone (spec/nilable string?))
(spec/def :account/signing-phrase :global/not-empty-string)
(spec/def :accounts/account (allowed-keys
@ -29,8 +28,7 @@
:opt-un [:account/debug? :account/status :account/last-updated
:account/updates-private-key :account/updates-public-key
:account/email :account/signed-up? :account/network
:account/phone :account/networks :account/settings
:account/wnode]))
:account/networks :account/settings :account/wnode]))
(spec/def :accounts/accounts (spec/nilable (spec/map-of :account/address :accounts/account)))

View File

@ -136,8 +136,7 @@
[:initialize-account
address
(when (or new-account? recover-in-progress?)
[[:chat-received-message/add console-chat/phone-number-request-message]
[:chat-received-message/add console-chat/shake-your-phone-message]])]
[[:chat-received-message/add console-chat/shake-your-phone-message]])]
[:navigate-to-clean :home]
(if new-account?
[:navigate-to-chat console-chat-id]

View File

@ -2,11 +2,9 @@
(:require [re-frame.core :refer [dispatch trim-v reg-fx reg-cofx inject-cofx]]
[status-im.utils.handlers :refer [register-handler-db register-handler-fx]]
[status-im.data-store.contacts :as contacts]
[status-im.utils.crypt :refer [encrypt]]
[clojure.string :as s]
[status-im.protocol.core :as protocol]
[status-im.utils.utils :refer [http-post]]
[status-im.utils.phone-number :refer [format-phone-number]]
[status-im.utils.random :as random]
[taoensso.timbre :as log]
[cljs.reader :refer [read-string]]
@ -33,11 +31,11 @@
(assoc coeffects :all-contacts (contacts/get-all))))
(reg-cofx
::get-default-contacts-and-groups
(fn [coeffects _]
(assoc coeffects
:default-contacts js-res/default-contacts
:default-groups js-res/default-contact-groups)))
::get-default-contacts-and-groups
(fn [coeffects _]
(assoc coeffects
:default-contacts js-res/default-contacts
:default-groups js-res/default-contact-groups)))
;;;; FX
@ -62,18 +60,18 @@
photo-path current-account-id status fcm-token
updates-public-key updates-private-key] :as params}]
(protocol/contact-request!
{:web3 web3
:message {:from current-public-key
:to whisper-identity
:message-id (random/id)
:payload {:contact {:name name
:profile-image photo-path
:address current-account-id
:status status
:fcm-token fcm-token}
:keypair {:public updates-public-key
:private updates-private-key}
:timestamp (web3.utils/timestamp)}}})))
{:web3 web3
:message {:from current-public-key
:to whisper-identity
:message-id (random/id)
:payload {:contact {:name name
:profile-image photo-path
:address current-account-id
:status status
:fcm-token fcm-token}
:keypair {:public updates-public-key
:private updates-private-key}
:timestamp (web3.utils/timestamp)}}})))
(reg-fx
::reset-pending-messages
@ -101,75 +99,16 @@
(remove s/blank?)
(s/join " ")))
(defn- normalize-phone-contacts [contacts]
(let [contacts' (js->clj contacts :keywordize-keys true)]
(map (fn [{:keys [thumbnailPath phoneNumbers] :as contact}]
{:name (contact-name contact)
:photo-path thumbnailPath
:phone-numbers phoneNumbers}) contacts')))
(reg-fx
::fetch-contacts-from-phone!
(fn [on-contacts-event-creator]
(.getAll rn-dependencies/contacts
(fn [error contacts]
(if error
(log/debug :error-on-fetching-loading error)
(let [contacts' (normalize-phone-contacts contacts)]
(dispatch [::get-contacts-identities contacts' on-contacts-event-creator])))))))
(defn- get-contacts-by-hash [contacts]
(->> contacts
(mapcat (fn [{:keys [phone-numbers] :as contact}]
(map (fn [{:keys [number]}]
(let [number' (format-phone-number number)]
[(encrypt number')
(-> contact
(assoc :phone-number number')
(dissoc :phone-numbers))]))
phone-numbers)))
(into {})))
(defn- add-identity [contacts-by-hash contacts]
(map (fn [{:keys [phone-number-hash whisper-identity address]}]
(let [contact (contacts-by-hash phone-number-hash)]
(assoc contact
:whisper-identity whisper-identity
:address address)))
(js->clj contacts)))
(reg-fx
::request-stored-contacts
(fn [{:keys [contacts on-contacts-event-creator]}]
(let [contacts-by-hash (get-contacts-by-hash contacts)
data (or (keys contacts-by-hash) '())]
(http-post "get-contacts" {:phone-number-hashes data}
(fn [{:keys [contacts]}]
(dispatch (on-contacts-event-creator (add-identity contacts-by-hash contacts))))))))
;;;; Handlers
(register-handler-fx
::get-contacts-identities
[trim-v]
(fn [_ [contacts on-contacts-event-creator]]
{::request-stored-contacts {:contacts contacts
:on-contacts-event-creator on-contacts-event-creator}}))
(register-handler-fx
:sync-contacts
[trim-v]
(fn [_ [on-contacts-event-creator]]
{::fetch-contacts-from-phone! on-contacts-event-creator}))
(defn watch-contact
"Takes effects map, adds effects necessary to start watching contact"
[{:keys [db] :as fx} {:keys [public-key private-key] :as contact}]
(cond-> fx
(and public-key private-key)
(assoc ::watch-contact (merge
(select-keys db [:web3])
(select-keys contact [:whisper-identity :public-key :private-key])))))
(select-keys db [:web3])
(select-keys contact [:whisper-identity :public-key :private-key])))))
(register-handler-fx
:watch-contact
@ -450,4 +389,4 @@
[:add-pending-contact-and-open-chat new-identity]
[:add-new-contact-and-open-chat {:name (generate-gfy new-identity)
:photo-path (identicon new-identity)
:whisper-identity new-identity}])}))))
:whisper-identity new-identity}])}))))

View File

@ -180,7 +180,6 @@
:chat/selected-participants
:chat/chat-loaded-callbacks
:chat/public-group-topic
:chat/confirmation-code-sms-listener
:chat/messages
:chat/not-loaded-message-ids
:chat/last-clock-value

View File

@ -68,21 +68,21 @@
;;;; COFX
(re-frame/reg-cofx
:now
(fn [coeffects _]
(assoc coeffects :now (time/now-ms))))
:now
(fn [coeffects _]
(assoc coeffects :now (time/now-ms))))
(re-frame/reg-cofx
:random-id
(fn [coeffects _]
(assoc coeffects :random-id (random/id))))
:random-id
(fn [coeffects _]
(assoc coeffects :random-id (random/id))))
(re-frame/reg-cofx
:random-id-seq
(fn [coeffects _]
(assoc coeffects :random-id-seq
((fn rand-id-seq []
(cons (random/id) (lazy-seq (rand-id-seq))))))))
:random-id-seq
(fn [coeffects _]
(assoc coeffects :random-id-seq
((fn rand-id-seq []
(cons (random/id) (lazy-seq (rand-id-seq))))))))
;;;; FX

View File

@ -45,16 +45,6 @@
(when identity
{:dispatch [:navigation-replace :chat identity]})))
(handlers/register-handler-fx
:my-profile/update-phone-number
;; Switch user to the console issuing the !phone command automatically to let him change his phone number.
;; We allow to change phone number only from console because this requires entering SMS verification code.
(fn [{{:contacts/keys [contacts] :as db} :db :as cofx} _]
(let [phone-command (get-in contacts chat-const/phone-command-ref)]
(-> (chat-events/navigate-to-chat cofx const/console-chat-id)
(as-> fx
(merge fx (input-events/select-chat-input-command (:db fx) phone-command nil true)))))))
(defn get-current-account [{:keys [:accounts/current-account-id] :as db}]
(get-in db [:accounts/accounts current-account-id]))

View File

@ -198,17 +198,6 @@
^{:key (str "item-" i)}
(str status " "))))
(defn profile-info-phone-item [phone & [options]]
(let [phone-empty? (or (nil? phone) (string/blank? phone))
phone-text (if phone-empty?
(i18n/label :t/not-specified)
phone)]
[profile-info-item {:label (i18n/label :t/phone-number)
:action phone-text
:options options
:empty-value? phone-empty?
:accessibility-label :profile-phone-number}]))
(defn settings-title [title]
[react/text {:style styles/profile-settings-title}
title])
@ -225,13 +214,11 @@
(when active?
[vector-icons/icon :icons/forward {:color colors/gray}])]])
(defn profile-info [{:keys [whisper-identity phone] :as contact}]
(defn profile-info [{:keys [whisper-identity] :as contact}]
[react/view
[profile-info-address-item contact]
[settings-item-separator]
[profile-info-public-key-item whisper-identity contact]
[settings-item-separator]
[profile-info-phone-item phone]])
[profile-info-public-key-item whisper-identity contact]])
(defn navigate-to-accounts []
;; TODO(rasom): probably not the best place for this call

View File

@ -1,30 +0,0 @@
(ns status-im.utils.phone-number
(:require [status-im.i18n :refer [label]]
[status-im.react-native.js-dependencies :as rn-dependencies]
[status-im.js-dependencies :as dependencies]))
(def locale (or (.-locale rn-dependencies/i18n) "___en"))
(def country-code (subs locale 3 5))
;; todo check wrong numbers, .getNumber returns empty string
(defn format-phone-number [number]
(str (.getNumber (dependencies/awesome-phonenumber number country-code) "international")))
(defn get-examples []
(when-let [example (.getExample dependencies/awesome-phonenumber country-code "mobile")]
[{:number (.getNumber example)
:description (label :t/phone-e164)}
{:number (.getNumber example "international")
:description (label :t/phone-international)}
{:number (.getNumber example "national")
:description (label :t/phone-national)}
{:number (.getNumber example "significant")
:description (label :t/phone-significant)}]))
(defn valid-mobile-number? [number]
(when (string? number)
(let [{:keys [valid type]} (-> (dependencies/awesome-phonenumber. number country-code)
(.toJSON)
(js->clj :keywordize-keys true))]
(and valid
(some #{(keyword type)} '(:mobile :fixed-line-or-mobile :pager))))))

View File

@ -1,19 +0,0 @@
(ns status-im.utils.sms-listener
(:require [re-frame.core :as re-frame]
[status-im.utils.platform :refer [android?]]
[status-im.react-native.js-dependencies :as rn-dependencies]))
;; Only android is supported!
(defn add-sms-listener
"Message format: {:originatingAddress string, :body string}. Returns
cancelable subscription."
[listen-event-creator]
(when android?
(.addListener rn-dependencies/android-sms-listener
(fn [message]
(re-frame/dispatch (listen-event-creator (js->clj message :keywordize-keys true)))))))
(defn remove-sms-listener [subscription]
(when android?
(.remove subscription)))

View File

@ -1,11 +1,9 @@
(ns status-im.react-native.js-dependencies)
(def action-button #js {:default #js {:Item #js {}}})
(def android-sms-listener #js {})
(def autolink #js {:default #js {}})
(def config #js {:default #js {}})
(def camera #js {:constants #js {}})
(def contacts #js {})
(def dialogs #js {})
(def dismiss-keyboard #js {})
(def emoji-picker #js {:default #js {}})

View File

@ -16,7 +16,6 @@
:address "c348abf29215d3817bec65007be83a0f11d13ad6"
:email nil
:signed-up? true
:phone nil
:name "Sleepy Serene Leopardseal"
:updates-private-key "3849320857de8efe1e1ec57e08e92ed2bce196cb8763756ae4e6e7e011c1d857de0a115b3dc7eff066afe75a8794ea9905b"
:updates-public-key "384975d68aec6426faacf8b4ba2c55d5a84b70a8a26eb616e06e9c9e63f95dfdf1c1c165773e1cdca2d198a0bc5386d8a6f2079414e073b4730c8f4745292a6cdfb3fa28143ad5937128643c6addf356b66962376dc8b12274d9abfb2e1c6447ac3"

View File

@ -5,7 +5,7 @@
(def fake-db
{:access-scope->commands-responses {#{:global :personal-chats :anonymous :dapps} {:command {"global-command1" ["0x1" :command 0 "global-command1"]}}
#{"0x1" :personal-chats :anonymous :dapps} {:command {"command2" ["0x1" :command 2 "command2"]}}
#{"0x1" :group-chats :anonymous :dapps} {:command {"command2" ["0x1" :command 4 "command2"]}}
#{"0x1" :group-chats :anonymous :dapps} {:command {"command2" ["0x1" :command 4 "command2"]}}
#{"0x2" :personal-chats :anonymous :dapps} {:command {"command3" ["0x2" :command 2 "command3"]}}
#{"0x2" :group-chats :anonymous :dapps} {:response {"response1" ["0x2" :response 4 "response1"]}}}
:chats {"test1" {:contacts [{:identity "0x1"}]
@ -166,9 +166,5 @@
(input/args->params {:command {:params [{:name "amount"} {:name "recipient"}]}
:args ["1.0" "John Doe"]}))))
(deftest command-dependent-context-params
(is (= {} (input/command-dependent-context-params "any" {:name "any"})))
(is (= {} (input/command-dependent-context-params "console" {:name "any"}))))
(deftest modified-db-after-change
"Just a combination of db modifications. Can be skipped now")