Browse Source

backup

master
!Root 5 months ago
commit
77e44fd092
105 changed files with 14596 additions and 0 deletions
  1. +6
    -0
      .buckconfig
  2. +2
    -0
      .bundle/config
  3. +7
    -0
      .eslintrc.js
  4. +65
    -0
      .flowconfig
  5. +60
    -0
      .gitignore
  6. +9
    -0
      .prettierrc
  7. +1
    -0
      .ruby-version
  8. +3
    -0
      .vscode/settings.json
  9. +1
    -0
      .watchmanconfig
  10. +6
    -0
      Gemfile
  11. +100
    -0
      Gemfile.lock
  12. +14
    -0
      __tests__/App-test.js
  13. +55
    -0
      android/app/_BUCK
  14. +227
    -0
      android/app/build.gradle
  15. +19
    -0
      android/app/build_defs.bzl
  16. BIN
      android/app/debug.keystore
  17. +10
    -0
      android/app/proguard-rules.pro
  18. +13
    -0
      android/app/src/debug/AndroidManifest.xml
  19. +72
    -0
      android/app/src/debug/java/com/alarm/ReactNativeFlipper.java
  20. +31
    -0
      android/app/src/main/AndroidManifest.xml
  21. BIN
      android/app/src/main/assets/fonts/AntDesign.ttf
  22. BIN
      android/app/src/main/assets/fonts/Entypo.ttf
  23. BIN
      android/app/src/main/assets/fonts/EvilIcons.ttf
  24. BIN
      android/app/src/main/assets/fonts/Feather.ttf
  25. BIN
      android/app/src/main/assets/fonts/FontAwesome.ttf
  26. BIN
      android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf
  27. BIN
      android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf
  28. BIN
      android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf
  29. BIN
      android/app/src/main/assets/fonts/Fontisto.ttf
  30. BIN
      android/app/src/main/assets/fonts/Foundation.ttf
  31. BIN
      android/app/src/main/assets/fonts/Ionicons.ttf
  32. BIN
      android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf
  33. BIN
      android/app/src/main/assets/fonts/MaterialIcons.ttf
  34. BIN
      android/app/src/main/assets/fonts/Octicons.ttf
  35. BIN
      android/app/src/main/assets/fonts/SimpleLineIcons.ttf
  36. BIN
      android/app/src/main/assets/fonts/Zocial.ttf
  37. +15
    -0
      android/app/src/main/java/com/alarm/MainActivity.java
  38. +86
    -0
      android/app/src/main/java/com/alarm/MainApplication.java
  39. +36
    -0
      android/app/src/main/res/drawable/rn_edit_text_material.xml
  40. BIN
      android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  41. BIN
      android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  42. BIN
      android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  43. BIN
      android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  44. BIN
      android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  45. BIN
      android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  46. BIN
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  47. BIN
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  48. BIN
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  49. BIN
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  50. +3
    -0
      android/app/src/main/res/values/strings.xml
  51. +9
    -0
      android/app/src/main/res/values/styles.xml
  52. +43
    -0
      android/build.gradle
  53. +28
    -0
      android/gradle.properties
  54. BIN
      android/gradle/wrapper/gradle-wrapper.jar
  55. +5
    -0
      android/gradle/wrapper/gradle-wrapper.properties
  56. +185
    -0
      android/gradlew
  57. +89
    -0
      android/gradlew.bat
  58. +27
    -0
      android/settings.gradle
  59. +4
    -0
      app.json
  60. +8
    -0
      babel.config.js
  61. +22
    -0
      index.js
  62. +17
    -0
      metro.config.js
  63. +49
    -0
      package.json
  64. +93
    -0
      src/App.js
  65. +26
    -0
      src/core/foreground.js
  66. +8
    -0
      src/core/notification.js
  67. +10
    -0
      src/core/sms.listen.js
  68. +19
    -0
      src/core/sms.read.js
  69. +60
    -0
      src/core/storage.js
  70. +0
    -0
      src/module/index.js
  71. +4
    -0
      src/module/sms-listener/CancellableSubscription.js
  72. +21
    -0
      src/module/sms-listener/LICENSE
  73. +100
    -0
      src/module/sms-listener/README.md
  74. +5
    -0
      src/module/sms-listener/ReceivedSmsMessage.js
  75. +19
    -0
      src/module/sms-listener/android/build.gradle
  76. +5
    -0
      src/module/sms-listener/android/src/main/AndroidManifest.xml
  77. +70
    -0
      src/module/sms-listener/android/src/main/java/com/centaurwarchief/smslistener/SmsListenerModule.java
  78. +34
    -0
      src/module/sms-listener/android/src/main/java/com/centaurwarchief/smslistener/SmsListenerPackage.java
  79. +3
    -0
      src/module/sms-listener/android/src/main/java/com/centaurwarchief/smslistener/SmsNotification.java
  80. +100
    -0
      src/module/sms-listener/android/src/main/java/com/centaurwarchief/smslistener/SmsReceiver.java
  81. +19
    -0
      src/module/sms-listener/build.gradle
  82. +17
    -0
      src/module/sms-listener/index.js
  83. +25
    -0
      src/module/sms-listener/package.json
  84. +45
    -0
      src/module/sms/android/build.gradle
  85. +5
    -0
      src/module/sms/android/src/main/AndroidManifest.xml
  86. +307
    -0
      src/module/sms/android/src/main/java/com/react/SmsModule.java
  87. +36
    -0
      src/module/sms/android/src/main/java/com/react/SmsPackage.java
  88. +3
    -0
      src/module/sms/index.js
  89. +32
    -0
      src/provider/device.helper.js
  90. +21
    -0
      src/provider/device.js
  91. +9
    -0
      src/provider/store.js
  92. +39
    -0
      src/views/Dialog.Device/index.js
  93. +3
    -0
      src/views/Dialog.Device/style.js
  94. +0
    -0
      src/views/index.js
  95. +3
    -0
      storybook/addons.js
  96. +25
    -0
      storybook/index.js
  97. +2
    -0
      storybook/rn-addons.js
  98. +20
    -0
      storybook/stories/Button/Button.stories.js
  99. +17
    -0
      storybook/stories/Button/index.js
  100. +16
    -0
      storybook/stories/CenterView/index.js

