Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
84 changes: 84 additions & 0 deletions src/apps/mobile/ios/BitFun.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {

/* Begin PBXBuildFile section */
A10000000000000000000001 /* BitFunApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000001 /* BitFunApp.swift */; };
A10000000000000000000002 /* MobileAppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000002 /* MobileAppModel.swift */; };
A10000000000000000000003 /* BitFunTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000003 /* BitFunTheme.swift */; };
A10000000000000000000004 /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000004 /* SidebarView.swift */; };
A10000000000000000000005 /* ConversationHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000005 /* ConversationHeader.swift */; };
A10000000000000000000006 /* ChatTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000006 /* ChatTimelineView.swift */; };
A10000000000000000000007 /* ComposerBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000007 /* ComposerBar.swift */; };
A10000000000000000000008 /* MobileShellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000008 /* MobileShellView.swift */; };
A10000000000000000000010 /* MobileCoreAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000010 /* MobileCoreAdapter.swift */; };
A10000000000000000000011 /* BitFunMobileCore.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = B10000000000000000000011 /* BitFunMobileCore.xcframework */; };
A10000000000000000000012 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B10000000000000000000012 /* libsqlite3.tbd */; };
A10000000000000000000009 /* Resources.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B10000000000000000000009 /* Resources.xcassets */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
B10000000000000000000000 /* BitFun.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BitFun.app; sourceTree = BUILT_PRODUCTS_DIR; };
B10000000000000000000001 /* BitFunApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BitFunApp.swift; sourceTree = "<group>"; };
B10000000000000000000002 /* MobileAppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileAppModel.swift; sourceTree = "<group>"; };
B10000000000000000000003 /* BitFunTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BitFunTheme.swift; sourceTree = "<group>"; };
B10000000000000000000004 /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = "<group>"; };
B10000000000000000000005 /* ConversationHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationHeader.swift; sourceTree = "<group>"; };
B10000000000000000000006 /* ChatTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatTimelineView.swift; sourceTree = "<group>"; };
B10000000000000000000007 /* ComposerBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposerBar.swift; sourceTree = "<group>"; };
B10000000000000000000008 /* MobileShellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileShellView.swift; sourceTree = "<group>"; };
B10000000000000000000010 /* MobileCoreAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileCoreAdapter.swift; sourceTree = "<group>"; };
B10000000000000000000011 /* BitFunMobileCore.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = "../../shared/core-feature/build/XCFrameworks/debug/BitFunMobileCore.xcframework"; sourceTree = "<group>"; };
B10000000000000000000012 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.text-based-dylib-definition; name = libsqlite3.tbd; path = "$(SDKROOT)/usr/lib/libsqlite3.tbd"; sourceTree = SDKROOT; };
B10000000000000000000009 /* Resources.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Resources.xcassets; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
C10000000000000000000001 /* Frameworks */ = {isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( A10000000000000000000011 /* BitFunMobileCore.xcframework in Frameworks */, A10000000000000000000012 /* libsqlite3.tbd in Frameworks */ ); runOnlyForDeploymentPostprocessing = 0; };
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
D10000000000000000000000 = {isa = PBXGroup; children = (D10000000000000000000001 /* BitFun */, D10000000000000000000009 /* Products */); sourceTree = "<group>"; };
D10000000000000000000001 /* BitFun */ = {isa = PBXGroup; children = (D10000000000000000000002 /* App */, D10000000000000000000003 /* Features */, D10000000000000000000008 /* Infrastructure */, B10000000000000000000009 /* Resources.xcassets */, B10000000000000000000011 /* BitFunMobileCore.xcframework */, B10000000000000000000012 /* libsqlite3.tbd */); path = BitFun; sourceTree = "<group>"; };
D10000000000000000000002 /* App */ = {isa = PBXGroup; children = (B10000000000000000000001 /* BitFunApp.swift */); path = App; sourceTree = "<group>"; };
D10000000000000000000003 /* Features */ = {isa = PBXGroup; children = (D10000000000000000000004 /* Chat */, D10000000000000000000005 /* Shell */); path = Features; sourceTree = "<group>"; };
D10000000000000000000004 /* Chat */ = {isa = PBXGroup; children = (B10000000000000000000005 /* ConversationHeader.swift */, B10000000000000000000006 /* ChatTimelineView.swift */, B10000000000000000000007 /* ComposerBar.swift */); path = Chat; sourceTree = "<group>"; };
D10000000000000000000005 /* Shell */ = {isa = PBXGroup; children = (B10000000000000000000003 /* BitFunTheme.swift */, B10000000000000000000004 /* SidebarView.swift */, B10000000000000000000008 /* MobileShellView.swift */); path = Shell; sourceTree = "<group>"; };
D10000000000000000000008 /* Infrastructure */ = {isa = PBXGroup; children = (B10000000000000000000002 /* MobileAppModel.swift */, B10000000000000000000010 /* MobileCoreAdapter.swift */); path = Infrastructure; sourceTree = "<group>"; };
D10000000000000000000009 /* Products */ = {isa = PBXGroup; children = (B10000000000000000000000 /* BitFun.app */); name = Products; sourceTree = "<group>"; };
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
E10000000000000000000001 /* BitFun */ = {isa = PBXNativeTarget; buildConfigurationList = F10000000000000000000002 /* Build configuration list for PBXNativeTarget "BitFun" */; buildPhases = (C10000000000000000000002 /* Sources */, C10000000000000000000001 /* Frameworks */, C10000000000000000000003 /* Resources */); buildRules = ( ); dependencies = ( ); name = BitFun; productName = BitFun; productReference = B10000000000000000000000 /* BitFun.app */; productType = "com.apple.product-type.application"; };
/* End PBXNativeTarget section */

