Skip to content

Commit 9f2d612

Browse files
fix(analytics): AnalyticsWithoutAdIdSupport (#115)
Co-authored-by: Osei Fortune <[email protected]>
1 parent b6b45df commit 9f2d612

File tree

11 files changed

+70
-14
lines changed

11 files changed

+70
-14
lines changed

apps/demo-vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dependencies": {
55
"@nativescript/core": "file:../../node_modules/@nativescript/core",
66
"@nativescript/firebase-admob": "file:../../packages/firebase-admob",
7-
"@nativescript/firebase-analytics": "file:../../packages/firebase-analytics",
7+
"@nativescript/firebase-analytics": "file:../../dist/packages/firebase-analytics",
88
"@nativescript/firebase-app-check": "file:../../packages/firebase-app-check",
99
"@nativescript/firebase-auth": "file:../../packages/firebase-auth",
1010
"@nativescript/firebase-core": "file:../../packages/firebase-core",

apps/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dependencies": {
77
"@nativescript/core": "file:../../node_modules/@nativescript/core",
88
"@nativescript/firebase-admob": "file:../../packages/firebase-admob",
9-
"@nativescript/firebase-analytics": "file:../../packages/firebase-analytics",
9+
"@nativescript/firebase-analytics": "file:../../dist/packages/firebase-analytics",
1010
"@nativescript/firebase-app-check": "file:../../packages/firebase-app-check",
1111
"@nativescript/firebase-auth": "file:../../packages/firebase-auth",
1212
"@nativescript/firebase-core": "file:../../packages/firebase-core",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
export = function ($logger, $projectData, hookArgs) {
5+
const platformName = ((hookArgs.prepareData && hookArgs.prepareData.platform) || (hookArgs.platformData && hookArgs.platformData.normalizedPlatformName) || '').toLowerCase();
6+
7+
if (platformName === 'ios') {
8+
const rootPath = $projectData.projectDir;
9+
10+
const Podfile = path.join(rootPath, 'platforms', 'ios', 'Podfile');
11+
const ResourcePodfile = $projectData.podfilePath;
12+
13+
if (fs.existsSync(Podfile) && fs.existsSync(ResourcePodfile)) {
14+
const podData = fs.readFileSync(Podfile, 'utf8') || '';
15+
const resourcePodData = fs.readFileSync(ResourcePodfile, 'utf8');
16+
17+
// set variable early in the Podfile
18+
if (podData && resourcePodData && resourcePodData.indexOf('$NSFirebaseAnalyticsWithoutAdIdSupport=true') > -1) {
19+
fs.writeFileSync(Podfile, '$NSFirebaseAnalyticsWithoutAdIdSupport=true \n' + podData);
20+
}
21+
}
22+
}
23+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import checkForChanges = require('./before-checkForChanges');
2+
export { checkForChanges };
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "../../../dist/packages/firebase-analytics/hooks",
4+
"rootDirs": [".", ".."],
5+
"module": "commonjs",
6+
"target": "es2015",
7+
"moduleResolution": "node",
8+
"declaration": false,
9+
"experimentalDecorators": true,
10+
"emitDecoratorMetadata": true,
11+
"noEmitHelpers": false,
12+
"noEmitOnError": true,
13+
"removeComments": true,
14+
"skipLibCheck": true
15+
},
16+
"include": ["../typings/**/*.d.ts"],
17+
"files": ["index.ts"]
18+
}

packages/firebase-analytics/package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
"platforms": {
99
"ios": "6.0.0",
1010
"android": "6.0.0"
11-
}
11+
},
12+
"hooks": [
13+
{
14+
"type": "before-checkForChanges",
15+
"script": "hooks/before-checkForChanges.js",
16+
"inject": true
17+
}
18+
]
1219
},
1320
"repository": {
1421
"type": "git",
@@ -31,5 +38,9 @@
3138
"license": "Apache-2.0",
3239
"homepage": "https://github.com/NativeScript/firebase",
3340
"readmeFilename": "README.md",
34-
"bootstrapper": "@nativescript/plugin-seed"
41+
"bootstrapper": "@nativescript/plugin-seed",
42+
"scripts": {
43+
"preuninstall": "node preuninstall",
44+
"postinstall": "node postinstall"
45+
}
3546
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('@nativescript/hook')(__dirname).postinstall();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('@nativescript/hook')(__dirname).preuninstall();

packages/firebase-analytics/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"build.all": {
3333
"executor": "@nrwl/workspace:run-commands",
3434
"options": {
35-
"commands": ["node tools/scripts/build-finish.ts firebase-analytics"],
35+
"commands": ["./node_modules/.bin/tsc -p packages/firebase-analytics/hooks/tsconfig.json", "node tools/scripts/build-finish.ts firebase-analytics"],
3636
"parallel": false
3737
},
3838
"outputs": ["dist/packages/firebase-analytics"],
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"extends": "../../tsconfig.base.json",
3-
"compilerOptions": {
4-
"outDir": "../../dist/out-tsc",
5-
"rootDir": "."
6-
},
7-
"exclude": ["**/*.spec.ts", "angular", "src-native"],
8-
"include": ["**/*.ts", "references.d.ts"]
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"rootDir": "."
6+
},
7+
"exclude": ["**/*.spec.ts", "angular", "src-native", "hooks"],
8+
"include": ["**/*.ts", "references.d.ts"]
99
}

0 commit comments

Comments
 (0)