Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
bd20873
Changes so that Commet builds and runs, and has libolm, on macOS
polemarkh Feb 28, 2025
581db9a
Updated README
polemarkh Mar 1, 2025
b0d3610
iOS builds
polemarkh Mar 1, 2025
20efec4
Build now passes beta review
polemarkh Mar 1, 2025
340982c
Merge branch 'commetchat:main' into apple_dev
polemarkh Mar 1, 2025
508bb87
Adding MacOS build action
polemarkh Mar 1, 2025
bf1c2b4
Bumping iOS required version to 13 to support firebase
polemarkh Mar 2, 2025
3053b4b
Updated benchmarking, and added ios push notification class
polemarkh Mar 2, 2025
bb2e043
Updated pubspec to include firebase
polemarkh Mar 2, 2025
e6f8e15
Since I moved the location of the plugin)
polemarkh Mar 2, 2025
7fb547d
Reverting pubspec for PR and repository
polemarkh Mar 2, 2025
1611d3e
Also reverting the base firebase push notifier code segment
polemarkh Mar 2, 2025
8637341
Naming everything correctly in the build profile
polemarkh Mar 4, 2025
82b3e76
And this time, not introducing any egregious errors into the YML file
polemarkh Mar 4, 2025
ca7503b
Added the ability to dismiss the keyboard
polemarkh Mar 5, 2025
ab3287b
Merge branch 'commetchat:main' into main
polemarkh Mar 5, 2025
1f05f37
Merge branch 'commetchat:main' into main
polemarkh Mar 7, 2025
28b5f6d
Changes to improve the chance of macos version building
polemarkh Mar 7, 2025
10b3add
Fixed error in formatting
polemarkh Mar 7, 2025
1a8e810
Changed double-dashes to single-dashes
polemarkh Mar 7, 2025
9cb21b4
Trying with a different provisioning profile and no pre-build step
polemarkh Mar 7, 2025
7e74c1d
Trying a different build string
polemarkh Mar 7, 2025
fd48c6f
Trying an action to install the provisioning profile
polemarkh Mar 7, 2025
2ac5d40
Yet another attempt at provisioning
polemarkh Mar 8, 2025
b0cac93
Trying a different combination
polemarkh Mar 8, 2025
dbc56ca
And another
polemarkh Mar 8, 2025
3953db9
And yet again
polemarkh Mar 8, 2025
74cb768
Trying with homebrew turned off
polemarkh Mar 8, 2025
7989a23
And again
polemarkh Mar 8, 2025
bd5ec64
Let's put the right secrets in the right variables
polemarkh Mar 8, 2025
0ff7094
Apparently the provisioning profile search location changed and githu…
polemarkh Mar 8, 2025
5fde41b
Apparently I also need to create the directory before copying somethi…
polemarkh Mar 8, 2025
b5c9701
Trying again
polemarkh Mar 8, 2025
cc8e459
and again
polemarkh Mar 8, 2025
3b5047e
Another tweak
polemarkh Mar 8, 2025
5461ef5
And trying once again
polemarkh Mar 8, 2025
d1c7db6
With a hardware keyboard, shift-return will now enter a newline witho…
polemarkh Mar 8, 2025
c2c34ed
Updated signing to not be automatic in github
polemarkh Mar 9, 2025
d65edcd
Removing unfound command
polemarkh Mar 9, 2025
7532c73
Trying different naming
polemarkh Mar 9, 2025
9509b29
Ready to start testing ios build action
polemarkh Mar 9, 2025
9730830
First attempt at iOS build in runner
polemarkh Mar 10, 2025
ce52bdf
Added all the changed files
polemarkh Mar 10, 2025
d2968f0
Dart formatting
polemarkh Mar 10, 2025
ba4b713
Merge pull request #2 from polemarkh/main
polemarkh Mar 14, 2025
6b4bd14
Merge branch 'commetchat:main' into main
polemarkh Mar 19, 2025
ae66107
Merge pull request #3 from polemarkh/main
polemarkh Mar 19, 2025
d1abccf
Version with combined local notifications and APNS swift
polemarkh Mar 11, 2025
386c819
Trying without local notifications
polemarkh Mar 11, 2025
3a25322
Resolved conflict
polemarkh Mar 19, 2025
76b3ab3
iOS change to make AppInfo.xcconfig into the parameters file
polemarkh Mar 19, 2025
9cc51d4
Building pods before running flutter
polemarkh Mar 19, 2025
883ca8a
Trying another updated build
polemarkh Mar 20, 2025
7c2aa01
Removed redundant servicer build target
polemarkh Mar 20, 2025
7744b83
Changed settings to hopefully avoid strange error
polemarkh Mar 20, 2025
5eec532
Trying to do a straight ios build instead of ipa
polemarkh Mar 22, 2025
ce4e936
Creating App Profile within build action
polemarkh Mar 22, 2025
1c96f6a
Renamed iOS certificates and profiles
polemarkh Mar 22, 2025
b296f93
Possibly yml syntax error
polemarkh Mar 22, 2025
8087a0e
Changed extension servicer to a group
polemarkh Mar 22, 2025
e72515b
Changed xcode version hopefully
polemarkh Mar 22, 2025
fd848d6
Changed xcode version hopefully
polemarkh Mar 22, 2025
497a057
Removed flutter framework from extension
polemarkh Mar 22, 2025
8e67af8
Returned to building ipa and removed unneeded extension profiles from…
polemarkh Mar 22, 2025
264aa56
Made macOS build configurable
polemarkh Mar 22, 2025
6dc54fc
Merge branch 'commetchat:main' into main
polemarkh Mar 22, 2025
08797f8
Make push gateway settable at build
polemarkh Apr 2, 2025
5df9fd3
Now get push gateway from environment variable
polemarkh Apr 2, 2025
01da98d
Changed the push gateway configuration to actually use its own variable
polemarkh Apr 2, 2025
39d88e7
Fix patch for re-ordering of build config
polemarkh Apr 2, 2025
84676ee
Trying to restore the android build patch working
polemarkh Apr 2, 2025
3eda7c5
Merge pull request #4 from commetchat/main
polemarkh May 8, 2025
9edb65f
Merge pull request #5 from polemarkh/main
polemarkh May 8, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
exit $INTEGRATION_TEST_EXIT_CODE

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: result.mkv
path: commet/video.mkv
Expand Down
158 changes: 157 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,160 @@ jobs:
- name: Build Web
run: |
cd $PROJECT_PATH
flutter build web --release --dart-define PLATFORM=web
flutter build web --release --dart-define PLATFORM=web

