Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ migrate_working_dir/
**/doc/api/
.dart_tool/
.packages
**/.swiftpm/
build/

# Project
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG_UNRELEASED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## 4.0.0

### Breaking changes

- Require Flutter 3.44.0 or later.
- Require Dart 3.12.0 or later.
- Require iOS 16.0 or later.

### Added

- Add Swift Package Manager support for the iOS plugin while keeping CocoaPods support.
- Migrate the iOS example app to Swift Package Manager.

### Notes

- Document the `-ObjC` linker flag required by SitumSDK when using Swift Package Manager.
- Update WebView Flutter dependencies to versions that can participate in a Swift Package Manager iOS build.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ There is a comprehensive tutorial on how to set-up a new application using this
Below you will find the basic steps to install and configure the plugin on your Flutter project.
These steps have already been done for you in the example application of this repository, but they are required for other projects.

## Requirements

Starting with version 4.0.0, this plugin requires:

- Flutter 3.44.0 or later
- Dart 3.12.0 or later
- iOS 16.0 or later

## Running the example

Check the [example/README](./example/README.md) file of this repository to create your first Flutter application using Situm Flutter.
Expand Down Expand Up @@ -56,11 +64,31 @@ up a Situm account.

### iOS

1. Remove the "use_frameworks!" directive in the `Podfile` of your iOS project:
On iOS, the plugin supports both CocoaPods and Swift Package Manager for native
dependencies. Flutter 3.44.0 and later enables Swift Package Manager by default.

When using Swift Package Manager, add `$(inherited) -ObjC` to your app target's
`Other Linker Flags` build setting. This is required by SitumSDK's Swift package.

> [!NOTE]
> The repository folder name requirement only affects local development of this
> repository and the bundled example app when using Swift Package Manager. Apps
> that consume `situm_flutter` from pub.dev are not affected.
>
> For local development with the example app and Swift Package Manager, clone or
> place this repository in a folder named `situm_flutter`. Some Flutter versions
> generate local Swift package overrides using the plugin directory name, and a
> different checkout folder name can cause Swift package resolution failures.

If your project uses CocoaPods:

1. Remove the "use_frameworks!" directive in the `Podfile` of your iOS project.

2. Run `pod install` or `pod update` to bring the dependencies to your project.

3. Declare the following permissions in your app's `Info.plist` file to successfully start positioning:
For both CocoaPods and Swift Package Manager:

1. Declare the following permissions in your app's `Info.plist` file to successfully start positioning:

```
<key>NSLocationWhenInUseUsageDescription</key>
Expand All @@ -71,7 +99,7 @@ up a Situm account.
<string>We use your phone sensors (giroscope, accelerometer and altimeter) to improve location quality</string>
```

4. For offline support you will have to add the underlying web application's domain inside the entry `WKAppBoundDomains` on `Info.plist` as follows:
2. For offline support you will have to add the underlying web application's domain inside the entry `WKAppBoundDomains` on `Info.plist` as follows:

