Skip to content

Commit

Permalink
Merge branch 'release/1.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Florianisme committed Jan 4, 2023
2 parents 24e8252 + 99f6771 commit 8ac95cc
Show file tree
Hide file tree
Showing 84 changed files with 1,072 additions and 343 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
*.iml
.gradle
/local.properties
.DS_Store
/build
/app/release
**/build
**/release
/captures
.externalNativeBuild
.cxx
local.properties
/.idea/
/.idea/
20 changes: 7 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply from: "$rootProject.projectDir/shared-build.gradle"

android {
defaultConfig {
versionCode 35
versionCode 45
wearAppUnbundled true
}
buildFeatures {
Expand All @@ -12,23 +12,17 @@ android {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.4.2'
implementation 'androidx.navigation:navigation-ui:2.4.2'
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'androidx.navigation:navigation-fragment:2.5.3'
implementation 'androidx.navigation:navigation-ui:2.5.3'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

def room_version = "2.4.2"
def room_version = "2.4.3"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation(name: 'android-ping', ext: 'aar')

implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.3'
implementation project(path: ':shared-models')
}
11 changes: 10 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
-renamesourcefileattribute SourceFile
-renamesourcefileattribute SourceFile

# Jackson
-keep @com.fasterxml.jackson.annotation.JsonIgnoreProperties class * { *; }
-keep class com.fasterxml.** { *; }
-keep class org.codehaus.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-keepclassmembers public final enum com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility {
public static final com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility *;
}

This file was deleted.

6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
</intent-filter>
</activity>
<activity
android:name=".ui.home.details.AddDeviceActivity"
android:name=".ui.modify.AddDeviceActivity"
android:label="@string/title_activity_add_device"
android:theme="@style/Theme.WakeOnLan.NoDrawerActivity" />
<activity
android:name=".ui.home.details.EditDeviceActivity"
android:name=".ui.modify.EditDeviceActivity"
android:label="@string/title_activity_edit_device"
android:theme="@style/Theme.WakeOnLan.NoDrawerActivity" />
<activity
android:name=".ui.home.details.AddNetworkScanDeviceActivity"
android:name=".ui.modify.AddNetworkScanDeviceActivity"
android:label="@string/title_activity_add_device"
android:theme="@style/Theme.WakeOnLan.NoDrawerActivity" />

Expand Down
Binary file removed app/src/main/ic_launcher-playstore.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import de.florianisme.wakeonlan.persistence.entities.Device;

@Database(entities = {Device.class}, version = 2, exportSchema = false)
@Database(entities = {Device.class}, version = 3, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
public abstract DeviceDao deviceDao();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import androidx.room.Room;

import de.florianisme.wakeonlan.persistence.migrations.MigrationFrom1To2;
import de.florianisme.wakeonlan.persistence.migrations.MigrationFrom2To3;

public class DatabaseInstanceManager {

Expand All @@ -14,7 +15,7 @@ public static synchronized AppDatabase getInstance(Context context) {
if (appDatabase == null) {
appDatabase = Room.databaseBuilder(context, AppDatabase.class, "database-name")
.allowMainThreadQueries()
.addMigrations(new MigrationFrom1To2())
.addMigrations(new MigrationFrom1To2(), new MigrationFrom2To3())
.build();
}
return appDatabase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,28 @@ public class Device {
public String macAddress;

@ColumnInfo(name = "broadcast_address")
public String broadcast_address;
public String broadcastAddress;

@ColumnInfo(name = "port")
public int port;

@ColumnInfo(name = "status_ip")
public String statusIp;

@ColumnInfo(name = "secure_on_password")
public String secureOnPassword;

@Ignore
public Device(String name, String macAddress, String broadcast_address, int port, String statusIp) {
public Device(String name, String macAddress, String broadcastAddress, int port, String statusIp, String secureOnPassword) {
this.name = name;
this.macAddress = macAddress;
this.broadcast_address = broadcast_address;
this.broadcastAddress = broadcastAddress;
this.port = port;
this.statusIp = statusIp;
this.secureOnPassword = secureOnPassword;
}


public Device() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.florianisme.wakeonlan.persistence.migrations;

import androidx.annotation.NonNull;
import androidx.room.migration.Migration;
import androidx.sqlite.db.SupportSQLiteDatabase;

public class MigrationFrom2To3 extends Migration {

public MigrationFrom2To3() {
super(2, 3);
}

@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE 'Devices' ADD COLUMN 'secure_on_password' TEXT");
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void initializeWearClient() {
wearClient = new WearClient().init(this);
wearClient = new WearClient(this);
DatabaseInstanceManager.getInstance(this).deviceDao()
.getAllAsObservable()
.observe(this, devices -> wearClient.onDeviceListUpdated(devices));
Expand Down Expand Up @@ -72,10 +72,4 @@ public void onBackPressed() {
super.onBackPressed();
}
}

@Override
protected void onDestroy() {
super.onDestroy();
wearClient.destroy();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.florianisme.wakeonlan.ui.home.backup;
package de.florianisme.wakeonlan.ui.backup;

import android.os.Bundle;
import android.view.LayoutInflater;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.florianisme.wakeonlan.ui.home.backup;
package de.florianisme.wakeonlan.ui.backup;

import android.content.Context;
import android.net.Uri;
Expand All @@ -10,14 +10,16 @@
import androidx.activity.result.ActivityResultLauncher;
import androidx.fragment.app.Fragment;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.FileOutputStream;
import java.lang.ref.WeakReference;
import java.util.List;

import de.florianisme.wakeonlan.R;
import de.florianisme.wakeonlan.persistence.DatabaseInstanceManager;
import de.florianisme.wakeonlan.persistence.entities.Device;
import de.florianisme.wakeonlan.ui.home.backup.contracts.ChooseSaveFileDestinationContract;
import de.florianisme.wakeonlan.ui.backup.contracts.ChooseSaveFileDestinationContract;

public class DataExporter implements ActivityResultCallback<Uri> {

Expand All @@ -44,7 +46,7 @@ public void onActivityResult(Uri uri) {
Context context = contextWeakReference.get();
try {
List<Device> devices = DatabaseInstanceManager.getInstance(context).deviceDao().getAll();
byte[] content = JsonConverter.toJson(devices);
byte[] content = new ObjectMapper().writeValueAsBytes(devices);
writeDevicesToFile(uri, content, context);

Toast.makeText(context, context.getString(R.string.backup_message_export_success, devices.size()), Toast.LENGTH_SHORT).show();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.florianisme.wakeonlan.ui.home.backup;
package de.florianisme.wakeonlan.ui.backup;

import android.content.Context;
import android.net.Uri;
Expand All @@ -9,6 +9,7 @@
import androidx.activity.result.ActivityResultLauncher;
import androidx.fragment.app.Fragment;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.io.ByteStreams;

import java.io.IOException;
Expand All @@ -19,7 +20,7 @@
import de.florianisme.wakeonlan.persistence.DatabaseInstanceManager;
import de.florianisme.wakeonlan.persistence.DeviceDao;
import de.florianisme.wakeonlan.persistence.entities.Device;
import de.florianisme.wakeonlan.ui.home.backup.contracts.ChooseImportFileDestinationContract;
import de.florianisme.wakeonlan.ui.backup.contracts.ChooseImportFileDestinationContract;

public class DataImporter implements ActivityResultCallback<Uri> {

Expand All @@ -44,7 +45,7 @@ public void onActivityResult(Uri uri) {

try {
byte[] bytes = readContentFromFile(uri, context);
Device[] devices = JsonConverter.toModel(bytes);
Device[] devices = new ObjectMapper().readValue(bytes, Device[].class);

replaceDevicesInDatabase(devices, context);
Toast.makeText(context, context.getString(R.string.backup_message_import_success, devices.length), Toast.LENGTH_LONG).show();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.florianisme.wakeonlan.ui.home.backup.contracts;
package de.florianisme.wakeonlan.ui.backup.contracts;

import android.app.Activity;
import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.florianisme.wakeonlan.ui.home.backup.contracts;
package de.florianisme.wakeonlan.ui.backup.contracts;

import android.app.Activity;
import android.content.Context;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.florianisme.wakeonlan.ui.home.list;
package de.florianisme.wakeonlan.ui.list;

public interface DeviceClickedCallback {
void onDeviceClicked(String deviceName);
Expand Down
Loading

0 comments on commit 8ac95cc

Please sign in to comment.