| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #import "TtdjPlugin.h"
- #import <DJGameVIPSDK/DJGameVIPSDK.h>
- #import "VipViewController.h"
- @interface TtdjPlugin() <FlutterPlugin>
- @property (nonatomic) UIViewController *viewController;
- @end
- @implementation TtdjPlugin
- + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
- UIViewController *viewController = [UIApplication sharedApplication].delegate.window.rootViewController;
- FlutterMethodChannel* channel = [FlutterMethodChannel
- methodChannelWithName:@"ttdj_plugin"
- binaryMessenger:[registrar messenger]];
- TtdjPlugin* instance = [[TtdjPlugin alloc] initWithViewController:viewController];
- [registrar addMethodCallDelegate:instance channel:channel];
- }
- - (instancetype)initWithViewController:(UIViewController *)viewController {
- self = [super init];
- if(self) {
- self.viewController = viewController;
- }
- return self;
- }
- - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
- if ([@"init" isEqualToString:call.method]) {
- NSString *userId = call.arguments[@"userId"];
- NSString *token = call.arguments[@"token"];
- [[DJGameManager defaultManager] configWithAppKey:@"1557281556ibPS1wFSicpPkbem8eW1" secret:@"ecO8lX8W8bQp8vQ9HVhE93t2"];
- [[DJGameManager defaultManager] configUserId:userId token:token];
- result(@"success");
- } else if ([@"gotoVipPage" isEqualToString:call.method]) {
- NSBundle *bundle = [NSBundle bundleForClass:[self class]];
- NSString *path = [bundle pathForResource:@"DJGameVIPSDK" ofType:@"framework"];
- NSBundle *SDKBundle = [NSBundle bundleWithPath:path];
- VipViewController *vc = [[VipViewController alloc] initWithNibName:@"DJGameVipViewController" bundle:SDKBundle];
- UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
- [self.viewController presentViewController:nvc animated:YES completion:nil];
- }
- }
- - (void)close {
-
- }
- @end
|