mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-06 13:54:01 +00:00
Setup sms-listener
This commit is contained in:
parent
9274ba0ebb
commit
1f5dad71e8
@ -14,7 +14,8 @@
|
|||||||
"react-native-vector-icons/Ionicons",
|
"react-native-vector-icons/Ionicons",
|
||||||
"react-native-circle-checkbox",
|
"react-native-circle-checkbox",
|
||||||
"react-native-randombytes",
|
"react-native-randombytes",
|
||||||
"dismissKeyboard"
|
"dismissKeyboard",
|
||||||
|
"react-native-android-sms-listener"
|
||||||
],
|
],
|
||||||
"imageDirs": [
|
"imageDirs": [
|
||||||
"images"
|
"images"
|
||||||
|
@ -128,6 +128,7 @@ dependencies {
|
|||||||
compile "com.facebook.react:react-native:+" // From node_modules
|
compile "com.facebook.react:react-native:+" // From node_modules
|
||||||
compile project(':react-native-contacts')
|
compile project(':react-native-contacts')
|
||||||
compile project(':react-native-i18n')
|
compile project(':react-native-i18n')
|
||||||
|
compile project(':ReactNativeAndroidSmsListener')
|
||||||
// compile(name:'geth', ext:'aar')
|
// compile(name:'geth', ext:'aar')
|
||||||
compile(group: 'status-im', name: 'android-geth', version: '1.4.0-201604110816-a97a114', ext: 'aar')
|
compile(group: 'status-im', name: 'android-geth', version: '1.4.0-201604110816-a97a114', ext: 'aar')
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import com.github.ethereum.go_ethereum.cmd.Geth;
|
import com.github.ethereum.go_ethereum.cmd.Geth;
|
||||||
import com.bitgo.randombytes.RandomBytesPackage;
|
import com.bitgo.randombytes.RandomBytesPackage;
|
||||||
|
import com.centaurwarchief.smslistener.SmsListener;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -78,7 +79,8 @@ public class MainActivity extends ReactActivity {
|
|||||||
new VectorIconsPackage(),
|
new VectorIconsPackage(),
|
||||||
new ReactNativeContacts(),
|
new ReactNativeContacts(),
|
||||||
new ReactNativeI18n(),
|
new ReactNativeI18n(),
|
||||||
new RandomBytesPackage()
|
new RandomBytesPackage(),
|
||||||
|
new SmsListener(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,6 @@ project(':react-native-vector-icons').projectDir = new File(rootProject.projectD
|
|||||||
include ':realm'
|
include ':realm'
|
||||||
project(':realm').projectDir = new File(rootProject.projectDir, '../node_modules/realm/android')
|
project(':realm').projectDir = new File(rootProject.projectDir, '../node_modules/realm/android')
|
||||||
include ':randombytes'
|
include ':randombytes'
|
||||||
project(':randombytes').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-randombytes/app')
|
project(':randombytes').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-randombytes/app')
|
||||||
|
include ':ReactNativeAndroidSmsListener'
|
||||||
|
project(':ReactNativeAndroidSmsListener').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-sms-listener/android')
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"react": "^0.14.5",
|
"react": "^0.14.5",
|
||||||
"react-native": "^0.24.1",
|
"react-native": "^0.24.1",
|
||||||
"react-native-action-button": "^1.1.4",
|
"react-native-action-button": "^1.1.4",
|
||||||
|
"react-native-android-sms-listener": "^0.1.3",
|
||||||
"react-native-circle-checkbox": "^0.1.3",
|
"react-native-circle-checkbox": "^0.1.3",
|
||||||
"react-native-contacts": "^0.2.4",
|
"react-native-contacts": "^0.2.4",
|
||||||
"react-native-i18n": "0.0.8",
|
"react-native-i18n": "0.0.8",
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
[syng-im.models.chats :as c]
|
[syng-im.models.chats :as c]
|
||||||
[syng-im.utils.utils :refer [log on-error http-post toast]]
|
[syng-im.utils.utils :refer [log on-error http-post toast]]
|
||||||
[syng-im.utils.random :as random]
|
[syng-im.utils.random :as random]
|
||||||
|
[syng-im.utils.sms-listener :refer [add-sms-listener
|
||||||
|
remove-sms-listener]]
|
||||||
[syng-im.utils.phone-number :refer [format-phone-number]]
|
[syng-im.utils.phone-number :refer [format-phone-number]]
|
||||||
[syng-im.constants :refer [text-content-type
|
[syng-im.constants :refer [text-content-type
|
||||||
content-type-command
|
content-type-command
|
||||||
@ -73,6 +75,10 @@
|
|||||||
:from "console"
|
:from "console"
|
||||||
:to "me"}])))
|
:to "me"}])))
|
||||||
|
|
||||||
|
(defn start-listen-confirmation-code-sms []
|
||||||
|
;; TODO UNDONE listen sms
|
||||||
|
)
|
||||||
|
|
||||||
;; -- Saving password ----------------------------------------
|
;; -- Saving password ----------------------------------------
|
||||||
(defn save-password [password]
|
(defn save-password [password]
|
||||||
;; TODO validate and save password
|
;; TODO validate and save password
|
||||||
|
14
src/syng_im/utils/sms_listener.cljs
Normal file
14
src/syng_im/utils/sms_listener.cljs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
(ns syng-im.utils.sms-listener)
|
||||||
|
|
||||||
|
(def sms-listener (js/require "react-native-android-sms-listener"))
|
||||||
|
|
||||||
|
;; Only android is supported!
|
||||||
|
|
||||||
|
(defn add-sms-listener
|
||||||
|
"Message format: {originatingAddress: string, body:
|
||||||
|
string}. Returns cancelable subscription."
|
||||||
|
[listen-fn]
|
||||||
|
(.addListener sms-listener listen-fn))
|
||||||
|
|
||||||
|
(defn remove-sms-listener [subscription]
|
||||||
|
(.remove subscription))
|
Loading…
x
Reference in New Issue
Block a user