Skip to content

Commit

Permalink
Fixes found when porting to Swift
Browse files Browse the repository at this point in the history
  • Loading branch information
pmachapman committed Aug 18, 2021
1 parent 9d5a6e0 commit bccd909
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion GoToBible.Model/ChapterReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace GoToBible.Model
/// <summary>
/// A chapter reference.
/// </summary>
public class ChapterReference
public record ChapterReference
{
/// <summary>
/// Initialises a new instance of the <see cref="ChapterReference" /> class.
Expand Down
7 changes: 3 additions & 4 deletions GoToBible.Model/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ private static string[] GetRanges(string passage)
{
if (!rangePart.Contains(':'))
{
semiParts[i] = semiParts[i] + ':' + 1;
semiParts[i] = semiParts[i] + ":1";
}
}

Expand All @@ -603,12 +603,11 @@ private static string NormaliseCommas(string rangePart)

for (int i = 1; i < parts.Length; i++)
{
if (parts[i].IndexOf(':') != -1)
if (parts[i].Contains(':'))
{
continue;
}

if (!parts[0].Contains(':'))
else if (!parts[0].Contains(':'))
{
if (!parts[i].Contains('-'))
{
Expand Down
4 changes: 2 additions & 2 deletions GoToBible.Model/GoToBible.Model.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<ApplicationIcon>App.ico</ApplicationIcon>
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>IReadOnlyCollection is now used instead of ReadOnlyCollection to allow JSON deserialisation.</PackageReleaseNotes>
<Version>1.1.2</Version>
<PackageReleaseNotes>Bug fixes and improvements from the port to Swift</PackageReleaseNotes>
<Version>1.1.3</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion GoToBible.Model/PassageReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace GoToBible.Model
/// <summary>
/// A passage reference.
/// </summary>
public class PassageReference
public record PassageReference
{
/// <summary>
/// Gets or sets the chapter reference.
Expand Down
22 changes: 11 additions & 11 deletions GoToBible.Model/Translation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Translation
/// <value>
/// <c>true</c> if this instance can be exported; otherwise, <c>false</c>.
/// </value>
public bool CanBeExported { get; set; } = false;
public bool CanBeExported { get; set; }

/// <summary>
/// Gets or sets the translation's unique code.
Expand All @@ -41,7 +41,7 @@ public class Translation
/// <value>
/// <c>true</c> if a commentary; otherwise, <c>false</c>.
/// </value>
public bool Commentary { get; set; } = false;
public bool Commentary { get; set; }

/// <summary>
/// Gets or sets the copyright message.
Expand All @@ -67,14 +67,6 @@ public class Translation
/// </value>
public string? Language { get; set; }

/// <summary>
/// Gets or sets the id of the translation provider.
/// </summary>
/// <value>
/// The translation provider id.
/// </value>
public string Provider { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the name of the translation.
/// </summary>
Expand All @@ -86,6 +78,14 @@ public class Translation
/// </remarks>
public string Name { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the id of the translation provider.
/// </summary>
/// <value>
/// The translation provider id.
/// </value>
public string Provider { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the year the translation was made.
/// </summary>
Expand All @@ -95,6 +95,6 @@ public class Translation
public int Year { get; set; }

/// <inheritdoc/>
public override string ToString() => $"{this.Language}: {this.Name}";
public override string ToString() => this.Language == null ? this.Name : $"{this.Language}: {this.Name}";
}
}

0 comments on commit bccd909

Please sign in to comment.