Skip to content

Commit

Permalink
feat: Show special cozy shared icon next to cozy shared ciphers
Browse files Browse the repository at this point in the history
  • Loading branch information
ptbrowne committed Mar 27, 2020
1 parent e0f4488 commit d3d7e0b
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 25 deletions.
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.
14 changes: 14 additions & 0 deletions cozy-customizations/replacements.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,19 @@
{
"dests": ["../src/Android/Resources/mipmap-xxxhdpi/ic_launcher_round.png"],
"src": "./Resources/android/ic_launcher_round-192.png"
},
{
"dests": [
"../src/Android/Resources/drawable/shared-with-cozy-icon.png",
"../src/iOS/Resources/shared-with-cozy-icon.png"
],
"src": "./Resources/common/shared-with-cozy-icon.png"
},
{
"dests": [
"../src/Android/Resources/drawable-hdpi/shared-with-cozy-icon.png",
"../src/iOS/Resources/shared-with-cozy-icon@2x.png"
],
"src": "./Resources/common/shared-with-cozy-icon@2x.png"
}
]
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.
13 changes: 5 additions & 8 deletions src/App/Controls/CipherViewCell/CipherViewCell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
Expand All @@ -74,17 +75,13 @@
Grid.ColumnSpan="3"
StyleClass="list-subtitle, list-subtitle-platform"
Text="{Binding Cipher.SubTitle, Mode=OneWay}" />
<controls:FaLabel
<ff:CachedImage
Grid.Column="1"
Grid.Row="0"
Margin="4, 4, 0, 0"
HorizontalOptions="Start"
VerticalOptions="Center"
StyleClass="list-title-icon"
Margin="5, 0, 0, 0"
Text="{ Binding SharedIconText, Mode=OneWay}"
IsVisible="{Binding Cipher.Shared, Mode=OneWay}"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Shared}" />
IsVisible="{Binding CozyShared, Mode=OneWay}"
Source="shared-with-cozy-icon.png" />
<controls:FaLabel
Grid.Column="2"
Grid.Row="0"
Expand Down
26 changes: 9 additions & 17 deletions src/App/Controls/CipherViewCell/CipherViewCellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,35 @@ public CipherView Cipher
set {
SetProperty(ref _cipher, value, () => {
#region cozy
TriggerPropertyChanged(nameof(SharedIconText));
TriggerPropertyChanged(nameof(CozyShared));
#endregion
});
}
}


#region cozy
private static readonly string shareIcon = "\uf1e0";
private static readonly string cloudIcon = "\uf0c2";

private IUserService _userService;

public CipherViewCellViewModel()
{
_userService = ServiceContainer.Resolve<IUserService>("userService"); ;
}

public static readonly BindableProperty SharedIconTextProperty = BindableProperty.Create(
nameof(SharedIconText),
typeof(string),
public static readonly BindableProperty CozySharedProperty = BindableProperty.Create(
nameof(CozyShared),
typeof(bool),
typeof(CipherViewCellViewModel),
string.Empty
false
);

public string SharedIconText {
public bool CozyShared
{
get
{
var cozyOrganizationId = _userService.CozyOrganizationId;
if (_cipher.OrganizationId == cozyOrganizationId)
{
return CipherViewCellViewModel.cloudIcon;
} else
{
return CipherViewCellViewModel.shareIcon;
}

return _cipher.OrganizationId == cozyOrganizationId;

}
}
#endregion
Expand Down
Binary file added src/iOS/Resources/shared-with-cozy-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/iOS/Resources/shared-with-cozy-icon@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/iOS/iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
<ImageAsset Include="Resources\Assets.xcassets\AppIcons.appiconset\Contents.json">
<Visible>false</Visible>
</ImageAsset>
<BundleResource Include="Resources\shared-with-cozy-icon.png" />
<BundleResource Include="Resources\shared-with-cozy-icon%402x.png" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="LaunchScreen.storyboard" />
Expand Down

0 comments on commit d3d7e0b

Please sign in to comment.