MozillaFoundation / tiktok-reporter-app-ios

1 stars 1 forks source link

first time builds do not work #18

Closed bhearsum closed 7 months ago

bhearsum commented 8 months ago

There are at least two issues here: 1) The one noted in the README - where you have to comment out functions in the Glean code. I don't know what to do about this one. 2) The included project file includes references to Generated files that do not exist. These should either not be present in the project file that's checked in, or the generated files should be checked in.

This patch to the project file is one way to fix the second issue:

diff --git a/TikTok Reporter/TikTok Reporter.xcodeproj/project.pbxproj b/TikTok Reporter/TikTok Reporter.xcodeproj/project.pbxproj
index 2eb1404..e1374d7 100644
--- a/TikTok Reporter/TikTok Reporter.xcodeproj/project.pbxproj 
+++ b/TikTok Reporter/TikTok Reporter.xcodeproj/project.pbxproj 
@@ -16,7 +16,6 @@
        684A23F22B17922D001B83AA /* ScreenRecording.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684A23F12B17922D001B83AA /* ScreenRecording.swift */; };
        684E2F2C2B1F2636006A05C8 /* Glean in Frameworks */ = {isa = PBXBuildFile; productRef = 684E2F2B2B1F2636006A05C8 /* Glean */; };
        684E2F2E2B1F2645006A05C8 /* Glean in Frameworks */ = {isa = PBXBuildFile; productRef = 684E2F2D2B1F2645006A05C8 /* Glean */; };
-       684E2F312B1F2773006A05C8 /* Metrics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684E2F302B1F2773006A05C8 /* Metrics.swift */; };
        684E2F342B20B3B5006A05C8 /* GleanManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684E2F332B20B3B5006A05C8 /* GleanManager.swift */; };
        684E2F362B20BBCF006A05C8 /* JSONMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684E2F352B20BBCF006A05C8 /* JSONMapper.swift */; };
        684E2F382B21F03E006A05C8 /* RecordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684E2F372B21F03E006A05C8 /* RecordView.swift */; };
@@ -27,7 +26,6 @@
        684E2F422B2313BC006A05C8 /* MultipartRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684E2F412B2313BC006A05C8 /* MultipartRequest.swift */; };
        684E2F442B2314A9006A05C8 /* Data+Append.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684E2F432B2314A9006A05C8 /* Data+Append.swift */; };
        684E2F462B23332F006A05C8 /* RecordingStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684E2F452B23332F006A05C8 /* RecordingStorage.swift */; };
-       684E2F4C2B235231006A05C8 /* Metrics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684E2F4B2B235231006A05C8 /* Metrics.swift */; };
        684E2F502B24C591006A05C8 /* JSONMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 684E2F352B20BBCF006A05C8 /* JSONMapper.swift */; };
        684E2F512B24C5F9006A05C8 /* Study.swift in Sources */ = {isa = PBXBuildFile; fileRef = 689FF0572AF3E03500C9FE51 /* Study.swift */; };
        684E2F522B24C621006A05C8 /* Policy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 689FF0402AF29B7400C9FE51 /* Policy.swift */; };
