fixed a few cloud sync bugs
* fixed a bug where cemu_UI faild to set the correct text to the playBtn * fixed cemu_UI crashing when activationg cloud sync under linux
This commit is contained in:
parent
e4bf16e7a1
commit
95df2b9359
|
@ -71,7 +71,6 @@ public class Main extends Application {
|
|||
public void start(Stage primaryStage) {
|
||||
try {
|
||||
this.primaryStage = primaryStage;
|
||||
cloudController = new CloudController(mainWindowController);
|
||||
mainWindow();
|
||||
initActions();
|
||||
} catch (Exception e) {
|
||||
|
@ -90,6 +89,7 @@ public class Main extends Application {
|
|||
|
||||
mainWindowController = loader.getController(); // Link of FXMLController and controller class
|
||||
mainWindowController.setMain(this); // call setMain
|
||||
cloudController = new CloudController(mainWindowController); // call cloudController constructor
|
||||
|
||||
// get OS and the specific paths
|
||||
if (System.getProperty("os.name").equals("Linux")) {
|
||||
|
@ -158,6 +158,7 @@ public class Main extends Application {
|
|||
// loading settings and initialize UI, dbController.main() loads all databases
|
||||
mainWindowController.init();
|
||||
mainWindowController.dbController.main();
|
||||
// if cloud sync is activated start sync
|
||||
if(mainWindowController.isCloudSync()) {
|
||||
cloudController.initializeConnection(mainWindowController.getCloudService(), mainWindowController.getCemuPath());
|
||||
cloudController.stratupCheck(mainWindowController.getCloudService(), mainWindowController.getCemuPath());
|
||||
|
|
|
@ -976,6 +976,11 @@ public class MainWindowController {
|
|||
//TODO rework for other cloud services
|
||||
cloudService = "GoogleDrive";
|
||||
|
||||
// start cloud sync in new thread
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (main.cloudController.initializeConnection(getCloudService(), getCemuPath())) {
|
||||
main.cloudController.sync(getCloudService(), getCemuPath());
|
||||
saveSettings();
|
||||
|
@ -990,6 +995,10 @@ public class MainWindowController {
|
|||
JFXInfoDialog cloudSyncErrorDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 450, 170, main.pane);
|
||||
cloudSyncErrorDialog.show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ public class CloudController {
|
|||
@Override
|
||||
public void run() {
|
||||
Platform.runLater(() -> {
|
||||
mwc.getPlayBtn().setText("syncing..."); // FIXME we get a NullPointerException here, because playBtn dosen't exist
|
||||
mwc.getPlayBtn().setText("syncing...");
|
||||
});
|
||||
LOGGER.info("starting synchronization in new thread ...");
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class CloudController {
|
|||
|
||||
}
|
||||
Platform.runLater(() -> {
|
||||
mwc.getPlayBtn().setText("play"); // FIXME we get a NullPointerException here, because playBtn dosen't exist
|
||||
mwc.getPlayBtn().setText("play");
|
||||
mwc.saveSettings();
|
||||
});
|
||||
LOGGER.info("synchronization successful!");
|
||||
|
|
|
@ -103,10 +103,6 @@ public class GoogleDriveController {
|
|||
// Load client secrets.
|
||||
InputStream in = getClass().getClassLoader().getResourceAsStream("client_secret.json");
|
||||
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
|
||||
|
||||
//FIXME Linux fails to open a new browser window, application crashes
|
||||
// see: https://github.com/Seil0/cemu_UI/issues/10
|
||||
// Build flow and trigger user authorization request.
|
||||
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
|
||||
.setDataStoreFactory(DATA_STORE_FACTORY)
|
||||
.setAccessType("offline")
|
||||
|
|
Loading…
Reference in New Issue