Skip to content

Commit

Permalink
WIP macOS build outside of Informant
Browse files Browse the repository at this point in the history
  • Loading branch information
glorysaber committed Jan 22, 2021
1 parent c097d45 commit 651ae84
Show file tree
Hide file tree
Showing 35 changed files with 686 additions and 28 deletions.
3 changes: 2 additions & 1 deletion EvernoteSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Pod::Spec.new do |spec|
spec.license = ' https://github.com/evernote/evernote-cloud-sdk-ios/blob/master/LICENSE'
spec.authors = { 'Evernote' => '[email protected]' }
spec.source = { :git => "https://github.com/evernote/evernote-cloud-sdk-ios.git", :tag => "3.0.0"}
spec.ios.deployment_target = "8.0"
spec.ios.deployment_target = "12.0"
spec.osx.deployment_target = "10.13"
spec.xcconfig = {'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2 ${PODS_ROOT}/Headers/Public/evernote-cloud-sdk-ios/SendToEvernoteActivity'}

spec.source_files = "evernote-sdk-ios/**/*.{h,m}",
Expand Down
476 changes: 476 additions & 0 deletions evernote-sdk-ios.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1230"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CC0222B025BA5E6A0062E173"
BuildableName = "libevernote-sdk-ios mac.a"
BlueprintName = "evernote-sdk-ios mac"
ReferencedContainer = "container:evernote-sdk-ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CC0222B025BA5E6A0062E173"
BuildableName = "libevernote-sdk-ios mac.a"
BlueprintName = "evernote-sdk-ios mac"
ReferencedContainer = "container:evernote-sdk-ios.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
24 changes: 1 addition & 23 deletions evernote-sdk-ios/ENSDK/Advanced/ENPreferencesStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,6 @@ + (NSString *)pathnameForStoreFilename:(NSString *)filename

#elif TARGET_OS_MAC && !TARGET_OS_IPHONE

+ (NSString *)pathnameForStoreFilename:(NSString *)filename
{
static NSString *path = nil;
if(path == nil)
{
path = [[NSFileManager informantDocumentsDirectory] stringByAppendingPathComponent: @"Evernote"];
NSFileManager *fileMng = [NSFileManager defaultManager];
if([fileMng fileExistsAtPath: path] == NO)
{
NSError *error = nil;
if([fileMng createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error: &error] == NO)
{
[PILog error:[NSString stringWithFormat:@"Error created Evernote store file path: %@", [error description]]];
}
}

path = [path stringByAppendingPathComponent:filename];
}

return path;
}

