diff --git a/android_app/app/src/main/java/com/health/openscale/core/OpenScale.java b/android_app/app/src/main/java/com/health/openscale/core/OpenScale.java
index b4e4164f..a892934f 100644
--- a/android_app/app/src/main/java/com/health/openscale/core/OpenScale.java
+++ b/android_app/app/src/main/java/com/health/openscale/core/OpenScale.java
@@ -69,6 +69,7 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.room.Room;
import androidx.room.RoomDatabase;
@@ -332,6 +333,7 @@ public class OpenScale {
runUiToastMsg(infoText);
}
+ syncInsertMeasurement(scaleMeasurement);
alarmHandler.entryChanged(context, scaleMeasurement);
updateScaleData();
triggerWidgetUpdate();
@@ -389,6 +391,7 @@ public class OpenScale {
Timber.d("Update measurement: %s", scaleMeasurement);
measurementDAO.update(scaleMeasurement);
alarmHandler.entryChanged(context, scaleMeasurement);
+ syncUpdateMeasurement(scaleMeasurement);
updateScaleData();
triggerWidgetUpdate();
@@ -396,6 +399,7 @@ public class OpenScale {
public void deleteScaleData(int id)
{
+ syncDeleteMeasurement(measurementDAO.get(id).getDateTime());
measurementDAO.delete(id);
updateScaleData();
@@ -666,4 +670,32 @@ public class OpenScale {
}
});
}
+
+ private void syncInsertMeasurement(ScaleMeasurement scaleMeasurement) {
+ Intent intent = new Intent();
+ intent.setComponent(new ComponentName("com.health.openscale.sync", "com.health.openscale.sync.core.service.SyncService"));
+ intent.putExtra("mode", "insert");
+ intent.putExtra("userId", scaleMeasurement.getUserId());
+ intent.putExtra("weight", scaleMeasurement.getWeight());
+ intent.putExtra("date", scaleMeasurement.getDateTime().getTime());
+ ContextCompat.startForegroundService(context, intent);
+ }
+
+ private void syncUpdateMeasurement(ScaleMeasurement scaleMeasurement) {
+ Intent intent = new Intent();
+ intent.setComponent(new ComponentName("com.health.openscale.sync", "com.health.openscale.sync.core.service.SyncService"));
+ intent.putExtra("mode", "update");
+ intent.putExtra("userId", scaleMeasurement.getUserId());
+ intent.putExtra("weight", scaleMeasurement.getWeight());
+ intent.putExtra("date", scaleMeasurement.getDateTime().getTime());
+ ContextCompat.startForegroundService(context, intent);
+ }
+
+ private void syncDeleteMeasurement(Date date) {
+ Intent intent = new Intent();
+ intent.setComponent(new ComponentName("com.health.openscale.sync", "com.health.openscale.sync.core.service.SyncService"));
+ intent.putExtra("mode", "delete");
+ intent.putExtra("date", date);
+ ContextCompat.startForegroundService(context, intent);
+ }
}
diff --git a/android_app/app/src/main/java/com/health/openscale/core/database/ScaleDatabaseProvider.java b/android_app/app/src/main/java/com/health/openscale/core/database/ScaleDatabaseProvider.java
index 647522fb..01837785 100644
--- a/android_app/app/src/main/java/com/health/openscale/core/database/ScaleDatabaseProvider.java
+++ b/android_app/app/src/main/java/com/health/openscale/core/database/ScaleDatabaseProvider.java
@@ -22,7 +22,6 @@ import android.content.UriMatcher;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
-import android.preference.PreferenceManager;
import com.health.openscale.BuildConfig;
import com.health.openscale.core.OpenScale;
@@ -97,11 +96,6 @@ public class ScaleDatabaseProvider extends android.content.ContentProvider {
String[] selectionArgs, String sortOrder) {
final Context context = getContext();
- if (!PreferenceManager.getDefaultSharedPreferences(context)
- .getBoolean("dataProviderEnable", false)) {
- throw new UnsupportedOperationException("Provider access not enabled");
- }
-
Cursor cursor;
switch (uriMatcher.match(uri)) {
@@ -140,10 +134,6 @@ public class ScaleDatabaseProvider extends android.content.ContentProvider {
@Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
- if (!PreferenceManager.getDefaultSharedPreferences(getContext())
- .getBoolean("dataProviderEnable", false)) {
- throw new UnsupportedOperationException("Provider access not enabled");
- }
Calendar cal = Calendar.getInstance();
cal.setTime(new Date((long)values.get("datetime")));
diff --git a/android_app/app/src/main/res/values-ar/strings.xml b/android_app/app/src/main/res/values-ar/strings.xml
index 33f01dd2..24cf0ebe 100644
--- a/android_app/app/src/main/res/values-ar/strings.xml
+++ b/android_app/app/src/main/res/values-ar/strings.xml
@@ -231,5 +231,4 @@
معتدل
كثيف
شديد
- "وصول جهات اخرى إلى تطبيق "
\ No newline at end of file
diff --git a/android_app/app/src/main/res/values-da/strings.xml b/android_app/app/src/main/res/values-da/strings.xml
index 26a8f756..b104c5ff 100644
--- a/android_app/app/src/main/res/values-da/strings.xml
+++ b/android_app/app/src/main/res/values-da/strings.xml
@@ -232,5 +232,4 @@
Læs/Skriv openScale data, herunder brugerinformation og alle gemte målinger
Læs/Skriv openScale data
Kalorier
- Tredjeparts appadgang
\ No newline at end of file
diff --git a/android_app/app/src/main/res/values-de/strings.xml b/android_app/app/src/main/res/values-de/strings.xml
index c4ec24d1..bf38aae9 100644
--- a/android_app/app/src/main/res/values-de/strings.xml
+++ b/android_app/app/src/main/res/values-de/strings.xml
@@ -216,7 +216,6 @@
Extreme Tätigkeit
Auslesen der openScale Daten, inkl. Benutzerinformationen und aller gespeicherten Messungen
Auslesen der openScale Daten
- 3rd Party App Zugriff
Diese Waage ist nicht gekoppelt!
\n
\nHalten Sie die Taste an der Unterseite der Waage gedrückt, um sie in den Kopplungsmodus zu versetzen und verbinden Sie sie dann erneut, um das Gerätepasswort abzurufen.
diff --git a/android_app/app/src/main/res/values-el/strings.xml b/android_app/app/src/main/res/values-el/strings.xml
index ecc5ec0d..bc92f789 100644
--- a/android_app/app/src/main/res/values-el/strings.xml
+++ b/android_app/app/src/main/res/values-el/strings.xml
@@ -222,7 +222,6 @@
Μέτριο
Έντονο
Ακραίο
- Πρόσβαση εφαρμογής τρίτων
Συνολική ημερήσια κατανάλωση ενέργειας (ΣΗΚΕ)
Θερμίδες
Δεν μπορεί να γίνει σύνδεση, ξαναδοκιμάζω…
diff --git a/android_app/app/src/main/res/values-es/strings.xml b/android_app/app/src/main/res/values-es/strings.xml
index 3fbc76d2..99b6cc08 100644
--- a/android_app/app/src/main/res/values-es/strings.xml
+++ b/android_app/app/src/main/res/values-es/strings.xml
@@ -222,7 +222,6 @@
¡Emparejamiento exitoso!
\n
\nVuelva a conectar para obtener datos de mediciones.
- Acceso de aplicaciones de terceros
Gasto Calórico Total Diario
No se puede establecer la conexión, reintentando…
Conexión de Bluetooth cerrada
diff --git a/android_app/app/src/main/res/values-hu/strings.xml b/android_app/app/src/main/res/values-hu/strings.xml
index 481a8035..54d915d1 100644
--- a/android_app/app/src/main/res/values-hu/strings.xml
+++ b/android_app/app/src/main/res/values-hu/strings.xml
@@ -222,7 +222,6 @@
Mérsékelt
Élénk
Extrém
- Harmadik fél app hozzáférése
Összes napi energia kiadás (TDEE)
Kalória
\ No newline at end of file
diff --git a/android_app/app/src/main/res/values-iw/strings.xml b/android_app/app/src/main/res/values-iw/strings.xml
index cb23e273..376eb43a 100644
--- a/android_app/app/src/main/res/values-iw/strings.xml
+++ b/android_app/app/src/main/res/values-iw/strings.xml
@@ -218,7 +218,6 @@
בינונית
גבוהה
קיצונית
- גישה ליישומון צד שלישי
המשקל טרם עבר צימוד!
\n
\nיש להחזיק את הכפתור בתחתית המשקל כדי להפעיל אותו במצב צימוד ואז להתחבר מחדש כדי לקבל את הססמה של המכשיר.
diff --git a/android_app/app/src/main/res/values-ko/strings.xml b/android_app/app/src/main/res/values-ko/strings.xml
index 21416f87..392d1b5f 100644
--- a/android_app/app/src/main/res/values-ko/strings.xml
+++ b/android_app/app/src/main/res/values-ko/strings.xml
@@ -219,5 +219,4 @@
중간 수준의 운동
많은 운동
과도한 운동
- 제 3자 앱 액세스
\ No newline at end of file
diff --git a/android_app/app/src/main/res/values-nb/strings.xml b/android_app/app/src/main/res/values-nb/strings.xml
index c562f90e..bd62d0e8 100644
--- a/android_app/app/src/main/res/values-nb/strings.xml
+++ b/android_app/app/src/main/res/values-nb/strings.xml
@@ -216,7 +216,6 @@
Ekstrem
les openScale-data, inkludert brukerinfo, og alle lagrede målinger
Les openScale-data
- Tilgang for tredjepartsprogrammer
Denne vekten har ikke blitt parret.
\n
\nHold knappen på bunnen av vekten for å sette den i paringsmodus, koble deretter til den igjen for å hente enhetens passord.
diff --git a/android_app/app/src/main/res/values-nl/strings.xml b/android_app/app/src/main/res/values-nl/strings.xml
index 63109dd1..4d471ed5 100644
--- a/android_app/app/src/main/res/values-nl/strings.xml
+++ b/android_app/app/src/main/res/values-nl/strings.xml
@@ -249,7 +249,6 @@
\n
\nVerbind opnieuw om metingen op te halen.
- Toegang andere apps
Totaal Dagelijks Energie Gebruik
Calorieën
Kan geen verbinding maken, opnieuw proberen…
diff --git a/android_app/app/src/main/res/values-ru/strings.xml b/android_app/app/src/main/res/values-ru/strings.xml
index ac16d613..677c8b72 100644
--- a/android_app/app/src/main/res/values-ru/strings.xml
+++ b/android_app/app/src/main/res/values-ru/strings.xml
@@ -250,7 +250,6 @@
Средний
Интенсивный
Экстремальный
- Доступ для сторонних приложений
Общий ежедневный расход энергии (TDEE)
Калории
\ No newline at end of file
diff --git a/android_app/app/src/main/res/values-sv/strings.xml b/android_app/app/src/main/res/values-sv/strings.xml
index 8161495a..37540901 100644
--- a/android_app/app/src/main/res/values-sv/strings.xml
+++ b/android_app/app/src/main/res/values-sv/strings.xml
@@ -224,7 +224,6 @@
Extrem
läs openScale-data, inklusive användarinformation och alla sparade mätningar
Läs openScale-data
-Tillgång för tredjeparts-app
Totala dagliga energiförbrukningen (TDEE)
Vågen har inte parats!
\n
diff --git a/android_app/app/src/main/res/values-tr/strings.xml b/android_app/app/src/main/res/values-tr/strings.xml
index 4d0655b3..2d41a3af 100644
--- a/android_app/app/src/main/res/values-tr/strings.xml
+++ b/android_app/app/src/main/res/values-tr/strings.xml
@@ -237,8 +237,7 @@
Hafif
Ağır
Aşırı
- Üçüncü parti uygulama erişimi
-Bu tartı eşleşmedi!
+ Bu tartı eşleşmedi!
\n
\nEşleştirme moduna geçmek için, terazinin altındaki düğmeyi basılı tutun ve ardından cihaz parolasını geri almak için tekrar bağlanın.
\n
diff --git a/android_app/app/src/main/res/values-vi/strings.xml b/android_app/app/src/main/res/values-vi/strings.xml
index d2b4fcbe..005541d2 100644
--- a/android_app/app/src/main/res/values-vi/strings.xml
+++ b/android_app/app/src/main/res/values-vi/strings.xml
@@ -247,5 +247,4 @@
Vận động trung bình
Vận động nặng
Vận động cực nặng
- Quyền truy cập ứng dụng bên thứ ba
diff --git a/android_app/app/src/main/res/values/strings.xml b/android_app/app/src/main/res/values/strings.xml
index 7c37a48a..ca4d4ea9 100644
--- a/android_app/app/src/main/res/values/strings.xml
+++ b/android_app/app/src/main/res/values/strings.xml
@@ -255,5 +255,4 @@
Moderate
Heavy
Extreme
- Third-party app access
\ No newline at end of file
diff --git a/android_app/app/src/main/res/xml/general_preferences.xml b/android_app/app/src/main/res/xml/general_preferences.xml
index 938fcdd4..43399889 100644
--- a/android_app/app/src/main/res/xml/general_preferences.xml
+++ b/android_app/app/src/main/res/xml/general_preferences.xml
@@ -23,10 +23,4 @@
android:summaryOff="@string/info_is_not_enable"
android:summaryOn="@string/info_is_enable"
android:title="@string/label_delete_confirmation" />
-