From 8a3f96e27cac884daa3535f3c04a4af17be463ba Mon Sep 17 00:00:00 2001 From: edwardigates <56969762+edwardigates@users.noreply.github.com> Date: Mon, 3 Aug 2020 10:59:04 +0300 Subject: [PATCH] package name change (#94) * Remove raw input data for testing - comment testing methods. * Uncomment used method * package name change. write only contacts to db. remove fastcsv dependency --- .../rncontacttracing/demo/MainActivity.java | 4 +- .../demo/MainApplication.java | 2 +- lib/android/build.gradle | 3 +- lib/android/src/main/AndroidManifest.xml | 10 +-- .../wix => moh/gov/il}/crypto/Constants.java | 2 +- .../wix => moh/gov/il}/crypto/Contact.java | 5 +- .../wix => moh/gov/il}/crypto/Crypto.java | 2 +- .../gov/il}/crypto/CryptoManager.java | 3 +- .../{com/wix => moh/gov/il}/crypto/Match.java | 2 +- .../gov/il}/crypto/MatchResponse.java | 6 +- .../wix => moh/gov/il}/crypto/Server.java | 12 +-- .../{com/wix => moh/gov/il}/crypto/Time.java | 2 +- .../{com/wix => moh/gov/il}/crypto/User.java | 24 +++-- .../gov/il}/crypto/custom/Pair.java | 2 +- .../gov/il}/crypto/custom/Triplet.java | 2 +- .../wix => moh/gov/il}/crypto/key/DayKey.java | 6 +- .../gov/il}/crypto/key/EpochKey.java | 10 +-- .../gov/il}/crypto/key/UserKey.java | 4 +- .../gov/il}/crypto/utilities/BytesUtils.java | 2 +- .../il}/crypto/utilities/DerivationUtils.java | 8 +- .../gov/il}/crypto/utilities/Hex.java | 2 +- .../il}/specialble/BLEForegroundService.java | 27 +++--- .../gov/il}/specialble/BLEReceiver.java | 5 +- .../il}/specialble/EventToJSDispatcher.java | 8 +- .../gov/il}/specialble/SpecialBleModule.java | 59 ++++-------- .../gov/il}/specialble/SpecialBlePackage.java | 2 +- .../BatteryOptimizationHolderActivity.java | 4 +- .../specialble/bt/BLEAdvertisingManager.java | 24 ++--- .../gov/il}/specialble/bt/BLEManager.java | 14 +-- .../il}/specialble/bt/BLEScannerManager.java | 90 +++++++++++-------- .../gov/il}/specialble/bt/Device.java | 2 +- .../gov/il}/specialble/bt/Event.java | 2 +- .../gov/il}/specialble/bt/Scan.java | 4 +- .../gov/il}/specialble/config/Config.java | 2 +- .../gov/il}/specialble/db/ContactDao.java | 4 +- .../gov/il}/specialble/db/DBClient.java | 12 +-- .../gov/il}/specialble/db/DeviceDao.java | 4 +- .../gov/il}/specialble/db/EventDao.java | 4 +- .../gov/il}/specialble/db/PublicKeyDao.java | 4 +- .../il}/specialble/db/PublicKeysDatabase.java | 4 +- .../gov/il}/specialble/db/ScanDao.java | 4 +- .../il}/specialble/db/SpecialBLEDatabase.java | 10 +-- .../gov/il}/specialble/kays/PublicKey.java | 2 +- .../specialble/listeners/IEventListener.java | 2 +- .../specialble/listeners/ISensorListener.java | 2 +- .../specialble/receivers/AlarmReceiver.java | 10 +-- .../sensor/AccelerometerManager.java | 4 +- .../specialble/sensor/ProximityManager.java | 4 +- .../sensor/RotationVectorManager.java | 4 +- .../il}/specialble/sensor/SensorUtils.java | 2 +- .../gov/il}/specialble/util/CSVUtil.java | 10 +-- .../gov/il}/specialble/util/Constants.java | 2 +- .../gov/il}/specialble/util/DeviceUtil.java | 4 +- .../gov/il}/specialble/util/ParseUtils.java | 33 +++---- .../gov/il}/specialble/util/PrefUtils.java | 2 +- 55 files changed, 221 insertions(+), 262 deletions(-) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/Constants.java (98%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/Contact.java (97%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/Crypto.java (98%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/CryptoManager.java (97%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/Match.java (98%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/MatchResponse.java (95%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/Server.java (94%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/Time.java (99%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/User.java (97%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/custom/Pair.java (90%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/custom/Triplet.java (92%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/key/DayKey.java (89%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/key/EpochKey.java (93%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/key/UserKey.java (94%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/utilities/BytesUtils.java (98%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/utilities/DerivationUtils.java (96%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/crypto/utilities/Hex.java (99%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/BLEForegroundService.java (93%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/BLEReceiver.java (86%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/EventToJSDispatcher.java (93%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/SpecialBleModule.java (90%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/SpecialBlePackage.java (95%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/activities/BatteryOptimizationHolderActivity.java (93%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/bt/BLEAdvertisingManager.java (81%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/bt/BLEManager.java (91%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/bt/BLEScannerManager.java (75%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/bt/Device.java (98%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/bt/Event.java (98%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/bt/Scan.java (99%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/config/Config.java (99%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/db/ContactDao.java (93%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/db/DBClient.java (94%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/db/DeviceDao.java (91%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/db/EventDao.java (90%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/db/PublicKeyDao.java (87%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/db/PublicKeysDatabase.java (75%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/db/ScanDao.java (89%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/db/SpecialBLEDatabase.java (69%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/kays/PublicKey.java (94%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/listeners/IEventListener.java (66%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/listeners/ISensorListener.java (80%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/receivers/AlarmReceiver.java (89%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/sensor/AccelerometerManager.java (94%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/sensor/ProximityManager.java (94%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/sensor/RotationVectorManager.java (94%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/sensor/SensorUtils.java (97%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/util/CSVUtil.java (97%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/util/Constants.java (88%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/util/DeviceUtil.java (98%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/util/ParseUtils.java (87%) rename lib/android/src/main/java/{com/wix => moh/gov/il}/specialble/util/PrefUtils.java (95%) diff --git a/example/android/app/src/main/java/com/rncontacttracing/demo/MainActivity.java b/example/android/app/src/main/java/com/rncontacttracing/demo/MainActivity.java index f682f06..39c7141 100644 --- a/example/android/app/src/main/java/com/rncontacttracing/demo/MainActivity.java +++ b/example/android/app/src/main/java/com/rncontacttracing/demo/MainActivity.java @@ -3,8 +3,8 @@ import android.content.Intent; import com.facebook.react.ReactActivity; -import com.wix.specialble.bt.BLEManager; -import com.wix.specialble.util.DeviceUtil; +import moh.gov.il.specialble.bt.BLEManager; +import moh.gov.il.specialble.util.DeviceUtil; public class MainActivity extends ReactActivity { diff --git a/example/android/app/src/main/java/com/rncontacttracing/demo/MainApplication.java b/example/android/app/src/main/java/com/rncontacttracing/demo/MainApplication.java index 2ae88dc..8256086 100644 --- a/example/android/app/src/main/java/com/rncontacttracing/demo/MainApplication.java +++ b/example/android/app/src/main/java/com/rncontacttracing/demo/MainApplication.java @@ -9,7 +9,7 @@ import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; -import com.wix.specialble.SpecialBlePackage; +import moh.gov.il.specialble.SpecialBlePackage; import java.lang.reflect.InvocationTargetException; import java.util.List; diff --git a/lib/android/build.gradle b/lib/android/build.gradle index 828f8d6..43b648a 100644 --- a/lib/android/build.gradle +++ b/lib/android/build.gradle @@ -85,7 +85,6 @@ dependencies { implementation "androidx.room:room-runtime:$room_version" annotationProcessor "androidx.room:room-compiler:$room_version" implementation 'com.google.code.gson:gson:2.8.6' - implementation 'de.siegmar:fastcsv:1.0.3' } def configureReactNativePom(def pom) { @@ -95,7 +94,7 @@ def configureReactNativePom(def pom) { name packageJson.title artifactId packageJson.name version = packageJson.version - group = "com.wix.specialble" + group = "moh.gov.il.specialble" description packageJson.description url packageJson.repository.baseUrl diff --git a/lib/android/src/main/AndroidManifest.xml b/lib/android/src/main/AndroidManifest.xml index feb7ef6..42bcd32 100644 --- a/lib/android/src/main/AndroidManifest.xml +++ b/lib/android/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="moh.gov.il.specialble"> @@ -13,7 +13,7 @@ - + - - - + + + diff --git a/lib/android/src/main/java/com/wix/crypto/Constants.java b/lib/android/src/main/java/moh/gov/il/crypto/Constants.java similarity index 98% rename from lib/android/src/main/java/com/wix/crypto/Constants.java rename to lib/android/src/main/java/moh/gov/il/crypto/Constants.java index 23ff48b..957679b 100644 --- a/lib/android/src/main/java/com/wix/crypto/Constants.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/Constants.java @@ -1,4 +1,4 @@ -package com.wix.crypto; +package moh.gov.il.crypto; import java.nio.charset.StandardCharsets; import java.util.HashMap; diff --git a/lib/android/src/main/java/com/wix/crypto/Contact.java b/lib/android/src/main/java/moh/gov/il/crypto/Contact.java similarity index 97% rename from lib/android/src/main/java/com/wix/crypto/Contact.java rename to lib/android/src/main/java/moh/gov/il/crypto/Contact.java index d52a474..7584221 100644 --- a/lib/android/src/main/java/com/wix/crypto/Contact.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/Contact.java @@ -1,4 +1,4 @@ -package com.wix.crypto; +package moh.gov.il.crypto; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; @@ -6,9 +6,8 @@ import androidx.room.Index; import androidx.room.PrimaryKey; -import com.wix.crypto.utilities.Hex; +import moh.gov.il.crypto.utilities.Hex; -import org.json.JSONException; import org.json.JSONObject; import java.nio.ByteBuffer; diff --git a/lib/android/src/main/java/com/wix/crypto/Crypto.java b/lib/android/src/main/java/moh/gov/il/crypto/Crypto.java similarity index 98% rename from lib/android/src/main/java/com/wix/crypto/Crypto.java rename to lib/android/src/main/java/moh/gov/il/crypto/Crypto.java index 966cbd2..e8b1044 100644 --- a/lib/android/src/main/java/com/wix/crypto/Crypto.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/Crypto.java @@ -1,4 +1,4 @@ -package com.wix.crypto; +package moh.gov.il.crypto; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; diff --git a/lib/android/src/main/java/com/wix/crypto/CryptoManager.java b/lib/android/src/main/java/moh/gov/il/crypto/CryptoManager.java similarity index 97% rename from lib/android/src/main/java/com/wix/crypto/CryptoManager.java rename to lib/android/src/main/java/moh/gov/il/crypto/CryptoManager.java index 3bf61a2..fb8c9ee 100644 --- a/lib/android/src/main/java/com/wix/crypto/CryptoManager.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/CryptoManager.java @@ -1,7 +1,6 @@ -package com.wix.crypto; +package moh.gov.il.crypto; import android.content.Context; -import android.util.Log; import java.security.SecureRandom; import java.util.ArrayList; diff --git a/lib/android/src/main/java/com/wix/crypto/Match.java b/lib/android/src/main/java/moh/gov/il/crypto/Match.java similarity index 98% rename from lib/android/src/main/java/com/wix/crypto/Match.java rename to lib/android/src/main/java/moh/gov/il/crypto/Match.java index 7a96a2e..0a26d5a 100644 --- a/lib/android/src/main/java/com/wix/crypto/Match.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/Match.java @@ -1,4 +1,4 @@ -package com.wix.crypto; +package moh.gov.il.crypto; import org.json.JSONObject; diff --git a/lib/android/src/main/java/com/wix/crypto/MatchResponse.java b/lib/android/src/main/java/moh/gov/il/crypto/MatchResponse.java similarity index 95% rename from lib/android/src/main/java/com/wix/crypto/MatchResponse.java rename to lib/android/src/main/java/moh/gov/il/crypto/MatchResponse.java index 0eb0e3f..1f95c7d 100644 --- a/lib/android/src/main/java/com/wix/crypto/MatchResponse.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/MatchResponse.java @@ -1,11 +1,7 @@ -package com.wix.crypto; - -import com.wix.crypto.utilities.Hex; +package moh.gov.il.crypto; import org.json.JSONObject; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; import java.util.List; public class MatchResponse { diff --git a/lib/android/src/main/java/com/wix/crypto/Server.java b/lib/android/src/main/java/moh/gov/il/crypto/Server.java similarity index 94% rename from lib/android/src/main/java/com/wix/crypto/Server.java rename to lib/android/src/main/java/moh/gov/il/crypto/Server.java index 04ab32b..ed9834a 100644 --- a/lib/android/src/main/java/com/wix/crypto/Server.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/Server.java @@ -1,10 +1,10 @@ -package com.wix.crypto; +package moh.gov.il.crypto; -import com.wix.crypto.custom.Pair; -import com.wix.crypto.custom.Triplet; -import com.wix.crypto.key.UserKey; -import com.wix.crypto.utilities.BytesUtils; -import com.wix.crypto.utilities.DerivationUtils; +import moh.gov.il.crypto.custom.Pair; +import moh.gov.il.crypto.custom.Triplet; +import moh.gov.il.crypto.key.UserKey; +import moh.gov.il.crypto.utilities.BytesUtils; +import moh.gov.il.crypto.utilities.DerivationUtils; import java.util.ArrayList; import java.util.Arrays; diff --git a/lib/android/src/main/java/com/wix/crypto/Time.java b/lib/android/src/main/java/moh/gov/il/crypto/Time.java similarity index 99% rename from lib/android/src/main/java/com/wix/crypto/Time.java rename to lib/android/src/main/java/moh/gov/il/crypto/Time.java index 10fdd39..d300d3c 100644 --- a/lib/android/src/main/java/com/wix/crypto/Time.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/Time.java @@ -1,4 +1,4 @@ -package com.wix.crypto; +package moh.gov.il.crypto; import androidx.annotation.Nullable; import com.google.gson.annotations.SerializedName; diff --git a/lib/android/src/main/java/com/wix/crypto/User.java b/lib/android/src/main/java/moh/gov/il/crypto/User.java similarity index 97% rename from lib/android/src/main/java/com/wix/crypto/User.java rename to lib/android/src/main/java/moh/gov/il/crypto/User.java index 3d48ad8..9d51a68 100644 --- a/lib/android/src/main/java/com/wix/crypto/User.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/User.java @@ -1,4 +1,4 @@ -package com.wix.crypto; +package moh.gov.il.crypto; import android.content.Context; import android.content.SharedPreferences; @@ -7,15 +7,15 @@ import android.util.Log; import com.google.gson.annotations.SerializedName; -import com.wix.crypto.custom.Pair; -import com.wix.crypto.custom.Triplet; -import com.wix.crypto.key.DayKey; -import com.wix.crypto.key.EpochKey; -import com.wix.crypto.key.UserKey; -import com.wix.crypto.utilities.BytesUtils; -import com.wix.crypto.utilities.DerivationUtils; -import com.wix.crypto.utilities.Hex; -import com.wix.specialble.db.DBClient; +import moh.gov.il.crypto.custom.Pair; +import moh.gov.il.crypto.custom.Triplet; +import moh.gov.il.crypto.key.EpochKey; +import moh.gov.il.crypto.utilities.BytesUtils; +import moh.gov.il.crypto.utilities.DerivationUtils; +import moh.gov.il.crypto.utilities.Hex; +import moh.gov.il.specialble.db.DBClient; +import moh.gov.il.crypto.key.DayKey; +import moh.gov.il.crypto.key.UserKey; import org.json.JSONArray; import org.json.JSONException; @@ -30,8 +30,6 @@ import java.util.Map; import static android.content.Context.MODE_PRIVATE; -import static com.wix.crypto.Constants.NUM_OF_DAYS; -import static com.wix.crypto.Constants.SECONDS_IN_DAY; /** * Created by hagai on 11/05/2020. @@ -222,7 +220,7 @@ public byte[] generateEphemeralId(int time, byte[] geoHash) EpochKey epochKey = null; if(!mEpochKeys.containsKey(t) && mEpochKeys.get(t) == null)// "Epoch key is not present"; { - this.updateKeyDatabase(time - NUM_OF_DAYS * SECONDS_IN_DAY, time); + this.updateKeyDatabase(time - Constants.NUM_OF_DAYS * Constants.SECONDS_IN_DAY, time); } epochKey = mEpochKeys.get(t); diff --git a/lib/android/src/main/java/com/wix/crypto/custom/Pair.java b/lib/android/src/main/java/moh/gov/il/crypto/custom/Pair.java similarity index 90% rename from lib/android/src/main/java/com/wix/crypto/custom/Pair.java rename to lib/android/src/main/java/moh/gov/il/crypto/custom/Pair.java index 418a728..b396f50 100644 --- a/lib/android/src/main/java/com/wix/crypto/custom/Pair.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/custom/Pair.java @@ -1,4 +1,4 @@ -package com.wix.crypto.custom; +package moh.gov.il.crypto.custom; /** * Created by hagai on 11/05/2020. diff --git a/lib/android/src/main/java/com/wix/crypto/custom/Triplet.java b/lib/android/src/main/java/moh/gov/il/crypto/custom/Triplet.java similarity index 92% rename from lib/android/src/main/java/com/wix/crypto/custom/Triplet.java rename to lib/android/src/main/java/moh/gov/il/crypto/custom/Triplet.java index 6dc81f0..03e5661 100644 --- a/lib/android/src/main/java/com/wix/crypto/custom/Triplet.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/custom/Triplet.java @@ -1,4 +1,4 @@ -package com.wix.crypto.custom; +package moh.gov.il.crypto.custom; /** * Created by hagai on 11/05/2020. diff --git a/lib/android/src/main/java/com/wix/crypto/key/DayKey.java b/lib/android/src/main/java/moh/gov/il/crypto/key/DayKey.java similarity index 89% rename from lib/android/src/main/java/com/wix/crypto/key/DayKey.java rename to lib/android/src/main/java/moh/gov/il/crypto/key/DayKey.java index 4bbbfbc..4d8f12f 100644 --- a/lib/android/src/main/java/com/wix/crypto/key/DayKey.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/key/DayKey.java @@ -1,7 +1,7 @@ -package com.wix.crypto.key; +package moh.gov.il.crypto.key; -import com.wix.crypto.utilities.BytesUtils; -import com.wix.crypto.utilities.DerivationUtils; +import moh.gov.il.crypto.utilities.BytesUtils; +import moh.gov.il.crypto.utilities.DerivationUtils; /** * Created by hagai on 11/05/2020. diff --git a/lib/android/src/main/java/com/wix/crypto/key/EpochKey.java b/lib/android/src/main/java/moh/gov/il/crypto/key/EpochKey.java similarity index 93% rename from lib/android/src/main/java/com/wix/crypto/key/EpochKey.java rename to lib/android/src/main/java/moh/gov/il/crypto/key/EpochKey.java index 2e83185..a134c94 100644 --- a/lib/android/src/main/java/com/wix/crypto/key/EpochKey.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/key/EpochKey.java @@ -1,10 +1,10 @@ -package com.wix.crypto.key; +package moh.gov.il.crypto.key; import com.google.gson.annotations.SerializedName; -import com.wix.crypto.Crypto; -import com.wix.crypto.utilities.Hex; -import com.wix.crypto.utilities.BytesUtils; -import com.wix.crypto.utilities.DerivationUtils; +import moh.gov.il.crypto.utilities.BytesUtils; +import moh.gov.il.crypto.utilities.DerivationUtils; +import moh.gov.il.crypto.Crypto; +import moh.gov.il.crypto.utilities.Hex; import org.json.JSONException; import org.json.JSONObject; diff --git a/lib/android/src/main/java/com/wix/crypto/key/UserKey.java b/lib/android/src/main/java/moh/gov/il/crypto/key/UserKey.java similarity index 94% rename from lib/android/src/main/java/com/wix/crypto/key/UserKey.java rename to lib/android/src/main/java/moh/gov/il/crypto/key/UserKey.java index e024874..b098cdd 100644 --- a/lib/android/src/main/java/com/wix/crypto/key/UserKey.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/key/UserKey.java @@ -1,6 +1,6 @@ -package com.wix.crypto.key; +package moh.gov.il.crypto.key; -import com.wix.crypto.custom.Triplet; +import moh.gov.il.crypto.custom.Triplet; import java.util.List; diff --git a/lib/android/src/main/java/com/wix/crypto/utilities/BytesUtils.java b/lib/android/src/main/java/moh/gov/il/crypto/utilities/BytesUtils.java similarity index 98% rename from lib/android/src/main/java/com/wix/crypto/utilities/BytesUtils.java rename to lib/android/src/main/java/moh/gov/il/crypto/utilities/BytesUtils.java index 9d0b7fe..153b864 100644 --- a/lib/android/src/main/java/com/wix/crypto/utilities/BytesUtils.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/utilities/BytesUtils.java @@ -1,4 +1,4 @@ -package com.wix.crypto.utilities; +package moh.gov.il.crypto.utilities; /** * Created by hagai on 11/05/2020. diff --git a/lib/android/src/main/java/com/wix/crypto/utilities/DerivationUtils.java b/lib/android/src/main/java/moh/gov/il/crypto/utilities/DerivationUtils.java similarity index 96% rename from lib/android/src/main/java/com/wix/crypto/utilities/DerivationUtils.java rename to lib/android/src/main/java/moh/gov/il/crypto/utilities/DerivationUtils.java index 1a5e70e..16669f4 100644 --- a/lib/android/src/main/java/com/wix/crypto/utilities/DerivationUtils.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/utilities/DerivationUtils.java @@ -1,8 +1,8 @@ -package com.wix.crypto.utilities; +package moh.gov.il.crypto.utilities; -import com.wix.crypto.Constants; -import com.wix.crypto.Crypto; -import com.wix.crypto.custom.Pair; +import moh.gov.il.crypto.Constants; +import moh.gov.il.crypto.Crypto; +import moh.gov.il.crypto.custom.Pair; import java.util.Arrays; diff --git a/lib/android/src/main/java/com/wix/crypto/utilities/Hex.java b/lib/android/src/main/java/moh/gov/il/crypto/utilities/Hex.java similarity index 99% rename from lib/android/src/main/java/com/wix/crypto/utilities/Hex.java rename to lib/android/src/main/java/moh/gov/il/crypto/utilities/Hex.java index bb49d55..7016669 100644 --- a/lib/android/src/main/java/com/wix/crypto/utilities/Hex.java +++ b/lib/android/src/main/java/moh/gov/il/crypto/utilities/Hex.java @@ -1,4 +1,4 @@ -package com.wix.crypto.utilities; +package moh.gov.il.crypto.utilities; /* diff --git a/lib/android/src/main/java/com/wix/specialble/BLEForegroundService.java b/lib/android/src/main/java/moh/gov/il/specialble/BLEForegroundService.java similarity index 93% rename from lib/android/src/main/java/com/wix/specialble/BLEForegroundService.java rename to lib/android/src/main/java/moh/gov/il/specialble/BLEForegroundService.java index 3cf8436..8f86959 100644 --- a/lib/android/src/main/java/com/wix/specialble/BLEForegroundService.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/BLEForegroundService.java @@ -1,4 +1,4 @@ -package com.wix.specialble; +package moh.gov.il.specialble; import android.app.ActivityManager; import android.app.AlarmManager; @@ -12,33 +12,30 @@ import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.net.Uri; import android.os.Build; import android.os.Handler; import android.os.IBinder; import android.os.PowerManager; import android.os.SystemClock; -import android.provider.Settings; import android.util.Log; -import android.widget.Toast; import androidx.annotation.Nullable; import androidx.core.app.NotificationCompat; -import com.wix.crypto.User; -import com.wix.specialble.bt.BLEManager; -import com.wix.specialble.config.Config; -import com.wix.specialble.receivers.AlarmReceiver; -import com.wix.specialble.util.PrefUtils; +import moh.gov.il.specialble.bt.BLEManager; +import moh.gov.il.specialble.util.PrefUtils; +import moh.gov.il.specialble.config.Config; +import moh.gov.il.specialble.receivers.AlarmReceiver; import java.io.IOException; import java.io.InputStream; -import static com.wix.specialble.receivers.AlarmReceiver.WAKE_ME_UP; -import static com.wix.specialble.receivers.AlarmReceiver.WAKE_ME_UP_AFTER_10; -import static com.wix.specialble.receivers.AlarmReceiver.WAKE_ME_UP_AFTER_5; -import static com.wix.specialble.receivers.AlarmReceiver.alarmInterval; -import static com.wix.specialble.receivers.AlarmReceiver.alarmInterval_after_10; -import static com.wix.specialble.receivers.AlarmReceiver.alarmInterval_after_5; + +import static moh.gov.il.specialble.receivers.AlarmReceiver.WAKE_ME_UP; +import static moh.gov.il.specialble.receivers.AlarmReceiver.WAKE_ME_UP_AFTER_10; +import static moh.gov.il.specialble.receivers.AlarmReceiver.WAKE_ME_UP_AFTER_5; +import static moh.gov.il.specialble.receivers.AlarmReceiver.alarmInterval; +import static moh.gov.il.specialble.receivers.AlarmReceiver.alarmInterval_after_10; +import static moh.gov.il.specialble.receivers.AlarmReceiver.alarmInterval_after_5; public class BLEForegroundService extends Service { public static final String CHANNEL_ID = "BLEForegroundServiceChannel"; diff --git a/lib/android/src/main/java/com/wix/specialble/BLEReceiver.java b/lib/android/src/main/java/moh/gov/il/specialble/BLEReceiver.java similarity index 86% rename from lib/android/src/main/java/com/wix/specialble/BLEReceiver.java rename to lib/android/src/main/java/moh/gov/il/specialble/BLEReceiver.java index dc01b0a..33719e9 100644 --- a/lib/android/src/main/java/com/wix/specialble/BLEReceiver.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/BLEReceiver.java @@ -1,12 +1,11 @@ -package com.wix.specialble; +package moh.gov.il.specialble; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; -import com.wix.specialble.config.Config; -import com.wix.specialble.util.PrefUtils; +import moh.gov.il.specialble.util.PrefUtils; /** * Currently filtering in only BOOT_COMPLETE and MY_PACKEGE_REPLACED. diff --git a/lib/android/src/main/java/com/wix/specialble/EventToJSDispatcher.java b/lib/android/src/main/java/moh/gov/il/specialble/EventToJSDispatcher.java similarity index 93% rename from lib/android/src/main/java/com/wix/specialble/EventToJSDispatcher.java rename to lib/android/src/main/java/moh/gov/il/specialble/EventToJSDispatcher.java index f21d989..d9a1bdc 100644 --- a/lib/android/src/main/java/com/wix/specialble/EventToJSDispatcher.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/EventToJSDispatcher.java @@ -1,4 +1,4 @@ -package com.wix.specialble; +package moh.gov.il.specialble; import android.util.Log; @@ -8,9 +8,9 @@ import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.WritableMap; import com.facebook.react.modules.core.DeviceEventManagerModule; -import com.wix.specialble.bt.Device; -import com.wix.specialble.bt.Scan; -import com.wix.specialble.listeners.IEventListener; +import moh.gov.il.specialble.bt.Device; +import moh.gov.il.specialble.bt.Scan; +import moh.gov.il.specialble.listeners.IEventListener; public class EventToJSDispatcher implements IEventListener { ReactApplicationContext context; diff --git a/lib/android/src/main/java/com/wix/specialble/SpecialBleModule.java b/lib/android/src/main/java/moh/gov/il/specialble/SpecialBleModule.java similarity index 90% rename from lib/android/src/main/java/com/wix/specialble/SpecialBleModule.java rename to lib/android/src/main/java/moh/gov/il/specialble/SpecialBleModule.java index f18b4c7..3e173d3 100644 --- a/lib/android/src/main/java/com/wix/specialble/SpecialBleModule.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/SpecialBleModule.java @@ -1,19 +1,15 @@ -package com.wix.specialble; +package moh.gov.il.specialble; import android.content.BroadcastReceiver; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; -import android.content.res.AssetManager; import android.net.Uri; import android.os.Build; import android.util.Log; -import android.widget.Toast; import androidx.annotation.RequiresApi; -import androidx.appcompat.app.AlertDialog; import androidx.core.content.FileProvider; import androidx.localbroadcastmanager.content.LocalBroadcastManager; @@ -28,49 +24,26 @@ import com.facebook.react.bridge.WritableMap; import com.facebook.react.bridge.WritableNativeArray; import com.facebook.react.bridge.WritableNativeMap; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; -import com.wix.crypto.Contact; -import com.wix.crypto.Crypto; -import com.wix.crypto.CryptoManager; -import com.wix.crypto.Match; -import com.wix.crypto.MatchResponse; -import com.wix.crypto.User; -import com.wix.crypto.utilities.BytesUtils; -import com.wix.crypto.utilities.DerivationUtils; -import com.wix.crypto.utilities.Hex; -import com.wix.specialble.activities.BatteryOptimizationHolderActivity; -import com.wix.specialble.bt.BLEManager; -import com.wix.specialble.bt.Device; -import com.wix.specialble.bt.Scan; -import com.wix.specialble.config.Config; -import com.wix.specialble.db.DBClient; -import com.wix.specialble.kays.PublicKey; -import com.wix.specialble.util.CSVUtil; -import com.wix.specialble.util.DeviceUtil; -import com.wix.specialble.util.ParseUtils; -import com.wix.specialble.util.PrefUtils; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.io.BufferedReader; + +import moh.gov.il.specialble.bt.BLEManager; +import moh.gov.il.specialble.bt.Device; +import moh.gov.il.specialble.bt.Scan; +import moh.gov.il.specialble.db.DBClient; +import moh.gov.il.specialble.kays.PublicKey; +import moh.gov.il.specialble.util.PrefUtils; +import moh.gov.il.crypto.CryptoManager; +import moh.gov.il.crypto.MatchResponse; +import moh.gov.il.specialble.activities.BatteryOptimizationHolderActivity; +import moh.gov.il.specialble.config.Config; +import moh.gov.il.specialble.util.CSVUtil; +import moh.gov.il.specialble.util.DeviceUtil; +import moh.gov.il.specialble.util.ParseUtils; + import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.lang.reflect.Type; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.wix.crypto.Constants.NUM_OF_EPOCHS; - public class SpecialBleModule extends ReactContextBaseJavaModule { diff --git a/lib/android/src/main/java/com/wix/specialble/SpecialBlePackage.java b/lib/android/src/main/java/moh/gov/il/specialble/SpecialBlePackage.java similarity index 95% rename from lib/android/src/main/java/com/wix/specialble/SpecialBlePackage.java rename to lib/android/src/main/java/moh/gov/il/specialble/SpecialBlePackage.java index 78695a7..47da355 100644 --- a/lib/android/src/main/java/com/wix/specialble/SpecialBlePackage.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/SpecialBlePackage.java @@ -1,4 +1,4 @@ -package com.wix.specialble; +package moh.gov.il.specialble; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.NativeModule; diff --git a/lib/android/src/main/java/com/wix/specialble/activities/BatteryOptimizationHolderActivity.java b/lib/android/src/main/java/moh/gov/il/specialble/activities/BatteryOptimizationHolderActivity.java similarity index 93% rename from lib/android/src/main/java/com/wix/specialble/activities/BatteryOptimizationHolderActivity.java rename to lib/android/src/main/java/moh/gov/il/specialble/activities/BatteryOptimizationHolderActivity.java index c3f96b7..cc070c4 100644 --- a/lib/android/src/main/java/com/wix/specialble/activities/BatteryOptimizationHolderActivity.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/activities/BatteryOptimizationHolderActivity.java @@ -1,4 +1,4 @@ -package com.wix.specialble.activities; +package moh.gov.il.specialble.activities; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -8,7 +8,7 @@ import android.os.Bundle; import android.util.Log; -import com.wix.specialble.util.DeviceUtil; +import moh.gov.il.specialble.util.DeviceUtil; public class BatteryOptimizationHolderActivity extends AppCompatActivity { diff --git a/lib/android/src/main/java/com/wix/specialble/bt/BLEAdvertisingManager.java b/lib/android/src/main/java/moh/gov/il/specialble/bt/BLEAdvertisingManager.java similarity index 81% rename from lib/android/src/main/java/com/wix/specialble/bt/BLEAdvertisingManager.java rename to lib/android/src/main/java/moh/gov/il/specialble/bt/BLEAdvertisingManager.java index d7ad2e6..74d2a5b 100644 --- a/lib/android/src/main/java/com/wix/specialble/bt/BLEAdvertisingManager.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/bt/BLEAdvertisingManager.java @@ -1,4 +1,4 @@ -package com.wix.specialble.bt; +package moh.gov.il.specialble.bt; import android.bluetooth.BluetoothAdapter; import android.bluetooth.le.AdvertiseCallback; @@ -10,12 +10,14 @@ import android.os.ParcelUuid; import android.util.Log; -import com.wix.crypto.CryptoManager; -import com.wix.specialble.config.Config; -import com.wix.specialble.db.DBClient; -import com.wix.specialble.listeners.IEventListener; -import com.wix.specialble.sensor.SensorUtils; -import com.wix.specialble.util.Constants; +import moh.gov.il.specialble.BuildConfig; + +import moh.gov.il.crypto.CryptoManager; +import moh.gov.il.specialble.config.Config; +import moh.gov.il.specialble.db.DBClient; +import moh.gov.il.specialble.listeners.IEventListener; +import moh.gov.il.specialble.sensor.SensorUtils; +import moh.gov.il.specialble.util.Constants; import java.util.UUID; public class BLEAdvertisingManager { @@ -32,8 +34,9 @@ public class BLEAdvertisingManager { @Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { super.onStartSuccess(settingsInEffect); - - insertToDb(new Event(System.currentTimeMillis(), Config.getInstance(mContext).getToken(), Constants.ACTION_ADVERTISE, Constants.ADVERTISE_SUCCESS, "", SensorUtils.getBatteryPercentage(mContext))); + + if(BuildConfig.DEBUG) + insertToDb(new Event(System.currentTimeMillis(), Config.getInstance(mContext).getToken(), Constants.ACTION_ADVERTISE, Constants.ADVERTISE_SUCCESS, "", SensorUtils.getBatteryPercentage(mContext))); mEventListenerCallback.onEvent(BLEAdvertisingManager.ADVERTISING_STATUS, true); } @@ -42,7 +45,8 @@ public void onStartSuccess(AdvertiseSettings settingsInEffect) { public void onStartFailure(int errorCode) { super.onStartFailure(errorCode); - insertToDb(new Event(System.currentTimeMillis(), Config.getInstance(mContext).getToken(), Constants.ACTION_ADVERTISE, Constants.ADVERTISE_FAIL, "error code: " + errorCode, SensorUtils.getBatteryPercentage(mContext))); + if(BuildConfig.DEBUG) + insertToDb(new Event(System.currentTimeMillis(), Config.getInstance(mContext).getToken(), Constants.ACTION_ADVERTISE, Constants.ADVERTISE_FAIL, "error code: " + errorCode, SensorUtils.getBatteryPercentage(mContext))); mEventListenerCallback.onEvent(ADVERTISING_STATUS, errorCode == ADVERTISE_FAILED_ALREADY_STARTED); Log.d(TAG, "onAdvertiseStartFailed - ErrorCode: " + errorCode); diff --git a/lib/android/src/main/java/com/wix/specialble/bt/BLEManager.java b/lib/android/src/main/java/moh/gov/il/specialble/bt/BLEManager.java similarity index 91% rename from lib/android/src/main/java/com/wix/specialble/bt/BLEManager.java rename to lib/android/src/main/java/moh/gov/il/specialble/bt/BLEManager.java index ea94a25..8ff51f4 100644 --- a/lib/android/src/main/java/com/wix/specialble/bt/BLEManager.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/bt/BLEManager.java @@ -1,16 +1,16 @@ -package com.wix.specialble.bt; +package moh.gov.il.specialble.bt; import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.util.Log; -import com.wix.crypto.Contact; -import com.wix.specialble.EventToJSDispatcher; -import com.wix.specialble.config.Config; -import com.wix.specialble.db.DBClient; -import com.wix.specialble.listeners.IEventListener; -import com.wix.specialble.util.Constants; +import moh.gov.il.specialble.db.DBClient; +import moh.gov.il.crypto.Contact; +import moh.gov.il.specialble.EventToJSDispatcher; +import moh.gov.il.specialble.config.Config; +import moh.gov.il.specialble.listeners.IEventListener; +import moh.gov.il.specialble.util.Constants; import java.util.List; diff --git a/lib/android/src/main/java/com/wix/specialble/bt/BLEScannerManager.java b/lib/android/src/main/java/moh/gov/il/specialble/bt/BLEScannerManager.java similarity index 75% rename from lib/android/src/main/java/com/wix/specialble/bt/BLEScannerManager.java rename to lib/android/src/main/java/moh/gov/il/specialble/bt/BLEScannerManager.java index b242647..fc0ea50 100644 --- a/lib/android/src/main/java/com/wix/specialble/bt/BLEScannerManager.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/bt/BLEScannerManager.java @@ -1,4 +1,4 @@ -package com.wix.specialble.bt; +package moh.gov.il.specialble.bt; import android.Manifest; import android.bluetooth.BluetoothAdapter; @@ -17,16 +17,19 @@ import android.os.ParcelUuid; import android.util.Log; import androidx.core.app.ActivityCompat; -import com.wix.crypto.CryptoManager; -import com.wix.crypto.utilities.BytesUtils; -import com.wix.specialble.config.Config; -import com.wix.specialble.db.DBClient; -import com.wix.specialble.listeners.IEventListener; -import com.wix.specialble.sensor.AccelerometerManager; -import com.wix.specialble.sensor.ProximityManager; -import com.wix.specialble.sensor.RotationVectorManager; -import com.wix.specialble.sensor.SensorUtils; -import com.wix.specialble.util.Constants; + +import moh.gov.il.specialble.BuildConfig; + +import moh.gov.il.specialble.db.DBClient; +import moh.gov.il.crypto.CryptoManager; +import moh.gov.il.crypto.utilities.BytesUtils; +import moh.gov.il.specialble.config.Config; +import moh.gov.il.specialble.listeners.IEventListener; +import moh.gov.il.specialble.sensor.AccelerometerManager; +import moh.gov.il.specialble.sensor.ProximityManager; +import moh.gov.il.specialble.sensor.RotationVectorManager; +import moh.gov.il.specialble.sensor.SensorUtils; +import moh.gov.il.specialble.util.Constants; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.UUID; @@ -143,12 +146,17 @@ public void onScanFailed(final int errorCode) { if (errorCode != SCAN_FAILED_ALREADY_STARTED) { mEventListenerCallback.onEvent(SCANNING_STATUS, false); } - AsyncTask.execute(new Runnable() { - @Override - public void run() { - DBClient.getInstance(mContext).insert(new Event(System.currentTimeMillis(), "none", Constants.ACTION_SCAN, "failure", String.valueOf(errorCode), SensorUtils.getBatteryPercentage(mContext))); - } - }); + + if(BuildConfig.DEBUG) { + + AsyncTask.execute(new Runnable() { + + @Override + public void run() { + DBClient.getInstance(mContext).insert(new Event(System.currentTimeMillis(), "none", Constants.ACTION_SCAN, "failure", String.valueOf(errorCode), SensorUtils.getBatteryPercentage(mContext))); + } + }); + } } } @@ -157,32 +165,39 @@ private void handleScanResults(final ScanResult result, final String scannedToke AsyncTask.execute(new Runnable() { @Override public void run() { - DBClient.getInstance(mContext).insert(new Event(System.currentTimeMillis(), scannedToken, Constants.ACTION_SCAN, "success", "", SensorUtils.getBatteryPercentage(mContext))); - Device oldDevice = dbClient.getDeviceByKey(scannedToken); // get device from database - Device newDevice; + if(BuildConfig.DEBUG) { - if (oldDevice != null) { - newDevice = getNewDevice(result, tx, scannedToken, oldDevice.getFirstTimestamp(), System.currentTimeMillis()); - if (hasUpdateRequirements(oldDevice, result)) { - dbClient.updateDevice(newDevice); + DBClient.getInstance(mContext).insert(new Event(System.currentTimeMillis(), scannedToken, Constants.ACTION_SCAN, "success", "", SensorUtils.getBatteryPercentage(mContext))); + + Device oldDevice = dbClient.getDeviceByKey(scannedToken); // get device from database + Device newDevice; + + if (oldDevice != null) { + newDevice = getNewDevice(result, tx, scannedToken, oldDevice.getFirstTimestamp(), System.currentTimeMillis()); + if (hasUpdateRequirements(oldDevice, result)) { + dbClient.updateDevice(newDevice); + } + } else { + newDevice = getNewDevice(result, tx, scannedToken, System.currentTimeMillis(), System.currentTimeMillis()); + dbClient.addDevice(newDevice); } - } else { - newDevice = getNewDevice(result, tx, scannedToken, System.currentTimeMillis(), System.currentTimeMillis()); - dbClient.addDevice(newDevice); - } - mEventListenerCallback.onEvent(FOUND_DEVICE, newDevice.toWritableMap()); + mEventListenerCallback.onEvent(FOUND_DEVICE, newDevice.toWritableMap()); - // handle scans - Scan newScan = new Scan(System.currentTimeMillis(), - scannedToken, - result.getDevice().getAddress(), - BLEManager.BLEProtocol.GAP.toString(), - result.getRssi(), - tx, mProximityManager.getEvents()[0], mAccelerometerManager.getEvents(), mRotationVectorManager.getEvents(), SensorUtils.getBatteryPercentage(mContext)); + // handle scans + Scan newScan = new Scan(System.currentTimeMillis(), + scannedToken, + result.getDevice().getAddress(), + BLEManager.BLEProtocol.GAP.toString(), + result.getRssi(), + tx, mProximityManager.getEvents()[0], mAccelerometerManager.getEvents(), mRotationVectorManager.getEvents(), SensorUtils.getBatteryPercentage(mContext)); + + dbClient.addScan(newScan); + + mEventListenerCallback.onEvent(FOUND_SCAN, newScan.toWritableMap()); + } - dbClient.addScan(newScan); int currentTime = (int) (System.currentTimeMillis() / 1000); @@ -217,7 +232,6 @@ public void run() { //TODO:: do we need to make sure our key is exactly 16 byte len as per the spec ? CryptoManager.getInstance(mContext).mySelf.storeContact(byteScannedToken, rssi, currentTime, sGeoHash, lat, lon); - mEventListenerCallback.onEvent(FOUND_SCAN, newScan.toWritableMap()); } }); } diff --git a/lib/android/src/main/java/com/wix/specialble/bt/Device.java b/lib/android/src/main/java/moh/gov/il/specialble/bt/Device.java similarity index 98% rename from lib/android/src/main/java/com/wix/specialble/bt/Device.java rename to lib/android/src/main/java/moh/gov/il/specialble/bt/Device.java index bf1fc6c..076d923 100644 --- a/lib/android/src/main/java/com/wix/specialble/bt/Device.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/bt/Device.java @@ -1,4 +1,4 @@ -package com.wix.specialble.bt; +package moh.gov.il.specialble.bt; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; diff --git a/lib/android/src/main/java/com/wix/specialble/bt/Event.java b/lib/android/src/main/java/moh/gov/il/specialble/bt/Event.java similarity index 98% rename from lib/android/src/main/java/com/wix/specialble/bt/Event.java rename to lib/android/src/main/java/moh/gov/il/specialble/bt/Event.java index b327743..d61748c 100644 --- a/lib/android/src/main/java/com/wix/specialble/bt/Event.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/bt/Event.java @@ -1,4 +1,4 @@ -package com.wix.specialble.bt; +package moh.gov.il.specialble.bt; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; diff --git a/lib/android/src/main/java/com/wix/specialble/bt/Scan.java b/lib/android/src/main/java/moh/gov/il/specialble/bt/Scan.java similarity index 99% rename from lib/android/src/main/java/com/wix/specialble/bt/Scan.java rename to lib/android/src/main/java/moh/gov/il/specialble/bt/Scan.java index 4a63f3e..4503c81 100644 --- a/lib/android/src/main/java/com/wix/specialble/bt/Scan.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/bt/Scan.java @@ -1,6 +1,4 @@ -package com.wix.specialble.bt; - -import android.util.Log; +package moh.gov.il.specialble.bt; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; diff --git a/lib/android/src/main/java/com/wix/specialble/config/Config.java b/lib/android/src/main/java/moh/gov/il/specialble/config/Config.java similarity index 99% rename from lib/android/src/main/java/com/wix/specialble/config/Config.java rename to lib/android/src/main/java/moh/gov/il/specialble/config/Config.java index 53b14d5..6de3a5f 100644 --- a/lib/android/src/main/java/com/wix/specialble/config/Config.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/config/Config.java @@ -1,4 +1,4 @@ -package com.wix.specialble.config; +package moh.gov.il.specialble.config; import android.bluetooth.le.AdvertiseSettings; import android.bluetooth.le.ScanSettings; diff --git a/lib/android/src/main/java/com/wix/specialble/db/ContactDao.java b/lib/android/src/main/java/moh/gov/il/specialble/db/ContactDao.java similarity index 93% rename from lib/android/src/main/java/com/wix/specialble/db/ContactDao.java rename to lib/android/src/main/java/moh/gov/il/specialble/db/ContactDao.java index a2a5d38..de4fdc8 100644 --- a/lib/android/src/main/java/com/wix/specialble/db/ContactDao.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/db/ContactDao.java @@ -1,4 +1,4 @@ -package com.wix.specialble.db; +package moh.gov.il.specialble.db; import android.database.Cursor; @@ -8,7 +8,7 @@ import androidx.room.OnConflictStrategy; import androidx.room.Query; -import com.wix.crypto.Contact; +import moh.gov.il.crypto.Contact; import java.util.List; diff --git a/lib/android/src/main/java/com/wix/specialble/db/DBClient.java b/lib/android/src/main/java/moh/gov/il/specialble/db/DBClient.java similarity index 94% rename from lib/android/src/main/java/com/wix/specialble/db/DBClient.java rename to lib/android/src/main/java/moh/gov/il/specialble/db/DBClient.java index 320770d..7d817e9 100644 --- a/lib/android/src/main/java/com/wix/specialble/db/DBClient.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/db/DBClient.java @@ -1,15 +1,15 @@ -package com.wix.specialble.db; +package moh.gov.il.specialble.db; import android.content.Context; import android.database.Cursor; import androidx.room.Room; -import com.wix.crypto.Contact; -import com.wix.specialble.bt.Device; -import com.wix.specialble.bt.Event; -import com.wix.specialble.bt.Scan; -import com.wix.specialble.kays.PublicKey; +import moh.gov.il.specialble.bt.Device; +import moh.gov.il.specialble.kays.PublicKey; +import moh.gov.il.crypto.Contact; +import moh.gov.il.specialble.bt.Event; +import moh.gov.il.specialble.bt.Scan; import java.util.List; diff --git a/lib/android/src/main/java/com/wix/specialble/db/DeviceDao.java b/lib/android/src/main/java/moh/gov/il/specialble/db/DeviceDao.java similarity index 91% rename from lib/android/src/main/java/com/wix/specialble/db/DeviceDao.java rename to lib/android/src/main/java/moh/gov/il/specialble/db/DeviceDao.java index 2f808df..8db2d17 100644 --- a/lib/android/src/main/java/com/wix/specialble/db/DeviceDao.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/db/DeviceDao.java @@ -1,4 +1,4 @@ -package com.wix.specialble.db; +package moh.gov.il.specialble.db; import androidx.room.Dao; import androidx.room.Delete; @@ -6,7 +6,7 @@ import androidx.room.Query; import androidx.room.Update; -import com.wix.specialble.bt.Device; +import moh.gov.il.specialble.bt.Device; import java.util.List; diff --git a/lib/android/src/main/java/com/wix/specialble/db/EventDao.java b/lib/android/src/main/java/moh/gov/il/specialble/db/EventDao.java similarity index 90% rename from lib/android/src/main/java/com/wix/specialble/db/EventDao.java rename to lib/android/src/main/java/moh/gov/il/specialble/db/EventDao.java index 5d81acd..9978f4a 100644 --- a/lib/android/src/main/java/com/wix/specialble/db/EventDao.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/db/EventDao.java @@ -1,4 +1,4 @@ -package com.wix.specialble.db; +package moh.gov.il.specialble.db; import androidx.room.Dao; import androidx.room.Delete; @@ -6,7 +6,7 @@ import androidx.room.Query; import androidx.room.Update; -import com.wix.specialble.bt.Event; +import moh.gov.il.specialble.bt.Event; import java.util.List; diff --git a/lib/android/src/main/java/com/wix/specialble/db/PublicKeyDao.java b/lib/android/src/main/java/moh/gov/il/specialble/db/PublicKeyDao.java similarity index 87% rename from lib/android/src/main/java/com/wix/specialble/db/PublicKeyDao.java rename to lib/android/src/main/java/moh/gov/il/specialble/db/PublicKeyDao.java index d1dd4cb..476b237 100644 --- a/lib/android/src/main/java/com/wix/specialble/db/PublicKeyDao.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/db/PublicKeyDao.java @@ -1,4 +1,4 @@ -package com.wix.specialble.db; +package moh.gov.il.specialble.db; import androidx.room.Dao; import androidx.room.Delete; @@ -6,7 +6,7 @@ import androidx.room.Query; import androidx.room.Update; -import com.wix.specialble.kays.PublicKey; +import moh.gov.il.specialble.kays.PublicKey; import java.util.List; diff --git a/lib/android/src/main/java/com/wix/specialble/db/PublicKeysDatabase.java b/lib/android/src/main/java/moh/gov/il/specialble/db/PublicKeysDatabase.java similarity index 75% rename from lib/android/src/main/java/com/wix/specialble/db/PublicKeysDatabase.java rename to lib/android/src/main/java/moh/gov/il/specialble/db/PublicKeysDatabase.java index db582ab..f777b11 100644 --- a/lib/android/src/main/java/com/wix/specialble/db/PublicKeysDatabase.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/db/PublicKeysDatabase.java @@ -1,9 +1,9 @@ -package com.wix.specialble.db; +package moh.gov.il.specialble.db; import androidx.room.Database; import androidx.room.RoomDatabase; -import com.wix.specialble.kays.PublicKey; +import moh.gov.il.specialble.kays.PublicKey; @Database(entities = {PublicKey.class}, version = 1) public abstract class PublicKeysDatabase extends RoomDatabase { diff --git a/lib/android/src/main/java/com/wix/specialble/db/ScanDao.java b/lib/android/src/main/java/moh/gov/il/specialble/db/ScanDao.java similarity index 89% rename from lib/android/src/main/java/com/wix/specialble/db/ScanDao.java rename to lib/android/src/main/java/moh/gov/il/specialble/db/ScanDao.java index edac4d9..5d6978f 100644 --- a/lib/android/src/main/java/com/wix/specialble/db/ScanDao.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/db/ScanDao.java @@ -1,4 +1,4 @@ -package com.wix.specialble.db; +package moh.gov.il.specialble.db; import androidx.room.Dao; import androidx.room.Delete; @@ -6,7 +6,7 @@ import androidx.room.Query; import androidx.room.Update; -import com.wix.specialble.bt.Scan; +import moh.gov.il.specialble.bt.Scan; import java.util.List; diff --git a/lib/android/src/main/java/com/wix/specialble/db/SpecialBLEDatabase.java b/lib/android/src/main/java/moh/gov/il/specialble/db/SpecialBLEDatabase.java similarity index 69% rename from lib/android/src/main/java/com/wix/specialble/db/SpecialBLEDatabase.java rename to lib/android/src/main/java/moh/gov/il/specialble/db/SpecialBLEDatabase.java index 10ff6f0..513be7c 100644 --- a/lib/android/src/main/java/com/wix/specialble/db/SpecialBLEDatabase.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/db/SpecialBLEDatabase.java @@ -1,11 +1,11 @@ -package com.wix.specialble.db; +package moh.gov.il.specialble.db; import androidx.room.Database; import androidx.room.RoomDatabase; -import com.wix.crypto.Contact; -import com.wix.specialble.bt.Device; -import com.wix.specialble.bt.Event; -import com.wix.specialble.bt.Scan; +import moh.gov.il.crypto.Contact; +import moh.gov.il.specialble.bt.Device; +import moh.gov.il.specialble.bt.Event; +import moh.gov.il.specialble.bt.Scan; @Database(entities = {Device.class, Scan.class, Contact.class, Event.class}, version = 6, exportSchema = true) public abstract class SpecialBLEDatabase extends RoomDatabase { diff --git a/lib/android/src/main/java/com/wix/specialble/kays/PublicKey.java b/lib/android/src/main/java/moh/gov/il/specialble/kays/PublicKey.java similarity index 94% rename from lib/android/src/main/java/com/wix/specialble/kays/PublicKey.java rename to lib/android/src/main/java/moh/gov/il/specialble/kays/PublicKey.java index db08b0e..93266b8 100644 --- a/lib/android/src/main/java/com/wix/specialble/kays/PublicKey.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/kays/PublicKey.java @@ -1,4 +1,4 @@ -package com.wix.specialble.kays; +package moh.gov.il.specialble.kays; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; diff --git a/lib/android/src/main/java/com/wix/specialble/listeners/IEventListener.java b/lib/android/src/main/java/moh/gov/il/specialble/listeners/IEventListener.java similarity index 66% rename from lib/android/src/main/java/com/wix/specialble/listeners/IEventListener.java rename to lib/android/src/main/java/moh/gov/il/specialble/listeners/IEventListener.java index 13aac46..b7db3c3 100644 --- a/lib/android/src/main/java/com/wix/specialble/listeners/IEventListener.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/listeners/IEventListener.java @@ -1,4 +1,4 @@ -package com.wix.specialble.listeners; +package moh.gov.il.specialble.listeners; public interface IEventListener { void onEvent(String event, Object data); diff --git a/lib/android/src/main/java/com/wix/specialble/listeners/ISensorListener.java b/lib/android/src/main/java/moh/gov/il/specialble/listeners/ISensorListener.java similarity index 80% rename from lib/android/src/main/java/com/wix/specialble/listeners/ISensorListener.java rename to lib/android/src/main/java/moh/gov/il/specialble/listeners/ISensorListener.java index 5506ab3..4d59de9 100644 --- a/lib/android/src/main/java/com/wix/specialble/listeners/ISensorListener.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/listeners/ISensorListener.java @@ -1,4 +1,4 @@ -package com.wix.specialble.listeners; +package moh.gov.il.specialble.listeners; import android.hardware.SensorEventListener; diff --git a/lib/android/src/main/java/com/wix/specialble/receivers/AlarmReceiver.java b/lib/android/src/main/java/moh/gov/il/specialble/receivers/AlarmReceiver.java similarity index 89% rename from lib/android/src/main/java/com/wix/specialble/receivers/AlarmReceiver.java rename to lib/android/src/main/java/moh/gov/il/specialble/receivers/AlarmReceiver.java index 6ec632b..1157c78 100644 --- a/lib/android/src/main/java/com/wix/specialble/receivers/AlarmReceiver.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/receivers/AlarmReceiver.java @@ -1,19 +1,15 @@ -package com.wix.specialble.receivers; +package moh.gov.il.specialble.receivers; -import android.app.ActivityManager; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Build; -import android.os.Handler; import android.os.SystemClock; -import android.util.Log; -import com.wix.specialble.BLEForegroundService; -import com.wix.specialble.util.CSVUtil; -import com.wix.specialble.util.PrefUtils; +import moh.gov.il.specialble.BLEForegroundService; +import moh.gov.il.specialble.util.PrefUtils; /** * Created by hagai on 30/04/2020. diff --git a/lib/android/src/main/java/com/wix/specialble/sensor/AccelerometerManager.java b/lib/android/src/main/java/moh/gov/il/specialble/sensor/AccelerometerManager.java similarity index 94% rename from lib/android/src/main/java/com/wix/specialble/sensor/AccelerometerManager.java rename to lib/android/src/main/java/moh/gov/il/specialble/sensor/AccelerometerManager.java index f10df1e..76c524c 100644 --- a/lib/android/src/main/java/com/wix/specialble/sensor/AccelerometerManager.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/sensor/AccelerometerManager.java @@ -1,11 +1,11 @@ -package com.wix.specialble.sensor; +package moh.gov.il.specialble.sensor; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorManager; import android.util.Log; -import com.wix.specialble.listeners.ISensorListener; +import moh.gov.il.specialble.listeners.ISensorListener; public class AccelerometerManager implements ISensorListener { diff --git a/lib/android/src/main/java/com/wix/specialble/sensor/ProximityManager.java b/lib/android/src/main/java/moh/gov/il/specialble/sensor/ProximityManager.java similarity index 94% rename from lib/android/src/main/java/com/wix/specialble/sensor/ProximityManager.java rename to lib/android/src/main/java/moh/gov/il/specialble/sensor/ProximityManager.java index 3c6fb4d..8812ab9 100644 --- a/lib/android/src/main/java/com/wix/specialble/sensor/ProximityManager.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/sensor/ProximityManager.java @@ -1,11 +1,11 @@ -package com.wix.specialble.sensor; +package moh.gov.il.specialble.sensor; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorManager; import android.util.Log; -import com.wix.specialble.listeners.ISensorListener; +import moh.gov.il.specialble.listeners.ISensorListener; public class ProximityManager implements ISensorListener { diff --git a/lib/android/src/main/java/com/wix/specialble/sensor/RotationVectorManager.java b/lib/android/src/main/java/moh/gov/il/specialble/sensor/RotationVectorManager.java similarity index 94% rename from lib/android/src/main/java/com/wix/specialble/sensor/RotationVectorManager.java rename to lib/android/src/main/java/moh/gov/il/specialble/sensor/RotationVectorManager.java index 5b333ee..6843f20 100644 --- a/lib/android/src/main/java/com/wix/specialble/sensor/RotationVectorManager.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/sensor/RotationVectorManager.java @@ -1,11 +1,11 @@ -package com.wix.specialble.sensor; +package moh.gov.il.specialble.sensor; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorManager; import android.util.Log; -import com.wix.specialble.listeners.ISensorListener; +import moh.gov.il.specialble.listeners.ISensorListener; public class RotationVectorManager implements ISensorListener { diff --git a/lib/android/src/main/java/com/wix/specialble/sensor/SensorUtils.java b/lib/android/src/main/java/moh/gov/il/specialble/sensor/SensorUtils.java similarity index 97% rename from lib/android/src/main/java/com/wix/specialble/sensor/SensorUtils.java rename to lib/android/src/main/java/moh/gov/il/specialble/sensor/SensorUtils.java index b06ef95..d21900d 100644 --- a/lib/android/src/main/java/com/wix/specialble/sensor/SensorUtils.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/sensor/SensorUtils.java @@ -1,4 +1,4 @@ -package com.wix.specialble.sensor; +package moh.gov.il.specialble.sensor; import android.content.Context; import android.content.Intent; diff --git a/lib/android/src/main/java/com/wix/specialble/util/CSVUtil.java b/lib/android/src/main/java/moh/gov/il/specialble/util/CSVUtil.java similarity index 97% rename from lib/android/src/main/java/com/wix/specialble/util/CSVUtil.java rename to lib/android/src/main/java/moh/gov/il/specialble/util/CSVUtil.java index a9852bd..ea24cf1 100644 --- a/lib/android/src/main/java/com/wix/specialble/util/CSVUtil.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/util/CSVUtil.java @@ -1,14 +1,14 @@ -package com.wix.specialble.util; +package moh.gov.il.specialble.util; import android.content.Context; import androidx.core.content.ContextCompat; import com.facebook.common.util.Hex; -import com.wix.crypto.Contact; -import com.wix.specialble.bt.Device; -import com.wix.specialble.bt.Scan; -import com.wix.specialble.bt.Event; +import moh.gov.il.crypto.Contact; +import moh.gov.il.specialble.bt.Device; +import moh.gov.il.specialble.bt.Event; +import moh.gov.il.specialble.bt.Scan; import java.io.File; import java.io.FileOutputStream; diff --git a/lib/android/src/main/java/com/wix/specialble/util/Constants.java b/lib/android/src/main/java/moh/gov/il/specialble/util/Constants.java similarity index 88% rename from lib/android/src/main/java/com/wix/specialble/util/Constants.java rename to lib/android/src/main/java/moh/gov/il/specialble/util/Constants.java index b31e38f..7627094 100644 --- a/lib/android/src/main/java/com/wix/specialble/util/Constants.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/util/Constants.java @@ -1,4 +1,4 @@ -package com.wix.specialble.util; +package moh.gov.il.specialble.util; public class Constants { diff --git a/lib/android/src/main/java/com/wix/specialble/util/DeviceUtil.java b/lib/android/src/main/java/moh/gov/il/specialble/util/DeviceUtil.java similarity index 98% rename from lib/android/src/main/java/com/wix/specialble/util/DeviceUtil.java rename to lib/android/src/main/java/moh/gov/il/specialble/util/DeviceUtil.java index 53094d4..dcdf0e8 100644 --- a/lib/android/src/main/java/com/wix/specialble/util/DeviceUtil.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/util/DeviceUtil.java @@ -1,4 +1,4 @@ -package com.wix.specialble.util; +package moh.gov.il.specialble.util; import android.app.Activity; import android.app.AlertDialog; @@ -16,7 +16,7 @@ import androidx.core.content.ContextCompat; -import com.wix.specialble.R; +import moh.gov.il.specialble.R; public class DeviceUtil { private static final String TAG = DeviceUtil.class.getSimpleName(); diff --git a/lib/android/src/main/java/com/wix/specialble/util/ParseUtils.java b/lib/android/src/main/java/moh/gov/il/specialble/util/ParseUtils.java similarity index 87% rename from lib/android/src/main/java/com/wix/specialble/util/ParseUtils.java rename to lib/android/src/main/java/moh/gov/il/specialble/util/ParseUtils.java index 2170330..eda3e94 100644 --- a/lib/android/src/main/java/com/wix/specialble/util/ParseUtils.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/util/ParseUtils.java @@ -1,36 +1,23 @@ -package com.wix.specialble.util; +package moh.gov.il.specialble.util; -import android.Manifest; import android.content.Context; -import android.content.pm.PackageManager; -import android.location.Location; -import android.location.LocationManager; -import androidx.core.app.ActivityCompat; - -import com.wix.crypto.Contact; -import com.wix.crypto.Match; -import com.wix.crypto.MatchResponse; -import com.wix.crypto.utilities.BytesUtils; -import com.wix.crypto.utilities.Hex; -import com.wix.specialble.R; -import com.wix.specialble.db.DBClient; +import moh.gov.il.crypto.Constants; +import moh.gov.il.crypto.Contact; +import moh.gov.il.crypto.MatchResponse; +import moh.gov.il.crypto.utilities.BytesUtils; +import moh.gov.il.crypto.utilities.Hex; +import moh.gov.il.specialble.db.DBClient; import org.json.JSONArray; import org.json.JSONObject; -import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.wix.crypto.Constants.NUM_OF_DAYS; -import static com.wix.crypto.Constants.NUM_OF_EPOCHS; - /** * Created by hagai on 17/05/2020. */ @@ -47,7 +34,7 @@ public static String infectedDbToJson(Map