Skip to content

Commit

Permalink
Merge pull request #16 from OneSignal/2.0
Browse files Browse the repository at this point in the history
2.0 Release 🎉
  • Loading branch information
jkasten2 authored Oct 11, 2016
2 parents a7f3730 + 3e72d05 commit 07606c9
Show file tree
Hide file tree
Showing 141 changed files with 4,453 additions and 4,369 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

78 changes: 57 additions & 21 deletions Example.Shared.Application/Droid/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,65 @@ public class MainActivity : Activity
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);

OneSignal.NotificationReceived exampleNotificationReceivedDelegate = delegate (OSNotification notification)
{
try
{
System.Console.WriteLine("OneSignal Notification Received:\nMessage: {0}", notification.payload.body);
Dictionary<string, object> additionalData = notification.payload.additionalData;

if (additionalData.Count > 0)
System.Console.WriteLine("additionalData: {0}", additionalData);
}
catch (System.Exception e)
{
System.Console.WriteLine(e.StackTrace);
}
};

// Notification Opened Delegate
OneSignal.NotificationOpened exampleNotificationOpenedDelegate = delegate(string message, Dictionary<string, object> additionalData, bool isActive) {
try
{
System.Console.WriteLine ("OneSignal Notification opened:\nMessage: {0}", message);

if (additionalData != null)
{
if (additionalData.ContainsKey("customKey"))
System.Console.WriteLine ("customKey: {0}", additionalData ["customKey"]);

System.Console.WriteLine ("additionalData: {0}", additionalData);
}
}
catch (System.Exception e)
{
System.Console.WriteLine (e.StackTrace);
}
};
// Notification Opened Delegate
OneSignal.NotificationOpened exampleNotificationOpenedDelegate = delegate (OSNotificationOpenedResult result)
{
try
{
System.Console.WriteLine("OneSignal Notification opened:\nMessage: {0}", result.notification.payload.body);
Dictionary<string, object> additionalData = result.notification.payload.additionalData;
if (additionalData.Count > 0)
System.Console.WriteLine("additionalData: {0}", additionalData);


List<Dictionary<string, object>> actionButtons = result.notification.payload.actionButtons;
if (actionButtons.Count > 0)
System.Console.WriteLine("actionButtons: {0}", actionButtons);
}
catch (System.Exception e)
{
System.Console.WriteLine(e.StackTrace);
}
};

// Initialize OneSignal
OneSignal.StartInit("4ba9ec31-b65a-4f5f-b210-a5077a245b3d", "703322744261")
.HandleNotificationReceived(exampleNotificationReceivedDelegate)
.HandleNotificationOpened(exampleNotificationOpenedDelegate)
.InFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
.Settings(new Dictionary<string, bool> { { OneSignal.kOSSettingsKeyAutoPrompt, true }, { OneSignal.kOSSettingsKeyInAppLaunchURL, false } })
.EndInit();

// Initialize OneSignal
OneSignal.Init (exampleNotificationOpenedDelegate);
OneSignal.IdsAvailable((playerID, pushToken) =>
{
try
{
System.Console.WriteLine("Player ID: " + playerID);
if (pushToken != null)
System.Console.WriteLine("Push Token: " + pushToken);
}
catch (System.Exception e)
{
System.Console.WriteLine(e.StackTrace);
}
});

// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:label="Example.Shared.Application">
<meta-data android:name="onesignal_app_id"
android:value="EDIT_APPID_TO_TEST_THIS_APP" />
<meta-data android:name="onesignal_google_project_number"
android:value="str:EDIT_GPN_TO_TEST_THIS_APP" />

<receiver android:name="com.onesignal.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
Expand Down
19 changes: 14 additions & 5 deletions Example.Shared.Application/Droid/Resources/Resource.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions Example.Shared.Application/Droid/obj/Debug/sdks.cache

This file was deleted.