+ 6
- 0
.buckconfig View File

@ -0,0 +1,6 @@
[android]
target = Google Inc.:Google APIs:23
[maven_repositories]
central = https://repo1.maven.org/maven2

+ 2
- 0
.bundle/config View File

@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1

+ 7
- 0
.eslintrc.js View File

@ -0,0 +1,7 @@
module.exports = {
root: true,
extends: "@react-native-community",
rules: {
"prettier/prettier": 0,
},
};

+ 65
- 0
.flowconfig View File

@ -0,0 +1,65 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
[include]
[libs]
node_modules/react-native/interface.js
node_modules/react-native/flow/
[options]
emoji=true
exact_by_default=true
format.bracket_spacing=false
module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js
munge_underscores=true
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
unnecessary-invariant=warn
signature-verification-failure=warn
[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
[version]
^0.162.0

+ 60
- 0
.gitignore View File

@ -0,0 +1,60 @@
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
# Bundle artifact
*.jsbundle
# CocoaPods
/ios/Pods/

+ 9
- 0
.prettierrc View File

@ -0,0 +1,9 @@
{
"printWidth": 110,
"tabWidth": 4,
"useTabs": true,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"jsxBracketSameLine": true
}

+ 1
- 0
.ruby-version View File

@ -0,0 +1 @@
2.7.4

+ 3
- 0
.vscode/settings.json View File

@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "disabled"
}

+ 1
- 0
.watchmanconfig View File

@ -0,0 +1 @@
{}

+ 6
- 0
Gemfile View File

@ -0,0 +1,6 @@
source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.4'
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

+ 100
- 0
Gemfile.lock View File