//Apple's standard migration gets the file from the general preferences folder into this folder (which is the Library/Containers folder for the helper). However, we need to get this file into the Group Containers folder so main app + helper can play with it. That happens in migratePrefsToSandboxIfNecessary. This method just gives us the path to the interim place where Apple moves it.
+ (NSString *)_legacyInterimPathnameForStoreFilename:(NSString *)filename
{
Expand Down Expand Up @@ -111,7 +89,7 @@ - (id)initWithStoreFilename:(NSString *)filename
{
self = [super init];
if (self) {
self.pathname = [[self class] pathnameForStoreFilename:filename];
self.pathname = [ENSession pathnameForStoreFilename](filename);
[self load];
}
return self;
Expand Down
1 change: 1 addition & 0 deletions evernote-sdk-ios/ENSDK/ENSDKLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@
* @param str String to log.
*/
- (void)evernoteLogErrorString:(NSString *)str;

@end
10 changes: 9 additions & 1 deletion evernote-sdk-ios/ENSDK/ENSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@
*/

#import <Foundation/Foundation.h>

#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
typedef UIImage ENImage;
#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
#import <AppKit/AppKit.h>
typedef NSImage ENImage;
#endif

#import "ENSDKLogging.h"

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -49,7 +57,7 @@ typedef void (^ENSessionShareNoteCompletionHandler)(NSString *_Nullable url, NSE
typedef void (^ENSessionDeleteNoteCompletionHandler)(NSError *_Nullable deleteNoteError);
typedef void (^ENSessionFindNotesCompletionHandler)(NSArray<ENSessionFindNotesResult *> *_Nullable findNotesResults, NSError *_Nullable findNotesError);
typedef void (^ENSessionDownloadNoteCompletionHandler)(ENNote *_Nullable note, NSError *_Nullable downloadNoteError);
typedef void (^ENSessionDownloadNoteThumbnailCompletionHandler)(UIImage *_Nullable thumbnail, NSError *_Nullable downloadNoteThumbnailError);
typedef void (^ENSessionDownloadNoteThumbnailCompletionHandler)(ENImage *_Nullable thumbnail, NSError *_Nullable downloadNoteThumbnailError);

/**
* A value indicating how the session should approach creating vs. updating existing notes when uploading.
Expand Down
19 changes: 19 additions & 0 deletions evernote-sdk-ios/ENSDK/ENSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,23 @@ extension ENSession {

@objc
static var userDefaults: UserDefaults = UserDefaults.standard

#if os(macOS)

@objc
static var keychain: ENKeychain?

@objc
static var pathnameForStoreFilename: (String) -> String = { $0 }

#endif
}

@objc
protocol ENKeychain {
@objc(setSharedStringService:description:synchronizable:)
func set(sharedStringService: String, description: String?, synchronizable: Bool)

@objc(setData:forKey:error:)
func set(data: Data, for key: String) throws
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright (c) 2014 RoleModel Software. All rights reserved.
//

#if TARGET_OS_IPHONE

#import <UIKit/UIKit.h>

@protocol BackspaceDelegate <NSObject>
Expand All @@ -20,3 +22,6 @@
@interface RMSTextField : UITextField
@property (nonatomic, weak) id<BackspaceDelegate>backspaceDelegate;
@end


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import "RMSTextField.h"

#if TARGET_OS_IPHONE

@implementation RMSTextField

// http://stackoverflow.com/questions/25354467/detect-backspace-in-uitextfield-in-ios8
Expand Down Expand Up @@ -40,3 +42,6 @@ - (void)deleteBackward {
}

@end


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// To change the template use AppCode | Preferences | File Templates.
//

#if TARGET_OS_IPHONE

#import <UIKit/UIKit.h>
@class RMSTokenView;

Expand All @@ -24,3 +26,5 @@
- (void)updateConstraintsForTokenLines:(NSArray *)tokenLines andLineView:(UIView *)lineView withTextFieldFocus:(BOOL)textFieldHasFocus isSearching:(BOOL)isSearching;

@end

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// To change the template use AppCode | Preferences | File Templates.
//

#if TARGET_OS_IPHONE

#import "RMSTokenConstraintManager.h"
#import "RMSTokenView.h"
Expand Down Expand Up @@ -111,3 +112,5 @@ - (void)addConstraintsWithFormat:(NSString *)format withView:(UIView *)view toVi
}

@end

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright (c) 2013 RoleModel Software. All rights reserved.
//

#if TARGET_OS_IPHONE

#import <UIKit/UIKit.h>

#import "RMSTextField.h"
Expand Down Expand Up @@ -51,3 +53,5 @@
- (void)tokenView:(RMSTokenView *)tokenView didChangeText:(NSString *)text;

@end

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright (c) 2013 RoleModel Software. All rights reserved.
//

#if TARGET_OS_IPHONE

#import "RMSTokenView.h"
#import "RMSTokenConstraintManager.h"
#import "ENTheme.h"
Expand Down Expand Up @@ -570,3 +572,5 @@ - (NSArray *)tokens {
}

@end

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "ENSSKeychainQuery.h"
#import "ENSSKeychain.h"
#import "evernote_sdk_ios-Swift.h"

@implementation ENSSKeychainQuery

Expand Down Expand Up @@ -39,9 +40,9 @@ - (BOOL)save:(NSError *__autoreleasing *)error {

#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)

PIKeyChain *keyChain = [[PIKeyChain alloc] initWithSharedStringService:self.service description:PIKeyChain.defaultKeychainDescription synchronizable:NO accessibility:PIKeyChainAccessibilityAlways];
[[ENSession keychain] setSharedStringService:self.service description:nil synchronizable:NO];

[keyChain setData: self.passwordData forKey:self.account error:error];
[[ENSession keychain] setData:self.passwordData forKey:self.account error:error];

status = error == nil;

Expand Down
4 changes: 4 additions & 0 deletions evernote-sdk-ios/ENSDK/Private/ENLoadingViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#if TARGET_OS_IPHONE

#import <UIKit/UIKit.h>
@class ENLoadingViewController;

Expand All @@ -36,3 +38,5 @@
@interface ENLoadingViewController : UIViewController
@property (nonatomic, weak) id<ENLoadingViewControllerDelegate> delegate;
@end

#endif
4 changes: 4 additions & 0 deletions evernote-sdk-ios/ENSDK/Private/ENLoadingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#if TARGET_OS_IPHONE

#import "ENLoadingViewController.h"

@interface ENLoadingViewController ()
Expand Down Expand Up @@ -74,3 +76,5 @@ - (void)cancel:(id)sender
[self.delegate loadingViewControllerDidCancel:self];
}
@end

#endif
4 changes: 4 additions & 0 deletions evernote-sdk-ios/ENSDK/Private/ENNotebookCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#if TARGET_OS_IPHONE

#import <UIKit/UIKit.h>
#import "ENNotebook.h"
#import "ENNotebookTypeView.h"
Expand All @@ -41,3 +43,5 @@
@property (strong, nonatomic) ENNotebookTypeView *notebookTypeView;

@end

#endif
4 changes: 4 additions & 0 deletions evernote-sdk-ios/ENSDK/Private/ENNotebookCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#if TARGET_OS_IPHONE

#import "ENNotebookCell.h"
#import "ENTheme.h"

Expand Down Expand Up @@ -110,3 +112,5 @@ - (void)configureTextLabelColor {
}

@end

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#if TARGET_OS_IPHONE

#import <UIKit/UIKit.h>
#import "EvernoteSDK.h"
@class ENNotebookChooserViewController;
Expand All @@ -40,3 +42,5 @@
@property (nonatomic, strong) NSArray * recentNotebookList;
@property (nonatomic, strong) ENNotebook * currentNotebook;
@end

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#if TARGET_OS_IPHONE

#import "ENNotebookChooserViewController.h"
#import "ENNotebookCell.h"
#import "ENTheme.h"
Expand Down Expand Up @@ -245,3 +247,5 @@ - (BOOL)showRecentNotebook {
}

@end

#endif
4 changes: 4 additions & 0 deletions evernote-sdk-ios/ENSDK/Private/ENNotebookTypeView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#if TARGET_OS_IPHONE

#import <UIKit/UIKit.h>

@interface ENNotebookTypeView : UIView

@property(nonatomic, assign) BOOL isBusiness;

@end

#endif
Loading

0 comments on commit 651ae84

Please sign in to comment.