Skip to content

Commit 88c2493

Browse files
authored
Merge branch 'master' into master
2 parents 8981f8d + d8a428f commit 88c2493

File tree

22 files changed

+340
-1676
lines changed

22 files changed

+340
-1676
lines changed

.github/workflows/build-companion-unstable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/setup-java@v3
1616
with:
1717
distribution: 'zulu'
18-
java-version: '11'
18+
java-version: '17'
1919
- uses: subosito/flutter-action@v2
2020
with:
2121
channel: 'stable' # or: 'beta', 'dev' or 'master'

.github/workflows/build-tagged.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/setup-java@v3
1717
with:
1818
distribution: 'zulu'
19-
java-version: '11'
19+
java-version: '17'
2020
- uses: subosito/flutter-action@v2
2121
with:
2222
channel: 'stable' # or: 'beta', 'dev' or 'master'

.github/workflows/static.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ jobs:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Checkout
31-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
3232
- name: Setup Node.js environment
33-
uses: actions/setup-node@v3.6.0
33+
uses: actions/setup-node@v4
3434
- name: Setup Pages
35-
uses: actions/configure-pages@v3
35+
uses: actions/configure-pages@v5
3636
- name: Render
3737
run: |
3838
npm ci
3939
npm run deploy
4040
rm -rfv ./node_modules .* package*.json || true
4141
working-directory: ./website
4242
- name: Upload artifact
43-
uses: actions/upload-pages-artifact@v1
43+
uses: actions/upload-pages-artifact@v3
4444
with:
4545
# Upload entire repository
4646
path: './website'
4747
- name: Deploy to GitHub Pages
4848
id: deployment
49-
uses: actions/deploy-pages@v2
49+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
*.apk
55
hooks.sh
66
.vscode
7-
.idea
7+
.idea
8+
.cxx

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ You need 3 functions in your hook for it to be properly initialized by the scrip
118118

119119
Please keep in mind that this project has minimal support for automation and very little support will be provided. In order to export contacts, you still need to have physical access to the device you're backing up as an "unattended mode" for the companion app hasn't been implemented yet.
120120

121-
There are 10 environment variables that control what the script does without user input:
121+
There are 11 environment variables that control what the script does without user input:
122122

123123
1. `unattended_mode` - Instead of waiting for a key press, sleeps for 5 seconds. Can be any value.
124124
2. `selected_action` - What the script should do when run. Possible values are `Backup` and `Restore` (case sensitive).
@@ -130,6 +130,7 @@ There are 10 environment variables that control what the script does without use
130130
8. `data_erase_choice` - Whether to securely erase temporary files or not. Possible values are `Fast`, `Slow` and `Extra Slow` (case sensitive). The value of this variable is ignored if the command `srm` isn't present on your computer.
131131
9. `discouraged_disable_archive` - Disables the creation of a backup archive, only creates a backup *directory* with no compression, encryption or other features. This is not recommended, although some may find it useful to deduplicate backups and save space. Restoring backups created with this option enabled is not supported by default; you must manually create an archive from the backup directory and then restore it. Possible values are `yes` or `no` (case sensitive).
132132
10. `compression_level` - One of 0, 1, 3, 5, 7, 9. Where 9 is the best an slowest copression and 0 is no compression and the fastest level. If most of your data is already compressed, for example jpg pictures or mp3 videos, you will not loose much volume by compressing it.
133+
11. `restore_apps`, `restore_storage`, `restore_contacts` - Whether to restore apps, internal storage and contacts or not. Possible values are `yes` or `no` (case sensitive).
133134

134135
Examples:
135136

