Skip to content

Commit

Permalink
Merge pull request #4186 from tloncorp/promote-11-14
Browse files Browse the repository at this point in the history
ops: promote 11/14
  • Loading branch information
arthyn authored Nov 15, 2024
2 parents e5bc2c5 + 7ccc059 commit 694e662
Show file tree
Hide file tree
Showing 153 changed files with 3,938 additions and 1,591 deletions.
25 changes: 25 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,31 @@ module.exports = {
message:
'Please use getTokenValue() instead of getToken() to ensure web compatibility. See: https://tamagui.dev/docs/core/exports#gettokenvalue',
},
{
selector:
'JSXOpeningElement[name.name=/^(Stack|XStack|YStack|View|ListItem)$/] > JSXAttribute[name.name="onPress"]',
message:
'Do not use onPress on Stack, View or ListItem components. Use Pressable instead.',
},
{
selector:
'JSXOpeningElement[name.name=/^(Stack|XStack|YStack|View|ListItem)$/] > JSXAttribute[name.name="onLongPress"]',
message:
'Do not use onLongPress on Stack, View or ListItem components. Use Pressable instead.',
},
{
selector:
'MemberExpression[object.name="CommonActions"][property.name="reset"]',
message:
'Please use the useTypedReset() hook instead of CommonActions.reset() for type safety.',
},
{
// Also catch it when imported as a different name
selector:
'ImportSpecifier[imported.name="reset"][parent.parent.source.value="@react-navigation/native"]',
message:
'Please use the useTypedReset() hook instead of importing reset from @react-navigation/native for type safety.',
},
],
},
};
2 changes: 1 addition & 1 deletion apps/tlon-mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
compileSdk rootProject.ext.compileSdkVersion
versionCode 108
versionName "4.1.1"
versionName "4.1.7"

buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
}
Expand Down
1 change: 1 addition & 0 deletions apps/tlon-mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
defaultOnboardingPassword: process.env.ONBOARDING_DEFAULT_PASSWORD,
defaultOnboardingTlonEmail: process.env.ONBOARDING_DEFAULT_TLON_EMAIL,
defaultOnboardingNickname: process.env.ONBOARDING_DEFAULT_NICKNAME,
defaultOnboardingPhoneNumber: process.env.ONBOARDING_DEFAULT_PHONE_NUMBER,
recaptchaSiteKeyAndroid: process.env.RECAPTCHA_SITE_KEY_ANDROID,
recaptchaSiteKeyIOS: process.env.RECAPTCHA_SITE_KEY_IOS,
enabledLoggers: process.env.ENABLED_LOGGERS,
Expand Down
109 changes: 109 additions & 0 deletions apps/tlon-mobile/ios/Intents/ChannelEntity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import AppIntents
import Intents

struct ChannelEntity: AppEntity {
struct Group {
let title: String
}

static var defaultQuery = ChannelQuery()

var id: String
let title: String
let group: ChannelEntity.Group

static var typeDisplayRepresentation: TypeDisplayRepresentation {
TypeDisplayRepresentation(
name: "Channel",
numericFormat: "\(placeholder: .int) channels"
)
}

var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(
title: "\(title)",
subtitle: "\(group.title)",
image: nil
)
}
}

struct ChannelQuery: EntityStringQuery {
private var database: SQLiteDB? {
SQLiteDB.openApplicationDatabase()
}

func entities(matching string: String) async throws -> [ChannelEntity] {
guard let database else { return [] }

let results = database.exec("""
select
c.id,
c.title,
g.title as group_title
from channels c
join groups g on c.group_id = g.id
where c.title like ?
""", parameters: ["%\(string)%"])

database.close()

return results.map { result in
ChannelEntity(
id: result["id"]!!,
title: result["title"]!!,
group: ChannelEntity.Group(title: result["group_title"]!!)
)
}
}

func entities(for identifiers: [ChannelEntity.ID]) async throws -> [ChannelEntity] {
guard let database else { return [] }

let results = database.exec("""
with query(id) as (
values \(identifiers.map { _ in "(?)" }.joined(separator: ", "))
)
select
c.id,
c.title,
g.title as group_title
from query
join channels c on query.id = c.id
join groups g on c.group_id = g.id
""", parameters: identifiers)
database.close()

return results.map { result in
ChannelEntity(
id: result["id"]!!,
title: result["title"]!!,
group: ChannelEntity.Group(title: result["group_title"]!!)
)
}
}

func suggestedEntities() async throws -> [ChannelEntity] {
guard let database else { return [] }

let results = database.exec("""
select
c.id,
c.title,
g.title as group_title
from channels c
join groups g on c.group_id = g.id
order by max(c.last_viewed_at, c.last_post_at) desc
limit 10
""")
database.close()

return results.map { result in
ChannelEntity(
id: result["id"]!!,
title: result["title"]!!,
group: ChannelEntity.Group(title: result["group_title"]!!)
)
}
}
}
26 changes: 26 additions & 0 deletions apps/tlon-mobile/ios/Intents/OpenAppIntent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import AppIntents

