1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-14 23:33:34 +00:00
This commit is contained in:
Kyle Spearrin
2019-05-15 13:09:49 -04:00
parent 2c302985f8
commit 264028b623
5 changed files with 73 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ using Foundation;
using MobileCoreServices;
using Photos;
using UIKit;
using Xamarin.Forms;
namespace Bit.iOS.Services
{
@@ -197,6 +198,21 @@ namespace Bit.iOS.Services
return result.Task;
}
public void RateApp()
{
string uri = null;
if(SystemMajorVersion() < 11)
{
uri = "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews" +
"?id=1137397744&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software";
}
else
{
uri = "itms-apps://itunes.apple.com/us/app/id1137397744?action=write-review";
}
Device.OpenUri(new Uri(uri));
}
private void ImagePicker_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e)
{
if(sender is UIImagePickerController picker)
@@ -313,5 +329,16 @@ namespace Bit.iOS.Services
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
return Path.Combine(documents, "..", "tmp");
}
private int SystemMajorVersion()
{
var versionParts = UIDevice.CurrentDevice.SystemVersion.Split('.');
if(versionParts.Length > 0 && int.TryParse(versionParts[0], out int version))
{
return version;
}
// unable to determine version
return -1;
}
}
}