@ -0,0 +1,100 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.5)
rexml
activesupport (6.1.4.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.1.0)
cocoapods (1.11.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.2)
activesupport (>= 5.0, < 7)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.9)
escape (0.0.4)
ethon (0.15.0)
ffi (>= 1.15.0)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
json (2.6.1)
minitest (5.15.0)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.6)
rexml (3.2.5)
ruby-macho (2.5.1)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
xcodeproj (1.21.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.4)
PLATFORMS
ruby
DEPENDENCIES
cocoapods (~> 1.11, >= 1.11.2)
RUBY VERSION
ruby 2.7.4p191
BUNDLED WITH
2.2.27

+ 14
- 0
__tests__/App-test.js View File

@ -0,0 +1,14 @@
/**
* @format
*/
import 'react-native';
import React from 'react';
import App from '../App';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
renderer.create(<App />);
});

+ 55
- 0
android/app/_BUCK View File

@ -0,0 +1,55 @@
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
lib_deps = []
create_aar_targets(glob(["libs/*.aar"]))
create_jar_targets(glob(["libs/*.jar"]))
android_library(
name = "all-libs",
exported_deps = lib_deps,
)
android_library(
name = "app-code",
srcs = glob([
"src/main/java/**/*.java",
]),
deps = [
":all-libs",
":build_config",
":res",
],
)
android_build_config(
name = "build_config",
package = "com.alarm",
)
android_resource(
name = "res",
package = "com.alarm",
res = "src/main/res",
)
android_binary(
name = "app",
keystore = "//android/keystores:debug",
manifest = "src/main/AndroidManifest.xml",
package_type = "debug",
deps = [
":app-code",
],
)

+ 227
- 0
android/app/build.gradle View File

@ -0,0 +1,227 @@
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // https://reactnative.dev/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and that value will be read here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
/**
* Architectures to build native code for in debug.
*/
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.alarm"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
if (nativeArchitectures) {
ndk {
abiFilters nativeArchitectures.split(',')
}
}
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.implementation
into 'libs'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

+ 19
- 0
android/app/build_defs.bzl View File

@ -0,0 +1,19 @@
"""Helper definitions to glob .aar and .jar targets"""
def create_aar_targets(aarfiles):
for aarfile in aarfiles:
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
lib_deps.append(":" + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)
def create_jar_targets(jarfiles):
for jarfile in jarfiles:
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
lib_deps.append(":" + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)

BIN
android/app/debug.keystore View File


+ 10
- 0
android/app/proguard-rules.pro View File

@ -0,0 +1,10 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:

+ 13
- 0
android/app/src/debug/AndroidManifest.xml View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>

+ 72
- 0
android/app/src/debug/java/com/alarm/ReactNativeFlipper.java View File

@ -0,0 +1,72 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.alarm;
import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
import com.facebook.flipper.android.utils.FlipperUtils;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;
public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(new ReactFlipperPlugin());
client.addPlugin(new DatabasesFlipperPlugin(context));
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
client.addPlugin(CrashReporterPlugin.getInstance());
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
NetworkingModule.setCustomClientBuilder(
new NetworkingModule.CustomClientBuilder() {
@Override
public void apply(OkHttpClient.Builder builder) {
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
}
});
client.addPlugin(networkFlipperPlugin);
client.start();
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
// Hence we run if after all native modules have been initialized
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext == null) {
reactInstanceManager.addReactInstanceEventListener(
new ReactInstanceManager.ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(ReactContext reactContext) {
reactInstanceManager.removeReactInstanceEventListener(this);
reactContext.runOnNativeModulesQueueThread(
new Runnable() {
@Override
public void run() {
client.addPlugin(new FrescoFlipperPlugin());
}
});
}
});
} else {
client.addPlugin(new FrescoFlipperPlugin());
}
}
}
}

+ 31
- 0
android/app/src/main/AndroidManifest.xml View File

@ -0,0 +1,31 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.alarm">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.voximplant.foregroundservice.VIForegroundService"> </service>
</application>
</manifest>

BIN
android/app/src/main/assets/fonts/AntDesign.ttf View File


BIN
android/app/src/main/assets/fonts/Entypo.ttf View File


BIN
android/app/src/main/assets/fonts/EvilIcons.ttf View File


BIN
android/app/src/main/assets/fonts/Feather.ttf View File


BIN
android/app/src/main/assets/fonts/FontAwesome.ttf View File


BIN
android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf View File


BIN
android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf View File


