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

add a notifications helper class #971

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions MacPass.xcodeproj/project.pbxproj
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
07408AAB231C2E540062BA87 /* MPNotificationsHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07408AAA231C2E540062BA87 /* MPNotificationsHelper.swift */; };
3C0CDECF21CFEDD200B2A10B /* NSTextView+MPTouchBarExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C0CDECE21CFEDD200B2A10B /* NSTextView+MPTouchBarExtension.m */; };
3C0CDED821D28BF700B2A10B /* MPTouchBarButtonCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C0CDED721D28BF700B2A10B /* MPTouchBarButtonCreator.m */; };
4C00E33817D8FA3500F37192 /* DDHotKeyCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C00E33717D8FA3500F37192 /* DDHotKeyCenter.m */; };
Expand Down Expand Up @@ -187,8 +188,8 @@
4C7B63771C0CB51F00D7038C /* TTTStringTransformers.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C7B63701C0CB51F00D7038C /* TTTStringTransformers.m */; };
4C7B637C1C0CB55600D7038C /* KeePassKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C7B63791C0CB55600D7038C /* KeePassKit.framework */; };
4C7B637D1C0CB55600D7038C /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C7B637A1C0CB55600D7038C /* Sparkle.framework */; };
4C7B637F1C0CB57300D7038C /* KeePassKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B63791C0CB55600D7038C /* KeePassKit.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
4C7B63801C0CB57300D7038C /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B637A1C0CB55600D7038C /* Sparkle.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
4C7B637F1C0CB57300D7038C /* KeePassKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B63791C0CB55600D7038C /* KeePassKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4C7B63801C0CB57300D7038C /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B637A1C0CB55600D7038C /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4C7BD07619FE94C900C7AA5C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4C7BD07519FE94C900C7AA5C /* Assets.xcassets */; };
4C7F8B681A10B68400CCB83D /* WelcomeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C7F8B6A1A10B68400CCB83D /* WelcomeView.xib */; };
4C80304A1E2FBAA300133E4C /* MPTestKeyMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C8030491E2FBAA300133E4C /* MPTestKeyMapper.m */; };
Expand Down Expand Up @@ -250,7 +251,7 @@
4CD2B9061849424B0051B395 /* MPAutotypeContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD2B9051849424B0051B395 /* MPAutotypeContext.m */; };
4CD4EE131FC7284000EA6EB3 /* MPPickcharsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD4EE111FC7284000EA6EB3 /* MPPickcharsViewController.m */; };
4CD5D705177A5F3300100649 /* MPDatabaseSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD5D704177A5F3300100649 /* MPDatabaseSettingsWindowController.m */; };
4CD60C131C104AD4005BE5F8 /* HNHUi.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4CC281881C0F675B00B9174D /* HNHUi.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
4CD60C131C104AD4005BE5F8 /* HNHUi.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4CC281881C0F675B00B9174D /* HNHUi.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4CD7223B17A7CB0700F5A1E1 /* MPWorkflowPreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD7223A17A7CB0700F5A1E1 /* MPWorkflowPreferencesController.m */; };
4CD78ABC16D155FF00768A1D /* 07_NotepadTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CD78AB716D155FF00768A1D /* 07_NotepadTemplate.pdf */; };
4CD78ABD16D155FF00768A1D /* 08_SocketTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CD78AB816D155FF00768A1D /* 08_SocketTemplate.pdf */; };
Expand Down Expand Up @@ -316,6 +317,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
07408AA9231C2E540062BA87 /* MacPass-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MacPass-Bridging-Header.h"; sourceTree = "<group>"; };
07408AAA231C2E540062BA87 /* MPNotificationsHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPNotificationsHelper.swift; sourceTree = "<group>"; };
3C0CDECD21CFED9000B2A10B /* NSTextView+MPTouchBarExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSTextView+MPTouchBarExtension.h"; sourceTree = "<group>"; };
3C0CDECE21CFEDD200B2A10B /* NSTextView+MPTouchBarExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSTextView+MPTouchBarExtension.m"; sourceTree = "<group>"; };
3C0CDED721D28BF700B2A10B /* MPTouchBarButtonCreator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPTouchBarButtonCreator.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1193,6 +1196,8 @@
4C978E0C19AE54AB003067DF /* MPFlagsHelper.m */,
3C0CDED921D28C0E00B2A10B /* MPTouchBarButtonCreator.h */,
3C0CDED721D28BF700B2A10B /* MPTouchBarButtonCreator.m */,
07408AAA231C2E540062BA87 /* MPNotificationsHelper.swift */,
07408AA9231C2E540062BA87 /* MacPass-Bridging-Header.h */,
);
name = Helper;
sourceTree = "<group>";
Expand Down Expand Up @@ -1811,11 +1816,12 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = MP;
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1030;
ORGANIZATIONNAME = "HicknHack Software GmbH";
TargetAttributes = {
4C77E36115B84A240093A587 = {
DevelopmentTeam = 55SM4L4Z97;
LastSwiftMigration = 1030;
};
};
};
Expand Down Expand Up @@ -2121,6 +2127,7 @@
4CEE46DD181C301D006BF1E5 /* MPAutotypeDaemon.m in Sources */,
4C50CC041F6C18830095629D /* MPCollectionViewItem.m in Sources */,
4CA78C001FD58C92003C8560 /* MPPluginRepository.m in Sources */,
07408AAB231C2E540062BA87 /* MPNotificationsHelper.swift in Sources */,
4CAD8AA622CF397B0090B2DD /* MPAutotypeDoctorReportViewController.m in Sources */,
4C8990F71EE978EB0043B48D /* MPDuplicateEntryOptionsWindowController.m in Sources */,
4CA3530B18A53CB800839B0F /* MPKeyMapper.m in Sources */,
Expand Down Expand Up @@ -2890,6 +2897,9 @@
PROVISIONING_PROFILE = "";
SDKROOT = macosx;
STRIP_STYLE = debugging;
SWIFT_OBJC_BRIDGING_HEADER = "MacPass/MacPass-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand Down Expand Up @@ -2921,6 +2931,8 @@
PROVISIONING_PROFILE = "";
SDKROOT = macosx;
STRIP_STYLE = debugging;
SWIFT_OBJC_BRIDGING_HEADER = "MacPass/MacPass-Bridging-Header.h";
SWIFT_VERSION = 5.0;
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
27 changes: 27 additions & 0 deletions MacPass/MPNotificationsHelper.swift
@@ -0,0 +1,27 @@
//
// MPNotificationsHelper.swift
// MacPass
//
// Created by Eric on 9/1/19.
// Copyright © 2019 HicknHack Software GmbH. All rights reserved.
//

import Foundation
import UserNotifications

class MPNotificationsHelper : NSObject {

func showNotification(title: String, message: String) {
let notification = NSUserNotification()
notification.identifier = "macpass-notification"
notification.title = title
notification.informativeText = message
notification.soundName = NSUserNotificationDefaultSoundName

// display the notification
let center = NSUserNotificationCenter.default

center.deliver(notification)
}

}
4 changes: 4 additions & 0 deletions MacPass/MacPass-Bridging-Header.h
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//