/* Begin PBXProject section */
E10000000000000000000000 /* Project object */ = {isa = PBXProject; attributes = {LastUpgradeCheck = 1640; TargetAttributes = {E10000000000000000000001 = {CreatedOnToolsVersion = 16.4; }; }; }; buildConfigurationList = F10000000000000000000001 /* Build configuration list for PBXProject "BitFun" */; compatibilityVersion = "Xcode 14.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = (en, Base); mainGroup = D10000000000000000000000; productRefGroup = D10000000000000000000009 /* Products */; projectDirPath = ""; projectRoot = ""; targets = (E10000000000000000000001 /* BitFun */); };
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
C10000000000000000000002 /* Sources */ = {isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = (A10000000000000000000001, A10000000000000000000002, A10000000000000000000003, A10000000000000000000004, A10000000000000000000005, A10000000000000000000006, A10000000000000000000007, A10000000000000000000008, A10000000000000000000010); runOnlyForDeploymentPostprocessing = 0; };
/* End PBXSourcesBuildPhase section */

/* Begin PBXResourcesBuildPhase section */
C10000000000000000000003 /* Resources */ = {isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = (A10000000000000000000009); runOnlyForDeploymentPostprocessing = 0; };
/* End PBXResourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
F10000000000000000000003 /* Debug */ = {isa = XCBuildConfiguration; buildSettings = {ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGNING_ALLOWED = NO; CODE_SIGNING_REQUIRED = NO; DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/../shared/core-feature/build/XCFrameworks/debug" ); INFOPLIST_FILE = BitFun/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; PRODUCT_BUNDLE_IDENTIFIER = com.bitfun.mobile.ios; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; };
F10000000000000000000004 /* Release */ = {isa = XCBuildConfiguration; buildSettings = {ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGNING_ALLOWED = NO; CODE_SIGNING_REQUIRED = NO; DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/../shared/core-feature/build/XCFrameworks/debug" ); INFOPLIST_FILE = BitFun/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; PRODUCT_BUNDLE_IDENTIFIER = com.bitfun.mobile.ios; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; };
F10000000000000000000005 /* Target Debug */ = {isa = XCBuildConfiguration; buildSettings = {SDKROOT = iphoneos; }; name = Debug; };
F10000000000000000000006 /* Target Release */ = {isa = XCBuildConfiguration; buildSettings = {SDKROOT = iphoneos; }; name = Release; };
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
F10000000000000000000001 /* Build configuration list for PBXProject "BitFun" */ = {isa = XCConfigurationList; buildConfigurations = (F10000000000000000000003 /* Debug */, F10000000000000000000004 /* Release */); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; };
F10000000000000000000002 /* Build configuration list for PBXNativeTarget "BitFun" */ = {isa = XCConfigurationList; buildConfigurations = (F10000000000000000000005 /* Target Debug */, F10000000000000000000006 /* Target Release */); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; };
/* End XCConfigurationList section */
};
rootObject = E10000000000000000000000 /* Project object */;
}
13 changes: 13 additions & 0 deletions src/apps/mobile/ios/BitFun/App/BitFunApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import SwiftUI

@main
struct BitFunApp: App {
@StateObject private var model = MobileAppModel.launchConfigured

var body: some Scene {
WindowGroup {
MobileShellView(model: model)
.preferredColorScheme(.light)
}
}
}
59 changes: 59 additions & 0 deletions src/apps/mobile/ios/BitFun/Features/Chat/ChatTimelineView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import SwiftUI

struct ChatTimelineView: View {
@ObservedObject var model: MobileAppModel

var body: some View {
ScrollViewReader { proxy in
ScrollView(showsIndicators: false) {
LazyVStack(spacing: 0) {
ForEach(model.messages) { message in
ChatMessageBubble(message: message)
.id(message.id)
}
if model.isSending {
HStack(spacing: 5) {
Circle().fill(BitFunTheme.muted).frame(width: 5, height: 5)
Circle().fill(BitFunTheme.muted).frame(width: 5, height: 5)
Circle().fill(BitFunTheme.muted).frame(width: 5, height: 5)
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 20)
.padding(.vertical, 15)
}
}
.padding(.horizontal, 16)
.padding(.top, 8)
.padding(.bottom, 14)
}
.onChange(of: model.messages.count) { _ in
if let id = model.messages.last?.id {
withAnimation(.easeOut(duration: 0.18)) { proxy.scrollTo(id, anchor: .bottom) }
}
}
}
.background(BitFunTheme.page)
}
}

private struct ChatMessageBubble: View {
let message: ChatMessage

var body: some View {
VStack(alignment: message.role == .user ? .trailing : .leading, spacing: 0) {
Text(message.text)
.font(.system(size: 15, weight: .regular))
.foregroundStyle(BitFunTheme.ink)
.lineSpacing(4)
.padding(.horizontal, 14)
.padding(.vertical, 11)
.background(message.role == .user ? BitFunTheme.soft : BitFunTheme.card)
.clipShape(RoundedRectangle(cornerRadius: 17))
.overlay(RoundedRectangle(cornerRadius: 17).stroke(BitFunTheme.line, lineWidth: 1))
.frame(maxWidth: 320, alignment: message.role == .user ? .trailing : .leading)
}
.frame(maxWidth: .infinity, alignment: message.role == .user ? .trailing : .leading)
.padding(.top, message.role == .user ? 8 : 2)
.padding(.bottom, message.role == .user ? 12 : 10)
}
}
56 changes: 56 additions & 0 deletions src/apps/mobile/ios/BitFun/Features/Chat/ComposerBar.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import SwiftUI

struct ComposerBar: View {
@ObservedObject var model: MobileAppModel
@FocusState private var focused: Bool

var body: some View {
HStack(spacing: 5) {
Button { } label: {
ReferenceGlyph(assetName: "ComposerPlusGlyph", width: 18, height: 18)
.frame(width: 40, height: 40)
}
.buttonStyle(.plain)
TextField(
model.surface == .remote ? "向 BitFun 提问" : (model.localSessionSelected ? "输入消息" : "问问 BitFun"),
text: $model.draft,
axis: .vertical
)
.font(.system(size: 15))
.foregroundStyle(BitFunTheme.ink)
.lineLimit(1...4)
.focused($focused)
.submitLabel(.send)
.onSubmit { model.send() }
.onChange(of: model.draft) { _ in model.syncDraftToCore() }
Button { model.send() } label: {
if model.isSending {
Image(systemName: "stop.fill")
.font(.system(size: 16, weight: .bold))
.foregroundStyle(BitFunTheme.accent)
.frame(width: 40, height: 40)
} else if model.draft.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
ReferenceGlyph(assetName: "ComposerMicGlyph", width: 16, height: 19)
.foregroundStyle(BitFunTheme.muted)
.frame(width: 40, height: 40)
} else {
Image(systemName: "arrow.up")
.font(.system(size: 16, weight: .bold))
.foregroundStyle(BitFunTheme.accent)
.frame(width: 40, height: 40)
}
}
.buttonStyle(.plain)
}
.padding(.horizontal, 8)
.frame(minHeight: 52)
.background(BitFunTheme.card)
.clipShape(RoundedRectangle(cornerRadius: 20))
.overlay(RoundedRectangle(cornerRadius: 20).stroke(BitFunTheme.line, lineWidth: 1))
.shadow(color: .black.opacity(0.07), radius: 10, y: 2)
.padding(.horizontal, 16)
.padding(.top, 8)
.padding(.bottom, 14)
.background(BitFunTheme.page)
}
}
55 changes: 55 additions & 0 deletions src/apps/mobile/ios/BitFun/Features/Chat/ConversationHeader.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import SwiftUI

struct ConversationHeader: View {
@ObservedObject var model: MobileAppModel
@State private var menuOpen = false

var body: some View {
HStack(spacing: 8) {
Button { model.drawerOpen = true } label: {
ReferenceGlyph(assetName: "MenuGlyph", width: 23, height: 18)
.frame(width: 44, height: 44)
.background(BitFunTheme.card)
.overlay(Circle().stroke(BitFunTheme.line, lineWidth: 1))
.clipShape(Circle())
.shadow(color: .black.opacity(0.07), radius: 8, y: 3)
}
.buttonStyle(.plain)
VStack(spacing: 3) {
Text(model.selectedSession?.title ?? "BitFun")
.font(.system(size: 17, weight: .medium))
.foregroundStyle(BitFunTheme.ink)
.lineLimit(1)
if model.surface == .local && model.localSessionSelected {
Text("本地会话")
.font(.system(size: 14))
.foregroundStyle(BitFunTheme.muted)
} else if model.remoteConnected && model.remoteSessionSelected {
Text("DESKTOP-KM3L4UI")
.font(.system(size: 14))
.foregroundStyle(BitFunTheme.muted)
}
}
.frame(maxWidth: .infinity)
.contentShape(Rectangle())
.onTapGesture { }

Menu {
Button("置顶会话") { }
Button("导出会话") { }
Button("归档会话") { }
} label: {
ReferenceGlyph(assetName: "MoreGlyph", width: 23, height: 7)
.frame(width: 44, height: 44)
.background(BitFunTheme.card)
.overlay(Circle().stroke(BitFunTheme.line, lineWidth: 1))
.clipShape(Circle())
.shadow(color: .black.opacity(0.07), radius: 8, y: 3)
}
}
.frame(height: 76)
.padding(.horizontal, 16)
.padding(.vertical, 8)
.background(BitFunTheme.page)
}
}
Loading