@@ -140,12 +141,6 @@ $ unattended_mode="yes" selected_action="Backup" mode="Wired" export_method="tar
140141
$ archive_password="456" ./backup.sh
141142
```
142143

143-
## Convenience Script
144-
145-
The `get.openandroidbackup.me` convenience script is deprecated starting January 1st 2024 due to potential security implications associated with running unverified code from the internet as well as its limited support for various system configurations. Please use the official usage instructions instead.
146-
147-
Removal of the script is planned for April 2024, although it may stay up for longer if it's still being used by a significant number of people.
148-
149144
## Building companion app
150145

151146
**Note:** You don't need to do this, as the precompiled companion app is automatically downloaded at runtime from GitHub Releases.

backup.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e
55
# This is used to download a stable, compatible version of the Android companion app as well as ensure backwards compatibility,
66
# so it should match the tag name in GitHub Releases.
77
# TODO: load this dynamically, i.e. configure our build system to automatically update the APP_VERSION
8-
APP_VERSION="v1.0.18"
8+
APP_VERSION="v1.1.0"
99

1010
# We use whiptail for showing dialogs.
1111
# Whiptail is used similarly as dialog, but we can't install it on macOS using Homebrew IIRC.
@@ -31,13 +31,21 @@ fi
3131

3232
# Check if other dependencies are installed: adb, tar, pv, 7z, bc, timeout
3333
# srm is optional so we don't check for it
34-
commands=("tar" "pv" "7z" "adb" "bc" "timeout")
34+
commands=("tar" "pv" "7z" "adb" "bc")
3535

3636
# Add zenity to the list of commands if we're running in WSL
3737
if [ "$(uname -r | sed -n 's/.*\( *Microsoft *\).*/\1/ip')" ]; then
3838
commands+=("zenity")
3939
fi
4040

41+
# Add gtimeout to the list of commands if we're running on macOS
42+
if [ "$(uname)" = "Darwin" ]; then
43+
commands+=("gtimeout")
44+
else
45+
# For the rest of the systems, we use the standard timeout command
46+
commands+=("timeout")
47+
fi
48+
4149
for cmd in "${commands[@]}"
4250
do
4351
# adb is a function in WSL so we're using type instead of command -v
@@ -188,4 +196,4 @@ if [ "$mode" = 'Wireless' ]; then
188196
adb disconnect
189197
fi
190198

191-
cecho "If this project helped you, please star the GitHub repository. It lets me know that there are people using this script and I should continue working on it. Donations are available in my GitHub profile and will be appreciated too."
199+
cecho "If this project helped you, please star the GitHub repository. It lets me know that there are people using this script and I should continue working on it."

companion_app/android/app/build.gradle

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -13,11 +19,6 @@ if (keystorePropertiesFile.exists()) {
1319
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
1420
}
1521

16-
def flutterRoot = localProperties.getProperty('flutter.sdk')
17-
if (flutterRoot == null) {
18-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
19-
}
20-
2122
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
2223
if (flutterVersionCode == null) {
2324
flutterVersionCode = '1'
@@ -28,14 +29,12 @@ if (flutterVersionName == null) {
2829
flutterVersionName = '1.0'
2930
}
3031

31-
apply plugin: 'com.android.application'
32-
apply plugin: 'kotlin-android'
33-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
34-
3532
android {
36-
compileSdkVersion flutter.compileSdkVersion
33+
namespace 'mrrfv.backup.companion'
34+
compileSdkVersion 34
3735

3836
compileOptions {
37+
coreLibraryDesugaringEnabled true
3938
sourceCompatibility JavaVersion.VERSION_1_8
4039
targetCompatibility JavaVersion.VERSION_1_8
4140
}
@@ -50,7 +49,7 @@ android {
5049

5150
defaultConfig {
5251
applicationId "mrrfv.backup.companion"
53-
minSdkVersion 19
52+
minSdkVersion flutter.minSdkVersion
5453
targetSdkVersion flutter.targetSdkVersion
5554
versionCode flutterVersionCode.toInteger()
5655
versionName flutterVersionName
@@ -72,10 +71,10 @@ android {
7271
}
7372
}
7473

75-
flutter {
76-
source '../..'
74+
dependencies {
75+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
7776
}
7877

79-
dependencies {
80-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
78+
flutter {
79+
source '../..'
8180
}

companion_app/android/build.gradle

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
1-
buildscript {
2-
ext.kotlin_version = '1.6.20'
1+
allprojects {
32
repositories {
43
google()
54
mavenCentral()
65
}
6+
}
77

8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.0.4'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
8+
// https://stackoverflow.com/a/77625024
9+
subprojects {
10+
afterEvaluate { project ->
11+
if (project.hasProperty('android')) {
12+
project.android {
13+
if (namespace == null) {
14+
namespace project.group
15+
}
16+
}
17+
}
1118
}
1219
}
1320

14-
allprojects {
15-
repositories {
16-
google()
17-
mavenCentral()
21+
// https://stackoverflow.com/a/78865504
22+
subprojects {
23+
afterEvaluate { project ->
24+
if (project.plugins.hasPlugin("com.android.application") ||
25+
project.plugins.hasPlugin("com.android.library")) {
26+
project.android {
27+
compileSdkVersion 34
28+
buildToolsVersion "34.0.0"
29+
}
30+
}
1831
}
1932
}
2033

@@ -28,4 +41,4 @@ subprojects {
2841

2942
tasks.register("clean", Delete) {
3043
delete rootProject.buildDir
31-
}
44+
}

companion_app/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.2.2" apply false
22+
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
23+
}
24+
25+
include ":app"

0 commit comments

Comments
 (0)