|
130 | 130 |
|
131 | 131 | #import "MXSDKOptions.h" |
132 | 132 |
|
133 | | -#import "UserActivities.h" |
134 | | - |
135 | 133 | #import "Riot-Swift.h" |
136 | 134 |
|
137 | 135 | NSNotificationName const RoomCallTileTappedNotification = @"RoomCallTileTappedNotification"; |
@@ -595,7 +593,7 @@ - (void)viewWillAppear:(BOOL)animated |
595 | 593 | category:AnalyticsNoficationsCategory]; |
596 | 594 | } |
597 | 595 |
|
598 | | - [self becomeCurrentActivity]; |
| 596 | + [self updateUserActivity]; |
599 | 597 | } |
600 | 598 |
|
601 | 599 | - (void)viewWillDisappear:(BOOL)animated |
@@ -2001,51 +1999,18 @@ - (void)setupActions { |
2001 | 1999 | roomInputView.actionsBar.actionItems = actionItems; |
2002 | 2000 | } |
2003 | 2001 |
|
2004 | | -- (void)becomeCurrentActivity |
| 2002 | +- (void)updateUserActivity |
2005 | 2003 | { |
2006 | 2004 | if (!self.userActivity) { |
2007 | | - self.userActivity = [[NSUserActivity alloc] initWithActivityType:kUserActivityTypeMatrixRoom]; |
| 2005 | + self.userActivity = [[NSUserActivity alloc] initWithActivityType:[UserActivityService roomActivityType]]; |
2008 | 2006 | } |
2009 | 2007 |
|
2010 | 2008 | // TODO: Move everything else into the method called below |
2011 | 2009 | [UserActivityService.shared update:self.userActivity from:self.roomDataSource.room]; |
2012 | 2010 |
|
2013 | | - self.userActivity.title = self.roomDataSource.room.summary.displayname; |
2014 | | - self.userActivity.requiredUserInfoKeys = [[NSSet alloc] initWithObjects:kUserActivityInfoRoomId, nil]; |
2015 | | - |
2016 | | - // user info |
2017 | | - NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init]; |
2018 | | - [userInfo setObject:self.roomDataSource.roomId forKey:kUserActivityInfoRoomId]; |
2019 | | - if ([self.roomDataSource.room isDirect]) { |
2020 | | - [userInfo setObject:self.roomDataSource.room.directUserId forKey:kUserActivityInfoUserId]; |
2021 | | - } |
2022 | | - self.userActivity.userInfo = userInfo; |
2023 | | - |
2024 | 2011 | // TODO: add a NSUserActivityDelegate to save the current text in the userinfo of the activity |
2025 | 2012 | // self.userActivity.delegate = self; |
2026 | 2013 | // self.userActivity.needsSave = true; |
2027 | | - self.userActivity.persistentIdentifier = self.roomDataSource.roomId; |
2028 | | - |
2029 | | - self.userActivity.eligibleForHandoff = true; |
2030 | | - self.userActivity.eligibleForSearch = true; |
2031 | | - self.userActivity.eligibleForPrediction = true; |
2032 | | - |
2033 | | - CSSearchableItemAttributeSet *contentAttribute; |
2034 | | - if (@available(iOS 14.0, *)) { |
2035 | | - contentAttribute = [[CSSearchableItemAttributeSet alloc] initWithContentType:UTTypeItem]; |
2036 | | - } else { |
2037 | | - contentAttribute = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:@"public.item"]; |
2038 | | - } |
2039 | | - |
2040 | | - contentAttribute.title = self.roomDataSource.room.summary.displayname; |
2041 | | - contentAttribute.displayName = self.roomDataSource.room.summary.displayname; |
2042 | | - contentAttribute.contentDescription = self.roomDataSource.room.summary.lastMessage.text; |
2043 | | - |
2044 | | - // TODO: contentAttribute.thumbnailURL = |
2045 | | - // TODO: accountHandles of everyone in the room |
2046 | | - contentAttribute.instantMessageAddresses = [[NSArray alloc] initWithObjects:self.roomDataSource.roomId, nil]; |
2047 | | - |
2048 | | - self.userActivity.contentAttributeSet = contentAttribute; |
2049 | 2014 | } |
2050 | 2015 |
|
2051 | 2016 | - (void)roomInputToolbarViewPresentStickerPicker |
|
0 commit comments