react-native-expo-moengage 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE.txt +8 -0
- package/README.md +38 -0
- package/android/build.gradle +53 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/expo/modules/moengage/MoEExpoFireBaseMessagingService.kt +56 -0
- package/android/src/main/java/expo/modules/moengage/MoEngageApplicationLifecycleListener.kt +31 -0
- package/android/src/main/java/expo/modules/moengage/MoEngagePackage.kt +12 -0
- package/android/src/main/java/expo/modules/moengage/internal/Constants.kt +4 -0
- package/android/user-agent.gradle +15 -0
- package/app.plugin.js +1 -0
- package/apple/ExpoAdapterMoEngage/MoEngageAppDelegate.swift +76 -0
- package/apple/ExpoAdapterMoEngage/MoEngageExpoPluginInfo.swift +5 -0
- package/apple/ExpoAdapterMoEngage.podspec +40 -0
- package/apple/PushTemplates/MainInterface.storyboard +29 -0
- package/apple/PushTemplates/MoEngageExpoPushTemplates-Info.plist +45 -0
- package/apple/PushTemplates/MoEngageExpoPushTemplates.entitlements +14 -0
- package/apple/PushTemplates/NotificationViewController.swift +14 -0
- package/apple/RichPush/MoEngageExpoRichPush-Info.plist +31 -0
- package/apple/RichPush/MoEngageExpoRichPush.entitlements +14 -0
- package/apple/RichPush/NotificationService.swift +20 -0
- package/build/android/constants.js +47 -0
- package/build/android/types.js +2 -0
- package/build/android/utils.js +80 -0
- package/build/android/withMoEngageAndroid.js +100 -0
- package/build/apple/constants.js +47 -0
- package/build/apple/index.js +72 -0
- package/build/apple/withDangerousMod.js +275 -0
- package/build/apple/withEntitlements.js +117 -0
- package/build/apple/withInfoPlist.js +91 -0
- package/build/apple/withXcodeProject.js +364 -0
- package/build/index.js +37 -0
- package/build/types.js +2 -0
- package/expo-module.config.json +18 -0
- package/package.json +69 -0
- package/src/android/constants.ts +52 -0
- package/src/android/types.ts +1 -0
- package/src/android/utils.ts +74 -0
- package/src/android/withMoEngageAndroid.ts +127 -0
- package/src/apple/constants.ts +48 -0
- package/src/apple/index.ts +38 -0
- package/src/apple/withDangerousMod.ts +265 -0
- package/src/apple/withEntitlements.ts +81 -0
- package/src/apple/withInfoPlist.ts +63 -0
- package/src/apple/withXcodeProject.ts +418 -0
- package/src/index.ts +52 -0
- package/src/types.ts +100 -0
package/CHANGELOG.md
ADDED
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
The Licensee desires to conduct a technical trial (hereafter referred to as the "Trial") or deployment of the source code or binaries contained within MoEngage SDK (“Software”) under a limited license from the Licensor.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
The Licensee may not modify: (i) permit any third party to use the Software; (ii) modify or translate the Software except as otherwise permitted; (iii) reverse engineer, decompile, or disassemble the Software; (iv) copy the Software, except as expressly provided above; or (vi) remove or obscure any proprietary rights notices or labels on the Software.
|
|
5
|
+
Licensee may not transfer the Software or any rights under this Agreement without the Licensor's prior written consent.
|
|
6
|
+
MoEngage owns the Software and all intellectual property rights embodied therein, including copyrights and valuable trade secrets embodied in the Software.
|
|
7
|
+
The Licensee shall not alter or remove this copyright notice.
|
|
8
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE USER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# React Native Expo MoEngage
|
|
2
|
+
|
|
3
|
+
This is an Expo plugin for integrating the MoEngage SDK into your React Native project.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install react-native-expo-moengage
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Add the plugin to your `app.json` or `app.config.js`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"expo": {
|
|
18
|
+
"plugins": [
|
|
19
|
+
[
|
|
20
|
+
"react-native-expo-moengage",
|
|
21
|
+
{
|
|
22
|
+
"android": {
|
|
23
|
+
"configFilePath": "<Android_Config_Path>",
|
|
24
|
+
"smallIconPath": "<Small_Icon_Path>",
|
|
25
|
+
"largeIconPath": "<Large_Icon_Path>",
|
|
26
|
+
"includeFirebaseMessagingDependencies": false,
|
|
27
|
+
"_comment1": "enable includeFirebaseMessagingDependencies to include firebase messaging library while prebuilding moengage expo plugin",
|
|
28
|
+
"isExpoNotificationIntegration": false,
|
|
29
|
+
"_comment2": "enable includeFirebaseMessagingDependencies to include moengage firebase service class for receiving notification while supporting expo notification",
|
|
30
|
+
"shouldIncludeMoEngageFirebaseMessagingService": false,
|
|
31
|
+
"_comment3": "enable includeFirebaseMessagingDependencies to include moengage firebase service class for receiving notification"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
3
|
+
|
|
4
|
+
buildscript {
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
ext {
|
|
16
|
+
minimumVersion = 23
|
|
17
|
+
compileVersion = 35
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
compileSdk compileVersion
|
|
22
|
+
namespace "expo.modules.moengage"
|
|
23
|
+
|
|
24
|
+
defaultConfig {
|
|
25
|
+
minSdk minimumVersion
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
compileOptions {
|
|
31
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
32
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
kotlinOptions {
|
|
36
|
+
freeCompilerArgs = ['-Xjvm-default=all']
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
buildFeatures {
|
|
40
|
+
buildConfig true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
dependencies {
|
|
45
|
+
implementation(project(':expo-modules-core'))
|
|
46
|
+
implementation(project(':react-native-moengage'))
|
|
47
|
+
compileOnly("host.exp.exponent:expo.modules.notifications:+")
|
|
48
|
+
compileOnly('com.google.firebase:firebase-messaging:24.1.0')
|
|
49
|
+
compileOnly('com.facebook.react:react-native')
|
|
50
|
+
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
apply from: file("./user-agent.gradle")
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2014-2021 MoEngage Inc.
|
|
3
|
+
*
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of source code or binaries contained within MoEngage SDK is permitted only to enable use of the MoEngage platform by customers of MoEngage.
|
|
7
|
+
* Modification of source code and inclusion in mobile apps is explicitly allowed provided that all other conditions are met.
|
|
8
|
+
* Neither the name of MoEngage nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
9
|
+
* Redistribution of source code or binaries is disallowed except with specific prior written permission. Any such redistribution must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
10
|
+
*
|
|
11
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
12
|
+
*/
|
|
13
|
+
package expo.modules.moengage
|
|
14
|
+
|
|
15
|
+
import com.google.firebase.messaging.RemoteMessage
|
|
16
|
+
import com.moengage.core.LogLevel
|
|
17
|
+
import com.moengage.core.internal.logger.Logger
|
|
18
|
+
import com.moengage.pushbase.MoEPushHelper
|
|
19
|
+
import com.moengage.firebase.MoEFireBaseHelper
|
|
20
|
+
import expo.modules.notifications.service.ExpoFirebaseMessagingService
|
|
21
|
+
import expo.modules.moengage.internal.BASE_TAG
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Class for receiving Firebase Cloud Messaging while using expo notification service
|
|
25
|
+
* @author Abhishek Kumar
|
|
26
|
+
*/
|
|
27
|
+
public class MoEExpoFireBaseMessagingService : ExpoFirebaseMessagingService() {
|
|
28
|
+
|
|
29
|
+
private val tag = "${BASE_TAG}_MoEExpoFireBaseMessagingService"
|
|
30
|
+
|
|
31
|
+
override fun onMessageReceived(remoteMessage: RemoteMessage) {
|
|
32
|
+
try {
|
|
33
|
+
Logger.print { "$tag onMessageReceived(): " }
|
|
34
|
+
val pushPayload = remoteMessage.data
|
|
35
|
+
if (MoEPushHelper.getInstance().isFromMoEngagePlatform(pushPayload)) {
|
|
36
|
+
Logger.print { "$tag onMessageReceived(): Will try to show push" }
|
|
37
|
+
MoEFireBaseHelper.getInstance().passPushPayload(applicationContext, pushPayload)
|
|
38
|
+
} else {
|
|
39
|
+
Logger.print { "$tag onMessageReceived(): passing callback to expo service" }
|
|
40
|
+
super.onMessageReceived(remoteMessage)
|
|
41
|
+
}
|
|
42
|
+
} catch (t: Throwable) {
|
|
43
|
+
Logger.print(LogLevel.ERROR, t) { "$tag onMessageReceived() : " }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override fun onNewToken(token: String) {
|
|
48
|
+
try {
|
|
49
|
+
Logger.print { "$tag onNewToken(): $token" }
|
|
50
|
+
MoEFireBaseHelper.getInstance().passPushToken(applicationContext, token)
|
|
51
|
+
super.onNewToken(token)
|
|
52
|
+
} catch (t: Throwable) {
|
|
53
|
+
Logger.print(LogLevel.ERROR, t) { "$tag onNewToken(): " }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
package expo.modules.moengage
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import expo.modules.core.interfaces.ApplicationLifecycleListener
|
|
5
|
+
import com.moengage.core.internal.logger.Logger
|
|
6
|
+
import com.moengage.core.LogLevel
|
|
7
|
+
import expo.modules.moengage.internal.BASE_TAG
|
|
8
|
+
import expo.modules.moengage.internal.INTEGRATION_TYPE
|
|
9
|
+
import com.moengage.plugin.base.internal.PluginInitializer
|
|
10
|
+
import com.moengage.core.internal.model.IntegrationMeta
|
|
11
|
+
|
|
12
|
+
class MoEngageApplicationLifecycleListener() : ApplicationLifecycleListener {
|
|
13
|
+
|
|
14
|
+
private val tag = "${BASE_TAG}_MoEngageApplicationLifecycleListener"
|
|
15
|
+
|
|
16
|
+
override fun onCreate(application: Application) {
|
|
17
|
+
super.onCreate(application)
|
|
18
|
+
try {
|
|
19
|
+
Logger.print { "$tag onCreate(): Initialising MoEngage SDK" }
|
|
20
|
+
PluginInitializer.initialize(
|
|
21
|
+
application = application,
|
|
22
|
+
integrationMeta = IntegrationMeta(
|
|
23
|
+
INTEGRATION_TYPE,
|
|
24
|
+
BuildConfig.MOENGAGE_REACT_EXPO_LIB_VERSION
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
} catch (t: Throwable) {
|
|
28
|
+
Logger.print(LogLevel.ERROR, t) { "$tag onCreate(): " }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package expo.modules.moengage
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import expo.modules.core.interfaces.ApplicationLifecycleListener
|
|
5
|
+
import expo.modules.core.interfaces.Package
|
|
6
|
+
|
|
7
|
+
class MoEngagePackage : Package {
|
|
8
|
+
|
|
9
|
+
override fun createApplicationLifecycleListeners(context: Context): List<ApplicationLifecycleListener> {
|
|
10
|
+
return listOf(MoEngageApplicationLifecycleListener())
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import groovy.json.JsonSlurper
|
|
2
|
+
|
|
3
|
+
String libraryVersionName = "UNKNOWN"
|
|
4
|
+
File packageJson = new File(project.projectDir.parentFile, "package.json")
|
|
5
|
+
|
|
6
|
+
if (packageJson.exists()) {
|
|
7
|
+
def parsedJson = new JsonSlurper().parseText(packageJson.text)
|
|
8
|
+
libraryVersionName = parsedJson.version
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
android {
|
|
12
|
+
defaultConfig {
|
|
13
|
+
buildConfigField 'String', 'MOENGAGE_REACT_EXPO_LIB_VERSION', "\"${libraryVersionName}\""
|
|
14
|
+
}
|
|
15
|
+
}
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./build/index');
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import UIKit
|
|
3
|
+
import MoEngageSDK
|
|
4
|
+
import MoEngagePluginBase
|
|
5
|
+
import ReactNativeMoEngage
|
|
6
|
+
import ExpoModulesCore
|
|
7
|
+
import SystemConfiguration
|
|
8
|
+
|
|
9
|
+
// This class provides AppDelegate integration for MoEngage SDK
|
|
10
|
+
@objc(MoEngageAppDelegate)
|
|
11
|
+
public class MoEngageAppDelegate: ExpoAppDelegateSubscriber {
|
|
12
|
+
|
|
13
|
+
// Called when the application is launched
|
|
14
|
+
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
|
15
|
+
let config = MoEngageSDKDefaultInitializationConfig()
|
|
16
|
+
config.launchOptions = launchOptions
|
|
17
|
+
let plugin = MoEngagePlugin()
|
|
18
|
+
guard
|
|
19
|
+
let sdkConfig = plugin.initializeDefaultInstance(withAdditionalConfig: config)
|
|
20
|
+
else { return false }
|
|
21
|
+
plugin.trackPluginInfo(MoEngageExpoPluginInfo.name, version: MoEngageExpoPluginInfo.moduleVersion)
|
|
22
|
+
MoEngageInitializer.sharedInstance().setPluginBridgeDelegate(sdkConfig.appId)
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Handle URL opening
|
|
27
|
+
public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
|
|
28
|
+
MoEngageSDKAnalytics.sharedInstance.processURL(url)
|
|
29
|
+
return true
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Handle continuation of user activity with web browsing URL
|
|
33
|
+
public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
|
|
34
|
+
guard
|
|
35
|
+
userActivity.activityType == NSUserActivityTypeBrowsingWeb,
|
|
36
|
+
let incomingURL = userActivity.webpageURL,
|
|
37
|
+
let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true),
|
|
38
|
+
let path = components.path
|
|
39
|
+
else { return false }
|
|
40
|
+
|
|
41
|
+
MoEngageSDKAnalytics.sharedInstance.processURL(incomingURL)
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#if !os(tvOS)
|
|
46
|
+
// Handle remote notifications registration
|
|
47
|
+
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
48
|
+
MoEngageSDKMessaging.sharedInstance.setPushToken(deviceToken)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Handle remote notifications registration failure
|
|
52
|
+
public func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
|
53
|
+
MoEngageSDKMessaging.sharedInstance.didFailToRegisterForPush()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Handle incoming remote notifications
|
|
57
|
+
public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
|
58
|
+
MoEngageSDKMessaging.sharedInstance.didReceieveNotification(inApplication: application, withInfo: userInfo)
|
|
59
|
+
completionHandler(UIBackgroundFetchResult.noData)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Handle notification response
|
|
63
|
+
@available(iOS 10.0, *)
|
|
64
|
+
public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
|
|
65
|
+
MoEngageSDKMessaging.sharedInstance.userNotificationCenter(center, didReceive: response)
|
|
66
|
+
completionHandler()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Handle notification presentation
|
|
70
|
+
@available(iOS 10.0, *)
|
|
71
|
+
public func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
|
72
|
+
MoEngageSDKMessaging.sharedInstance.userNotificationCenter(center, willPresent: notification)
|
|
73
|
+
completionHandler([.alert, .sound])
|
|
74
|
+
}
|
|
75
|
+
#endif
|
|
76
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
package = JSON.parse(File.read(File.join(__dir__, '../package.json')))
|
|
3
|
+
|
|
4
|
+
Pod::Spec.new do |s|
|
|
5
|
+
s.name = 'ExpoAdapterMoEngage'
|
|
6
|
+
s.version = package['version']
|
|
7
|
+
s.summary = package['description']
|
|
8
|
+
s.description = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.author = package['author']
|
|
11
|
+
s.homepage = "https://www.moengage.com"
|
|
12
|
+
s.platforms = { :ios => "13.0", :tvos => "13.0" }
|
|
13
|
+
s.swift_version = '5.0'
|
|
14
|
+
s.source = { git: package['repository']['url'] }
|
|
15
|
+
s.static_framework = true
|
|
16
|
+
|
|
17
|
+
s.source_files = "ExpoAdapterMoEngage/**/*.{h,m,swift}"
|
|
18
|
+
|
|
19
|
+
s.dependency 'ExpoModulesCore'
|
|
20
|
+
s.dependency 'ReactNativeMoEngage'
|
|
21
|
+
|
|
22
|
+
# Swift/Objective-C compatibility
|
|
23
|
+
s.pod_target_xcconfig = {
|
|
24
|
+
'DEFINES_MODULE' => 'YES'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
version_file = "#{s.name}/MoEngageExpoPluginInfo+Version.swift"
|
|
28
|
+
s.prepare_command = <<-CMD
|
|
29
|
+
echo // Generated file, do not edit > #{version_file}
|
|
30
|
+
echo "import Foundation\n" >> #{version_file}
|
|
31
|
+
echo "extension MoEngageExpoPluginInfo {\n static let moduleVersion = \\"#{s.version}\\"\n}" >> #{version_file}
|
|
32
|
+
CMD
|
|
33
|
+
|
|
34
|
+
if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
|
|
35
|
+
s.source_files = "#{s.name}/**/*.h"
|
|
36
|
+
s.vendored_frameworks = "#{s.name}.xcframework"
|
|
37
|
+
else
|
|
38
|
+
s.source_files = "#{s.name}/**/*.{h,m,swift}"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="M4Y-Lb-cyx">
|
|
3
|
+
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
|
4
|
+
<dependencies>
|
|
5
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
|
|
6
|
+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
7
|
+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
8
|
+
</dependencies>
|
|
9
|
+
<scenes>
|
|
10
|
+
<!--Notification View Controller-->
|
|
11
|
+
<scene sceneID="cwh-vc-ff4">
|
|
12
|
+
<objects>
|
|
13
|
+
<viewController id="M4Y-Lb-cyx" userLabel="Notification View Controller" customClass="NotificationViewController" customModule="NotificationContent" customModuleProvider="target" sceneMemberID="viewController">
|
|
14
|
+
<view key="view" contentMode="scaleToFill" simulatedAppContext="notificationCenter" id="S3S-Oj-5AN">
|
|
15
|
+
<rect key="frame" x="0.0" y="0.0" width="320" height="37"/>
|
|
16
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
17
|
+
<viewLayoutGuide key="safeArea" id="2BE-c3-nQJ"/>
|
|
18
|
+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
19
|
+
</view>
|
|
20
|
+
<extendedEdge key="edgesForExtendedLayout"/>
|
|
21
|
+
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
|
22
|
+
<size key="freeformSize" width="320" height="37"/>
|
|
23
|
+
</viewController>
|
|
24
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="vXp-U4-Rya" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
25
|
+
</objects>
|
|
26
|
+
<point key="canvasLocation" x="79.710144927536234" y="70.647321428571431"/>
|
|
27
|
+
</scene>
|
|
28
|
+
</scenes>
|
|
29
|
+
</document>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
+
<key>CFBundleDisplayName</key>
|
|
8
|
+
<string>MoEngageExpoPushStories</string>
|
|
9
|
+
<key>CFBundleExecutable</key>
|
|
10
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
11
|
+
<key>CFBundleIdentifier</key>
|
|
12
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
13
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
14
|
+
<string>6.0</string>
|
|
15
|
+
<key>CFBundleName</key>
|
|
16
|
+
<string>$(PRODUCT_NAME)</string>
|
|
17
|
+
<key>CFBundlePackageType</key>
|
|
18
|
+
<string>XPC!</string>
|
|
19
|
+
<key>CFBundleShortVersionString</key>
|
|
20
|
+
<string>1.0.0</string>
|
|
21
|
+
<key>CFBundleVersion</key>
|
|
22
|
+
<string>1</string>
|
|
23
|
+
<key>NSExtension</key>
|
|
24
|
+
<dict>
|
|
25
|
+
<key>NSExtensionAttributes</key>
|
|
26
|
+
<dict>
|
|
27
|
+
<key>UNNotificationExtensionUserInteractionEnabled</key>
|
|
28
|
+
<true/>
|
|
29
|
+
<key>UNNotificationExtensionDefaultContentHidden</key>
|
|
30
|
+
<true/>
|
|
31
|
+
<key>UNNotificationExtensionCategory</key>
|
|
32
|
+
<array>
|
|
33
|
+
<string>MOE_PUSH_TEMPLATE</string>
|
|
34
|
+
<string>MOE_DISMISS_CATEGORY</string>
|
|
35
|
+
</array>
|
|
36
|
+
<key>UNNotificationExtensionInitialContentSizeRatio</key>
|
|
37
|
+
<real>2</real>
|
|
38
|
+
</dict>
|
|
39
|
+
<key>NSExtensionMainStoryboard</key>
|
|
40
|
+
<string>MainInterface</string>
|
|
41
|
+
<key>NSExtensionPointIdentifier</key>
|
|
42
|
+
<string>com.apple.usernotifications.content-extension</string>
|
|
43
|
+
</dict>
|
|
44
|
+
</dict>
|
|
45
|
+
</plist>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>com.apple.security.app-sandbox</key>
|
|
6
|
+
<true/>
|
|
7
|
+
<key>com.apple.security.network.client</key>
|
|
8
|
+
<true/>
|
|
9
|
+
<key>com.apple.security.application-groups</key>
|
|
10
|
+
<array>
|
|
11
|
+
<string>$(MOENGAGE_APP_GROUP)</string>
|
|
12
|
+
</array>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
import UserNotifications
|
|
3
|
+
import UserNotificationsUI
|
|
4
|
+
import MoEngageRichNotification
|
|
5
|
+
|
|
6
|
+
class NotificationViewController: UIViewController, UNNotificationContentExtension {
|
|
7
|
+
override func viewDidLoad() {
|
|
8
|
+
super.viewDidLoad()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
func didReceive(_ notification: UNNotification) {
|
|
12
|
+
MoEngageSDKRichNotification.addPushTemplate(toController: self, withNotification: notification)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
+
<key>CFBundleDisplayName</key>
|
|
8
|
+
<string>MoEngageExpoRichPush</string>
|
|
9
|
+
<key>CFBundleExecutable</key>
|
|
10
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
11
|
+
<key>CFBundleIdentifier</key>
|
|
12
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
13
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
14
|
+
<string>6.0</string>
|
|
15
|
+
<key>CFBundleName</key>
|
|
16
|
+
<string>$(PRODUCT_NAME)</string>
|
|
17
|
+
<key>CFBundlePackageType</key>
|
|
18
|
+
<string>XPC!</string>
|
|
19
|
+
<key>CFBundleShortVersionString</key>
|
|
20
|
+
<string>1.0.0</string>
|
|
21
|
+
<key>CFBundleVersion</key>
|
|
22
|
+
<string>1</string>
|
|
23
|
+
<key>NSExtension</key>
|
|
24
|
+
<dict>
|
|
25
|
+
<key>NSExtensionPointIdentifier</key>
|
|
26
|
+
<string>com.apple.usernotifications.service</string>
|
|
27
|
+
<key>NSExtensionPrincipalClass</key>
|
|
28
|
+
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
|
|
29
|
+
</dict>
|
|
30
|
+
</dict>
|
|
31
|
+
</plist>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>com.apple.security.app-sandbox</key>
|
|
6
|
+
<true/>
|
|
7
|
+
<key>com.apple.security.network.client</key>
|
|
8
|
+
<true/>
|
|
9
|
+
<key>com.apple.security.application-groups</key>
|
|
10
|
+
<array>
|
|
11
|
+
<string>$(MOENGAGE_APP_GROUP)</string>
|
|
12
|
+
</array>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import UserNotifications
|
|
2
|
+
import MoEngageRichNotification
|
|
3
|
+
import MoEngageMessaging
|
|
4
|
+
|
|
5
|
+
class NotificationService: UNNotificationServiceExtension {
|
|
6
|
+
var contentHandler: ((UNNotificationContent) -> Void)?
|
|
7
|
+
var bestAttemptContent: UNMutableNotificationContent?
|
|
8
|
+
|
|
9
|
+
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
|
10
|
+
self.contentHandler = contentHandler
|
|
11
|
+
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
|
|
12
|
+
MoEngageSDKRichNotification.handle(richNotificationRequest: request, withContentHandler: contentHandler)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override func serviceExtensionTimeWillExpire() {
|
|
16
|
+
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
|
|
17
|
+
contentHandler(bestAttemptContent)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.googleFirebaseMessagingModule = exports.googleFirebaseMessagingGroup = exports.xmlValuesResourcePath = exports.drawableResourcePath = exports.moEngageExpoNotificationServiceEntry = exports.moEngageExpoNotificationServiceName = exports.moEngageFCMServiceEntry = exports.moEngageFCMServiceName = exports.moEngageMessagingIntentFilter = exports.manifestApplicationKeys = void 0;
|
|
4
|
+
exports.manifestApplicationKeys = [
|
|
5
|
+
{ "android:fullBackupContent": "@xml/com_moengage_backup_descriptor" },
|
|
6
|
+
{ "android:dataExtractionRules": "@xml/com_moengage_data_extraction_rules" }
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* Common intent-filter for MoEngage FCM/Expo Notification services
|
|
10
|
+
*/
|
|
11
|
+
exports.moEngageMessagingIntentFilter = [
|
|
12
|
+
{
|
|
13
|
+
action: [
|
|
14
|
+
{
|
|
15
|
+
$: {
|
|
16
|
+
'android:name': 'com.google.firebase.MESSAGING_EVENT',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Service entry for MoEngage Push Notification handling with fcm integration
|
|
24
|
+
*/
|
|
25
|
+
exports.moEngageFCMServiceName = 'com.moengage.firebase.MoEFireBaseMessagingService';
|
|
26
|
+
exports.moEngageFCMServiceEntry = {
|
|
27
|
+
$: {
|
|
28
|
+
'android:name': exports.moEngageFCMServiceName,
|
|
29
|
+
'android:exported': 'false',
|
|
30
|
+
},
|
|
31
|
+
'intent-filter': exports.moEngageMessagingIntentFilter,
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Service entry for MoEngage Push Notification handling with expo notification integration
|
|
35
|
+
*/
|
|
36
|
+
exports.moEngageExpoNotificationServiceName = 'expo.modules.moengage.MoEExpoFireBaseMessagingService';
|
|
37
|
+
exports.moEngageExpoNotificationServiceEntry = {
|
|
38
|
+
$: {
|
|
39
|
+
'android:name': exports.moEngageExpoNotificationServiceName,
|
|
40
|
+
'android:exported': 'false',
|
|
41
|
+
},
|
|
42
|
+
'intent-filter': exports.moEngageMessagingIntentFilter,
|
|
43
|
+
};
|
|
44
|
+
exports.drawableResourcePath = './android/app/src/main/res/drawable';
|
|
45
|
+
exports.xmlValuesResourcePath = './android/app/src/main/res/values';
|
|
46
|
+
exports.googleFirebaseMessagingGroup = 'com.google.firebase';
|
|
47
|
+
exports.googleFirebaseMessagingModule = 'firebase-messaging';
|