forked from FMXExpress/ios-object-pascal-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iOSapi.NewsstandKit.pas
155 lines (117 loc) · 3.74 KB
/
iOSapi.NewsstandKit.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{ *********************************************************** }
{ }
{ CodeGear Delphi Runtime Library }
{ }
{ Copyright(c) 2012-2014 Embarcadero Technologies, Inc. }
{ }
{ *********************************************************** }
//
// Delphi-Objective-C Bridge
// Interfaces for Cocoa framework NewsstandKit
//
unit iOSapi.NewsstandKit;
interface
uses
Macapi.CoreFoundation,
Macapi.CoreServices,
Macapi.Dispatch,
Macapi.Foundation,
Macapi.Mach,
Macapi.ObjCRuntime,
Macapi.ObjectiveC,
Macapi.QuartzCore,
iOSapi.CocoaTypes,
iOSapi.Foundation;
const
NKIssueContentStatusNone = 0;
NKIssueContentStatusDownloading = 1;
NKIssueContentStatusAvailable = 2;
type
// ===== Forward declarations =====
{$M+}
NKIssue = interface;
NKAssetDownload = interface;
NKLibrary = interface;
NKAssetDownloadAdditions = interface;
// ===== Framework typedefs =====
{$M+}
NSInteger = Integer;
NKIssueContentStatus = NSInteger;
// ===== Interface declarations =====
NKIssueClass = interface(NSObjectClass)
['{C970D91A-0681-48F7-8A8A-30C4006807E2}']
end;
NKIssue = interface(NSObject)
['{ECF5C8AD-3FC3-4C11-87D5-03E680F3DF71}']
function downloadingAssets: NSArray; cdecl;
function contentURL: NSURL; cdecl;
function status: NKIssueContentStatus; cdecl;
function name: NSString; cdecl;
function date: NSDate; cdecl;
function addAssetWithRequest(request: NSURLRequest): NKAssetDownload; cdecl;
end;
TNKIssue = class(TOCGenericImport<NKIssueClass, NKIssue>)
end;
PNKIssue = Pointer;
NKAssetDownloadClass = interface(NSObjectClass)
['{5BB85842-6154-4EB0-AEF6-5218A1F5BB26}']
end;
NKAssetDownload = interface(NSObject)
['{7ED0D4AF-6228-4F77-9617-F4227325843D}']
function issue: NKIssue; cdecl;
function identifier: NSString; cdecl;
procedure setUserInfo(userInfo: NSDictionary); cdecl;
function userInfo: NSDictionary; cdecl;
function URLRequest: NSURLRequest; cdecl;
function downloadWithDelegate(delegate: Pointer): NSURLConnection; cdecl;
end;
TNKAssetDownload = class(TOCGenericImport<NKAssetDownloadClass,
NKAssetDownload>)
end;
PNKAssetDownload = Pointer;
NKLibraryClass = interface(NSObjectClass)
['{240B1757-0555-45AB-A62B-2B672E8E997A}']
{ class } function sharedLibrary: NKLibrary; cdecl;
end;
NKLibrary = interface(NSObject)
['{6B64BA48-5607-47AF-A0C4-8F71F1AD2AB1}']
function issues: NSArray; cdecl;
function downloadingAssets: NSArray; cdecl;
procedure setCurrentlyReadingIssue(currentlyReadingIssue: NKIssue); cdecl;
function currentlyReadingIssue: NKIssue; cdecl;
function issueWithName(name: NSString): NKIssue; cdecl;
function addIssueWithName(name: NSString; date: NSDate): NKIssue; cdecl;
procedure removeIssue(issue: NKIssue); cdecl;
end;
TNKLibrary = class(TOCGenericImport<NKLibraryClass, NKLibrary>)
end;
PNKLibrary = Pointer;
NKAssetDownloadAdditions = interface(IObjectiveC)
['{87ECE995-B2B3-4437-9EF1-9C2F2EBE0735}']
function newsstandAssetDownload: NKAssetDownload; cdecl;
end;
// ===== Exported string consts =====
function NKIssueDownloadCompletedNotification: NSString;
// ===== External functions =====
const
libNewsstandKit =
'/System/Library/Frameworks/NewsstandKit.framework/NewsstandKit';
implementation
{$IF defined(IOS) and NOT defined(CPUARM)}
uses
Posix.Dlfcn;
var
NewsstandKitModule: THandle;
{$ENDIF IOS}
function NKIssueDownloadCompletedNotification: NSString;
begin
Result := CocoaNSStringConst(libNewsstandKit,
'NKIssueDownloadCompletedNotification');
end;
{$IF defined(IOS) and NOT defined(CPUARM)}
initialization
NewsstandKitModule := dlopen(MarshaledAString(libNewsstandKit), RTLD_LAZY);
finalization
dlclose(NewsstandKitModule);
{$ENDIF IOS}
end.