Skip to content

Commit

Permalink
Merge branch 'main' into faeture/apply_custom_font_for_ios
Browse files Browse the repository at this point in the history
  • Loading branch information
Corvus400 authored Sep 3, 2023
2 parents a74e33b + 8aba1b7 commit ce479c1
Show file tree
Hide file tree
Showing 38 changed files with 486 additions and 283 deletions.
1 change: 1 addition & 0 deletions app-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
id("droidkaigi.primitive.android.compose")
id("droidkaigi.primitive.android.hilt")
id("droidkaigi.primitive.android.firebase")
id("droidkaigi.primitive.android.crashlytics")
id("droidkaigi.primitive.detekt")
id("droidkaigi.primitive.android.roborazzi")
id("droidkaigi.primitive.kover")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import io.github.droidkaigi.confsched2023.main.MainNestedGraphStateHolder
import io.github.droidkaigi.confsched2023.main.MainScreenTab
import io.github.droidkaigi.confsched2023.main.MainScreenTab.About
import io.github.droidkaigi.confsched2023.main.MainScreenTab.Badges
import io.github.droidkaigi.confsched2023.main.MainScreenTab.Contributor
import io.github.droidkaigi.confsched2023.main.MainScreenTab.FloorMap
import io.github.droidkaigi.confsched2023.main.MainScreenTab.Timetable
import io.github.droidkaigi.confsched2023.main.mainScreen
Expand Down Expand Up @@ -150,27 +149,18 @@ private fun NavGraphBuilder.mainScreen(
)
nestedAboutScreen(
onAboutItemClick = { aboutItem ->
val portalBaseUrl = if (defaultLang() == JAPANESE) {
"https://portal.droidkaigi.jp"
} else {
"https://portal.droidkaigi.jp/en"
}
when (aboutItem) {
Sponsors -> navController.navigateSponsorsScreen()
CodeOfConduct -> {
val url = if (defaultLang() == JAPANESE) {
"https://portal.droidkaigi.jp/about/code-of-conduct"
} else {
"https://portal.droidkaigi.jp/en/about/code-of-conduct"
}
externalNavController.navigate(url = url)
}
CodeOfConduct -> { externalNavController.navigate(url = "$portalBaseUrl/about/code-of-conduct") }
Contributors -> mainNestedNavController.navigate(contributorsScreenRoute)
License -> externalNavController.navigateToLicenseScreen()
Medium -> externalNavController.navigate(url = "https://medium.com/droidkaigi")
PrivacyPolicy -> {
val url = if (defaultLang() == JAPANESE) {
"https://portal.droidkaigi.jp/about/privacy"
} else {
"https://portal.droidkaigi.jp/en/about/privacy"
}
externalNavController.navigate(url = url)
}
PrivacyPolicy -> { externalNavController.navigate(url = "$portalBaseUrl/about/privacy") }
Staff -> navController.navigateStaffScreen()
X -> externalNavController.navigate(url = "https://twitter.com/DroidKaigi")
YouTube -> externalNavController.navigate(url = "https://www.youtube.com/c/DroidKaigi")
Expand Down Expand Up @@ -215,7 +205,6 @@ class KaigiAppMainNestedGraphStateHolder : MainNestedGraphStateHolder {
override fun routeToTab(route: String): MainScreenTab? {
return when (route) {
timetableScreenRoute -> Timetable
contributorsScreenRoute -> Contributor
aboutScreenRoute -> About
floorMapScreenRoute -> FloorMap
stampsScreenRoute -> Badges
Expand All @@ -231,11 +220,6 @@ class KaigiAppMainNestedGraphStateHolder : MainNestedGraphStateHolder {
Timetable -> mainNestedNavController.navigateTimetableScreen()
About -> mainNestedNavController.navigateAboutScreen()
FloorMap -> mainNestedNavController.navigateFloorMapScreen()
Contributor -> mainNestedNavController.navigate(contributorsScreenRoute) {
launchSingleTop = true
restoreState = true
}

Badges -> mainNestedNavController.navigateStampsScreen()
}
}
Expand Down Expand Up @@ -304,7 +288,7 @@ private class ExternalNavController(
shareNavigator.share(
"[${timeTableItem.room.name.currentLangTitle}] ${timeTableItem.startsTimeString} - ${timeTableItem.endsTimeString}\n" +
"${timeTableItem.title.currentLangTitle}\n" +
"https://2023.droidkaigi.jp/timetable/${timeTableItem.id.value}",
timeTableItem.url,
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package io.github.droidkaigi.confsched2023

import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
Expand All @@ -10,6 +13,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.window.layout.DisplayFeature
import androidx.window.layout.WindowInfoTracker
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -23,7 +28,27 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

enableEdgeToEdge()
// Navigation icon color can be changed since API 26(O)
if (VERSION.SDK_INT < VERSION_CODES.O) {
enableEdgeToEdge()
} else {
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.auto(
lightScrim = Color.Transparent.toArgb(),
darkScrim = Color.Transparent.toArgb(),
),
navigationBarStyle = SystemBarStyle.auto(
lightScrim = Color.Transparent.toArgb(),
darkScrim = Color.Transparent.toArgb(),
),
)

// For API29(Q) or higher and 3-button navigation,
// the following code must be written to make the navigation color completely transparent.
if (VERSION.SDK_INT >= VERSION_CODES.Q) {
window.isNavigationBarContrastEnforced = false
}
}

setContent {
val windowSize = calculateWindowSizeClass(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,6 @@ class KaigiAppTest {
}
}

@Test
fun checkNavigateToContributorShot() {
kaigiAppRobot {
goToContributor()
capture()
}
}

@Test
fun checkNavigateToTimetableItemDetailShot() {
kaigiAppRobot {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
9EB9E9E92AA2BF3800A9CBA1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
D77DAF6D29FAA148007195DB /* DroidKaigi2023.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DroidKaigi2023.app; sourceTree = BUILT_PRODUCTS_DIR; };
D77DAF7029FAA148007195DB /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
D77DAF7429FAA149007195DB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -109,6 +110,7 @@
D77DAF6F29FAA148007195DB /* DroidKaigi2023 */ = {
isa = PBXGroup;
children = (
9EB9E9E92AA2BF3800A9CBA1 /* Info.plist */,
D77DAF7029FAA148007195DB /* App.swift */,
D77DAF7429FAA149007195DB /* Assets.xcassets */,
D77DAF7629FAA149007195DB /* DroidKaigi2023.entitlements */,
Expand Down Expand Up @@ -235,10 +237,11 @@
};
buildConfigurationList = D77DAF6829FAA148007195DB /* Build configuration list for PBXProject "DroidKaigi2023" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
developmentRegion = ja;
hasScannedForEncodings = 0;
knownRegions = (
en,
ja,
Base,
);
mainGroup = D77DAF6429FAA148007195DB;
Expand Down Expand Up @@ -449,6 +452,7 @@
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = DroidKaigi2023/Info.plist;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand Down Expand Up @@ -489,6 +493,7 @@
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = DroidKaigi2023/Info.plist;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand Down
32 changes: 0 additions & 32 deletions app-ios/App/DroidKaigi2023/DroidKaigi2023/ContentView.swift

This file was deleted.

8 changes: 8 additions & 0 deletions app-ios/App/DroidKaigi2023/DroidKaigi2023/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>CFBundleAllowMixedLocalizations</key>
<true/>
</dict>
</plist>
2 changes: 2 additions & 0 deletions app-ios/Modules/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PackageDescription

var package = Package(
name: "Modules",
defaultLocalization: "ja",
platforms: [
.iOS(.v16),
],
Expand Down Expand Up @@ -84,6 +85,7 @@ var package = Package(
"Assets",
"Component",
"KMPContainer",
"shared",
"Model",
.product(name: "Dependencies", package: "swift-dependencies"),
]
Expand Down
6 changes: 6 additions & 0 deletions app-ios/Modules/Sources/About/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public struct AboutView<ContributorView: View, StaffView: View, SponsorView: Vie
Text(Bundle.main.formattedVersion)
.font(Font.custom(FontAssets.Montserrat.medium, size: 14))
.fontWeight(.medium)
Spacer().frame(height: 8)
Text("The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.")
.foregroundStyle(AssetColors.About.androidRobotDescription.swiftUIColor)
.font(Font.custom(FontAssets.Montserrat.medium, size: 11))
.fontWeight(.medium)
.multilineTextAlignment(.center)
}
.padding(16)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 10 additions & 0 deletions app-ios/Modules/Sources/Assets/swiftgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ fonts:
params:
enumName: FontAssets
publicAccess: true

strings:
inputs:
- Strings/ja.lproj
outputs:
templateName: structured-swift5
output: Strings.generated.swift
params:
publicAccess: true
bundle: Bundle.myModule
8 changes: 4 additions & 4 deletions app-ios/Modules/Sources/Component/CacheAsyncImage.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import SwiftUI

public struct CacheAsyncImage<Content, PlaceHolder>: View where Content: View, PlaceHolder: View {

private let url: URL?
private let scale: CGFloat
private let contentImage: (Image) -> Content
private let placeholder: () -> PlaceHolder

public init(
url: URL?,
scale: CGFloat = 1.0,
Expand All @@ -18,7 +18,7 @@ public struct CacheAsyncImage<Content, PlaceHolder>: View where Content: View, P
self.contentImage = contentImage
self.placeholder = placeholder
}

public var body: some View {
if let cachedImage = ImageCache[url] {
contentImage(cachedImage)
Expand All @@ -44,7 +44,7 @@ private extension CacheAsyncImage {

private class ImageCache {
static private var cache: [URL: Image] = [:]

static subscript(url: URL?) -> Image? {
get {
guard let url else { return nil }
Expand Down
Loading

0 comments on commit ce479c1

Please sign in to comment.