Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Contains the React Native Griffon plugin, sample app and Unit tests. #1

Merged
merged 52 commits into from
Jun 15, 2020

Conversation

shtomar-adb
Copy link
Contributor

Description

Contains the React Native Griffon plugin and sample app. There are few pending issues that I am working.

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Contributor

@nporter-adbe nporter-adbe left a comment

Choose a reason for hiding this comment

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

Some initial comments, can you remove Pods so its easier to review? Currently, my browser is struggling to load the diff due to the size.

@@ -0,0 +1,25 @@

Pod::Spec.new do |s|
s.name = "RCTACPReactNativeAcpGriffon"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you updated the podspec to be consistent with the other React Native podspecs we have (naming, summary, etc)
https://github.com/adobe/react-native-acpanalytics/blob/master/RCTACPAnalytics.podspec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the Podspec.

README.md Outdated

#### iOS

1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't advertise manual installation, I'd recommend only providing instructions using react-native link and the auto-link feature introduced in RN 0.60+.

https://github.com/adobe/react-native-acpanalytics#2-install-javascript-packages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update it once I update Readme.md

@@ -0,0 +1,39 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Update this file to use the same versions as used in other RN packages unless there is a specific need from Girffon to use different versions. https://raw.githubusercontent.com/adobe/react-native-acpanalytics/master/android/build.gradle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

README.md Outdated
# react-native-acpgriffon
Adobe Experience Platform - Project Griffon plugin for React-Native apps

# adobe-mobile-marketing-react-native-acp-griffon
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update to use the format other RN packages are using for their readme: https://github.com/adobe/react-native-acpanalytics/blob/master/README.md

@@ -0,0 +1,43 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing the copyright header.

/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the copyright header.


