| | |
| | | @implementation ShonpingShareViewController |
| | | - (void)viewWillAppear:(BOOL)animated{ |
| | | [super viewWillAppear:animated]; |
| | | |
| | | self.navigationController.navigationBar.translucent = NO; |
| | | |
| | | self.navigationController.navigationBar.barTintColor = [UIColor whiteColor]; |
| | | |
| | | self.tabBarController.tabBar.hidden = YES; |
| | | |
| | | self.navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:XYRMainColor,NSFontAttributeName:[UIFont boldSystemFontOfSize:17]}; |
| | | |
| | | UIImage *image = [UIImage imageNamed:@"F72A37B3-8434-44EE-A2BA-BDCEB598C99F"]; |
| | |
| | | [backbutton addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside]; |
| | | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backbutton]; |
| | | |
| | | [self.webView removeFromSuperview]; |
| | | self.webView.delegate = self; |
| | | self.webView = nil; |
| | | [self.view addSubview:self.webView]; |
| | | _interface = [[MyJSInterface alloc] init]; |
| | | [self.webView addJavascriptInterfaces:_interface WithName:@"yestv"]; |
| | | [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlString]]]; |
| | | } |
| | | |
| | | - (void)back:(UIButton *)sender { |
| | | if (self.isHelpBack) { |
| | | [self.webView removeFromSuperview]; |
| | | self.webView.delegate = self; |
| | | self.webView = nil; |
| | | [self.view addSubview:self.webView]; |
| | | _interface = [MyJSInterface new]; |
| | | _interface = [[MyJSInterface alloc] init]; |
| | | [self.webView addJavascriptInterfaces:_interface WithName:@"yestv"]; |
| | | [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlString]]]; |
| | | self.isHelpBack = NO; |
| | |
| | | [self.view addSubview:self.webView]; |
| | | [self.view addSubview:self.loadingProgressView]; |
| | | |
| | | |
| | | _interface = [MyJSInterface new]; |
| | | |
| | | [self.webView addJavascriptInterfaces:_interface WithName:@"yestv"]; |
| | | |
| | | [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlString]]]; |
| | | } |
| | | |
| | | - (void)viewWillDisappear:(BOOL)animated { |
| | | [super viewWillDisappear:animated]; |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | [shareView tappedCancel]; |
| | | } |
| | | - (UIImage*)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize |
| | | { |
| | | // Create a graphics image context |
| | | UIGraphicsBeginImageContext(newSize); |
| | | // Tell the old image to draw in this new context, with the desired |
| | | // new size |
| | | [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; |
| | | // Get the new image from the context |
| | | UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); |
| | | // End the context |
| | | UIGraphicsEndImageContext(); |
| | | // Return the new image. |
| | | return newImage; |
| | | } |
| | | |
| | | /** |
| | | å享 |
| | |
| | | |
| | | if (shareType == SSDKPlatformSubTypeWechatTimeline || shareType == SSDKPlatformSubTypeWechatSession) { |
| | | if (![WXApi isWXAppInstalled]) { |
| | | [SVProgressHUD setContainerView:[UIApplication sharedApplication].delegate.window]; |
| | | [SVProgressHUD showInfoWithStatus:@"微信æªå®è£
"]; |
| | | |
| | | ALToastCenter(@"微信æªå®è£
"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if ( SSDKPlatformSubTypeQQFriend == shareType || shareType == SSDKPlatformSubTypeQZone ) { |
| | | if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://"]]) { |
| | | [SVProgressHUD setContainerView:[UIApplication sharedApplication].delegate.window]; |
| | | [SVProgressHUD showInfoWithStatus:@"QQæªå®è£
"]; |
| | | |
| | | ALToastCenter(@"QQæªå®è£
"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (shareType == SSDKPlatformSubTypeQZone) { |
| | | type = SSDKContentTypeImage; |
| | | } |
| | |
| | | if ( [urlString containsString:@"yeshitv://fanli_invite"]) { |
| | | if ([YTHsharedManger startManger].networkStatus == 0) { |
| | | |
| | | [CustomProgressHUD showNormal:@"ç½ç»æªè¿æ¥ï¼è¯·æ£æµç½ç»è®¾ç½®"]; |
| | | ALToastCenter(@"ç½ç»æªè¿æ¥ï¼è¯·æ£æµç½ç»è®¾ç½®"); |
| | | |
| | | return NO; |
| | | } |
| | | |
| | | if ([YTHsharedManger startManger].isCheckNetCanUse == -2) { |
| | | |
| | | [CustomProgressHUD showNormal:@"ç½ç»è¿æ¥å¼å¸¸ï¼è¯·æ£æµç½ç»è®¾ç½®"]; |
| | | ALToastCenter(@"ç½ç»è¿æ¥å¼å¸¸ï¼è¯·æ£æµç½ç»è®¾ç½®"); |
| | | |
| | | return NO; |
| | | } |
| | |
| | | NSLog(@"%@",decodedString); |
| | | UIPasteboard*pasteboard = [UIPasteboard generalPasteboard]; |
| | | pasteboard.string=decodedString; |
| | | [SVProgressHUD showSuccessWithStatus:@"å¤å¶æåï¼"]; |
| | | |
| | | |
| | | }else if([array[0] isEqualToString:@"yestv://share"]){ |
| | | NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:array[2] options:0]; |
| | | NSString *decodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding]; |
| | |
| | | }; |
| | | |
| | | } |
| | | - (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString |
| | | { |
| | | - (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString { |
| | | if (jsonString == nil) { |
| | | return nil; |
| | | } |
| | |
| | | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData |
| | | options:NSJSONReadingMutableContainers |
| | | error:&err]; |
| | | if(err) |
| | | { |
| | | if (err) { |
| | | NSLog(@"jsonè§£æå¤±è´¥ï¼%@",err); |
| | | return nil; |
| | | } |
| | |
| | | decisionHandler(WKNavigationActionPolicyCancel); |
| | | NSArray *array = [url componentsSeparatedByString:@"#"]; |
| | | if([array[0] isEqualToString:@"fanli://yaoqin"]){ |
| | | // shareMeassageArr=array; |
| | | |
| | | NSArray *shareAry = @[ |
| | | @{@"image":@"new微信", |
| | | @"title":@"微信"}, |
| | |
| | | - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{ |
| | | NSLog(@"%@",error); |
| | | self.isField = YES; |
| | | self.title = @"ç½é¡µæ æ³æå¼"; |
| | | NSNotification *notice = [[NSNotification alloc]initWithName:@"netWorkChangeEventNotification" object:@([YTHsharedManger startManger].networkStatus) userInfo:nil]; |
| | | [self NetWorkStatesChange:notice]; |
| | | // self.title = @"ç½é¡µæ æ³æå¼"; |
| | | // NSNotification *notice = [[NSNotification alloc]initWithName:@"netWorkChangeEventNotification" object:@([YTHsharedManger startManger].networkStatus) userInfo:nil]; |
| | | // [self NetWorkStatesChange:notice]; |
| | | } |
| | | - (void)loadData { |
| | | |
| | |
| | | [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlString]]]; |
| | | |
| | | if (!self.urlString) { |
| | | // [CustomProgressHUD showNormal:@"ç½ç»è¿æ¥å¼å¸¸ï¼è¯·æ£æµç½ç»è®¾ç½®"]; |
| | | |
| | | [self.navigationController popViewControllerAnimated:YES]; |
| | | } |
| | | } |
| | |
| | | if (self.isHelpBack) { |
| | | height = 0; |
| | | } |
| | | _webView = [[EasyJSWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - height)]; |
| | | _webView = [[EasyJSWebView alloc]initWithFrame:CGRectMake(0, 0, KScreenW, KScreenH - height)]; |
| | | _webView.scalesPageToFit = YES; |
| | | _webView.delegate = self; |
| | | //å è½½è¿åº¦çå¬ |
| | |
| | | |
| | | - (void)webViewReload { |
| | | if (!self.isshareType) { |
| | | [_webView reload]; |
| | | [self.webView reload]; |
| | | } |
| | | |
| | | } |
| | | - (void)dealloc{ |
| | | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| | | [_webView removeObserver:self forKeyPath:@"estimatedProgress"]; |
| | | |
| | | [self.webView removeObserver:self forKeyPath:@"estimatedProgress"]; |
| | | self.webView.delegate = self; |
| | | [self.webView removeFromSuperview]; |
| | | self.webView = nil; |
| | | |
| | | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| | | |
| | | |
| | | NSHTTPCookie *cookie; |
| | | NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; |
| | | |
| | | for (cookie in [storage cookies]) { |
| | | |
| | | [storage deleteCookie:cookie]; |
| | | } |
| | | // æ¸
é¤webViewçç¼å |
| | | [[NSURLCache sharedURLCache] removeAllCachedResponses]; |
| | | } |
| | | - (void)didReceiveMemoryWarning { |
| | | [super didReceiveMemoryWarning]; |