Live location sharing - update beacon_info implementation to latest MSC (#8256)
* update calls to set and createLiveBeacon Signed-off-by: Kerry Archibald <kerrya@element.io> * fix stop beacon Signed-off-by: Kerry Archibald <kerrya@element.io> * remove variable event type from beacon utils Signed-off-by: Kerry Archibald <kerrya@element.io> * use beacon identifier Signed-off-by: Kerry Archibald <kerrya@element.io> * fix RoomLiveShareWarning tests Signed-off-by: Kerry Archibald <kerrya@element.io> * add case for beacon update Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * more lint Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
610225aef2
commit
03d0969ae3
9 changed files with 123 additions and 108 deletions
|
@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { BeaconInfoState } from "matrix-js-sdk/src/content-helpers";
|
||||
import { Beacon } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
/**
|
||||
|
@ -26,8 +27,8 @@ import { Beacon } from "matrix-js-sdk/src/matrix";
|
|||
export const msUntilExpiry = (startTimestamp: number, durationMs: number): number =>
|
||||
Math.max(0, (startTimestamp + durationMs) - Date.now());
|
||||
|
||||
export const getBeaconMsUntilExpiry = (beacon: Beacon): number =>
|
||||
msUntilExpiry(beacon.beaconInfo.timestamp, beacon.beaconInfo.timeout);
|
||||
export const getBeaconMsUntilExpiry = (beaconInfo: BeaconInfoState): number =>
|
||||
msUntilExpiry(beaconInfo.timestamp, beaconInfo.timeout);
|
||||
|
||||
export const getBeaconExpiryTimestamp = (beacon: Beacon): number =>
|
||||
beacon.beaconInfo.timestamp + beacon.beaconInfo.timeout;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue