Skip to content

Commit

Permalink
Login feature (#21)
Browse files Browse the repository at this point in the history
### Issue Link 🔗
<!-- What is your redmine link for this task? -->

### Goals ⚽
<!-- List the high-level objectives of this pull request. -->
<!-- Include any relevant context. -->

**The primary goals of this pull request:**
1. Improve the login feature in the community app, working alongside
Oğuzhan.
2. Use MVVM architecture and SwiftUI for development.
3. Add Firebase for various login options like email, anonymous, Apple,
and Google login.

### Implementation Details 🚧
<!-- Explain the reasoning behind any architectural changes. -->
<!-- Highlight any new functionality. -->

We've enhanced the login functionality of the community app, choosing
MVVM for its organization and SwiftUI for its simplicity. Firebase
integration adds versatile login methods, improving user experience and
security.

### Testing Details 🔍
<!-- Describe what tests you've added for your changes. -->

**TBD** 
### Screenshots/Gifs 📷
<!-- Add screenshots or Gifs when appropriate. -->

<img
src="https://github.com/SwiftBuddiesTR/BuddiesIOS/assets/98055405/6a4939c2-1f11-4ad4-bb8d-0b4348861ad8.gif"
width="150">

## PR Type
What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->

- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:
  • Loading branch information
darkbringer1 authored Oct 10, 2024
2 parents 25135be + 94d55d6 commit 0c72486
Show file tree
Hide file tree
Showing 45 changed files with 1,400 additions and 254 deletions.
318 changes: 197 additions & 121 deletions Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extension Target {
static func featureTarget(
name: String,
productName: String,
product: Product = .staticLibrary,
dependencies: [TargetDependency],
hasResources: Bool = false
) -> Self {
Expand All @@ -20,75 +21,204 @@ extension Target {
}
}

let localizationModule = Target.featureTarget(
name: "Localization",
productName: "Localization",
dependencies: [],
hasResources: true
)

let designModule = Target.featureTarget(
name: "Design",
productName: "Design",
dependencies: [.target(localizationModule)],
hasResources: true
)

let feedModule = Target.featureTarget(
name: "Feed",
productName: "Feed",
dependencies: [.target(designModule)]
)

let aboutModule = Target.featureTarget(
name: "About",
productName: "About",
dependencies: [.target(designModule)]
)

let contributorsModule = Target.featureTarget(
name: "Contributors",
productName: "Contributors",
dependencies: [.target(designModule)]
)

let mapModule = Target.featureTarget(
name: "Map",
productName: "Map",
dependencies: [.target(designModule)]
)

let authModule = Target.featureTarget(
name: "Auth",
productName: "Auth",
dependencies: [.package(product: "GoogleSignIn", type: .runtime, condition: .none)]
)

let onboardingModule = Target.featureTarget(
name: "Onboarding",
productName: "Onboarding",
dependencies: [.target(designModule)]
)

let localicationCodegen = Target.target(
name: "LocalizationCodegen",
destinations: .macOS,
product: .commandLineTool,
productName: "LocalizationCodegen",
bundleId: "com.swiftbuddies.localization",
sources: ["SwiftBuddiesIOS/Targets/ScriptsModule/LocalizationCodegen/**"],
scripts: [],
dependencies: [.package(product: "ArgumentParser", type: .runtime, condition: .none)],
coreDataModels: [],
environmentVariables: [:],
launchArguments: [],
additionalFiles: [],
buildRules: [],
mergedBinaryType: .automatic,
mergeable: false
let project = Project(
name: "Buddies",
packages: [
.remote(url: "https://github.com/google/GoogleSignIn-iOS.git", requirement: .exact("7.0.0")),
.remote(url: "https://github.com/apple/swift-argument-parser.git", requirement: .exact("1.3.0")),
.remote(url: "https://github.com/darkbringer1/BuddiesNetwork.git", requirement: .branch("main"))
],
targets: [
.target(
name: "SwiftBuddiesIOS",
destinations: .iOS,
product: .app,
bundleId: "com.swiftbuddies.SwiftBuddiesIOS",
infoPlist: .extendingDefault(
with: [
"CFBundleShortVersionString": "1.0",
"CFBundleVersion": "1",
"UIMainStoryboardFile": "",
"UILaunchStoryboardName": "LaunchScreen",
"CLIENT_ID": "1015261010783-dq3s025o2j6pcj81ped6nqpbiv5m1fvr.apps.googleusercontent.com",
"REVERSED_CLIENT_ID": "com.googleusercontent.apps.1015261010783-dq3s025o2j6pcj81ped6nqpbiv5m1fvr",
"CFBundleURLTypes": [
["CFBundleURLSchemes": ["com.googleusercontent.apps.1015261010783-dq3s025o2j6pcj81ped6nqpbiv5m1fvr"]]
]
]
),
sources: ["SwiftBuddiesIOS/Sources/**"],
resources: ["SwiftBuddiesIOS/Resources/**"],
dependencies: [
.package(product: "GoogleSignIn", type: .runtime, condition: .none),
.package(product: "BuddiesNetwork", type: .runtime, condition: .none),
.target(Modules.design.target),
.target(Modules.auth.target),
.target(Modules.onboarding.target),
.target(Modules.login.target),
.target(Modules.feed.target),
.target(Modules.map.target),
.target(Modules.profile.target),
.target(Modules.contributors.target),
.target(Modules.network.target),
.target(Modules.localization.target),
.target(Modules.core.target)
]
),
Modules.design.target,
Modules.auth.target,
Modules.onboarding.target,
Modules.login.target,
Modules.feed.target,
Modules.map.target,
Modules.profile.target,
Modules.contributors.target,
Modules.network.target,
Modules.localization.target,
Modules.core.target,
Modules.localicationCodegen
]
)


enum Modules: CaseIterable {
case core
case localization
case design
case network
case auth
case onboarding
case login
case feed
case map
case profile
case contributors


var target: Target {
switch self {
case .core:
Target.featureTarget(
name: "Core",
productName: "Core",
dependencies:
[.target(Modules.auth.target), .target(Modules.network.target),
.package(product: "GoogleSignIn", type: .runtime, condition: .none)]
// []
)
case .localization:
Target.featureTarget(
name: "Localization",
productName: "Localization",
dependencies: [],
hasResources: true
)
case .design:
Target.featureTarget(
name: "Design",
productName: "Design",
dependencies: [.target(Modules.localization.target)],
hasResources: true
)
case .network:
Target.featureTarget(
name: "Network",
productName: "Network",
dependencies: [
.package(product: "BuddiesNetwork", type: .runtime, condition: .none)
]
)
case .auth:
Target.featureTarget(
name: "Auth",
productName: "Auth",
dependencies: [
.target(Modules.network.target),
// .target(Modules.core.target),
.package(product: "GoogleSignIn", type: .runtime, condition: .none)
]
)
case .onboarding:
Target.featureTarget(
name: "Onboarding",
productName: "Onboarding",
dependencies: [
.target(Modules.design.target),
.target(Modules.core.target),
]
)
case .login:
Target.featureTarget(
name: "Login",
productName: "Login",
dependencies: [
.target(Modules.design.target),
.target(Modules.auth.target),
.target(Modules.network.target),
.target(Modules.core.target),
.package(product: "GoogleSignIn", type: .runtime, condition: .none)
]
)
case .feed:
Target.featureTarget(
name: "Feed",
productName: "Feed",
dependencies: [
.target(Modules.core.target),
.target(Modules.design.target)
]
)
case .map:
Target.featureTarget(
name: "Map",
productName: "Map",
dependencies: [
.target(Modules.core.target),
.target(Modules.design.target)
]
)
case .profile:
Target.featureTarget(
name: "Profile",
productName: "Profile",
dependencies: [
.target(Modules.design.target),
.target(Modules.auth.target),
.target(Modules.network.target),
.target(Modules.core.target),
.package(product: "GoogleSignIn", type: .runtime, condition: .none)
]
)
case .contributors:
Target.featureTarget(
name: "Contributors",
productName: "Contributors",
dependencies: [
.target(Modules.core.target),
.target(Modules.design.target)
]
)
}
}

static let localicationCodegen = Target.target(
name: "LocalizationCodegen",
destinations: .macOS,
product: .commandLineTool,
productName: "LocalizationCodegen",
bundleId: "com.swiftbuddies.localization",
sources: ["SwiftBuddiesIOS/Targets/ScriptsModule/LocalizationCodegen/**"],
scripts: [],
dependencies: [.package(product: "ArgumentParser", type: .runtime, condition: .none)],
coreDataModels: [],
environmentVariables: [:],
launchArguments: [],
additionalFiles: [],
buildRules: [],
mergedBinaryType: .automatic,
mergeable: false
)
}

//let scriptsModule = Target.target(
// name: "Scripts",
Expand All @@ -98,7 +228,7 @@ let localicationCodegen = Target.target(
// bundleId: "com.swiftbuddies.scripts",
// deploymentTargets: nil,
// infoPlist: nil,
//
//
// sources: ["SwiftBuddiesIOS/Targets/ScriptsModule/**"],
// resources: nil,
// copyFiles: nil,
Expand All @@ -115,57 +245,3 @@ let localicationCodegen = Target.target(
// mergedBinaryType: .automatic,
// mergeable: false
//)

let project = Project(
name: "SwiftBuddiesIOS",
packages: [
.remote(url: "https://github.com/google/GoogleSignIn-iOS.git", requirement: .exact("7.0.0")),
.remote(url: "https://github.com/apple/swift-argument-parser.git", requirement: .exact("1.3.0"))
],
targets: [
.target(
name: "SwiftBuddiesIOS",
destinations: .iOS,
product: .app,
bundleId: "io.tuist.SwiftBuddiesIOS",
infoPlist: .extendingDefault(
with: [
"CFBundleShortVersionString": "1.0",
"CFBundleVersion": "1",
"UIMainStoryboardFile": "",
"UILaunchStoryboardName": "LaunchScreen",
"CLIENT_ID": "221417854896-bs0p0kp2qou67t91g9dtal8pbrv4rki8.apps.googleusercontent.com",
"REVERSED_CLIENT_ID": "com.googleusercontent.apps.221417854896-bs0p0kp2qou67t91g9dtal8pbrv4rki8",
"CFBundleURLTypes": [
["CFBundleURLSchemes": ["com.googleusercontent.apps.221417854896-bs0p0kp2qou67t91g9dtal8pbrv4rki8"]]
]
]
),
sources: ["SwiftBuddiesIOS/Sources/**"],
resources: ["SwiftBuddiesIOS/Resources/**"],
dependencies: [
.package(product: "GoogleSignIn", type: .runtime, condition: .none),
.target(authModule),
.target(feedModule),
.target(designModule),
.target(contributorsModule),
.target(mapModule),
.target(aboutModule),
.target(onboardingModule),
.target(localizationModule)
// .target(scriptsModule),
// .target(localicationCodegen)
]
),
authModule,
feedModule,
designModule,
contributorsModule,
mapModule,
aboutModule,
onboardingModule,
// scriptsModule,
localizationModule,
localicationCodegen
]
)
34 changes: 34 additions & 0 deletions SwiftBuddiesIOS/Resources/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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>CLIENT_ID</key>
<string>1015261010783-dq3s025o2j6pcj81ped6nqpbiv5m1fvr.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.1015261010783-dq3s025o2j6pcj81ped6nqpbiv5m1fvr</string>
<key>API_KEY</key>
<string>AIzaSyAUZb6hIeGqfUZ21fpMnFjOpZXv9BUUtKg</string>
<key>GCM_SENDER_ID</key>
<string>1015261010783</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>io.tuist.SwiftBuddiesIOS</string>
<key>PROJECT_ID</key>
<string>swiftbuddies-717e1</string>
<key>STORAGE_BUCKET</key>
<string>swiftbuddies-717e1.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:1015261010783:ios:470fb09b3e679ad779b4ea</string>
</dict>
</plist>
Loading

0 comments on commit 0c72486

Please sign in to comment.