BIN
android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf View File


BIN
android/app/src/main/assets/fonts/Fontisto.ttf View File


BIN
android/app/src/main/assets/fonts/Foundation.ttf View File


BIN
android/app/src/main/assets/fonts/Ionicons.ttf View File


BIN
android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf View File


BIN
android/app/src/main/assets/fonts/MaterialIcons.ttf View File


BIN
android/app/src/main/assets/fonts/Octicons.ttf View File


BIN
android/app/src/main/assets/fonts/SimpleLineIcons.ttf View File


BIN
android/app/src/main/assets/fonts/Zocial.ttf View File


+ 15
- 0
android/app/src/main/java/com/alarm/MainActivity.java View File

@ -0,0 +1,15 @@
package com.alarm;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "alarm";
}
}

+ 86
- 0
android/app/src/main/java/com/alarm/MainApplication.java View File

@ -0,0 +1,86 @@
package com.alarm;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.wix.reactnativenotifications.RNNotificationsPackage;
import com.voximplant.foregroundservice.VIForegroundServicePackage;
import com.react.SmsPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
import com.centaurwarchief.smslistener.SmsListenerPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.alarm.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}

+ 36
- 0
android/app/src/main/res/drawable/rn_edit_text_material.xml View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
android:insetTop="@dimen/abc_edit_text_inset_top_material"
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
<selector>
<!--
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
-->
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
</selector>
</inset>

BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png View File

Before After
Width: 72  |  Height: 72  |  Size: 3.0 KiB

BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png View File

Before After
Width: 72  |  Height: 72  |  Size: 4.9 KiB

BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png View File

Before After
Width: 48  |  Height: 48  |  Size: 2.0 KiB

BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png View File

Before After
Width: 48  |  Height: 48  |  Size: 2.8 KiB

BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png View File

Before After
Width: 96  |  Height: 96  |  Size: 4.5 KiB

BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png View File

Before After
Width: 96  |  Height: 96  |  Size: 6.9 KiB

BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png View File

Before After
Width: 144  |  Height: 144  |  Size: 6.3 KiB

BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png View File

Before After
Width: 144  |  Height: 144  |  Size: 10 KiB

BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png View File

Before After
Width: 192  |  Height: 192  |  Size: 9.0 KiB

BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png View File

Before After
Width: 192  |  Height: 192  |  Size: 15 KiB

+ 3
- 0
android/app/src/main/res/values/strings.xml View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">alarm</string>
</resources>

+ 9
- 0
android/app/src/main/res/values/styles.xml View File

@ -0,0 +1,9 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>
</resources>

+ 43
- 0
android/build.gradle View File

@ -0,0 +1,43 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}

+ 28
- 0
android/gradle.properties View File

@ -0,0 +1,28 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.99.0

BIN
android/gradle/wrapper/gradle-wrapper.jar View File


+ 5
- 0
android/gradle/wrapper/gradle-wrapper.properties View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

+ 185
- 0
android/gradlew View File

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

+ 89
- 0
android/gradlew.bat View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

+ 27
- 0
android/settings.gradle View File

