From 2492991a6af3ff68a6e375725422499d6e8640f8 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Fri, 14 Dec 2018 14:52:01 +0100 Subject: [PATCH] simplify the group name for extensions --- Classes/ChatConversationView.m | 2 +- Classes/ChatsListTableView.m | 2 +- Classes/HistoryListTableView.m | 2 +- latestCallsWidget/TodayViewController.m | 2 +- latestChatroomsWidget/TodayViewController.m | 2 +- linphone-Info.plist | 2 +- linphone.entitlements | 5 +++-- linphone.xcodeproj/project.pbxproj | 16 ++++++++-------- linphoneExtension/ShareViewController.m | 3 ++- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index e61c8b8a6..6c3f8e468 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -27,7 +27,6 @@ #import "DevicesListView.h" @implementation ChatConversationView -static NSString* groupName = @"group.belledonne-communications.linphone"; #pragma mark - Lifecycle Functions @@ -250,6 +249,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)shareFile { + NSString* groupName = [NSString stringWithFormat:@"group.%@.linphoneExtension",[[NSBundle mainBundle] bundleIdentifier]]; NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:groupName]; NSDictionary *dict = [defaults valueForKey:@"photoData"]; NSDictionary *dictFile = [defaults valueForKey:@"icloudData"]; diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index b2fa81858..60c69d715 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -124,7 +124,7 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo } + (void) saveDataToUserDefaults { - NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.belledonne-communications.linphone.widget"]; + NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:[NSString stringWithFormat:@"group.%@.latestChatroomsWidget",[[NSBundle mainBundle] bundleIdentifier]]]; MSList *sorted = nil; const MSList *unsorted = linphone_core_get_chat_rooms(LC); const MSList *iter = unsorted; diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m index 4961d6b21..9d82b367d 100644 --- a/Classes/HistoryListTableView.m +++ b/Classes/HistoryListTableView.m @@ -169,7 +169,7 @@ + (void) saveDataToUserDefaults { const bctbx_list_t *logs = linphone_core_get_call_logs(LC); - NSUserDefaults *mySharedDefaults = [[NSUserDefaults alloc] initWithSuiteName: @"group.belledonne-communications.linphone.widget"]; + NSUserDefaults *mySharedDefaults = [[NSUserDefaults alloc] initWithSuiteName: [NSString stringWithFormat:@"group.%@.latestCallsWidget",[[NSBundle mainBundle] bundleIdentifier]]]; NSMutableArray *logsShare = [NSMutableArray array]; NSMutableDictionary *tmpStoreDict = [NSMutableDictionary dictionary]; NSMutableArray *addedContacts = [NSMutableArray array]; diff --git a/latestCallsWidget/TodayViewController.m b/latestCallsWidget/TodayViewController.m index 7b5400081..15ae1c44d 100644 --- a/latestCallsWidget/TodayViewController.m +++ b/latestCallsWidget/TodayViewController.m @@ -15,7 +15,7 @@ @implementation TodayViewController - (void)loadData { - NSUserDefaults *mySharedDefaults = [[NSUserDefaults alloc] initWithSuiteName: @"group.belledonne-communications.linphone.widget"]; + NSUserDefaults *mySharedDefaults = [[NSUserDefaults alloc] initWithSuiteName: [NSString stringWithFormat:@"group.%@",[[NSBundle mainBundle] bundleIdentifier]]]; [_imgs removeAllObjects]; [_logIds removeAllObjects]; [_displayNames removeAllObjects]; diff --git a/latestChatroomsWidget/TodayViewController.m b/latestChatroomsWidget/TodayViewController.m index 4686acab0..61320f0f6 100644 --- a/latestChatroomsWidget/TodayViewController.m +++ b/latestChatroomsWidget/TodayViewController.m @@ -15,7 +15,7 @@ @implementation TodayViewController - (void)loadData { - NSUserDefaults *mySharedDefaults = [[NSUserDefaults alloc] initWithSuiteName: @"group.belledonne-communications.linphone.widget"]; + NSUserDefaults *mySharedDefaults = [[NSUserDefaults alloc] initWithSuiteName: [NSString stringWithFormat:@"group.%@",[[NSBundle mainBundle] bundleIdentifier]]]; [_imgs removeAllObjects]; [_addresses removeAllObjects]; [_localAddress removeAllObjects]; diff --git a/linphone-Info.plist b/linphone-Info.plist index 2e19ecb2c..751d442db 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -124,7 +124,7 @@ UIApplicationShortcutWidget - $(PRODUCT_BUNDLE_IDENTIFIER).widget.latestChatrooms + $(PRODUCT_BUNDLE_IDENTIFIER).latestChatroomsWidget UIBackgroundModes audio diff --git a/linphone.entitlements b/linphone.entitlements index 8a823707e..5df6178aa 100644 --- a/linphone.entitlements +++ b/linphone.entitlements @@ -20,8 +20,9 @@ $(TeamIdentifierPrefix)$(CFBundleIdentifier) com.apple.security.application-groups - group.belledonne-communications.linphone.widget - group.belledonne-communications.linphone + group.org.linphone.phone.linphoneExtension + group.org.linphone.phone.latestCallsWidget + group.org.linphone.phone.latestChatroomsWidget diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 3aa7cc99a..99afeb691 100644 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -5929,7 +5929,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; INFOPLIST_FILE = latestChatroomsWidget/Info.plist; MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.widget.latestChatrooms; + PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.latestChatroomsWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -5970,7 +5970,7 @@ INFOPLIST_FILE = latestChatroomsWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.widget.latestChatrooms; + PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.latestChatroomsWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6013,7 +6013,7 @@ INFOPLIST_FILE = latestChatroomsWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.widget.latestChatrooms; + PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.latestChatroomsWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6056,7 +6056,7 @@ INFOPLIST_FILE = latestChatroomsWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.widget.latestChatrooms; + PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.latestChatroomsWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6268,7 +6268,7 @@ INFOPLIST_FILE = latestCallsWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.widget.latestCalls; + PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.latestCallsWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6310,7 +6310,7 @@ INFOPLIST_FILE = latestCallsWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.widget.latestCalls; + PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.latestCallsWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6353,7 +6353,7 @@ INFOPLIST_FILE = latestCallsWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.widget.latestCalls; + PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.latestCallsWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -6396,7 +6396,7 @@ INFOPLIST_FILE = latestCallsWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.widget.latestCalls; + PRODUCT_BUNDLE_IDENTIFIER = org.linphone.phone.latestCallsWidget; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/linphoneExtension/ShareViewController.m b/linphoneExtension/ShareViewController.m index c6745f71d..cdd142d75 100644 --- a/linphoneExtension/ShareViewController.m +++ b/linphoneExtension/ShareViewController.m @@ -10,7 +10,7 @@ @interface ShareViewController () @end -static NSString* groupName = @"group.belledonne-communications.linphone"; + @implementation ShareViewController - (BOOL)isContentValid { @@ -19,6 +19,7 @@ static NSString* groupName = @"group.belledonne-communications.linphone"; } - (void)didSelectPost { + NSString* groupName = [NSString stringWithFormat:@"group.%@",[[NSBundle mainBundle] bundleIdentifier]]; // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments. BOOL support = TRUE; // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.