```
<key>WKAppBoundDomains</key>
Expand Down
29 changes: 15 additions & 14 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ steps:
- checkout: self
fetchTags: false
fetchDepth: 1
path: flutter
path: situm_flutter
displayName: checkout self

- template: azure-templates/static-analyse.yml@sys_kubernetes_templates
parameters:
repoFolder: $(Pipeline.Workspace)/flutter
repoFolder: $(Pipeline.Workspace)/situm_flutter
teams: mobile
phase: semgrep

Expand All @@ -61,8 +61,8 @@ steps:

export PATH="$PATH:$(Agent.BuildDirectory)/binaries/flutter/bin"

if [ -d "flutter" ];then
cd $(Pipeline.Workspace)/flutter
if [ -d "$(Pipeline.Workspace)/situm_flutter" ];then
cd $(Pipeline.Workspace)/situm_flutter
fi

echo -e "\n[+] Get Dependencies\n"
Expand All @@ -73,14 +73,15 @@ steps:

- template: azure-templates/static-analyse.yml@sys_kubernetes_templates
parameters:
repoFolder: $(Pipeline.Workspace)/flutter
repoFolder: $(Pipeline.Workspace)/situm_flutter
teams: mobile
phase: trivy

- ${{ if contains(variables['Build.SourceBranch'], 'release/') }}:
- checkout: self
fetchTags: false
fetchDepth: 1
path: situm_flutter
displayName: checkout self

- ${{ if eq(variables['Build.Reason'],'manual') }}:
Expand Down Expand Up @@ -109,8 +110,8 @@ steps:
- bash: |

set -euo pipefail
if [ -d "flutter" ];then
cd flutter
if [ -d "$(Pipeline.Workspace)/situm_flutter" ];then
cd $(Pipeline.Workspace)/situm_flutter
fi
currentBranch=$(echo $(Build.SourceBranch) | cut -d "/" -f 3,4)
echo "##vso[task.setvariable variable=currentBranch]$(echo $currentBranch)"
Expand Down Expand Up @@ -151,8 +152,8 @@ steps:

- bash: |
set -euo pipefail
if [ -d "flutter" ];then
cd flutter
if [ -d "$(Pipeline.Workspace)/situm_flutter" ];then
cd $(Pipeline.Workspace)/situm_flutter
fi
#Export binary paths
export PATH="$PATH:$(Agent.BuildDirectory)/binaries/flutter/bin"
Expand Down Expand Up @@ -188,7 +189,7 @@ steps:
bitbucket_user: situmops
system: "N/A"
server: "github"
repofolder: "flutter"
repofolder: "situm_flutter"
mergeBranches:
- "master"
- "develop"
Expand Down Expand Up @@ -219,8 +220,8 @@ steps:
echo -e "\n[+] Create temporary token \n"
gcloud auth print-identity-token --audiences=https://pub.dev | dart pub token add https://pub.dev

if [ -d "flutter" ];then
cd flutter
if [ -d "$(Pipeline.Workspace)/situm_flutter" ];then
cd $(Pipeline.Workspace)/situm_flutter
fi

echo -e "\n[+] Publish flutter package\n"
Expand All @@ -231,8 +232,8 @@ steps:
- bash: |

set -euo pipefail
if [ -d "flutter" ]; then
cd flutter
if [ -d "$(Pipeline.Workspace)/situm_flutter" ]; then
cd $(Pipeline.Workspace)/situm_flutter
fi

echo -e "\n[+] Pull master changes and change to master branch \n"
Expand Down
16 changes: 13 additions & 3 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,29 @@ This folder contains the necessary source code for an example application using
The first step is to download this repo:

```bash
git clone https://github.com/situmtech/flutter.git
git clone https://github.com/situmtech/flutter.git situm_flutter
```

And then install the plugin dependencies alongside the `example` app as follows:

```bash
cd flutter/example
cd situm_flutter/example
flutter pub get
```

#### iOS only

Run `pod install` or `pod update` from the `example/ios` folder to bring the dependencies to your project.
The bundled example app uses Swift Package Manager for iOS dependencies.

> [!NOTE]
> This limitation only affects local development of this repository and the
> bundled example app when using Swift Package Manager. Apps that consume
> `situm_flutter` from pub.dev are not affected.
>
> When running this example app on iOS with Swift Package Manager, make sure the
> repository directory is named `situm_flutter`. Some Flutter versions generate
> local Swift package overrides using the plugin directory name, and a different
> checkout folder name can cause Swift package resolution failures.

Also check out the project [code signing](https://developer.apple.com/support/code-signing/) before you run the example.

Expand Down
4 changes: 4 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
# This builtInKotlin flag was added automatically by Flutter migrator
android.builtInKotlin=false
# This newDsl flag was added automatically by Flutter migrator
android.newDsl=false
14 changes: 3 additions & 11 deletions example/azure/build-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ steps:

sudo xcode-select -switch $(xcodeVersion)

cd example/ios/fastlane
cd $(Pipeline.Workspace)/situm_flutter/example/ios/fastlane

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Que é Pipeline.Workspace? De onde sae?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


echo -e "\n[+] Setting Apple connection options"

Expand All @@ -71,14 +71,6 @@ steps:
echo -e "\t[+] IPHONEOS_DEPLOYMENT_TARGET: $IPHONEOS_DEPLOYMENT_TARGET"


echo -e "\n[+] Pod deintegrate command \n"
cd ..
rm -rf Podfile.lock
pod deintegrate

echo -e "\n[+] Pod install with --repo-update option \n"
pod install --repo-update

echo -e "\n[+] Build example with fastlane \n"
fastlane ios beta

Expand All @@ -87,13 +79,13 @@ steps:
- ${{ if contains(parameters.system, 'ubuntu') }}:
- bash: |
export PATH="$PATH:$(Agent.BuildDirectory)/binaries/flutter/bin"
cd example
cd $(Pipeline.Workspace)/situm_flutter/example

flutter build apk
displayName: Build

- bash: |
cd example
cd $(Pipeline.Workspace)/situm_flutter/example

if [[ "$(Build.Reason)" == "Manual" ]];then
folder="$(FlutterExample_folder)/Manual"
Expand Down
4 changes: 3 additions & 1 deletion example/azure/common-steps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ steps:
- checkout: self
fetchDepth: 1
fetchTags: false
path: situm_flutter
displayName: Clone repository

- bash: |
cd $(Pipeline.Workspace)/situm_flutter
pluginVersion=$(grep "^version: [0-9\.].*$" pubspec.yaml | awk -F":" '{print $2}')
echo "##vso[task.setvariable variable=pluginVersion]$(echo $pluginVersion)"
cd example
Expand Down Expand Up @@ -69,7 +71,7 @@ steps:

- bash: |
export PATH="$PATH:$(Agent.BuildDirectory)/binaries/flutter/bin"
cd example
cd $(Pipeline.Workspace)/situm_flutter/example

echo -e "\n[+] Install flutter dependencies\n"
flutter pub get
Expand Down
49 changes: 0 additions & 49 deletions example/ios/Podfile

This file was deleted.

39 changes: 0 additions & 39 deletions example/ios/Podfile.lock

This file was deleted.

Loading