build-mac:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Setup Flutter
uses: subosito/flutter-action@v2.8.0
with:
flutter-version: '3.24.4'
channel: 'stable'

- name: Setup Provisioning Profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.MACOS_SIGNING_P12 }}
P12_PASSWORD: ${{ secrets.MACOS_SIGNING_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.COMMET_MACOS_PROVISIONPROFILE }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.provisionprofile
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

# import certificate and provisioning profile from secrets
echo "Making Build Certificate"
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo "Making Provisioning Profile"
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH

# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH

# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/

- name: Create Configuration
run: |
cd $PROJECT_PATH/macos/Runner/Configs
touch AppInfo.xcconfig
echo PRODUCT_NAME=commet >> AppInfo.xcconfig
echo PRODUCT_BUNDLE_IDENTIFIER=${{ vars.MACOS_BUNDLE_ID }} >> AppInfo.xcconfig
echo PRODUCT_COPYRIGHT="Copyright © 2023 commet.chat. All rights reserved." >> AppInfo.xcconfig
echo PRODUCT_TEAM=${{ secrets.DEV_TEAM_ID }} >> AppInfo.xcconfig
echo PRODUCT_PROFILE=${{ secrets.MACOS_PROVISIONING_PROFILE_NAME }} >> AppInfo.xcconfig

- name: Code Generation
run: |
cd $PROJECT_PATH
dart run scripts/codegen.dart

- name: Build Mac
run: |
cd $PROJECT_PATH
flutter build macos --dart-define BUILD_MODE=release --dart-define PLATFORM=macos

- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.provisionprofile

build-ios:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Setup Flutter
uses: subosito/flutter-action@v2.8.0
with:
flutter-version: '3.24.4'
channel: 'stable'

- name: Setup Provisioning Profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_SIGNING_P12 }}
P12_PASSWORD: ${{ secrets.IOS_SIGNING_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.COMMET_IOS_MOBILEPROVISION }}
BUILD_EXTENSION_PROVISION_PROFILE_BASE64: ${{ secrets.COMMET_IOS_EXTENSION_MOBILEPROVISION }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
PP_EXT_PATH=$RUNNER_TEMP/build_ext_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

# import certificate and provisioning profile from secrets
echo "Making Build Certificate"
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo "Making Provisioning Profile"
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
echo "Making Extension Provisioning Profile"
echo -n "$BUILD_EXTENSION_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_EXT_PATH

# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH

# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/
cp $PP_EXT_PATH ~/Library/MobileDevice/Provisioning\ Profiles/

- name: Create Configuration
run: |
cd $PROJECT_PATH/ios
touch AppInfo.xcconfig
echo PRODUCT_NAME=commet >> AppInfo.xcconfig
echo PRODUCT_BUNDLE_IDENTIFIER=${{ vars.IOS_BUNDLE_ID }} >> AppInfo.xcconfig
echo PRODUCT_SERVICE_BUNDLE_IDENTIFIER=${{ vars.IOS_BUNDLE_SERVICER_ID }} >> AppInfo.xcconfig
echo PRODUCT_COPYRIGHT="Copyright © 2023 commet.chat. All rights reserved." >> AppInfo.xcconfig
echo PRODUCT_TEAM=${{ secrets.DEV_TEAM_ID }} >> AppInfo.xcconfig
echo PRODUCT_PROFILE=${{ secrets.IOS_PROVISIONING_PROFILE_NAME }} >> AppInfo.xcconfig
echo PRODUCT_SERVICE_PROFILE=${{ secrets.IOS_EXTENSION_PROVISIONING_PROFILE_NAME }} >> AppInfo.xcconfig

- name: Code Generation
run: |
cd $PROJECT_PATH
gem install plist_lite
dart run scripts/codegen.dart
cd ios
pod install

- name: Build iOS
env:
GATEWAY: ${{ vars.IOS_PUSH_GATEWAY }}
run: |
cd $PROJECT_PATH
flutter build ipa --export-options-plist=ios/export.plist --dart-define BUILD_MODE=release --dart-define PLATFORM=ios --dart-define PUSH_GATEWAY=$GATEWAY

- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:

- name: Upload Artifact
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: result.mkv
path: commet/video.mkv
46 changes: 40 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,53 @@ When building Commet, there are some additional command line arguments that must
**Required**
| **Argument** | **Valid Values** | **Description** |
|--------------|---------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|
| PLATFORM | 'desktop', 'mobile', 'linux', 'windows', 'macos', 'android', 'ios', 'web' | Defines which platform to build for |
| PLATFORM | 'desktop', 'mobile', 'linux', 'windows', 'macos', 'android', 'ios', 'web' | Defines which platform to build for |
| BUILD_MODE | 'release', 'debug' | When building with 'debug' flag, additional debug information will be shown |

**Optional**
| **Argument** | **Valid Values** | **Description** |
|--------------|---------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|
| GIT_HASH | * | Supply the current git hash when building to show in info screen |
| VERSION_TAG | * | Supply the current build version, to display app version |
| BUILD_DETAIL | * | Can provide additional detail about the current build, for example if it was being built for Flatpak or Snap |
| **Argument** | **Valid Values** | **Description** |
|--------------|------------------|--------------------------------------------------------------------------------------------------------------|
| GIT_HASH | * | Supply the current git hash when building to show in info screen |
| VERSION_TAG | * | Supply the current build version, to display app version |
| BUILD_DETAIL | * | Can provide additional detail about the current build, for example if it was being built for Flatpak or Snap |

**Example:**

```bash
cd commet
flutter run --dart-define BUILD_MODE=debug --dart-define PLATFORM=linux
```

## Building on macOS

These are rough notes, based on the experience of getting Commet compiled and running for
macOS and iOS from a mac.

- Install [Homebrew](https://brew.sh)
- Install ninja with `brew install ninja`
- Repeat for "gtk", "mpv", "ffmpeg", "libmpv", "mimalloc"
- If you want to run locally only (on a mac), you can install OLM with
`brew install libolm`. If you want to generate a universal binary, then the Commet
Xcode project for macOS includes a Cocoapods installation of "OLMKit" along with a shell
script to create an alias to the compiled library named "libolm.3.dylib", so that the
application can find it.
- For both macOS and iOS, open the Xcode projects by opening the ".xcworkspace" file
instead of the ".xcodeproj" file.
- In these files, set up code signing appropriately. You will need:
- An apple code signing certificate for iOS (and the same for macOS if you want to be
able to run the app non-locally)
- An Apple Push Services certificate for push notification support
- An Apple Identifier for your app bundle name (e.g. "chat.commet.app.WHATEVER")
- An Apple device profile for each device (mac or phone) you want to test on
- An Apple services key for push services (and your own Firebase set-up to go with it)
if you want to use push notifications outside of the main commet set-up

The current set-up specifies the Podfile for both macOS and iOS (rather than having
Flutter generate it) because the generated Podfile both sets the wrong target OS versions
and includes a test target which is not actually present in the code. In addition, on
macOS, the pod install of 'OLMKit' *must* be done manually in the pod file because the
Flutter pod definition of OLMKit will only install it on iOS, and Homebrew will only
install the version of libolm that matches the system architecture on which it's running.
In addition, the Homebrew libolm is linked with the rest of the homebrew installation, and
thus the library may fail to work, even embedded in the app, if installed on a different
system.
2 changes: 1 addition & 1 deletion commet/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions commet/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions commet/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
107 changes: 107 additions & 0 deletions commet/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

require 'plist_lite'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

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

flutter_ios_podfile_setup

target 'Runner' do
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)

target.build_configurations.each do |config|
# You can remove unused permissions here
# for more information: https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',

## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=1',
]

end
end

work_dir = Dir.pwd
app_id = ""
app_profile = ""
service_id = ""
service_profile = ""
team_id = ""
env_path = "#{work_dir}/Appinfo.xcconfig"
File.foreach( env_path ) do |line|
items = line.split("=")
if ("#{items[0]}" == "PRODUCT_SERVICE_BUNDLE_IDENTIFIER") then
service_id = items[1].strip!
elsif ("#{items[0]}" == "PRODUCT_BUNDLE_IDENTIFIER") then
app_id = items[1].strip!
elsif ("#{items[0]}" == "PRODUCT_TEAM") then
team_id = items[1].strip!
elsif ("#{items[0]}" == "PRODUCT_PROFILE") then
app_profile = items[1].strip!
elsif ("#{items[0]}" == "PRODUCT_SERVICE_PROFILE") then
service_profile = items[1].strip!
end
end
Dir.glob("Pods/Target Support Files/Pods-servicer/*.xcconfig") do |xc_config_filename|
full_path_name = "#{work_dir}/#{xc_config_filename}"
if (File.exist?(full_path_name))
new_text = "PRODUCT_BUNDLE_IDENTIFIER = #{service_id}\n"
end
File.write(full_path_name, new_text, File.size(full_path_name), mode: 'a')
end
export_path = File.expand_path(File.join('..', "export.plist"), __FILE__)
puts "Export file path is #{export_path}"
provisioning_profiles={app_id => app_profile, service_id => service_profile}
plist = {
"destination" => "export",
"manageAppVersionAndBuildNumber" => true,
"method" => "app-store-connect",
"provisioningProfiles" => provisioning_profiles,
"signingCertificate" => "Apple Distribution",
"signingStyle" => "manual",
"stripSwiftSymbols" => true,
"teamID" => team_id,
"uploadSymbols" => true
}
puts plist
plist_text = PlistLite.dump(plist)
puts plist_text
File.open(export_path, "w") {|file| file.puts PlistLite.dump(plist) }
end

target 'servicer' do
use_frameworks!
end
Loading