Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Merge v2.0.x into master #1736

Merged
merged 81 commits into from May 25, 2017
Merged

Merge v2.0.x into master #1736

merged 81 commits into from May 25, 2017

Conversation

macdonst
Copy link
Member

Hey all,

I want to move the 2.0.x branch into master as I'm getting tired of all of these rebases and I want to release this thing soon. Please take a look over this PR.

I've pushed the latest master branch to v1.x so we can do bug fixes there if required.

jcesarmobile and others added 30 commits May 23, 2017 12:10
* Modified plugin.xml to include FCM changes

* Plugin.xml changes for FCM

* Java changes for FCM

* Increased plugin version to 2.0.0

* Increased plugin version in package.json

* Added topic subscription/unsubscription

* Removed some empty lines
@fredgalvao
Copy link
Collaborator

One of the forks of the fcm-node package now mentions the existence of a module officialy from Firebase that provides the functionality offered by fcm-node:

Warning: on February 2, 2017, the Firebase Team released the admin.messaging() service to their node.js admin module. This new service makes this module kind of deprecated (source)

Should the examples on payload be changed accordingly?

Docs on the new official node.js API is here

@fredgalvao
Copy link
Collaborator

Should we subtly advise use of let instead of var on our examples? Both our codebase and the internet has moved on to a new level of ES now, it feels right to me (but not needed, of course).

@shazron
Copy link
Member

shazron commented May 24, 2017

@fredgalvao ES6 is only baked in on iOS 10, unfortunately (without transpilers). cordova-ios still supports ios 9.

@fredgalvao
Copy link
Collaborator

@shazron The examples are in the context of a node.js server to send the payloads, not in the webview itself.

@shazron
Copy link
Member

shazron commented May 24, 2017

@fredgalvao gotcha, I thought you were talking about the client side example

@fredgalvao
Copy link
Collaborator

I can't read Objective-C without it hurting my brain, so I can't help on that.

Overall, there seems to be a few merge-originated regressions on plugin.xml and that one TODO that has apparently left the registration event without it's tokenRefresh counterpart on the native side.

Most of the stuff I commented on on the docs are chore, and can be left for another PR.

@tlaverdure
Copy link

I'm getting this error when submitting to the Apple App store:

Non-public API usage:

The app references non-public selectors in: _terminateWithStatus:

Found in:
platforms/ios/Pods/GoogleToolboxForMac/UnitTesting/GTMIPhoneUnitTestDelegate.m

@shazron
Copy link
Member

shazron commented May 25, 2017

@tlaverdure Looks like we can't include the full GTM suite, and just use subspecs of it. We will have to discover which ones, but definitely none of the UnitTesting ones.

$ pod search GoogleToolboxForMac
> GoogleToolboxForMac (2.1.1)
   Google utilities for iOS and OSX development.
   pod 'GoogleToolboxForMac', '~> 2.1.1'
   - Homepage: https://github.com/google/google-toolbox-for-mac
   - Source:   https://github.com/google/google-toolbox-for-mac.git
   - Versions: 2.1.1, 2.1.0, 2.0.1, 2.0.0 [master repo]
   - Subspecs:
     - GoogleToolboxForMac/Defines (2.1.1)
     - GoogleToolboxForMac/Core (2.1.1)
     - GoogleToolboxForMac/AddressBook (2.1.1)
     - GoogleToolboxForMac/DebugUtils (2.1.1)
     - GoogleToolboxForMac/GeometryUtils (2.1.1)
     - GoogleToolboxForMac/KVO (2.1.1)
     - GoogleToolboxForMac/Logger (2.1.1)
     - GoogleToolboxForMac/Regex (2.1.1)
     - GoogleToolboxForMac/StackTrace (2.1.1)
     - GoogleToolboxForMac/StringEncoding (2.1.1)
     - GoogleToolboxForMac/SystemVersion (2.1.1)
     - GoogleToolboxForMac/URLBuilder (2.1.1)
     - GoogleToolboxForMac/NSData+zlib (2.1.1)
     - GoogleToolboxForMac/NSDictionary+URLArguments (2.1.1)
     - GoogleToolboxForMac/NSFileHandle+UniqueName (2.1.1)
     - GoogleToolboxForMac/NSScanner+JSON (2.1.1)
     - GoogleToolboxForMac/NSString+HTML (2.1.1)
     - GoogleToolboxForMac/NSString+URLArguments (2.1.1)
     - GoogleToolboxForMac/NSString+XML (2.1.1)
     - GoogleToolboxForMac/NSThread+Blocks (2.1.1)
     - GoogleToolboxForMac/iPhone (2.1.1)
     - GoogleToolboxForMac/RoundedRectPath (2.1.1)
     - GoogleToolboxForMac/UIFont+LineHeight (2.1.1)
     - GoogleToolboxForMac/UnitTesting (2.1.1)
     - GoogleToolboxForMac/UnitTestingAppLib (2.1.1)

