CompdfkitFlutterPlugin.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #import "CompdfkitFlutterPlugin.h"
  2. #import "FLNativeView.h"
  3. #import <ComPDFKit/ComPDFKit.h>
  4. @implementation CompdfkitFlutterPlugin
  5. + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
  6. FlutterMethodChannel* channel = [FlutterMethodChannel
  7. methodChannelWithName:@"com.compdfkit.flutter.plugin"
  8. binaryMessenger:[registrar messenger]];
  9. CompdfkitFlutterPlugin* instance = [[CompdfkitFlutterPlugin alloc] init];
  10. [registrar addMethodCallDelegate:instance channel:channel];
  11. FLNativeViewFactory* factory =
  12. [[FLNativeViewFactory alloc] initWithMessenger:registrar.messenger];
  13. [registrar registerViewFactory:factory withId:@"com.compdfkit.flutter.pdfviewer"];
  14. }
  15. - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
  16. if ([@"sdk_version_code" isEqualToString:call.method]) {
  17. result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
  18. } else if ([@"init_sdk" isEqualToString:call.method]) {
  19. // NSDictionary *initInfo = (NSDictionary *)call.arguments;
  20. // NSString *key = initInfo[@"key"] ?: @"";
  21. // NSString *secret = initInfo[@"secret"] ?: @"";
  22. [CPDFKit setLicenseKey:@"rgFNqsZykKZ9g+uUEl59uYolfyQQha7hfKF3ojzs41pP3PBGfzPS/9CMwsBkJsqNBfULy7kBiUGXelugMdloJ+DWqE5Zjt4+xP6t2paXuFOPX/uXy6G/9vZkuEGSIFfBpUzrCgcXs4xxh8k5+sAfW+EA7DvUgt7u0CcPRyqr1Jg=" secret:@"mG0c3O3Mzeu5dkZJW3gpqiAYrD3HuVAh2a+2rjOsIRhyTBaXPgPRGke3LtDII3XZqZRGhToxzSR51pXlzib4f0WpLOaOv47bs7x+UqfQzn9hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBwyVLBY93oKLBB8UJg4t07605BGbaBKUlDopA0iGq1HSncUNNe38VRnoTm6ibgXyIGz5dhD0tvZsf2Vt2my9XP/2scnSpUeS12jwHQXiCsaaK/oKTJGcYKLPGdXenrzHolQ=="];
  23. }else {
  24. result(FlutterMethodNotImplemented);
  25. }
  26. }
  27. @end