diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj index e3e5050f..d8b9d145 100644 --- a/damus.xcodeproj/project.pbxproj +++ b/damus.xcodeproj/project.pbxproj @@ -170,6 +170,7 @@ 4C3BEFDB281DCE6100B3DE84 /* Liked.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Liked.swift; sourceTree = ""; }; 4C3BEFDF281DE1ED00B3DE84 /* DamusState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DamusState.swift; sourceTree = ""; }; 4C477C9D282C3A4800033AA3 /* TipCounter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TipCounter.swift; sourceTree = ""; }; + 4C4A3A5A288A1B2200453788 /* damus.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = damus.entitlements; sourceTree = ""; }; 4C5C7E67284ED36500A22DF5 /* SearchHomeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchHomeModel.swift; sourceTree = ""; }; 4C5C7E69284EDE2E00A22DF5 /* SearchResultsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultsView.swift; sourceTree = ""; }; 4C5F9113283D694D0052CD1C /* FollowTarget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowTarget.swift; sourceTree = ""; }; @@ -397,6 +398,7 @@ 4CE6DEE527F7A08100C66700 /* damus */ = { isa = PBXGroup; children = ( + 4C4A3A5A288A1B2200453788 /* damus.entitlements */, 4CE4F9DF285287A000C00DD9 /* Components */, 4C7FF7D628233637009601DB /* Util */, 4C0A3F8D280F63FF000448DE /* Models */, @@ -832,6 +834,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\""; @@ -867,6 +870,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\""; diff --git a/damus/ContentView.swift b/damus/ContentView.swift index 3ab74110..d8ca3eb3 100644 --- a/damus/ContentView.swift +++ b/damus/ContentView.swift @@ -182,6 +182,7 @@ struct ContentView: View { } .onAppear() { self.connect() + setup_notifications() } .sheet(item: $active_sheet) { item in switch item { @@ -479,3 +480,20 @@ func update_filters_with_since(last_of_kind: [Int: NostrEvent], filters: [NostrF } } + + +func setup_notifications() { + + UIApplication.shared.registerForRemoteNotifications() + let center = UNUserNotificationCenter.current() + + center.getNotificationSettings { settings in + guard settings.authorizationStatus == .authorized else { + center.requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in + + } + + return + } + } +} diff --git a/damus/damus.entitlements b/damus/damus.entitlements new file mode 100644 index 00000000..903def2a --- /dev/null +++ b/damus/damus.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + +