Skip to content

Commit 632ed99

Browse files
authored
Merge pull request #13 from studyplus/add_duration_checker
StudyplusRecordのdurationプロパティへ24時間上限を追加
2 parents d7c8496 + 42b54be commit 632ed99

File tree

6 files changed

+27
-3
lines changed

6 files changed

+27
-3
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
1.3.1 Release notes (2019-06-17)
2+
=============================================================
3+
4+
### API Breaking Changes
5+
6+
* None.
7+
8+
### Enhancements
9+
10+
* added lower than 24 hours validation when post study record.
11+
12+
### Bugfixes
13+
14+
* None.
15+
116
1.3.0 Release notes (2019-04-09)
217
=============================================================
318

Demo/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.3.0</string>
18+
<string>1.3.1</string>
1919
<key>CFBundleURLTypes</key>
2020
<array>
2121
<dict>

StudyplusSDK-V2.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "StudyplusSDK-V2"
3-
s.version = "1.3.0"
3+
s.version = "1.3.1"
44
s.summary = "StudyplusSDK-V2 is Studyplus iOS SDK for Swift"
55
s.homepage = "http://info.studyplus.jp"
66
s.license = { :type => "MIT", :file => "LICENSE" }

StudyplusSDK/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.3.0</string>
18+
<string>1.3.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

StudyplusSDK/Studyplus.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ final public class Studyplus {
152152
/// - failure: callback when failure to post the studyRecord
153153
public func post(studyRecord: StudyplusRecord, success: @escaping () -> Void, failure: @escaping (_ error: StudyplusError) -> Void) {
154154

155+
guard StudyplusRecord.durationRange ~= Int(studyRecord.duration) else {
156+
failure(.postRecordFailed)
157+
return
158+
}
159+
155160
if !self.isConnected() {
156161
failure(.notConnected)
157162
return

StudyplusSDK/StudyplusRecord.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ private extension Date {
6969
Studyplusに投稿する一件の勉強記録を表現するクラスです。
7070
*/
7171
public struct StudyplusRecord {
72+
73+
static let durationRange = 0...(24 * 60 * 60)
7274

7375
/**
7476
The seconds of the learning.
@@ -102,6 +104,8 @@ public struct StudyplusRecord {
102104
///
103105
/// - Parameters:
104106
/// - duration: Specify the seconds of the learning. 勉強した時間(秒数)を指定してください。
107+
/// - min: 0
108+
/// - max: 86400 (24h)
105109
/// - recordedAt: Time the learning is ended. 学習を終えた日時。
106110
/// - amount: The amount of learning. 学習量。
107111
/// - comment: Studyplus timeline comment. Studyplusのタイムライン上で表示されるコメント。

0 commit comments

Comments
 (0)