@bprotsyk/aso-core 1.2.88 → 1.2.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/panel/flash/create-flash-app-request.d.ts +2 -0
- package/lib/utils/huawei/converter.d.ts +2 -0
- package/lib/utils/huawei/converter.js +53 -0
- package/lib/utils/keitaro-utils.js +4 -4
- package/package.json +2 -1
- package/src/panel/flash/create-flash-app-request.ts +2 -0
- package/src/utils/huawei/converter.ts +55 -0
- package/src/utils/keitaro-utils.ts +4 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IAppKeitaroData } from "flash/flash-app";
|
|
1
2
|
export interface IUpsertFlashAppRequest {
|
|
2
3
|
id: number;
|
|
3
4
|
name: string;
|
|
@@ -11,6 +12,7 @@ export interface IUpsertFlashAppRequest {
|
|
|
11
12
|
developerEmail: string;
|
|
12
13
|
developerOrganization: string;
|
|
13
14
|
generationOptions: IAppGenerationOptions;
|
|
15
|
+
keitaroData?: Partial<IAppKeitaroData>;
|
|
14
16
|
}
|
|
15
17
|
export interface IAppGenerationOptions {
|
|
16
18
|
splashActivityClassName: string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mofidyGradleBuildFile = exports.modifyAppBuildGragleFile = void 0;
|
|
4
|
+
let modifyAppBuildGragleFile = async (file, alias, password, keyName) => {
|
|
5
|
+
const newSigningConfig = `
|
|
6
|
+
signingConfigs {
|
|
7
|
+
release {
|
|
8
|
+
keyAlias "${alias}"
|
|
9
|
+
keyPassword "${password}"
|
|
10
|
+
storePassword "${password}"
|
|
11
|
+
storeFile file('./${keyName}.jks')
|
|
12
|
+
v1SigningEnabled true
|
|
13
|
+
v2SigningEnabled true
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const huaweiBlock = `
|
|
17
|
+
huawei {
|
|
18
|
+
minifyEnabled true
|
|
19
|
+
shrinkResources true
|
|
20
|
+
signingConfig signingConfigs.release
|
|
21
|
+
proguardFiles(
|
|
22
|
+
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
23
|
+
"proguard-rules.pro"
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
let updatedConfigString = file.replace(/(signingConfigs\s*{[^}]+})/, newSigningConfig.trim());
|
|
28
|
+
if (!file.includes("signingConfigs")) {
|
|
29
|
+
// If the signingConfigs block doesn't exist, insert it after buildTypes
|
|
30
|
+
updatedConfigString = file.replace("buildTypes {", `signingConfigs ${newSigningConfig.trim()}\n\nbuildTypes {`);
|
|
31
|
+
}
|
|
32
|
+
file = updatedConfigString
|
|
33
|
+
.replace("buildTypes {", `buildTypes {\n${huaweiBlock.trim()}\n`)
|
|
34
|
+
.replace("plugins {", "plugins {\n id 'com.huawei.agconnect'")
|
|
35
|
+
.replace("apply plugin: 'com.android.application'", "apply plugin: 'com.huawei.agconnect'\napply plugin: 'com.android.application'")
|
|
36
|
+
.replace(/(implementation 'com\.onesignal.*')/g, `debugImplementation 'com.onesignal:OneSignal:4.7.2'
|
|
37
|
+
releaseImplementation 'com.onesignal:OneSignal:4.7.2'
|
|
38
|
+
|
|
39
|
+
huaweiImplementation 'com.huawei.hms:push:6.3.0.304'
|
|
40
|
+
|
|
41
|
+
huaweiImplementation('com.onesignal:OneSignal:4.7.2') {
|
|
42
|
+
exclude group: 'com.google.android.gms'
|
|
43
|
+
exclude group: 'com.google.firebase'
|
|
44
|
+
}`);
|
|
45
|
+
return file;
|
|
46
|
+
};
|
|
47
|
+
exports.modifyAppBuildGragleFile = modifyAppBuildGragleFile;
|
|
48
|
+
let mofidyGradleBuildFile = async (file) => {
|
|
49
|
+
return file
|
|
50
|
+
.replace(/repositories {/g, "repositories {\nmaven {url 'https://developer.huawei.com/repo/'")
|
|
51
|
+
.replace(/dependencies {/g, "dependencies {\nclasspath 'com.huawei.agconnect:agcp:1.9.0.300'");
|
|
52
|
+
};
|
|
53
|
+
exports.mofidyGradleBuildFile = mofidyGradleBuildFile;
|
|
@@ -103,17 +103,17 @@ let addGeosToAllRedirectCampaigns = async (geosToAdd) => {
|
|
|
103
103
|
console.log({
|
|
104
104
|
name: stream.name,
|
|
105
105
|
});
|
|
106
|
-
let geos = stream?.filters[0]?.payload;
|
|
106
|
+
let geos = stream?.filters[stream.type == "forced" ? 1 : 0]?.payload;
|
|
107
107
|
if (!geos)
|
|
108
108
|
continue;
|
|
109
109
|
geosToAdd.split(" ").forEach((geo) => {
|
|
110
110
|
let streamForGeo = streams.find((s) => s.name == geo);
|
|
111
|
-
if (streamForGeo && stream
|
|
111
|
+
if (streamForGeo && stream)
|
|
112
112
|
return;
|
|
113
113
|
if (!geos.includes(geo))
|
|
114
114
|
geos.push(geo);
|
|
115
115
|
});
|
|
116
|
-
stream.filters[0].payload = geos;
|
|
116
|
+
stream.filters[stream.type == "forced" ? 1 : 0].payload = geos;
|
|
117
117
|
await keitaro_service_1.KeitaroService.upsertStreamToCampaign(campaign, stream);
|
|
118
118
|
await (0, sleep_promise_1.default)(2000);
|
|
119
119
|
}
|
|
@@ -466,6 +466,6 @@ let gatherInfoForFlashApps = async () => {
|
|
|
466
466
|
// removeBrokenDomain()
|
|
467
467
|
// createFlashCampaigns(sampleApp)
|
|
468
468
|
// changeSourceForFA()
|
|
469
|
-
//
|
|
469
|
+
// addGeosToAllRedirectCam`paigns("GR")
|
|
470
470
|
// removeGeosFromAllRedirectCampaigns("BE`")
|
|
471
471
|
// gatherInfoForFlashApps()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bprotsyk/aso-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.90",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"module-alias": "^2.2.2",
|
|
30
30
|
"mongoose": "^6.8.3",
|
|
31
31
|
"react": "^18.2.0",
|
|
32
|
+
"replace-in-file": "^7.0.1",
|
|
32
33
|
"sleep-promise": "^9.1.0",
|
|
33
34
|
"styled-components": "^5.3.9"
|
|
34
35
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IAppKeitaroData } from "flash/flash-app"
|
|
1
2
|
import { PlugType } from "index"
|
|
2
3
|
|
|
3
4
|
export interface IUpsertFlashAppRequest {
|
|
@@ -15,6 +16,7 @@ export interface IUpsertFlashAppRequest {
|
|
|
15
16
|
developerEmail: string
|
|
16
17
|
developerOrganization: string
|
|
17
18
|
generationOptions: IAppGenerationOptions
|
|
19
|
+
keitaroData?: Partial<IAppKeitaroData>
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export interface IAppGenerationOptions {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export let modifyAppBuildGragleFile = async (file: string, alias: string, password: string, keyName: string) => {
|
|
2
|
+
const newSigningConfig = `
|
|
3
|
+
signingConfigs {
|
|
4
|
+
release {
|
|
5
|
+
keyAlias "${alias}"
|
|
6
|
+
keyPassword "${password}"
|
|
7
|
+
storePassword "${password}"
|
|
8
|
+
storeFile file('./${keyName}.jks')
|
|
9
|
+
v1SigningEnabled true
|
|
10
|
+
v2SigningEnabled true
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
const huaweiBlock = `
|
|
15
|
+
huawei {
|
|
16
|
+
minifyEnabled true
|
|
17
|
+
shrinkResources true
|
|
18
|
+
signingConfig signingConfigs.release
|
|
19
|
+
proguardFiles(
|
|
20
|
+
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
21
|
+
"proguard-rules.pro"
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
let updatedConfigString = file.replace(/(signingConfigs\s*{[^}]+})/, newSigningConfig.trim());
|
|
27
|
+
|
|
28
|
+
if (!file.includes("signingConfigs")) {
|
|
29
|
+
// If the signingConfigs block doesn't exist, insert it after buildTypes
|
|
30
|
+
updatedConfigString = file.replace("buildTypes {", `signingConfigs ${newSigningConfig.trim()}\n\nbuildTypes {`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
file = updatedConfigString
|
|
34
|
+
.replace("buildTypes {", `buildTypes {\n${huaweiBlock.trim()}\n`)
|
|
35
|
+
.replace("plugins {", "plugins {\n id 'com.huawei.agconnect'")
|
|
36
|
+
.replace("apply plugin: 'com.android.application'", "apply plugin: 'com.huawei.agconnect'\napply plugin: 'com.android.application'")
|
|
37
|
+
.replace(/(implementation 'com\.onesignal.*')/g, `debugImplementation 'com.onesignal:OneSignal:4.7.2'
|
|
38
|
+
releaseImplementation 'com.onesignal:OneSignal:4.7.2'
|
|
39
|
+
|
|
40
|
+
huaweiImplementation 'com.huawei.hms:push:6.3.0.304'
|
|
41
|
+
|
|
42
|
+
huaweiImplementation('com.onesignal:OneSignal:4.7.2') {
|
|
43
|
+
exclude group: 'com.google.android.gms'
|
|
44
|
+
exclude group: 'com.google.firebase'
|
|
45
|
+
}`)
|
|
46
|
+
|
|
47
|
+
return file
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export let mofidyGradleBuildFile = async (file: string) => {
|
|
51
|
+
return file
|
|
52
|
+
.replace(/repositories {/g, "repositories {\nmaven {url 'https://developer.huawei.com/repo/'")
|
|
53
|
+
.replace(/dependencies {/g, "dependencies {\nclasspath 'com.huawei.agconnect:agcp:1.9.0.300'")
|
|
54
|
+
}
|
|
55
|
+
|
|
@@ -85,15 +85,15 @@ export let addGeosToAllRedirectCampaigns = async (geosToAdd: string) => {
|
|
|
85
85
|
console.log({
|
|
86
86
|
name: stream.name,
|
|
87
87
|
})
|
|
88
|
-
let geos = stream?.filters[0]?.payload
|
|
88
|
+
let geos = stream?.filters[stream.type == "forced" ? 1 : 0]?.payload
|
|
89
89
|
if (!geos) continue
|
|
90
90
|
geosToAdd.split(" ").forEach((geo: string) => {
|
|
91
91
|
let streamForGeo = streams.find((s) => s.name == geo)
|
|
92
|
-
if (streamForGeo && stream
|
|
92
|
+
if (streamForGeo && stream) return
|
|
93
93
|
if (!geos.includes(geo)) geos.push(geo)
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
stream.filters[0].payload = geos
|
|
96
|
+
stream.filters[stream.type == "forced" ? 1 : 0].payload = geos
|
|
97
97
|
|
|
98
98
|
await KeitaroService.upsertStreamToCampaign(campaign, stream)
|
|
99
99
|
await sleep(2000)
|
|
@@ -495,7 +495,7 @@ let gatherInfoForFlashApps = async () => {
|
|
|
495
495
|
|
|
496
496
|
// createFlashCampaigns(sampleApp)
|
|
497
497
|
// changeSourceForFA()
|
|
498
|
-
//
|
|
498
|
+
// addGeosToAllRedirectCam`paigns("GR")
|
|
499
499
|
// removeGeosFromAllRedirectCampaigns("BE`")
|
|
500
500
|
|
|
501
501
|
// gatherInfoForFlashApps()
|