Skip to content
This repository has been archived by the owner on Sep 30, 2022. It is now read-only.

Commit

Permalink
Added Airdrop/Android Share Support
Browse files Browse the repository at this point in the history
  • Loading branch information
shreystechtips committed Feb 13, 2019
1 parent d2a59c6 commit a7642ec
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 253 deletions.
1 change: 1 addition & 0 deletions Droid/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ protected override void OnCreate(Bundle bundle)

base.OnCreate(bundle);

Xamarin.Essentials.Platform.Init(this, bundle);
Rg.Plugins.Popup.Popup.Init(this, bundle);

global::Xamarin.Forms.Forms.Init(this, bundle);
Expand Down
418 changes: 171 additions & 247 deletions Droid/Resources/Resource.designer.cs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions NRGScoutingApp/Models/Item.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace NRGScoutingApp
{
public class Item
{
public string Id { get; set; }
public string Text { get; set; }
public string Description { get; set; }
}
}
11 changes: 10 additions & 1 deletion NRGScoutingApp/Pages/Data Handling/ExportDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
Margin="5,5">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
Expand All @@ -51,14 +52,22 @@
Margin="5,3"
Grid.Row="0"
Grid.Column="0"
HorizontalOptions="EndAndExpand"/>
HorizontalOptions="StartAndExpand"/>
<Button x:Name="copyButton"
Text="Clipboard"
Margin="10,3"
Clicked="copyClicked"
Grid.Row="0"
Grid.Column="1"
HorizontalOptions="EndAndExpand"/>
<Button Text="Share"
Clicked="Share_Clicked"
x:Name="shareButton"
Margin="5,3"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
HorizontalOptions="CenterAndExpand"/>
</Grid>
</StackLayout>
</Frame>
Expand Down
23 changes: 21 additions & 2 deletions NRGScoutingApp/Pages/Data Handling/ExportDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Plugin.Clipboard;
using System.Threading.Tasks;
using Rg.Plugins.Popup.Services;
using Xamarin.Essentials;

Expand All @@ -19,20 +20,38 @@ void copyClicked (object sender, System.EventArgs e) {
PopupNavigation.Instance.PopAsync (true);
}

//Gets entries from device storage and sets them into the text field (or disables field if empty)
void setExportEntries () {
async void Share_Clicked(object sender, System.EventArgs e)
{
await ShareText(exportDisplay.Text);
}
public async Task ShareText(string text)
{
await Share.RequestAsync(new ShareTextRequest
{
Text = text,
Title = "Share Match"
});
}

//Gets entries from device storage and sets them into the text field (or disables field if empty)
void setExportEntries () {
JObject x;
try {
x = (JObject) JsonConvert.DeserializeObject (Preferences.Get ("matchEventsString", ""));
} catch (JsonException) {
x = new JObject ();
}
if (Object.Equals(x, null))
{
x = new JObject();
}
if (x.Count > 0) {
String exportEntries = JsonConvert.SerializeObject (
JObject.Parse (Preferences.Get ("matchEventsString", "")), Formatting.None);
exportDisplay.Text = exportEntries;
} else {
copyButton.IsEnabled = false;
shareButton.IsEnabled = false;
exportDisplay.Text = "No Entries Yet!";
}
}
Expand Down
6 changes: 3 additions & 3 deletions iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
<string>NRG Scouting</string>
<key>CFBundleIdentifier</key>
<string>com.NRG.ScoutingApp.NRG-Scouting</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>v0.7-beta</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
Expand Down Expand Up @@ -44,5 +42,7 @@
<string>Assets.xcassets/AppIcon.appiconset</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CFBundleShortVersionString</key>
<string>v0.7-beta</string>
</dict>
</plist>

0 comments on commit a7642ec

Please sign in to comment.