@@ -41,7 +41,7 @@ final public class Studyplus {
4141
4242 StudyplusSDKのバージョンを返します
4343 */
44- public static let SDKVersion : String = " 1.3.6 "
44+ public static let SDKVersion : String = " 2.0.0 "
4545
4646 /**
4747 Returns the shared defaults object.
@@ -75,25 +75,16 @@ final public class Studyplus {
7575 see StudyplusLoginDelegate protocol
7676 */
7777 public weak var delegate : StudyplusLoginDelegate ?
78-
79- /**
80- When set to true, if Studyplus is not installed, AppStore starts when auth/login methods are called.
81-
82- trueの場合、auth、loginメソッドを呼び出したとき、StudyplusアプリがインストールされていなければAppStoreを起動します。
83- */
84- public var openAppStoreIfNotInstalled : Bool = true
8578
8679 private let accessTokenStoreKey : String = " accessToken "
8780 private let usernameStoreKey : String = " username "
8881
8982 /// Opens the login screen by invoking the Studyplus application.
90- /// If Studyplus app is not installed and openAppStoreIfNotInstalled is true, then open the Studyplus page in AppStore.
91- /// If openAppStoreIfNotInstalled is false, do nothing.
83+ /// If Studyplus app is not installed, open the Studyplus page in AppStore.
9284 /// After the process has returned from Studyplus application, delegate method will be called back.
9385 ///
9486 /// Studyplusアプリを起動してStudyplusログイン画面を開きます。
95- /// Studyplusアプリがインストールされていない場合、 openAppStoreIfNotInstalled が true であれば、AppStore を起動して Studyplus を開きます。
96- /// openAppStoreIfNotInstalled が false であれば何もしません。
87+ /// Studyplusアプリがインストールされていない場合、AppStore を起動して Studyplus を開きます。
9788 /// Studyplusアプリから操作が戻ってきた後、delegateオブジェクトのコールバックメソッドを呼び出します。
9889 public func login( ) {
9990 openStudyplus ( command: " auth " )
@@ -299,20 +290,18 @@ final public class Studyplus {
299290
300291 private func openStudyplus( command: String ) {
301292
293+ guard UIApplication . shared. canOpenURL ( URL ( string: " studyplus:// " ) !) else {
294+ let appStoreURLString : String = " https://apps.apple.com/jp/app/id505410049?mt=8 "
295+ guard let appStoreURL = URL ( string: appStoreURLString) else { return }
296+ applicationOpen ( appStoreURL)
297+ return
298+ }
299+
302300 let urlString : String = " studyplus://external_app/ " + command + " / " + consumerKey + " / " + consumerSecret
303301
304302 if let url = URL ( string: urlString) {
305303
306304 applicationOpen ( url)
307-
308- } else {
309-
310- if self . openAppStoreIfNotInstalled {
311-
312- let appStoreURLString : String = " https://apps.apple.com/jp/app/id505410049?mt=8 "
313- guard let appStoreURL = URL ( string: appStoreURLString) else { return }
314- applicationOpen ( appStoreURL)
315- }
316305 }
317306 }
318307
0 commit comments