Skip to content

Commit

Permalink
Distribution notifications fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostrenkiy committed May 20, 2016
1 parent c0d7ba4 commit eb72671
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
24 changes: 12 additions & 12 deletions Stepic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2234,8 +2234,8 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution: Ekaterina Chaykina (4562ZPB9BG)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Ekaterina Chaykina (L4RK2A4X6G)";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -2258,7 +2258,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PROVISIONING_PROFILE = "6b661861-fe87-47f8-86c7-55228acc23f1";
PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -2282,8 +2282,8 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution: Ekaterina Chaykina (4562ZPB9BG)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Ekaterina Chaykina (L4RK2A4X6G)";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
Expand All @@ -2298,7 +2298,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
PROVISIONING_PROFILE = "6b661861-fe87-47f8-86c7-55228acc23f1";
PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand All @@ -2311,15 +2311,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Stepic/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.AlexKarpov.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "1a14385f-6596-44bd-ac77-1b7b0904153a";
SWIFT_OBJC_BRIDGING_HEADER = "Stepic/Stepic-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
Expand All @@ -2331,15 +2331,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Stepic/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.AlexKarpov.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "1a14385f-6596-44bd-ac77-1b7b0904153a";
SWIFT_OBJC_BRIDGING_HEADER = "Stepic/Stepic-Bridging-Header.h";
};
name = Release;
Expand Down
5 changes: 4 additions & 1 deletion Stepic/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if StepicAPI.shared.isAuthorized {
NotificationRegistrator.sharedInstance.registerForRemoteNotifications(application)
}

if let notificationDict = launchOptions?[UIApplicationLaunchOptionsRemoteNotificationKey] as? [NSString: AnyObject] {
handleNotification(notificationDict)
}

// let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0]
// print(documentsPath)
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
"idiom" : "universal",
"filename" : "BoundedStepicIcon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down
2 changes: 1 addition & 1 deletion Stepic/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>0</string>
<string>3</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
1 change: 1 addition & 0 deletions Stepic/NotificationReactionHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class NotificationReactionHandler {
}

if let notificationObject : [String: AnyObject] = deserializeObject(from: userInfo) {
print(notificationObject)
if let notification = Notification(dictionary: notificationObject) {
switch notification.type {
case NotificationType.Learn:
Expand Down
6 changes: 4 additions & 2 deletions Stepic/NotificationRegistrator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ class NotificationRegistrator: NSObject {
// Start the GGLInstanceID shared instance with that config and request a registration
// token to enable reception of notifications
GGLInstanceID.sharedInstance().startWithConfig(instanceIDConfig)
registrationOptions = [kGGLInstanceIDRegisterAPNSOption:deviceToken,
kGGLInstanceIDAPNSServerTypeSandboxOption:true]
registrationOptions = [
kGGLInstanceIDRegisterAPNSOption : deviceToken,
kGGLInstanceIDAPNSServerTypeSandboxOption : false
]
GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(GGLContext.sharedInstance().configuration.gcmSenderID,
scope: kGGLInstanceIDScopeGCM, options: registrationOptions, handler: registrationHandler)
}
Expand Down

0 comments on commit eb72671

Please sign in to comment.