Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 3.5.0 crashes reported by Googe Play Store #6032

Merged
merged 5 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void onDestroy() {
public int onStartCommand(Intent intent, int flags, int startId) {
Log.v("QFieldPositioningService", "onStartCommand triggered");

if (intent.hasExtra("content")) {
if (intent != null && intent.hasExtra("content")) {
ClipboardManager clipboard =
(ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(intent.getStringExtra("content"));
Expand Down Expand Up @@ -156,11 +156,17 @@ public int onStartCommand(Intent intent, int flags, int startId) {

Notification notification = builder.build();

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(NOTIFICATION_ID, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
} else {
startForeground(NOTIFICATION_ID, notification);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(NOTIFICATION_ID, notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
} else {
startForeground(NOTIFICATION_ID, notification);
}
} catch (SecurityException e) {
Log.v("QFieldPositioningService",
"Missing permission to launch the positioning service");
return START_NOT_STICKY;
}

return START_STICKY;
Expand Down
5 changes: 4 additions & 1 deletion src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function(create_executable)
qt_import_plugins(${exe_TARGET} INCLUDE Qt::QSvgPlugin)
qt_import_plugins(${exe_TARGET} INCLUDE Qt::Core5Compat)

if(IOS)
if(IOS OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(
${exe_TARGET}
PUBLIC Qt6::QDarwinCameraPermissionPlugin
Expand All @@ -121,6 +121,9 @@ function(create_executable)

set_target_properties(${exe_TARGET} PROPERTIES AUTORCC TRUE)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Handles platform-specific tasks, including insuring permission plugins
qt_finalize_executable(qfield)

set_target_properties(
${exe_TARGET}
PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}"
Expand Down
1 change: 1 addition & 0 deletions src/core/qgismobileapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ void QgisMobileapp::onAfterFirstRendering()
}
}
}
rootObjects().first()->setProperty( "sceneLoaded", true );
mFirstRenderingFlag = false;
}
}
Expand Down
21 changes: 16 additions & 5 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,19 @@ ApplicationWindow {
Material.theme: Theme.darkTheme ? "Dark" : "Light"
Material.accent: Theme.mainColor

property bool sceneLoaded: false
property bool sceneBorderless: false
property double sceneTopMargin: platformUtilities.sceneMargins(mainWindow)["top"]
property double sceneBottomMargin: platformUtilities.sceneMargins(mainWindow)["bottom"]

onSceneLoadedChanged: {
// This requires the scene to be fully loaded not to crash due to possibility of
// a thread blocking permission request being thrown
if (positioningSettings.positioningActivated) {
positionSource.active = true;
}
}

Timer {
id: refreshSceneMargins
running: false
Expand Down Expand Up @@ -384,11 +393,13 @@ ApplicationWindow {
objectName: "positioningSettings"

onPositioningActivatedChanged: {
if (positioningActivated) {
displayToast(qsTr("Activating positioning service"));
positionSource.active = true;
} else {
positionSource.active = false;
if (mainWindow.sceneLoaded) {
if (positioningActivated) {
displayToast(qsTr("Activating positioning service"));
positionSource.active = true;
} else {
positionSource.active = false;
}
}
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading