Skip to content

Commit 6638135

Browse files
committed
Merge pull request facebookarchive#19 from facebook/philikon-cleanup
Cleanup: coding style and conventions
2 parents d9d3f6c + fe2103c commit 6638135

35 files changed

+489
-533
lines changed

Sample/.flowconfig

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[ignore]
2+
3+
# We fork some components by platform.
4+
.*/*.web.js
5+
.*/*.android.js
6+
7+
# Some modules have their own node_modules with overlap
8+
.*/node_modules/node-haste/.*
9+
10+
# Ignore react-tools where there are overlaps, but don't ignore anything that
11+
# react-native relies on
12+
.*/node_modules/react-tools/src/React.js
13+
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
14+
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
15+
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
16+
17+
18+
# Ignore commoner tests
19+
.*/node_modules/commoner/test/.*
20+
21+
# See https://github.com/facebook/flow/issues/442
22+
.*/react-tools/node_modules/commoner/lib/reader.js
23+
24+
# Ignore jest
25+
.*/react-native/node_modules/jest-cli/.*
26+
27+
[include]
28+
29+
[libs]
30+
node_modules/react-native/Libraries/react-native/react-native-interface.js
31+
32+
[options]
33+
module.system=haste
34+
35+
munge_underscores=true
36+
37+
suppress_type=$FlowIssue
38+
suppress_type=$FlowFixMe
39+
suppress_type=$FixMe
40+
41+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
42+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
43+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
44+
45+
[version]
46+
0.14.0

react-native-fbsdkcore/FBSDKCore.ios.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
'use strict';
2424

2525
// Core modules
26-
exports.FBSDKAccessToken = require('./js-modules/FBSDKAccessToken.ios.js');
27-
exports.FBSDKAppEvents = require('./js-modules/FBSDKAppEvents.ios.js');
28-
exports.FBSDKGraphRequest = require('./js-modules/FBSDKGraphRequest.ios.js');
29-
exports.FBSDKGraphRequestManager = require('./js-modules/FBSDKGraphRequestManager.ios.js');
26+
exports.FBSDKAccessToken = require('./js/FBSDKAccessToken.ios.js');
27+
exports.FBSDKAppEvents = require('./js/FBSDKAppEvents.ios.js');
28+
exports.FBSDKGraphRequest = require('./js/FBSDKGraphRequest.ios.js');
29+
exports.FBSDKGraphRequestManager = require('./js/FBSDKGraphRequestManager.ios.js');

react-native-fbsdkcore/js-modules/FBSDKAppEvents.ios.js

-92
This file was deleted.

react-native-fbsdkcore/js-modules/FBSDKAccessToken.ios.js react-native-fbsdkcore/js/FBSDKAccessToken.ios.js

+12-25
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1818
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919
*
20-
* @providesModule FBSDKAccessToken
2120
* @flow
2221
*/
2322

@@ -35,31 +34,31 @@ type AccessTokenDict = {
3534
_refreshDate: number;
3635
};
3736

38-
/*
37+
/**
3938
* Represents an immutable access token for using Facebook services.
4039
*/
4140
class FBSDKAccessToken {
42-
/*
41+
/**
4342
* The opaque token string.
4443
*/
4544
tokenString: string;
4645

47-
/*
46+
/**
4847
* The known granted permissions.
4948
*/
5049
permissions: Array<string>;
5150

52-
/*
51+
/**
5352
* The known declined permissions.
5453
*/
5554
declinedPermissions: Array<string>;
5655

57-
/*
56+
/**
5857
* The app ID.
5958
*/
6059
appID: string;
6160

62-
/*
61+
/**
6362
* The user ID.
6463
*/
6564
userID: string;
@@ -68,7 +67,7 @@ class FBSDKAccessToken {
6867
_expirationDate: number;
6968
_refreshDate: number;
7069

71-
/*
70+
/**
7271
* Constructs a new FBSDKAccessToken object.
7372
*/
7473
constructor(tokenDict: AccessTokenDict) {
@@ -83,50 +82,38 @@ class FBSDKAccessToken {
8382
Object.freeze(this);
8483
}
8584

86-
/*
85+
/**
8786
* Gets the expiration date.
88-
*
89-
* @returns - Expiration date of the token.
9087
*/
9188
getExpirationDate(): Date {
9289
return new Date(this._expirationDate);
9390
}
9491

95-
/*
92+
/**
9693
* Gets the the date the token was last refreshed.
97-
*
98-
* @returns - Refresh date of the token.
9994
*/
10095
getRefreshDate(): Date {
10196
return new Date(this._refreshDate);
10297
}
10398

104-
/*
99+
/**
105100
* Indicates whether the specified permission has been granted.
106-
*
107-
* @param (string) permission - The permissions to check the status of.
108-
*
109-
* @returns - true if permission has been granted, otherwise false
110101
*/
111102
hasGrantedPermission(permission: string): boolean {
112103
return this.permissions.some((perm) => perm === permission);
113104
}
114105

115-
/*
106+
/**
116107
* Makes a request to retrieve the current access token.
117-
*
118-
* @param ((token: FBSDKAccessToken) => void) callback - Called with the current access token.
119108
*/
120109
static getCurrentAccessToken(callback: (token: ?FBSDKAccessToken) => void) {
121110
FBSDKAccessTokenInterface.getCurrentAccessToken((tokenDict) => {
122111
callback(tokenDict ? new FBSDKAccessToken(tokenDict) : null);
123112
});
124113
}
125114

126-
/*
115+
/**
127116
* Sets the current access token to the one provided.
128-
*
129-
* @param (FBSDKAccessToken) token - An access token.
130117
*/
131118
static setCurrentAccessToken(token: FBSDKAccessToken) {
132119
FBSDKAccessTokenInterface.setCurrentAccessToken(token);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
3+
*
4+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5+
* copy, modify, and distribute this software in source code or binary form for use
6+
* in connection with the web services and APIs provided by Facebook.
7+
*
8+
* As with any software that integrates with the Facebook platform, your use of
9+
* this software is subject to the Facebook Developer Principles and Policies
10+
* [http://developers.facebook.com/policy/]. This copyright notice shall be
11+
* included in all copies or substantial portions of the software.
12+
*
13+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19+
*
20+
* @flow
21+
*/
22+
23+
'use strict';
24+
25+
var FBSDKAppEventsInterface = require('react-native').NativeModules.FBSDKAppEvents;
26+
var FBSDKAccessToken = require('./FBSDKAccessToken.ios.js');
27+
28+
/**
29+
* Specifies when events are sent to the server.
30+
*/
31+
type FBSDKAppEventsFlushBehavior = 'auto' | 'explicity-only';
32+
33+
module.exports = {
34+
/**
35+
* Logs an event.
36+
*/
37+
logEvent(
38+
eventName: string,
39+
valueToSum: ?number,
40+
parameters: ?Object,
41+
accessToken: ?FBSDKAccessToken
42+
) {
43+
FBSDKAppEventsInterface.logEvent(
44+
eventName,
45+
valueToSum,
46+
parameters,
47+
accessToken
48+
);
49+
},
50+
51+
/**
52+
* Logs a purchase.
53+
*/
54+
logPurchase(
55+
purchaseAmount: number,
56+
currency: string,
57+
parameters: ?Object,
58+
accessToken: ?FBSDKAccessToken
59+
) {
60+
FBSDKAppEventsInterface.logPurchase(
61+
purchaseAmount,
62+
currency,
63+
parameters,
64+
accessToken
65+
);
66+
},
67+
68+
/**
69+
* Sets the current event flushing behavior specifying when events
70+
* are sent back to Facebook servers.
71+
*/
72+
setFlushBehavior(flushBehavior: FBSDKAppEventsFlushBehavior) {
73+
FBSDKAppEventsInterface.setFlushBehavior(flushBehavior);
74+
},
75+
76+
/**
77+
* Sets the override app ID for app event logging.
78+
*/
79+
setLoggingOverrideAppID(appID: string) {
80+
FBSDKAppEventsInterface.setLoggingOverrideAppID(appID);
81+
},
82+
83+
/**
84+
* Explicitly kicks off flushing of events to Facebook.
85+
*/
86+
flush() {
87+
FBSDKAppEventsInterface.flush();
88+
},
89+
};

0 commit comments

Comments
 (0)