@@ -202,7 +200,6 @@
        684A23EC2B178D93001B83AA /* FormTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormTab.swift; sourceTree = "<group>"; };
        684A23EF2B178F12001B83AA /* SubmissionSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubmissionSuccessView.swift; sourceTree = "<group>"; };
        684A23F12B17922D001B83AA /* ScreenRecording.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenRecording.swift; sourceTree = "<group>"; };
-       684E2F302B1F2773006A05C8 /* Metrics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Metrics.swift; sourceTree = "<group>"; };
        684E2F332B20B3B5006A05C8 /* GleanManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GleanManager.swift; sourceTree = "<group>"; };
        684E2F352B20BBCF006A05C8 /* JSONMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONMapper.swift; sourceTree = "<group>"; };
        684E2F372B21F03E006A05C8 /* RecordView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecordView.swift; sourceTree = "<group>"; };
@@ -213,7 +210,6 @@
        684E2F412B2313BC006A05C8 /* MultipartRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultipartRequest.swift; sourceTree = "<group>"; };
        684E2F432B2314A9006A05C8 /* Data+Append.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+Append.swift"; sourceTree = "<group>"; };
        684E2F452B23332F006A05C8 /* RecordingStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecordingStorage.swift; sourceTree = "<group>"; };
-       684E2F4B2B235231006A05C8 /* Metrics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Metrics.swift; sourceTree = "<group>"; };
        6858A6912B0E69490076A91A /* TikTok ReporterScreenCapture.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "TikTok ReporterScreenCapture.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
        6858A6932B0E69490076A91A /* ReplayKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReplayKit.framework; path = System/Library/Frameworks/ReplayKit.framework; sourceTree = SDKROOT; };
        6858A6962B0E694A0076A91A /* SampleHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleHandler.swift; sourceTree = "<group>"; };
@@ -392,22 +388,6 @@
            path = Record;
            sourceTree = "<group>";
        };
-       684E2F2F2B1F2773006A05C8 /* Generated */ = {
-           isa = PBXGroup;
-           children = (
-               684E2F302B1F2773006A05C8 /* Metrics.swift */,
-           );
-           path = Generated;
-           sourceTree = "<group>";
-       };
-       684E2F4A2B235221006A05C8 /* Generated */ = {
-           isa = PBXGroup;
-           children = (
-               684E2F4B2B235231006A05C8 /* Metrics.swift */,
-           );
-           path = Generated;
-           sourceTree = "<group>";
-       };
        6858A6922B0E69490076A91A /* Frameworks */ = {
            isa = PBXGroup;
            children = (
@@ -822,7 +802,6 @@
        68CBF9672AEB9F2F006D03FC /* TikTok Reporter */ = {
            isa = PBXGroup;
            children = (
-               684E2F2F2B1F2773006A05C8 /* Generated */,
                683A20442B0BB70F006F8AE5 /* TikTok Reporter.entitlements */,
                689FF08B2AFD4EBD00C9FE51 /* Managers */,
                689FF0882AFD410700C9FE51 /* Helpers */,
@@ -904,7 +883,6 @@
        68FA994E2B0BA34400D65D43 /* TikTok ReporterShare */ = {
            isa = PBXGroup;
            children = (
-               684E2F4A2B235221006A05C8 /* Generated */,
                688CA4802B0CC38D001A7BBE /* Managers */,
                688CA4622B0CB3B2001A7BBE /* Views */,
                683A20452B0BB7A7006F8AE5 /* TikTok ReporterShare.entitlements */,
@@ -1222,7 +1200,6 @@
                689FF0872AFD379200C9FE51 /* FormInputField.swift in Sources */,
                689FF0752AFA2C9200C9FE51 /* OnboardingFormView.swift in Sources */,
                684E2F3A2B21F048006A05C8 /* RecordViewModel.swift in Sources */,
-               684E2F312B1F2773006A05C8 /* Metrics.swift in Sources */,
                689FF0622AF5153200C9FE51 /* RadioButton.swift in Sources */,
                684E2F462B23332F006A05C8 /* RecordingStorage.swift in Sources */,
                689FF0852AFCE86700C9FE51 /* DropDownView.swift in Sources */,
@@ -1321,7 +1298,6 @@
                684E2F632B24C917006A05C8 /* PresentationStateView.swift in Sources */,
                684E2F612B24C909006A05C8 /* IdleView.swift in Sources */,
                684E2F652B24C92F006A05C8 /* SliderView.swift in Sources */,
-               684E2F4C2B235231006A05C8 /* Metrics.swift in Sources */,
                684E2F682B24C978006A05C8 /* ErrorView.swift in Sources */,
                684E2F642B24C92A006A05C8 /* DropDownView.swift in Sources */,
                68FA99502B0BA34400D65D43 /* ShareViewController.swift in Sources */,
jmccrosky commented 8 months ago

Thanks! We don't currently have an iOS dev to work on this, but we may soon, in which case I'll get them to look at your patch. And I'll try to raise the question with the glean experts.

eliakorkmaz commented 7 months ago

Hello,

Thanks for the issue submission @bhearsum

The problem was related to the folder structure of the application, it must be fixed right now

When the application is built and compiles sources, the last step of the build is running the script

in the iOS project we are running a sdk_generator.sh shell script, which reads the yaml files and generates the Generated folder inside of this folder, generates Metrics.swift file which is generated by Glean sdk with reading yaml file for configuration, somehow. in the iOS project, there's a GleanManager.swift file that handles all of the pings. This file contains a bunch of Glean Pings-related codes

Previous developers put Generated/* folder inside to .gitignore file, so there was no Generated folder inside the code when you downloaded it, i removed this usage, because in your case, GleanManager.swift file try to reach some Glean Pings which is not generated yet.

The old scenario was like this:

  1. Build the app
  2. The app will be built, the run script will work and there will be Generated/ folder
  3. Drag and Drop this Generated/ folder into the Project structure
  4. Now, GleanManager can see all of the Pings by creating Glean

Current scenario:

  1. You can run the application, it will be run without an error
  2. If you have changes on yaml file, or if your telemetry data changes, change the yaml, build the app, and replace the current Generated/ folder with the newly generated Generated/ folder by Glean sdk