-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connectivity): shared codebase for apple products
Signed-off-by: George Kutsurua <[email protected]>
- Loading branch information
Showing
19 changed files
with
79 additions
and
286 deletions.
There are no files selected for viewing
File renamed without changes.
8 changes: 8 additions & 0 deletions
8
packages/connectivity_plus/connectivity_plus/apple/Classes/ConnectivityPlugin.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#if TARGET_OS_IOS | ||
#import <Flutter/Flutter.h> | ||
#elif TARGET_OS_OSX | ||
#import <FlutterMacOS/FlutterMacOS.h> | ||
#endif | ||
|
||
@interface ConnectivityPlugin : NSObject <FlutterPlugin> | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ses/PathMonitorConnectivityProvider.swift → ...ses/PathMonitorConnectivityProvider.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
packages/connectivity_plus/connectivity_plus/apple/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Flutter Project Restructurization Guide | ||
|
||
## Overview | ||
|
||
This guide outlines the process of restructuring our Flutter project to improve code organization and maintainability. We are introducing a new directory structure to consolidate common classes used across Apple's operating systems (iOS, macOS, and potentially others in the future). This approach aims to keep similar code in one place, making our codebase cleaner and more manageable. | ||
|
||
## New Directory Structure | ||
|
||
We have created a new folder named `apple` within our project's directory. This folder will contain all the classes and code snippets that are common to Apple's operating systems. By centralizing this code, we can easily manage and update it without duplicating effort across multiple files. | ||
|
||
### Implementing the `apple` Folder | ||
|
||
- **Location:** The `apple` folder is located at the root of the project's directory structure. | ||
- **Contents:** This folder will include any Dart files that contain code relevant to both iOS and macOS platforms. If the code is potentially applicable to other Apple operating systems in the future, it should also reside here. | ||
|
||
## Conditional Compilation | ||
|
||
To accommodate the differences between operating systems without needing to completely overwrite files, we will utilize conditional compilation statements. These statements allow us to compile code conditionally based on the target operating system. Examples include `#if os(macOS)` for macOS-specific code and `#if os(iOS)` for iOS-specific code. | ||
|
||
### Using Conditional Compilation | ||
|
||
1. **Identify Common Code:** First, identify code that is common across different Apple platforms but requires slight modifications based on the target OS. | ||
2. **Apply Conditional Compilation:** Use conditional compilation statements to include or exclude code blocks based on the OS. This method ensures that only relevant code is compiled for each target platform, reducing bloat and improving performance. | ||
|
||
## Benefits | ||
|
||
- **Improved Code Organization:** By keeping similar code in one place, we make our codebase more organized and navigable. | ||
- **Easier Maintenance:** Centralizing code for Apple's platforms simplifies updates and maintenance, as changes only need to be made in one location. | ||
- **Efficient Development:** Conditional compilation allows for a more efficient development process, as it eliminates the need for completely separate codebases for each platform. | ||
|
||
## Conclusion | ||
|
||
The restructurization of our Flutter project, including the introduction of the `apple` folder and the use of conditional compilation, is a strategic move to improve our codebase's maintainability and efficiency. By following this guide, we can ensure a smooth transition to the new structure and a more streamlined development process moving forward. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,22 @@ Downloaded by pub (not CocoaPods). | |
s.author = { 'Flutter Community Team' => '[email protected]' } | ||
s.source = { :http => 'https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus' } | ||
s.documentation_url = 'https://pub.dev/packages/connectivity_plus' | ||
s.source_files = 'Classes/**/*' | ||
s.public_header_files = 'Classes/**/*.h' | ||
s.dependency 'Flutter' | ||
s.source_files = [ | ||
'Classes/**/*' | ||
] | ||
s.public_header_files = [ | ||
'Classes/**/*.h' | ||
] | ||
s.ios.dependency 'Flutter' | ||
s.osx.dependency 'FlutterMacOS' | ||
s.dependency 'ReachabilitySwift' | ||
s.platform = :ios, '12.0' | ||
s.platform = { | ||
:ios => '12.0', | ||
:osx => '10.14' | ||
} | ||
s.ios.deployment_target = '12.0' | ||
s.osx.deployment_target = '10.14' | ||
s.swift_version = '5.0' | ||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } | ||
s.resource_bundles = {'connectivity_plus_privacy' => ['PrivacyInfo.xcprivacy']} | ||
s.ios.resource_bundles = {'connectivity_plus_privacy' => ['PrivacyInfo.xcprivacy']} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
apple |
4 changes: 0 additions & 4 deletions
4
packages/connectivity_plus/connectivity_plus/ios/Classes/ConnectivityPlusPlugin.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
apple |
96 changes: 0 additions & 96 deletions
96
packages/connectivity_plus/connectivity_plus/macos/Classes/ConnectivityPlugin.swift
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
packages/connectivity_plus/connectivity_plus/macos/Classes/ConnectivityProvider.swift
This file was deleted.
Oops, something went wrong.
63 changes: 0 additions & 63 deletions
63
...s/connectivity_plus/connectivity_plus/macos/Classes/PathMonitorConnectivityProvider.swift
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.