Setup sms-listener

Former-commit-id: 1f5dad71e8
This commit is contained in:
virvar 2016-05-18 17:40:26 +03:00
parent 11c08f1e01
commit d1ef5e7e32
7 changed files with 30 additions and 3 deletions

View File

@ -14,7 +14,8 @@
"react-native-vector-icons/Ionicons",
"react-native-circle-checkbox",
"react-native-randombytes",
"dismissKeyboard"
"dismissKeyboard",
"react-native-android-sms-listener"
],
"imageDirs": [
"images"

View File

@ -128,6 +128,7 @@ dependencies {
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-contacts')
compile project(':react-native-i18n')
compile project(':ReactNativeAndroidSmsListener')
// compile(name:'geth', ext:'aar')
compile(group: 'status-im', name: 'android-geth', version: '1.4.0-201604110816-a97a114', ext: 'aar')

View File

@ -10,6 +10,7 @@ import android.os.Bundle;
import android.os.Environment;
import com.github.ethereum.go_ethereum.cmd.Geth;
import com.bitgo.randombytes.RandomBytesPackage;
import com.centaurwarchief.smslistener.SmsListener;
import java.util.Arrays;
import java.util.List;
@ -78,7 +79,8 @@ public class MainActivity extends ReactActivity {
new VectorIconsPackage(),
new ReactNativeContacts(),
new ReactNativeI18n(),
new RandomBytesPackage()
new RandomBytesPackage(),
new SmsListener(this)
);
}
}

View File

@ -14,3 +14,5 @@ include ':realm'
project(':realm').projectDir = new File(rootProject.projectDir, '../node_modules/realm/android')
include ':randombytes'
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')

View File

@ -10,6 +10,7 @@
"react": "^0.14.5",
"react-native": "^0.24.1",
"react-native-action-button": "^1.1.4",
"react-native-android-sms-listener": "^0.1.3",
"react-native-circle-checkbox": "^0.1.3",
"react-native-contacts": "^0.2.4",
"react-native-i18n": "0.0.8",

View File

@ -6,6 +6,8 @@
[syng-im.models.chats :as c]
[syng-im.utils.utils :refer [log on-error http-post toast]]
[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.constants :refer [text-content-type
content-type-command
@ -73,6 +75,10 @@
:from "console"
:to "me"}])))
(defn start-listen-confirmation-code-sms []
;; TODO UNDONE listen sms
)
;; -- Saving password ----------------------------------------
(defn save-password [password]
;; TODO validate and save password

View 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))