forked from mirrors/linphone-iphone
popup in progress
This commit is contained in:
parent
5142a70dc1
commit
d83c869e65
5 changed files with 96 additions and 4 deletions
|
|
@ -193,6 +193,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
- (void)coreUpdateEvent:(NSNotification *)notif {
|
||||
@try {
|
||||
[[LinphoneManager instance] checkNewVersion];
|
||||
if (IPAD) {
|
||||
if (linphone_core_video_display_enabled(LC) && linphone_core_video_preview_enabled(LC)) {
|
||||
linphone_core_set_native_preview_window_id(LC, (__bridge void *)(_videoPreview));
|
||||
|
|
|
|||
|
|
@ -218,6 +218,17 @@
|
|||
actions:[NSArray arrayWithObjects:act_confirm, act_deny, nil]
|
||||
intentIdentifiers:[[NSMutableArray alloc] init]
|
||||
options:UNNotificationCategoryOptionCustomDismissAction];
|
||||
|
||||
// App version verification
|
||||
|
||||
UNNotificationAction *act_go_to_URL = [UNNotificationAction actionWithIdentifier:@"Download"
|
||||
title:NSLocalizedString(@"Download", nil)
|
||||
options:UNNotificationActionOptionNone];
|
||||
UNNotificationCategory *version_verif =
|
||||
[UNNotificationCategory categoryWithIdentifier:@"version_verif"
|
||||
actions:[NSArray arrayWithObjects:act_go_to_URL, nil]
|
||||
intentIdentifiers:[[NSMutableArray alloc] init]
|
||||
options:UNNotificationCategoryOptionCustomDismissAction];
|
||||
|
||||
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
|
||||
[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge)
|
||||
|
|
@ -226,7 +237,8 @@
|
|||
if (error)
|
||||
LOGD(error.description);
|
||||
}];
|
||||
NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, nil];
|
||||
|
||||
NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, version_verif, nil];
|
||||
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories];
|
||||
}
|
||||
|
||||
|
|
@ -662,7 +674,11 @@ didInvalidatePushTokenForType:(NSString *)type {
|
|||
}];
|
||||
} else if ([response.notification.request.content.categoryIdentifier isEqual:@"lime"]) {
|
||||
return;
|
||||
} else { // Missed call
|
||||
} else if ([response.notification.request.content.categoryIdentifier isEqual:@"version_verif"]) {
|
||||
NSString *url = [response.notification.request.content.userInfo objectForKey:@"url"];
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
|
||||
return;
|
||||
} else { // Missed call
|
||||
[PhoneMainView.instance changeCurrentView:HistoryListView.compositeViewDescription];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,6 +205,8 @@ typedef struct _LinphoneManagerSounds {
|
|||
- (void) setContactsUpdated:(BOOL) updated;
|
||||
- (BOOL) getContactsUpdated;
|
||||
|
||||
- (void)checkNewVersion;
|
||||
|
||||
@property ProviderDelegate *providerDelegate;
|
||||
|
||||
@property (readonly) BOOL isTesting;
|
||||
|
|
|
|||
|
|
@ -1394,6 +1394,55 @@ void linphone_iphone_chatroom_state_changed(LinphoneCore *lc, LinphoneChatRoom *
|
|||
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:nil];
|
||||
}
|
||||
|
||||
void linphone_iphone_version_update_check_result_received (LinphoneCore *lc, LinphoneVersionUpdateCheckResult result, const char *version, const char *url) {
|
||||
LOGD(@"MONCUL");
|
||||
if (result == LinphoneVersionUpdateCheckUpToDate || result == LinphoneVersionUpdateCheckError) {
|
||||
return;
|
||||
}
|
||||
NSString *title = NSLocalizedString(@"Outdated Version", nil);
|
||||
NSString *body = NSLocalizedString(@"A new version of your app is available, use the button below to download it.", nil);
|
||||
|
||||
UIAlertController *versVerifView = [UIAlertController alertControllerWithTitle:title
|
||||
message:body
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
NSString *ObjCurl = [NSString stringWithUTF8String:url];
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:ObjCurl]];
|
||||
}];
|
||||
|
||||
[versVerifView addAction:defaultAction];
|
||||
[PhoneMainView.instance presentViewController:versVerifView animated:YES completion:nil];
|
||||
/*
|
||||
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive &&
|
||||
floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) {
|
||||
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
|
||||
content.title = title;
|
||||
content.body = body;
|
||||
content.categoryIdentifier = @"version_verif";
|
||||
UNNotificationRequest *req =
|
||||
[UNNotificationRequest requestWithIdentifier:@"version_verif" content:content trigger:NULL];
|
||||
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:req
|
||||
withCompletionHandler:^(NSError *_Nullable error) {
|
||||
// Enable or disable features based on authorization.
|
||||
if (error) {
|
||||
LOGD(@"Error while adding notification request :");
|
||||
LOGD(error.description);
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
|
||||
message:body
|
||||
delegate:nil
|
||||
cancelButtonTitle:nil
|
||||
otherButtonTitles:nil];
|
||||
[alert show];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#pragma mark - Message composition start
|
||||
- (void)alertLIME:(LinphoneChatRoom *)room {
|
||||
NSString *title = NSLocalizedString(@"LIME warning", nil);
|
||||
|
|
@ -1964,6 +2013,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
|
|||
linphone_core_cbs_set_notify_received(cbs, linphone_iphone_notify_received);
|
||||
linphone_core_cbs_set_call_encryption_changed(cbs, linphone_iphone_call_encryption_changed);
|
||||
linphone_core_cbs_set_chat_room_state_changed(cbs, linphone_iphone_chatroom_state_changed);
|
||||
linphone_core_cbs_set_version_update_check_result_received(cbs, linphone_iphone_version_update_check_result_received);
|
||||
linphone_core_cbs_set_user_data(cbs, (__bridge void *)(self));
|
||||
|
||||
theLinphoneCore = linphone_factory_create_core_with_config(factory, cbs, _configDb);
|
||||
|
|
@ -3028,4 +3078,29 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
|
|||
- (void)exportSymbolsForUITests {
|
||||
linphone_address_set_header(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
- (void)checkNewVersion {
|
||||
if (theLinphoneCore == nil)
|
||||
return;
|
||||
//NSString *curVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
//const char *curVersionCString = [curVersion cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
//linphone_core_check_for_update(theLinphoneCore, curVersionCString);
|
||||
|
||||
NSString *title = NSLocalizedString(@"Outdated Version", nil);
|
||||
NSString *body = NSLocalizedString(@"A new version of your app is available, use the button below to download it.", nil);
|
||||
|
||||
UIAlertController *versVerifView = [UIAlertController alertControllerWithTitle:title
|
||||
message:body
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
NSString *ObjCurl = @"https://www.google.com/";
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:ObjCurl]];
|
||||
}];
|
||||
|
||||
[versVerifView addAction:defaultAction];
|
||||
[PhoneMainView.instance presentViewController:versVerifView animated:YES completion:nil];
|
||||
}
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@
|
|||
}
|
||||
[self setFrame:CGRectMake(0, 0, 5, 100)];
|
||||
[self addSubview:sub];
|
||||
//LOGD(@"ZBOUB");
|
||||
chatTableView = VIEW(ChatConversationView).tableController;
|
||||
actualAvailableWidth = chatTableView.tableView.frame.size.width;
|
||||
}
|
||||
|
|
@ -110,7 +109,6 @@
|
|||
_imageGestureRecognizer.enabled = YES;
|
||||
//_cancelButton.hidden = _fileTransferProgress.hidden = _downloadButton.hidden = YES;
|
||||
_finalImage.hidden = NO;
|
||||
LOGD(@"ZBOUB");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue