Merge pull request #1332 from OffbandMesh/feat/1329-ios-universal-links

feat(#1329): iOS opens offband.app/add/ links in Offband
pull/1341/head
Strycher 20 hours ago committed by GitHub
commit 89e5387361
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -247,6 +247,26 @@ jobs:
fi
echo "IPA signing verified."
# Universal Links (#1329). Without this entitlement in the signed app, iOS
# never fetches apple-app-site-association and offband.app links open in
# Safari, with no build error. Checked against a wrong domain first, so it
# is shown able to fail on every run.
- name: Verify the IPA claims the offband.app link domains
run: |
set -eu
ENT="$(codesign -d --entitlements :- "${APP}" 2>/dev/null)"
if printf '%s\n' "${ENT}" | grep -qF "<string>applinks:not-this-domain.example</string>"; then
echo "::error::The entitlement check accepted a wrong domain."
exit 1
fi
for domain in offband.app dev.offband.app; do
if ! printf '%s\n' "${ENT}" | grep -qF "<string>applinks:${domain}</string>"; then
echo "::error::The signed app does not claim applinks:${domain}."
exit 1
fi
done
echo "Associated domains present in the signed app."
- name: Install the App Store Connect API key
env:
ASC_API_KEY_P8_BASE64: ${{ secrets.ASC_API_KEY_P8_BASE64 }}

@ -446,6 +446,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@ -625,6 +626,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@ -647,6 +649,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:offband.app</string>
<string>applinks:dev.offband.app</string>
</array>
</dict>
</plist>

@ -101,6 +101,56 @@ void main() {
);
});
test('iOS claims offband.app links for Offband (#1329)', () {
final entitlements = _read('ios/Runner/Runner.entitlements');
final domains = RegExp(
r'<key>com\.apple\.developer\.associated-domains</key>\s*<array>([\s\S]*?)</array>',
).firstMatch(entitlements);
expect(domains, isNotNull, reason: 'associated-domains entitlement');
expect(
RegExp(
r'<string>([^<]*)</string>',
).allMatches(domains![1]!).map((m) => m[1]).toList(),
['applinks:offband.app', 'applinks:dev.offband.app'],
);
// Debug, Release and Profile of the Runner target. Without the setting,
// Xcode signs the app with no entitlement and iOS never asks the site.
expect(
'CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;'
.allMatches(_read('ios/Runner.xcodeproj/project.pbxproj'))
.length,
3,
);
});
test('apple-app-site-association names Offband for /add/ (#1329)', () {
final aasa =
jsonDecode(_read('web/.well-known/apple-app-site-association'))
as Map<String, dynamic>;
final details =
(aasa['applinks'] as Map<String, dynamic>)['details'] as List;
expect(details, hasLength(1));
final entry = details.single as Map<String, dynamic>;
// Team ID from the App Store profile, and the iOS bundle id, which ends
// in .ios unlike Android's.
expect(entry['appIDs'], ['63VU9LBN3A.app.offband.meshcore.ios']);
expect(entry['components'], [
{'/': '/add/*'},
]);
});
test('apple-app-site-association is served as JSON (#1329)', () {
expect(
_read('web/_headers'),
matches(
RegExp(
r'^/\.well-known/apple-app-site-association\r?\n\s+Content-Type: application/json',
multiLine: true,
),
),
);
});
test('macOS opens meshcore:// links in Offband', () {
expect(
_plistDeclaresScheme(_read('macos/Runner/Info.plist'), 'meshcore'),

@ -0,0 +1,10 @@
{
"applinks": {
"details": [
{
"appIDs": ["63VU9LBN3A.app.offband.meshcore.ios"],
"components": [{ "/": "/add/*" }]
}
]
}
}

@ -28,6 +28,11 @@
/.well-known/assetlinks.json
Content-Type: application/json
# Universal Links (#1329). iOS reads this file, which has no extension, to
# confirm the app may open offband.app/add/... links.
/.well-known/apple-app-site-association
Content-Type: application/json
/*
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

Loading…
Cancel
Save

Powered by TurnKey Linux.