Skip to content

feat(ios): Add iOS platform support with Local/Remote flavors#598

Merged
HankYuLinksys merged 4 commits intodev-2.0.0from
hank/privacy-gui-ios
Jan 26, 2026
Merged

feat(ios): Add iOS platform support with Local/Remote flavors#598
HankYuLinksys merged 4 commits intodev-2.0.0from
hank/privacy-gui-ios

Conversation

@HankYuLinksys
Copy link
Collaborator

@HankYuLinksys HankYuLinksys commented Jan 23, 2026

User description

Summary

  • Add iOS platform support with Local and Remote flavors
  • Configure xcconfig-based build configurations (Debug-Local, Debug-Remote, Release-Local, Release-Remote)
  • Add Xcode schemes for Local and Remote builds
  • Implement runtime bundle ID detection for force mode (forceCommandType) on iOS/Android
  • Add VSCode launch configurations for iOS Local/Remote debugging
  • Web platform unchanged — continues using --dart-define=force=xxx at compile time

Build Methods

Method Local Remote
Xcode Select "Local" scheme Select "Remote" scheme
VSCode linksys - iOS (Local) linksys - iOS (Remote)
CLI flutter run --flavor Local flutter run --flavor Remote

Configuration

Flavor Bundle ID App Name
Local com.linksys.privacygui.local Linksys (Local)
Remote com.linksys.privacygui.remote Linksys (Remote)

Force Mode Detection

  • iOS/Android: Automatically detected from bundle ID suffix (.local / .remote) at runtime
  • Web: Unchanged — uses --dart-define=force=xxx at compile time

PR Type

Enhancement


Description

  • Add complete iOS platform support with Local/Remote build flavors

  • Implement xcconfig-based build configuration system for four variants

  • Add Xcode schemes and VSCode launch configurations for iOS debugging

  • Implement runtime bundle ID detection for iOS/Android force mode

  • Update Podfile to support four build configurations


Diagram Walkthrough

flowchart LR
  A["BuildConfig.load()"] -- "detect bundle ID" --> B["iOS/Android Runtime Detection"]
  B -- "ends with .local" --> C["ForceCommand.local"]
  B -- "ends with .remote" --> D["ForceCommand.remote"]
  E["Xcode Build"] -- "Local scheme" --> F["Debug-Local/Release-Local"]
  E -- "Remote scheme" --> G["Debug-Remote/Release-Remote"]
  F -- "uses Local.xcconfig" --> H["com.linksys.privacygui.local"]
  G -- "uses Remote.xcconfig" --> I["com.linksys.privacygui.remote"]
  J["VSCode Launch"] -- "iOS Local config" --> F
  J -- "iOS Remote config" --> G
Loading

File Walkthrough

Relevant files
Enhancement
3 files
build_config.dart
Add runtime bundle ID detection for iOS/Android                   
+26/-1   
main.dart
Await BuildConfig.load() for async initialization               
+1/-1     
AppDelegate.swift
Add Swift AppDelegate for iOS app initialization                 
+13/-0   
Configuration changes
20 files
.metadata
Update Flutter SDK revision and platform metadata               
+7/-7     
launch.json
Add iOS Local/Remote debug configurations                               
+26/-8   
Podfile
Update build configurations and remove RunnerTests target
+7/-7     
Shared.xcconfig
Define shared iOS build settings and base bundle ID           
+20/-0   
Local.xcconfig
Configure Local flavor bundle ID and app name                       
+16/-0   
Remote.xcconfig
Configure Remote flavor bundle ID and app name                     
+16/-0   
Debug-Local.xcconfig
Include Local and Pods debug configuration                             
+13/-0   
Debug-Remote.xcconfig
Include Remote and Pods debug configuration                           
+13/-0   
Release-Local.xcconfig
Include Local and Pods release configuration                         
+9/-0     
Release-Remote.xcconfig
Include Remote and Pods release configuration                       
+9/-0     
AppFrameworkInfo.plist
Add Flutter framework metadata plist file                               
+26/-0   
project.pbxproj
Add complete Xcode project configuration with four build variants
+672/-0 
Local.xcscheme
Add Xcode scheme for Local build configuration                     
+80/-0   
Remote.xcscheme
Add Xcode scheme for Remote build configuration                   
+80/-0   
contents.xcworkspacedata
Add Xcode workspace configuration file                                     
+10/-0   
Info.plist
Add iOS app metadata and configuration plist                         
+49/-0   
Main.storyboard
Add iOS main storyboard with FlutterViewController             
+29/-0   
LaunchScreen.storyboard
Add iOS launch screen storyboard                                                 
+37/-0   
Contents.json
Add app icon asset catalog configuration                                 
+122/-0 
Runner-Bridging-Header.h
Add Swift-Objective-C bridging header                                       
+1/-0     
Additional files
9 files
flutter_lldb_helper.py +0/-32   
flutter_lldbinit +0/-5     
contents.xcworkspacedata +7/-0     
IDEWorkspaceChecks.plist +8/-0     
WorkspaceSettings.xcsettings +8/-0     
IDEWorkspaceChecks.plist +8/-0     
WorkspaceSettings.xcsettings +10/-0   
Contents.json +23/-0   
README.md +5/-0     

- Add xcconfig-based build configuration system:
  - Shared.xcconfig: Common settings (iOS 14.0, Swift 5.0, base bundle ID)
  - Local.xcconfig: Bundle ID suffix .local, app name "Linksys (Local)"
  - Remote.xcconfig: Bundle ID suffix .remote, app name "Linksys (Remote)"
  - Debug-Local/Debug-Remote/Release-Local/Release-Remote.xcconfig for each build variant

- Add Xcode schemes:
  - Local.xcscheme: Uses Debug-Local/Release-Local configurations
  - Remote.xcscheme: Uses Debug-Remote/Release-Remote configurations

- Update Podfile to support 4 build configurations

- Update build_config.dart:
  - Add runtime bundle ID detection for iOS/Android platforms
  - Web continues to use String.fromEnvironment('force') at compile time
  - Await BuildConfig.load() in main.dart to ensure initialization

- Update VSCode launch.json:
  - Add "linksys - iOS (Local)" configuration
  - Add "linksys - iOS (Remote)" configuration
  - Reorder configurations (Local before Remote)

- Remove old Flutter default configurations:
  - Delete Debug.xcconfig and Release.xcconfig
  - Delete RunnerTests
@qodo-code-review
Copy link

qodo-code-review bot commented Jan 23, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Build script sandboxing

Description: The build settings disable Xcode user script sandboxing (ENABLE_USER_SCRIPT_SANDBOXING =
NO) for multiple configurations, which can increase build-time supply-chain risk by
allowing arbitrary build phase scripts (including from dependencies) broader
filesystem/network access than necessary.
project.pbxproj [374-453]

Referred Code
	ENABLE_USER_SCRIPT_SANDBOXING = NO;
	GCC_C_LANGUAGE_STANDARD = gnu99;
	GCC_DYNAMIC_NO_PIC = NO;
	GCC_NO_COMMON_BLOCKS = YES;
	GCC_OPTIMIZATION_LEVEL = 0;
	GCC_PREPROCESSOR_DEFINITIONS = (
		"DEBUG=1",
		"$(inherited)",
	);
	GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
	GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
	GCC_WARN_UNDECLARED_SELECTOR = YES;
	GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
	GCC_WARN_UNUSED_FUNCTION = YES;
	GCC_WARN_UNUSED_VARIABLE = YES;
	MTL_ENABLE_DEBUG_INFO = YES;
	ONLY_ACTIVE_ARCH = YES;
	SDKROOT = iphoneos;
	TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Debug-Local";


 ... (clipped 59 lines)
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Missing error handling: BuildConfig.load() awaits SharedPreferences.getInstance() and PackageInfo.fromPlatform()
without any try/catch or fallback behavior, which can crash startup on platform/plugin
failure.

