1、变更推送为阿里云推,清除云信IM以及推送内容;
2、消息页面全新改版; 3、部分微小Bug修复
This commit is contained in:
+53
-426
@@ -15,7 +15,7 @@
|
||||
#import "RegistViewController.h"
|
||||
#import "AFNetworking.h"
|
||||
#import "IfishDatabaseManager.h"
|
||||
#import "PushmassageModel.h"
|
||||
#import "PushmessageModel.h"
|
||||
#import "ConnectWifiViewController.h"
|
||||
#import "UserModel.h"
|
||||
#import "DeviceModel.h"
|
||||
@@ -24,6 +24,7 @@
|
||||
#import "DownLoadViewController.h"
|
||||
//#define RONYUN_APPKEY @"pgyu6atqyxxlu"// 融云appkey
|
||||
#import "ChatroomModel.h"
|
||||
#import "SVProgressHUD.h"
|
||||
#define GETRONG_TOKEN 4310
|
||||
#define iPhone6 \
|
||||
([UIScreen instancesRespondToSelector:@selector(currentMode)] \
|
||||
@@ -46,6 +47,7 @@
|
||||
#import <UMCommunitySDK/UMCommunitySDK.h>
|
||||
#import <UMCommunitySDK/UMComSession.h>
|
||||
#import <UMSocialCore/UMSocialCore.h>
|
||||
#import "AppDelegate+AliPushConfig.h"
|
||||
#define UMCommunity_APPKEY @"569f530fe0f55a3e9a002502"
|
||||
#define UMCommunity_SECRET @"462384e695d18d287ee46c423c5dce34"
|
||||
|
||||
@@ -73,29 +75,18 @@
|
||||
#import "AccountResult.h"
|
||||
#import "ContactDAO.h"
|
||||
#import "IfishMianTabViewController.h"
|
||||
//云信
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#define NIMAPPKEY @"87b0e3315dfc2df08060bcb54246da68"
|
||||
#import "NTESDataManager.h"
|
||||
#import "NTESCustomAttachmentDecoder.h"
|
||||
#define NIMCERNAME_DEVL @"Ifishpushdevelopment"
|
||||
#define NIMCERNAME_PRO @"Ifishpushproduction"
|
||||
//#import "NTESLogManager.h"
|
||||
#import "NTESLoginManager.h"
|
||||
#import "NTESNotificationCenter.h"
|
||||
#import "NTESSDKConfig.h"
|
||||
NSString *NTESNotificationLogout = @"NTESNotificationLogout";
|
||||
|
||||
#import "IfishUncaughtExceptionHandler.h"
|
||||
//阿里百川
|
||||
#import <AlibcTradeSDK/AlibcTradeSDK.h>
|
||||
#import "IfishADTimerViewController.h"
|
||||
@interface AppDelegate ()<NIMLoginManagerDelegate>
|
||||
@interface AppDelegate ()
|
||||
@property(nonatomic,strong)ICSDrawerController*ics;
|
||||
|
||||
@property(nonatomic)NSString*downloadAddress;
|
||||
|
||||
@property(nonatomic,strong)NSString*versionLabel;
|
||||
@property(nonatomic,strong) UIAlertView * alert;
|
||||
//@property(nonatomic,strong) UIAlertView * alert;
|
||||
|
||||
@property(nonatomic,copy)NSString*ismustUpdate;
|
||||
|
||||
@@ -104,9 +95,9 @@ NSString *NTESNotificationLogout = @"NTESNotificationLogout";
|
||||
@property(nonatomic,strong) NSString*massagetype;
|
||||
|
||||
//删除绑定弹窗
|
||||
@property(nonatomic,strong)UIAlertView* deletDeviceAlert;
|
||||
//@property(nonatomic,strong)UIAlertView* deletDeviceAlert;
|
||||
|
||||
@property (nonatomic,strong) NTESSDKConfig *config;
|
||||
//@property (nonatomic,strong) NTESSDKConfig *config;
|
||||
|
||||
@end
|
||||
BOOL launchedByNotification;
|
||||
@@ -115,7 +106,6 @@ NSString *NTESNotificationLogout = @"NTESNotificationLogout";
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
|
||||
#pragma mark - 摄像头部分代码
|
||||
|
||||
#pragma mark - 返回三种类型的rect,分别是水平、7.0和其他情况
|
||||
@@ -166,7 +156,7 @@ NSString *NTESNotificationLogout = @"NTESNotificationLogout";
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
self.window.backgroundColor=[UIColor whiteColor];
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
|
||||
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
|
||||
//崩溃日志
|
||||
/* [IfishUncaughtExceptionHandler setDefaultHandler];
|
||||
// 发送崩溃日志 需要后台接口 暂无 用bugly
|
||||
@@ -180,29 +170,26 @@ NSString *NTESNotificationLogout = @"NTESNotificationLogout";
|
||||
//短信验证
|
||||
[SMSSDK registerApp:SMSSDK_APPKey withSecret:SMSSDK_APPSec];
|
||||
[SMSSDK enableAppContactFriends:NO];
|
||||
|
||||
|
||||
// 云信IM
|
||||
_config = [[NTESSDKConfig alloc] init];
|
||||
[[NIMSDKConfig sharedConfig] setDelegate:_config];
|
||||
|
||||
[[NIMSDK sharedSDK] registerWithAppID:NIMAPPKEY
|
||||
cerName:NIMCERNAME_PRO];
|
||||
|
||||
//注入 NIMKit 内容提供者
|
||||
[[NIMKit sharedKit] setProvider:[NTESDataManager new]];
|
||||
|
||||
//需要自定义消息时使用
|
||||
[NIMCustomObject registerCustomDecoder:[[NTESCustomAttachmentDecoder alloc]init]];
|
||||
|
||||
//登陆云信
|
||||
/**
|
||||
* 注册APNS
|
||||
*/
|
||||
|
||||
[self registerAPNsYunXin];
|
||||
[self setupServices];
|
||||
[self commonInitListenEvents];
|
||||
|
||||
[self registerAPNS:application];
|
||||
//注册阿里推送
|
||||
[self registerAliPush];
|
||||
// 点击通知将 App 从关闭状态启动时,将通知打开回执上报 // 计算点击 OpenCount
|
||||
[CloudPushSDK sendNotificationAck:launchOptions];
|
||||
// 当APP为关闭状态 收到推送通知,点击 图标 会调用该方法 didFinishLaunchingWithOptions:
|
||||
if (launchOptions) {
|
||||
NSLog(@"\n ====== launchOptions: %@",launchOptions);
|
||||
NSDictionary *pushNotificationKey = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
|
||||
if (pushNotificationKey) {
|
||||
// 这里定义自己的处理方式
|
||||
// 如需要代码控制 BadgeNum (icon右上角的数字等操作)
|
||||
// [UIApplication sharedApplication].applicationIconBadgeNumber = 10;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 初始化BugTags
|
||||
*/
|
||||
@@ -248,22 +235,13 @@ NSString *NTESNotificationLogout = @"NTESNotificationLogout";
|
||||
* 极光推送 推送消息已去 用云信
|
||||
*/
|
||||
NSUserDefaults*userDefsult=[NSUserDefaults standardUserDefaults];
|
||||
|
||||
// NSString*userID=[userDefsult objectForKey:@"userId"];
|
||||
// NSString*userId=[NSString stringWithFormat:@"%@",userID];
|
||||
|
||||
// [JPUSHService setupWithOption:launchOptions appKey:JPUSH_APPKEY_APPSTORE channel:@"Publish channel" apsForProduction:YES];
|
||||
//
|
||||
// [JPUSHService setBadge:1];
|
||||
// [JPUSHService setTags:nil alias:userId callbackSelector:@selector(tagsAliasCallback:tags:alias:) object:self];
|
||||
|
||||
|
||||
/**
|
||||
* 友盟社区 分享 v6.4.2
|
||||
*/
|
||||
[UMCommunitySDK setAppkey:UMCommunity_APPKEY withAppSecret:UMCommunity_SECRET];
|
||||
[UMComSession openLog:NO];
|
||||
|
||||
//自定义显示框
|
||||
[self setUpSVProgressHUD];
|
||||
//设置友盟社会化组件appkey
|
||||
//打开调试日志
|
||||
[[UMSocialManager defaultManager] openLog:YES];
|
||||
@@ -401,7 +379,20 @@ if (kScreenSize.height>480) {
|
||||
return YES;
|
||||
|
||||
}
|
||||
|
||||
//初始化提示框
|
||||
- (void)setUpSVProgressHUD {
|
||||
[SVProgressHUD setMinimumDismissTimeInterval:2];
|
||||
[SVProgressHUD setBackgroundColor:RGBA(255, 255, 255, 1)];
|
||||
[SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
|
||||
[SVProgressHUD setBorderColor:RGB(234, 234, 234)];
|
||||
[SVProgressHUD setBorderWidth:ONE_PIXEL_SIZE];
|
||||
[SVProgressHUD setFont:SYSTEMSIZE(28)];
|
||||
[SVProgressHUD setCornerRadius:kSizeFrom750(20)];
|
||||
[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeCustom];
|
||||
[SVProgressHUD setImageViewSize:CGSizeMake(kSizeFrom750(80), kSizeFrom750(80))];
|
||||
[SVProgressHUD setBackgroundLayerColor:[[UIColor blackColor] colorWithAlphaComponent:0.4]];
|
||||
[SVProgressHUD setMinimumSize:CGSizeMake(kSizeFrom750(300), kSizeFrom750(240))];
|
||||
}
|
||||
#pragma mark - 摄像头部分代码***********************************
|
||||
|
||||
-(void)reachabilityChanged:(NSNotification *)note
|
||||
@@ -421,359 +412,10 @@ if (kScreenSize.height>480) {
|
||||
NSLog(@"rescode: %d, \ntags: %@, \nalias: %@\n", iResCode, tags , alias);
|
||||
}
|
||||
|
||||
#pragma mark - logic 登录云信
|
||||
- (void)setupServices
|
||||
{
|
||||
NSUserDefaults*userDefsult=[NSUserDefaults standardUserDefaults];
|
||||
NSString *acount = [userDefsult objectForKey:@"userId"];
|
||||
if (acount) {
|
||||
|
||||
//登陆云信 走自动登录
|
||||
LoginData *data = [[NTESLoginManager sharedManager] currentLoginData];
|
||||
NSString *account = [data account];
|
||||
NSString *token = [data token];
|
||||
|
||||
//如果有缓存用户名密码推荐使用自动登录
|
||||
if ([account length] && [token length])
|
||||
{
|
||||
//自动登录
|
||||
//非强制模式
|
||||
//[[[NIMSDK sharedSDK] loginManager] autoLogin:account
|
||||
// token:token];
|
||||
//这里我们使用强制模式 即不考虑安全登录 多设备同帐号登陆
|
||||
|
||||
NIMAutoLoginData * LoginData = [[NIMAutoLoginData alloc] init];
|
||||
LoginData.account = account;
|
||||
LoginData.token = token;
|
||||
//强制模式 强制模式下的自动登录,服务器将不检查当前登录设备是否为上一次登录设备,安全性较低。但相对的更加方便,适合 IM 仅作为辅助模块的 App
|
||||
|
||||
LoginData.forcedMode = YES;
|
||||
[[[NIMSDK sharedSDK] loginManager] autoLogin:LoginData];
|
||||
[[NTESServiceManager sharedManager] start];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//[[NTESLogManager sharedManager] start];
|
||||
[[NTESNotificationCenter sharedCenter] start];
|
||||
}
|
||||
|
||||
- (void)commonInitListenEvents
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(logout:)
|
||||
name:NTESNotificationLogout
|
||||
object:nil];
|
||||
|
||||
[[[NIMSDK sharedSDK] loginManager] addDelegate:self];
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[[[NIMSDK sharedSDK] loginManager] removeDelegate:self];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma mark - 注册APNS
|
||||
|
||||
- (void)registerAPNsYunXin
|
||||
{
|
||||
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerForRemoteNotifications)])
|
||||
{
|
||||
UIUserNotificationType types = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert;
|
||||
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types
|
||||
categories:nil];
|
||||
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
|
||||
[[UIApplication sharedApplication] registerForRemoteNotifications];
|
||||
}
|
||||
else
|
||||
{
|
||||
UIRemoteNotificationType types = UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge;
|
||||
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:types];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//jPush 已去
|
||||
|
||||
-(void)registerAPNS{
|
||||
if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 8.0) {
|
||||
NSLog(@"Version8.0 %f",[[[UIDevice currentDevice] systemVersion] doubleValue]);
|
||||
[self registerPushForIOS8];
|
||||
}else if([[[UIDevice currentDevice] systemVersion] doubleValue] >= 7.0 && [[[UIDevice currentDevice] systemVersion] doubleValue] < 8.0){
|
||||
NSLog(@"Version7.0 %f",[[[UIDevice currentDevice] systemVersion] doubleValue]);
|
||||
[self registerNofitication];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - iOS8以上注册方法
|
||||
- (void)registerPushForIOS8{
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= _IPHONE80_
|
||||
|
||||
//Types
|
||||
UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
|
||||
|
||||
//Actions
|
||||
UIMutableUserNotificationAction *acceptAction = [[UIMutableUserNotificationAction alloc] init];
|
||||
|
||||
acceptAction.identifier = @"ACCEPT_IDENTIFIER";
|
||||
acceptAction.title = @"Accept";
|
||||
|
||||
acceptAction.activationMode = UIUserNotificationActivationModeForeground;
|
||||
acceptAction.destructive = NO;
|
||||
acceptAction.authenticationRequired = NO;
|
||||
|
||||
//Categories
|
||||
UIMutableUserNotificationCategory *inviteCategory = [[UIMutableUserNotificationCategory alloc] init];
|
||||
|
||||
inviteCategory.identifier = @"INVITE_CATEGORY";
|
||||
|
||||
[inviteCategory setActions:@[acceptAction] forContext:UIUserNotificationActionContextDefault];
|
||||
|
||||
[inviteCategory setActions:@[acceptAction] forContext:UIUserNotificationActionContextMinimal];
|
||||
|
||||
NSSet *categories = [NSSet setWithObjects:inviteCategory, nil];
|
||||
|
||||
UIUserNotificationSettings *mySettings = [UIUserNotificationSettings settingsForTypes:types categories:categories];
|
||||
|
||||
|
||||
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];
|
||||
|
||||
|
||||
// [JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:categories];
|
||||
#endif
|
||||
}
|
||||
|
||||
#pragma mark - iOS8以下注册方法
|
||||
- (void) registerNofitication {
|
||||
|
||||
// [JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];
|
||||
}
|
||||
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
|
||||
// [JPUSHService registerDeviceToken:deviceToken];
|
||||
|
||||
NSString *token =
|
||||
[[[[deviceToken description] stringByReplacingOccurrencesOfString:@"<"
|
||||
withString:@""]
|
||||
stringByReplacingOccurrencesOfString:@">"
|
||||
withString:@""]
|
||||
stringByReplacingOccurrencesOfString:@" "
|
||||
withString:@""];
|
||||
NSLog(@"token:%@",token);
|
||||
|
||||
|
||||
//注册成功,将deviceToken保存到yoosee摄像头服务器数据库中
|
||||
NSString *dToken = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
|
||||
dToken = [dToken stringByReplacingOccurrencesOfString:@" " withString:@""];
|
||||
self.token = [NSString stringWithFormat:@"%@",dToken];
|
||||
|
||||
// [[NetManager sharedManager] loginWithUserName:@"237807878@qq.com" password:@"lian1030" token: self.token callBack:^(id JSON) {
|
||||
//
|
||||
// LoginResult *loginResult = (LoginResult*)JSON;
|
||||
// //登陆成功返回 LoginResult数据模型 存储
|
||||
//
|
||||
// //[UDManager setIsLogin:YES];
|
||||
// [UDManager setLoginInfo:loginResult];
|
||||
//
|
||||
// NSLog(@"%@",JSON);
|
||||
// [[NetManager sharedManager] getAccountInfo:loginResult.contactId sessionId:loginResult.sessionId callBack:^(id JSN){
|
||||
//
|
||||
// AccountResult *accountResult = (AccountResult*)JSN;
|
||||
// loginResult.email = accountResult.email;
|
||||
// loginResult.phone = accountResult.phone;
|
||||
// loginResult.countryCode = accountResult.countryCode;
|
||||
// [UDManager setLoginInfo:loginResult];
|
||||
// }];
|
||||
//
|
||||
// }];
|
||||
|
||||
//云信
|
||||
|
||||
[[NIMSDK sharedSDK] updateApnsToken:deviceToken];
|
||||
|
||||
|
||||
}
|
||||
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
|
||||
//[JPUSHService resetBadge];
|
||||
// [JPUSHService handleRemoteNotification:userInfo];
|
||||
[self showAlertViewWithUserInfo:userInfo];
|
||||
//存储推送消息
|
||||
// PushmassageModel*model=[[PushmassageModel alloc] init];
|
||||
// model.massageType=userInfo[@"msg_type"];
|
||||
// NSDictionary*apsDic=userInfo[@"aps"];
|
||||
// NSDictionary*alertDic=apsDic[@"alert"];
|
||||
// model.massageBody=alertDic[@"body"];
|
||||
// model.massageTitle=alertDic[@"title"];
|
||||
// [[IfishDatabaseManager sharedManager] insertModel:model];
|
||||
|
||||
}
|
||||
|
||||
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
|
||||
|
||||
// [JPUSHService resetBadge];
|
||||
NSLog(@"userInfo%@",userInfo);
|
||||
// [JPUSHService handleRemoteNotification:userInfo];
|
||||
completionHandler(UIBackgroundFetchResultNewData);
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"PresentView" object:nil];
|
||||
//推送解绑 JPUSH 推送功能已去
|
||||
|
||||
//[self showAlertViewWithUserInfo:userInfo];
|
||||
|
||||
// if (_islaunchedByNotification) {
|
||||
// //通知栏进入应用 定位到消息列表 老版本消息列表在tab栏中 已废弃
|
||||
//
|
||||
// [[NSNotificationCenter defaultCenter] postNotificationName:@"PresentView" object:nil];
|
||||
//
|
||||
//
|
||||
// }else{
|
||||
// //用户在使用应用时,弹出提示框 已废弃功能
|
||||
// [self showAlertViewWithUserInfo:userInfo];
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* massageType
|
||||
1.wendu_warn 2.remove_device3.qu_reply 4.offline_push
|
||||
* 5.remind_water
|
||||
|
||||
*/
|
||||
-(void)showAlertViewWithUserInfo:(NSDictionary*)userInfo{
|
||||
if([UIApplication sharedApplication].applicationState == UIApplicationStateActive)
|
||||
{
|
||||
|
||||
|
||||
NSDictionary*apsDic=userInfo[@"aps"];
|
||||
NSDictionary*alertDic=apsDic[@"alert"];
|
||||
NSString*body=alertDic[@"body"];
|
||||
NSString*title=alertDic[@"title"];
|
||||
NSString*massagetype=userInfo[@"msg_type"];
|
||||
self.massagetype = massagetype;
|
||||
// NSString*deviceid=apsDic[@"device_id"];
|
||||
// NSString*deviceName=apsDic[@"device_name"];
|
||||
NSString* cancelButtontitle=nil;
|
||||
UserModel *model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"];
|
||||
if (![model.userSex isEqual:[NSNull null]]) {
|
||||
if ([model.userSex isEqualToString:@"1"]) {
|
||||
cancelButtontitle=@"朕知道了";
|
||||
}else{
|
||||
|
||||
cancelButtontitle=@"本宫知道了";
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
cancelButtontitle=@"朕知道了";
|
||||
|
||||
}
|
||||
|
||||
_alert = [[UIAlertView alloc] initWithTitle:title
|
||||
message:body
|
||||
delegate:self
|
||||
cancelButtonTitle:cancelButtontitle
|
||||
otherButtonTitles:nil];
|
||||
_alert.tag=JPUSHMASSAGE;
|
||||
[_alert show];
|
||||
|
||||
if ([massagetype isEqualToString:@"remove_device"]) {// 删除设备推送
|
||||
|
||||
_deletDeviceAlert=[[UIAlertView alloc] initWithTitle:title
|
||||
message:body
|
||||
delegate:self
|
||||
cancelButtonTitle:cancelButtontitle
|
||||
otherButtonTitles: nil];
|
||||
|
||||
_deletDeviceAlert.tag=DELETDEVICE_ALERT;
|
||||
[_alert show];
|
||||
|
||||
formLogIn=NO;
|
||||
[[Socketsingleton sharedInstance] cutOffSocket];
|
||||
[IFISHHTTPTOOL ifishLogindismissvc:nil];
|
||||
|
||||
}else if ([massagetype isEqualToString:@"app_update"]){//app 版本升级 推送更新
|
||||
|
||||
//offline_push
|
||||
}else if ([massagetype isEqualToString:@"offline_push"]){
|
||||
//离线推送
|
||||
|
||||
_alert = [[UIAlertView alloc] initWithTitle:title
|
||||
message:body
|
||||
delegate:self
|
||||
cancelButtonTitle:cancelButtontitle
|
||||
otherButtonTitles:nil];
|
||||
_alert.tag=OFFLINE_PUSH;
|
||||
[_alert show];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
|
||||
|
||||
if (alertView.tag==JPUSHMASSAGE) {
|
||||
// 通知弹窗
|
||||
|
||||
|
||||
// IfishMianTabViewController *mianVC=[[IfishMianTabViewController alloc] init];
|
||||
//
|
||||
//
|
||||
// [UIApplication sharedApplication].delegate.window.rootViewController=mianVC;
|
||||
|
||||
|
||||
|
||||
}else if(alertView.tag==CURRENTVERSIONALERT){
|
||||
//非强制更新
|
||||
if ([self.ismustUpdate isEqualToString:@"0"]) {
|
||||
|
||||
if (buttonIndex==1) {
|
||||
[self UpLoadView];
|
||||
}else{
|
||||
if (_islaunchedByNotification==NO){//不是点击通知栏弹窗时 点击通知栏取消弹窗不做处理
|
||||
UIApplication*application=[UIApplication sharedApplication];
|
||||
[self loginAnimated:application];
|
||||
}
|
||||
}
|
||||
//强制更新
|
||||
}else{
|
||||
if (buttonIndex==0) {
|
||||
[self UpLoadView];
|
||||
}
|
||||
}
|
||||
}else if (alertView.tag==DELETDEVICE_ALERT){
|
||||
if (buttonIndex==0) {
|
||||
//无作用转主界面写
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)UpLoadView{
|
||||
//更新下载弹窗
|
||||
DownLoadViewController *dowloadView=[[DownLoadViewController alloc]init];
|
||||
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:dowloadView];
|
||||
dowloadView.downAddress=self.downloadAddress;
|
||||
// if (_islaunchedByNotification==YES) {//app已挂起收到通知直接点击通知进入程序 不走版本检测下载地址已写死
|
||||
// dowloadView.downAddress=@"https://www.ifish7.com/download/ios.html";
|
||||
// }
|
||||
dowloadView.fromsetView=NO;
|
||||
if ([self.ismustUpdate isEqualToString:@"1"]) {
|
||||
dowloadView.ismust=YES;
|
||||
}else{
|
||||
dowloadView.ismust=NO;
|
||||
|
||||
}
|
||||
// self.window.rootViewController=nav;
|
||||
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];
|
||||
|
||||
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"bar.png"] forBarMetrics:UIBarMetricsDefault];
|
||||
|
||||
//[[UIApplication sharedApplication]openURL:[NSURL URLWithString:self.downloadAddress]];
|
||||
}
|
||||
#pragma mark 登录
|
||||
-(void)loginAnimated:(UIApplication*)appliaction{
|
||||
@@ -798,14 +440,7 @@ if (kScreenSize.height>480) {
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
//极光
|
||||
//[JPUSHService resetBadge];
|
||||
|
||||
//云信
|
||||
NSInteger count = [[[NIMSDK sharedSDK] conversationManager] allUnreadCount];
|
||||
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];
|
||||
|
||||
// application.applicationIconBadgeNumber=0;
|
||||
if (application.backgroundTimeRemaining > 10)
|
||||
{
|
||||
NSLog(@"ESPAppDelegate: some thread goto background, remained: %f seconds", application.backgroundTimeRemaining);
|
||||
@@ -858,7 +493,19 @@ if (kScreenSize.height>480) {
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
|
||||
NSLog(@" \n ------ App 在后台运行 点击 icon 激活的APP ------");
|
||||
|
||||
if (application.applicationIconBadgeNumber != 0) {
|
||||
|
||||
// 发起请求获取未读消息的内容
|
||||
|
||||
// 点击 icon 从后台进入应用时, 对 badge 的处理
|
||||
application.applicationIconBadgeNumber = 0;
|
||||
|
||||
// // 清除导航栏未读的通知
|
||||
// [_notificationCenter removeAllDeliveredNotifications];
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -949,26 +596,6 @@ if (kScreenSize.height>480) {
|
||||
NSLog(@"vonGetPermissionState %d",iError);
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
|
||||
//注意如果同时使用微信支付、支付宝等其他需要改写回调代理的SDK,请在if分支下做区分,否则会影响 分享、登录的回调
|
||||
|
||||
// 新接口写法
|
||||
if (![[AlibcTradeSDK sharedInstance] application:application
|
||||
openURL:url
|
||||
sourceApplication:sourceApplication
|
||||
annotation:annotation]) {
|
||||
// 处理其他app跳转到自己的app
|
||||
|
||||
BOOL result = [[UMSocialManager defaultManager] handleOpenURL:url];
|
||||
return result;
|
||||
|
||||
}
|
||||
return YES;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//同时实现iOS9+的新系统API
|
||||
|
||||
Reference in New Issue
Block a user