fix: multiple issues running the app
- `setAppWidth` issue - fixed - `signal connection` issue - fixed - `app-run-test.sh` script added
This commit is contained in:
parent
eb41dbe175
commit
4169854feb
|
@ -268,6 +268,8 @@ proc startupDidLoad*(self: AppController) =
|
||||||
|
|
||||||
# We need to init a language service once qml is loaded
|
# We need to init a language service once qml is loaded
|
||||||
self.languageService.init()
|
self.languageService.init()
|
||||||
|
# We need this to set app width/height appropriatelly on the app start.
|
||||||
|
self.startupModule.startUpUIRaised()
|
||||||
|
|
||||||
proc mainDidLoad*(self: AppController) =
|
proc mainDidLoad*(self: AppController) =
|
||||||
self.statusFoundation.onLoggedIn()
|
self.statusFoundation.onLoggedIn()
|
||||||
|
@ -276,6 +278,7 @@ proc mainDidLoad*(self: AppController) =
|
||||||
self.mainModule.checkForStoringPassword()
|
self.mainModule.checkForStoringPassword()
|
||||||
|
|
||||||
proc start*(self: AppController) =
|
proc start*(self: AppController) =
|
||||||
|
self.keychainService.init()
|
||||||
self.generalService.init()
|
self.generalService.init()
|
||||||
self.ethService.init()
|
self.ethService.init()
|
||||||
self.accountsService.init()
|
self.accountsService.init()
|
||||||
|
|
|
@ -81,5 +81,8 @@ method userLoggedIn*[T](self: Module[T]) =
|
||||||
method moveToAppState*[T](self: Module[T]) =
|
method moveToAppState*[T](self: Module[T]) =
|
||||||
self.view.setAppState(AppState.MainAppState)
|
self.view.setAppState(AppState.MainAppState)
|
||||||
|
|
||||||
|
method startUpUIRaised*[T](self: Module[T]) =
|
||||||
|
self.view.startUpUIRaised()
|
||||||
|
|
||||||
method emitLogOut*[T](self: Module[T]) =
|
method emitLogOut*[T](self: Module[T]) =
|
||||||
self.view.emitLogOut()
|
self.view.emitLogOut()
|
|
@ -6,3 +6,6 @@ method load*(self: AccessInterface) {.base.} =
|
||||||
|
|
||||||
method moveToAppState*(self: AccessInterface) {.base.} =
|
method moveToAppState*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method startUpUIRaised*(self: AccessInterface) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
|
@ -26,6 +26,7 @@ QtObject:
|
||||||
# In some point, here, we will setup some exposed main module related things.
|
# In some point, here, we will setup some exposed main module related things.
|
||||||
self.delegate.viewDidLoad()
|
self.delegate.viewDidLoad()
|
||||||
|
|
||||||
|
proc startUpUIRaised*(self: View) {.signal.}
|
||||||
proc appStateChanged*(self: View, state: int) {.signal.}
|
proc appStateChanged*(self: View, state: int) {.signal.}
|
||||||
|
|
||||||
proc getAppState(self: View): int {.slot.} =
|
proc getAppState(self: View): int {.slot.} =
|
||||||
|
|
|
@ -75,7 +75,6 @@ QtObject:
|
||||||
result.events = events
|
result.events = events
|
||||||
result.threadpool = threadpool
|
result.threadpool = threadpool
|
||||||
result.contacts = initTable[string, ContactsDto]()
|
result.contacts = initTable[string, ContactsDto]()
|
||||||
signalConnect(singletonInstance.userProfile, "imageChanged()", result, "onLoggedInUserImageChange()", 2)
|
|
||||||
|
|
||||||
proc addContact(self: Service, contact: ContactsDto) =
|
proc addContact(self: Service, contact: ContactsDto) =
|
||||||
# Private proc, used for adding contacts only.
|
# Private proc, used for adding contacts only.
|
||||||
|
@ -125,6 +124,8 @@ QtObject:
|
||||||
self.doConnect()
|
self.doConnect()
|
||||||
self.startCheckingContactStatuses()
|
self.startCheckingContactStatuses()
|
||||||
|
|
||||||
|
signalConnect(singletonInstance.userProfile, "imageChanged()", self, "onLoggedInUserImageChange()", 2)
|
||||||
|
|
||||||
proc onLoggedInUserImageChange*(self: Service) {.slot.} =
|
proc onLoggedInUserImageChange*(self: Service) {.slot.} =
|
||||||
let data = Args()
|
let data = Args()
|
||||||
self.events.emit(SIGNAL_LOGGEDIN_USER_IMAGE_CHANGED, data)
|
self.events.emit(SIGNAL_LOGGEDIN_USER_IMAGE_CHANGED, data)
|
||||||
|
|
|
@ -22,11 +22,6 @@ QtObject:
|
||||||
|
|
||||||
proc setup(self: Service) =
|
proc setup(self: Service) =
|
||||||
self.QObject.setup
|
self.QObject.setup
|
||||||
self.keychainManager = newStatusKeychainManager("StatusDesktop", "authenticate you")
|
|
||||||
signalConnect(self.keychainManager, "success(QString)", self,
|
|
||||||
"onKeychainManagerSuccess(QString)", 2)
|
|
||||||
signalConnect(self.keychainManager, "error(QString, int, QString)", self,
|
|
||||||
"onKeychainManagerError(QString, int, QString)", 2)
|
|
||||||
|
|
||||||
proc delete*(self: Service) =
|
proc delete*(self: Service) =
|
||||||
self.keychainManager.delete
|
self.keychainManager.delete
|
||||||
|
@ -36,6 +31,13 @@ QtObject:
|
||||||
new(result, delete)
|
new(result, delete)
|
||||||
result.setup()
|
result.setup()
|
||||||
result.events = events
|
result.events = events
|
||||||
|
result.keychainManager = newStatusKeychainManager("StatusDesktop", "authenticate you")
|
||||||
|
|
||||||
|
proc init*(self: Service) =
|
||||||
|
signalConnect(self.keychainManager, "success(QString)", self,
|
||||||
|
"onKeychainManagerSuccess(QString)", 2)
|
||||||
|
signalConnect(self.keychainManager, "error(QString, int, QString)", self,
|
||||||
|
"onKeychainManagerError(QString, int, QString)", 2)
|
||||||
|
|
||||||
proc storePassword*(self: Service, username: string, password: string) =
|
proc storePassword*(self: Service, username: string, password: string) =
|
||||||
self.keychainManager.storeDataAsync(username, password)
|
self.keychainManager.storeDataAsync(username, password)
|
||||||
|
|
|
@ -94,10 +94,6 @@ proc mainProc() =
|
||||||
# Register events objects
|
# Register events objects
|
||||||
let dockShowAppEvent = newStatusDockShowAppEventObject(singletonInstance.engine)
|
let dockShowAppEvent = newStatusDockShowAppEventObject(singletonInstance.engine)
|
||||||
let osThemeEvent = newStatusOSThemeEventObject(singletonInstance.engine)
|
let osThemeEvent = newStatusOSThemeEventObject(singletonInstance.engine)
|
||||||
# We need this global variable in order to be able to access the application
|
|
||||||
# from the non-closure callback passed to `statusgo_backend.setSignalEventCallback`
|
|
||||||
signalsManagerQObjPointer = cast[pointer](statusFoundation.signalsManager.vptr)
|
|
||||||
setupRemoteSignalsHandling()
|
|
||||||
|
|
||||||
if not defined(macosx):
|
if not defined(macosx):
|
||||||
app.icon(app.applicationDirPath & statusAppIconPath)
|
app.icon(app.applicationDirPath & statusAppIconPath)
|
||||||
|
@ -139,6 +135,12 @@ proc mainProc() =
|
||||||
|
|
||||||
info "starting application controller..."
|
info "starting application controller..."
|
||||||
appController.start()
|
appController.start()
|
||||||
|
|
||||||
|
# We need this global variable in order to be able to access the application
|
||||||
|
# from the non-closure callback passed to `statusgo_backend.setSignalEventCallback`
|
||||||
|
signalsManagerQObjPointer = cast[pointer](statusFoundation.signalsManager.vptr)
|
||||||
|
setupRemoteSignalsHandling()
|
||||||
|
|
||||||
info "starting application..."
|
info "starting application..."
|
||||||
app.exec()
|
app.exec()
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
## This script runs the app in a loop for `TOTAL_NUM_OF_TRIES` times and closes it
|
||||||
|
## after each successful run. If all runs go well, script will place a success message,
|
||||||
|
## otherwise you will get an error and an info in which run an error occurred.
|
||||||
|
##
|
||||||
|
## Tested on MacOs!
|
||||||
|
##
|
||||||
|
## You need to build the app before running this script.
|
||||||
|
|
||||||
|
TOTAL_NUM_OF_TRIES=100
|
||||||
|
COUNTER=0
|
||||||
|
RES=1
|
||||||
|
PID=-1
|
||||||
|
|
||||||
|
function checkSuccess {
|
||||||
|
if [ "$RES" -eq "0" ]; then
|
||||||
|
printf "\x1B[1;32m$1\x1B[0m\n";
|
||||||
|
else
|
||||||
|
printf "\x1B[1;31m$2\x1B[0m\n"; exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
while [ $COUNTER -lt $TOTAL_NUM_OF_TRIES ]
|
||||||
|
do
|
||||||
|
echo "------------------------------------"
|
||||||
|
((COUNTER=COUNTER+1))
|
||||||
|
echo "Running the app..."
|
||||||
|
export LD_LIBRARY_PATH=vendor/status-lib/vendor/status-go/build/bin/libstatus.so &
|
||||||
|
./bin/nim_status_client &
|
||||||
|
PID=$!
|
||||||
|
sleep 4
|
||||||
|
output=$(ps -p "$PID")
|
||||||
|
RES=$?
|
||||||
|
checkSuccess "App successfully started in PID{$PID} for the $COUNTER. time" "An error starting the app occurred in $COUNTER. try"
|
||||||
|
echo "Closing the app..."
|
||||||
|
kill -9 $PID
|
||||||
|
sleep 3
|
||||||
|
echo "------------------------------------"
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "\x1B[1;32m ALL $TOTAL_NUM_OF_TRIES TRIES WERE SUCCESSFUL! \x1B[0m\n";
|
12
ui/main.qml
12
ui/main.qml
|
@ -23,6 +23,7 @@ StatusWindow {
|
||||||
property bool hasAccounts: startupModule.appState !== Constants.appState.onboarding
|
property bool hasAccounts: startupModule.appState !== Constants.appState.onboarding
|
||||||
property alias dragAndDrop: dragTarget
|
property alias dragAndDrop: dragTarget
|
||||||
property bool displayBeforeGetStartedModal: !hasAccounts
|
property bool displayBeforeGetStartedModal: !hasAccounts
|
||||||
|
property bool appIsReady: false
|
||||||
|
|
||||||
Universal.theme: Universal.System
|
Universal.theme: Universal.System
|
||||||
|
|
||||||
|
@ -44,10 +45,14 @@ StatusWindow {
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
function storeWidth() {
|
function storeWidth() {
|
||||||
|
if(!applicationWindow.appIsReady)
|
||||||
|
return
|
||||||
localAppSettings.appWidth = width
|
localAppSettings.appWidth = width
|
||||||
}
|
}
|
||||||
|
|
||||||
function storeHeight() {
|
function storeHeight() {
|
||||||
|
if(!applicationWindow.appIsReady)
|
||||||
|
return
|
||||||
localAppSettings.appHeight = height
|
localAppSettings.appHeight = height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +99,13 @@ StatusWindow {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: startupModule
|
target: startupModule
|
||||||
|
|
||||||
|
onStartUpUIRaised: {
|
||||||
|
applicationWindow.appIsReady = true
|
||||||
|
applicationWindow.storeWidth()
|
||||||
|
applicationWindow.storeHeight()
|
||||||
|
}
|
||||||
|
|
||||||
onAppStateChanged: {
|
onAppStateChanged: {
|
||||||
if(state === Constants.appState.main) {
|
if(state === Constants.appState.main) {
|
||||||
// We set main module to the Global singleton once user is logged in and we move to the main app.
|
// We set main module to the Global singleton once user is logged in and we move to the main app.
|
||||||
|
|
Loading…
Reference in New Issue