Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix all Framework imports that would break cocoapods installation #319

Merged
merged 4 commits into from
Jun 4, 2018
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
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>

@import AppCenter;
@class MSWrapperSdk;

@interface AppCenterReactNativeShared : NSObject

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>

@import AppCenter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need some header for MSWrapperSdk type?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in AppCenterReactNativeShared.m file we need header for MSAppCenter type

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right.. I wasn't able to properly build the framework before, not sure why but it should be good to go now. Built and checked.
I've use forward declaration on the header and imported the right header in the .m file, still not requiring a @import which has been the issue for our integration flow.

@class MSWrapperSdk;

@interface AppCenterReactNativeShared : NSObject

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#import "AppCenterReactNativeShared.h"
#import <AppCenter/MSAppCenter.h>
#import <AppCenter/MSWrapperSdk.h>

@implementation AppCenterReactNativeShared

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#import <Foundation/Foundation.h>

@import AppCenterCrashes;

// Support React Native headers both in the React namespace, where they are in RN version 0.40+,
// and no namespace, for older versions of React Native
#if __has_include(<React/RCTEventEmitter.h>)
Expand All @@ -10,6 +8,7 @@
#import "RCTEventEmitter.h"
#endif

@protocol MSCrashesDelegate;

@interface AppCenterReactNativeCrashesDelegate : NSObject<MSCrashesDelegate>

Expand All @@ -20,4 +19,3 @@
- (void)stopObserving;

@end

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#import <AppCenterCrashes/AppCenterCrashes.h>
#import "AppCenterReactNativeCrashesDelegate.h"
#import "AppCenterReactNativeCrashesUtils.h"

static NSString *ON_BEFORE_SENDING_EVENT = @"AppCenterErrorReportOnBeforeSending";
static NSString *ON_SENDING_FAILED_EVENT = @"AppCenterErrorReportOnSendingFailed";
static NSString *ON_SENDING_SUCCEEDED_EVENT = @"AppCenterErrorReportOnSendingSucceeded";

@implementation AppCenterReactNativeCrashesDelegate
@implementation AppCenterReactNativeCrashesDelegate
{
bool hasListeners;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#import <Foundation/Foundation.h>

@import AppCenterPush;

// Support React Native headers both in the React namespace, where they are in RN version 0.40+,
// and no namespace, for older versions of React Native
#if __has_include(<React/RCTEventEmitter.h>)
Expand All @@ -12,6 +10,8 @@

@class AppCenterReactNativePush;

@protocol MSPushDelegate;

@protocol AppCenterReactNativePushDelegate <MSPushDelegate>

@required
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <Foundation/Foundation.h>
#import <AppCenterPush/AppCenterPush.h>
#import "AppCenterReactNativePushDelegate.h"

#if __has_include(<React/RCTEventDispatcher.h>)
Expand Down Expand Up @@ -35,7 +35,7 @@ - (void)push:(MSPush *)push didReceivePushNotification:(MSPushNotification *)pus
else if (hasListeners) {
[self.eventEmitter sendEventWithName:ON_PUSH_NOTIFICATION_RECEIVED_EVENT body:convertNotificationToJS(pushNotification)];
}
}
}

- (void)sendAndClearInitialNotification
{
Expand All @@ -46,7 +46,7 @@ - (void)sendAndClearInitialNotification
self.initialNotification = nil;
}
self.saveInitialNotification = false;
}
}

- (NSArray<NSString *> *)supportedEvents
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import <Foundation/Foundation.h>

@import AppCenterPush.MSPushNotification;
@class MSPushNotification;

NSDictionary* convertNotificationToJS(MSPushNotification* notification);
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
#import "AppCenterReactNativePushUtils.h"

#import <AppCenterPush/MSPushNotification.h>
#import "AppCenterReactNativePushUtils.h"

NSDictionary* convertNotificationToJS(MSPushNotification* pushNotification) {
if (pushNotification == nil) {
return @{};
}

NSMutableDictionary * dict = [[NSMutableDictionary alloc] init];
NSString *message = pushNotification.message;
NSString *title = pushNotification.title;

dict[@"message"] = message;
dict[@"title"] = title;

NSMutableDictionary *customData = [[NSMutableDictionary alloc] init];
for (NSString *key in pushNotification.customData) {
customData[key] = [pushNotification.customData objectForKey:key];
}

dict[@"customProperties"] = customData;

return dict;
}