Referred Code
static Future<void> load() async {
  logger.d('load build configuration');
  final prefs = await SharedPreferences.getInstance();
  final envStr = prefs.getString(pCloudEnv);
  cloudEnvTarget = CloudEnvironment.get(envStr ?? '') ?? cloudEnvTarget;
  logger.d('Cloud Env: $cloudEnvTarget');

  // For non-Web platforms (iOS/Android): determine force mode from bundle ID
  // Web uses String.fromEnvironment('force') set at compile time
  //
  // iOS: Bundle ID is set via PRODUCT_BUNDLE_IDENTIFIER in xcconfig
  //   - Local: com.linksys.privacygui.local
  //   - Remote: com.linksys.privacygui.remote
  //
  // Android: Application ID should be configured in build.gradle with flavors:
  //   flavorDimensions "mode"
  //   productFlavors {
  //       local { applicationIdSuffix ".local" }
  //       remote { applicationIdSuffix ".remote" }
  //   }
  if (!kIsWeb) {


 ... (clipped 10 lines)

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status:
Unstructured debug logs: Newly added logger.d(...) entries are plain text (non-JSON/non-structured), reducing
auditability and violating the requirement for structured logs.

Referred Code
logger.d('load build configuration');
final prefs = await SharedPreferences.getInstance();
final envStr = prefs.getString(pCloudEnv);
cloudEnvTarget = CloudEnvironment.get(envStr ?? '') ?? cloudEnvTarget;
logger.d('Cloud Env: $cloudEnvTarget');

// For non-Web platforms (iOS/Android): determine force mode from bundle ID
// Web uses String.fromEnvironment('force') set at compile time
//
// iOS: Bundle ID is set via PRODUCT_BUNDLE_IDENTIFIER in xcconfig
//   - Local: com.linksys.privacygui.local
//   - Remote: com.linksys.privacygui.remote
//
// Android: Application ID should be configured in build.gradle with flavors:
//   flavorDimensions "mode"
//   productFlavors {
//       local { applicationIdSuffix ".local" }
//       remote { applicationIdSuffix ".remote" }
//   }
if (!kIsWeb) {
  final packageInfo = await PackageInfo.fromPlatform();


 ... (clipped 9 lines)

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

qodo-code-review bot commented Jan 23, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Pass flavor directly via build variables

Instead of inferring the build flavor from the bundle ID at runtime, pass it
directly from the native build configuration to Dart. This can be done by
setting a DART_DEFINES value in the flavor-specific .xcconfig files.

Examples:

lib/constants/build_config.dart [103-113]
    if (!kIsWeb) {
      final packageInfo = await PackageInfo.fromPlatform();
      final bundleId = packageInfo.packageName;
      if (bundleId.endsWith('.local')) {
        forceCommandType = ForceCommand.local;
      } else if (bundleId.endsWith('.remote')) {
        forceCommandType = ForceCommand.remote;
      }
      // Otherwise, keep ForceCommand.none (default)
      logger.d('Non-Web platforms: Force command type: $forceCommandType');

 ... (clipped 1 lines)
ios/Flutter/Configs/Local.xcconfig [16]
// Note: DART_DEFINES is intentionally not set here.

Solution Walkthrough:

Before:

// lib/constants/build_config.dart
class BuildConfig {
  static ForceCommand forceCommandType = ForceCommand.none;

  static Future<void> load() async {
    if (!kIsWeb) {
      final packageInfo = await PackageInfo.fromPlatform();
      final bundleId = packageInfo.packageName;
      if (bundleId.endsWith('.local')) {
        forceCommandType = ForceCommand.local;
      } else if (bundleId.endsWith('.remote')) {
        forceCommandType = ForceCommand.remote;
      }
    }
  }
}

After:

// ios/Flutter/Configs/Local.xcconfig
#include "Shared.xcconfig"
PRODUCT_BUNDLE_IDENTIFIER = $(BASE_BUNDLE_ID).local
APP_DISPLAY_NAME = Linksys (Local)
DART_DEFINES = $(DART_DEFINES),FORCE_COMMAND_TYPE=local

// lib/constants/build_config.dart
class BuildConfig {
  static ForceCommand forceCommandType = ForceCommand.values.byName(
    const String.fromEnvironment('FORCE_COMMAND_TYPE', defaultValue: 'none')
  );

  static Future<void> load() async {
    // The flavor is now determined at compile-time.
    // The runtime check on packageInfo is no longer needed.
    // ... other loading logic ...
  }
}

Suggestion importance[1-10]: 8

__

Why: This is a significant design improvement that replaces a brittle runtime check on the bundle ID with a robust, explicit, and idiomatic compile-time configuration via DART_DEFINES, enhancing maintainability.

Medium
Possible issue
Remove hardcoded development team ID
Suggestion Impact:The commit removed the hardcoded DEVELOPMENT_TEAM = SD9SVWP2H8; setting from multiple build configurations in ios/Runner.xcodeproj/project.pbxproj.

code diff:

@@ -400,7 +404,6 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
-				DEVELOPMENT_TEAM = SD9SVWP2H8;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = Runner/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = (
@@ -478,7 +481,6 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
-				DEVELOPMENT_TEAM = SD9SVWP2H8;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = Runner/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = (
@@ -553,7 +555,6 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
-				DEVELOPMENT_TEAM = SD9SVWP2H8;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = Runner/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = (
@@ -627,7 +628,6 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
-				DEVELOPMENT_TEAM = SD9SVWP2H8;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = Runner/Info.plist;

Remove the hardcoded DEVELOPMENT_TEAM ID from project.pbxproj to avoid causing
build and signing issues for other developers. Team IDs should be configured
locally.

ios/Runner.xcodeproj/project.pbxproj [396-410]

 ...
 		9F3E4DC12F208DC800F508EE /* Debug-Local */ = {
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 9F3E4DD82F20BA1600F508EE /* Debug-Local.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
-				DEVELOPMENT_TEAM = SD9SVWP2H8;
 				ENABLE_BITCODE = NO;
 				INFOPLIST_FILE = Runner/Info.plist;
 ...

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a hardcoded DEVELOPMENT_TEAM ID, which is a significant issue for team collaboration, and recommends its removal to prevent build failures for other developers.

Medium
Restore removed Android platform configuration

The android platform configuration was removed from the .metadata file. Restore
it if Android support is still intended for the project.

.metadata [13-20]

 migration:
   platforms:
     - platform: root
       create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
-      base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
+      base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+    - platform: android
+      create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+      base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
     - platform: ios
       create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
       base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: This suggestion correctly identifies the removal of the android platform configuration, which could be an unintentional and critical breaking change. It prompts the author to verify this change.

Medium
Guard flavor detection call

Wrap the PackageInfo.fromPlatform() call in a try-catch block to handle
potential exceptions and prevent the app from crashing during startup if it
fails.

lib/constants/build_config.dart [104-110]

-final packageInfo = await PackageInfo.fromPlatform();
-final bundleId = packageInfo.packageName;
-if (bundleId.endsWith('.local')) {
-  forceCommandType = ForceCommand.local;
-} else if (bundleId.endsWith('.remote')) {
-  forceCommandType = ForceCommand.remote;
+try {
+  final packageInfo = await PackageInfo.fromPlatform();
+  final bundleId = packageInfo.packageName;
+  if (bundleId.endsWith('.local')) {
+    forceCommandType = ForceCommand.local;
+  } else if (bundleId.endsWith('.remote')) {
+    forceCommandType = ForceCommand.remote;
+  }
+} catch (e, st) {
+  logger.w('Failed to detect bundle ID for flavor', e, st);
 }
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly recommends adding error handling around a platform-specific API call, which improves the application's robustness during startup.

Low
General
Include program path
Suggestion Impact:The commit added `"program": "lib/main.dart"` to the `linksys - iOS (Local)` launch configuration as suggested, and also added the same field to the `linksys - iOS (Remote)` configuration.

code diff:

@@ -41,7 +41,8 @@
             "toolArgs": [
                 "--flavor",
                 "Local"
-            ]
+            ],
+            "program": "lib/main.dart"
         },
         {
             "name": "linksys - iOS (Remote)",
@@ -50,7 +51,8 @@
             "toolArgs": [
                 "--flavor",
                 "Remote"
-            ]
+            ],
+            "program": "lib/main.dart"
         }

Add the "program": "lib/main.dart" field to the linksys - iOS (Local) launch
configuration in .vscode/launch.json to specify the application entrypoint for
VSCode.

.vscode/launch.json [37-44]

 {
     "name": "linksys - iOS (Local)",
     "request": "launch",
     "type": "dart",
+    "program": "lib/main.dart",
     "toolArgs": [
         "--flavor",
         "Local"
     ]
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 5

__

Why: The suggestion correctly points out a missing program field in a VSCode launch configuration, which is necessary for the debugger to function correctly.

Low
  • Update

- Add explicit program entry point to iOS launch configurations in VSCode
- Remove hardcoded DEVELOPMENT_TEAM from project.pbxproj
- Add empty inputPaths/outputPaths arrays for Pods framework embedding
@HankYuLinksys HankYuLinksys merged commit 81b48b2 into dev-2.0.0 Jan 26, 2026
2 checks passed
@HankYuLinksys HankYuLinksys deleted the hank/privacy-gui-ios branch January 26, 2026 02:04
@HankYuLinksys HankYuLinksys linked an issue Jan 27, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add iOS platform support

2 participants