rho-tau-extensions 6.2.0 → 7.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/libs/crosswalk/ext/platform/android/Rakefile +19 -1
- data/libs/enterprise-barcode/ext/platform/android/adds/lib/aarch64/liballbarcode.a +0 -0
- data/libs/enterprise-barcode/ext/platform/android/adds/lib/armeabi/liballbarcode.a +0 -0
- data/libs/enterprise-barcode/ext/platform/android/adds/lib/x86/liballbarcode.a +0 -0
- data/libs/enterprise-barcode/ext/platform/android/allbarcode.jar +0 -0
- data/libs/fcm-push-18/ext.yml +20 -0
- data/libs/fcm-push-18/ext/android/AndroidManifest.rb +10 -0
- data/libs/fcm-push-18/ext/android/ApplicationManifestAdds.erb +39 -0
- data/libs/fcm-push-18/ext/android/Rakefile +187 -0
- data/libs/fcm-push-18/ext/android/ext_java.files +3 -0
- data/libs/fcm-push-18/ext/android/ext_native.files +1 -0
- data/libs/fcm-push-18/ext/android/jni/src/fcmpushclient.cpp +215 -0
- data/libs/fcm-push-18/ext/android/jni/src/fcmpushclient.h +74 -0
- data/libs/fcm-push-18/ext/android/res/res/values/fireBaseValues.xml +5 -0
- data/libs/fcm-push-18/ext/android/src/com/rhomobile/rhodes/fcm/FCMFacade.java +164 -0
- data/libs/fcm-push-18/ext/android/src/com/rhomobile/rhodes/fcm/FCMIntentService.java +219 -0
- data/libs/fcm-push-18/ext/android/src/com/rhomobile/rhodes/fcm/FCMListener.java +88 -0
- data/libs/fcm-push-18/ext/build +16 -0
- data/libs/fcm-push-18/ext/build.bat +8 -0
- data/libs/fcm-push-18/ext/fcm.xml +9 -0
- data/libs/fcm-push-18/ext/iphone/ApplePush_Prefix.pch +7 -0
- data/libs/fcm-push-18/ext/iphone/Firebase.h +68 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/FirebaseAnalytics +0 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h +62 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h +115 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h +1 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsSwiftNameSupport.h +13 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h +1 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h +1 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h +389 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h +1 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h +485 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h +15 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h +10 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap +10 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/FirebaseCore +0 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h +52 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIRApp.h +130 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIRConfiguration.h +78 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h +35 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIROptions.h +133 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FirebaseCore.h +5 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Modules/module.modulemap +7 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics +0 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap +6 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseInstanceID.framework/FirebaseInstanceID +0 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h +276 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h +1 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap +7 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseMessaging.framework/FirebaseMessaging +0 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseMessaging.framework/Headers/FIRMessaging.h +508 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging.h +1 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseMessaging.framework/Modules/module.modulemap +8 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseNanoPB.framework/FirebaseNanoPB +0 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/GoogleToolboxForMac.framework/GoogleToolboxForMac +0 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/GoogleToolboxForMac.framework/Modules/module.modulemap +5 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/Protobuf.framework/Modules/module.modulemap +5 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/Protobuf.framework/Protobuf +0 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/nanopb.framework/Modules/module.modulemap +5 -0
- data/libs/fcm-push-18/ext/iphone/Frameworks/nanopb.framework/nanopb +0 -0
- data/libs/fcm-push-18/ext/iphone/Rakefile +81 -0
- data/libs/fcm-push-18/ext/iphone/fcm-push.xcodeproj/project.pbxproj +370 -0
- data/libs/fcm-push-18/ext/iphone/impl/PushNotificationsReceiver.h +28 -0
- data/libs/fcm-push-18/ext/iphone/impl/PushNotificationsReceiver.m +27 -0
- data/libs/fcm-push-18/ext/iphone/impl/PushNotificationsReceiver.mm +234 -0
- data/libs/fcm-push-18/ext/iphone/impl/applePushSetup.c +10 -0
- data/libs/fcm-push-18/ext/iphone/impl/applepushclient.h +69 -0
- data/libs/fcm-push-18/ext/iphone/impl/applepushclient.mm +164 -0
- data/libs/fcm-push-18/ext/iphone/impl/readme.txt +7 -0
- data/libs/fcm-push-18/ext/platform/iphone/impl/readme.txt +7 -0
- data/libs/nodejs/ext/platform/android/jxCore/jx.h +17 -1
- data/libs/nodejs/ext/platform/android/jxCore/libcares_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libcares_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libcares_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libjx_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libjx_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libjx_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libopenssl_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libopenssl_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libopenssl_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libuv_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libuv_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libuv_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_base_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_base_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_base_x64.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_arm.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_ia32.a +0 -0
- data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_x64.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/jx.h +17 -1
- data/libs/nodejs/ext/platform/iphone/jxCore/libcares.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libchrome_zlib.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libhttp_parser.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libjx.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libmozjs.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libopenssl.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libsqlite3.a +0 -0
- data/libs/nodejs/ext/platform/iphone/jxCore/libuv.a +0 -0
- data/libs/rexml-edge/rexml/attlistdecl.rb +63 -0
- data/libs/rexml-edge/rexml/attribute.rb +192 -0
- data/libs/rexml-edge/rexml/cdata.rb +68 -0
- data/libs/rexml-edge/rexml/child.rb +97 -0
- data/libs/rexml-edge/rexml/comment.rb +80 -0
- data/libs/rexml-edge/rexml/doctype.rb +270 -0
- data/libs/rexml-edge/rexml/document.rb +291 -0
- data/libs/rexml-edge/rexml/dtd/attlistdecl.rb +11 -0
- data/libs/rexml-edge/rexml/dtd/dtd.rb +47 -0
- data/libs/rexml-edge/rexml/dtd/elementdecl.rb +18 -0
- data/libs/rexml-edge/rexml/dtd/entitydecl.rb +57 -0
- data/libs/rexml-edge/rexml/dtd/notationdecl.rb +40 -0
- data/libs/rexml-edge/rexml/element.rb +1241 -0
- data/libs/rexml-edge/rexml/encoding.rb +51 -0
- data/libs/rexml-edge/rexml/entity.rb +174 -0
- data/libs/rexml-edge/rexml/formatters/default.rb +112 -0
- data/libs/rexml-edge/rexml/formatters/pretty.rb +142 -0
- data/libs/rexml-edge/rexml/formatters/transitive.rb +58 -0
- data/libs/rexml-edge/rexml/functions.rb +418 -0
- data/libs/rexml-edge/rexml/instruction.rb +71 -0
- data/libs/rexml-edge/rexml/light/node.rb +196 -0
- data/libs/rexml-edge/rexml/namespace.rb +48 -0
- data/libs/rexml-edge/rexml/node.rb +76 -0
- data/libs/rexml-edge/rexml/output.rb +30 -0
- data/libs/rexml-edge/rexml/parent.rb +166 -0
- data/libs/rexml-edge/rexml/parseexception.rb +52 -0
- data/libs/rexml-edge/rexml/parsers/baseparser.rb +533 -0
- data/libs/rexml-edge/rexml/parsers/lightparser.rb +59 -0
- data/libs/rexml-edge/rexml/parsers/pullparser.rb +197 -0
- data/libs/rexml-edge/rexml/parsers/sax2parser.rb +273 -0
- data/libs/rexml-edge/rexml/parsers/streamparser.rb +61 -0
- data/libs/rexml-edge/rexml/parsers/treeparser.rb +101 -0
- data/libs/rexml-edge/rexml/parsers/ultralightparser.rb +57 -0
- data/libs/rexml-edge/rexml/parsers/xpathparser.rb +657 -0
- data/libs/rexml-edge/rexml/quickpath.rb +266 -0
- data/libs/rexml-edge/rexml/rexml.rb +32 -0
- data/libs/rexml-edge/rexml/sax2listener.rb +98 -0
- data/libs/rexml-edge/rexml/security.rb +28 -0
- data/libs/rexml-edge/rexml/source.rb +297 -0
- data/libs/rexml-edge/rexml/streamlistener.rb +93 -0
- data/libs/rexml-edge/rexml/syncenumerator.rb +33 -0
- data/libs/rexml-edge/rexml/text.rb +426 -0
- data/libs/rexml-edge/rexml/undefinednamespaceexception.rb +9 -0
- data/libs/rexml-edge/rexml/validation/relaxng.rb +539 -0
- data/libs/rexml-edge/rexml/validation/validation.rb +144 -0
- data/libs/rexml-edge/rexml/validation/validationexception.rb +10 -0
- data/libs/rexml-edge/rexml/xmldecl.rb +116 -0
- data/libs/rexml-edge/rexml/xmltokens.rb +85 -0
- data/libs/rexml-edge/rexml/xpath.rb +81 -0
- data/libs/rexml-edge/rexml/xpath_parser.rb +704 -0
- data/version +1 -1
- metadata +118 -2
@@ -0,0 +1,28 @@
|
|
1
|
+
//
|
2
|
+
// PushNotificationsListener.h
|
3
|
+
// fcm-push
|
4
|
+
//
|
5
|
+
// Created by Alexei Shishkin on 21.03.18.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
#import "IPushNotificationsReceiver.h"
|
11
|
+
#import "Firebase.h"
|
12
|
+
|
13
|
+
@interface PushNotificationsReceiver : NSObject<IPushNotificationsReceiver, FIRMessagingDelegate>
|
14
|
+
{
|
15
|
+
BOOL isDirectMessage;
|
16
|
+
}
|
17
|
+
|
18
|
+
+ (id<IPushNotificationsReceiver>)sharedInstance;
|
19
|
+
|
20
|
+
- (void) onPushRegistrationSucceed:(NSData *)deviceToken;
|
21
|
+
- (void) onPushRegistrationFailed:(NSError *)error;
|
22
|
+
- (void) onPushMessageReceived:(NSDictionary *)userInfo;
|
23
|
+
- (void) messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken;
|
24
|
+
- (void) messaging:(FIRMessaging *)messaging didReceiveMessage:(FIRMessagingRemoteMessage *)remoteMessage;
|
25
|
+
//- (void) messaging:(FIRMessaging *)messaging didRefreshRegistrationToken:(NSString *)fcmToken;
|
26
|
+
@end
|
27
|
+
|
28
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//
|
2
|
+
// PushNotificationsListener.m
|
3
|
+
// ApplePush
|
4
|
+
//
|
5
|
+
// Created by Alex Epifanoff on 01.07.13.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "PushNotificationsReceiver.h"
|
10
|
+
|
11
|
+
@implementation PushNotificationsReceiverBase
|
12
|
+
|
13
|
+
- (void)messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken {
|
14
|
+
NSLog(@"FCM registration token: %@", fcmToken);
|
15
|
+
}
|
16
|
+
|
17
|
+
- (void)messaging:(FIRMessaging *)messaging didReceiveMessage:(FIRMessagingRemoteMessage *)remoteMessage {
|
18
|
+
NSLog(@"FCM Received data message: %@", remoteMessage.appData);
|
19
|
+
}
|
20
|
+
|
21
|
+
- (void)messaging:(FIRMessaging *)messaging didRefreshRegistrationToken:(NSString *)fcmToken {
|
22
|
+
NSLog(@"FCM refresh token: %@", fcmToken);
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
@end
|
27
|
+
|
@@ -0,0 +1,234 @@
|
|
1
|
+
//
|
2
|
+
// PushNotificationsListener.m
|
3
|
+
// fcm-push
|
4
|
+
//
|
5
|
+
// Created by Alexei Shishkin on 21.03.18.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "PushNotificationsReceiver.h"
|
10
|
+
#include "Push.h"
|
11
|
+
#import "Rhodes.h"
|
12
|
+
|
13
|
+
@implementation PushNotificationsReceiver
|
14
|
+
|
15
|
+
static PushNotificationsReceiver *instance = nil;
|
16
|
+
|
17
|
+
+ (id<IPushNotificationsReceiver>)sharedInstance {
|
18
|
+
|
19
|
+
if (instance == nil) {
|
20
|
+
instance = [[PushNotificationsReceiver alloc] init];
|
21
|
+
}
|
22
|
+
|
23
|
+
instance->isDirectMessage = false;
|
24
|
+
|
25
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
26
|
+
[FIRApp configure];
|
27
|
+
[FIRMessaging messaging].delegate = instance;
|
28
|
+
[FIRMessaging messaging].shouldEstablishDirectChannel = true;
|
29
|
+
});
|
30
|
+
|
31
|
+
return instance;
|
32
|
+
}
|
33
|
+
|
34
|
+
|
35
|
+
- (void) onPushRegistrationSucceed:(NSData *)deviceToken
|
36
|
+
{
|
37
|
+
NSLog(@"Apple device token is %@", deviceToken);
|
38
|
+
|
39
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
40
|
+
[FIRMessaging messaging].APNSToken = deviceToken;
|
41
|
+
});
|
42
|
+
}
|
43
|
+
|
44
|
+
- (void)messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken {
|
45
|
+
NSLog(@"FCM registration token: %@", fcmToken);
|
46
|
+
|
47
|
+
char* szpin = strdup([fcmToken cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
48
|
+
RAWLOG_INFO1("device fcm pin: %s\n", szpin);
|
49
|
+
rho::push::CPushManager::getInstance()->setDeviceId("fcm",szpin);
|
50
|
+
|
51
|
+
free(szpin);
|
52
|
+
}
|
53
|
+
|
54
|
+
- (void)messaging:(FIRMessaging *)messaging didReceiveMessage:(FIRMessagingRemoteMessage *)remoteMessage {
|
55
|
+
isDirectMessage = true;
|
56
|
+
NSLog(@"FCM Received direct message: %@", remoteMessage.appData);
|
57
|
+
[self onPushMessageReceived:remoteMessage.appData];
|
58
|
+
}
|
59
|
+
|
60
|
+
//- (void)messaging:(FIRMessaging *)messaging didRefreshRegistrationToken:(NSString *)fcmToken {
|
61
|
+
// NSLog(@"FCM refresh token: %@", fcmToken);
|
62
|
+
//}
|
63
|
+
|
64
|
+
- (void) onPushRegistrationFailed:(NSError *)error
|
65
|
+
{
|
66
|
+
NSLog(@"Push Notification Error: %@", [error localizedDescription]);
|
67
|
+
}
|
68
|
+
|
69
|
+
+ (NSDictionary*)ansMessageToRhodesMessage:(NSDictionary*)dict
|
70
|
+
{
|
71
|
+
NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
72
|
+
|
73
|
+
NSArray *keys = [dict allKeys];
|
74
|
+
|
75
|
+
for ( id key in keys ) {
|
76
|
+
if (![key isKindOfClass:[NSString class]]) {
|
77
|
+
NSLog(@"Non-string key type in push payload");
|
78
|
+
continue;
|
79
|
+
}
|
80
|
+
|
81
|
+
NSString* sKey = (NSString*) key;
|
82
|
+
id val = [dict objectForKey:key];
|
83
|
+
|
84
|
+
if ( [sKey isEqualToString:@"aps"] && [val isKindOfClass:[NSDictionary class]] ) {
|
85
|
+
[ret addEntriesFromDictionary:val];
|
86
|
+
} else {
|
87
|
+
[ret setValue:val forKey:sKey];
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
return ret;
|
92
|
+
}
|
93
|
+
|
94
|
+
+ (NSDictionary*)FormalizeMessage:(NSDictionary*)dict
|
95
|
+
{
|
96
|
+
NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
97
|
+
NSMutableDictionary* data = [[NSMutableDictionary alloc] init];
|
98
|
+
|
99
|
+
[dict enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL* stop) {
|
100
|
+
if([(NSString*)key isEqualToString:@"gcm.message_id"])
|
101
|
+
{
|
102
|
+
[ret setObject:value forKey:@"id"];
|
103
|
+
}
|
104
|
+
else if([(NSString*)key isEqualToString:@"from"])
|
105
|
+
{
|
106
|
+
[ret setObject:value forKey:@"from"];
|
107
|
+
}
|
108
|
+
else if([(NSString*)key isEqualToString:@"notification"])
|
109
|
+
{
|
110
|
+
NSDictionary* notification = value;
|
111
|
+
if([notification isKindOfClass:[NSDictionary class]])
|
112
|
+
{
|
113
|
+
if (id body = notification[@"body"])
|
114
|
+
[ret setObject:body forKey:@"body"];
|
115
|
+
if(id title = notification[@"title"])
|
116
|
+
[ret setObject:title forKey:@"title"];
|
117
|
+
}
|
118
|
+
}
|
119
|
+
else if([(NSString*)key isEqualToString:@"aps"])
|
120
|
+
{
|
121
|
+
if([value isKindOfClass:[NSDictionary class]])
|
122
|
+
{
|
123
|
+
NSDictionary* aps = value;
|
124
|
+
if(id alert = aps[@"alert"])
|
125
|
+
{
|
126
|
+
if([alert isKindOfClass:[NSDictionary class]])
|
127
|
+
{
|
128
|
+
if (id body = alert[@"body"])
|
129
|
+
[ret setObject:body forKey:@"body"];
|
130
|
+
if(id title = alert[@"title"])
|
131
|
+
[ret setObject:title forKey:@"title"];
|
132
|
+
}
|
133
|
+
else if([alert isKindOfClass:[NSString class]])
|
134
|
+
{
|
135
|
+
[ret setObject:alert forKey:@"body"];
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
else
|
141
|
+
{
|
142
|
+
[data setObject:value forKey:key];
|
143
|
+
}
|
144
|
+
|
145
|
+
}];
|
146
|
+
|
147
|
+
NSDictionary* data_copy = [[data copy] autorelease];
|
148
|
+
[ret setObject:data_copy forKey:@"data"];
|
149
|
+
|
150
|
+
[data dealloc];
|
151
|
+
|
152
|
+
return ret;
|
153
|
+
}
|
154
|
+
|
155
|
+
+ (NSMutableString*) dictToJSON:(NSDictionary*)dict context:(NSMutableString*)context
|
156
|
+
{
|
157
|
+
if (nil == context) {
|
158
|
+
context = [[NSMutableString alloc] init];
|
159
|
+
}
|
160
|
+
|
161
|
+
[context appendString:@"{"];
|
162
|
+
|
163
|
+
NSArray *keys = [dict allKeys];
|
164
|
+
|
165
|
+
for ( int i = 0; i < [keys count]; ++ i ) {
|
166
|
+
id k = keys[i];
|
167
|
+
|
168
|
+
if (![k isKindOfClass:[NSString class]]) {
|
169
|
+
NSLog(@"Non-string key type in push payload");
|
170
|
+
continue;
|
171
|
+
}
|
172
|
+
|
173
|
+
[context appendFormat:@"\"%@\":",(NSString*)k];
|
174
|
+
|
175
|
+
id val = [dict objectForKey:k];
|
176
|
+
|
177
|
+
if ([val isKindOfClass:[NSString class]]) {
|
178
|
+
[context appendFormat:@"\"%@\"",(NSString*)val];
|
179
|
+
|
180
|
+
} else if ([val isKindOfClass:[NSNumber class]]) {
|
181
|
+
[context appendFormat:@"\"%@\"",[(NSNumber*)val stringValue]];
|
182
|
+
} else if ([val isKindOfClass:[NSDictionary class]]) {
|
183
|
+
NSMutableString* json = [[NSMutableString alloc] init];
|
184
|
+
[PushNotificationsReceiver dictToJSON:(NSDictionary*)val context:json];
|
185
|
+
[context appendString:json];
|
186
|
+
[json dealloc];
|
187
|
+
} else if ([val isKindOfClass:[NSArray class]]) {
|
188
|
+
|
189
|
+
[context appendString:@"\""];
|
190
|
+
//will only support String values in array
|
191
|
+
NSArray* vals = (NSArray*)val;
|
192
|
+
for ( int j = 0; j < ([vals count]); ++j ) {
|
193
|
+
id v = vals[j];
|
194
|
+
if ([v isKindOfClass:[NSString class]]) {
|
195
|
+
[context appendFormat:@"%@",(NSString*)v];
|
196
|
+
|
197
|
+
if ( j < ([vals count]-1) ) {
|
198
|
+
[context appendString:@","];
|
199
|
+
}
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
[context appendString:@"\""];
|
204
|
+
|
205
|
+
} else {
|
206
|
+
[context appendString:@"\"\""];
|
207
|
+
}
|
208
|
+
|
209
|
+
if ( i < ([keys count]-1) ) {
|
210
|
+
[context appendString:@","];
|
211
|
+
}
|
212
|
+
}
|
213
|
+
|
214
|
+
[context appendString:@"}"];
|
215
|
+
|
216
|
+
return context;
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
- (void) onPushMessageReceived:(NSDictionary *)userInfo
|
221
|
+
{
|
222
|
+
[[FIRMessaging messaging] appDidReceiveMessage:userInfo];
|
223
|
+
NSMutableString* json = [[NSMutableString alloc] init];
|
224
|
+
|
225
|
+
NSDictionary* processedMessage = [PushNotificationsReceiver FormalizeMessage:userInfo];
|
226
|
+
json = [PushNotificationsReceiver dictToJSON:processedMessage context:json];
|
227
|
+
|
228
|
+
rho::push::CPushManager::getInstance()->callBack("fcm", [json UTF8String]);
|
229
|
+
|
230
|
+
[processedMessage dealloc];
|
231
|
+
[json dealloc];
|
232
|
+
}
|
233
|
+
|
234
|
+
@end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*------------------------------------------------------------------------
|
2
|
+
* (The MIT License)
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008-2012 Rhomobile, Inc.
|
5
|
+
*
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
11
|
+
* furnished to do so, subject to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
14
|
+
* all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
* THE SOFTWARE.
|
23
|
+
*
|
24
|
+
* http://rhomobile.com
|
25
|
+
*------------------------------------------------------------------------*/
|
26
|
+
|
27
|
+
#pragma once
|
28
|
+
#include "Push.h"
|
29
|
+
|
30
|
+
#include "logging/RhoLog.h"
|
31
|
+
#include "common/RhoStd.h"
|
32
|
+
|
33
|
+
|
34
|
+
namespace rho {
|
35
|
+
|
36
|
+
namespace apple {
|
37
|
+
|
38
|
+
using namespace rho::common;
|
39
|
+
|
40
|
+
class ApplePushClient: public push::CPushClient
|
41
|
+
{
|
42
|
+
class SyncLoginListener;
|
43
|
+
private:
|
44
|
+
CMethodResult m_oResult;
|
45
|
+
CMethodResult m_deviceIdResult;
|
46
|
+
bool m_CallbackIsValid;
|
47
|
+
bool m_HasSavedMessage;
|
48
|
+
String m_SavedMessage;
|
49
|
+
static const String s_Type;
|
50
|
+
|
51
|
+
public:
|
52
|
+
DEFINE_LOGCLASS;
|
53
|
+
|
54
|
+
ApplePushClient();
|
55
|
+
virtual ~ApplePushClient() {}
|
56
|
+
|
57
|
+
virtual const String& getId() const { return s_Type; }
|
58
|
+
virtual void setDeviceId(const String& deviceId);
|
59
|
+
virtual void getDeviceId(CMethodResult& result);
|
60
|
+
virtual void startNotifications(CMethodResult& result);
|
61
|
+
virtual void stopNotifications(CMethodResult& result);
|
62
|
+
virtual bool callBack(const String& json);
|
63
|
+
|
64
|
+
void doRegister();
|
65
|
+
void doUnregister();
|
66
|
+
};
|
67
|
+
|
68
|
+
|
69
|
+
}}
|
@@ -0,0 +1,164 @@
|
|
1
|
+
/*------------------------------------------------------------------------
|
2
|
+
* (The MIT License)
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008-2012 Rhomobile, Inc.
|
5
|
+
*
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
11
|
+
* furnished to do so, subject to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
14
|
+
* all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
* THE SOFTWARE.
|
23
|
+
*
|
24
|
+
* http://rhomobile.com
|
25
|
+
*------------------------------------------------------------------------*/
|
26
|
+
|
27
|
+
#import "Firebase.h"
|
28
|
+
#include "common/RhoConf.h"
|
29
|
+
#include "Push.h"
|
30
|
+
#include "sync/RhoconnectClientManager.h"
|
31
|
+
#include "sync/ILoginListener.h"
|
32
|
+
#import "Rhodes.h"
|
33
|
+
#import "PushNotificationsReceiver.h"
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
#include "logging/RhoLog.h"
|
38
|
+
|
39
|
+
#include "applepushclient.h"
|
40
|
+
|
41
|
+
|
42
|
+
extern "C" void Init_FCMPushClient();
|
43
|
+
|
44
|
+
//----------------------------------------------------------------------------------------------------------------------
|
45
|
+
void Init_FCMPushClient()
|
46
|
+
{
|
47
|
+
RAWTRACEC("Init_FCMPushClient", "creating Apple client >>>>>>>>>>>>>>");
|
48
|
+
|
49
|
+
rho::apple::ApplePushClient* pClient = new rho::apple::ApplePushClient();
|
50
|
+
|
51
|
+
RAWTRACEC("Init_FCMPushClient", "adding Apple client >>>>>>>>>>>>>>>>");
|
52
|
+
|
53
|
+
rho::push::CPushManager::getInstance()->addClient(pClient);
|
54
|
+
|
55
|
+
LOG(TRACE) + "request APNS registration >>>>>>>>>>>>>>>>";
|
56
|
+
pClient->doRegister();
|
57
|
+
}
|
58
|
+
//----------------------------------------------------------------------------------------------------------------------
|
59
|
+
|
60
|
+
namespace rho {
|
61
|
+
|
62
|
+
namespace apple {
|
63
|
+
|
64
|
+
IMPLEMENT_LOGCLASS(ApplePushClient, "ApplePushClient");
|
65
|
+
|
66
|
+
void ApplePushClient::doRegister()
|
67
|
+
{
|
68
|
+
LOG(TRACE) + "ApplePushRegister()";
|
69
|
+
[[Rhodes sharedInstance] registerForPushNotifications: [PushNotificationsReceiver sharedInstance] ];
|
70
|
+
}
|
71
|
+
|
72
|
+
|
73
|
+
void ApplePushClient::doUnregister()
|
74
|
+
{
|
75
|
+
LOG(TRACE) + "ApplePushUnregister()";
|
76
|
+
|
77
|
+
}
|
78
|
+
//----------------------------------------------------------------------------------------------------------------------
|
79
|
+
const String ApplePushClient::s_Type = "fcm";
|
80
|
+
|
81
|
+
ApplePushClient::ApplePushClient()
|
82
|
+
{
|
83
|
+
m_CallbackIsValid = false;
|
84
|
+
m_HasSavedMessage = false;
|
85
|
+
m_SavedMessage = "";
|
86
|
+
CMethodResult result;
|
87
|
+
setProperty("id", s_Type, result);
|
88
|
+
setProperty("type", IPush::PUSH_TYPE_NATIVE, result);
|
89
|
+
}
|
90
|
+
|
91
|
+
//----------------------------------------------------------------------------------------------------------------------
|
92
|
+
|
93
|
+
void ApplePushClient::getDeviceId(CMethodResult& result)
|
94
|
+
{
|
95
|
+
String deviceId = m_hashProps["deviceId"];
|
96
|
+
|
97
|
+
if(deviceId.length() != 0)
|
98
|
+
{
|
99
|
+
LOG(TRACE) + "APNS deviceId: " + deviceId;
|
100
|
+
result.set(deviceId);
|
101
|
+
}
|
102
|
+
else
|
103
|
+
{
|
104
|
+
LOG(TRACE) + "Still waiting for APNS deviceId";
|
105
|
+
m_deviceIdResult = result;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
//----------------------------------------------------------------------------------------------------------------------
|
110
|
+
void ApplePushClient::startNotifications(CMethodResult& result)
|
111
|
+
{
|
112
|
+
LOG(TRACE) + "Start APNS push notifications";
|
113
|
+
m_oResult = result;
|
114
|
+
m_CallbackIsValid = true;
|
115
|
+
if (m_HasSavedMessage) {
|
116
|
+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
117
|
+
m_oResult.setJSON(m_SavedMessage);
|
118
|
+
m_SavedMessage = "";
|
119
|
+
});
|
120
|
+
}
|
121
|
+
m_HasSavedMessage = false;
|
122
|
+
}
|
123
|
+
|
124
|
+
//----------------------------------------------------------------------------------------------------------------------
|
125
|
+
void ApplePushClient::stopNotifications(CMethodResult& result)
|
126
|
+
{
|
127
|
+
LOG(TRACE) + "Stop APNS push notifications";
|
128
|
+
m_oResult = CMethodResult();
|
129
|
+
m_CallbackIsValid = false;
|
130
|
+
m_HasSavedMessage = false;
|
131
|
+
m_SavedMessage = "";
|
132
|
+
}
|
133
|
+
|
134
|
+
//----------------------------------------------------------------------------------------------------------------------
|
135
|
+
void ApplePushClient::setDeviceId(const String& deviceId)
|
136
|
+
{
|
137
|
+
CMethodResult result;
|
138
|
+
setProperty("deviceId", deviceId, result);
|
139
|
+
|
140
|
+
LOG(TRACE) + "creating client register";
|
141
|
+
rho::sync::RhoconnectClientManager::clientRegisterCreate(deviceId.c_str());
|
142
|
+
|
143
|
+
getDeviceId(m_deviceIdResult);
|
144
|
+
m_deviceIdResult = CMethodResult();
|
145
|
+
|
146
|
+
}
|
147
|
+
|
148
|
+
//----------------------------------------------------------------------------------------------------------------------
|
149
|
+
bool ApplePushClient::callBack(const String& json)
|
150
|
+
{
|
151
|
+
LOG(TRACE) + "APNS push notification: " + json;
|
152
|
+
|
153
|
+
if (m_CallbackIsValid) {
|
154
|
+
m_oResult.setJSON(json);
|
155
|
+
}
|
156
|
+
else {
|
157
|
+
m_SavedMessage = json;
|
158
|
+
m_HasSavedMessage = true;
|
159
|
+
}
|
160
|
+
return true;
|
161
|
+
}
|
162
|
+
|
163
|
+
}}
|
164
|
+
|