@ -0,0 +1,27 @@
rootProject.name = 'alarm'
include ':react-native-background-job'
project(':react-native-background-job').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-job/android')
include ':react-native-endless-background-service-without-notification'
project(':react-native-endless-background-service-without-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-endless-background-service-without-notification/android')
include ':react-native-background-job'
project(':react-native-background-job').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-job/android')
include ':react-native-notifications'
project(':react-native-notifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/lib/android/app')
include ':@voximplant_react-native-foreground-service'
project(':@voximplant_react-native-foreground-service').projectDir = new File(rootProject.projectDir, '../node_modules/@voximplant/react-native-foreground-service/android')
include ':react-native-background-job'
project(':react-native-background-job').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-job/android')
include ':react-native-get-sms-android-v2'
project(':react-native-get-sms-android-v2').projectDir = new File(rootProject.projectDir, '../src/module/sms/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-sms-android'
project(':react-native-sms-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sms-android/android')
include ':@react-native-async-storage_async-storage'
project(':@react-native-async-storage_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-async-storage/async-storage/android')
include ':react-native-sms-android'
project(':react-native-sms-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sms-android/android')
include ':react-native-android-sms-listener'
project(':react-native-android-sms-listener').projectDir = new File(rootProject.projectDir, '../src/module/sms-listener/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

+ 4
- 0
app.json View File

@ -0,0 +1,4 @@
{
"name": "alarm",
"displayName": "alarm"
}

+ 8
- 0
babel.config.js View File

@ -0,0 +1,8 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
env: {
production: {
plugins: ['react-native-paper/babel'],
},
},
};

+ 22
- 0
index.js View File

@ -0,0 +1,22 @@
/**
* @format
*/
import React from 'react';
import { AppRegistry } from 'react-native';
import { name as appName } from './app.json';
import { App } from './src/App';
// redux
import { Provider } from 'react-redux';
import { ReduxStore } from './src/provider/store';
// material
import { Provider as PaperProvider } from 'react-native-paper';
const Index = () => (
<Provider store={ReduxStore}>
<PaperProvider>
<App />
</PaperProvider>
</Provider>
);
AppRegistry.registerComponent(appName, () => Index);

+ 17
- 0
metro.config.js View File

@ -0,0 +1,17 @@
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
};

+ 49
- 0
package.json View File

@ -0,0 +1,49 @@
{
"name": "alarm",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"storybook": "start-storybook -p 7007",
"build-storybook": "build-storybook"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.16.1",
"@reduxjs/toolkit": "^1.8.0",
"@voximplant/react-native-foreground-service": "^2.0.0",
"react": "17.0.2",
"react-native": "0.67.3",
"react-native-android-sms-listener": "^0.8.0",
"react-native-get-sms-android-v2": "^2.1.0",
"react-native-notifications": "^4.2.2",
"react-native-paper": "^4.11.2",
"react-native-vector-icons": "^9.1.0",
"react-redux": "^7.2.6",
"redux": "^4.1.2"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@storybook/addon-actions": "^5.3",
"@storybook/addon-knobs": "^5.3",
"@storybook/addon-links": "^5.3",
"@storybook/addon-ondevice-actions": "^5.3.23",
"@storybook/addon-ondevice-knobs": "^5.3.25",
"@storybook/react-native": "^5.3.25",
"@storybook/react-native-server": "^5.3.23",
"babel-jest": "^26.6.3",
"babel-loader": "^8.2.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-dom": "17.0.2",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}

+ 93
- 0
src/App.js View File

