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 method declarations to NSUserActivity #299

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
139 changes: 133 additions & 6 deletions Headers/Foundation/NSUserActivity.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**Definition of class NSUserActivity
/* Definition of class NSUserActivity
Copyright (C) 2019 Free Software Foundation, Inc.

By: Gregory John Casamento <[email protected]>
Date: Fri Nov 1 00:25:47 EDT 2019

This file is part of the GNUstep Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Expand All @@ -25,16 +25,144 @@
#ifndef _NSUserActivity_h_GNUSTEP_BASE_INCLUDE
#define _NSUserActivity_h_GNUSTEP_BASE_INCLUDE

#include <Foundation/NSObject.h>
#import <Foundation/NSObject.h>
#import <GNUstepBase/GSBlocks.h>

#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)

#if defined(__cplusplus)
extern "C" {
#endif

GS_EXPORT NSString* const NSUserActivityBrowsingWeb;

@class NSString, NSInputStream, NSOutputStream, NSError, NSDictionary, NSSet, NSURL, NSDate;

typedef NSString* NSUserActivityPersistentIdentifier;

@protocol NSUserActivityDelegate;

DEFINE_BLOCK_TYPE(GSContinuationStreamsCompletionHandler, void, NSInputStream*, NSOutputStream*, NSError*);

DEFINE_BLOCK_TYPE_NO_ARGS(GSDeleteSavedCompletionHandler, void);

GS_EXPORT_CLASS
@interface NSUserActivity : NSObject
{
NSString *_activityType;
NSString *_title;
NSDictionary *_userInfo;
NSSet *_requiredUserInfoKeys;
NSURL *_webpageURL;
NSURL *_referrerURL;
NSDate *_expirationDate;
NSSet *_keywords;
id<NSUserActivityDelegate> _delegate;
NSString *_targetContentIdentifier;
NSString *_persistentIdentifier;

BOOL _supportsContinuationStreams;
BOOL _needsSave;
BOOL _valid;
BOOL _eligibleForPrediction;
BOOL _eligibleForPublicIndexing;
BOOL _eligibleForSearch;
BOOL _eligibleForHandoff;
}

- (instancetype) initWithActivityType: (NSString *)activityType;

- (instancetype) init;

- (void) becomeCurrent;

#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
- (void) resignCurrent;
#endif

- (void) invalidate;

- (void) getContinuationStreamsWithCompletionHandler: (GSContinuationStreamsCompletionHandler)handler;

+ (void) deleteSavedUserActivitiesWithPersistentIdentifiers: (NSArray *)persistentIdentifies completionHandler: (GSDeleteSavedCompletionHandler)handler;

+ (void) deleteAllSavedUserActivitiesWithCompletionHandler: (GSDeleteSavedCompletionHandler)handler;

// properties...
- (NSString *) activityType;

- (NSString *) title;

- (void) setTitle: (NSString *)title;

- (NSDictionary *) userInfo;

- (void) setUserInfo: (NSDictionary *)userInfo;

- (BOOL) needsSave;

- (void) setNeedsSave: (BOOL)needsSave;

- (NSURL *) webpageURL;

- (void) setWebpageURL: (NSURL *)url;

- (NSURL *) referrerURL;

- (void) setReferrerURL: (NSURL *)url;

- (NSDate *) expirationDate;

- (void) setExpirationDate: (NSDate *)date;

- (NSArray *) keywords;

- (void) setKeywords: (NSArray *)keywords;

- (BOOL) supportsContinuationStreams;

- (void) setSupportsContinuationStreams: (BOOL)flag;

- (id<NSUserActivityDelegate>) delegate;

- (void) setDelegate: (id<NSUserActivityDelegate>)delegate;

- (NSString *) targetContentIdentifier;

- (void) setTargetContentIdentifier: (NSString *)targetContentIdentifier;

#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
- (BOOL) isEligibleForHandoff;

- (void) setEligibleForHandoff: (BOOL)f;

- (BOOL) isEligibleForSearch;

- (void) setEligibleForSearch: (BOOL)f;

- (BOOL) isEligibleForPublicIndexing;

- (void) setEligibleForPublicIndexing: (BOOL)f;

- (BOOL) isEligibleForPrediction;

- (void) setEligibleForPrediction: (BOOL)f;
#endif

#if OS_API_VERSION(MAC_OS_X_VERSION_10_15, GS_API_LATEST)
- (NSUserActivityPersistentIdentifier) persistentIdentifier;

- (void) setPersistentIdentifier: (NSUserActivityPersistentIdentifier)persistentIdentifier;
#endif
@end

@protocol NSUserActivityDelegate <NSObject>

- (void) userActivityWillSave: (NSUserActivity *)activity;

- (void) userActivityWasContinued: (NSUserActivity *)activity;

- (void) userActivity: (NSUserActivity *)activity didRecieveInputStream: (NSInputStream *)inputStream outputStream: (NSOutputStream *)outputStream;

@end

Expand All @@ -45,4 +173,3 @@ GS_EXPORT_CLASS
#endif /* GS_API_MACOSX */

#endif /* _NSUserActivity_h_GNUSTEP_BASE_INCLUDE */

16 changes: 8 additions & 8 deletions Source/NSUbiquitousKeyValueStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.

*/

#import "common.h"
#import "Foundation/NSAutoreleasePool.h"
#import "Foundation/NSCoder.h"
#import "Foundation/NSEnumerator.h"
#import "Foundation/NSException.h"
#import "Foundation/NSKeyedArchiver.h"
#import <Foundation/NSUbiquitousKeyValueStore.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSData.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSUserDefaults.h>
#import "Foundation/NSUbiquitousKeyValueStore.h"
#import "Foundation/NSArray.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSData.h"
#import "Foundation/NSString.h"
#import "Foundation/NSValue.h"
#import "Foundation/NSUserDefaults.h"

static NSUbiquitousKeyValueStore *_sharedUbiquitousKeyValueStore = nil;

Expand Down
Loading
Loading