Skip to content

Commit

Permalink
chore: check in frameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
markemer committed Oct 24, 2023
1 parent 126e40c commit 8cdf910
Show file tree
Hide file tree
Showing 94 changed files with 105,992 additions and 0 deletions.
48 changes: 48 additions & 0 deletions ios/Frameworks/Capacitor.xcframework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>Capacitor.framework/Capacitor</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>Capacitor.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>Capacitor.framework/Capacitor</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>Capacitor.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#import "CAPPluginMethod.h"

#if defined(__cplusplus)
#define CAP_EXTERN extern "C" __attribute__((visibility("default")))
#else
#define CAP_EXTERN extern __attribute__((visibility("default")))
#endif

#define CAPPluginReturnNone @"none"
#define CAPPluginReturnCallback @"callback"
#define CAPPluginReturnPromise @"promise"
#define CAPPluginReturnWatch @"watch"
#define CAPPluginReturnSync @"sync" // not used

@class CAPPluginCall;
@class CAPPlugin;

@protocol CAPBridgedPlugin <NSObject>
@property (nonnull, readonly) NSString *identifier;
@property (nonnull, readonly) NSString *jsName;
@property (nonnull, readonly) NSArray<CAPPluginMethod *> *pluginMethods;
@end

#define CAP_PLUGIN_CONFIG(plugin_id, js_name) \
- (NSString *)identifier { return @#plugin_id; } \
- (NSString *)jsName { return @js_name; }
#define CAP_PLUGIN_METHOD(method_name, method_return_type) \
[methods addObject:[[CAPPluginMethod alloc] initWithName:@#method_name returnType:method_return_type]]

#define CAP_PLUGIN(objc_name, js_name, methods_body) \
@interface objc_name : NSObject \
@end \
@interface objc_name (CAPPluginCategory) <CAPBridgedPlugin> \
@end \
@implementation objc_name (CAPPluginCategory) \
- (NSArray *)pluginMethods { \
NSMutableArray *methods = [NSMutableArray new]; \
methods_body \
return methods; \
} \
CAP_PLUGIN_CONFIG(objc_name, js_name) \
@end

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef CAPInstanceConfiguration_h
#define CAPInstanceConfiguration_h

@import UIKit;

@class CAPInstanceDescriptor;

NS_SWIFT_NAME(InstanceConfiguration)
@interface CAPInstanceConfiguration: NSObject
@property (nonatomic, readonly, nullable) NSString *appendedUserAgentString;
@property (nonatomic, readonly, nullable) NSString *overridenUserAgentString;
@property (nonatomic, readonly, nullable) UIColor *backgroundColor;
@property (nonatomic, readonly, nonnull) NSArray<NSString*> *allowedNavigationHostnames;
@property (nonatomic, readonly, nonnull) NSURL *localURL;
@property (nonatomic, readonly, nonnull) NSURL *serverURL;
@property (nonatomic, readonly, nullable) NSString *errorPath;
@property (nonatomic, readonly, nonnull) NSDictionary *pluginConfigurations;
@property (nonatomic, readonly) BOOL loggingEnabled;
@property (nonatomic, readonly) BOOL scrollingEnabled;
@property (nonatomic, readonly) BOOL zoomingEnabled;
@property (nonatomic, readonly) BOOL allowLinkPreviews;
@property (nonatomic, readonly) BOOL handleApplicationNotifications;
@property (nonatomic, readonly) BOOL isWebDebuggable;
@property (nonatomic, readonly) BOOL cordovaDeployDisabled;
@property (nonatomic, readonly) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior;
@property (nonatomic, readonly, nonnull) NSURL *appLocation;
@property (nonatomic, readonly, nullable) NSString *appStartPath;
@property (nonatomic, readonly) BOOL limitsNavigationsToAppBoundDomains;
@property (nonatomic, readonly, nullable) NSString *preferredContentMode;

@property (nonatomic, readonly, nonnull) NSDictionary *legacyConfig DEPRECATED_MSG_ATTRIBUTE("Use direct properties instead");

- (instancetype _Nonnull)initWithDescriptor:(CAPInstanceDescriptor* _Nonnull)descriptor isDebug:(BOOL)debug NS_SWIFT_NAME(init(with:isDebug:));
- (instancetype _Nonnull)updatingAppLocation:(NSURL* _Nonnull)location NS_SWIFT_NAME(updatingAppLocation(_:));
@end

#endif /* CAPInstanceConfiguration_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
#ifndef CAPInstanceDescriptor_h
#define CAPInstanceDescriptor_h

@import UIKit;
@import Cordova;

typedef NS_ENUM(NSInteger, CAPInstanceType) {
CAPInstanceTypeFixed NS_SWIFT_NAME(fixed),
CAPInstanceTypeVariable NS_SWIFT_NAME(variable)
} NS_SWIFT_NAME(InstanceType);

typedef NS_OPTIONS(NSUInteger, CAPInstanceWarning) {
CAPInstanceWarningMissingAppDir NS_SWIFT_NAME(missingAppDir) = 1 << 0,
CAPInstanceWarningMissingFile NS_SWIFT_NAME(missingFile) = 1 << 1,
CAPInstanceWarningInvalidFile NS_SWIFT_NAME(invalidFile) = 1 << 2,
CAPInstanceWarningMissingCordovaFile NS_SWIFT_NAME(missingCordovaFile) = 1 << 3,
CAPInstanceWarningInvalidCordovaFile NS_SWIFT_NAME(invalidCordovaFile) = 1 << 4
} NS_SWIFT_NAME(InstanceWarning);

typedef NS_OPTIONS(NSUInteger, CAPInstanceLoggingBehavior) {
CAPInstanceLoggingBehaviorNone NS_SWIFT_NAME(none) = 1 << 0,
CAPInstanceLoggingBehaviorDebug NS_SWIFT_NAME(debug) = 1 << 1,
CAPInstanceLoggingBehaviorProduction NS_SWIFT_NAME(production) = 1 << 2,
} NS_SWIFT_NAME(InstanceLoggingBehavior);

extern NSString * _Nonnull const CAPInstanceDescriptorDefaultScheme NS_SWIFT_UNAVAILABLE("Use InstanceDescriptorDefaults");
extern NSString * _Nonnull const CAPInstanceDescriptorDefaultHostname NS_SWIFT_UNAVAILABLE("Use InstanceDescriptorDefaults");

NS_SWIFT_NAME(InstanceDescriptor)
@interface CAPInstanceDescriptor : NSObject
/**
@brief A value to append to the @c User-Agent string. Ignored if @c overridenUserAgentString is set.
@discussion Set by @c appendUserAgent in the configuration file.
*/
@property (nonatomic, copy, nullable) NSString *appendedUserAgentString;
/**
@brief A value that will completely replace the @c User-Agent string. Overrides @c appendedUserAgentString.
@discussion Set by @c overrideUserAgent in the configuration file.
*/
@property (nonatomic, copy, nullable) NSString *overridenUserAgentString;
/**
@brief The background color to set on the web view where content is not visible.
@discussion Set by @c backgroundColor in the configuration file.
*/
@property (nonatomic, retain, nullable) UIColor *backgroundColor;
/**
@brief Hostnames to which the web view is allowed to navigate without opening an external browser.
@discussion Set by @c allowNavigation in the configuration file.
*/
@property (nonatomic, copy, nonnull) NSArray<NSString*> *allowedNavigationHostnames;
/**
@brief The scheme that will be used for the server URL.
@discussion Defaults to @c capacitor. Set by @c server.iosScheme in the configuration file.
*/
@property (nonatomic, copy, nullable) NSString *urlScheme;
/**
@brief The path to a local html page to display in case of errors.
@discussion Defaults to nil.
*/
@property (nonatomic, copy, nullable) NSString *errorPath;
/**
@brief The hostname that will be used for the server URL.
@discussion Defaults to @c localhost. Set by @c server.hostname in the configuration file.
*/
@property (nonatomic, copy, nullable) NSString *urlHostname;
/**
@brief The fully formed URL that will be used as the server URL.
@discussion Defaults to nil, in which case the server URL will be constructed from @c urlScheme and @c urlHostname. If set, it will override the other properties. Set by @c server.url in the configuration file.
*/
@property (nonatomic, copy, nullable) NSString *serverURL;
/**
@brief The JSON dictionary that contains the plugin-specific configuration information.
@discussion Set by @c plugins in the configuration file.
*/
@property (nonatomic, retain, nonnull) NSDictionary *pluginConfigurations;
/**
@brief The build configurations under which logging should be enabled.
@discussion Defaults to @c debug. Set by @c loggingBehavior in the configuration file.
*/
@property (nonatomic, assign) CAPInstanceLoggingBehavior loggingBehavior;
/**
@brief Whether or not the web view can scroll.
@discussion Set by @c ios.scrollEnabled in the configuration file. Corresponds to @c isScrollEnabled on WKWebView.
*/
@property (nonatomic, assign) BOOL scrollingEnabled;
/**
@brief Whether or not the web view can zoom.
@discussion Set by @c zoomEnabled in the configuration file.
*/
@property (nonatomic, assign) BOOL zoomingEnabled;
/**
@brief Whether or not the web view will preview links.
@discussion Set by @c ios.allowsLinkPreview in the configuration file. Corresponds to @c allowsLinkPreview on WKWebView.
*/
@property (nonatomic, assign) BOOL allowLinkPreviews;
/**
@brief Whether or not the Capacitor runtime will set itself as the @c UNUserNotificationCenter delegate.
@discussion Defaults to @c true. Required to be @c true for notification plugins to work correctly. Set to @c false if your application will handle notifications independently.
*/
@property (nonatomic, assign) BOOL handleApplicationNotifications;
/**
@brief Enables web debugging by setting isInspectable of @c WKWebView to @c true on iOS 16.4 and greater
@discussion Defaults to true in debug mode and false in production
*/
@property (nonatomic, assign) BOOL isWebDebuggable;
/**
@brief How the web view will inset its content
@discussion Set by @c ios.contentInset in the configuration file. Corresponds to @c contentInsetAdjustmentBehavior on WKWebView.
*/
@property (nonatomic, assign) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior;
/**
@brief The base file URL from which Capacitor will load resources
@discussion Defaults to @c public/ located at the root of the application bundle.
*/
@property (nonatomic, copy, nonnull) NSURL *appLocation;
/**
@brief The path (relative to @c appLocation) which Capacitor will use for the inital URL at launch.
@discussion Defaults to nil, in which case Capacitor will attempt to load @c index.html.
*/
@property (nonatomic, copy, nullable) NSString *appStartPath;
/**
@brief Whether or not the Capacitor WebView will limit the navigation to @c WKAppBoundDomains listed in the Info.plist.
@discussion Defaults to @c false. Set by @c ios.limitsNavigationsToAppBoundDomains in the configuration file. Required to be @c true for plugins to work if the app includes @c WKAppBoundDomains in the Info.plist.
*/
@property (nonatomic, assign) BOOL limitsNavigationsToAppBoundDomains;
/**
@brief The content mode for the web view to use when it loads and renders web content.
@discussion Defaults to @c recommended. Set by @c ios.preferredContentMode in the configuration file.
*/
@property (nonatomic, copy, nullable) NSString *preferredContentMode;
/**
@brief The parser used to load the cofiguration for Cordova plugins.
*/
@property (nonatomic, copy, nonnull) CDVConfigParser *cordovaConfiguration;
/**
@brief Warnings generated during initialization.
*/
@property (nonatomic, assign) CAPInstanceWarning warnings;
/**
@brief The type of instance.
*/
@property (nonatomic, readonly) CAPInstanceType instanceType;
/**
@brief The JSON dictionary representing the contents of the configuration file.
@warning Deprecated. Do not use.
*/
@property (nonatomic, retain, nonnull) NSDictionary *legacyConfig;
/**
@brief Initialize the descriptor with the default environment. This assumes that the application was built with the help of the Capacitor CLI and that that the web app is located inside the application bundle at @c public/.
*/
- (instancetype _Nonnull)initAsDefault NS_SWIFT_NAME(init());
/**
@brief Initialize the descriptor for use in other contexts. The app location is the one required parameter.
@param appURL The location of the folder containing the web app.
@param configURL The location of the Capacitor configuration file.
@param cordovaURL The location of the Cordova configuration file.
*/
- (instancetype _Nonnull)initAtLocation:(NSURL* _Nonnull)appURL configuration:(NSURL* _Nullable)configURL cordovaConfiguration:(NSURL* _Nullable)cordovaURL NS_SWIFT_NAME(init(at:configuration:cordovaConfiguration:));
@end

#endif /* CAPInstanceDescriptor_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#import <Foundation/Foundation.h>
#import <WebKit/WebKit.h>

@protocol CAPBridgeProtocol;
@class CAPPluginCall;

@class PluginConfig;

@interface CAPPlugin : NSObject

@property (nonatomic, weak, nullable) WKWebView *webView;
@property (nonatomic, weak, nullable) id<CAPBridgeProtocol> bridge;
@property (nonatomic, strong, nonnull) NSString *pluginId;
@property (nonatomic, strong, nonnull) NSString *pluginName;
@property (nonatomic, strong, nullable) NSMutableDictionary<NSString *, NSMutableArray<CAPPluginCall *>*> *eventListeners;
@property (nonatomic, strong, nullable) NSMutableDictionary<NSString *, NSMutableArray<id> *> *retainedEventArguments;
@property (nonatomic, assign) BOOL shouldStringifyDatesInCalls;

- (instancetype _Nonnull) initWithBridge:(id<CAPBridgeProtocol> _Nonnull) bridge pluginId:(NSString* _Nonnull) pluginId pluginName:(NSString* _Nonnull) pluginName DEPRECATED_MSG_ATTRIBUTE("This initializer is deprecated and is not suggested for use. Any data set through this init method will be overridden when it is loaded on the bridge.");
- (void)addEventListener:(NSString* _Nonnull)eventName listener:(CAPPluginCall* _Nonnull)listener;
- (void)removeEventListener:(NSString* _Nonnull)eventName listener:(CAPPluginCall* _Nonnull)listener;
- (void)notifyListeners:(NSString* _Nonnull)eventName data:(NSDictionary<NSString *, id>* _Nullable)data;
- (void)notifyListeners:(NSString* _Nonnull)eventName data:(NSDictionary<NSString *, id>* _Nullable)data retainUntilConsumed:(BOOL)retain;
- (NSArray<CAPPluginCall *>* _Nullable)getListeners:(NSString* _Nonnull)eventName;
- (BOOL)hasListeners:(NSString* _Nonnull)eventName;
- (void)addListener:(CAPPluginCall* _Nonnull)call;
- (void)removeListener:(CAPPluginCall* _Nonnull)call;
- (void)removeAllListeners:(CAPPluginCall* _Nonnull)call;
/**
* Default implementation of the capacitor 3.0 permission pattern
*/
- (void)checkPermissions:(CAPPluginCall* _Nonnull)call;
- (void)requestPermissions:(CAPPluginCall* _Nonnull)call;
/**
* Give the plugins a chance to take control when a URL is about to be loaded in the WebView.
* Returning true causes the WebView to abort loading the URL.
* Returning false causes the WebView to continue loading the URL.
* Returning nil will defer to the default Capacitor policy
*/
- (NSNumber* _Nullable)shouldOverrideLoad:(WKNavigationAction* _Nonnull)navigationAction;

// Called after init if the plugin wants to do
// some loading so the plugin author doesn't
// need to override init()
-(void)load;
-(NSString* _Nonnull)getId;
-(BOOL)getBool:(CAPPluginCall* _Nonnull) call field:(NSString* _Nonnull)field defaultValue:(BOOL)defaultValue DEPRECATED_MSG_ATTRIBUTE("Use accessors on CAPPluginCall instead. See CAPBridgedJSTypes.h for Obj-C implementations.");
-(NSString* _Nullable)getString:(CAPPluginCall* _Nonnull)call field:(NSString* _Nonnull)field defaultValue:(NSString* _Nonnull)defaultValue DEPRECATED_MSG_ATTRIBUTE("Use accessors on CAPPluginCall instead. See CAPBridgedJSTypes.h for Obj-C implementations.");
-(id _Nullable)getConfigValue:(NSString* _Nonnull)key __deprecated_msg("use getConfig() and access config values using the methods available depending on the type.");
-(PluginConfig* _Nonnull)getConfig;
-(void)setCenteredPopover:(UIViewController* _Nonnull) vc;
-(void)setCenteredPopover:(UIViewController* _Nonnull) vc size:(CGSize) size;
-(BOOL)supportsPopover DEPRECATED_MSG_ATTRIBUTE("All iOS 13+ devices support popover");

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#import <Foundation/Foundation.h>

@class CAPPluginCall;
@class CAPPluginCallResult;
@class CAPPluginCallError;

typedef void(^CAPPluginCallSuccessHandler)(CAPPluginCallResult *result, CAPPluginCall* call);
typedef void(^CAPPluginCallErrorHandler)(CAPPluginCallError *error);

@interface CAPPluginCall : NSObject

@property (nonatomic, assign) BOOL isSaved DEPRECATED_MSG_ATTRIBUTE("Use 'keepAlive' instead.");
@property (nonatomic, assign) BOOL keepAlive;
@property (nonatomic, strong) NSString *callbackId;
@property (nonatomic, strong) NSDictionary *options;
@property (nonatomic, copy) CAPPluginCallSuccessHandler successHandler;
@property (nonatomic, copy) CAPPluginCallErrorHandler errorHandler;

- (instancetype)initWithCallbackId:(NSString *)callbackId options:(NSDictionary *)options success:(CAPPluginCallSuccessHandler)success error:(CAPPluginCallErrorHandler)error;

- (void)save DEPRECATED_MSG_ATTRIBUTE("Use the 'keepAlive' property instead.");
@end
Loading

0 comments on commit 8cdf910

Please sign in to comment.