1- import { AppInfo } from "./models/app-info" ;
21import { AppCrash } from "./models/app-crash" ;
32import { EnvConfig } from "./utils/env-config" ;
43
@@ -7,14 +6,11 @@ export const crashlyticsImgUrl = "https://github.com/oddbit/firebase-alerts/raw/
76/**
87 * Generate a URL to Firebase Console for the issue
98 *
10- * @param {AppInfo } appInfo
119 * @param {AppCrash } appCrash
1210 * @return {string } URL to Firebase console
1311 */
14- export function makeCrashlyticsIssueUrl (
15- appInfo : AppInfo ,
16- appCrash : AppCrash , ) : string {
17- return `https://console.firebase.google.com/project/${ EnvConfig . projectId } /crashlytics/app/${ appInfo . platform } :${ appInfo . bundleId } /issues/${ appCrash . issueId } ` ;
12+ export function makeCrashlyticsIssueUrl ( appCrash : AppCrash ) : string {
13+ return `https://console.firebase.google.com/project/${ EnvConfig . projectId } /crashlytics/app/${ EnvConfig . platform } :${ EnvConfig . bundleId } /issues/${ appCrash . issueId } ` ;
1814}
1915
2016/**
@@ -27,43 +23,37 @@ export function makeFirebaseAppsSettingsUrl(): string {
2723}
2824
2925/**
30- * Generate a URL to Firestore app info document
26+ * Make a repository URL to create an issue from this app crash
3127 *
32- * @param {AppInfo } appInfo
33- * @return {string } URL to Firebase console
34- */
35- export function makeFirestoreAppInfoUrl ( appInfo : AppInfo ) : string {
36- return `https://console.firebase.google.com/project/${ EnvConfig . projectId } /firestore/data/~2F${ process . env . EXT_INSTANCE_ID } -apps~2F${ appInfo . appId } ` ;
37- }
38-
39- /**
40- * Make an Github URL to create an issue from this app crash
41- *
42- * @param {AppInfo } appInfo
4328 * @param {AppCrash } appCrash
4429 * @return {string } URL to create a github issue
4530 */
46- export function makeGithubIssueUrl (
47- appInfo : AppInfo ,
48- appCrash : AppCrash , ) : string {
49- const attributes = [
50- `title=${ encodeURI ( appCrash . issueTitle ) } ` ,
51- `labels=${ appCrash . tags . map ( ( tag ) => encodeURI ( tag ) ) . join ( "," ) } ` ,
52- ] ;
53-
54- return `https://github.com/${ appInfo . github ?. repo } /issues/new?${ attributes . join ( "&" ) } ` ;
31+ export function makeRepositoryIssueUrl ( appCrash : AppCrash ) : string {
32+ const repositoryUrl = EnvConfig . repositoryUrl ;
33+ if ( repositoryUrl . startsWith ( "https://github.com" ) ) {
34+ const attributes = [
35+ `title=${ encodeURI ( appCrash . issueTitle ) } ` ,
36+ `labels=${ appCrash . tags . map ( ( tag ) => encodeURI ( tag ) ) . join ( "," ) } ` ,
37+ ] ;
38+
39+ return `${ repositoryUrl } /issues/new?${ attributes . join ( "&" ) } ` ;
40+ }
41+
42+ throw new Error ( "Unknown repository type: " + repositoryUrl ) ;
5543}
5644
5745/**
58- * Make an Github URL to search for issues from this app crash
46+ * Make a repository URL to search for issues from this app crash
5947 *
60- * @param {AppInfo } appInfo
6148 * @param {AppCrash } appCrash
6249 * @return {string } URL to search for github issues
6350 */
64- export function makeGithubSearchUrl (
65- appInfo : AppInfo ,
66- appCrash : AppCrash , ) : string {
67- return `https://github.com/${ appInfo . github ?. repo } /issues?q=${ encodeURI ( appCrash . issueTitle ) } ` ;
51+ export function makeRepositorySearchUrl ( appCrash : AppCrash ) : string {
52+ const repositoryUrl = EnvConfig . repositoryUrl ;
53+ if ( repositoryUrl . startsWith ( "https://github.com" ) ) {
54+ return `${ repositoryUrl } /issues?q=${ encodeURI ( appCrash . issueTitle ) } ` ;
55+ }
56+
57+ throw new Error ( "Unknown repository type: " + repositoryUrl ) ;
6858}
6959
0 commit comments