|
|
|
@ -64,14 +64,14 @@ public abstract class AppDatabase extends RoomDatabase { |
|
|
|
|
|
|
|
|
|
|
|
public static void restore(File file, com.fongmi.android.tv.impl.Callback callback) { |
|
|
|
public static void restore(File file, com.fongmi.android.tv.impl.Callback callback) { |
|
|
|
App.execute(() -> { |
|
|
|
App.execute(() -> { |
|
|
|
File cache = Path.cache("restore"); |
|
|
|
File restore = Path.cache("restore"); |
|
|
|
FileUtil.gzipDecompress(file, cache); |
|
|
|
FileUtil.gzipDecompress(file, restore); |
|
|
|
Backup backup = Backup.objectFrom(Path.read(cache)); |
|
|
|
Backup backup = Backup.objectFrom(Path.read(restore)); |
|
|
|
if (backup.getConfig().isEmpty()) { |
|
|
|
if (backup.getConfig().isEmpty()) { |
|
|
|
App.post(callback::error); |
|
|
|
App.post(callback::error); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
backup.restore(); |
|
|
|
backup.restore(); |
|
|
|
Path.clear(cache); |
|
|
|
Path.clear(restore); |
|
|
|
App.post(callback::success); |
|
|
|
App.post(callback::success); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|