Skip to content

Commit 64b48d1

Browse files
committed
reconsitution iOS plugin
1 parent d418841 commit 64b48d1

File tree

6 files changed

+648
-1165
lines changed

6 files changed

+648
-1165
lines changed

example/app/routes/Launch/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const {
2121
componentWillMount() {
2222
const { navigate } = this.props.navigation;
2323
var params = {
24-
'appkey': "4f7aef34fb361292c566a1cd",
24+
'appkey': "a1703c14b186a68a66ef86c1",
2525
'isOpenMessageRoaming': false,
2626
'isProduction': false,
2727
'channel': ""

example/ios/JMessageDemo.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,7 @@
12851285
"-framework",
12861286
"\"JMessage\"",
12871287
);
1288+
PRODUCT_BUNDLE_IDENTIFIER = com.example.huminios.jpushTest;
12881289
PRODUCT_NAME = JMessageDemo;
12891290
VERSIONING_SYSTEM = "apple-generic";
12901291
};
@@ -1318,6 +1319,7 @@
13181319
"-framework",
13191320
"\"JMessage\"",
13201321
);
1322+
PRODUCT_BUNDLE_IDENTIFIER = com.example.huminios.jpushTest;
13211323
PRODUCT_NAME = JMessageDemo;
13221324
VERSIONING_SYSTEM = "apple-generic";
13231325
};

example/ios/JMessageDemo/Info.plist

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>NSMicrophoneUsageDescription</key>
6-
<string></string>
7-
<key>NSCameraUsageDescription</key>
8-
<string></string>
9-
<key>NSPhotoLibraryUsageDescription</key>
10-
<string></string>
115
<key>CFBundleDevelopmentRegion</key>
126
<string>en</string>
137
<key>CFBundleDisplayName</key>
148
<string>JMessageDemo</string>
159
<key>CFBundleExecutable</key>
1610
<string>$(EXECUTABLE_NAME)</string>
1711
<key>CFBundleIdentifier</key>
18-
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
12+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1913
<key>CFBundleInfoDictionaryVersion</key>
2014
<string>6.0</string>
2115
<key>CFBundleName</key>
@@ -30,6 +24,25 @@
3024
<string>1</string>
3125
<key>LSRequiresIPhoneOS</key>
3226
<true/>
27+
<key>NSAppTransportSecurity</key>
28+
<dict>
29+
<key>NSExceptionDomains</key>
30+
<dict>
31+
<key>localhost</key>
32+
<dict>
33+
<key>NSExceptionAllowsInsecureHTTPLoads</key>
34+
<true/>
35+
</dict>
36+
</dict>
37+
</dict>
38+
<key>NSCameraUsageDescription</key>
39+
<string></string>
40+
<key>NSLocationWhenInUseUsageDescription</key>
41+
<string></string>
42+
<key>NSMicrophoneUsageDescription</key>
43+
<string></string>
44+
<key>NSPhotoLibraryUsageDescription</key>
45+
<string></string>
3346
<key>UILaunchStoryboardName</key>
3447
<string>LaunchScreen</string>
3548
<key>UIRequiredDeviceCapabilities</key>
@@ -44,18 +57,5 @@
4457
</array>
4558
<key>UIViewControllerBasedStatusBarAppearance</key>
4659
<false/>
47-
<key>NSLocationWhenInUseUsageDescription</key>
48-
<string></string>
49-
<key>NSAppTransportSecurity</key>
50-
<dict>
51-
<key>NSExceptionDomains</key>
52-
<dict>
53-
<key>localhost</key>
54-
<dict>
55-
<key>NSExceptionAllowsInsecureHTTPLoads</key>
56-
<true/>
57-
</dict>
58-
</dict>
59-
</dict>
6060
</dict>
6161
</plist>

ios/RCTJMessageModule/JMessageHelper.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
@end
4343

4444

45+
@interface NSArray (JMessage)
46+
- (NSArray *)mapObjectsUsingBlock:(id (^)(id obj, NSUInteger idx))block;
47+
@end
4548

4649
@interface NSDictionary (JMessage)
4750
-(NSString*)toJsonString;
@@ -70,3 +73,7 @@
7073
@interface NSError (JMessage)
7174
- (NSDictionary *)errorToDictionary;
7275
@end
76+
77+
@interface JMSGChatRoom (JMessage)
78+
- (NSMutableDictionary *)chatRoomToDictionary;
79+
@end

ios/RCTJMessageModule/JMessageHelper.m

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,3 +506,31 @@ - (NSDictionary *)errorToDictionary {
506506
}
507507

508508
@end
509+
510+
@implementation JMSGChatRoom (JMessage)
511+
- (NSMutableDictionary *)chatRoomToDictionary {
512+
NSMutableDictionary *dict = @{}.mutableCopy;
513+
dict[@"type"] = @"chatroom";
514+
dict[@"roomId"] = self.roomID;
515+
dict[@"roomName"] = self.name;
516+
dict[@"appKey"] = self.appkey;
517+
dict[@"description"] = self.description;
518+
dict[@"createTime"] = self.ctime;
519+
dict[@"maxMemberCount"] = @([self.maxMemberCount integerValue]);
520+
dict[@"memberCount"] = @(self.totalMemberCount);
521+
522+
return dict;
523+
}
524+
@end
525+
526+
527+
@implementation NSArray (JMessage)
528+
529+
- (NSArray *)mapObjectsUsingBlock:(id (^)(id obj, NSUInteger idx))block {
530+
NSMutableArray *result = [NSMutableArray arrayWithCapacity:[self count]];
531+
[self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
532+
[result addObject:block(obj, idx)];
533+
}];
534+
return result;
535+
}
536+
@end

0 commit comments

Comments
 (0)