Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ build/
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!OneSignalSDK.xcworkspace
!default.xcworkspace
xcuserdata
profile
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: objective-c
osx_image: xcode8.1
before_install:
- cd iOS_SDK
- cd iOS_SDK/OneSignalSDK
script:
- xcodebuild -list
- xcodebuild build -scheme OneSignal-Dynamic
Expand Down
2 changes: 2 additions & 0 deletions Examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Pods
Podfile.lock
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Modified MIT License
*
* Copyright 2015 OneSignal
* Copyright 2017 OneSignal
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 7 additions & 0 deletions Examples/ObjectiveCExample/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
target 'OneSignalDemo' do
pod 'OneSignal', '~> 2.0'
end

target 'NotificationServiceExtension' do
pod 'OneSignal', '~> 2.0'
end
9 changes: 9 additions & 0 deletions Examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Running Example projects.
1. Open `ObjectiveCExample` or `SwiftExample` in your terminal.
2. Run `sudo gem install cocoapods` to install Cocoapods.
3. Run `pod repo update` to make sure you get the latest OneSignal version.
4. Run `pod install`
5. Open `OneSignalDemo.xcworkspace`
6. Under General in Xcode Change the Bundle identifier to yours.
7. Also change your Team under signing below this.
8. Open `AppDelegate` and change the `appId` passed to OneSignal initWithLaunchOptions to yours.
574 changes: 574 additions & 0 deletions Examples/SwiftExample/OneSignalDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91E4D50C1C7521DE00025BA8"
BuildableName = "OneSignalDemo.app"
BlueprintName = "OneSignalDemo"
ReferencedContainer = "container:OneSignalDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91E4D50C1C7521DE00025BA8"
BuildableName = "OneSignalDemo.app"
BlueprintName = "OneSignalDemo"
ReferencedContainer = "container:OneSignalDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91E4D50C1C7521DE00025BA8"
BuildableName = "OneSignalDemo.app"
BlueprintName = "OneSignalDemo"
ReferencedContainer = "container:OneSignalDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91E4D50C1C7521DE00025BA8"
BuildableName = "OneSignalDemo.app"
BlueprintName = "OneSignalDemo"
ReferencedContainer = "container:OneSignalDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9112E8AC1E725C1E0022A1CB"
BuildableName = "OneSignalNotificationServiceExtension.appex"
BlueprintName = "OneSignalNotificationServiceExtension"
ReferencedContainer = "container:OneSignalDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91E4D50C1C7521DE00025BA8"
BuildableName = "OneSignalDemo.app"
BlueprintName = "OneSignalDemo"
ReferencedContainer = "container:OneSignalDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9112E8AC1E725C1E0022A1CB"
BuildableName = "OneSignalNotificationServiceExtension.appex"
BlueprintName = "OneSignalNotificationServiceExtension"
ReferencedContainer = "container:OneSignalDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91E4D50C1C7521DE00025BA8"
BuildableName = "OneSignalDemo.app"
BlueprintName = "OneSignalDemo"
ReferencedContainer = "container:OneSignalDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91E4D50C1C7521DE00025BA8"
BuildableName = "OneSignalDemo.app"
BlueprintName = "OneSignalDemo"
ReferencedContainer = "container:OneSignalDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}, settings: [kOSSettingsKeyAutoPrompt : true,
kOSSettingsKeyInFocusDisplayOption : OSNotificationDisplayType.notification.rawValue])

OneSignal.idsAvailable({ (userId, pushToken) in
print("UserId:%@", userId);
if (pushToken != nil) {
NSLog("Sending Test Noification to this device now");
OneSignal.postNotification(["contents": ["en": "Test Message"], "include_player_ids": [userId]]);
}
});


// iOS 10 ONLY - Add category for the OSContentExtension
// Make sure to add UserNotifications framework in the Linked Frameworks & Libraries.
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().getNotificationCategories { (categories) in
let myAction = UNNotificationAction(identifier: "action0", title: "Hit Me!", options: .foreground)
let myCategory = UNNotificationCategory(identifier: "myOSContentCategory", actions: [myAction], intentIdentifiers: [], options: .customDismissAction)
let mySet = NSSet(array: [myCategory]).addingObjects(from: categories) as! Set<UNNotificationCategory>
UNUserNotificationCenter.current().setNotificationCategories(mySet)
}
}

return true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>OSServiceExtension</string>
<string>OneSignalNotificationServiceExtension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// NotificationService.swift
// OSServiceExtension
// OneSignalNotificationServiceExtension
//
// Created by Joseph Kalash on 9/12/16.
// Copyright © 2016 OneSignal. All rights reserved.
// Created by Kasten on 3/9/17.
// Copyright © 2017 OneSignal. All rights reserved.
//

import UserNotifications
Expand All @@ -19,7 +19,7 @@ class NotificationService: UNNotificationServiceExtension {

if let bestAttemptContent = bestAttemptContent {
// Modify the notification content here...
bestAttemptContent.title = "[Modified By OneSignal] - \(bestAttemptContent.title)"
bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"

contentHandler(bestAttemptContent)
}
Expand Down
8 changes: 8 additions & 0 deletions Examples/SwiftExample/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
target 'OneSignalDemo' do
use_frameworks!
pod 'OneSignal', '~> 2.0'
end

target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '~> 2.0'
end
2 changes: 1 addition & 1 deletion OneSignal.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Pod::Spec.new do |s|
s.platform = :ios
s.requires_arc = true

s.ios.vendored_frameworks = 'iOS_SDK/Framework/OneSignal.framework'
s.ios.vendored_frameworks = 'iOS_SDK/OneSignalSDK/Framework/OneSignal.framework'
s.framework = 'SystemConfiguration', 'UIKit'
end

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions OneSignalSwiftExample/.gitignore

This file was deleted.

Loading