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) {
|
public void start(Stage primaryStage) {
|
||||||
try {
|
try {
|
||||||
this.primaryStage = primaryStage;
|
this.primaryStage = primaryStage;
|
||||||
cloudController = new CloudController(mainWindowController);
|
|
||||||
mainWindow();
|
mainWindow();
|
||||||
initActions();
|
initActions();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -90,6 +89,7 @@ public class Main extends Application {
|
||||||
|
|
||||||
mainWindowController = loader.getController(); // Link of FXMLController and controller class
|
mainWindowController = loader.getController(); // Link of FXMLController and controller class
|
||||||
mainWindowController.setMain(this); // call setMain
|
mainWindowController.setMain(this); // call setMain
|
||||||
|
cloudController = new CloudController(mainWindowController); // call cloudController constructor
|
||||||
|
|
||||||
// get OS and the specific paths
|
// get OS and the specific paths
|
||||||
if (System.getProperty("os.name").equals("Linux")) {
|
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
|
// loading settings and initialize UI, dbController.main() loads all databases
|
||||||
mainWindowController.init();
|
mainWindowController.init();
|
||||||
mainWindowController.dbController.main();
|
mainWindowController.dbController.main();
|
||||||
|
// if cloud sync is activated start sync
|
||||||
if(mainWindowController.isCloudSync()) {
|
if(mainWindowController.isCloudSync()) {
|
||||||
cloudController.initializeConnection(mainWindowController.getCloudService(), mainWindowController.getCemuPath());
|
cloudController.initializeConnection(mainWindowController.getCloudService(), mainWindowController.getCemuPath());
|
||||||
cloudController.stratupCheck(mainWindowController.getCloudService(), mainWindowController.getCemuPath());
|
cloudController.stratupCheck(mainWindowController.getCloudService(), mainWindowController.getCemuPath());
|
||||||
|
|
|
@ -975,21 +975,30 @@ public class MainWindowController {
|
||||||
cloudSync = true;
|
cloudSync = true;
|
||||||
//TODO rework for other cloud services
|
//TODO rework for other cloud services
|
||||||
cloudService = "GoogleDrive";
|
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();
|
||||||
|
} else {
|
||||||
|
cloudSyncToggleBtn.setSelected(false);
|
||||||
|
|
||||||
if (main.cloudController.initializeConnection(getCloudService(), getCemuPath())) {
|
//cloud sync init error dialog
|
||||||
main.cloudController.sync(getCloudService(), getCemuPath());
|
String headingText = "Error while initializing cloud sync!";
|
||||||
saveSettings();
|
String bodyText = "There was some truble adding your game."
|
||||||
} else {
|
+ "\nPlease upload the app.log (which can be found in the cemu_UI directory)"
|
||||||
cloudSyncToggleBtn.setSelected(false);
|
+ "\nto \"https://github.com/Seil0/cemu_UI/issues\" so we can fix this.";
|
||||||
|
JFXInfoDialog cloudSyncErrorDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 450, 170, main.pane);
|
||||||
//cloud sync init error dialog
|
cloudSyncErrorDialog.show();
|
||||||
String headingText = "Error while initializing cloud sync!";
|
}
|
||||||
String bodyText = "There was some truble adding your game."
|
|
||||||
+ "\nPlease upload the app.log (which can be found in the cemu_UI directory)"
|
}
|
||||||
+ "\nto \"https://github.com/Seil0/cemu_UI/issues\" so we can fix this.";
|
});
|
||||||
JFXInfoDialog cloudSyncErrorDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 450, 170, main.pane);
|
thread.start();
|
||||||
cloudSyncErrorDialog.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class CloudController {
|
||||||
LOGGER.error("error while initialize connection", e);
|
LOGGER.error("error while initialize connection", e);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cloudService.equals("Dropbox")) {
|
if(cloudService.equals("Dropbox")) {
|
||||||
|
@ -106,7 +106,7 @@ public class CloudController {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Platform.runLater(() -> {
|
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 ...");
|
LOGGER.info("starting synchronization in new thread ...");
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ public class CloudController {
|
||||||
|
|
||||||
}
|
}
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
mwc.getPlayBtn().setText("play"); // FIXME we get a NullPointerException here, because playBtn dosen't exist
|
mwc.getPlayBtn().setText("play");
|
||||||
mwc.saveSettings();
|
mwc.saveSettings();
|
||||||
});
|
});
|
||||||
LOGGER.info("synchronization successful!");
|
LOGGER.info("synchronization successful!");
|
||||||
|
|
|
@ -102,11 +102,7 @@ public class GoogleDriveController {
|
||||||
public Credential authorize() throws IOException {
|
public Credential authorize() throws IOException {
|
||||||
// Load client secrets.
|
// Load client secrets.
|
||||||
InputStream in = getClass().getClassLoader().getResourceAsStream("client_secret.json");
|
InputStream in = getClass().getClassLoader().getResourceAsStream("client_secret.json");
|
||||||
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
|
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)
|
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
|
||||||
.setDataStoreFactory(DATA_STORE_FACTORY)
|
.setDataStoreFactory(DATA_STORE_FACTORY)
|
||||||
.setAccessType("offline")
|
.setAccessType("offline")
|
||||||
|
|
Loading…
Reference in New Issue