14 changes: 9 additions & 5 deletions Example.Shared.Application/Example.Shared.Application.userprefs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<Properties StartupItem="iOS/Example.Shared.Application.iOS.csproj">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.Kasten’s iPad" />
<MonoDevelop.Ide.Workbench ActiveDocument="iOS/Info.plist">
<Properties StartupConfiguration="{6B36F91C-F597-4E43-B547-F303E0755448}|Default">
<MonoDevelop.Ide.Workbench ActiveDocument="Droid/MainActivity.cs">
<Files>
<File FileName="Droid/Properties/AndroidManifest.xml" Line="1" Column="1" />
<File FileName="iOS/Info.plist" />
<File FileName="Droid/MainActivity.cs" Line="49" Column="12" />
<File FileName="../SDK/Common/Com.OneSignal/Com.OneSignal/OneSignal.cs" Line="224" Column="91" />
<File FileName="../SDK/Android/OneSignalAndroid.cs" Line="108" Column="71" />
<File FileName="iOS/AppDelegate.cs" Line="55" Column="38" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.ItemProperties.Example.Shared.Application.iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.A716D2E4-BC21-48CE-8BB3-C6AC416BED74" />
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhoneSimulator" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
<MonoDevelop.Ide.ItemProperties.Example.Shared.Application.Droid PreferredExecutionTarget="Android.Android_Accelerated_x86" />
</Properties>
70 changes: 53 additions & 17 deletions Example.Shared.Application/iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,76 @@ namespace Example.Shared.Application.iOS
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
public class AppDelegate : UIApplicationDelegate {
// class-level declarations

public override UIWindow Window {
get;
set;
}

public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) {

OneSignal.NotificationReceived exampleNotificationReceivedDelegate = delegate (OSNotification notification)
{
try
{
System.Console.WriteLine("OneSignal Notification Received: {0}", notification.payload.body);
Dictionary<string, object> additionalData = notification.payload.additionalData;

if (additionalData.Count > 0)
System.Console.WriteLine("additionalData: {0}", additionalData);
}
catch (System.Exception e)
{
System.Console.WriteLine(e.StackTrace);
}
};

// Notification Opened Delegate
OneSignal.NotificationOpened exampleNotificationOpenedDelegate = delegate(string message, Dictionary<string, object> additionalData, bool isActive) {
OneSignal.NotificationOpened exampleNotificationOpenedDelegate = delegate(OSNotificationOpenedResult result)
{
try
{
System.Console.WriteLine ("OneSignal Notification opened:\nMessage: {0}", message);

if (additionalData != null)
{
if (additionalData.ContainsKey("customKey"))
System.Console.WriteLine ("customKey: {0}", additionalData ["customKey"]);
System.Console.WriteLine ("OneSignal Notification opened: {0}", result.notification.payload.body);

Dictionary<string, object> additionalData = result.notification.payload.additionalData;
List<Dictionary<string, object>> actionButtons = result.notification.payload.actionButtons;

if (additionalData.Count > 0)
System.Console.WriteLine("additionalData: {0}", additionalData);

System.Console.WriteLine ("additionalData: {0}", additionalData);
}
if (actionButtons.Count > 0)
System.Console.WriteLine ("actionButtons: {0}", actionButtons);
}
catch (System.Exception e)
{
System.Console.WriteLine (e.StackTrace);
}
};

// Initialize OneSignal
OneSignal.Init (exampleNotificationOpenedDelegate);


// Initialize OneSignal
OneSignal.StartInit("5eb5a37e-b458-11e3-ac11-000c2940e62c")
.HandleNotificationReceived(exampleNotificationReceivedDelegate)
.HandleNotificationOpened(exampleNotificationOpenedDelegate)
.InFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
.Settings(new Dictionary<string, bool> { { OneSignal.kOSSettingsKeyAutoPrompt, true }, { OneSignal.kOSSettingsKeyInAppLaunchURL, false } })
.EndInit();

OneSignal.IdsAvailable((playerID, pushToken) =>
{
try
{
System.Console.WriteLine("Player ID: " + playerID);
if (pushToken != null)
System.Console.WriteLine("Push Token: " + pushToken);
}
catch (System.Exception e)
{
System.Console.WriteLine(e.StackTrace);
}
});

return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Example.Shared.Application/iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleName</key>
<string>Example.Shared.Application</string>
<key>CFBundleIdentifier</key>
<string>com.companyname.example-shared-application</string>
<string>com.hiptic.ios10-test</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>NewRefCount</key>
<string>true</string>
<key>HttpMessageHandler</key>
<string>System.Net.Http.HttpClientHandler, System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</string>
<key>TlsProvider</key>
<string>default</string>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Loading

0 comments on commit 07606c9

Please sign in to comment.