vector-im/element-ios/issues/5298 - Implemented location sharing from the input toolbar action menu.

This commit is contained in:
Stefan Ceriu
2021-12-16 14:02:42 +02:00
committed by Stefan Ceriu
parent fb16d96ac1
commit 37db201124
30 changed files with 867 additions and 36 deletions
@@ -591,6 +591,25 @@ extern NSString *const kMXKRoomDataSourceTimelineErrorErrorKey;
success:(void (^)(NSString *eventId))success
failure:(void (^)(NSError *error))failure;
/**
Send a location message to a room.
While sending, a fake event will be echoed in the messages list.
Once complete, this local echo will be replaced by the event saved by the homeserver.
@param latitude the location's latitude
@param longitude the location's longitude
@param description an optional description
@param success A block object called when the operation succeeds. It returns
the event id of the event generated on the homeserver
@param failure A block object called when the operation fails.
*/
- (void)sendLocationWithLatitude:(double)latitude
longitude:(double)longitude
description:(NSString *)description
success:(void (^)(NSString *))success
failure:(void (^)(NSError *))failure;
/**
Send a generic non state event to a room.
@@ -1914,6 +1914,29 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
}
}
- (void)sendLocationWithLatitude:(double)latitude
longitude:(double)longitude
description:(NSString *)description
success:(void (^)(NSString *))success
failure:(void (^)(NSError *))failure
{
__block MXEvent *localEchoEvent = nil;
// Make the request to the homeserver
[_room sendLocationWithLatitude:latitude
longitude:longitude
description:description
localEcho:&localEchoEvent
success:success failure:failure];
if (localEchoEvent)
{
// Make the data source digest this fake local echo message
[self queueEventForProcessing:localEchoEvent withRoomState:self.roomState direction:MXTimelineDirectionForwards];
[self processQueuedEvents:nil];
}
}
- (void)sendEventOfType:(MXEventTypeString)eventTypeString content:(NSDictionary<NSString*, id>*)msgContent success:(void (^)(NSString *eventId))success failure:(void (^)(NSError *error))failure
{
__block MXEvent *localEchoEvent = nil;