Looks like it could just be Logger: https://github.com/CocoaPods/Specs/blob/23b07bd380c1e829caf2663182e3be87ace02785/Specs/2/d/6/FirebaseMessaging/1.2.1/FirebaseMessaging.podspec.json#L35

@shazron
Copy link
Member

shazron commented May 25, 2017

I removed the <framework> GoogleToolboxForMac in plugin.xml and it appears that FirebaseMessaging will download the appropriate dependency in platforms/ios/Pods so GTM is there already. This might be an issue in the workspace settings possibly. Strange that including the pod explicitly makes it work.

Lots of similar issues: https://www.google.com/search?q=library+not+found+for+lGoogleToolboxForMac&oq=library+not+found+for+lGoogleToolboxForMac&aqs=chrome..69i57.3654j0j7&sourceid=chrome&ie=UTF-8

@shazron
Copy link
Member

shazron commented May 25, 2017

I tested this again on the v2.0.x plugin without the GoogleToolboxForMac <framework> tag and it builds fine, so the original problem disappeared? Weird. Using Xcode 8.3.2. Note that it installs FirebaseMessaging 1.2.2 due to the way the spec is specified. Not sure why it didn't pick up 1.2.3

PODS:
  - FirebaseAnalytics (3.7.0):
    - FirebaseCore (~> 3.5)
    - FirebaseInstanceID (~> 1.0)
    - GoogleToolboxForMac/NSData+zlib (~> 2.1)
  - FirebaseCore (3.5.1):
    - GoogleToolboxForMac/NSData+zlib (~> 2.1)
  - FirebaseInstanceID (1.0.9)
  - FirebaseMessaging (1.2.2):
    - FirebaseAnalytics (~> 3.7)
    - FirebaseInstanceID (~> 1.0)
    - GoogleToolboxForMac/Logger (~> 2.1)
    - Protobuf (~> 3.1)
  - GoogleToolboxForMac/Defines (2.1.1)
  - GoogleToolboxForMac/Logger (2.1.1):
    - GoogleToolboxForMac/Defines (= 2.1.1)
  - GoogleToolboxForMac/NSData+zlib (2.1.1):
    - GoogleToolboxForMac/Defines (= 2.1.1)
  - Protobuf (3.2.0)

DEPENDENCIES:
  - FirebaseMessaging (~> 1.2.1)

SPEC CHECKSUMS:
  FirebaseAnalytics: 0d1b7d81d5021155be37702a94ba1ec16d45365d
  FirebaseCore: 225d40532489835a034b8f4e2c9c87fbf4f615a2
  FirebaseInstanceID: 2d0518b1378fe9d685ef40cbdd63d2fdc1125339
  FirebaseMessaging: df8267f378580a24174ce7861233aa11d5c90109
  GoogleToolboxForMac: 8e329f1b599f2512c6b10676d45736bcc2cbbeb0
  Protobuf: 745f59e122e5de98d4d7ef291e264a0eef80f58e

PODFILE CHECKSUM: 61ad6041bfe0d7b053a1f23890ab2fd59004e3c7

COCOAPODS: 1.2.0

@jcesarmobile
Copy link
Collaborator

I was planning on testing FirebaseMessaging 2.0.0

@macdonst
Copy link
Member Author

@fredgalvao can you create an issue to update the docs for ES6 and using the supported way of sending FCM messages from node? Tag it to the v2.0.0 release.

@macdonst macdonst merged commit d07fdf0 into master May 25, 2017
@macdonst
Copy link
Member Author

Okay master is now officially the 2.0.0 working branch and v1.x is where we'll do bug fixes for older releases.