@ReactMethod
public void startSession(final String url) {
Griffon.startSession(url);
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle the case where url could be null

@@ -0,0 +1,28 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing copyright header.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;
public class RCTACPReactNativeAcpGriffonPackage implements ReactPackage {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about naming conventions.

Copy link
Contributor Author

@shtomar-adb shtomar-adb Jun 1, 2020

Choose a reason for hiding this comment

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

Changed as per convention.

index.js Outdated
@@ -0,0 +1,4 @@
// const ACPGriffon = require('./js/ACPGriffon');
Copy link
Contributor

Choose a reason for hiding this comment

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

Few comments on this file:

  1. Usually, we have our index.js file live in the js directory.
  2. Implement to be consistent with our other index.js files: https://github.com/adobe/react-native-acpanalytics/blob/master/js/index.js
  3. Add copyright header

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved index.js to js and added copyright.

@@ -0,0 +1,26 @@
Copyright 2006-2011, the V8 project authors. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not be checking in our pods, and additionally, we shouldn't be checking in an Xcode project which references pods. This will cause build issues for our customers and require them to download all the pods.

  1. Remove pods and add them to git ignore
  2. Before committing run pod deintegrate

@@ -0,0 +1,10 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Copyright header.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

@@ -0,0 +1,29 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Copyright header



RCT_EXPORT_METHOD(startSession: (NSString *) url){
[ACPGriffon startSession:[[NSURL alloc] initWithString:url]];
Copy link
Contributor

Choose a reason for hiding this comment

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

Griffon's headers specifies that url should be Nonnull, we should do a check here to ensure it is not nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the nil check.

@@ -0,0 +1,15 @@
package com.griffonsample;
Copy link
Contributor

Choose a reason for hiding this comment

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

Be sure to add the copyright header to all the files, including those in the sample app.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

package.json Outdated
"author": "",
"license": "",
"peerDependencies": {
"react-native": ">=0.44.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Add "@adobe/react-native-acpcore": ">=1.0.0" as a peer dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added core as peer dependency.

@@ -0,0 +1,27 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

package.json Outdated
{
"name": "@adobe/react-native-acpgriffon",
"version": "1.0.0",
"description": "",
Copy link
Contributor

Choose a reason for hiding this comment

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

Populate the metadata to be similar to that in other packages: https://github.com/adobe/react-native-acpanalytics/blob/master/package.json#L8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -0,0 +1,19 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Copyright header

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

js/ACPGriffon.js Outdated
Alert.alert("----- "+NativeModules);
const ACPGriffon = NativeModules.ACPGriffon;

// Alert.alert("{}{}{}{}"+JSON.stringify(NativeModules));
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

js/ACPGriffon.js Outdated
@@ -0,0 +1,19 @@

import { NativeModules, Alert } from 'react-native';
Alert.alert("----- "+NativeModules);
Copy link
Contributor

@nporter-adbe nporter-adbe May 28, 2020

Choose a reason for hiding this comment

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

Unused code, also remove the Alert import.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

js/ACPGriffon.js Outdated
return Promise.resolve(ACPGriffon.getExtensionVersion());
},
registerExtension: () => {
return Promis.resolve(ACPGriffon.registerExtension());
Copy link
Contributor

Choose a reason for hiding this comment

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

Our other register extension APIs don't resolve a promise as it doesn't have a return value: https://github.com/adobe/react-native-acpanalytics/blob/master/js/ACPAnalytics.js#L32

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the Promise.

@shtomar-adb shtomar-adb changed the title WIP: Contains the React Native Griffon plugin and sample app. Contains the React Native Griffon plugin, sample app and Unit tests. Jun 1, 2020
s.license = "Apache 2.0 License"
s.platform = :ios, "10.0"

s.source = { :git => "https://github.com/adobe/react-native-acp-griffon", :tag => "#{s.version}" }

Choose a reason for hiding this comment

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

shouldnt this be react-native-acpgriffon

shtomar-adb and others added 10 commits June 2, 2020 00:49
…dge class to set current activity to Griffon. This is to handle Griffon issue where Griffon fails to show PincodeNetryActivity for first time.
…griffon into acp-griffon

Merged the remote branch.
…eed to be registered from Native code Application/AppDelegate in android and ios respectively which is recommended in RN.
…griffon into acp-griffon

Merged remote branch.
Copy link
Contributor

@nporter-adbe nporter-adbe left a comment

Choose a reason for hiding this comment

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

looks really good just a few comments.

README.md Outdated

###### **iOS**
```objective-c
#import <RCTACPAnalytics/ACPAnalytics.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Import wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missed to change that. Fixed

README.md Outdated

###### **Android:**
```java
import com.adobe.marketing.mobile.Analytics;
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix import

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@@ -0,0 +1,18 @@
import { NativeModules } from 'react-native';
Copy link
Contributor

Choose a reason for hiding this comment

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

Add copyright header

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

3D83B4BD247E5608007E783A /* libACPGriffon_iOS.a */,
3D83B4BB247E55F5007E783A /* ACPGriffon.h */,
134814211AA4EA7D00B7C361 /* Products */,
BFD6951DDA7DCA909FD456A9 /* Pods */,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should remove references to Pods in our project before commiting it. Try pod deintegrate, you may need to go into the project and delete the Pods folder manually. This can cause build issues in cusutomers apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deintegrated the pods.

super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
MobileCore.setApplication(this); // add this line
MobileCore.configureWithAppID("94f571f308d5/e30a9514788b/launch-44fec1a705f1-development");
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 commit app Ids to public git. Remove and add a place holder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced with placeholders.

[self.window makeKeyAndVisible];

//Register ACP Core and Griffon Extensions.
[ACPCore configureWithAppId:@"94f571f308d5/e30a9514788b/launch-44fec1a705f1-development"];
Copy link
Contributor

@nporter-adbe nporter-adbe Jun 4, 2020

Choose a reason for hiding this comment

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

Add placeholder for app id

const RNACPCore = require('@adobe/react-native-acpcore');
const ACPCore = RNACPCore.ACPCore;
// import { ACPGriffon } from '@adobe/react-native-acpgriffon';
// const RNACPGriffon = require('@adobe/react-native-acpgriffon');
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we clean up these imports?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

shtomar-adb and others added 28 commits June 8, 2020 20:32
Added other react native plugin info in Readme.
…griffon into acp-griffon

Merge the remote branch.
Copy link
Contributor

@nporter-adbe nporter-adbe left a comment

Choose a reason for hiding this comment

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

nice!

@shtomar-adb shtomar-adb merged commit fd725c2 into adobe:master Jun 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants