Skip to content

Commit

Permalink
use Mobile.BulidTools for environment values
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Jul 26, 2019
1 parent 01c6581 commit 0ed1f8a
Show file tree
Hide file tree
Showing 8 changed files with 264 additions and 244 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -172,4 +172,7 @@ UpgradeLog*.htm
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/
FakesAssemblies/

# Mobile.BuildTools
secrets.json
14 changes: 3 additions & 11 deletions README.md
Expand Up @@ -44,8 +44,8 @@ app follow the instructions below to:

- configure Azure Mobile Services,
- configure Azure Storage,
- setup Xamarin Insights, and
- add the required constants to the `Keys` class in the app
- setup App Center, and
- rename or copy the `sample.json` to `secrets.json` and add the required values

### Instructions

Expand Down Expand Up @@ -104,15 +104,7 @@ The backend for your Snapchat clone is now complete. :)

#### Run the Xamarin App (iOS or Android)

- Open the solution for *Moments* and navigate to `Helpers/Keys.cs`. Paste in relevant keys and information as seen below:
![Keys.cs](Screenshots/README/Keys.png)
These values come from:
- `ApplicationURL` - Azure Mobile Services DASHBOARD > MOBILE SERVICE URL
- `ApplicationMobileService` - Azure Mobile Services DASHBOARD > MOBILE SERVICE URL
- `ApplicationKey` - Azure Mobile Services DASHBOARD > MANAGE KEYS > APPLICATION KEY
- `ContainerURL` - Azure Storage CONTAINERS page NAME column
- `ContainerName` - Azure Storage CONTAINERS page URL column
- `InsightsKey` - Xamarin Insights configuration (using this is optional)
- Open the solution for *Moments* and copy the template from `sample.json` in the *Moments* project, to `secrets.json` and update the values with your values.
- Build *Moments* for either an iOS or Android device, and watch it work its magic!

### Special Thanks
Expand Down
8 changes: 8 additions & 0 deletions src/Moments.Droid/MainActivity.cs
Expand Up @@ -13,6 +13,7 @@
using Microsoft.WindowsAzure.MobileServices;
using Prism;
using Prism.Ioc;
using Android.Runtime;

namespace Moments.Droid
{
Expand All @@ -36,5 +37,12 @@ protected override void OnCreate(Bundle savedInstanceState)

ScreenshotServiceAndroid.Activity = this;
}

public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum]Permission[] grantResults)
{
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);

base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}
14 changes: 0 additions & 14 deletions src/Moments.Shared/Helpers/Keys.cs

This file was deleted.

4 changes: 4 additions & 0 deletions src/Moments.Shared/Moments.csproj
Expand Up @@ -16,6 +16,10 @@
<PackageReference Include="akavache.sqlite3" Version="6.5.9" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="2.1.1" />
<PackageReference Include="Mobile.BuildTools" Version="1.4.0.638">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Prism.DryIoc.Forms.Extended" Version="1.0.0.511-pre" />
<PackageReference Include="ReactiveUI.Fody" Version="10.0.1-preview.6" />
<PackageReference Include="Splat" Version="8.0.5" />
Expand Down
12 changes: 5 additions & 7 deletions src/Moments.Shared/Services/ZumoConfig.cs
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using Moments.AzureMobileApps.Helpers;
using Moments.AzureMobileApps.Helpers;
using Moments.Helpers;

namespace Moments.Services
{
class ZumoConfig : IZumoConfig
{
public string ApplicationURL => "";
public string ContainerURL => "";
public string ContainerName => "";
public string ApplicationURL => Secrets.ApplicationURL;
public string ContainerURL => Secrets.ContainerURL;
public string ContainerName => Secrets.ContainerName;
}
}
6 changes: 6 additions & 0 deletions src/Moments.Shared/sample.json
@@ -0,0 +1,6 @@
{
"ApplicationURL": "",
"ContainerURL": "",
"ContainerName": "",
"AppCenterKey": ""
}

0 comments on commit 0ed1f8a

Please sign in to comment.