@ -0,0 +1,93 @@
import React, { useEffect, useState } from 'react';
import { SafeAreaView, Text } from 'react-native';
// material
import { Button } from 'react-native-paper';
// redux
import { useDeviceList, useDeviceActive } from './provider/device.helper';
// core
import { Storage } from './core/storage';
import { useSMSRead } from './core/sms.read';
import { useSMSListener } from './core/sms.listen';
import { StartForegroundService } from './core/foreground';
// import { StartForegroundService } from './core/foreground';
// import { NotificationOnReciveSMS } from './core/notification';
// view
import { DialogDevice } from './views/Dialog.Device';
export const App = () => {
const [devices, setDevices] = useDeviceList();
const [deviceActive, setDeviceActive] = useDeviceActive();
const [visible, setVisable] = useState(false);
useEffect(() => {
onInit();
onForground();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const onInit = async () => {
try {
// await StartForegroundService();
// load data from storage
const DeviceList = await Storage.ListDevice();
// set devices to redux
setDevices(DeviceList);
// load data from storage
const DeviceActive = await Storage.GetDeviceActive();
// set device active to redux
setDeviceActive(DeviceActive);
// read SMS
// eslint-disable-next-line react-hooks/rules-of-hooks
const SMSs = await useSMSRead({ phone: '09102802725' });
console.log(SMSs.count);
} catch (error) {
console.error(error);
}
};
const onForground = async () => {
console.log('forground/1');
StartForegroundService();
// eslint-disable-next-line react-hooks/rules-of-hooks
useSMSListener((message) => {
console.log(message.originatingAddress);
});
};
/**
* On Dialog device form close
* @param {null | {name: string, phone: string}} value return value from dialog
*/
const onDialogDeviceClose = (value) => {
if (value) {
const _devices = [...devices];
_devices.push(value);
setDevices(_devices);
Storage.SetDevice(_devices);
if (deviceActive === -1) {
setDeviceActive(0);
Storage.SetDeviceActive(0);
}
}
setVisable(false);
};
return (
<SafeAreaView>
<Text>{deviceActive}</Text>
{devices.map((item, index) => (
<Text key={index}>
{item.name} - {item.phone}
</Text>
))}
<Button onPress={() => setVisable(!visible)}>افزودن دستگاه جدید</Button>
<DialogDevice visible={visible} onClose={onDialogDeviceClose} />
</SafeAreaView>
);
};

+ 26
- 0
src/core/foreground.js View File

@ -0,0 +1,26 @@
import VIForegroundService from '@voximplant/react-native-foreground-service';
import { Platform } from 'react-native';
export const StartForegroundService = async () => {
if (Platform.Version >= 26) {
const channelConfig = {
id: 'ForegroundServiceChannel',
name: 'Notification Channel',
description: 'Notification Channel for Foreground Service',
enableVibration: false,
importance: 2,
};
await VIForegroundService.createNotificationChannel(channelConfig);
}
const notificationConfig = {
id: 3456,
title: 'Foreground Service',
text: 'Foreground service is running',
icon: 'ic_notification',
priority: 0,
};
if (Platform.Version >= 26) {
notificationConfig.channelId = 'ForegroundServiceChannel';
}
await VIForegroundService.startService(notificationConfig);
};

+ 8
- 0
src/core/notification.js View File

@ -0,0 +1,8 @@
import { Notifications } from 'react-native-notifications';
export const NotificationOnReciveSMS = () => {
Notifications.postLocalNotification({
title: 'Local notification',
body: 'This notification was generated by the app!',
});
};

+ 10
- 0
src/core/sms.listen.js View File

@ -0,0 +1,10 @@
import SmsListener from '../module/sms-listener';
/**
* Listen to SMSs
* @param {(message: { originatingAddress: string, body: string, timestamp: number}) => void} callback Function on recive a SMS
* @returns
*/
export const useSMSListener = (callback) => {
return SmsListener.addListener(callback);
};

+ 19
- 0
src/core/sms.read.js View File

@ -0,0 +1,19 @@
import SmsAndroid from '../module/sms';
/**
* Read SMS from past
* @param {{ phone: string }}
* @returns {Promise<{count: number, list: any[] }>}
*/
export const useSMSRead = ({ phone }) => {
return new Promise((resolve, reject) => {
const filter = {
box: 'inbox',
address: phone,
};
SmsAndroid.list(JSON.stringify(filter), reject, (count, list) => {
resolve({ count, list: JSON.parse(list) });
});
});
};

+ 60
- 0
src/core/storage.js View File

@ -0,0 +1,60 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
class CStorage {
/**
* Get list of devices from storage
* @returns {[{name: string, phone: string}]} List of devices from storage
*/
async ListDevice() {
try {
const device = await AsyncStorage.getItem('device');
return device != null ? JSON.parse(device) : [];
} catch (error) {
return [];
}
}
/**
* Set device to stronge
* @param {[{name: string, phone: string}]} devices list of devices
* @returns {null|any} Save device to storage error
*/
async SetDevice(devices) {
try {
await AsyncStorage.setItem('device', JSON.stringify(devices));
return null;
} catch (error) {
return error;
}
}
/**
* Set active device by index in storage
* @param {number} index Device index in array
* @returns {null|any} Save active device in storage error
*/
async SetDeviceActive(index) {
try {
await AsyncStorage.setItem('device:active', index.toString());
return null;
} catch (error) {
return error;
}
}
/**
* Get active device index in storage
* @returns {number} Active device index
*/
async GetDeviceActive() {
try {
const index = await AsyncStorage.getItem('device:active');
// eslint-disable-next-line radix
return index !== null ? parseInt(index) : -1;
} catch (error) {
return -1;
}
}
}
export const Storage = new CStorage();

+ 0
- 0
src/module/index.js View File