1234567891011121314151617181920212223242526272829303132333435 |
- #import "CompdfkitFlutterPlugin.h"
- #import "FLNativeView.h"
- #import <ComPDFKit/ComPDFKit.h>
- @implementation CompdfkitFlutterPlugin
- + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
-
- FlutterMethodChannel* channel = [FlutterMethodChannel
- methodChannelWithName:@"com.compdfkit.flutter.plugin"
- binaryMessenger:[registrar messenger]];
- CompdfkitFlutterPlugin* instance = [[CompdfkitFlutterPlugin alloc] init];
- [registrar addMethodCallDelegate:instance channel:channel];
-
- FLNativeViewFactory* factory =
- [[FLNativeViewFactory alloc] initWithMessenger:registrar.messenger];
- [registrar registerViewFactory:factory withId:@"com.compdfkit.flutter.pdfviewer"];
- }
- - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
- if ([@"sdk_version_code" isEqualToString:call.method]) {
- result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
- } else if ([@"init_sdk" isEqualToString:call.method]) {
- // NSDictionary *initInfo = (NSDictionary *)call.arguments;
- // NSString *key = initInfo[@"key"] ?: @"";
- // NSString *secret = initInfo[@"secret"] ?: @"";
- [CPDFKit setLicenseKey:@"rgFNqsZykKZ9g+uUEl59uYolfyQQha7hfKF3ojzs41pP3PBGfzPS/9CMwsBkJsqNBfULy7kBiUGXelugMdloJ+DWqE5Zjt4+xP6t2paXuFOPX/uXy6G/9vZkuEGSIFfBpUzrCgcXs4xxh8k5+sAfW+EA7DvUgt7u0CcPRyqr1Jg=" secret:@"mG0c3O3Mzeu5dkZJW3gpqiAYrD3HuVAh2a+2rjOsIRhyTBaXPgPRGke3LtDII3XZqZRGhToxzSR51pXlzib4f0WpLOaOv47bs7x+UqfQzn9hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBwyVLBY93oKLBB8UJg4t07605BGbaBKUlDopA0iGq1HSncUNNe38VRnoTm6ibgXyIGz5dhD0tvZsf2Vt2my9XP/2scnSpUeS12jwHQXiCsaaK/oKTJGcYKLPGdXenrzHolQ=="];
- }else {
- result(FlutterMethodNotImplemented);
- }
- }
- @end
|