`android.icon` | `string` | | Optional. The name of a drawable resource to use as the small-icon. The name should not include the extension.
`android.iconColor` | `string` | | Optional. Sets the background color of the small icon on Android 5.0 and greater. [Supported Formats](http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String))
`android.sound` | `boolean` | `true` | Optional. If `true` it plays the sound specified in the push data or the default system sound.
`android.vibrate` | `boolean` | `true` | Optional. If `true` the device vibrates on receipt of notification.
`android.clearBadge` | `boolean` | `false` | Optional. If `true` the icon badge will be cleared on init and before push messages are processed.
`android.clearNotifications` | `boolean` | `true` | Optional. If `true` the app clears all pending notifications when it is closed.
`android.forceShow` | `boolean` | `false` | Optional. Controls the behavior of the notification when app is in foreground. If `true` and app is in foreground, it will show a notification in the notification drawer, the same way as when the app is in background (and `on('notification')` callback will be called *only when the user clicks the notification*). When `false` and app is in foreground, the `on('notification')` callback will be called immediately.
`android.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic. Note: you should omit the `/topics/` prefix from each element of the array as the plugin will handle that for you.
`android.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a FcmPubSub topic.
`/topics/` prefix from each element of the array as the plugin will handle that for you.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like an accidental line break. (edit) Or maybe this line was supposed to be removed too?

Copy link
Member Author

Choose a reason for hiding this comment

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

It was supposed to be removed. I will fix this in a commit shortly.

`ios.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic. Note: only usable in conjunction with `senderID`. Note: you should omit the `/topics/` prefix from each element of the array as the plugin will handle that for you.
`ios.fcmSandbox` | `boolean` | `false` | Whether to use prod or sandbox GCM setting. Defaults to false.
options
`ios.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a FcmPubSub topic.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Either the /topics thing needs to come back here, or it needs to go away on the android section above.

If you are not creating an Android application you can put in anything for this value.
```
<platform name="android">
<resource-file src="google-services.json" target="google-services.json" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this target needed in this example?

Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't hurt :)

title: 'AUX Scrum',
message: 'Scrum: Daily touchbase @ 10am Please be on time so we can cover everything on the agenda.',
actions: [
{ "icon": "emailGuests", "title": "EMAIL GUESTS", "callback": "app.emailGuests", "foreground": true},
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to quote those nested keys, might as well leave unquoted for homogeneity.

data: {
title: 'Force Start',
message: 'This notification should restart the app',
force-start: '1'
Copy link
Collaborator

Choose a reason for hiding this comment

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

This key actually needs to be quoted, otherwise this won't compile.

"cordova": ">100"
"cordova-ios": ">=4.4.0",
"cordova-android": ">=6.2.1",
"cordova": ">=6.4.0"
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Having a block pointing to the distant future "cordova": ">100" is healthy afaik, we should create a new one for 3.0 or 2.1 on that.

<platform name="android">
<hook type="before_plugin_install" src="scripts/copyAndroidFile.js"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need this? If I read that script right, it only adds a framework dependency, which can be done through framework tags themselves.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's still needed as the classpath "com.google.gms:google-services:3.0.0" has to end up in the buildscript dependencies section. This will screw us up for PGB.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this something that can be achieved with a custom framework tag to gradle?

</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.adobe.phonegap.push.PushHandlerActivity" android:exported="true" android:permission="${applicationId}.permission.PushHandlerActivity"/>
<activity android:name="com.adobe.phonegap.push.PushHandlerActivity" android:exported="true"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might be a bit too late or mistaken, but why was the custom permission removed? It fixed conflicts of duplicated providers when multiple applications with the same plugin were present, and afaik that issue can still happen on 2.0.

<js-module src="src/windows/PushPluginProxy.js" name="PushPlugin">
<runs/>
<merges target=""/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This and the setToastCapable above seem to have been lost accidentally. Losing those changes are a regression afaik.

String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(LOG_TAG, "Refreshed token: " + refreshedToken);
// TODO: Implement this method to send any registration to your app's servers.
//sendRegistrationToServer(refreshedToken);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this TODO supposed to have survived? How is the tokenRefresh event being cascaded into webview-land now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that todo should stick around for now. We should fire the registration event if this happens.

Copy link
Collaborator

Choose a reason for hiding this comment

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

By "we should" you mean when this TODO gets implemented, right? I'm trying to understand what's happening and what should happen with this TODO in place. Otherwise we need to update the docs to mention that tokenRefresh won't trigger a registration event anymore.

@fredgalvao
Copy link
Collaborator

fredgalvao commented May 25, 2017

I misunderstood how github reviews acted on the comments left on changes, and it seems all the comments I had made were being held until I submitted the review. Sorry for that.

@macdonst can you take a look at them? It's too late with the merge, but we can always create new issues for the ones that are agreed upon.

@macdonst
Copy link
Member Author

@fredgalvao I went through your comments. Lots of good catches there, thanks! Will push a commit in a moment.

@lock
Copy link

lock bot commented Jun 3, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants