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