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

updates to macos notifications #63

Merged
merged 4 commits into from
Dec 4, 2023
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
Binary file added resources/common/libjni_notifications.jnilib
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,25 @@ public static void displayNotification(String message)
}
else if (os.contains("Mac"))
{
Log.i(TAG, "using osascript for Notification");
ProcessBuilder builder = new ProcessBuilder("osascript", "-e",
"display notification \"" + filter_out_specials_2(message) +
"\"" + " with title \"" + filter_out_specials_2(title) +
"\"");
builder.inheritIO().start();
int res_jni_notify = -1;
if (MainActivity.getNative_notification_lib_loaded_error() == 0)
{
String icon_path = null;
if (resources_dir != null)
{
icon_path = resources_dir + File.separator + "icon-linux.png";
}
res_jni_notify = jninotifications_notify(title,
title, message,
icon_path);
Log.i(TAG, "using macOS objC native JNI for Notification");
}

if (res_jni_notify != 0) {
Log.i(TAG, "using osascript for Notification");
ProcessBuilder builder = new ProcessBuilder("osascript", "-e", "display notification \"" + filter_out_specials_2(message) + "\"" + " with title \"" + filter_out_specials_2(title) + "\"");
builder.inheritIO().start();
}
}
else if (SystemTray.isSupported())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ class MainActivity
{
}

if (OperatingSystem.getCurrent() == OperatingSystem.LINUX)
if ((OperatingSystem.getCurrent() == OperatingSystem.LINUX)
|| (OperatingSystem.getCurrent() == OperatingSystem.MACOS))
{
native_notification_lib_loaded_error = jninotifications_loadjni(libdir2)
if (native_notification_lib_loaded_error == 0)
Expand Down
15 changes: 15 additions & 0 deletions src/main/kotlin/org/briarproject/briar/desktop/SettingDetails.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import androidx.compose.ui.unit.dp
import com.zoffcc.applications.trifa.HelperFriend
import com.zoffcc.applications.trifa.HelperFriend.get_g_opts
import com.zoffcc.applications.trifa.HelperFriend.set_g_opts
import com.zoffcc.applications.trifa.HelperNotification
import com.zoffcc.applications.trifa.MainActivity.Companion.DB_PREF__open_files_directly
import com.zoffcc.applications.trifa.TrifaToxService.Companion.orma
import global_prefs
Expand Down Expand Up @@ -246,6 +247,20 @@ fun SettingDetails()
}
// database prefs ===================

Row(Modifier.wrapContentHeight().fillMaxWidth().padding(start = 15.dp)) {
Button(modifier = Modifier.width(400.dp),
enabled = true,
onClick = {
GlobalScope.launch {
HelperNotification.displayNotification("test notification öäüß{}?°^!_;:,.-_|<>'1234567890")
SnackBarToast("Notification triggered")
}
})
{
Text("test Notification")
}
}

Row(Modifier.wrapContentHeight().fillMaxWidth().padding(start = 15.dp)) {
var loading_nodes by remember { mutableStateOf(false) }
Button(modifier = Modifier.width(400.dp),
Expand Down
Loading