Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cordova-plugin-local-notifications
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nabil Sadki
cordova-plugin-local-notifications
Commits
ecb12b55
Commit
ecb12b55
authored
Mar 22, 2015
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix duplicate symbol _UIApplicationRegisterUserNotificationSettings
parent
33ad4c78
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
91 deletions
+128
-91
plugin.xml
plugin.xml
+8
-3
didRegisterUserNotificationSettings.js
scripts/ios/didRegisterUserNotificationSettings.js
+119
-0
APPLocalNotification.m
src/ios/APPLocalNotification.m
+1
-1
AppDelegate+APPLocalNotification.h
src/ios/AppDelegate+APPLocalNotification.h
+0
-38
AppDelegate+APPLocalNotification.m
src/ios/AppDelegate+APPLocalNotification.m
+0
-49
No files found.
plugin.xml
View file @
ecb12b55
...
...
@@ -59,9 +59,6 @@
</feature>
</config-file>
<header-file
src=
"src/ios/AppDelegate+APPLocalNotification.h"
/>
<source-file
src=
"src/ios/AppDelegate+APPLocalNotification.m"
/>
<header-file
src=
"src/ios/APPLocalNotification.h"
/>
<source-file
src=
"src/ios/APPLocalNotification.m"
/>
...
...
@@ -74,6 +71,14 @@
<header-file
src=
"src/ios/UILocalNotification+APPLocalNotification.h"
/>
<source-file
src=
"src/ios/UILocalNotification+APPLocalNotification.m"
/>
<hook
type=
"after_platform_add"
src=
"scripts/ios/didRegisterUserNotificationSettings.js"
/>
<hook
type=
"after_plugin_install"
src=
"scripts/ios/didRegisterUserNotificationSettings.js"
/>
</platform>
<!-- android -->
...
...
scripts/ios/didRegisterUserNotificationSettings.js
0 → 100755
View file @
ecb12b55
/*
* Copyright (c) 2013-2015 by appPlant UG. All rights reserved.
*
* @APPPLANT_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apache License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://opensource.org/licenses/Apache-2.0/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPPLANT_LICENSE_HEADER_END@
*/
// Hook inserts the UIApplicationRegisterUserNotificationSettings constant
// and the didRegisterUserNotificationSettings method to AppDelegate.
var
fs
=
require
(
'fs'
),
path
=
require
(
'path'
),
rootdir
=
process
.
argv
[
2
];
if
(
!
rootdir
)
return
;
module
.
exports
=
function
(
context
)
{
var
cordova_util
=
context
.
requireCordovaModule
(
'cordova-lib/src/cordova/util'
),
ConfigParser
=
context
.
requireCordovaModule
(
'cordova-lib/src/configparser/ConfigParser'
),
platforms
=
context
.
requireCordovaModule
(
'cordova-lib/src/cordova/platforms'
),
projectRoot
=
cordova_util
.
isCordova
(),
xml
=
cordova_util
.
projectConfig
(
projectRoot
),
cfg
=
new
ConfigParser
(
xml
);
/**
* The absolute path for the file.
*
* @param {String} platform
* The name of the platform like 'ios'.
* @param {String} relPath
* The relative path from the platform root directory.
*
* @return String
*/
function
getAbsPath
(
platform
,
relPath
)
{
var
platform_path
=
path
.
join
(
projectRoot
,
'platforms'
,
platform
),
parser
=
new
platforms
[
platform
].
parser
(
platform_path
);
return
path
.
join
(
parser
.
cordovaproj
,
relPath
);
}
/**
* Replaces a string with another one in a file.
*
* @param {String} path
* Absolute or relative file path from cordova root project.
* @param {String} to_replace
* The string to replace.
* @param {String}
* The string to replace with.
*/
function
replace
(
path
,
to_replace
,
replace_with
)
{
var
data
=
fs
.
readFileSync
(
path
,
'utf8'
),
result
;
if
(
data
.
indexOf
(
replace_with
)
>
-
1
)
return
;
result
=
data
.
replace
(
new
RegExp
(
to_replace
,
'g'
),
replace_with
);
fs
.
writeFileSync
(
path
,
result
,
'utf8'
);
}
// Absolute paths for AppDelegate's header and member
var
h_path
=
getAbsPath
(
'ios'
,
'Classes/AppDelegate.h'
),
m_path
=
getAbsPath
(
'ios'
,
'Classes/AppDelegate.m'
);
// Decleration of UIApplicationRegisterUserNotificationSettings
var
h_UIApplicationRegisterUserNotificationSettings
=
"extern NSString* const UIApplicationRegisterUserNotificationSettings;
\
n"
;
// Implementation of UIApplicationRegisterUserNotificationSettings
var
m_UIApplicationRegisterUserNotificationSettings
=
"NSString* const UIApplicationRegisterUserNotificationSettings = @
\"
UIApplicationRegisterUserNotificationSettings
\"
;
\
n"
;
// Implementation for didRegisterUserNotificationSettings
var
didRegisterUserNotificationSettings
=
"#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
\
n"
+
"
\
n"
+
"- (void) application:(UIApplication*)application
\
n"
+
" didRegisterUserNotificationSettings:(UIUserNotificationSettings*)settings
\
n"
+
"{
\
n"
+
" NSNotificationCenter* center = [NSNotificationCenter
\
n"
+
" defaultCenter];
\
n"
+
"
\
n"
+
" // re-post (broadcast)
\
n"
+
" [center postNotificationName:UIApplicationRegisterUserNotificationSettings
\
n"
+
" object:settings];
\
n"
+
"}
\
n"
+
"#endif
\
n"
;
// Inserts the constant decleration
replace
(
h_path
,
'@interface AppDelegate'
,
h_UIApplicationRegisterUserNotificationSettings
+
"
\
n@interface AppDelegate"
);
// Inserts the constant implementation
replace
(
m_path
,
'@implementation AppDelegate'
,
m_UIApplicationRegisterUserNotificationSettings
+
"
\
n@implementation AppDelegate"
);
// Inserts the didRegisterUserNotificationSettings implementation
replace
(
m_path
,
'@end'
,
didRegisterUserNotificationSettings
+
"
\
n@end"
);
};
src/ios/APPLocalNotification.m
View file @
ecb12b55
...
...
@@ -21,9 +21,9 @@
* @APPPLANT_LICENSE_HEADER_END@
*/
#import "AppDelegate.h"
#import "APPLocalNotification.h"
#import "APPLocalNotificationOptions.h"
#import "AppDelegate+APPLocalNotification.h"
#import "UIApplication+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
...
...
src/ios/AppDelegate+APPLocalNotification.h
deleted
100644 → 0
View file @
33ad4c78
/*
* Copyright (c) 2013-2015 by appPlant UG. All rights reserved.
*
* @APPPLANT_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apache License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://opensource.org/licenses/Apache-2.0/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPPLANT_LICENSE_HEADER_END@
*/
#import "AppDelegate.h"
#import <Availability.h>
extern
NSString
*
const
UIApplicationRegisterUserNotificationSettings
;
@interface
AppDelegate
(
APPLocalNotification
)
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
// Tells the delegate what types of notifications may be used
-
(
void
)
application
:(
UIApplication
*
)
application
didRegisterUserNotificationSettings
:(
UIUserNotificationSettings
*
)
settings
;
#endif
@end
src/ios/AppDelegate+APPLocalNotification.m
deleted
100644 → 0
View file @
33ad4c78
/*
* Copyright (c) 2013-2015 by appPlant UG. All rights reserved.
*
* @APPPLANT_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apache License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://opensource.org/licenses/Apache-2.0/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPPLANT_LICENSE_HEADER_END@
*/
#import "AppDelegate+APPLocalNotification.h"
#import <Availability.h>
NSString
*
const
UIApplicationRegisterUserNotificationSettings
=
@"UIApplicationRegisterUserNotificationSettings"
;
@implementation
AppDelegate
(
APPLocalNotification
)
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
/**
* Tells the delegate what types of notifications may be used
* to get the user’s attention.
*/
-
(
void
)
application
:(
UIApplication
*
)
application
didRegisterUserNotificationSettings
:(
UIUserNotificationSettings
*
)
settings
{
NSNotificationCenter
*
center
=
[
NSNotificationCenter
defaultCenter
];
// re-post (broadcast)
[
center
postNotificationName
:
UIApplicationRegisterUserNotificationSettings
object
:
settings
];
}
#endif
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment