Skip to content

Commit 0db26da

Browse files
committed
(chore): Add PasswordResetViewModel
1 parent b07ae65 commit 0db26da

File tree

4 files changed

+106
-5
lines changed

4 files changed

+106
-5
lines changed

.github/workflows/dependencies.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
xcodebuild -resolvePackageDependencies
25-
swift package update
2625
2726
- name: Check for changes
2827
id: check_changes

ScribbleLab.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@
515515
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
516516
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
517517
MACOSX_DEPLOYMENT_TARGET = 14.5;
518-
MARKETING_VERSION = 1.0;
518+
MARKETING_VERSION = "0.1-alpha";
519519
PRODUCT_BUNDLE_IDENTIFIER = com.nhsystems.ScribbleLab;
520520
PRODUCT_NAME = "$(TARGET_NAME)";
521521
SDKROOT = auto;
@@ -669,7 +669,7 @@
669669
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
670670
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
671671
MACOSX_DEPLOYMENT_TARGET = 14.5;
672-
MARKETING_VERSION = 1.0;
672+
MARKETING_VERSION = "0.1-beta";
673673
PRODUCT_BUNDLE_IDENTIFIER = com.nhsystems.ScribbleLab;
674674
PRODUCT_NAME = "$(TARGET_NAME)";
675675
SDKROOT = auto;
@@ -877,7 +877,7 @@
877877
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
878878
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
879879
MACOSX_DEPLOYMENT_TARGET = 14.5;
880-
MARKETING_VERSION = 1.0;
880+
MARKETING_VERSION = "0.1-dev";
881881
PRODUCT_BUNDLE_IDENTIFIER = com.nhsystems.ScribbleLab;
882882
PRODUCT_NAME = "$(TARGET_NAME)";
883883
SDKROOT = auto;
@@ -922,7 +922,7 @@
922922
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
923923
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
924924
MACOSX_DEPLOYMENT_TARGET = 14.5;
925-
MARKETING_VERSION = 1.0;
925+
MARKETING_VERSION = 0.1;
926926
PRODUCT_BUNDLE_IDENTIFIER = com.nhsystems.ScribbleLab;
927927
PRODUCT_NAME = "$(TARGET_NAME)";
928928
SDKROOT = auto;

ScribbleLab/App/Launch.storyboard

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<device id="retina6_12" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
6+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
7+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
8+
</dependencies>
9+
<scenes>
10+
<!--View Controller-->
11+
<scene sceneID="EHf-IW-A2E">
12+
<objects>
13+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
14+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
15+
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
16+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
17+
<subviews>
18+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
19+
<rect key="frame" x="0.0" y="832" width="393" height="0.0"/>
20+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
21+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
22+
<nil key="highlightedColor"/>
23+
</label>
24+
</subviews>
25+
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
26+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
27+
<constraints>
28+
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
29+
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
30+
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
31+
</constraints>
32+
</view>
33+
</viewController>
34+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
35+
</objects>
36+
<point key="canvasLocation" x="53" y="375"/>
37+
</scene>
38+
</scenes>
39+
</document>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//
2+
// SignInViewModel.swift
3+
// ScribbleLab · Authentication
4+
//
5+
// Copyright (c) 2024 ScribbleLabApp LLC. - All rights reserved.
6+
//
7+
// Redistribution and use in source and binary forms, with or without
8+
// modification, are permitted provided that the following conditions are met:
9+
//
10+
// 1. Redistributions of source code must retain the above copyright notice, this
11+
// list of conditions and the following disclaimer.
12+
//
13+
// 2. Redistributions in binary form must reproduce the above copyright notice,
14+
// this list of conditions and the following disclaimer in the documentation
15+
// and/or other materials provided with the distribution.
16+
//
17+
// 3. Neither the name of the copyright holder nor the names of its
18+
// contributors may be used to endorse or promote products derived from
19+
// this software without specific prior written permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
32+
import Combine
33+
import Foundation
34+
import Firebase
35+
import FirebaseAuth
36+
import ScribbleFoundation
37+
38+
class ResetPasswordViewModel: ObservableObject {
39+
@Published var email: String = ""
40+
@Published var errorString: String?
41+
@Published var isAlertShown: Bool = false
42+
43+
@MainActor
44+
func resetPasswordHandler() {
45+
SCIDAuthService.resetPassword(email: email) { [weak self] res in
46+
guard let self = self else { return }
47+
48+
DispatchQueue.main.async {
49+
switch res {
50+
case .failure(let error):
51+
ScribbleLabApp().logger.error(
52+
"Failed to reset password with error \(error.localizedDescription)"
53+
)
54+
self.errorString = error.localizedDescription
55+
self.isAlertShown = true
56+
case .success:
57+
ScribbleLabApp().logger.log("Password reset succeeded")
58+
self.isAlertShown = true
59+
}
60+
}
61+
}
62+
}
63+
}

0 commit comments

Comments
 (0)