-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ce4f7ee
Showing
99 changed files
with
22,885 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Xcode ### | ||
# Xcode | ||
# | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
## User settings | ||
xcuserdata/ | ||
|
||
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) | ||
*.xcscmblueprint | ||
*.xccheckout | ||
|
||
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) | ||
build/ | ||
DerivedData/ | ||
*.moved-aside | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
|
||
### Xcode Patch ### | ||
*.xcodeproj/* | ||
!*.xcodeproj/project.pbxproj | ||
!*.xcodeproj/xcshareddata/ | ||
!*.xcworkspace/contents.xcworkspacedata | ||
/*.gcno | ||
|
||
### Projects ### | ||
*.xcodeproj | ||
*.xcworkspace | ||
|
||
### Tuist derived files ### | ||
graph.dot | ||
Derived/ | ||
|
||
### Tuist managed dependencies ### | ||
Tuist/Dependencies |
21 changes: 21 additions & 0 deletions
21
App/CatchUI/Resources/Assets.xcassets/Background.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "pokemonBackground.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+432 KB
App/CatchUI/Resources/Assets.xcassets/Background.imageset/pokemonBackground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
App/CatchUI/Resources/Assets.xcassets/Ball.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "Ball.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
App/CatchUI/Resources/Assets.xcassets/PokemonPlaceholder.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "PokemonPlaceholder.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+4.42 KB
...UI/Resources/Assets.xcassets/PokemonPlaceholder.imageset/PokemonPlaceholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// CatchActions.swift | ||
// CatchUI | ||
// | ||
// Created by Ronan on 01/07/21. | ||
// Copyright © 2021 Sonomos. All rights reserved. | ||
// | ||
|
||
import Common | ||
|
||
public protocol CatchActions { | ||
func catchPokemon() | ||
} | ||
|
||
extension Actions: CatchActions { | ||
public func catchPokemon() { | ||
dataProvider?.catchPokemon() | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
App/CatchUI/Sources/Scenes/Catch Scene/CatchDataProvider.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// CatchDataProvider.swift | ||
// CatchUI | ||
// | ||
// Created by Ronan on 01/07/21. | ||
// Copyright © 2021 Sonomos. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Common | ||
|
||
public protocol CatchDataProvider { | ||
func pokemon() -> ScreenPokemon? | ||
func newSpecies() -> Bool | ||
} | ||
|
||
extension DataProvider: CatchDataProvider { | ||
public func pokemon() -> ScreenPokemon? { | ||
guard let foundPokemon = appData.pokemon else { return nil } | ||
return ScreenPokemon(name: foundPokemon.name, | ||
weight: foundPokemon.weight, | ||
height: foundPokemon.height, | ||
iconPath: foundPokemon.sprites.frontDefault) | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
App/CatchUI/Sources/Scenes/Catch Scene/CatchPresenter.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// CatchPresenter.swift | ||
// CatchUI | ||
// | ||
// Created by Ronan on 01/07/21. | ||
// Copyright © 2021 Sonomos. All rights reserved. | ||
// | ||
|
||
import Common | ||
|
||
protocol CatchView: AnyObject { | ||
func update() | ||
func showLeaveOrCatchAlert() | ||
func showLeaveItAlert() | ||
func showNotFoundAlert() | ||
func showError(message: String) | ||
} | ||
|
||
public protocol CatchPresenting: AnyObject { | ||
func pokemon() -> ScreenPokemon? | ||
func catchPokemonAction() | ||
} | ||
|
||
public class CatchPresenter: CatchPresenting, Updatable { | ||
|
||
// MARK: Properties | ||
|
||
private weak var view: CatchView? | ||
private var actions: CatchActions | ||
private var dataProvider: CatchDataProvider | ||
|
||
// MARK: Typealias | ||
|
||
typealias Actions = CatchActions | ||
typealias DataProvider = CatchDataProvider | ||
typealias View = CatchView | ||
|
||
required init(view: CatchView, actions: CatchActions, dataProvider: CatchDataProvider) { | ||
self.view = view | ||
self.actions = actions | ||
self.dataProvider = dataProvider | ||
} | ||
|
||
public func update() { | ||
guard let view = view else { return } | ||
view.update() | ||
|
||
if pokemon() == nil { | ||
view.showNotFoundAlert() | ||
return | ||
} | ||
|
||
dataProvider.newSpecies() ? view.showLeaveOrCatchAlert() : view.showLeaveItAlert() | ||
} | ||
|
||
public func showError(message: String) { | ||
view?.showError(message: message) | ||
} | ||
|
||
public func pokemon() -> ScreenPokemon? { | ||
return dataProvider.pokemon() | ||
} | ||
|
||
public func catchPokemonAction() { | ||
actions.catchPokemon() | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
App/CatchUI/Sources/Scenes/Catch Scene/CatchViewController.storyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> | ||
<device id="retina4_7" orientation="portrait" appearance="light"/> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/> | ||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<scenes> | ||
<!--Catch View Controller--> | ||
<scene sceneID="Sf8-0k-iHG"> | ||
<objects> | ||
<viewController storyboardIdentifier="CatchViewController" id="6JY-wC-gpp" customClass="CatchViewController" customModule="CatchUI" customModuleProvider="target" sceneMemberID="viewController"> | ||
<view key="view" contentMode="scaleToFill" id="Ywu-gT-m6t"> | ||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<subviews> | ||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Background" translatesAutoresizingMaskIntoConstraints="NO" id="sf1-cg-uKF"> | ||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
</imageView> | ||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YzX-Yf-1Ql"> | ||
<rect key="frame" x="127.5" y="501" width="120" height="120"/> | ||
<accessibility key="accessibilityConfiguration" identifier="Catch"/> | ||
<constraints> | ||
<constraint firstAttribute="width" constant="120" id="OAM-Xw-BXP"/> | ||
<constraint firstAttribute="height" constant="120" id="mYr-ZQ-7iZ"/> | ||
</constraints> | ||
<state key="normal" image="Ball"/> | ||
<connections> | ||
<action selector="ballAction" destination="6JY-wC-gpp" eventType="touchUpInside" id="rKr-SQ-uLW"/> | ||
</connections> | ||
</button> | ||
</subviews> | ||
<viewLayoutGuide key="safeArea" id="ODG-Sk-nvn"/> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
<constraints> | ||
<constraint firstItem="sf1-cg-uKF" firstAttribute="trailing" secondItem="ODG-Sk-nvn" secondAttribute="trailing" id="1dX-3i-wrw"/> | ||
<constraint firstItem="YzX-Yf-1Ql" firstAttribute="centerX" secondItem="Ywu-gT-m6t" secondAttribute="centerX" id="9Cl-ly-hds"/> | ||
<constraint firstItem="ODG-Sk-nvn" firstAttribute="bottom" secondItem="YzX-Yf-1Ql" secondAttribute="bottom" constant="46" id="Lmf-vs-wPf"/> | ||
<constraint firstItem="sf1-cg-uKF" firstAttribute="top" secondItem="Ywu-gT-m6t" secondAttribute="top" id="UFT-Ev-VST"/> | ||
<constraint firstItem="sf1-cg-uKF" firstAttribute="leading" secondItem="ODG-Sk-nvn" secondAttribute="leading" id="XEf-aR-tOk"/> | ||
<constraint firstItem="sf1-cg-uKF" firstAttribute="bottom" secondItem="Ywu-gT-m6t" secondAttribute="bottom" id="orC-nU-Ixw"/> | ||
</constraints> | ||
</view> | ||
<connections> | ||
<outlet property="backgroundImageView" destination="sf1-cg-uKF" id="O1H-ss-w2w"/> | ||
<outlet property="button" destination="YzX-Yf-1Ql" id="Hw5-Yq-pvw"/> | ||
</connections> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="y3d-JN-ISV" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="293.60000000000002" y="-4.0479760119940034"/> | ||
</scene> | ||
</scenes> | ||
<resources> | ||
<image name="Background" width="800" height="480"/> | ||
<image name="Ball" width="600" height="600"/> | ||
</resources> | ||
</document> |
Oops, something went wrong.