Skip to content

Commit

Permalink
Remote and local trackers lists #345
Browse files Browse the repository at this point in the history
  • Loading branch information
XITRIX committed Oct 5, 2024
1 parent 1ad5c18 commit ffd9fdb
Show file tree
Hide file tree
Showing 19 changed files with 1,207 additions and 44 deletions.
170 changes: 170 additions & 0 deletions .github/workflows/ios-debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: "Build iOS app"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build_with_signing:
runs-on: macos-14
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 16.0

- name: checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Prepare Brew
run: brew install boost

- name: Prepare LibTorrent
run: ./Submodules/LibTorrent-Swift/make.sh

- name: Install the Apple certificate and provisioning profile
env:
FIREBASE_INFO_PLIST_BASE64: ${{ secrets.FIREBASE_INFO_PLIST_BASE64 }}
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
BUILD_CERTIFICATE_PASSWORD: ${{ secrets.BUILD_CERTIFICATE_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
BUILD_PROVISION_PROFILE_PROD_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_PROD_BASE64 }}
BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_BASE64 }}
BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_PROD_BASE64: ${{ secrets.BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_PROD_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
FIREBASE_INFO_PLIST_PATH=iTorrent/Core/Assets/GoogleService-Info.plist
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
PP_PROD_PATH=$RUNNER_TEMP/build_pp_prod.mobileprovision
PW_PP_PATH=$RUNNER_TEMP/build_progresswidget_pp.mobileprovision
PW_PP_PROD_PATH=$RUNNER_TEMP/build_progresswidget_pp_prod.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import firebase plist to the project
echo -n "$FIREBASE_INFO_PLIST_BASE64" | base64 --decode -o $FIREBASE_INFO_PLIST_PATH
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
echo -n "$BUILD_PROVISION_PROFILE_PROD_BASE64" | base64 --decode -o $PP_PROD_PATH
echo -n "$BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_BASE64" | base64 --decode -o $PW_PP_PATH
echo -n "$BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_PROD_BASE64" | base64 --decode -o $PW_PP_PROD_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 "$BUILD_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $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_PROD_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $PW_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $PW_PP_PROD_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: build archive
run: |
xcodebuild \
-workspace iTorrent.xcworkspace \
-scheme "iTorrent" \
-archivePath $RUNNER_TEMP/itorrent.xcarchive \
-sdk iphoneos \
-configuration Release \
-destination generic/platform=iOS \
clean archive
- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: itorrent.xcarchive
path: |
${{ runner.temp }}/itorrent.xcarchive
export_ipa:
needs: [build_with_signing]
runs-on: macos-14
strategy:
matrix:
org: [adhoc, prod]
include:
- org: adhoc
export_options_plist_secret: EXPORT_OPTIONS_PLIST
- org: prod
export_options_plist_secret: EXPORT_PROD_OPTIONS_PLIST
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 16.0

- name: Download artifacts
uses: actions/download-artifact@v4

- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
BUILD_CERTIFICATE_PASSWORD: ${{ secrets.BUILD_CERTIFICATE_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
BUILD_PROVISION_PROFILE_PROD_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_PROD_BASE64 }}
BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_BASE64 }}
BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_PROD_BASE64: ${{ secrets.BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_PROD_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
PP_PROD_PATH=$RUNNER_TEMP/build_pp_prod.mobileprovision
PW_PP_PATH=$RUNNER_TEMP/build_progresswidget_pp.mobileprovision
PW_PP_PROD_PATH=$RUNNER_TEMP/build_progresswidget_pp_prod.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
echo -n "$BUILD_PROVISION_PROFILE_PROD_BASE64" | base64 --decode -o $PP_PROD_PATH
echo -n "$BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_BASE64" | base64 --decode -o $PW_PP_PATH
echo -n "$BUILD_PROGRESS_WIDGET_PROVISION_PROFILE_PROD_BASE64" | base64 --decode -o $PW_PP_PROD_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 "$BUILD_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $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_PROD_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $PW_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $PW_PP_PROD_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Export ipa
env:
EXPORT_OPTIONS_PLIST: ${{ secrets[matrix.export_options_plist_secret] }}
run: |
EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH
xcodebuild -exportArchive -archivePath itorrent.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath $RUNNER_TEMP/build
- name: Move dSYMs
run: mv itorrent.xcarchive/dSYMs $RUNNER_TEMP/dSYMs

- name: Upload application
uses: actions/upload-artifact@v4
with:
name: app-Release-${{ matrix.org }}
path: |
${{ runner.temp }}/build/iTorrent.ipa
${{ runner.temp }}/build/manifest.plist
${{ runner.temp }}/dSYMs
10 changes: 5 additions & 5 deletions .github/workflows/ios.yml → .github/workflows/ios-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 15.4
xcode-version: 16.0

- name: checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 15.4
xcode-version: 16.0

- name: Download artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 15.4
xcode-version: 16.0

- name: Download artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -224,7 +224,7 @@ jobs:
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 15.4
xcode-version: 16.0

- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 15.4
xcode-version: 16.0

- name: Download artifacts
uses: actions/download-artifact@v4
Expand Down
13 changes: 0 additions & 13 deletions ProgressWidget/ProgressWidgetLiveActivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,9 @@ struct ProgressWidgetLiveActivity: Widget {
// Lock screen/banner UI goes here

if #available(iOS 18, *) {
#if XCODE16
ProgressWidgetLiveActivityWatchSupportContent(context: context)
.tint(Color(uiColor: context.tintColor))
.padding()
#else
ProgressWidgetLiveActivityContent(context: context)
.tint(Color(uiColor: context.tintColor))
.padding()
#endif

} else {
ProgressWidgetLiveActivityContent(context: context)
.tint(Color(uiColor: context.tintColor))
Expand Down Expand Up @@ -105,18 +98,13 @@ struct ProgressWidgetLiveActivity: Widget {
}

if #available(iOS 18.0, *) {
#if XCODE16
return config.supplementalActivityFamilies([.small])
#else
return config
#endif
} else {
return config
}
}
}