struct OpenAppIntent: AppIntent {
static var title: LocalizedStringResource = "Open channel"
static var description = IntentDescription("Opens the app to the specified channel.")
static var openAppWhenRun = true

@Parameter(title: "Channel", description: "The app will open to this channel.")
var channel: ChannelEntity?

@Parameter(title: "Start draft", description: "True if you want to start a new draft in the channel.")
var startDraft: Bool?

@Dependency
private var intentNotepad: IntentNotepad

@MainActor
func perform() async throws -> some IntentResult {
if let channelId = channel?.id {
intentNotepad.action = .openChannel(channelId: channelId, startDraft: startDraft ?? false)
} else {
intentNotepad.action = nil
}
return .result()
}
}
62 changes: 62 additions & 0 deletions apps/tlon-mobile/ios/Intents/ShortcutsManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import Foundation
import Combine
import AppIntents

final class IntentNotepad: ObservableObject, @unchecked Sendable {
static let shared = IntentNotepad()

enum Action {
case openChannel(channelId: String, startDraft: Bool)
}

@Published var action: Action?
}

@objc class ShortcutsManager: NSObject {
// reference necessary to retain subscription
private static var subscription: AnyCancellable?

@objc static func setup() {
AppDependencyManager.shared.add(dependency: IntentNotepad.shared)

subscription = IntentNotepad.shared
.$action
.sink { action in
switch action {
case let .openChannel(channelId, startDraft):
if let url = URL.deeplinkToOpenChannel(withId: channelId, startDraft: startDraft) {
UIApplication.shared.open(url)
}

default: break
}
}
}
}

extension URL {
static var schemeForDeeplinking: String? {
if let urlTypes = Bundle.main.object(forInfoDictionaryKey: "CFBundleURLTypes") as? [[String: Any]] {
if let urlSchemes = urlTypes.first?["CFBundleURLSchemes"] as? [String] {
return urlSchemes.first
}
}
return nil
}

static func deeplinkToOpenChannel(withId channelId: String, startDraft: Bool = false) -> URL? {
guard let scheme = URL.schemeForDeeplinking else { return nil }
var urlComponents = URLComponents()
urlComponents.scheme = scheme
urlComponents.host = "channel"
urlComponents.path = "/open"
var queryItems: [URLQueryItem] = [
URLQueryItem(name: "id", value: channelId),
]
if startDraft {
queryItems.append(URLQueryItem(name: "startDraft", value: "true"))
}
urlComponents.queryItems = queryItems
return urlComponents.url
}
}
40 changes: 36 additions & 4 deletions apps/tlon-mobile/ios/Landscape.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,27 @@
632793D42C4AEA6800F942B1 /* UrsusSigil in Frameworks */ = {isa = PBXBuildFile; productRef = 632793D32C4AEA6800F942B1 /* UrsusSigil */; };
63566D1C2C530A370048E3C4 /* INPerson+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70D386662A60A37000AFB46E /* INPerson+Extension.swift */; };
63566D1D2C530A370048E3C4 /* INPerson+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70D386662A60A37000AFB46E /* INPerson+Extension.swift */; };
635BCB0B2CC6F969004D52AA /* OpenAppIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635BCB0A2CC6F969004D52AA /* OpenAppIntent.swift */; };
635BCB0C2CC6F969004D52AA /* OpenAppIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635BCB0A2CC6F969004D52AA /* OpenAppIntent.swift */; };
6374ACE22C49DA9600E637C0 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6374ACE12C49DA9600E637C0 /* NotificationService.swift */; };
6374ACF92C4ACD5100E637C0 /* LoginStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6374ACF82C4ACD5000E637C0 /* LoginStore.swift */; };
6374ACFA2C4ACD5100E637C0 /* LoginStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6374ACF82C4ACD5000E637C0 /* LoginStore.swift */; };
6374ACFB2C4ACD5100E637C0 /* LoginStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6374ACF82C4ACD5000E637C0 /* LoginStore.swift */; };
6374ACFD2C4ACD7500E637C0 /* Login.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6374ACFC2C4ACD7500E637C0 /* Login.swift */; };
6374ACFE2C4ACD7500E637C0 /* Login.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6374ACFC2C4ACD7500E637C0 /* Login.swift */; };
6374ACFF2C4ACD7500E637C0 /* Login.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6374ACFC2C4ACD7500E637C0 /* Login.swift */; };
638753082CC7036C003942F5 /* ShortcutsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638753072CC7036C003942F5 /* ShortcutsManager.swift */; };
638753092CC7036C003942F5 /* ShortcutsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638753072CC7036C003942F5 /* ShortcutsManager.swift */; };
63A5A04E2CD05CB900928EED /* ChannelEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63A5A04D2CD05CB600928EED /* ChannelEntity.swift */; };
63A5A04F2CD05CB900928EED /* ChannelEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63A5A04D2CD05CB600928EED /* ChannelEntity.swift */; };
63E27E0B2C5AF26C008ACB45 /* Alamofire+sessionWithSharedCookieStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E27E0A2C5AF26C008ACB45 /* Alamofire+sessionWithSharedCookieStorage.swift */; };
63E27E0C2C5AF26C008ACB45 /* Alamofire+sessionWithSharedCookieStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E27E0A2C5AF26C008ACB45 /* Alamofire+sessionWithSharedCookieStorage.swift */; };
63E27E0D2C5AF26C008ACB45 /* Alamofire+sessionWithSharedCookieStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E27E0A2C5AF26C008ACB45 /* Alamofire+sessionWithSharedCookieStorage.swift */; };
63E27E0E2C5AF26C008ACB45 /* Alamofire+sessionWithSharedCookieStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E27E0A2C5AF26C008ACB45 /* Alamofire+sessionWithSharedCookieStorage.swift */; };
63E27E132C5AF5B9008ACB45 /* HTTPCookieStorage+forwardChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E27E122C5AF5B8008ACB45 /* HTTPCookieStorage+forwardChanges.swift */; };
63E27E142C5AF5B9008ACB45 /* HTTPCookieStorage+forwardChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E27E122C5AF5B8008ACB45 /* HTTPCookieStorage+forwardChanges.swift */; };
63EC5CC02CD0495B0098C343 /* SQLiteDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63EC5CBF2CD049540098C343 /* SQLiteDB.swift */; };
63EC5CC12CD0495B0098C343 /* SQLiteDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63EC5CBF2CD049540098C343 /* SQLiteDB.swift */; };
700B635B2A71DF860017F40F /* PocketUserAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 700B635A2A71DF860017F40F /* PocketUserAPI.swift */; };
700B635D2A71DFE90017F40F /* Contact.swift in Sources */ = {isa = PBXBuildFile; fileRef = 700B635C2A71DFE90017F40F /* Contact.swift */; };
700B63602A71E0810017F40F /* SettingsStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 700B635F2A71E0810017F40F /* SettingsStore.swift */; };
Expand Down Expand Up @@ -236,15 +244,19 @@
630DE0EB2C51AC840053603B /* UserDefaults+appGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDefaults+appGroup.swift"; sourceTree = "<group>"; };
630DE0F02C51AE870053603B /* Info-preview.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-preview.plist"; sourceTree = "<group>"; };
632793BD2C4AE4B500F942B1 /* Error+isAFTimeout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Error+isAFTimeout.swift"; sourceTree = "<group>"; };
635BCB0A2CC6F969004D52AA /* OpenAppIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenAppIntent.swift; sourceTree = "<group>"; };
636788082C90DC2600F5331E /* Notifications-preview.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Notifications-preview.entitlements"; sourceTree = "<group>"; };
6374ACDF2C49DA9600E637C0 /* Notifications.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Notifications.appex; sourceTree = BUILT_PRODUCTS_DIR; };
6374ACE12C49DA9600E637C0 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
6374ACE32C49DA9600E637C0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6374ACEB2C49DAB600E637C0 /* Notifications.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Notifications.entitlements; sourceTree = "<group>"; };
6374ACF82C4ACD5000E637C0 /* LoginStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginStore.swift; sourceTree = "<group>"; };
6374ACFC2C4ACD7500E637C0 /* Login.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Login.swift; sourceTree = "<group>"; };
638753072CC7036C003942F5 /* ShortcutsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortcutsManager.swift; sourceTree = "<group>"; };
63A5A04D2CD05CB600928EED /* ChannelEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelEntity.swift; sourceTree = "<group>"; };
63E27E0A2C5AF26C008ACB45 /* Alamofire+sessionWithSharedCookieStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Alamofire+sessionWithSharedCookieStorage.swift"; sourceTree = "<group>"; };
63E27E122C5AF5B8008ACB45 /* HTTPCookieStorage+forwardChanges.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "HTTPCookieStorage+forwardChanges.swift"; path = "Landscape/HTTPCookieStorage+forwardChanges.swift"; sourceTree = "<group>"; };
63EC5CBF2CD049540098C343 /* SQLiteDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLiteDB.swift; sourceTree = "<group>"; };
6C2E3173556A471DD304B334 /* Pods-Landscape.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Landscape.debug.xcconfig"; path = "Target Support Files/Pods-Landscape/Pods-Landscape.debug.xcconfig"; sourceTree = "<group>"; };
700B635A2A71DF860017F40F /* PocketUserAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PocketUserAPI.swift; sourceTree = "<group>"; };
700B635C2A71DFE90017F40F /* Contact.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contact.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -345,6 +357,8 @@
13B07FAE1A68108700A75B9A /* Landscape */ = {
isa = PBXGroup;
children = (
63EC5CBF2CD049540098C343 /* SQLiteDB.swift */,
635BCB092CC6F954004D52AA /* Intents */,
BB2F792B24A3F905000567C9 /* Supporting */,
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
Expand Down Expand Up @@ -386,6 +400,16 @@
name = "Landscape-preview";
sourceTree = "<group>";
};
635BCB092CC6F954004D52AA /* Intents */ = {
isa = PBXGroup;
children = (
63A5A04D2CD05CB600928EED /* ChannelEntity.swift */,
635BCB0A2CC6F969004D52AA /* OpenAppIntent.swift */,
638753072CC7036C003942F5 /* ShortcutsManager.swift */,
);
path = Intents;
sourceTree = "<group>";
};
6374ACE02C49DA9600E637C0 /* Notifications */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1198,7 +1222,9 @@
70D386672A60A37000AFB46E /* INPerson+Extension.swift in Sources */,
701A09B02B03081300D8F710 /* Error+logWithDomain.swift in Sources */,
70D3866C2A60A38400AFB46E /* Group.swift in Sources */,
63A5A04F2CD05CB900928EED /* ChannelEntity.swift in Sources */,
700B63602A71E0810017F40F /* SettingsStore.swift in Sources */,
635BCB0B2CC6F969004D52AA /* OpenAppIntent.swift in Sources */,
70D386712A60A3E600AFB46E /* UIColor+Extension.swift in Sources */,
700B635B2A71DF860017F40F /* PocketUserAPI.swift in Sources */,
6374ACFD2C4ACD7500E637C0 /* Login.swift in Sources */,
Expand All @@ -1207,6 +1233,8 @@
7036E3522ACD08E30020A9FB /* GroupChannelStore.swift in Sources */,
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
638753082CC7036C003942F5 /* ShortcutsManager.swift in Sources */,
63EC5CC02CD0495B0098C343 /* SQLiteDB.swift in Sources */,
70EAEAB52A57A99100FE96E4 /* UrbitModule.swift in Sources */,
700B63622A71E0D70017F40F /* ContactStore.swift in Sources */,
63E27E132C5AF5B9008ACB45 /* HTTPCookieStorage+forwardChanges.swift in Sources */,
Expand Down Expand Up @@ -1301,7 +1329,9 @@
70DBBFF42B7C60B50021EA96 /* Error+logWithDomain.swift in Sources */,
70DBBFF52B7C60B50021EA96 /* Group.swift in Sources */,
70DBBFF62B7C60B50021EA96 /* SettingsStore.swift in Sources */,
63A5A04E2CD05CB900928EED /* ChannelEntity.swift in Sources */,
70DBBFF72B7C60B50021EA96 /* UIColor+Extension.swift in Sources */,
635BCB0C2CC6F969004D52AA /* OpenAppIntent.swift in Sources */,
70DBBFF82B7C60B50021EA96 /* PocketUserAPI.swift in Sources */,
C83014832C7BA74C00D9A5CA /* UIFont+SystemDesign.m in Sources */,
6374ACFE2C4ACD7500E637C0 /* Login.swift in Sources */,
Expand All @@ -1310,6 +1340,8 @@
70DBBFFB2B7C60B50021EA96 /* GroupChannelStore.swift in Sources */,
70DBBFFC2B7C60B50021EA96 /* AppDelegate.mm in Sources */,
70DBBFFD2B7C60B50021EA96 /* main.m in Sources */,
638753092CC7036C003942F5 /* ShortcutsManager.swift in Sources */,
63EC5CC12CD0495B0098C343 /* SQLiteDB.swift in Sources */,
70DBBFFF2B7C60B50021EA96 /* UrbitModule.swift in Sources */,
70DBC0002B7C60B50021EA96 /* ContactStore.swift in Sources */,
63E27E142C5AF5B9008ACB45 /* HTTPCookieStorage+forwardChanges.swift in Sources */,
Expand Down Expand Up @@ -1395,7 +1427,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.1.1;
MARKETING_VERSION = 4.1.7;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1433,7 +1465,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.1.1;
MARKETING_VERSION = 4.1.7;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1657,7 +1689,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.0.2;
MARKETING_VERSION = 4.1.7;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1700,7 +1732,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.0.2;
MARKETING_VERSION = 4.1.7;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
Loading

0 comments on commit 694e662

Please sign in to comment.