Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build iOS version #203

Merged
merged 33 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8473958
Adding iOS build changes to experment
Oct 28, 2022
c8548d3
Some changes
Nov 1, 2022
4273966
Update lock
Nov 3, 2022
53f98ec
Update experments
Nov 17, 2022
9abbcc0
Experments
Nov 18, 2022
c9dfda8
Progress
Nov 18, 2022
1561b48
Adjusted to iOS screens
Nov 19, 2022
10a7920
Fixing Download, Select File functions, adding icon
Nov 24, 2022
f817bc6
Added select media for iOS
Nov 25, 2022
165a910
Cleanup on IPA validation
Nov 25, 2022
337fdda
Cleanup and adding stage
Dec 8, 2022
64c4fac
Small double button fix and documentation
Dec 8, 2022
2779d85
Small fixes for button and file selector
Dec 9, 2022
0072f30
Add push capabilities
Dec 10, 2022
af77a86
Merge branch 'main' into ios-build
donpui Dec 14, 2022
78f678e
Update flutter-intro-slider to newest commit
Dec 16, 2022
8363df6
Added resource and debug label parameter
Dec 16, 2022
3d4e921
Update submodules and lock files
Dec 21, 2022
25bfecc
Merge branch 'main' into ios-build
donpui Dec 21, 2022
6dabf9b
Editable config (#209)
wuan Dec 21, 2022
efe49c7
Stage_la updated
Dec 22, 2022
7116aab
Fix small mixtakes after merge
Dec 22, 2022
7f2f128
Added notes regarding ios and some typos fix
Dec 22, 2022
e6b0dbb
Merge changes from main
Dec 23, 2022
b82dfa7
Ios build improvements (#219)
donpui Jan 19, 2023
cfab804
Update submodule
donpui Jan 19, 2023
ad2c840
Revert "Update dart submodule"
donpui Jan 19, 2023
f7e6dce
Update submodule
donpui Jan 19, 2023
3e1e3c2
Update version to 1.0.3
donpui Jan 19, 2023
bbbfeb1
Fix styling issue
donpui Jan 19, 2023
c2a1fee
Add wakelock to keep screen on (#215)
donpui Jan 19, 2023
b7bd4c6
Merge branch 'main' into ios-build
donpui Jan 19, 2023
0332866
Fix static error after update branch
donpui Jan 19, 2023
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
52 changes: 44 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

Expand All @@ -40,7 +40,7 @@ jobs:

# We are building debug version APK which can be manually install, however it cannot be reused for upload to store
- name: "Build debug apk"
run: "flutter build apk lib/main_la.dart -v --dart-define version=${{ env.DESTINY_VERSION }} --build-name ${{ env.DESTINY_VERSION }} --debug"
run: "flutter build apk lib/main_la.dart --dart-define version=${{ env.DESTINY_VERSION }} --build-name ${{ env.DESTINY_VERSION }} --debug"

- name: "Move apk"
run: mv ./build/app/outputs/flutter-apk/app-debug.apk destiny_android_${{ env.DESTINY_VERSION }}.apk
Expand All @@ -65,7 +65,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
run: "sudo apt update && sudo apt install ninja-build libgtk-3-dev libgtkmm-3.0-dev libfuse2"

- name: "Build for linux"
run: "flutter build linux lib/main_la.dart -v --dart-define version=${{ env.DESTINY_VERSION }}"
run: "flutter build linux lib/main_la.dart --dart-define version=${{ env.DESTINY_VERSION }}"

- name: "rpath workaround"
run: |
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
run: "flutter config --enable-macos-desktop"

- name: "Build mac app"
run: "flutter build macos lib/main_la.dart --debug -v --dart-define version=${{ env.DESTINY_VERSION }} --build-name ${{ env.DESTINY_VERSION }}"
run: "flutter build macos lib/main_la.dart --debug --dart-define version=${{ env.DESTINY_VERSION }} --build-name ${{ env.DESTINY_VERSION }}"

- name: "Install create-dmg"
run: "brew install create-dmg"
Expand All @@ -196,12 +196,48 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.ref_type == 'tag' }}

ios:
runs-on: macos-latest

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Set version string for release"
run: echo DESTINY_VERSION=${{ github.ref_name }} >> $GITHUB_ENV
if: ${{ github.ref_type == 'tag' }}

- name: "Set version string for branch"
run: echo DESTINY_VERSION=${{ github.head_ref }} >> $GITHUB_ENV
if: ${{ github.ref_type != 'tag' }}

- name: "Setup flutter"
uses: "subosito/flutter-action@v2.4.0"

- name: "Fetch flutter dependencies"
run: "flutter pub get"

# TODO remove the || true when this should be enforced
# Right now it is just informational
- name: "Lint"
run: "flutter analyze || true"

- name: "Style check"
run: "flutter format --set-exit-if-changed lib test"

- name: "Build ios app (only for simulator)"
run: |
export GOROOT=`go env GOROOT`
flutter build ios lib/main_la.dart --debug --simulator --no-codesign --dart-define version=${{ env.DESTINY_VERSION }} --build-name ${{ env.DESTINY_VERSION }}

windows:
runs-on: windows-latest

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

Expand All @@ -226,7 +262,7 @@ jobs:
run: "flutter format --set-exit-if-changed lib test"

- name: "Build windows"
run: "flutter build windows lib/main_la.dart -v --dart-define version=${{ env.DESTINY_VERSION }}"
run: "flutter build windows lib/main_la.dart --dart-define version=${{ env.DESTINY_VERSION }}"

- name: "Copy VC++ redistributables"
run: |
Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Destiny is a secure file transfer application that allows people to transfer files without needing to reveal their identities to each other or the service provider. All files are end-to-end encrypted, meaning no one except the sender and the receiver can decrypt the contents. Users select a file on their device and then share the generated code with the intended recipient for safe delivery. No sign-up is needed.

Key security features:
Key security features:

- **Identity-less**: no need to disclose identity information (such as name, email address, or phone number) to be able to transfer files.
- **End-to-end encryption**: files are end-to-end encrypted and only the sender and recipient can read them.
Expand All @@ -27,7 +27,8 @@ Supported platforms
- [x] Windows
- [x] macOS
- [x] Android (Google Play & F-Droid)
- [ ] iOS
- [x] iOS


## Usage

Expand All @@ -42,12 +43,12 @@ Available on external stores:
[<img src="assets/images/google-play-store-label.png" height="40" alt="Google Play store">](https://play.google.com/store/apps/details?id=com.leastauthority.destiny)
[<img src="assets/images/f-droid-store-label.png" height="40" alt="F-Droid store">](https://f-droid.org/en/packages/com.leastauthority.destiny/)

Alternatively, apps can be downloaded directly from Github release [assets](https://github.com/LeastAuthority/destiny/releases/latest/download/destiny_android.apk) and installed manually.
Alternatively, apps can be downloaded directly from GitHub release [assets](https://github.com/LeastAuthority/destiny/releases/latest/download/destiny_android.apk)](https://github.com/LeastAuthority/destiny/releases/latest/download/destiny_android.apk) and installed manually.


### Verification

We recommend to [verify every downloaded file](https://github.com/LeastAuthority/destiny/blob/main/doc/releases.md) against the corresponding signature.
We recommend [verifying every downloaded file](https://github.com/LeastAuthority/destiny/blob/main/doc/releases.md) against the corresponding signature.

### Please check our [**FAQ**](https://github.com/LeastAuthority/destiny/blob/main/FAQ.md), [**Privacy Policy**](https://github.com/LeastAuthority/destiny/blob/main/PRIVACY-POLICY.md) and [**Terms & Conditions**](https://github.com/LeastAuthority/destiny/blob/main/TERMS.md) to find more information before to using applications.

Expand All @@ -62,19 +63,20 @@ git clone --recurse-submodules git@github.com:LeastAuthority/destiny.git

### Dependencies

- Go >= 1.15
- Go >= 1.19
- Flutter >= 3.0.0
- Android SDK for Android builds (>= SDK 24)

### Unsigned release builds

Builds for magic-wormhole.io:
Builds for magic-wormhole.io by default:

```bash
flutter build linux
flutter build apk
flutter build appbundle
flutter build macos
flutter build ipa
```

Builds for Least Authority servers:
Expand All @@ -85,17 +87,22 @@ flutter build linux -t lib/main_la.dart

Builds for local instances:


```bash
flutter build linux -t lib/main_local.dart
```

If flutter is not used for web application, worth to set:

Checkout detail instructions for [building](https://github.com/LeastAuthority/destiny/blob/main/doc/building.md).

If flutter is not used for web application, worth to set to avoid additional files generation and static analysis warnings:
```bash
flutter config --no-enable-web
```

Checkout detail instructions how to [sign releases](https://github.com/LeastAuthority/destiny/blob/main/doc/releases.md).


### Starting the wormhole services locally

```bash
Expand All @@ -108,4 +115,9 @@ docker-compose up -d
so x86 emulators or devices are not supported.
- MacOS M1 chip build is not supported.

### Other configuration/ notes

- To disable debug label on the app in the emulator, set debugShowCheckedModeBanner: false (two places)

- iOS downloaded files are stored in app/Documents folder, which is displayed in Files App as a dedicated application folder. If Files doesn't display the application folder, try restart phone.
Note, that if App is deleted, all downloaded files in the same App folder will be deleted too.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions doc/building.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Building details

## iOS building documentation

### *Prerequisit*:
* macOS and Xcode is necessary to build iOS or macOS app (Alternatively, may be Xcode cloud could be used).
* flutter (latest)
* cmake (latest)
* cocoapods (latest)
* workstation (preferrable M1, as it compiles for arm64)

*Note:* iphonesimulator runs on arch: x86_64, iphone on arm64

Check enviroment variables:
* FLUTTER_ROOT
* GOROOT
* Homebrew bin is in PATH


Apple Developer account is necessary only if you want to sign and release or you want to install on your own iPhone devices

### *Basic commands:*

Build cleanup: `flutter clean && cd dart_wormhole_william && flutter clean && cd ..`

Additional cleanup: `rm -rf ios/Pods && rm ios/Podfile.loc`

Build ios app debug version with stage servers: `flutter build ios -t lib/main_stage_la.dart --debug`

Build ios app release version with production servers: `flutter build ios -t lib/main_la.dart --debug`

Build and run on simulator or connected iPhone: `flutter run`

Check available devices: `flutter devices`

### *Other notes*

Alternative you can build and run in Xcode, however it not works on every workstation straight away (it execute a little bit differently then flutter commands). Build in Xcode, can give more detail description if something is failing.

If Xcode build fails, first try to build with flutter command: `flutter build ios` and then rebuild in Xcode

For signing:
* Add apple developer account in Xcode.
* Set in Runner->Signing & Capabilities, your team, which you are signing and Enable automatically manage signing

iOS load static libraries, you can find and check if libraries are build and in which arch: `find . -name "*.a" -exec objdump -x {} \;`

Helps to find for some parameters in logs: `rg STRIP_STYLE` or in absolutely all files: `rg -uuu STRIP_STYLE`

Main files to check compilation scripts:
* dart_wormhole_william/ios/CMakeLists.txt
* dart_wormhole_william/ios/dart_wormhole_william.podspec
* dart_wormhole_william/lib/src/CMakeLists.txt
* dart_wormhole_william/CMakeLists.txt

To check if libraries compiled, included in build and linked properly, run app in iPhone or iPhonesimulator, go to Sender try to load File or Media, code should be generated. Alternatively, you can go to receiver and enter failed code: 1-2-3 and get message: "Something went wrong".
Note: If you get error: `PlatformException(file_picker_error, Temporary file could not be created`, simulator might have a bug when selecting Media file. Try select any other media file. Also in Destiny application settings, set Document storage: Phone.

### *Troubleshooting*

Sharing some issues, faced during enabling iOS build:

* Failed to lookup symbol 'init_dart_api_dl' iphone simulator - helped setting in Runner->Build Settings->Build Active Architecture Only = Yes
* Architecture miscompilation and loading arm64 vs amd64 (x86_64). Iphone runs on Arm64, MacBook M1-chip runs on Arm64, MacBook intel runs on amd64, iPhoneSimulator runs on x86_64. We have flutter app, dart_wormhole_william and wormhole_william. All this must match to what you build



18 changes: 18 additions & 0 deletions doc/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ flutter build appbundle --build-name=<build_version> --dart-define version=<buil
Note: Google Play store requires unique or incremental build-number for every upload to store.


## iOS bundle upload to App Store

To build for production, use command:
```bash
flutter build ipa --build-name=<version> --dart-define version=v<version> -t lib/main_la.dart --release
```

Prerequisite: Apple Developer account is mandatory

Validate
```bash
xcrun altool --validate-app -f build/ios/ipa/Destiny.ipa -t ios -u <username> -p <app passowd>
```
Upload
```bash
xcrun altool --upload-app -f build/ios/ipa/Destiny.ipa -t ios -u <username> -p <app passowd>
```

## MacOS

In order to build signed macos releases, a valid code signing certificate needs to be added to the key chain.
Expand Down
40 changes: 20 additions & 20 deletions ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
2 changes: 1 addition & 1 deletion ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
18 changes: 12 additions & 6 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand All @@ -25,17 +25,23 @@ end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
flutter_ios_podfile_setup

use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["STRIP_STYLE"] = "non-global"
config.build_settings['IOS_DEPLOYMENT_TARGET'] = '12.0'
end

installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
end
Loading