#if XCODE16
@available(iOS 18.0, *)
struct ProgressWidgetLiveActivityWatchSupportContent: View {
@Environment(\.activityFamily) var activityFamily
Expand Down Expand Up @@ -180,7 +168,6 @@ struct ProgressWidgetLiveActivityWatchSupportContent: View {
}
}
}
#endif

struct ProgressWidgetLiveActivityContent: View {
@State var context: ActivityViewContext<ProgressWidgetAttributes>
Expand Down
2 changes: 1 addition & 1 deletion Submodules/LibTorrent-Swift
31 changes: 31 additions & 0 deletions iTorrent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@
D1B99D932BEE631B00F51514 /* Benefit.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1B99D8F2BEE631B00F51514 /* Benefit.swift */; };
D1B99D942BEE631B00F51514 /* Tier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1B99D902BEE631B00F51514 /* Tier.swift */; };
D1B99D962BEE657F00F51514 /* API.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1B99D952BEE657F00F51514 /* API.swift */; };
D1BB073B2C98524B00981D5F /* TrackersListService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1BB073A2C98524A00981D5F /* TrackersListService.swift */; };
D1BB07432C985EB800981D5F /* TrackersListPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1BB07422C985EAE00981D5F /* TrackersListPreferencesView.swift */; };
D1BB07452C9869C300981D5F /* TrackersListDetailsPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1BB07442C9869B900981D5F /* TrackersListDetailsPreferencesView.swift */; };
D1CAB8852AF3B51E00EB6AFF /* ToggleCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1CAB8842AF3B51E00EB6AFF /* ToggleCellView.swift */; };
D1CAB8872AF3B52E00EB6AFF /* ToggleCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1CAB8862AF3B52E00EB6AFF /* ToggleCellViewModel.swift */; };
D1D1279B2BC7CA7600C04533 /* SwiftUILayoutGuides.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1D1279A2BC7CA7600C04533 /* SwiftUILayoutGuides.swift */; };
Expand Down Expand Up @@ -418,6 +421,9 @@
D1B99D8F2BEE631B00F51514 /* Benefit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Benefit.swift; sourceTree = "<group>"; };
D1B99D902BEE631B00F51514 /* Tier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tier.swift; sourceTree = "<group>"; };
D1B99D952BEE657F00F51514 /* API.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = API.swift; sourceTree = "<group>"; };
D1BB073A2C98524A00981D5F /* TrackersListService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackersListService.swift; sourceTree = "<group>"; };
D1BB07422C985EAE00981D5F /* TrackersListPreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackersListPreferencesView.swift; sourceTree = "<group>"; };
D1BB07442C9869B900981D5F /* TrackersListDetailsPreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackersListDetailsPreferencesView.swift; sourceTree = "<group>"; };
D1CAB8842AF3B51E00EB6AFF /* ToggleCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleCellView.swift; sourceTree = "<group>"; };
D1CAB8862AF3B52E00EB6AFF /* ToggleCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleCellViewModel.swift; sourceTree = "<group>"; };
D1D1279A2BC7CA7600C04533 /* SwiftUILayoutGuides.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftUILayoutGuides.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -793,6 +799,7 @@
D111384C2AF9663F008907F7 /* Preferences */ = {
isa = PBXGroup;
children = (
D1BB07412C985E9700981D5F /* TrackersList */,
7C95B7A32C34B554000EC50F /* Storage */,
D1DB718E2BD92206007F9267 /* Patreon */,
7CB6F6CC2BD82B8A00D0813B /* FileSharing */,
Expand Down Expand Up @@ -1118,6 +1125,7 @@
D1A226F02AEF018500669D6D /* Services */ = {
isa = PBXGroup;
children = (
D1BB07392C98522D00981D5F /* TrackersListService */,
7C1C08AE2C31FEF700569B45 /* IntentsService */,
7C3142D42C31ED4600397E82 /* LiveActivityService */,
D1B99D842BEE5E4100F51514 /* Patreon */,
Expand Down Expand Up @@ -1256,6 +1264,23 @@
path = Models;
sourceTree = "<group>";
};
D1BB07392C98522D00981D5F /* TrackersListService */ = {
isa = PBXGroup;
children = (
D1BB073A2C98524A00981D5F /* TrackersListService.swift */,
);
path = TrackersListService;
sourceTree = "<group>";
};
D1BB07412C985E9700981D5F /* TrackersList */ = {
isa = PBXGroup;
children = (
D1BB07442C9869B900981D5F /* TrackersListDetailsPreferencesView.swift */,
D1BB07422C985EAE00981D5F /* TrackersListPreferencesView.swift */,
);
path = TrackersList;
sourceTree = "<group>";
};
D1CAB8832AF3B50C00EB6AFF /* ToggleCell */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1539,6 +1564,7 @@
D11138552AF97511008907F7 /* TorrentAddFileItemViewModel.swift in Sources */,
D11333B52AF19C4900FA017E /* TorrentHandle+Extension.swift in Sources */,
D19E00202AEFFA1B000A17A2 /* DetailCellView.swift in Sources */,
D1BB07452C9869C300981D5F /* TrackersListDetailsPreferencesView.swift in Sources */,
D1ACFDC62AF6DB9F0098FF56 /* TorrentFilesFileListCell.swift in Sources */,
D1A227072AEF0B2C00669D6D /* TorrentListItem.swift in Sources */,
D111384B2AF965F1008907F7 /* TorrentAddViewModel.swift in Sources */,
Expand Down Expand Up @@ -1602,6 +1628,7 @@
7CFEBE7C2BC4318E0013233F /* RssChannelViewController.swift in Sources */,
7C5FBE2C2BBDD6B40069E5A0 /* UIView+LayerColors.swift in Sources */,
7C4ED08D2BE646E40034B62C /* AdView+Meta.swift in Sources */,
D1BB07432C985EB800981D5F /* TrackersListPreferencesView.swift in Sources */,
D1B538572AF1171900694AFD /* TorrentDetailProgressCellView.swift in Sources */,
7C5FBE742BC2F0A30069E5A0 /* MvvmViewModelProtocol+Alert.swift in Sources */,
D1EFCD122AF572E400D33A7A /* TorrentFilesFileItemViewModel.swift in Sources */,
Expand Down Expand Up @@ -1672,6 +1699,7 @@
D1DB71802BD6773E007F9267 /* RssSearchViewModel.swift in Sources */,
D17733EE2BBC2C5F006FC81A /* ProxyPreferencesViewModel.swift in Sources */,
7CF6DA3E2C0F9DC40033D03F /* LiveActivityService.swift in Sources */,
D1BB073B2C98524B00981D5F /* TrackersListService.swift in Sources */,
7C4ED0982BEF8B8E0034B62C /* PatreonCredentials.swift in Sources */,
D173D9E12BC0286800E4F9EB /* UIMenu+Priority.swift in Sources */,
D1AA00CE2AFA8B1000B74629 /* PreferencesStorage.swift in Sources */,
Expand Down Expand Up @@ -1744,6 +1772,7 @@
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "iTorrent2 ProgressWidget Dev";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$inherited XCODE16";
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -1891,6 +1920,7 @@
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "iTorrent2 ProgressWidget Dev";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$inherited XCODE16";
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -2033,6 +2063,7 @@
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "iTorrent2 ProgressWidget Distrib";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$inherited XCODE16";
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
Loading

0 comments on commit ffd9fdb

Please sign in to comment.