Run automatic backups after database imports - 1.131
This commit is contained in:
parent
13b340f5be
commit
79a48b1e47
|
@ -245,9 +245,12 @@ export default function SettingsPage() {
|
||||||
await AppDataSource.initialize()
|
await AppDataSource.initialize()
|
||||||
await setRepo.createQueryBuilder().update().set({image: null}).execute()
|
await setRepo.createQueryBuilder().update().set({image: null}).execute()
|
||||||
await update('sound', null)
|
await update('sound', null)
|
||||||
|
const {alarm, backup} = await settingsRepo.findOne({where: {}})
|
||||||
|
console.log({backup})
|
||||||
|
if (backup) NativeModules.BackupModule.start()
|
||||||
|
else NativeModules.BackupModule.stop()
|
||||||
NativeModules.SettingsModule.ignoringBattery(
|
NativeModules.SettingsModule.ignoringBattery(
|
||||||
async (isIgnoring: boolean) => {
|
async (isIgnoring: boolean) => {
|
||||||
const {alarm} = await settingsRepo.findOne({where: {}})
|
|
||||||
if (alarm && !isIgnoring) NativeModules.SettingsModule.ignoreBattery()
|
if (alarm && !isIgnoring) NativeModules.SettingsModule.ignoreBattery()
|
||||||
reset({index: 0, routes: [{name: 'Settings'}]})
|
reset({index: 0, routes: [{name: 'Settings'}]})
|
||||||
},
|
},
|
||||||
|
|
|
@ -41,8 +41,8 @@ android {
|
||||||
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60"
|
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 36156
|
versionCode 36157
|
||||||
versionName "1.130"
|
versionName "1.131"
|
||||||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
||||||
|
|
||||||
if (isNewArchitectureEnabled()) {
|
if (isNewArchitectureEnabled()) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
|
import android.util.Log
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import com.facebook.react.bridge.ReactApplicationContext
|
import com.facebook.react.bridge.ReactApplicationContext
|
||||||
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
||||||
|
@ -24,6 +25,7 @@ class BackupModule constructor(context: ReactApplicationContext?) :
|
||||||
private val copyReceiver = object : BroadcastReceiver() {
|
private val copyReceiver = object : BroadcastReceiver() {
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
|
Log.d("BackupModule", "Backing up database...")
|
||||||
val sourceFile = File(context?.getDatabasePath("massive.db")!!.path)
|
val sourceFile = File(context?.getDatabasePath("massive.db")!!.path)
|
||||||
|
|
||||||
val targetDir =
|
val targetDir =
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "massive",
|
"name": "massive",
|
||||||
"version": "1.130",
|
"version": "1.131",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue