Skip to content

Commit

Permalink
Merge pull request #6055 from vector-im/maximee/6029_lls_timeline_cell
Browse files Browse the repository at this point in the history
[Location sharing] Live location cell in timeline
  • Loading branch information
MaximeEvrard42 authored Apr 26, 2022
2 parents 1381335 + 14fd798 commit 7e3737a
Show file tree
Hide file tree
Showing 35 changed files with 599 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "location_live_cell_ended_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "Subtract.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "location_live_cell_loading_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "location_placeholder_background_image.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Riot/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,7 @@ Tap the + to start adding people.";

"location_sharing_live_share_title" = "Share live location";
"live_location_sharing_banner_title" = "Live location enabled";
"live_location_sharing_ended" = "Live location ended";
"live_location_sharing_banner_stop" = "Stop";
"location_sharing_static_share_title" = "Send my current location";
"location_sharing_pin_drop_share_title" = "Send this location";
Expand All @@ -2149,6 +2150,9 @@ Tap the + to start adding people.";
"location_sharing_live_list_item_last_update_invalid" = "Unknown last update";
"location_sharing_live_list_item_current_user_display_name" = "You";
"location_sharing_live_list_item_stop_sharing_action" = "Stop sharing";
"location_sharing_live_timer_incoming" = "Live until %@";
"location_sharing_live_loading" = "Loading Live location...";
"location_sharing_live_error" = "Live location error";

// MARK: - MatrixKit

Expand Down
4 changes: 4 additions & 0 deletions Riot/Generated/Images.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,13 @@ internal class Asset: NSObject {
internal static let voiceCallHangupIcon = ImageAsset(name: "voice_call_hangup_icon")
internal static let liveLocationIcon = ImageAsset(name: "live_location_icon")
internal static let locationCenterMapIcon = ImageAsset(name: "location_center_map_icon")
internal static let locationLiveCellEndedIcon = ImageAsset(name: "location_live_cell_ended_icon")
internal static let locationLiveCellIcon = ImageAsset(name: "location_live_cell_icon")
internal static let locationLiveCellLoadingIcon = ImageAsset(name: "location_live_cell_loading_icon")
internal static let locationLiveIcon = ImageAsset(name: "location_live_icon")
internal static let locationMarkerIcon = ImageAsset(name: "location_marker_icon")
internal static let locationPinIcon = ImageAsset(name: "location_pin_icon")
internal static let locationPlaceholderBackgroundImage = ImageAsset(name: "location_placeholder_background_image")
internal static let locationShareIcon = ImageAsset(name: "location_share_icon")
internal static let locationUserMarker = ImageAsset(name: "location_user_marker")
internal static let pollCheckboxDefault = ImageAsset(name: "poll_checkbox_default")
Expand Down
16 changes: 16 additions & 0 deletions Riot/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2727,6 +2727,10 @@ public class VectorL10n: NSObject {
public static var liveLocationSharingBannerTitle: String {
return VectorL10n.tr("Vector", "live_location_sharing_banner_title")
}
/// Live location ended
public static var liveLocationSharingEnded: String {
return VectorL10n.tr("Vector", "live_location_sharing_ended")
}
/// Loading
public static var loading: String {
return VectorL10n.tr("Vector", "loading")
Expand Down Expand Up @@ -2759,6 +2763,10 @@ public class VectorL10n: NSObject {
public static var locationSharingInvalidAuthorizationSettings: String {
return VectorL10n.tr("Vector", "location_sharing_invalid_authorization_settings")
}
/// Live location error
public static var locationSharingLiveError: String {
return VectorL10n.tr("Vector", "location_sharing_live_error")
}
/// You
public static var locationSharingLiveListItemCurrentUserDisplayName: String {
return VectorL10n.tr("Vector", "location_sharing_live_list_item_current_user_display_name")
Expand All @@ -2783,6 +2791,10 @@ public class VectorL10n: NSObject {
public static func locationSharingLiveListItemTimeLeft(_ p1: String) -> String {
return VectorL10n.tr("Vector", "location_sharing_live_list_item_time_left", p1)
}
/// Loading Live location...
public static var locationSharingLiveLoading: String {
return VectorL10n.tr("Vector", "location_sharing_live_loading")
}
/// Share location
public static var locationSharingLiveMapCalloutTitle: String {
return VectorL10n.tr("Vector", "location_sharing_live_map_callout_title")
Expand All @@ -2791,6 +2803,10 @@ public class VectorL10n: NSObject {
public static var locationSharingLiveShareTitle: String {
return VectorL10n.tr("Vector", "location_sharing_live_share_title")
}
/// Live until %@
public static func locationSharingLiveTimerIncoming(_ p1: String) -> String {
return VectorL10n.tr("Vector", "location_sharing_live_timer_incoming", p1)
}
/// Location
public static var locationSharingLiveViewerTitle: String {
return VectorL10n.tr("Vector", "location_sharing_live_viewer_title")
Expand Down
6 changes: 6 additions & 0 deletions Riot/Managers/Theme/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ import DesignKit

var roomCellOutgoingBubbleBackgroundColor: UIColor { get }

// Localisation Cells

var roomCellLocalisationIconStartedColor: UIColor { get }

var roomCellLocalisationErrorColor: UIColor { get }

// MARK: - Customisation methods


Expand Down
4 changes: 4 additions & 0 deletions Riot/Managers/Theme/Themes/DarkTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class DarkTheme: NSObject, Theme {
}

var roomCellOutgoingBubbleBackgroundColor: UIColor = UIColor(rgb: 0x133A34)

var roomCellLocalisationIconStartedColor: UIColor = UIColor(rgb: 0x5C56F5)

var roomCellLocalisationErrorColor: UIColor = UIColor(rgb: 0xFF5B55)

func applyStyle(onTabBar tabBar: UITabBar) {
tabBar.unselectedItemTintColor = self.tabBarUnselectedItemTintColor
Expand Down
4 changes: 4 additions & 0 deletions Riot/Managers/Theme/Themes/DefaultTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ class DefaultTheme: NSObject, Theme {

var roomCellOutgoingBubbleBackgroundColor: UIColor = UIColor(rgb: 0xE7F8F3)

var roomCellLocalisationIconStartedColor: UIColor = UIColor(rgb: 0x5C56F5)

var roomCellLocalisationErrorColor: UIColor = UIColor(rgb: 0xFF5B55)

func applyStyle(onTabBar tabBar: UITabBar) {
tabBar.unselectedItemTintColor = self.tabBarUnselectedItemTintColor
tabBar.tintColor = self.tintColor
Expand Down
2 changes: 2 additions & 0 deletions Riot/Modules/Room/CellData/RoomBubbleCellData.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ - (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomS
self.collapsable = NO;
self.collapsed = NO;
}

break;
}
default:
break;
Expand Down
72 changes: 30 additions & 42 deletions Riot/Modules/Room/Location/LocationMarkerView.xib
Original file line number Diff line number Diff line change
@@ -1,63 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="iN0-l3-epB" customClass="LocationMarkerView" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="50" height="108"/>
<rect key="frame" x="0.0" y="0.0" width="42" height="46"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GS1-Cw-Ezx">
<rect key="frame" x="0.0" y="0.0" width="50" height="54"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="location_user_marker" translatesAutoresizingMaskIntoConstraints="NO" id="ldO-kc-R5W">
<rect key="frame" x="0.0" y="0.0" width="50" height="54"/>
<color key="tintColor" red="0.050980392159999999" green="0.74117647060000003" blue="0.5450980392" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="41S-fj-tn4"/>
<constraint firstAttribute="height" constant="54" id="MAX-5E-xvS"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="location_marker_icon" translatesAutoresizingMaskIntoConstraints="NO" id="gQe-Hv-22e">
<rect key="frame" x="13" y="15" width="24" height="24"/>
<color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="24" id="XuF-VU-qG2"/>
<constraint firstAttribute="height" constant="24" id="ejE-pC-umv"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qut-wn-BX3" customClass="UserAvatarView" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="2" y="2" width="46" height="46"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="46" id="BjG-I5-n8f"/>
<constraint firstAttribute="width" constant="46" id="W3F-Aw-FO3"/>
</constraints>
</view>
</subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="location_user_marker" translatesAutoresizingMaskIntoConstraints="NO" id="ldO-kc-R5W">
<rect key="frame" x="0.0" y="0.5" width="42" height="45"/>
<color key="tintColor" red="0.050980392159999999" green="0.74117647060000003" blue="0.5450980392" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="42" id="R2b-uu-zTh"/>
<constraint firstAttribute="height" constant="45" id="kEu-X4-Zv7"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="location_marker_icon" translatesAutoresizingMaskIntoConstraints="NO" id="gQe-Hv-22e">
<rect key="frame" x="9" y="9" width="24" height="24"/>
<color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="24" id="XuF-VU-qG2"/>
<constraint firstAttribute="height" constant="24" id="ejE-pC-umv"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qut-wn-BX3" customClass="UserAvatarView" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="3" y="4" width="36" height="36"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="ldO-kc-R5W" firstAttribute="top" secondItem="GS1-Cw-Ezx" secondAttribute="top" id="1cb-YG-bcI"/>
<constraint firstItem="ldO-kc-R5W" firstAttribute="leading" secondItem="GS1-Cw-Ezx" secondAttribute="leading" id="8I8-Zn-R5S"/>
<constraint firstItem="gQe-Hv-22e" firstAttribute="centerY" secondItem="GS1-Cw-Ezx" secondAttribute="centerY" id="EE9-rM-y0V"/>
<constraint firstItem="qut-wn-BX3" firstAttribute="centerY" secondItem="GS1-Cw-Ezx" secondAttribute="centerY" constant="-2" id="EQM-Hr-37h"/>
<constraint firstAttribute="trailing" secondItem="ldO-kc-R5W" secondAttribute="trailing" id="QUB-rY-t4j"/>
<constraint firstItem="qut-wn-BX3" firstAttribute="centerX" secondItem="GS1-Cw-Ezx" secondAttribute="centerX" id="XLg-Qs-yTR"/>
<constraint firstAttribute="bottom" secondItem="ldO-kc-R5W" secondAttribute="bottom" id="l4H-nN-44g"/>
<constraint firstItem="gQe-Hv-22e" firstAttribute="centerX" secondItem="GS1-Cw-Ezx" secondAttribute="centerX" id="syG-Kp-4F9"/>
<constraint firstAttribute="height" constant="36" id="BjG-I5-n8f"/>
<constraint firstAttribute="width" constant="36" id="W3F-Aw-FO3"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="GS1-Cw-Ezx" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="61F-Ve-exC"/>
<constraint firstAttribute="trailing" secondItem="GS1-Cw-Ezx" secondAttribute="trailing" id="H8I-4T-A0M"/>
<constraint firstItem="GS1-Cw-Ezx" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="hhI-gR-E5z"/>
<constraint firstAttribute="bottom" secondItem="GS1-Cw-Ezx" secondAttribute="bottom" constant="54" id="mvD-6W-gMh"/>
<constraint firstItem="ldO-kc-R5W" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="6Ih-un-Opb"/>
<constraint firstItem="ldO-kc-R5W" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="8ex-ce-7JP"/>
<constraint firstItem="gQe-Hv-22e" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="VE9-WY-CvF"/>
<constraint firstItem="qut-wn-BX3" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="Y4M-u0-fTL"/>
<constraint firstItem="gQe-Hv-22e" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" constant="-2" id="eMd-85-1X6"/>
<constraint firstItem="qut-wn-BX3" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" constant="-1" id="jar-84-78F"/>
</constraints>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
Expand All @@ -71,6 +59,6 @@
</objects>
<resources>
<image name="location_marker_icon" width="24" height="24"/>
<image name="location_user_marker" width="51" height="54.5"/>
<image name="location_user_marker" width="42" height="45"/>
</resources>
</document>
Loading

0 comments on commit 7e3737a

Please sign in to comment.